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.
bridge.ping
Ping the bridge server.
No parameters.
Returns
| Field | Type | Description |
|---|---|---|
version | string | Bridge version |
status | string | Always "ok" |
uptime | number | Uptime 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 |
|---|---|---|---|
message | string | Yes | The user message |
sessionId | string | No | Resume a previous session |
systemPrompt | string | No | Override the system prompt |
Returns
| Field | Type | Description |
|---|---|---|
content | string | The assistant response |
sessionId | string | Session 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 |
|---|---|---|---|
requestId | string | Yes | The permission request ID |
approved | boolean | Yes | Whether to allow the tool |
Returns
{ "ok": true } bridge.state
Get the current bridge state.
No parameters.
Returns
| Field | Type | Description |
|---|---|---|
connected | boolean | Whether the bridge is connected |
Example Response
{
"connected": true
} bridge.listModels
Fetch available Claude models from the Anthropic API.
No parameters.
Returns
| Field | Type | Description |
|---|---|---|
models | array | Each: {id, displayName, createdAt} |
currentModel | string | Currently 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 |
|---|---|---|---|
model | string | No | New Claude model ID |
claudeMdPath | string | No | Path to CLAUDE.md project instructions |
memoryDir | string | No | Path 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 |
|---|---|---|---|
allowedTools | string[] | Yes | Tool 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
}