Repository navigation
feat(browser): report the extension's state to the daemon's clients - #1440
Merged
Merged
Conversation
The daemon now sends the browser_extension_status app frame to every client that is not the extension, once when the client connects and again whenever the extension attaches or detaches. The browser context owns the frame next to the rest of its wire vocabulary, and the relay delivers the frames under its state mutex so a client's join frame and the attach broadcasts leave in state-change order. Resolves #1403
A dialing client's HelloAttrs are copied first and the type, token, client and protocol_version fields set after them, so a declared attribute can never override what the handshake owns. The marshal of a map of strings cannot fail, so its error branch is gone.
Contributor
|
🎉 This PR is included in version 0.221.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.
Resolves #1403
Summary
A client of the daemon's binding could not tell whether the browser extension is attached; it only found out when a Browser tool failed with "no browser extension connected". The daemon now reports the extension connection's state as the
browser_extension_statusapp frame: once when a client connects (its first frame names the state at that moment) and again whenever the extension attaches or detaches. The frame belongs to the browser context's own wire vocabulary, andinternal/protocols/aguistays free of client names.Changes
internal/browser/infrastructure/extension_wire.go: the frame namebrowser_extension_status, its ownprotocol_version(1, independent of the handshake's), and the frame builder, next to the rest of the browser wire vocabulary.internal/browser/infrastructure/extension_relay.go: the relay now tracks the non-extension connections on the binding and delivers the frame to them whenever the extension attaches or detaches, readingextension_versionfrom the attached extension's hello; a joining client is framed with the current state at once. Deliveries stay under the relay's state mutex, so every client's frames leave in state-change order.internal/protocols/agui/binding.go:DialConfig.HelloAttrs, the other hello fields a dialing client declares (the host reads them back withHelloAttrlike it already does for the extension). This makes the version passthrough testable over the wire. The handshake's own fields (type,token,client,protocol_version) are set after the attrs, so a declared attribute never overrides them.cancelled, and continues with a new run on the thread, the same path computer use takes in [TASK] Refactor replace custom events and frames with standard AG-UI #1419.docs/browser-extension-protocol.md: new "Browser extension status" section documenting the frame.Tests
go test ./internal/browser/... ./internal/protocols/agui/ -racegreen;task precommit:run(mod tidy, mocks, gofmt, golangci-lint, markdownlint) passing.Follow-ups