Repository navigation
feat(ucu): agents are told where the user is, and where each listed window is for them - #32
Merged
Merged
Conversation
…indow is for them An agent could not tell what the user was doing or looking at, so it could not choose when or where to work. `list_windows` now begins with a line on the user: the app and window they are in, whether they type, and their Spaces, with the apps in full screen and what is showing. Each listed window says whether it is on the user's screen, on an agent's desktop or on no screen, and windows on a Space the user isn't looking at follow the list, which an app's own list leaves out. When the user moves to another app, or into or out of full screen, the next result ends with a note that names the app. All of it comes from the helper that runs beside the server, which answers in half a millisecond. Done in the `list` command, started anew each time, the same took 55 ms more, 27 of them for the screens alone. The title of the user's window is left out for an app on the deny list, and for every app when the list can't be read. No tool text changes.
…t after every call A chat that starts while an update is still building the new helper keeps the old one for its whole life. That one never answers the new question, so every call would have waited a second for it.
…nch adds tests Two branches adding tests before the same line conflict for no reason.
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.
Based on
main. Independent of #30 and #31.What changes for the user
Agents can now tell what you are doing and looking at, so they can choose when and where to work. Nothing changes on screen.
What agents get
No tool text changes. The tool definitions stay at their size.
list_windowsbegins with a line on the user:User: in Mail, window "Inbox", typing. Spaces: 2 desktops, full screen: Safari; showing a desktop.It names the app and window they are in, says whether they are typing, active, or how long idle, and describes their Spaces: how many desktops, which apps are in full screen, and which they are looking at.
user-screen,private-desktoporoff-screen.other-space. An app's own list leaves those out, which is why a session in full screen could not be found once the user left its Space.[ucu: The user is in Safari in full screen, idle 12 s.]. The first call of a chat says where they are.How it works
ucu-window watch, the helper that runs beside the server, answers a newsituationrequest. After every call the server asks for the app, whether it is in full screen, and what the user is doing, which no app has to answer. Forlist_windowsit also asks for the line, the screens and the windows on other Spaces.listcommand itself is unchanged.CGSMainConnectionID,CGSCopyManagedDisplaySpaces,CGSCopySpacesForWindows). Each is looked up at run time, and where one is missing nothing is said of Spaces. An agent's desktop has Spaces of its own, which are left out.What it costs
A helper built before it knew the question never answers it. A chat that starts while an update is still building the new helper has such a one for its whole life, and every call would wait a second for it. It is asked once and then left alone.
The helper answers in 0.3 ms after a call and 0.5 ms for a list (medians of 20). Its first answer for a list in a chat took 150 ms.
The
listcommand is unchanged and takes what it took: 0.07 seconds for one app and 0.21 for every app (medians of 11). Through the server, a list of every app took 0.20 seconds.A first version did the work in the
listcommand, which is started anew each time. That made it 55 ms slower, 27 of them only to connect to the display system for the screens, so it moved to the helper.What is told, and what is not
list_windowsalready did.How it was validated
python3 -m unittest discover -s testsinucu/: 176 pass, 4 of them new. One was checked to fail without its code. No CI workflow runsucu/tests, and no unit test coversucu-window.On this Mac, with the server and helper built from this branch:
user-screenon the 8 windows of a full list, andprivate-desktopon a test app's two windows aftermove_to_desktop.full screen: DialogProbe; showing full screen (DialogProbe), and the note saidin full screen. Back on the desktop the line saidshowing a desktop, the helper's list left the window out, and it followed asDialogProbe: "Dialog Probe List" fullscreen other-space.Merged locally with #30 and #31, in the scenario round of 24 November that #30 describes, with the user really working: the line named the app and window they were in and said "active", the windows of two test apps were marked
private-desktopaftermove_to_desktop, and the note followed them from one app to the next.Not verified
Limits
Notes for review
ucu-window.swiftchanged, so the helper is rebuilt on update.git merge-treesays it merges cleanly with fix(ucu): Command-Tab, Mission Control and a click on a window bring an agent's app to the user #22, fix(ucu): focus_window with activate asks the app itself to come to the front #29 and fix(ucu): opening an app doesn't show its window to the user or keep their keyboard #31. With feat(ucu): work with the user: steps in front that give the screen back, and a label that says what the agent needs #30 it conflicts inREADME.md,ucu-proxy.pyandfake_ucu_window.py, where both add lines at the same places: whichever merges second keeps both.