Repository navigation
Description
Summary
The web terminal's Screen view shows what a session's worker sees (read_frame, polled every two seconds), but it is watch-only. When the agent reaches a step a person has to do, a login, a two-factor code, a CAPTCHA, a cookie dialog the judge keeps rejecting, the only ways to help are approving individual tool calls or typing instructions into the chat. Neither lets the person simply do the step.
Add a take-over mode to the Screen view, shaped like the handoff in agent computer: the person takes the screen, acts on it directly as on a remote desktop, and hands it back. The agent is held while the person holds the screen and resumes from a fresh screenshot afterwards.
Ubiquitous language
- Screen - the desktop a session's worker drives, wherever the session runs (local, or a
kind: daemonor Kubernetes workspace after/teleport). - Take over - the person claims the screen. Their pointer and keyboard drive it, the agent does not.
- Hand back - the person releases the screen. The agent may drive it again and is told to continue.
- Held - the state between the two. The invariant of the feature: exactly one actor, the person or the agent, drives a screen at a time.
Behaviour
- The Screen view gets a Take over button. While on, the image takes focus, pointer clicks, wheel and keys inside it go to the session's screen, and the frame poll drops to a few hundred milliseconds so typing feels live. A Done button (and
Esctwice) hands back. - Inputs bypass the agent's tool layer. No approval prompt, no judge call, no conversation entry. The person at the keyboard is the authority, the same rule that already makes a human approval the gate for the sandbox. A credential typed during take-over never enters the transcript.
- While the screen is held, a
Computerinput action the agent issues waits until hand-back instead of fighting the person's cursor. Observations (screenshot, accessibility) keep working. If the agent is parked on an approval box for aComputercall, taking over is a third answer next to approve and reject: the box resolves as rejected with a reason naming the take-over. - Hand-back queues one user message,
I took over the screen and handed it back, continue from what you see now., so the next turn starts from a fresh frame. The agent is not fed the individual inputs. - A teleported session works unchanged: the frames travel the same relay as
read_frame, through the laptop daemon to the workspace that runs the worker.
Design
The change follows the existing direction of dependencies: the web page talks to the daemon over HTTP, the daemon relays a panel frame to the worker through the sessions registry, the worker's panel unit calls a port the computer context owns. Nothing new points outward.
computer context (owns the invariant)
domain/: aScreenControlcontract next toAction:TakeOver() / HandBack()andHeld() bool, plus aScreenInputvalue object (kind, x, y, text, combo, button, direction, amount in frame space) that the existingActionis built from. Two chat events,ScreenTakenOverandScreenHandedBack, published throughPublishedEventlike the recording state key, so every client of the thread sees who drives the screen.executor.go:Executor.Dowaits onHeld()for input actions (move,click,double_click,triple_click,scroll,type,key,press) and passes observations through. The wait honours the call's context, so a cancelled turn does not hang on a held screen.- A
ScreenControlimplementation in the context root with a mutex and a broadcast, and aDrive(ctx, ScreenInput)entry that scales frame coordinates with the existingcoordinate_scaler.goand calls the display controller directly. The screen lock (screen_lock.go) is already held by the worker, so no second lock.
presentation/headless (panel unit)
- A
screen_inputpanel unit besidepanel_frame.go:{"type":"screen_input","project_dir":...,"id":<session>,"input":{...}}and{"type":"screen_control","project_dir":...,"id":<session>,"action":"take_over"|"hand_back"}, each answered by onescreen_resultwith the request id.PanelDepsgains aScreen computerdomain.ScreenControlnext toFrames. Hand-back also enqueues the continue message through the existing message queue, the wayrun_agent_inputdoes. serve.go: aComputerapproval request that is open when the screen is taken over resolves as rejected with the take-over reason.
cmd/daemon + presentation/web (delivery)
cmd/daemon/screen.go: next toscreenFrame, ascreenInputrelay that builds the panel frame and callsregistry.Request(ctx, frame, "screen_result").internal/presentation/web/screen.go:POST /screen/?id=<session>with the same bearer token as the GET, body{"action": "take_over"|"hand_back"}or{"input": {...}}. Rejected with 409 when the session is not held and an input arrives, so a stale tab cannot drive a screen it handed back.static/app.jsScreenView: the button, focus handling, pointer-to-frame scaling from theX-Frame-Width/X-Frame-Heightheaders the GET already sends, key and wheel mapping ontoScreenInput, a 250 ms poll while held, and a visible held state (focus ring, badge). Inputs are only sent while held.
sessions: no change, screen_input and screen_control ride the panel-request routing like read_frame.
docs: docs/browser-extension-protocol.md (Session screen section), docs/web-terminal.md (Live screen), docs/computer-use.md, and the computer-use example README gains a take-over step.
Out of scope
- A real video stream (WebSocket frame push) instead of the faster poll. The input path does not change when that lands.
- Per-input conversation entries. The agent sees the result in its next screenshot, as it would with a person at the keyboard.
- Take-over from the terminal TUI. The TUI has no screen view yet.
Acceptance Criteria
- The Screen view has Take over and Done. While held, clicks, wheel, typed text and key combos inside the image reach the session's screen at the right frame coordinates, locally and after
/teleportto akind: daemonworkspace (verified onexamples/computer-use). - Inputs sent during take-over create no approval prompt, no judge call and no conversation entry.
- A
Computerinput action the agent issues while the screen is held waits until hand-back and then runs. Observations are not blocked. A cancelled turn does not hang on a held screen. - Taking over while an approval box for a
Computercall is open resolves that box as rejected with the take-over reason. - Hand-back queues the continue message and the next turn starts with a fresh screenshot.
- Every client following the thread sees
ScreenTakenOver/ScreenHandedBackon the run stream. -
POST /screen/requires the binding token and refuses inputs for a screen that is not held. - Unit tests: the
ScreenControlwait and release, the panel unit (counterfeiter fakes), the web handler, the daemon relay. Protocol and web terminal docs updated, and a[DOCS]ticket drafted forinference-gateway/docs.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
edenreich commentedon Nov 5, 2026
@infer can you work on this? use /domain-driven-design /clean-architecture /clean-code /go /go-concurrency /bubbles-v2 /bubbletea-v2 /lipgloss
inference-gateway-maintainer commentedon Nov 5, 2026
Model:
ollama_cloud/glm-5.3-flash· Action:v0.59.4· CLI:v0.244.0· Gateway:v0.63.0· View JobTodos
Pull Request
#1699
✅ Infer Result: Success
Done - issue #1697 is implemented, tested, documented, and open for review at PR #1699 (branch
fix/issue-1697, 5 commits pushed, board item set to QA).What changed
computer context (owns the invariant)
internal/computer/domain/screen.go- theScreenControlcontract (TakeOver/HandBack/Held/WaitRelease/Drive) besideAction, theScreenInputvalue object (kind, x, y, text, combo, button, direction, amount in frame space) with theActionbuilder, andIsInputActionseparating agent input actions from observations.internal/computer/screen_control.go- the take-over invariant: mutex + release broadcast, refuses a second claim, publishesScreenTakenOver/ScreenHandedBack;Drivescales frame coordinates with the existing scaler straight to the display controller - bypassing the tool layer entirely (no approval prompt, no judge call, no conversation entry).internal/computer/input_dispatch.go+executor.go- the pointer/scroll/type/key mechanics are shared between the Computer tool andDrive;Executor.Doparks input actions onHeld()with the call's context (a cancelled turn never hangs; observations pass through).Run stream + panel
agui/run.go+computer/published_events.go- a seededscreenControlstate key every client following the thread sees patched on take-over/hand-back;uiBridgeforwards both events.internal/presentation/headless/panel_screen.go- thescreen_input/screen_controlpanel unit answered by onescreen_resultwith the request id; hand-back queues the continue message ("I took over the screen and handed it back, continue from what you see now.") through the run input's own path and wakes the turn loop. A take-over resolves the openComputerapproval box as rejected (interrupts now note the tool they name).internal/sessions/registry.go,internal/container/container.go- screen frames ride the named-session-only panel routing likeread_frame; oneScreenControlper container wired into both the tool and the worker's panel.Delivery
cmd/daemon/screen.go+internal/presentation/web/screen.go-POST /screen/?id=<session>with the GET's bearer, answered{"held": ...}; an input for a screen nobody holds and a take-over of a held screen are409s (stale-tab guard); teleported sessions work unchanged over the same relay.static/app.js+index.html- Take over/Done on the Screen view, image focus, frame-space scaling from theX-Frame-Width/Heightheaders, click/double-click/wheel/keys (Esc twice hands back), 250 ms poll while held, held badge + focus ring, fire-and-forget hand-back when a tab closes.Tests + docs:
ScreenControlwait/release/repark (synctest),ScreenInput→Actionmapping, panel unit (counterfeiter fakes - including the not-held refusal and the queued continue message), web POST statuses/409s, daemon relay round trip through a registry with a fake worker; docs updated inweb-terminal.md,browser-extension-protocol.md,computer-use.md,examples/computer-use/README.md;[DOCS]ticket filed at inference-gateway/docs#1093.Honest caveats
--no-verifyto protect the work, verified after the fact withgofmt -l(clean) and passinggo teston every touched package, but CI's full golangci-lint may surface lint nits.examples/computer-uselive verification is not runnable in this CI job (no X display or Docker); the coordinate scaling, hold logic and relays are covered by unit tests instead.tea.Modelor Bubbles component; the TUI take-over is out of scope per the issue.Model:
ollama_cloud/glm-5.3-flash· Action:v0.59.4· CLI:v0.244.0· Gateway:v0.63.0· Exit Code:0· Duration: 34m 4sTokens: 31,173,937 in · 161,336 out · 31,335,273 total (122 requests)
Tool calls: 203 total · 100% success rate
Traces
Stats
Triggered by edenreich · Infer Action · OSS
inference-gateway-releaser commentedon Nov 5, 2026
🎉 This issue has been resolved in version 0.245.0 🎉
The release is available on:
Your semantic-release bot 📦🚀