Commit graph

3 commits

Author SHA1 Message Date
顾盼
97926a07fe
fix(acp): support SSE and HTTP MCP servers in ACP mode (#3574)
In ACP mode, the Mcp server list sent by the IDE client can include
SSE (type: "sse") and HTTP (type: "http") transports, but the previous
implementation only handled stdio servers via toStdioServer(). Non-stdio
servers were silently skipped (continue), so any SSE/HTTP-configured
MCP server would never be registered.

Changes:
- Add toSseServer() helper: detects type=="sse" servers and maps them
  to MCPServerConfig(url=..., headers=...)
- Add toHttpServer() helper: detects type=="http" servers and maps them
  to MCPServerConfig(httpUrl=..., headers=...)
- Refactor newSessionConfig() loop to handle all three transport types
- Declare mcpCapabilities: { sse: true, http: true } in agentCapabilities
  so IDE clients know this agent supports these transports without needing
  a transparent proxy
- Export the three helper functions for unit testing

Tests:
- Unit tests for toStdioServer / toSseServer / toHttpServer helpers
  (type discrimination, mutual exclusion)
- Integration-style tests for QwenAgent.initialize() mcpCapabilities
- Integration-style tests for newSession() with SSE/HTTP MCP servers,
  verifying MCPServerConfig is constructed with the correct arguments
  (url vs httpUrl, headers passthrough, empty-headers → undefined)

Fixes #3472
2026-04-24 14:53:01 +08:00
DennisYu07
08d3d6eb6f
feat(acp): add complete hooks support for ACP integration (#3248)
* complete hooks for acp

* resolve comment

* reslove test

* resolve comment for SessionEnd/SessionStart/PostToolUseFailure/PostToolUse
2026-04-16 09:28:26 +08:00
zhangxy-zju
38d0acb01c fix: clean up MCP subprocesses on ACP shutdown to prevent orphan processes
PR #2472 added SIGTERM/SIGINT handlers in runAcpAgent() that destroy
stdin/stdout streams, allowing the ACP connection to close. However,
it did not call runExitCleanup() to terminate child processes (MCP
servers, etc.) spawned by the CLI. This caused orphan subprocesses
to persist after the IDE disconnects, especially noticeable in VSCode
with multiple tabs.

Changes:
- acpAgent.ts: Call runExitCleanup() in the shutdown signal handler
  before process.exit(0), ensuring MCP server subprocesses are killed
- gemini.tsx: Call runExitCleanup() + process.exit(0) after
  runAcpAgent() returns normally, matching the cleanup pattern used
  by other non-interactive exit paths
- Add 4 unit tests covering SIGTERM cleanup, SIGINT cleanup,
  idempotent shutdown, and cleanup-failure resilience

Closes #1884
2026-03-25 19:30:09 +08:00