Repository navigation
feat(bridge): conversation list + resume protocol for the extension - #1070
Merged
Merged
Conversation
Add list_conversations -> conversations and resume_conversation -> conversation_snapshot frames so the opentask panel can list the user's stored conversations and resume a chosen one, backed by the same store infer resumes from (.infer/conversations). resume reuses the repo's LoadConversation + sendSnapshot; list type-asserts to a narrow conversationLister interface so the domain interface is untouched and the in-memory fallback repo yields an empty list. The implicit auto-backfill-on-connect is dropped and protocol_version bumps to 4. Closes #1068
Contributor
|
🎉 This PR is included in version 0.173.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
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.
Summary
CLI half of opentask#146. Adds bridge protocol frames so the opentask sidepanel can list the user's stored conversations and resume a chosen one, mirroring the CLI 1:1 (the same conversations
inferpersists and resumes from under.infer/conversations).Closes #1068.
New wire frames (protocol v4)
{"type":"list_conversations"}{"type":"conversations","conversations":[{"id","title","updated_at","message_count"}]}{"type":"resume_conversation","id":"<id>"}id{"type":"conversation_snapshot","messages":[...]}After a resume, the running chat pump streams live
chat_eventframes into the now-active conversation.Implementation notes
LoadConversation(ctx, id)+sendSnapshot— both already on thedomain.ConversationRepositoryinterface, so no interface change.b.repoto a small localconversationListerinterface (theListSavedConversationsmethod lives only on the concrete*PersistentConversationRepository). This keepsinternal/domain/interfaces.gountouched (no counterfeiter regen) and lets the in-memory fallback repo cleanly return an empty list.sendSnapshotinadopt) is removed — the panel now lists/resumes explicitly. Existing tests all inject anilrepo wheresendSnapshotwas already a no-op, so blast radius is nil.protocol_versionbumped3→4in thebrowser_hello_ack.PersistentConversationRepositoryguards its own state, so calling these from the per-connectionreadLoopgoroutine is race-safe (verified with-race).Docs
docs/browser-extension-protocol.md— reworked the Conversation sync section to document the new frames in the existing house style; bumped the handshakeprotocol_versionto 4. Public-docs follow-up filed: inference-gateway/docs#555.Tests
Three new tests in
extension_bridge_test.goagainst a real persistent repo backed by in-memory storage:TestExtensionBridgeListConversations— list returns both seeded conversations with id/title/updated_at/message_count.TestExtensionBridgeResumeConversation— resume ships the target conversation's snapshot and switches the active conversation.TestExtensionBridgeNoAutoSnapshotOnConnect— regression guard: no unsolicited snapshot after connect.go test -race ./internal/services -run TestExtensionBridgeand fulltask testboth green;task precommit:runclean.Deliberately deferred
list_conversations(hardcoded limit 50, matching the TUI selector).