Skip to content

feat: add ACP (Agent Client Protocol) server support#29

Merged
ynishi merged 3 commits intomainfrom
feat/acp-server
Mar 5, 2026
Merged

feat: add ACP (Agent Client Protocol) server support#29
ynishi merged 3 commits intomainfrom
feat/acp-server

Conversation

@ynishi
Copy link
Owner

@ynishi ynishi commented Mar 5, 2026

Summary

  • Add orcs-acp crate implementing an ACP-compliant server that exposes the ORCS engine over HTTP (JSON-RPC style)
  • Connect ACP server to the ORCS engine via IOInput/IOOutput channels, enabling external clients to send user input and receive engine output
  • Add HIL (Human-in-the-Loop) approval handling to the ACP engine worker, allowing external clients to approve/deny permission requests

Changes

New crate: orcs-acp

  • server.rs — ACP HTTP server built on agent-client-protocol crate. Handles session lifecycle, message routing, and streaming responses
  • agent.rs — ACP agent implementation bridging ACP protocol messages to ORCS engine IOInput/IOOutput
  • convert.rs — Type conversion between ACP protocol types and ORCS internal types

Modified

  • orcs-cli/src/main.rs — Add --acp flag to start the ACP server alongside the CLI
  • orcs-app/src/app/mod.rs — Expose IO channel constructors for ACP integration

Test plan

  • orcs --acp starts ACP server on default port
  • ACP client can establish a session
  • User input sent via ACP is processed by the ORCS engine
  • Engine output is streamed back to the ACP client
  • HIL approval requests are forwarded to the ACP client
  • Approval/denial responses from ACP client are handled correctly
  • Graceful shutdown when ACP client disconnects

ynishi added 3 commits March 5, 2026 09:06
Add orcs-acp crate implementing the ACP Agent trait from
agent-client-protocol v0.9. Enables ORCS to run as an ACP-compatible
agent over stdio, registerable in ACP-aware editors (Zed, JetBrains).

P1 implementation: initialize, authenticate, new_session, prompt,
cancel handlers with echo response. Engine integration planned for P2.

CLI: `orcs --acp` starts the ACP server mode.
Replace echo-based engine_worker with real ORCS engine integration.
The ACP server now sends user prompts through IOInputHandle and
streams engine output back as ACP SessionUpdate notifications,
using the same idle-timeout pattern as run_command().
Track pending approval IDs from ShowApprovalRequest and attach them
as InputContext when the next prompt is a HIL response (y/n),
enabling the engine's IOBridge to dispatch correct approve/reject
signals. Add comprehensive tests for convert and server modules.
@github-actions
Copy link

github-actions bot commented Mar 5, 2026

Code Metrics

Metric Value
Code units 5359
Line coverage 86.6%
Function coverage 84.7%
Region coverage 86.6%
High complexity (cyclo>=15) 158
Large functions (>=100 lines) 209
Domain breakdown
Domain Nodes %
orcs-runtime 1908 35.6%
orcs-lua 1633 30.5%
orcs-component 578 10.8%
orcs-types 223 4.2%
orcs-lint 211 3.9%
orcs-hook 207 3.9%
orcs-auth 153 2.9%
orcs-cli 118 2.2%
orcs-app 117 2.2%
orcs-event 111 2.1%
other 56 1.0%
orcs-mcp 44 0.8%

@ynishi ynishi merged commit d1f9d1b into main Mar 5, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant