feat(session): add storage interface for pluggable session backends#15922
Open
ryanjwong wants to merge 4 commits intoanomalyco:devfrom
Open
feat(session): add storage interface for pluggable session backends#15922ryanjwong wants to merge 4 commits intoanomalyco:devfrom
ryanjwong wants to merge 4 commits intoanomalyco:devfrom
Conversation
Contributor
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue for this PR
Closes #
Type of change
What does this PR do?
This adds a typed storage contract for session persistence, wraps SQLite behind that contract, and makes the contract async-compatible so non-SQLite providers can be added more easily.
Changes included:
SessionStore+SessionStoreTxinterfaces inpackages/opencode/src/session/store.ts, with operation groups for sessions/messages/parts/todos/permissions.SessionInput,SessionRow, etc.).Asyncable<T>return support across the store interface (use,transaction,effect, and tx methods).SqliteSessionStoreadapter inpackages/opencode/src/session/store.sqlite.tsthat wrapsDatabase.use,Database.transaction, andDatabase.effect.Session.updateMessage,Session.removeMessage,Session.removePart,Session.updatePartTodo.updateandTodo.get(now async to align with async-capable store)packages/opencode/src/session/index.ts.This remains incremental: runtime behavior should stay equivalent while introducing a real, async-ready boundary for follow-up backends.
How did you verify your code works?
1.3.10) in this environmentbun installat repo rootbun run typecheckinpackages/opencodebun turbo typecheckand passedScreenshots / recordings
N/A (no UI changes)
Checklist