sandbox-agent/server/packages/acp-http-adapter
Nathan Flurry e7656d78f0
perf: improve startup instrumentation and replace npx with npm install (#208)
Add comprehensive tracing instrumentation across the entire agent startup path (gigacode CLI, ACP HTTP adapter, agent installation, and process spawning) to enable detailed performance profiling. Replace npm-based agent process launchers that use npx (incurring resolution overhead on every spawn) with pre-installed npm packages, reducing startup latency. Improve error diagnostics when agent processes crash by capturing exit codes and stderr tails. Update error handling to map exited processes to dedicated error variants with actionable error messages.

Co-authored-by: Claude Haiku 4.5 <noreply@anthropic.com>
2026-03-06 12:05:19 -08:00
..
src perf: improve startup instrumentation and replace npx with npm install (#208) 2026-03-06 12:05:19 -08:00
tests chore: fix bad merge 2026-02-11 07:57:02 -08:00
Cargo.toml chore: fix bad merge 2026-02-11 07:57:02 -08:00
README.md chore: fix bad merge 2026-02-11 07:57:02 -08:00

acp-http-adapter

Minimal ACP HTTP to stdio proxy.

Endpoints

  • GET /v1/health
  • POST /v1/rpc
  • GET /v1/rpc (SSE)
  • DELETE /v1/rpc

Stdio framing

Uses ACP stdio framing from ACP docs:

  • UTF-8 JSON-RPC messages
  • one message per line
  • newline-delimited (\n)
  • no embedded newlines in messages

Run

cargo run -p acp-http-adapter -- \
  --host 127.0.0.1 \
  --port 7591 \
  --registry-json '{"distribution":{"npx":{"package":"@zed-industries/codex-acp"}}}'

--registry-json accepts:

  • full registry document ({"agents":[...]}) with --registry-agent-id
  • single registry entry ({"id":"...","distribution":...})
  • direct distribution object ({"npx":...} or {"binary":...})

Library

use std::time::Duration;
use acp_http_adapter::{run_server, ServerConfig};

run_server(ServerConfig {
    host: "127.0.0.1".to_string(),
    port: 7591,
    registry_json: r#"{"distribution":{"npx":{"package":"@zed-industries/codex-acp"}}}"#.to_string(),
    registry_agent_id: None,
    rpc_timeout: Duration::from_secs(120),
}).await?;