46namespace neograph::acp {
48using json = neograph::json;
58 bool embedded_context =
false;
76 bool load_session =
false;
84 bool read_text_file =
false;
85 bool write_text_file =
false;
91 bool terminal =
false;
94 bool elicitation =
false;
102struct NEOGRAPH_API ContentBlock {
106 std::string mime_type;
109 std::optional<std::string> title;
110 std::optional<std::string> description;
111 std::optional<std::int64_t> size;
122 static ContentBlock text_block(std::string s);
125 static ContentBlock resource_link(std::string uri,
127 std::string mime_type = {});
136 int protocol_version = 1;
141struct NEOGRAPH_API InitializeResponse {
142 int protocol_version = 1;
146 std::vector<json> auth_methods;
160struct NEOGRAPH_API NewSessionRequest {
164 std::vector<std::string> additional_directories;
165 std::vector<McpServerConfig> mcp_servers;
168struct NEOGRAPH_API NewSessionResponse {
169 std::string session_id;
183 std::string session_id;
187 std::vector<McpServerConfig> mcp_servers;
194struct NEOGRAPH_API PromptRequest {
195 std::string session_id;
196 std::vector<ContentBlock> prompt;
214NEOGRAPH_API std::string stop_reason_to_string(StopReason s);
215NEOGRAPH_API StopReason stop_reason_from_string(std::string_view s);
217struct NEOGRAPH_API PromptResponse {
218 StopReason stop_reason = StopReason::EndTurn;
225struct NEOGRAPH_API CancelNotification {
226 std::string session_id;
233struct NEOGRAPH_API ReadTextFileRequest {
234 std::string session_id;
236 std::optional<int> line;
237 std::optional<int> limit;
240struct NEOGRAPH_API ReadTextFileResponse {
244struct NEOGRAPH_API WriteTextFileRequest {
245 std::string session_id;
250NEOGRAPH_API
void to_json(json& j,
const ReadTextFileRequest& r);
251NEOGRAPH_API
void from_json(
const json& j, ReadTextFileRequest& r);
252NEOGRAPH_API
void to_json(json& j,
const ReadTextFileResponse& r);
253NEOGRAPH_API
void from_json(
const json& j, ReadTextFileResponse& r);
254NEOGRAPH_API
void to_json(json& j,
const WriteTextFileRequest& r);
255NEOGRAPH_API
void from_json(
const json& j, WriteTextFileRequest& r);
261struct NEOGRAPH_API ToolCallUpdate {
262 std::string tool_call_id;
266 std::string tool_name;
271 std::vector<ContentBlock> content;
276NEOGRAPH_API
void to_json(json& j,
const ToolCallUpdate& t);
277NEOGRAPH_API
void from_json(
const json& j, ToolCallUpdate& t);
284struct NEOGRAPH_API PermissionOption {
285 std::string option_id;
290NEOGRAPH_API
void to_json(json& j,
const PermissionOption& o);
291NEOGRAPH_API
void from_json(
const json& j, PermissionOption& o);
293struct NEOGRAPH_API RequestPermissionRequest {
294 std::string session_id;
295 ToolCallUpdate tool_call;
296 std::vector<PermissionOption> options;
299NEOGRAPH_API
void to_json(json& j,
const RequestPermissionRequest& r);
300NEOGRAPH_API
void from_json(
const json& j, RequestPermissionRequest& r);
308struct NEOGRAPH_API RequestPermissionOutcome {
309 PermissionOutcomeKind kind = PermissionOutcomeKind::Cancelled;
310 std::string option_id;
313NEOGRAPH_API
void to_json(json& j,
const RequestPermissionOutcome& o);
314NEOGRAPH_API
void from_json(
const json& j, RequestPermissionOutcome& o);
316struct NEOGRAPH_API RequestPermissionResponse {
317 RequestPermissionOutcome outcome;
320NEOGRAPH_API
void to_json(json& j,
const RequestPermissionResponse& r);
321NEOGRAPH_API
void from_json(
const json& j, RequestPermissionResponse& r);
345struct NEOGRAPH_API SessionNotification {
346 std::string session_id;
353NEOGRAPH_API
void to_json(json& j,
const PromptCapabilities& c);
354NEOGRAPH_API
void from_json(
const json& j, PromptCapabilities& c);
356NEOGRAPH_API
void to_json(json& j,
const McpCapabilities& c);
357NEOGRAPH_API
void from_json(
const json& j, McpCapabilities& c);
359NEOGRAPH_API
void to_json(json& j,
const SessionCapabilities& c);
360NEOGRAPH_API
void from_json(
const json& j, SessionCapabilities& c);
362NEOGRAPH_API
void to_json(json& j,
const AgentCapabilities& c);
363NEOGRAPH_API
void from_json(
const json& j, AgentCapabilities& c);
365NEOGRAPH_API
void to_json(json& j,
const FsCapabilities& c);
366NEOGRAPH_API
void from_json(
const json& j, FsCapabilities& c);
368NEOGRAPH_API
void to_json(json& j,
const ClientCapabilities& c);
369NEOGRAPH_API
void from_json(
const json& j, ClientCapabilities& c);
371NEOGRAPH_API
void to_json(json& j,
const ContentBlock& b);
372NEOGRAPH_API
void from_json(
const json& j, ContentBlock& b);
374NEOGRAPH_API
void to_json(json& j,
const InitializeRequest& r);
375NEOGRAPH_API
void from_json(
const json& j, InitializeRequest& r);
377NEOGRAPH_API
void to_json(json& j,
const InitializeResponse& r);
378NEOGRAPH_API
void from_json(
const json& j, InitializeResponse& r);
380NEOGRAPH_API
void to_json(json& j,
const McpServerConfig& c);
381NEOGRAPH_API
void from_json(
const json& j, McpServerConfig& c);
383NEOGRAPH_API
void to_json(json& j,
const NewSessionRequest& r);
384NEOGRAPH_API
void from_json(
const json& j, NewSessionRequest& r);
386NEOGRAPH_API
void to_json(json& j,
const NewSessionResponse& r);
387NEOGRAPH_API
void from_json(
const json& j, NewSessionResponse& r);
389NEOGRAPH_API
void to_json(json& j,
const ResumeSessionRequest& r);
390NEOGRAPH_API
void from_json(
const json& j, ResumeSessionRequest& r);
392NEOGRAPH_API
void to_json(json& j,
const PromptRequest& r);
393NEOGRAPH_API
void from_json(
const json& j, PromptRequest& r);
395NEOGRAPH_API
void to_json(json& j,
const PromptResponse& r);
396NEOGRAPH_API
void from_json(
const json& j, PromptResponse& r);
398NEOGRAPH_API
void to_json(json& j,
const CancelNotification& n);
399NEOGRAPH_API
void from_json(
const json& j, CancelNotification& n);
401NEOGRAPH_API
void to_json(json& j,
const SessionUpdate& u);
402NEOGRAPH_API
void from_json(
const json& j, SessionUpdate& u);
404NEOGRAPH_API
void to_json(json& j,
const SessionNotification& n);
405NEOGRAPH_API
void from_json(
const json& j, SessionNotification& n);
StopReason
Why the agent stopped responding for this turn.
@ EndTurn
"end_turn" — turn finished normally.
@ MaxTurnRequests
"max_turn_requests" — agent reached its turn-request budget.
@ Refusal
"refusal" — agent refused to continue.
@ Cancelled
"cancelled" — cancelled via session/cancel.
@ MaxTokens
"max_tokens" — model hit the token cap.
PermissionOutcomeKind
The user's decision (or absence thereof).
NEOGRAPH_API export/import macro for shared-library builds.
Thin C++ RAII wrapper around yyjson with nlohmann-compatible API.
Capabilities advertised in InitializeResponse.
Capabilities advertised by the editor in InitializeRequest.
File-system access methods the client offers (agent→client direction).
Sent once by the editor when the connection comes up.
json client_info
free-form metadata bag (e.g. name/version)
MCP server transports the agent supports (stdio is implicit / required).
Single MCP server entry attached to the session.
Capabilities the agent advertises about which prompt content it accepts.
Reconnect to a persisted session without replaying conversation history.
std::vector< std::string > additional_directories
Complete replacement list of additional workspace roots.
Optional session-management features the agent supports.
Streaming event the agent sends while a prompt is in flight.
std::string session_update
discriminator
ContentBlock content
populated for *_chunk variants
json raw
full original JSON (always populated)