Skip to content

feat(ucu): notch island, vault, and passkey sign-in out of the user's sight - #38

Draft
betoxf wants to merge 14 commits into
mainfrom
feat/notch-island-vault
Draft

betoxf wants to merge 14 commits into
mainfrom
feat/notch-island-vault

Conversation

@betoxf

@betoxf betoxf commented Nov 26, 2026 •

Copy link
Copy Markdown
Owner

What this adds

  • Notch island (ucu-island). A small app that draws ucu's prompts at the MacBook notch: approvals, a login form, toasts, the cursors of the agents at work, and a Touch ID banner. The server talks to it over a Unix socket.
  • Vault. Saved logins and API keys, encrypted with a key in the Keychain. The vault tool fills, captures and pastes them, and the model gets ids and masked previews. ask_user asks at the notch.
  • Passkey sign-in without the page. vault fill on a page that offers a passkey moves the agent's Safari tab to its private desktop, presses the page's passkey button with a real click, and waits there for the user's touch. The notch names the site while the finger can be read, and says "Pause, then touch" while it can't.
  • main merged in. Two clashes with the fixes of 25 November are resolved. Both sides had an ask_user in the server: the notch tool's method is notch_ask now, and the tool keeps its name. The notch work sent front with allow, a key the helper already answers as a question, so show sends allow alone, as on main.
  • Coming to a browser an agent works in. The branch of fix(ucu): a tab the user may be looking at stays open, and a Dock click brings them what the agent has out of sight #37 is merged in, and its answer to a click on the browser's Dock icon is reworked, as described below.

How the passkey step works

Measured on Safari with a local WebAuthn page and a test passkey:

  • A page opens the passkey sheet only for a press made while Safari is the active app and the page's window has the keyboard. A click made by script never counts.
  • The sheet reads the finger only while Safari is the active app. Where its window is doesn't matter.
  • macOS doesn't tell a process that a finger is on the sensor: BiometricKit's presence detection answers error 1 without Apple's entitlement. The helper also can't catch a keystroke or pass it on without Input Monitoring, which ucu doesn't ask for.

So the helper makes Safari the active app by the one window on the agent's desktop (_SLPSSetFrontProcessWithOptions and the key-window records, the way window managers do it), which leaves the user's windows where they are. It does so only while the user's hands are still, 0.8 s after a key and 0.5 s after the mouse, and gives their app back at any input, when the sheet takes the touch, and on every other way out. A key pressed while Safari has the front goes to the sheet, which ignores it, and is lost to the user's app. Each such key doubles the pause that is waited for, up to 4 s.

In Chrome, where none of this is measured, the agent's window comes to the user, who touches there.

Coming to a browser an agent works in

While a chat's page is in a window on the agent's desktop, Safari and Chrome open no window for a click on their Dock icon, because they have one. With no window of the user's on screen the click got them nothing until the agent brought its page, which took 16 s in the case that prompted this.

  • The helper tells the chat's server of the click ({"came": "dock"}), of a switch to the browser another way ("switch"), and of a click on the chat's preview at the notch ("notch"), each with whether a window of the browser is before the user. It tells of a switch between the agent's steps too. The message carries no event, so a server started before this change ignores it.
  • The server answers on a thread that takes no lock, so a long step of the agent's doesn't hold it up. A window of the user's in the Dock or in another Space comes back to them. With none at all, the chat's window comes to their screen with its page as it is, and is theirs from then on. A click that brings them a window of their own is left to that window.
  • A click at the notch brings the chat's page: as a tab of the user's window when they have one on screen, where the agent moves in at its next step, and as the chat's window otherwise. Before, that click only activated the app, which shows nothing while its window is out of sight.
  • The guard that gives the keyboard back to the user's window took a window out of the Dock that the user had just put there. With no window of theirs before them, the app whose window they see gets the keyboard.

The notch app tells the helpers through a distributed notification, com.ucu.asked-at-notch. Any process of the same user can post it, and so bring a chat's window or page in front of the user. It carries the chat's process number and an app's name, and releases nothing.

This replaces what pull request 37 did for the Dock click: a copy of the page in a tab of the user's window, opened after the agent's step. Its other half, the tab that stays open while the user may be looking at it, is merged unchanged.

