refactor(acp): modularize monolithic acpClient into specialized files#26143
refactor(acp): modularize monolithic acpClient into specialized files#26143
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request completes Phase 1 of the Agent Client Protocol (ACP) refactoring plan. The primary goal was to break down the monolithic Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
|
Hi @sripasg, thank you so much for your contribution to Gemini CLI! We really appreciate the time and effort you've put into this. We're making some updates to our contribution process to improve how we track and review changes. Please take a moment to review our recent discussion post: Improving Our Contribution Process & Introducing New Guidelines. Key Update: Starting January 26, 2026, the Gemini CLI project will require all pull requests to be associated with an existing issue. Any pull requests not linked to an issue by that date will be automatically closed. Thank you for your understanding and for being a part of our community! |
|
Size Change: +1.5 kB (0%) Total Size: 33.9 MB
ℹ️ View Unchanged
|
There was a problem hiding this comment.
Code Review
This pull request modularizes the Agent Client Protocol (ACP) implementation by refactoring the monolithic acpClient.ts into specialized modules for RPC dispatching, session management, and transport. The changes include the addition of a comprehensive README and updated test suites. Feedback focuses on aligning error handling with JSON-RPC standards by using acp.RequestError for invalid session parameters and moving module-level state, specifically the callIdCounter, to instance-scoped properties to ensure thread safety in concurrent environments.
Note: Security Review did not run due to the size of the PR.
19b1f37 to
5f81d45
Compare
Decomposed the massive `acpClient.ts` and its test file into smaller, focused modules to improve maintainability and isolate concerns. This completes Phase 1 of the ACP refactoring plan. Additionally, all files in the `acp` folder have been renamed to share the `acp` prefix for better consistency. - **Source Code Restructuring**: - Extracted `runAcpClient` to `acpStdioTransport.ts` for handling raw I/O. - Extracted `GeminiAgent` to `acpRpcDispatcher.ts` to act as pure RPC handler. - Created `acpSessionManager.ts` to manage concurrent user sessions. - Extracted `Session` class to `acpSession.ts` to manage individual chat turns. - Moved shared helpers and schemas to `acpUtils.ts`. - **File Renaming**: Renamed all files in the `acp` directory to share the `acp` prefix (e.g., `commandHandler.ts` -> `acpCommandHandler.ts`, `fileSystemService.ts` -> `acpFileSystemService.ts`) to avoid name collisions and improve organization. - **Test Split**: Decomposed the massive `acpClient.test.ts` into corresponding test files: `acpRpcDispatcher.test.ts`, `acpSessionManager.test.ts`, and `acpSession.test.ts`. - **Integrations**: Updated imports in `gemini.tsx` and `acpResume.test.ts` to use the new file paths. - **Verification**: Verified that all tests pass and the full build (`npm run build`) succeeds after resolving initial linting and compilation errors.
5f81d45 to
0c6bee0
Compare
Summary
Decomposed the massive
acpClient.tsand its test file into smaller, focused modules to improve maintainability and isolate concerns. This completes Phase 1 of the ACP refactoring plan. Additionally, all files in theacpfolder have been renamed to share theacpprefix for better consistency.Details
runAcpClienttoacpStdioTransport.tsfor handling raw I/O.GeminiAgenttoacpRpcDispatcher.tsto act as pure RPC handler.acpSessionManager.tsto manage concurrent user sessions.Sessionclass toacpSession.tsto manage individual chat turns.acpUtils.ts.acpdirectory to share theacpprefix (e.g.,commandHandler.ts->acpCommandHandler.ts,fileSystemService.ts->acpFileSystemService.ts) to avoid name collisions and improve organization.acpClient.test.tsinto corresponding test files:acpRpcDispatcher.test.ts,acpSessionManager.test.ts, andacpSession.test.ts.gemini.tsxandacpResume.test.tsto use the new file paths.npm run build) succeeds after resolving initial linting and compilation errors.Related Issues
maintainers-gemini-cli#1604
How to Validate
npm run cleannpm installnpm run buildnpm run bundlePre-Merge Checklist