Integrations

  • ACP (oi rpc). ACP v2 (Preview, schema v2.0.0-beta.4); a client asking for v1 gets -32022.
    • Methods: initialize, session/new, session/list, session/resume (with replayFrom: {type: "start"} it replays the branch, then replay_complete), session/close, session/prompt, session/cancel, session/set_config_option (model, mode, effort) and $/cancel_request. Extensions: _oi/tree, _oi/rewind (files, force; answers the restored, conflicting and failed files), _oi/models, _oi/checkpoint/export and _oi/checkpoint/import.
    • Prompts take text, image (and embedded image resources), resource and resource_link blocks; the agent advertises prompt.image. availableCommands lists /compact, custom commands and skills, and an available_commands_update adds MCP prompts once they are listed.
    • session/prompt answers {messageId} once the message is inserted (an idempotencyKey retry returns the same id); progress follows as state_update (running, requires_action while an approval waits, idle with the stop reason) plus user_message, agent_message_chunk, agent_thought_chunk, tool_call_update, usage_update (cost includes sub-agents) and notice. A prompt sent while the session is busy is held and inserted when the work ends.
    • Sub-agents are child sessions: subagent_update announces each one on its parent before any update carries its id, its own updates use its sessionId, the parent's agent tool call links to it with session content, and background children are listed in state_update.background. A child accepts only session/cancel.
    • session/request_permission uses a command subject for shell calls and a tool_call subject otherwise (with the diff as content for file changes), addressed to the session that asks. The allow_always option names the rules it saves and is left out when no rule fits. A cancelled request is withdrawn with $/cancel_request.
  • HTTP (oi serve). See GET /openapi.json. The server binds 127.0.0.1 only. Every route except /health needs Authorization: Bearer <token>; the token is random per start and written to <data>/serve.json with mode 0600. The Host header must be a loopback name.
    • POST /session/{id}/prompt returns 202 and the turn runs in the background ("wait": true answers with the TurnResult when it ends; 409 while the session is busy). "images": [{"media_type", "data"}] sends images (base64). Turns on different sessions run at the same time.
    • POST /session/{id}/rewind takes {"event_id", "files", "force"}; GET /commands lists the slash commands. Permission events carry raw JSON with the command, the diff and the rules "always" saves.
    • GET /events fans out deltas to any number of subscribers, so a CLI and an IDE can watch the same session. Each event carries its session's lineage (parent_session_id, parent_tool_id, root_session_id, agent, depth), and ?session= also matches that session's sub-agents. GET /session/{id}/children lists sub-agents; POST /session/{id}/cancel cancels one session's turn.
    • Read routes use their own SQLite connections and stay responsive during a turn.
  • C ABI (libharness). oi_open / oi_session_new / oi_prompt(…, callback) / oi_cancel / oi_checkpoint_export / oi_checkpoint_import / oi_close, plus oi_set_approval (an approval callback for ask mode; struct oi_ask carries the diff and the rules OI_ALLOW_ALWAYS saves), oi_session_info and oi_session_children. The callback receives a struct oi_update with the event's lineage fields; see include/oi.h and tests/c_abi_test.c. Set OI_SANDBOX_HELPER=/path/to/oi so embedded hosts still sandbox shell and MCP children.