Skip to content

「WIP」Enhance WebMCP tool metadata, RPC reliability and add thread status services#4748

Open
lulusir wants to merge 184 commits into
mainfrom
feat/acp-v2
Open

「WIP」Enhance WebMCP tool metadata, RPC reliability and add thread status services#4748
lulusir wants to merge 184 commits into
mainfrom
feat/acp-v2

Conversation

@lulusir

@lulusir lulusir commented May 27, 2026

Copy link
Copy Markdown
Contributor

Types

  • 🎉 New Features
  • 🐛 Bug Fixes
  • 📚 Documentation Changes
  • 💄 Code Style Changes
  • 💄 Style Changes
  • 🪚 Refactors
  • 🚀 Performance Improvements
  • 🏗️ Build System
  • ⏱ Tests
  • 🧹 Chores
  • Other Changes

Background or solution

Changelog

Summary by CodeRabbit

发行说明

  • 新功能

    • 会话绑定权限对话框:权限请求现已关联到特定会话,多会话场景下避免弹窗丢失
    • 待处理权限提示:显示后台会话的权限待处理状态,支持任务切换后查看
    • WebMCP 工具组:新增文件、终端和编辑器操作工具集,扩展 IDE 能力
  • 改进

    • 线程状态可视化:聊天历史显示代理工作状态
    • 权限管理优化:移除超时自动过期,支持显式决策
  • 文档

    • 新增开发循环和场景验证规范文档

Review Change Stack

lulusir and others added 30 commits May 19, 2026 20:44
Extract hardcoded placeholder string in ACP chat view to use localize()
with i18n key, and update Chinese translation to be more concise.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Integrate ClientSideConnection from the official ACP SDK instead of
building a custom JSON-RPC transport layer. The SDK provides complete
JSON-RPC 2.0 implementation, NDJSON parsing, request queuing, error
handling, and type validation.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Plan for replacing custom JSON-RPC transport with
@agentclientprotocol/sdk's ClientSideConnection in the Node layer.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Fix 10 issues found during plan review:
- Runtime bugs: releaseTerminal operator precedence, ndJsonStream called
  before SDK loaded, uninitialized exitResolve variable
- Interface mismatches: setSessionMode return type, sendMessage missing
  config parameter, authenticate method missing
- Behavioral gaps: handler rewrite now notes workspace sandboxing
  preservation, permission options from agent request not hardcoded
- Add test plan with unit and integration test scenarios
- Add 3 new risk items to mitigation table

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
… not per-connection

Replace "per WebSocket connection via childInjector" with accurate model:
single WS connection with RPC multiplexing, DI singleton services managing
one Agent process per workspace, AcpThread scoped per Agent session.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Complete IAcpThread interface with all lifecycle methods shown in architecture diagram
- Add AcpThreadFactory (useFactory pattern) to auto-inject dependencies
- Update AcpAgentService.createThread to use factory instead of manual new
- Renumber all tasks (1-7) and steps to match new task structure
- Fix subsection numbering consistency throughout

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…nection, and entry management

Implements the core Thread AI entity encapsulating agent process spawning,
@agentclientprotocol/sdk connection via dynamic ESM import (Node 16 compat),
entries state management, Client interface delegation, notification dispatch,
tool call state machine, and permission request forwarding.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Fixes 9 spec compliance deviations in AcpThread:

1. Entry data contracts use SDK types (ContentBlock, ToolCall, Plan)
   with data wrapper pattern instead of flattened primitives
2. Event model: replaced bulk entries_changed with granular
   entry_added/entry_updated events
3. markAssistantComplete(): no params — finds last assistant entry
   automatically, transitions status to awaiting_prompt
4. respondToToolCall(toolCallId, allowed: boolean): updates
   ToolCallEntry.status (completed/rejected), fires entry_updated
5. reset(): preserves _initialized flag for thread pool reuse
6. initialize(): accepts AgentProcessConfig parameter
7. sessionId: non-nullable string (empty when unbound)
8. Added setError(error): sets status to errored, fires events
9. handleNotification: made public per IAcpThread interface

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
… instances

Add AcpThreadFactoryToken, AcpThreadFactory type, AcpThreadRuntimeConfig,
and AcpThreadFactoryProvider using OpenSumi DI useFactory pattern with
Injector-based dependency resolution. The factory accepts sessionId and
runtime config (command, args, cwd, env) at call time while injecting
file system handler, terminal handler, and permission caller via DI.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…tor plan