Notch fixes

  • The cursor pile was drawn anew for every step an agent took, with a fade, a slide, a rim glow and a wiggle each time. It is drawn again only when who is in it changes, and a cursor stirs once in a while with one slow movement. Under the same stream of steps, pictures taken 12 times a second showed the pile moving in 97% of them before and 11% after.
  • The ring around the Touch ID icon, and the island's contents as they come and go, scaled about the bottom-left corner, where AppKit anchors a view's layer. Both scale about their middle now.
  • The Touch ID banner shows what its sheet is doing: dim while it waits for a pause, a ring while the finger is read, a turning arc with "Signing in…", then a check with "Done".
  • The notch app took the user's keyboard 0.2 s after it started, in 5 of 6 starts, when a chat's server started it while the user was in that chat. It starts as a process without windows now, which macOS doesn't activate: 12 of 12 starts left the user's app in front.

Validation

  • python3 -m unittest discover -s tests in ucu/: 251 tests pass at 5491d50. They use stand-ins for the helper, the engine, the page backend and the notch app, so they cover the server only.
  • Live on macOS 27 with Safari, on the local test page: 15 sign-ins completed by a real touch, through both vault fill and ask_user, with the user in another app and in a Safari window of their own. With real input while Safari had the front, their app came back each time and the touch was read at the next pause. From the switch to the window-only method on, the user's windows stayed on top in every run. One run had nobody there: it ended after 90 s with the user's app in front.
  • Notch: pictures taken at the real notch of a copy of the app run apart from the real one, with its own socket, vault and key. They show the Touch ID banner through its four states, a toast, an approval, and the pile under a stream of agent steps.
  • Installed from this branch on one Mac, at 27db7e3 and then at 5491d50, where ucu doctor passes.
  • The browser change, with the user's own clicks on a local page in Safari, each during a 40 s step of the agent's, on builds of the change as it grew. With no window of theirs, the agent's window was on their screen 0.57 s after the press on the Dock icon, before the rule that their own window comes first. With theirs in the Dock, theirs came back in 0.54 s and the agent's stayed out of sight. A window they put in the Dock stayed there. The notice the notch app posts, posted by a script, brought the page into a tab of their window in about a second, and the agent's next step ran in that tab. A run without the user showed their window on the same tab before the agent's tab opened, while its page was away, and after it came back.
  • On the build installed at 27db7e3, with nobody at the Mac and the installed files run through a test launcher, not a new chat. A click on the chat's preview at the notch, made by moving the real pointer, had the notch app post its notice, and Safari came forward with the chat's page as a tab of the user's window 1.1 s after the press. The chat's next read ran in that tab. With the notice posted by a script during a 30 s step it also took 1.1 s. A Safari window put in the Dock while Safari was in front stayed there, and the keyboard went to the app in sight.
  • A click on Safari's Dock icon and a Command-Tab to Safari, both posted by a program, were sent back in under 0.1 s as an app that came forward by itself. macOS names the sending process on a posted click even when the event's field is set to 0. Why the posted Command-Tab was not taken for the user's was not measured: three tries were each sent back. So the Dock click was run by hand only, on earlier builds, and the Command-Tab not at all.
  • 5491d50 changes when the helper tells the server of a switch. A scratch build of that helper ran three passes: the notch pass still works, a Command-Tab posted by a program during a step is still sent back, and one posted between steps tells the server nothing. The helper installed at 5491d50 is byte for byte that build.

Not verified live

  • Real typing while a touch is pending (a simulated key press was used), and a finger that the sheet rejects.
  • A sheet that was left open after a timeout and is used again.
  • Chrome, and the fallback on a Mac without an agent's desktop.
  • The notch's login form after the animation and start-up changes.
  • The vault's own flows (fill with a saved login, capture, paste), which only the stand-ins exercise. No real account was used.
  • A switch to the browser by Command-Tab, during a step of the agent's or between steps. The helper told the server of a switch only during a step and for 10 s after it, and tells it at any time since 5491d50. That change was made by reading the code, and no run could check what it does for a real switch.
  • In the browser change: Chrome, and several chats with pages away in the same browser.
  • No Dock click has gone from end to end on the final build. The message's name and the keyboard hand-off ran on the installed build in the passes above. The hold-off, which keeps the front from going to another app for half a second after a Dock click with the user's window in the Dock, needs a click by hand.

Known problems, not fixed here

