Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Bridge protocol

A bridge is a program a brnr process starts from its profile’s bridges (configuration): it writes requests to its stdout, and reads the replies and the events from its stdin. Its stderr goes to the host log. An external client can instead connect to the control socket, $BRNR_DIR/<pid>.sock, and speak the same protocol. Access is limited by the private runtime directory: this is a local control interface, not an HTTP service, nor a sandbox boundary against other programs of the same user.

Covered from 1.0.0: the protocol as a bridge brnr starts from a profile speaks it, on its stdout and stdin: each cmd, its fields and its reply, the events, and how long the bridge lasts; and BRNR_PID in its environment. Not covered: the control socket, which is in the private runtime directory and is not an interface: its path, how processes and their metadata files are found, and a client that connects to it itself, which speaks this protocol today but has no promise and can change in any release; BRNR_SOCKET; and the wording of an error’s message.

Requests and replies

A request is one UTF-8 JSON object, then a newline. A reply is one too, matched to its request by req_id: replies to requests the agent answers can come later, and events come between replies. A line that isn’t JSON gets an error reply; a request of more than 32 MiB is answered with an error, and the peer is cut off. Handle EOF and a closed connection, rather than wait for ever. The examples below show a long reply across lines; on the wire each is one line.

FieldTypeMeaning
cmdstringThe request: one of the sections below.
req_idanyOptional. Echoed, as given, in the reply. Use a unique one.
okbooleanIn every reply: true for success.
errorobject, optionalIn a failed reply, ok false: {code, message}, an error. Not there otherwise.
error.codestringThe error code.
error.messagestringWhat failed, for people. Not covered.

A cmd the process doesn’t have, or a field the section doesn’t list for it, is refused with command_unknown, and nothing is done: a process can be an older brnr than the one that wrote the request (an editor’s lives as long as the editor’s session), and does a request as asked or not at all. A field of the wrong type, or one missing, is command_invalid. CLI --json results leave out ok and req_id.

{"cmd":"cancel","session":"sess-9","req_id":"r2"}
{
  "ok": false,
  "error": {
    "code": "session_not_found",
    "message": "no session sess-9"
  },
  "req_id": "r2"
}

A request about a session needs the exact id of a session this process serves; one that is closing or opening takes none (session_closing, session_opening). What the agent can’t do, what strict mode refuses, and an action an editor’s profile doesn’t enable are errors (capability_missing, strict_mode_refused, experimental_disabled). On an editor’s session, every request that acts on it (send, cancel, queue’s clear_context, allow, reject, elicitation, set_config and close) is experimental: refused unless the profile enables it (ADR 7.1). Bridges observe it freely. stop is process management, not an experimental action.

Versions

A process says what it is in status (and its metadata file): brnr, its version as brnr --version prints it, and protocol, the version of what the socket speaks. protocol grows by one with each release that adds a request, a field or an event, and only grows within a major version. The CLI compares it with its own, and an error that may come of a difference says which brnr the process is, and how to restart it: a headless one with brnr process stop <pid> and brnr session resume <session>, an editor’s from the editor (ADR 8.8).

Events and how long a bridge lasts

  • A started bridge is subscribed from the start, to every event but acp unless its profile’s events chooses. A socket client gets events once it sends subscribe. Bridge events take event names, not --events’s default.
  • Read continuously. A peer 16 MiB behind is cut off: a connection is closed, a started bridge is sent SIGTERM. The host log’s peer_dropped says so, with last_queued_seq, and the other peers get peer_cut_off. A socket client catches up: it connects again, asks was_cut_off, sends subscribe again (its seq is where live events start), sends logged, and reads the process’s records between its last event’s seq and that one from the transcript (the host log names each session’s files), as brnr’s own commands do. A started bridge can’t.
  • When its process stops, a started bridge gets the last events, then EOF on its stdin. It should exit on EOF: it is sent SIGTERM if it still runs 2 s later.
  • A started bridge’s stdout closing ends its requests, not its events.
  • When a reader falls behind has the 16 MiB queue, long lines and the foreground’s skipped events.

status

The process’s full report: its metadata, its state, and each session’s.

Request: no fields.

Reply:

