-
Notifications
You must be signed in to change notification settings - Fork 9.1k
feat(acp): add session/list and session/fork support #7976
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
|
The following comment was made by an LLM, it may be inaccurate: No duplicate PRs found |
2a5bd39 to
c832de4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds support for two ACP draft/unstable methods: session/list for listing existing sessions with cursor-based pagination, and session/fork for creating new sessions branched from existing ones. The implementation includes updating the SDK from version 0.5.1 to 0.12.0 to support these new capabilities.
Changes:
- Added
session/list(unstable) with cursor-based pagination sorted by most recently updated - Added
session/fork(unstable) to create new sessions from existing ones - Updated
@agentclientprotocol/sdkdependency from 0.5.1 to 0.12.0 - Refactored session replay logic into a reusable private method
- Improved defensive programming in the providers call with optional chaining
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| packages/opencode/src/acp/agent.ts | Implements unstable_listSessions and unstable_forkSession methods, adds sessionCapabilities to initialization, refactors replay logic, and improves error handling |
| packages/opencode/package.json | Updates @agentclientprotocol/sdk from 0.5.1 to 0.12.0 |
| bun.lock | Updates lock file with new SDK version and peer dependency changes |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
cc8e4e9 to
11066fb
Compare
11066fb to
df8eb84
Compare
|
Hey @remorses! 👋 I've been working on the same What I have:
One design difference to discuss: Your implementation loads all sessions then slices in memory: const all = await Session.list({ cwd: ... })
return all.slice(start, start + limit)My implementation uses backend pagination via the SDK's const result = await Session.list({ cwd, start, limit })The backend approach scales better for users with many sessions (doesn't load everything into memory). My branch: https://github.com/nonsleepr/opencode/tree/feat/acp-session-list Happy to:
Let me know if you'd like to collaborate! If you're busy, I can also open a separate PR and let maintainers decide which approach to merge. |
# Conflicts: # packages/opencode/src/acp/agent.ts
5848847 to
d5213dc
Compare
- Add unstable_resumeSession method (like loadSession but without replaying messages) - Add resume capability to sessionCapabilities - Fix unstable_listSessions to use SDK pagination (start/limit) instead of in-memory slicing - Remove calls to undefined setupEventSubscriptions method
d5213dc to
1673579
Compare
|
Hey @nonsleepr, thanks for the feedback! We updated the implementation to use cursor-based pagination following the ACP spec. Also added Regarding your test suite - we took a look but decided not to include them since they rely heavily on mocks, which doesn't align with our testing approach. We'll keep this PR moving forward. Feel free to review the latest changes! |
Closes #7978
Summary
session/list(unstable) with cursor-based paginationsession/fork(unstable) to fork existing sessions@agentclientprotocol/sdkto 0.12.0Smoke test script: https://gist.github.com/remorses/ddec691b72cef0ae128dc440505596f6