kimi-code icon indicating copy to clipboard operation
kimi-code copied to clipboard

feat(acp-adapter): implement session/close and logout stable methods

Open xy200303 opened this issue 4 months ago • 1 comments

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/close in AcpServer: look up the session, call Session.close(), and remove it from the in-memory map. Unknown session IDs return invalid_params.
  • Implement logout in AcpServer: delegate to KimiHarness.auth.logout().
  • Advertise sessionCapabilities.close and auth.logout in initialize.
  • 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-changesets skill, or this PR needs no changeset.
  • [x] Ran gen-docs skill, or this PR needs no doc update.

xy200303 avatar Jul 15 '26 04:07 xy200303

🦋 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

changeset-bot[bot] avatar Jul 15 '26 04:07 changeset-bot[bot]

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.

xy200303 avatar Sep 15 '26 10:09 xy200303