Repository navigation
Description
Part of #1396
Summary
The browser extension bridge (internal/browser/infrastructure/extension_bridge.go, extension_chat.go, extension_panel.go, extension_tools.go) is a protocol, not a browser adapter. One WebSocket on 127.0.0.1:52789/ws carries browser driver RPC (browser_command / browser_result), a chat mirror and the panel control frames. Only the first of those implements browserdomain.BrowserDriver. Move the socket and the panel units into internal/protocols/agui, and leave internal/browser a thin driver.
This is the ground work for #1396. infer daemon will host this binding (#1399), and the same driver seam will tunnel browser commands over session worker stdio (#1398) and through the daemon (#1400). The wire contract does not change here. The AG-UI reconciliation this issue first described now lands with the encoder split (#1397), the daemon binding (#1399) and the extension (inference-gateway/opentask#209).
Target layout
internal/protocols/aguiowns the listener, theOrigincheck, thebrowser_hellotoken handshake, one active connection with replacement, pings, the/artifacts/route, and the panel units fromextension_chat.go,extension_panel.goandextension_tools.go.Renderstays the one encoder.- The bridge gains
Request(ctx, id, frame) (json.RawMessage, error): write a frame and wait for thebrowser_resultcarrying that id. It keeps retrying a failed listen, so a process that lost the port to anotherinfertakes it over when that one exits. internal/browser/infrastructurekeeps anExtensionDriverthat buildsbrowser_commandframes, owns the per-action timeout and maps results toBrowserToolResult. The container injects the request function (ExtensionRequest), sobrowserdoes not importprotocols/agui.- depguard:
websocket-only-in-browser-and-webbecomeswebsocket-only-in-agui-and-weband allowsinternal/protocols/aguiinstead ofinternal/browser.
Acceptance Criteria
- The extension socket, handshake, panel handlers and
/artifacts/route live ininternal/protocols/agui -
internal/browserholds only theExtensionDriveradapter, no longer importsgorilla/websocket, and depguard enforces it - The container builds the bridge in
protocols/agui, injectsbridge.Requestintobrowserinfra.NewExtensionDriver, and closes the bridge on shutdown - Every frame on the wire keeps its shape, so the extension works unchanged
- The
extension_bridge_test.goscenarios are ported to the new packages, not dropped. The driver is tested through a fakeExtensionRequest -
internal/protocols/agui/README.md,internal/browser/README.mdandAGENTS.mddescribe the new layout -
go test -race ./..., the e2e suite andtask precommit:runpass
Metadata
Metadata
Assignees
Type
Projects
- StatusShow more project fieldsDone
Activity
[-][TASK] Refactor browser Extension bridge[/-][+][TASK] Refactor the browser extension bridge into an AG-UI WebSocket binding in internal/protocols/agui[/+][-][TASK] Refactor the browser extension bridge into an AG-UI WebSocket binding in internal/protocols/agui[/-][+][TASK] Refactor move the browser extension socket into internal/protocols/agui behind an injected browser request[/+]edenreich commentedon Sep 28, 2026
@infer Can you work on this? use /ponytail:ponytail /domain-driven-design /clean-code /clean-architecture /go /go-concurrency
inference-gateway-maintainer commentedon Sep 28, 2026
Model:
ollama_cloud/glm-5.3-flash· View JobTodos
Pull Request
#1406
✅ Infer Result: Success
All acceptance criteria are met and everything is pushed and verified. This closes the work on issue #1395.
Summary
Moved the opentask browser-extension bridge out of the browser capability into
internal/protocols/agui, leavinginternal/browsera thin driver, as ground work for #1396 and the daemon/session-worker seam. The wire contract is unchanged, so the extension works unchanged.What changed (PR #1406, branch
fix/issue-1395, commit 26efb11)internal/protocols/aguinow owns the protocol:extension_bridge.go(listener,Origincheck,browser_hellotoken handshake, one active connection with replacement, pings,/artifacts/route, frame routing), plus the panel unitsextension_chat.go(chat mirror + approvals),extension_panel.go(conversations, history, skills, model picker, modes) andextension_tools.go(tool_request execution).Renderstays the one AG-UI encoder and the chat mirror still reuses it.ExtensionBridge.Request(ctx, id, frame json.RawMessage) (json.RawMessage, error)writes a pre-built frame, resolves on thebrowser_resultcarrying that id (raw bytes preserved), and keeps retrying a failed listen so a process that lost the port takes it over - the caller owns the id, the frame'stimeout_msand the deadline.internal/browser/infrastructure/extension_driver.go: new thinExtensionDriverthat buildsbrowser_commandframes (uuid id +timeout_ms), owns the per-action timeout (config seconds + reply margin, with the same friendly timeout and failure messages) and maps results/errors toBrowserToolResult. ItsCloseis a no-op because the container closes the bridge. Nogorilla/websocketimport remains.agui.NewExtensionBridge, injectsbridge.Requestintobrowserinfra.NewExtensionDriver(declared in browser as theExtensionRequestseam, sobrowsernever importsprotocols/agui), and closes the bridge on shutdown.websocket-only-in-browser-and-webbecamewebsocket-only-in-agui-and-web, allowinginternal/protocols/aguiand denyinginternal/browseragain.extension_bridge_test.goscenarios are ported tointernal/protocols/agui(the driver round-trip tests there now go throughbridge.Request); theExtensionDriveris tested through a fakeExtensionRequestinextension_driver_test.go.internal/protocols/agui/README.md,internal/browser/README.mdand rootAGENTS.mddescribe the new layout.no docs ticket: internal-only refactor(no public behavior or protocol change, no ripple to other org repos).Verification
task precommit:runpasses (mod:tidy, mocks, fmt, lint:imports, golangci-lint 0 issues, markdownlint)go test -race ./...passesTestChatTUIApprovalBoxFollowsTail) was verified to fail identically on clean main (e6357da) in this sandboxed runner, so it is pre-existing runner flakiness, unrelated to this changePR: #1406 (ready for review; board item moved to QA).
Model:
ollama_cloud/glm-5.3-flash· Exit Code:0· Duration: 26m 3sTokens: 11,329,485 in · 87,887 out · 11,417,372 total (70 requests)
Tool calls: 96 total · 100% success rate
Traces
Stats
Triggered by edenreich · Infer Action · OSS
feat(headless): add a --serve worker that runs one AG-UI run per user…
inference-gateway-releaser commentedon Sep 30, 2026
🎉 This issue has been resolved in version 0.219.0 🎉
The release is available on:
Your semantic-release bot 📦🚀