bridge

Bridge v2 API -- available on ws://127.0.0.1:9878 (configurable). These are separate from the editor's JSON-RPC methods on :9877.

← API Reference

bridge.ping

Ping the bridge server.

No parameters.

Returns

Field Type Description
versionstringBridge version
statusstringAlways "ok"
uptimenumberUptime in seconds

Example Response

{
  "version": "2.2.0",
  "status": "ok",
  "uptime": 123.45
}

bridge.prompt

Send a user message to Claude via the Agent SDK.

Name Type Required Description
messagestringYesThe user message
sessionIdstringNoResume a previous session
systemPromptstringNoOverride the system prompt

Returns

Field Type Description
contentstringThe assistant response
sessionIdstringSession identifier for continuation

Side Effects: Emits streaming bridge.event notifications during execution.

Example Request

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "bridge.prompt",
  "params": { "message": "Spawn a cube at the origin" }
}

Example Response

{
  "content": "Here's what I found...",
  "sessionId": "abc-123"
}

bridge.interrupt

Abort the current Claude generation.

No parameters.

Returns

{ "ok": true }

bridge.permission.respond

Respond to a tool permission request.

Name Type Required Description
requestIdstringYesThe permission request ID
approvedbooleanYesWhether to allow the tool

Returns

{ "ok": true }

bridge.state

Get the current bridge state.

No parameters.

Returns

Field Type Description
connectedbooleanWhether the bridge is connected

Example Response

{
  "connected": true
}

bridge.listModels

Fetch available Claude models from the Anthropic API.

No parameters.

Returns

Field Type Description
modelsarrayEach: {id, displayName, createdAt}
currentModelstringCurrently configured model ID

Example Response

{
  "models": [
    { "id": "claude-sonnet-4-20250514", "displayName": "Claude Sonnet 4", "createdAt": "2025-05-14" },
    { "id": "claude-opus-4-20250514", "displayName": "Claude Opus 4" }
  ],
  "currentModel": "claude-sonnet-4-20250514"
}

Errors: Returns -32603 if no ANTHROPIC_API_KEY is configured.


bridge.updateConfig

Update bridge configuration at runtime. Only provided fields are changed.

Name Type Required Description
modelstringNoNew Claude model ID
claudeMdPathstringNoPath to CLAUDE.md project instructions
memoryDirstringNoPath to directory of .md memory files

Returns

{
  "ok": true,
  "model": "claude-opus-4-20250514"
}

bridge.updatePermissions

Update the bridge's allowed tool patterns at runtime. Previously auto-approved tools can be changed without restarting the bridge.

Name Type Required Description
allowedToolsstring[]YesTool name patterns (e.g. "mcp__agentux__*", "Bash")

Returns

{
  "ok": true,
  "toolCount": 3
}

Notifications

The bridge sends JSON-RPC notifications with method bridge.event. The params object always contains a type field.

token

{ "type": "token", "text": "Hello" }

message

{ "type": "message", "role": "assistant", "content": "Full response text" }

state

{ "type": "state", "state": "thinking" }

States: idle, thinking, streaming, tool_use, permission_required, error

error

{ "type": "error", "message": "Something went wrong", "code": -32000 }

permission_request

{
  "type": "permission_request",
  "requestId": "uuid",
  "toolName": "Bash",
  "toolInput": { "command": "ls" },
  "description": "Tool: Bash"
}

permission_resolved

{ "type": "permission_resolved", "requestId": "uuid", "approved": true }

tool_use

{ "type": "tool_use", "toolName": "agentux_raw", "toolInput": { "method": "editor.actor.spawn" } }

tool_result

{ "type": "tool_result", "toolName": "agentux_raw", "result": "{\"name\":\"MyCube\"}" }

session

{ "type": "session", "sessionId": "abc-123" }

usage

Emitted after each Claude response with token counts and cost.

{
  "type": "usage",
  "inputTokens": 1500,
  "outputTokens": 800,
  "totalCostUsd": 0.0042,
  "durationMs": 3200.0
}