FieldTypeMeaning
idstringThe process’s pid, as text.
host_idstringIts run, <started>-<pid>.
brnrstringbrnr’s version, as brnr --version prints it.
protocolnumberThe protocol’s version.
profilestring or nullThe profile it started with; null for none.
host_pidnumberThe process.
proxy_pidnumber or nullAn editor’s brnr acp; null headless.
agent_pidnumber or nullThe agent’s process.
agentlist of stringsThe agent’s command, as the profile’s agent has it.
cwdstringWhere it started.
host_logstringIts host log.
socketstringIts control socket. Not covered.
startedstringWhen it started.
capabilitiesobjectWhat the agent advertised, as booleans.
capabilities.resumebooleansession/resume.
capabilities.loadbooleansession/load.
capabilities.listbooleansession/list.
capabilities.forkbooleansession/fork.
capabilities.closebooleansession/close.
capabilities.imagebooleanImages in a prompt.
capabilities.steeringboolean_session/steering.
capabilities.mcp_httpbooleanMCP servers over HTTP.
capabilities.mcp_ssebooleanMCP servers over SSE.
agent_infoobject or null, ACP’sThe agent’s agentInfo from initialize, as it sent it; null without one.
ownerstringeditor or headless.
pending_countnumberApprovals waiting, in all its sessions.
elicitation_countnumberElicitations waiting, outside a session too.
uptimenumberSeconds since it started.
stop_when_idlenumber or nullIts idle timeout in seconds; null for none.
startingbooleanUntil its first session commits.
stoppingbooleanWhether it is stopping.
closinglist of stringsThe sessions it has closed, or failed to open, and holds the locks of until their records are written (ADR 5.5).
bridgeslist of stringsIts started bridges’ names.
sessionslist of objectsIts sessions.
sessions[].sessionstringThe session’s id.
sessions[].statestringidle, busy or waiting.
sessions[].busybooleanWhether a turn runs.
sessions[].titlestring or nullIts title.
sessions[].modestring or nullIts current mode.
sessions[].modesobject or null, ACP’sACP’s v1 modes, as the agent gave them.
sessions[].modelstring or nullIts current model.
sessions[].configlist or null, ACP’sACP’s config options, as the agent gave them.
sessions[].commandslist or null, ACP’sACP’s available commands, as the agent gave them.
sessions[].planlist or null, ACP’sThe last plan’s entries.
sessions[].usageobject or nullThe last usage, as usage has it.
sessions[].toolslist of objectsThe running tool calls, as tool_call has them.
sessions[].last_messagestring or nullThe agent’s last message, at most 4000 characters of it.
sessions[].last_activestringWhen it last had an event.
sessions[].cwdstringIts working directory.
sessions[].forked_fromstring or nullThe session it was forked from, where this process knows it.
sessions[].turn_elapsednumber or nullSeconds the running turn has run.
sessions[].promptsnumberPrompts the agent hasn’t answered.
sessions[].held_countnumberMessages held.
sessions[].context_countnumberContext entries held.
sessions[].pending_countnumberApprovals waiting.
sessions[].elicitation_countnumberElicitations waiting.
sessions[].sharedbooleanWhether it serves the session without its lock.
sessions[].lock_errorstring or nullWhy it has no lock on it.
sessions[].last_turnobject or nullHow its last turn ended, as session status has it.
sessions[].last_turn.stop_reasonstring or nullAs turn_ended has it.
sessions[].last_turn.errorobject or nullAs turn_ended has it.
sessions[].last_turn.tokensobject or nullAs turn_ended has it.
sessions[].events_logstring or nullIts events file; null when not kept (log = "off").
sessions[].acp_logstring or nullIts raw ACP file; null when not kept.
{"cmd":"status","req_id":"r1"}
{
  "id": "4466",
  "host_id": "20261023T150820-4466",
  "brnr": "0.10.0",
  "protocol": 1,
  "profile": null,
  "host_pid": 4466,
  "proxy_pid": null,
  "agent_pid": 4468,
  "agent": [
    "brnr-claude-adapter"
  ],
  "cwd": "/home/me/project",
  "host_log": "/home/me/.brnr/hosts/20261023T150820-4466.jsonl",
  "socket": "/run/user/1000/brnr/4466.sock",
  "started": "2026-10-23T15:08:20.323457Z",
  "capabilities": {
    "resume": true,
    "load": true,
    "list": true,
    "fork": true,
    "close": true,
    "image": true,
    "steering": true,
    "mcp_http": true,
    "mcp_sse": false
  },
  "agent_info": {
    "name": "fake-agent",
    "version": "1.2.3"
  },
  "ok": true,
  "owner": "headless",
  "pending_count": 0,
  "elicitation_count": 0,
  "uptime": 0,
  "stop_when_idle": null,
  "starting": false,
  "stopping": false,
  "closing": [],
  "bridges": [
    "slack-bridge#0"
  ],
  "sessions": [
    {
      "title": "Fake session",
      "mode": "default",
      "modes": {
        "currentModeId": "default",
        "availableModes": [
          {
            "id": "default",
            "name": "Default",
            "description": "Asks before edits"
          },
          {
            "id": "plan",
            "name": "Plan",
            "description": "Plans, doesn't edit"
          }
        ]
      },
      "model": "small",
      "config": [
        {
          "id": "model",
          "name": "Model",
          "type": "select",
          "currentValue": "small",
          "options": [
            {
              "value": "small",
              "name": "Small"
            },
            {
              "value": "large",
              "name": "Large"
            }
          ],
          "category": "model"
        }
      ],
      "commands": [
        {
          "name": "compact",
          "description": "Compact the conversation"
        }
      ],
      "plan": null,
      "usage": null,
      "tools": [],
      "last_message": "hi",
      "session": "sess-1",
      "state": "idle",
      "last_active": "2026-10-23T15:08:20.532866Z",
      "cwd": "/home/me/project",
      "forked_from": null,
      "busy": false,
      "turn_elapsed": null,
      "prompts": 0,
      "held_count": 0,
      "context_count": 0,
      "pending_count": 0,
      "elicitation_count": 0,
      "shared": false,
      "lock_error": null,
      "last_turn": {
        "stop_reason": "end_turn",
        "error": null,
        "tokens": null
      },
      "events_log": "/home/me/.brnr/projects/-home-me-project-abd1481c/sess-1.jsonl",
      "acp_log": "/home/me/.brnr/projects/-home-me-project-abd1481c/sess-1.acp.jsonl"
    }
  ],
  "req_id": "r1"
}