- Rewrite file-system handler: replace generic FileSystemRequest/Response
  with typed ReadTextFileRequest/Response and WriteTextFileRequest/Response,
  remove permissionCallback, getFileMeta, listDirectory, createDirectory
- Rewrite terminal handler: change method signatures to accept individual
  parameters (terminalId, sessionId) instead of request objects for
  getTerminalOutput, waitForTerminalExit, killTerminal, releaseTerminal
- Remove @Injectable decorator and permissionCallback from both handlers
- Update AcpThread Client and AcpAgentRequestHandler to call handlers
  with new signatures
- Fix pre-existing PlanEntry export error in index.ts
- Update tests to match new interfaces, remove obsolete test cases

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…support

Refactor the permission caller from a per-clientId static singleton pattern
(AcpPermissionCallerManager) to a proper DI singleton service
(AcpPermissionCallerService) that extends RPCService. Add a new
PermissionRoutingService to route permission requests from multiple ACP
sessions independently, with session registration, active session fallback,
and concurrent request support. Pass sessionId through the entire chain
from Node caller to browser dialog for multi-dialog tracking.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Replace the single-process model (AcpCliClientService + CliAgentProcessManager)
with a multi-thread pool architecture using AcpThread instances. Key changes:

- Thread pool management with sessions Map + threadPool array (max 10)
- findOrCreateThread with idle thread reuse logic
- createSession using Deferred pattern (no setTimeout polling)
- sendMessage with streaming via SumiReadableStream + thread.onEvent
- disposeSession with default (return to pool) and force (full dispose) modes
- stopAgent disposes all threads and clears pool
- AgentUpdate mapping from SDK sessionNotification events

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
The AcpPermissionCallerService.requestPermission() signature now requires
sessionId as a second parameter. Update all call sites in
agent-request.handler.ts and corresponding test assertions.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
… update DI bindings

- Replace AcpPermissionCallerManager with PermissionRoutingService in
  AcpThreadFactoryProvider so permission requests go through the routing layer
- Update AcpThreadOptions.permissionCaller to permissionRouting
- Update backServices to bind AcpPermissionServicePath to
  AcpPermissionCallerServiceToken instead of deprecated alias
- Update acp-thread.test.ts mock to match new permissionRouting interface

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…teSession

Previously createSession generated a fake uuid and passed it to
loadSessionOrNew, which failed and fell back to newSession. The real
sessionId from the agent CLI was stored in the thread but not used for
the sessions map or return value.

The new flow:
1. Find or create an idle thread without sessionId binding
2. Call thread.newSession() to get the real sessionId from the agent CLI
3. Register the thread with the real sessionId
4. Return the real sessionId to callers

Also adds error-handling cleanup in loadSession to prevent thread leaks
when initialization or loadSession fails on a newly created thread.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add setSessionMode, setSessionConfigOption, and unstable session
operations (fork, resume, close, setSessionModel) to IAcpThread
and AcpThread class. Also add 12 SDK type re-exports to acp-types.ts.

Unify cancel() to use ensureInitialized() for consistent error
behavior across all methods — previously it silently returned.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…nager, update AcpAgentService

Removes the deprecated CLI client and process manager classes that have
been superseded by the thread pool pattern. Cleans up DI bindings,
barrel exports, and associated test files. Updates AcpAgentService,
AcpChatAgent, and agent-types to align with the new architecture.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…pAgentService to AcpThread

AcpThread owns SDK notification format knowledge, so translating
SessionNotification into the legacy AgentUpdate stream format belongs
there. AcpAgentService now delegates to thread.toAgentUpdate() instead
of parsing SDK internals itself.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Wrap thread.setSessionMode() in try/catch with warn logging, consistent
with cancelRequest pattern. Re-throw error so caller is notified of failure.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Track whether thread was newly created or reused. On failure:
- New thread: remove from pool and dispose
- Reused thread: reset to clean state
- Add error logging consistent with loadSession pattern

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Wrap thread.setSessionConfigOption() in try/catch with warn logging,
consistent with setSessionMode pattern.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…AcpThread

Expose four unstable_* methods from AcpThread through IAcpAgentService
without the unstable_ prefix, enabling session lifecycle management
(fork, resume, close) and model switching from the service layer.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Wrap fork/resume/close/setSessionModel delegations in try/catch with
warn logging, consistent with setSessionMode/setSessionConfigOption pattern.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…erations

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…licate

