Expand description
basis-acp — the ACP adapter: basis’s explicit protocol surface.
ACP is JSON-RPC 2.0 over stdio, LSP-style — the standard editors and web UIs already speak. Serving it is what makes basis embeddable without basis shipping a client: Zed, JetBrains, and acp-ui drive it as-is (PROPOSAL.md Bet 2, ADR-0002).
This is an adapter over basis and nothing else: the run lifecycle,
the event stream and the seams are all the core’s, and what is here is the
translation at one edge. Opt-in by dependency, so a host embedding the
harness in-process never compiles a JSON-RPC server it does not run
(ADR-0011). The binary exposes this adapter through the explicit
basis serve --acp command on stdin/stdout; a bare basis invocation is
reserved for usage and prompt shorthand (ADR-0017).
§Shape
session_updatemaps basis’sEventontosession/update. That mapping is the whole reasonEventis basis’s own type rather than a re-export of mentra’s: one normalization, many surfaces.AcpApproveranswers mentra’s permission requests by asking the client, turning basis’s existingApproverseam intosession/request_permissionwith no new plumbing.SessionModesis the client’s permission switch: ACP session modes over basis’sApproverseam, applied in front of the approver so the answer can still change mid-session. The three modes areApprovalMode, which is basis-acp’s own because an enumerable mode list is a protocol concept — the core has the trait and nothing else.historyreplays a resumed conversation, which is what separatessession/loadfromsession/resume.SessionRegistryholds the open conversations, keyed by mentra’s persisted agent id so thatsession/loadis justWorkspace::resume.servewires the handlers onto a connection, over oneRuntimefor the process and oneWorkspaceper directory a client names (ADR-0018).serve_stdiois the stdin/stdout transport, and the one place basis looks at what a peer sent before serving it.available_commandsandfrom_acpare the two mappings between a core convention and the wire: templates become the commands a client offers, and a client’smcpServersbecome servers basis can register.
Structs§
- AcpApprover
- Puts approval requests to the ACP client.
- AcpSession
- One open conversation.
- Moded
Approver - Applies the session’s mode to each approval request, asking
inneronly when the mode says to ask. - Serve
Config - How a served connection is configured.
- Session
Modes - One session’s mode, and what the client has already answered under it.
- Session
Registry - Every conversation this connection is holding.
Enums§
- Approval
Mode - What a session does about a call that changes state outside the process.
- Mode
Error - Why a
session/set_modewas refused. - Stdio
Error - Why serving stdio ended.
Traits§
- Session
Source - Where an ACP session’s
PreparedRuncomes from.
Functions§
- available_
commands - Maps discovered templates to the commands an ACP client can offer.
- from_
acp - Translates a client’s
mcpServersinto servers basis can register. - serve
- Serves ACP over any transport, which is what makes the server testable
in-process — see
tests/acp/, which drives it overChannel::duplex(). - serve_
stdio - Serves ACP on stdin/stdout until the client disconnects.
- session_
update - Maps one basis event to an ACP session update.