start_request

The request the process was started with, as its host log’s process_started record has it, secrets redacted, without the prompt and foreground: what profile show --pid prints (ADR 6.5).

Request: no fields.

Reply:

FieldTypeMeaning
start_requestobjectWhat the process was started with, as its host log’s process_started record has it, without the prompt and foreground.
start_request.profilestring or nullThe profile’s name; null where none was given.
start_request.agentlist of stringsThe agent’s command as it was run.
start_request.cwdstringThe directory the process started in.
start_request.strictbooleanStable ACP only.
start_request.logstringWhat it records.
start_request.bridgeslist of objectsThe bridges, each command as it was run.
start_request.bridges[].commandstringThe program.
start_request.bridges[].argslist of stringsIts arguments.
start_request.bridges[].eventslist of strings or nullThe events it gets; null: every event but acp.
start_request.retentionnumber or nullThe config’s retention.
start_request.roleobjectheadless or editor, with what that role was started with.
start_request.role.headlessobject, optionalA headless process’s.
start_request.role.headless.resumestring or nullThe session it resumed.
start_request.role.headless.transcriptbooleanWhether brnr had the resumed session’s transcript.
start_request.role.headless.settingsobjectWhat the start’s flags set: mode, model, thought_level, options.
start_request.role.headless.settings.modestring or null--mode.
start_request.role.headless.settings.modelstring or null--model.
start_request.role.headless.settings.thought_levelstring or null--thought-level.
start_request.role.headless.settings.optionsobject--option, by id.
start_request.role.headless.defaultsobjectWhat the profile set, the same fields: the flags win over it.
start_request.role.headless.defaults.modestring or nullThe profile’s mode.
start_request.role.headless.defaults.modelstring or nullThe profile’s model.
start_request.role.headless.defaults.thought_levelstring or nullThe profile’s thought_level.
start_request.role.headless.defaults.optionsobjectThe profile’s options.
start_request.role.headless.mcp_serverslist of objects, ACP’sThe MCP servers as session/new sends them, the values of env and headers <redacted>.
start_request.role.headless.authstring or nullThe login method.
start_request.role.headless.eventslist of stringsThe events the start followed its first turn by (--wait).
start_request.role.headless.start_timeoutnumberSeconds the start had.
start_request.role.headless.stop_when_idlenumber or nullSeconds until an idle session is closed.
start_request.role.headless.response_timeoutnumber or nullSeconds an approval or elicitation waits.
start_request.role.editorobject, optionalAn editor’s process’s.
start_request.role.editor.proxy_pidnumberThe brnr acp process.
start_request.role.editor.sigmasklist of numbersThe editor’s signal mask, which the agent got.
start_request.role.editor.experimentallist of stringsThe experimental actions enabled.
start_request.role.editor.client_capabilitieslist of stringsThe editor’s capabilities that reach the agent.
start_request.role.editor.echo_asstringHow a message sent through brnr is shown to the editor.
start_request.role.editor.featureslist of stringsThe process-management features enabled.
{"cmd":"start_request","req_id":"r1"}
{
  "ok": true,
  "req_id": "r1",
  "start_request": {
    "profile": null,
    "agent": [
      "/opt/homebrew/bin/brnr-claude-adapter"
    ],
    "cwd": "/home/me/project",
    "strict": false,
    "log": "all",
    "bridges": [],
    "retention": null,
    "role": {
      "headless": {
        "resume": null,
        "transcript": false,
        "settings": {
          "mode": null,
          "model": null,
          "thought_level": null,
          "options": {}
        },
        "defaults": {
          "mode": null,
          "model": null,
          "thought_level": null,
          "options": {}
        },
        "mcp_servers": [],
        "auth": null,
        "events": [
          "agent_message",
          "turn_ended"
        ],
        "start_timeout": 120,
        "stop_when_idle": null,
        "response_timeout": null
      }
    }
  }
}

