fix(acp): harden session-page connection and localize backend errors

- Session-page connect never triggers download/install; returns
  SdkNotInstalled immediately and prompts the user to install from
  Agent Settings instead
- Binary agents now accept any cached version via
  find_best_cached_binary_for_agent so stale caches still connect
- Bound Initialize handshake with a 60s timeout and convert it to
  AcpError::InitializeTimeout via a sentinel in run_connection
- Spawn background task owns ConnectionManager map insertion and
  removes the entry on exit through an RAII guard that survives
  panics, preventing leaked stale entries
- AcpError gains SdkNotInstalled and InitializeTimeout variants plus
  a stable code() identifier; AcpEvent::Error carries code so the
  frontend can render localized messages by key
- Frontend preflight now runs for all connect sources; error event
  handler switches on code to show translated text for
  initialize_timeout, sdk_not_installed, platform_not_supported,
  process_exited, spawn_failed and download_failed
- Remove ConnectionStatus::Downloading enum variant, all frontend
  branches, and i18n strings; drop obsolete autoLinkFailedTitle,
  autoLinkPreflightFailed, preflightCheckFailedDefault and
  preflightFailedTitle keys across 10 locales
- Add backendErrors.* translations in 10 languages
- Diagnostic logging: always log agent stderr plus binary
  path/size/args/env keys and Initialize timing; gate stdin/stdout
  JSON-RPC tracing behind CODEG_ACP_DEBUG to avoid persisting user
  content into OS log files

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
xintaofei
2026-04-12 03:36:08 +08:00
parent 5bda7d06e9
commit 1c1738298b
25 changed files with 595 additions and 255 deletions

View File

@@ -851,7 +851,6 @@
"connection": {
"connected": "연결됨",
"connecting": "연결 중...",
"downloading": "다운로드 중...",
"prompting": "응답 중...",
"error": "연결 오류",
"disconnected": "연결 끊김",
@@ -1422,11 +1421,13 @@
"unavailable": "{agent}은(는) 현재 플랫폼에서 사용할 수 없습니다.",
"sdkMissing": "{agent} SDK가 설치되어 있지 않습니다"
},
"backendErrors": {
"initializeTimeout": "{agent} 연결 핸드셰이크가 시간 초과되었습니다(60초 동안 응답 없음). 설정을 열어 에이전트 및 네트워크 구성을 확인하세요.",
"processExited": "{agent} 프로세스가 예기치 않게 종료되었습니다.",
"spawnFailed": "{agent} 시작 실패: {message}",
"downloadFailed": "{agent} 다운로드 실패: {message}"
},
"unableReadAgentConfig": "에이전트 구성을 읽을 수 없습니다: {message}",
"autoLinkFailedTitle": "{agent} 자동 연결 실패",
"preflightCheckFailedDefault": "사전 점검에 실패했습니다. 에이전트 설정을 확인하세요.",
"preflightFailedTitle": "{agent} 사전 점검 실패",
"autoLinkPreflightFailed": "자동 연결 사전 점검 실패: {message}",
"connectFailedTitle": "{agent} 연결 실패",
"toolFallbackTitle": "도구",
"eventErrorTitle": "에이전트 오류",