feat(acp-adapter): implement session/close and logout stable methods
Problem
The ACP adapter advertised a stable agent-side surface that was missing session/close and logout, leaving ACP clients unable to close sessions or sign out through the protocol.
What changed
- Implement
session/closeinAcpServer: look up the session, callSession.close(), and remove it from the in-memory map. Unknown session IDs returninvalid_params. - Implement
logoutinAcpServer: delegate toKimiHarness.auth.logout(). - Advertise
sessionCapabilities.closeandauth.logoutininitialize. - Add unit tests for both methods and update the capability assertion in
server.test.ts. - Update the ACP method coverage matrix in both English and Chinese docs.
- Add a changeset for
@moonshot-ai/kimi-code.
Checklist
- [x] I have read the CONTRIBUTING document.
- [x] I have explained the problem above.
- [x] I have added tests that prove my feature works.
- [x] Ran
gen-changesetsskill, or this PR needs no changeset. - [x] Ran
gen-docsskill, or this PR needs no doc update.
🦋 Changeset detected
Latest commit: 7cbe1264c9d278d36aac786ffdf59c8bb095074f
The changes in this PR will be included in the next version bump.
This PR includes changesets to release 1 package
| Name | Type |
|---|---|
| @moonshot-ai/kimi-code | Patch |
Not sure what this means? Click here to learn what changesets are.
Click here if you're a maintainer who wants to add another changeset to this PR
This looks superseded by main — the feature landed upstream, so I'd suggest closing it rather than resolving the conflict.
What this PR added to packages/acp-adapter/src/server.ts is present today in packages/acp-server/src/server.ts (the package was renamed and rewritten since this branch was opened; this branch is 187 commits behind):
| This PR | main today |
|---|---|
agentCapabilities.auth = { logout: {} } |
packages/acp-server/src/server.ts:224 |
sessionCapabilities.close = {} |
packages/acp-server/src/server.ts:211 (alongside delete, fork, additionalDirectories) |
logout() handler |
packages/acp-server/src/server.ts:399 |
closeSession() handler |
packages/acp-server/src/server.ts:340 |
| — | handlers registered at :704 and :709 (methods.agent.logout, methods.agent.session.close) |
packages/acp-server/test/lifecycle.test.ts already covers logout (e.g. logout drops the token and the auth gate closes again), and test/initialize.test.ts asserts the advertised auth: { logout: {} } capability.
Because packages/acp-adapter no longer exists, merging would mean porting these handlers into acp-server, where they already are — there is nothing left to add.
Happy to close this if you agree. If there is a specific gap the current acp-server handlers do not cover (for example the exact session/close response shape, or logout behaviour for a provider the oauthService path does not handle), tell me which one and I'll re-scope a patch to that.