The vault doesn't hold yet against a process that runs as the user, or against the model itself:

  • vault_resolve releases a secret with no prompt when the destination is a file, to any process that can open the socket.
  • A vault that fails to load is treated as empty and overwritten by the next save, and a Keychain read that fails makes a new key over the old one.
  • The notch app isn't on the deny list, so an agent could press Allow through ucu itself.
  • One Allow is remembered for good by default, under a key the caller picks.

A separate change for these is in progress. Until it lands, the vault keeps secrets out of the chat by accident, not by force.

The notch's preview of a chat that works in a browser can picture the wrong window. The server sends no window number for a browser step, so the notch app takes the first window of the browser on screen, which is the user's own: seen once, with the chat's page on the agent's desktop.

For the owner to decide

  • The pause before Safari takes the front is 0.8 s after a key. main waits 4 s before it brings an app forward, for the same reason: a keystroke that goes to the wrong window. The shorter pause makes a touch register as the hand reaches the sensor, at the price of a lost key now and then.
  • The Touch ID banner names the site ("Sign in to example.com") where the first design said "Please touch the key".
  • fix(ucu): a tab the user may be looking at stays open, and a Dock click brings them what the agent has out of sight #37 is merged into this branch and half of it is reworked here. It can be closed, or merged first for the half that is unchanged.
  • A Dock click with a window of the user's on screen brings nothing of the agent's, also when the browser was in front already. The notch is where they ask for the agent's page.
  • A click at the notch shows the chat's page in front, over the tab the user was on in that window. Opening it behind their tab is the alternative.

Install notes

  • ucu update rebuilds the engine, ucu-window and ucu-island. It doesn't restart a notch app that is running: stop it once with pkill -f "ucu-island serve", and the next ucu call starts the new one.
  • No new permission is asked for, and nothing migrates.
  • A chat that was open before the update keeps its server and helper, so the Dock click and the notch click work in chats started after it. Once the notch app is restarted, a click on the preview of a chat from before the update does nothing until that chat restarts: the new notch app posts the notice, and the old helper doesn't hear it.

…ck brings them what the agent has out of sight

An agent that had shown the user its Safari tab took that tab `away` again, which closed it in the user's window
while they were looking at it. A click on Safari's Dock icon then brings nothing: Safari opens no window for it
while it has one, and the one it had was on the agent's desktop.

- `away` no longer closes the tab its window shows, in a window that has tabs of the user's too or after the
  agent showed them the tab. The tab stays open, and the agent goes on in a copy of its page on its desktop. When
  the page comes back, at `show` or when the turn ends, it comes into that tab if it is still at its address, so
  show after show leaves one tab and not a row of them. It comes into a new tab if the user went on in theirs, or
  if they are looking at theirs and the page has moved on: nothing changes under their eyes unless the agent shows
  it to them.
- ucu-window reports a plain click on the Dock icon of a browser the chat works in, with whether the browser was in
  front already and whether a window of it was in the user's sight. For Safari the server then opens each page the
  chat has away in a tab of the user's own window as well, in front, and the agent keeps its own. For Chrome the
  chat's window comes to the user's screen, as `show` brings it. Clicking again opens nothing new.
- A click on the Dock icon of an app that is in front already, with its windows on the agent's desktop, brings
  them back to the user. Nothing comes forward for such a click, so nothing did before.
- A press that is held, moved or made with a modifier key is not a click for this.

The server's part has unit tests with the stand-ins for Safari, Chrome and ucu-window. No test covers ucu-window
itself, and its part was only compiled: it ignores clicks that name a sender, so it needs a click by the user's
own hand. Nothing here ran in a real Safari or Chrome.
Snapshot of the work as it stood on 2026-11-25, so it is no longer only in
a working copy. ucu-island draws prompts at the MacBook notch and keeps an
encrypted vault of logins and keys. The server gains the ask_user and vault
tools, and the browser tools report which sign-in options a page offers.
189 unit tests pass.

The passkey step brings the browser to the user and clicks by script, which
Safari doesn't take as a user's click. The commits that follow replace it
with the steps that were measured to work.
The notch work started from main before the fixes of 25 November. Both
sides added methods at the same place in the server, kept one after the
other, and both named one ask_user: the notch tool's is notch_ask now, and
the tool keeps its name. The notch work sent "front" with "allow" to bring
a shown tab forward, a key the helper already answers as a question, so
the two show paths send "allow" alone, as on main. 219 unit tests pass.
…touch