logged

Answered once what the process recorded before it was asked is in its transcript, which another thread writes.

Request: no fields.

Reply:

FieldTypeMeaning
lostbooleantrue when a file has lost records it hasn’t noted yet (a full disk): look for the gaps and errors recorded.
{"cmd":"logged","req_id":"r1"}
{"ok":true,"req_id":"r1","lost":false}

send

Sends a message to a session, as prompt send does. An accepted send is not a turn that has ended: subscribe, and match its message with turn_ended’s messages or message_dropped’s message.

Request:

FieldTypeMeaning
sessionstringThe session.
textstringThe text. It or blocks is needed.
blockslist of objects, ACP’sACP content blocks to add: text, resource_link (uri), image (data, mimeType).
modestringprompt (the default), steer, interrupt or context. context is text only.
replacebooleanWith context: replace the last entry.

Reply:

FieldTypeMeaning
statusstringdelivered, held, steered or interrupting; held for context.
sessionstringThe session.
messagestring, optionalThe message’s id. Not there for context, which has none.
{"cmd":"send","session":"sess-1","text":"also update the changelog","req_id":"r1"}
{"ok":true,"status":"held","session":"sess-1","message":"m2","req_id":"r1"}

cancel

Cancels the running turn, as prompt cancel does.

Request:

FieldTypeMeaning
sessionstringThe session.
keep_heldbooleanKeep the held messages.

Reply:

FieldTypeMeaning
statusstringcancelling or idle.
sessionstringThe session.
droppedlist of objectsThe messages dropped, {message, text, reason}.
{"cmd":"cancel","session":"sess-1","req_id":"r1"}
{"ok":true,"status":"cancelling","session":"sess-1","dropped":[],"req_id":"r1"}

queue

The held messages and context, after what was asked was dropped, as the queue commands print them; or, with show, one held message in full, as queue show prints it.

Request:

FieldTypeMeaning
sessionstringThe session.
dropstringA held message’s id, to drop.
clearbooleanDrop every held message.
clear_contextbooleanDrop the held context.
showstringA held message’s id, to show; alone. One that isn’t an id is refused.

Reply: without show, session, held, context and dropped, as queue has them; with show, session, message, text, interrupt, attachments and blocks, as queue show has them.

FieldTypeMeaning
sessionstringThe session.
heldlist of objectsThe held messages, {message, text, interrupt, attachments}.
contextlist of stringsThe held context.
droppedlist of objectsThe messages dropped, {message, text, reason}.

With show:

FieldTypeMeaning
sessionstringThe session.
messagestringThe message’s id.
textstringIts text.
interruptbooleanWhether it is an interrupt.
attachmentsnumberHow many attachments it has.
blockslist of objects, ACP’sIts attachments, as the ACP content blocks that go with the prompt, as queue show has them.
{"cmd":"queue","session":"sess-1","req_id":"r1"}
{"ok":true,"session":"sess-1","held":[],"context":[],"dropped":[],"req_id":"r1"}

subscribe

Events follow on this connection. Selection is the process’s: filter sessions on the client.

Request:

FieldTypeMeaning
eventslist of strings, "all" or null, optionalThe events. Not there, or null: every event but acp; "all": every event; an empty list: none. A note’s name is refused (event_unknown).

Reply:

FieldTypeMeaning
eventslist of stringsThe events subscribed to.
unknown_eventslist of stringsThe names asked for that this process doesn’t have (a newer brnr’s), left out of the subscription.
peerstringThis connection’s name, socket#7.
host_idstringThe process’s run.
pidnumberThe process.
seqnumberThe last event’s position before the subscription.
{"cmd":"subscribe","events":["turn_ended","tool_dance"],"req_id":"r1"}
{
  "ok": true,
  "events": [
    "turn_ended"
  ],
  "unknown_events": [
    "tool_dance"
  ],
  "peer": "socket#2",
  "host_id": "20261023T150820-4466",
  "pid": 4466,
  "seq": 14,
  "req_id": "r1"
}

was_cut_off

Whether the process cut a connection off for falling behind, of its last 64 cut-offs: a position only, never an event. Catch up from the transcript (ADR 10.2).

Request:

FieldTypeMeaning
peerstringA connection’s name, as subscribe gave it.

Reply:

FieldTypeMeaning
peerstringThe connection.
cut_offbooleanWhether it was cut off.
last_queued_seqnumber or nullThe last position queued for it then; null if it wasn’t.
{"cmd":"was_cut_off","peer":"socket#7","req_id":"r1"}
{"ok":true,"peer":"socket#7","cut_off":false,"last_queued_seq":null,"req_id":"r1"}

pending

The approvals and elicitations waiting in this process, in full.

Request: no fields.

Reply:

FieldTypeMeaning
pendinglist of objectsThe approvals, as permission show --json prints them.
pending[].requeststringAs permission show has it.
pending[].sessionstringAs permission show has it.
pending[].ownerstringAs permission show has it.
pending[].answerablebooleanAs permission show has it.
pending[].why_notstring or nullAs permission show has it.
pending[].titlestring or nullAs permission show has it.
pending[].kindstring or nullAs permission show has it.
pending[].tool_callobject, ACP’sAs permission show has it.
pending[].optionslist of objects, ACP’sAs permission show has it.
pending[].timeout_leftnumber or nullAs permission show has it.
elicitationslist of objectsThe elicitations, as elicitation show --json prints them, each with the process’s pid.
{"cmd":"pending","req_id":"r1"}
{
  "ok": true,
  "pending": [
    {
      "request": "p1",
      "session": "sess-1",
      "owner": "headless",
      "answerable": true,
      "why_not": null,
      "title": "Edit src/lib.rs",
      "kind": "edit",
      "tool_call": {
        "toolCallId": "perm-1",
        "title": "Edit src/lib.rs",
        "kind": "edit",
        "locations": [
          {
            "path": "src/lib.rs",
            "line": 2
          }
        ],
        "rawInput": {
          "file_path": "src/lib.rs"
        },
        "content": [
          {
            "type": "diff",
            "path": "src/lib.rs",
            "oldText": "one\nold line\nthree\n",
            "newText": "one\nnew line\nthree\n"
          }
        ]
      },
      "options": [
        {
          "optionId": "allow",
          "name": "Allow",
          "kind": "allow_once"
        },
        {
          "optionId": "reject",
          "name": "Reject",
          "kind": "reject_once"
        }
      ],
      "timeout_left": null
    }
  ],
  "elicitations": [],
  "req_id": "r1"
}

allow, reject

Answers an approval, as permission allow and reject do.

Request:

FieldTypeMeaning
sessionstringThe session.
requeststringThe handle, p1.
alwaysbooleanThe always kind.
option_idstringThe option’s optionId, in place of a kind. Anything but a string, null too, is refused (command_invalid). Its old name, option, is a field allow doesn’t take (command_unknown).

Reply:

FieldTypeMeaning
sessionstringThe session.
requeststringThe handle.
outcomeobject, ACP’sACP’s outcome, as sent.
{"cmd":"allow","session":"sess-1","request":"p1","req_id":"r1"}
{
  "ok": true,
  "session": "sess-1",
  "request": "p1",
  "outcome": {
    "outcome": "selected",
    "optionId": "allow"
  },
  "req_id": "r1"
}

elicitation

Answers an elicitation with ACP’s action, as elicitation accept and the others do.

Request:

FieldTypeMeaning
sessionstring or nullThe session; null for one outside any session.
requeststringThe handle, e1.
actionstringaccept, decline or cancel.
contentobjectFor a form’s accept: its fields, checked against its schema before anything is sent.

Reply:

FieldTypeMeaning
sessionstring or nullThe session.
requeststringThe handle.
resultobject, ACP’sThe response sent to the agent: action, and an accept’s content.
{"cmd":"elicitation","session":"sess-1","request":"e1","action":"decline","req_id":"r1"}
{"ok":true,"session":"sess-1","request":"e1","result":{"action":"decline"},"req_id":"r1"}

set_config

Sets a session’s settings, as config set does: resolved and sent the same way, and answered once all are set, or with the first failure, which names what was already set.

Request:

FieldTypeMeaning
sessionstringThe session.
modestringThe mode.
modelstringThe model.
thought_levelstringThe thought level.
optionsobjectOption ids to values, strings.

At least one of mode, model, thought_level and options is needed.

Reply:

FieldTypeMeaning
sessionstringThe session.
setlist of objectsEach setting sent, {option, category, value}, as config set has them.
set[].optionstring or nullAs config set has it.
set[].categorystring or nullAs config set has it.
set[].valuestringAs config set has it.
modestring or nullThe current mode.
configlist or null, ACP’sThe agent’s config options now, as ACP has them.
{"cmd":"set_config","session":"sess-1","model":"large","req_id":"r1"}
{
  "ok": true,
  "session": "sess-1",
  "set": [
    {
      "option": "model",
      "category": "model",
      "value": "large"
    }
  ],
  "mode": "default",
  "config": [
    {
      "id": "model",
      "name": "Model",
      "type": "select",
      "currentValue": "large",
      "options": [
        {
          "value": "small",
          "name": "Small"
        },
        {
          "value": "large",
          "name": "Large"
        }
      ],
      "category": "model"
    }
  ],
  "req_id": "r1"
}

fork

Forks a session into a new one in this process, as session fork does. Never in an editor’s process.

Request:

FieldTypeMeaning
sessionstringThe session.

Reply:

FieldTypeMeaning
sessionstringThe new session’s id.
{"cmd":"fork","session":"sess-1","req_id":"r1"}
{"ok":true,"session":"sess-2","req_id":"r1"}

new

Opens a session in this process (session/new, with the process’s MCP servers), sets its settings over the profile’s, then sends the prompt, if there is one: session new --pid. Refused by an editor’s process, and with stop_when_idle when the agent can’t close sessions.

Request:

FieldTypeMeaning
cwdstringIts working directory, absolute; the process’s by default.
mode, model, thought_level, optionsAs for set_config.
textstringThe first prompt’s text.
blockslist of objects, ACP’sThe first prompt’s content blocks, as for send.
timeoutnumberSeconds it may take; past it, the opening is abandoned.

Reply: answered once the session is open and its settings set, before the prompt goes.

FieldTypeMeaning
pidnumberThe process.
sessionstringThe new session’s id.
messagestring or nullThe prompt’s message id; null without a prompt.

A failure after the agent opened the session (a setting, timeout passing, the process stopping) fails the request, and the prompt isn’t sent. The session is closed again (or ends with a stopping process), and the error says so, or names it, left open, when the agent can’t close sessions.

{"cmd":"new","text":"review the diff","req_id":"r1"}
{"ok":true,"pid":4466,"session":"sess-2","message":"m2","req_id":"r1"}

resume

Opens an existing session in this process: session/resume, or session/load where the agent has only that. session resume --pid. The session’s lock is taken first, so one another process holds, or this one serves, is refused.

Request: session, and the fields of new, cwd being the session’s.

FieldTypeMeaning
sessionstringThe session’s id.

Reply: as new.

FieldTypeMeaning
pidnumberThe process.
sessionstringThe session’s id, the one resumed.
messagestring or nullThe prompt’s message id; null without a prompt.
{"cmd":"resume","session":"old-1","req_id":"r1"}
{"ok":true,"pid":4466,"session":"old-1","message":null,"req_id":"r1"}

close

Cancels a running turn, then closes the session (session/close), as session close does. Answered once the agent has closed it. A headless process whose last session closes stops.

Request:

FieldTypeMeaning
sessionstringThe session.
take_overnumberThe pid of the process that session resume --take-over resumes it in.

Reply:

FieldTypeMeaning
sessionstringThe session closed.
{"cmd":"close","session":"sess-1","req_id":"r1"}
{"ok":true,"session":"sess-1","req_id":"r1"}

stop

Stops the process: it closes the agent’s stdin, then sends SIGTERM, then SIGKILL, to the agent’s process group. It doesn’t wait for the process to exit.

Request: no fields.

Reply:

FieldTypeMeaning
statusstringstopping.
{"cmd":"stop","req_id":"r1"}
{"ok":true,"status":"stopping","req_id":"r1"}