41namespace neograph::acp {
70 const std::vector<ContentBlock>& blocks)
const;
79 const std::vector<ContentBlock>& blocks,
80 const std::string& session_id)
const;
86 const neograph::json& output)
const;
138 void set_timeout(std::chrono::milliseconds t);
143 std::
string read_text_file(std::string_view session_id,
144 std::string_view path,
145 std::optional<
int> line = {},
146 std::optional<int> limit = {});
151 std::string_view path,
152 std::string_view content);
161 std::string_view session_id,
162 const ToolCallUpdate& tool_call,
163 const std::vector<PermissionOption>& options);
167 std::chrono::milliseconds timeout_{std::chrono::seconds(30)};
196 ACPServer(std::shared_ptr<neograph::graph::GraphEngine> engine,
198 std::shared_ptr<ACPGraphAdapter> adapter = {});
218 void run(std::istream& in, std::ostream& out);
282 neograph::json params,
283 std::chrono::milliseconds timeout
284 = std::chrono::seconds(30));
288 std::unique_ptr<Impl> impl_;
Core data types for the Agent Client Protocol (ACP).
NEOGRAPH_API export/import macro for shared-library builds.
Agent-side handle for issuing requests back to the editor.
ACPClient(ACPServer *server)
Construct a client already bound to server.
bool bound() const noexcept
True once bind has been called with a non-null server.
void bind(ACPServer *server)
Late-binding hook — set the back-pointer to the server. Idempotent.
void write_text_file(std::string_view session_id, std::string_view path, std::string_view content)
Write (create or overwrite) a workspace file via the editor.
ACPClient()
Construct an unbound client.
RequestPermissionOutcome request_permission(std::string_view session_id, const ToolCallUpdate &tool_call, const std::vector< PermissionOption > &options)
Ask the editor to surface a permission prompt for an upcoming tool call.
Map between ACP ContentBlock[] and the engine's channels.
virtual neograph::json build_initial_state(const std::vector< ContentBlock > &blocks, const std::string &session_id) const
Build the initial graph state for a turn.
virtual std::string extract_user_text(const std::vector< ContentBlock > &blocks) const
Concatenate every text-typed ContentBlock with single-space joins; non-text blocks are ignored unless...
virtual std::string input_channel() const
Channel name to write the inbound user text into (default "prompt").
virtual std::string extract_agent_text(const neograph::json &output) const
Pull the agent's text reply out of the graph's final state.
virtual std::string output_channel() const
Channel name to read the agent's text reply from (default "response").
HTTP-less, stdio-first ACP server hosting a NeoGraph engine.
std::function< void(const neograph::json &)> NotificationSink
Sink for agent→client notifications (session/update).
void run()
Convenience overload — uses std::cin / std::cout.
bool initialized() const
True after at least one initialize has been processed.
neograph::json handle_message(const neograph::json &envelope)
Process exactly one parsed JSON-RPC envelope.
neograph::json call_client(std::string method, neograph::json params, std::chrono::milliseconds timeout=std::chrono::seconds(30))
Issue a JSON-RPC request to the connected client and block until a response arrives.
bool is_running() const
True while run() is actively reading from its input stream.
AgentCapabilities & capabilities()
Mutable access to the capabilities advertised in initialize.
void run(std::istream &in, std::ostream &out)
Drive the server loop reading newline-delimited JSON-RPC envelopes from in and writing them to out.
std::shared_ptr< ACPClient > client()
Handle for issuing agent→client requests (fs/*, etc.).
void set_notification_sink(NotificationSink sink)
Where session/update notifications go.
void attach_client(std::shared_ptr< ACPClient > c)
Install a pre-constructed client and bind it to this server.
ACPServer(std::shared_ptr< neograph::graph::GraphEngine > engine, neograph::json info, std::shared_ptr< ACPGraphAdapter > adapter={})
void stop()
Signal a running run() loop to exit at the next message boundary.
Main graph execution engine with super-step loop and HITL support.
Capabilities advertised in InitializeResponse.