The passkey step brought the browser to the user, clicked the page's button
by script and lit the notch at once. Safari takes no scripted click for a
passkey, so no sheet opened, and the notch asked for a touch that nothing
could read.

Measured on Safari on 25 November 2026: a page opens the sheet only for a
press made while Safari is the active app, and the sheet reads the finger
only while it is, wherever its window is. So the chat's tab goes to its
private desktop, the helper makes Safari the active app in a pause of the
user's with that window as its main one, which moves nothing on their
screen, and the button gets a real press. The notch lights when the helper
sees the sheet, names the site, and says "Pause, then touch" while the
user's own input keeps Safari from the front. Their app is back at whatever
they do, when the sheet closes, and on every other way out. Nobody touching
for 90 seconds cancels the sheet.

A key the user presses while Safari has the front goes to the sheet: the
helper can't catch it or send it on without a permission to read the
keyboard, which ucu doesn't ask for. So the pause before Safari takes the
front is 1.2 s for keys, and 4 s once a key has ended one.

Chrome isn't measured, so there the window comes to the user, who touches
in it. ask_user with kind passkey takes the same way and no longer lights
the notch by itself.
…e front back at the touch

Live runs on Safari showed three things the first version got wrong.

macOS doesn't activate an app for a helper in the background, so the
passkey sheet never opened. Asking the app itself worked for the first
arming, but on a second one, with the sheet open, it brought a window of
the user's over their app for half a second. The app now comes forward by
the one window on the agent's desktop, as it does when that window is
clicked, and the window is given the keyboard, without which the page says
it has no focus. The user's windows stayed where they were in every run.

Safari keeps the sheet up for 1.4 s after it has read the finger, to say it
is done. The helper tells that moment by a button of the sheet that can no
longer be pressed, gives the user's app back then, and the notch clears.
The result says whether the sheet took a touch or closed without one.

What the user does is looked for a hundred times a second instead of
thirty, so that the key after a shortcut's modifier finds their app in
front again more often.
…e sensor the pause

A user who typed on for eight seconds got nothing pressed and no word of
it. Now the notch asks them to pause after a second, and the step waits for
that pause for as long as it would wait for the touch.

The user asked not to have to stop for the touch. macOS won't say that a
finger is on the sensor: BiometricKit's presence detection answers error 1
to a process without Apple's entitlement, and the finger is read only for
the app in front. So the browser has the front whenever the user's hands
have been still for the time a hand takes to reach the sensor, 0.8 s after
a key and 0.5 s after the mouse, down from 1.2 s and 0.7 s. A key that ends
a pause they didn't mean is lost to their app, so each one doubles the
pause that is waited for, up to four seconds, instead of going there at
once.

The notch says "Sign in to <site>" only while a sheet is open and the
browser has the front, and no longer repeats itself.
…ed touch waited for

Giving the front back went through a call macOS ignores from a helper in
the background, and then, 0.15 s later, through asking the user's app
itself. In a live run that second step fired after the browser had the
front again for a new pause, and pulled it away. Their app now comes back
by the window they were in, at once, and is asked itself only if that
fails and the browser hasn't been given the front again.

Asking an app itself brings its main window along, which with a sheet open
was a window of the user's. So it is used only before the sheet is open,
and an arming that would need it afterwards fails instead.

A sheet whose buttons can be pressed again didn't take the finger: the
notch asks again and the browser gets the front in the next pause, where
before it stayed dark until the wait ran out.
…w what Touch ID is doing

The cursor pile was drawn anew for every step an agent took, several times
a second, and each time it faded in, slid, swept its rim glow and wiggled:
with one agent at work the pile was moving in 97% of the pictures taken of
it at 12 a second. It is drawn again only when who is in it changes, and a
cursor stirs once in a while, with one slow movement instead of three quick
turns. The same stream of steps now moves it in 11% of them: as it comes,
once while it is there, and as it goes.

The ring around the Touch ID icon grew from the icon's bottom-left corner,
because a view's own layer scales about that corner. The island's contents
came in and went out from that corner too. The ring is a layer placed by
its middle, and the contents scale about theirs.