Previously listSessions only read from the pool's this.sessions Map, which
could drift from the agent's actual state. Now it delegates to each active
thread's listSessions() method, merges results with Set deduplication, and
catches per-thread errors with warn logging.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…ionInfo type

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
lulusir and others added 8 commits June 8, 2026 15:02
…ut changes

- Reflect eager session creation and deduplicated concurrent calls
- Update session list ordering expectations (newest-first)
- Add WebMCP profile query override scenarios
- Update classic panel size and resize handle expectations
- Clarify layer descriptions and profile coverage in README
ResizeHandle.getSize() now requires an isLatter boolean parameter.
The agentic left panel always uses targetIsLatter=true.
The keytar native module requires libsecret-1 to compile via
node-gyp when no prebuilt binary is available.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The CI only runs node/jsdom tests and does not need the Electron
binary. Downloading it causes intermittent 504 timeouts.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@lulusir

lulusir commented Jun 8, 2026

Copy link
Copy Markdown
Contributor Author

/next

@opensumi

opensumi Bot commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

🎉 PR Next publish successful!

3.9.1-next-1780908834.0

@codecov

codecov Bot commented Jun 8, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 52.19832% with 511 lines in your changes missing coverage. Please review.
✅ Project coverage is 53.44%. Comparing base (f0c4c12) to head (3fd0a8e).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...c/browser/acp/webmcp-groups/editor.webmcp-group.ts 2.66% 231 Missing and 61 partials ⚠️
...browser/acp/webmcp-groups/acp-chat.webmcp-group.ts 70.28% 67 Missing and 15 partials ⚠️
...wser/acp/webmcp-groups/diagnostics.webmcp-group.ts 42.85% 33 Missing and 15 partials ⚠️
packages/ai-native/src/browser/acp/index.ts 0.00% 20 Missing ⚠️
...c/browser/acp/webmcp-groups/file-workspace-path.ts 81.70% 14 Missing and 1 partial ⚠️
...ative/src/browser/acp/permission-bridge.service.ts 82.08% 9 Missing and 3 partials ⚠️
...ai-native/src/browser/acp/webmcp-group-registry.ts 78.94% 12 Missing ⚠️
...src/browser/acp/acp-chat-relay-summary-provider.ts 90.09% 10 Missing and 1 partial ⚠️
...e/src/browser/acp/acp-thread-status-rpc.service.ts 0.00% 7 Missing and 3 partials ⚠️
...i-native/src/browser/acp/acp-webmcp-rpc.service.ts 0.00% 9 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4748      +/-   ##
==========================================
+ Coverage   52.92%   53.44%   +0.51%     
==========================================
  Files        1720     1752      +32     
  Lines      107381   111758    +4377     
  Branches    23377    24753    +1376     
==========================================
+ Hits        56836    59724    +2888     
- Misses      42021    43178    +1157     
- Partials     8524     8856     +332     
Flag Coverage Δ
jsdom 46.99% <52.19%> (-0.27%) ⬇️
node 13.67% <0.00%> (+0.60%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@lulusir

lulusir commented Jun 9, 2026

Copy link
Copy Markdown
Contributor Author

/next

@opensumi

opensumi Bot commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

🎉 PR Next publish successful!

3.9.1-next-1781010409.0

@lulusir

lulusir commented Jun 10, 2026

Copy link
Copy Markdown
Contributor Author

/next

@opensumi

opensumi Bot commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

🎉 PR Next publish successful!

3.9.1-next-1781059368.0

lulusir and others added 5 commits June 10, 2026 11:30
- Fix EXPLORER locator: use getByText instead of getByRole('heading')
  since accordion headers are divs, not heading elements
- Fix Deep Thinking collapse test: use expect.poll() to handle timing
  issues during stream completion re-renders
- Fix editor.close(): add optional force parameter for handling floating
  UI elements (debug toolbar) intercepting clicks
- Apply force click only in debug tests where toolbar overlaps tabs

Fixes CI failures in acp-chat-agentic-startup, acp-chat-agentic-deep-thinking-collapse,
acp-chat-agentic-side-entry-filter, and debug tests.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@lulusir

lulusir commented Jun 11, 2026

Copy link
Copy Markdown
Contributor Author

/next

@opensumi

opensumi Bot commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

🎉 PR Next publish successful!

3.9.1-next-1781167188.0

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