The Touch ID banner now shows what its sheet is doing, as the sheet does:
dim while the user's hands are busy, a ring while the finger is read, a
turning arc with "Signing in…" once the sheet took the touch, then a check
with "Done", and it closes in about the time the sheet takes. It changes
where it is instead of coming in again for each thing it says.

A close left its fade behind, which kept contents that came right after it
unseen until the close had ended.
macOS makes an app that has windows the active one as it starts, when the
app in front started it. A chat's server starts the notch app while the
user is in that chat, so the notch app took their keyboard 0.2 s after it
started, in 5 of 6 starts, and kept it until they clicked their window
again. It restarts each time it has been idle for five minutes.

It now starts as a process without windows, which macOS doesn't activate,
and becomes one with windows when it first shows the island: 12 of 12
starts left the user's app in front. If it is made the active app all the
same, while no field on the island takes the keyboard and it isn't asking
for a finger itself, the app the user was in has the front back at once.
The scan of this branch's history found 23 values in the vault's tests and
in the notch app's storyboard: made-up addresses, and passwords and keys
that open nothing. None is real.

Addresses in the reserved .test domain are allowed now, since nobody can
own one. Two addresses were in domains that are not reserved: they move to
.test, and their five occurrences in the first commit of this work are
acknowledged by their exact places. The made-up passwords and keys are
allowed by their exact values, so a real key of the same shape is still
found.
…w at once, their own first

On 26 November a click on Safari's Dock icon got the user nothing for 16 s. The only window Safari had was a chat's
page on the agent's desktop, so Safari opened none, and the build that ran had no answer to the click.

The answer written for it waited for the agent's step: it took the workspace's lock, which a `wait` or a page load
holds for up to 45 s. It also opened a copy of the agent's page, or brought the agent's window, when the user had a
window of their own.

- The helper tells the chat's server of the click as {"came": ...}, with whether a window of the browser is before
  the user. That is read from the window server, which answers while the browser is busy. The message carries no
  "event", so a server from before it says nothing of it to its agent.
- The server answers on a thread that takes no lock, through a call to the page backend that reads and writes
  nothing of the workspace. A window of the user's in the Dock or in another Space comes back to them. With none at
  all, the chat's window comes to their screen with its page as it is, and its tab gets the chat's mark, by which
  the chat finds it among theirs. What the chat keeps of the page changes at its next step.
- A click that brings the user a window of their own is answered by that window alone.
- Coming to the browser another way than by its Dock icon counts as the click does.
- A click on a chat's preview at the notch asks for the chat's page. The notch app tells the chat's helper, which
  brings a parked app forward or tells the server. With a window of the user's on screen the page opens in a tab of
  that window, and the agent moves into that tab at its next step. Before, the click only activated the app, which
  shows nothing while its window is out of sight.
- The guard that gives the keyboard back to the user's window took a window out of the Dock that the user had just
  put there. With no window of theirs before them, the app whose window they see gets the keyboard now.

Measured with the user's own clicks on a local page, each during a 40 s step of the agent's, on builds of this
change as it grew. With no window of theirs, the agent's window was on their screen 0.57 s after the press, before
the rule that their own window comes first. With theirs in the Dock, theirs came back in 0.54 s and the agent's
stayed out of sight, with the front going to another app for half a second on the way. A window they put in the
Dock stayed there. What came after those runs had no real click: the hold-off that ends that flicker, the
message's new name, and the two conditions on the keyboard hand-off. A run without the user showed their window on
the same tab before the agent's tab opened, while its page was away, and after it came back.
… the agent's steps too

The helper told the chat's server that the user had come to the browser another
way than by its Dock icon only while it watches the apps the chat drives: during
a step of the agent's and for 10 s after it. A Command-Tab to Safari later than
that, with the chat's page still on the agent's desktop, got the user an app in
front with no window, which is what this branch set out to end.

The server is told before that check now, whenever the user comes to the browser
and has no window of it before them. It hears of such a switch more often, so
two tests say what it does with one: what it does for a click on the Dock icon
while a page is away, and nothing while none is.

Found by reading, and the helper's side is not verified by a run. A Command-Tab
posted by a program was sent back as an app that came forward by itself in each
of three tries, so a test could not play the user's switch, and no unit test
covers the helper. With a scratch build of the changed helper the notch pass
still works, a Command-Tab posted during a step is still sent back, and one
posted between steps tells the server nothing.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant