mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-12-01 00:49:33 +01:00
5f4741f2690764d4534a8984a7374baf87a8f444
10
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
150f01e9b4 |
feat(desktop): the whole-display full screen is on by default, has a switch in App Settings, and the tabs go around the camera
Three things the owner asked for after seeing the first build on a MacBook
Pro with a camera housing, and one bug that run found.
On by default. `wholeScreen` in desktop.json now reads as on when it is
absent. The View menu item shows only while a display with a housing is
connected, since the option's own value no longer says anything about the Mac.
A switch in App Settings (Appearance > Mac App). The setting stays the app's:
the app tells each page what the switch shows
(`CodemanHostCutout.option({ available, enabled })`, on every page load and
whenever it changes), the group shows only inside the app on a Mac with such a
display, and saving sends a changed switch back through
`CodemanHost.setWholeScreen` (IPC `wholeScreen`, trusted frames only). The
menu item and every open page follow. It is never a key of the settings the
page stores or the server keeps.
Tabs on both sides of the camera. The toolbar's box used to start left of the
housing, so the first row of tabs ended there and the room up to the toolbar
stayed empty: three of ten tabs in the first row on that display. Now
`fitTabs()` reads the tabs' rectangles, finds the one that would overlap the
housing and gives the room to the tab before it as its right margin, so the
row carries on right of the housing (five of ten there, same header height).
Nothing is added to the strip and no tab is reordered. The tab strip calls it
once its row mode is decided and before it measures one row; a resize observer
follows a tab that grows or is added with no render behind it. The toolbar
keeps its own box, a user-chosen width included, and takes the covering box
(`html.host-cutout-toolbar`) only when it would reach the housing, and in a
solo window.
The bug: a window that comes out of a macOS Space is its own first responder
and takes no keys. Ticking the option while in macOS's full screen left the
terminal with a hollow cursor until a click. The web view now gets the keys
when nothing else had them.
Seen on the MacBook with the first build: launch into the mode, typing, the
menu bar sliding in over the header, leaving and entering, both change-overs,
relaunch, command+W, Dock and menu bar never stuck. Not yet seen there: this
commit's default, switch and focus fix (the Mac went to sleep before the
second round).
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
|
||
|
|
d5ddf2e250 |
feat(desktop): full screen over the whole display, the strip beside the camera included
On a MacBook with a camera housing (the notch), macOS's full screen ends the window below the housing and paints the strip beside it black. No setting changes that, so the Mac app gets a second kind of full screen, off by default: View > Full Screen Uses the Area Beside the Camera. The app (packages/desktop/src/whole_screen.rs): - The window loses its title bar, the Dock and the menu bar auto-hide, and the window gets the display's whole frame, which reaches behind the housing. - An override of toggleFullScreen: on tao's window class decides per request, so the green button, the menu item, its shortcut and the launch into full screen all follow the option. It only applies on a display with a housing. - performClose: asks the delegate while the window has no close button. - Changes into and out of macOS's own full screen are tracked from AppKit's notifications: while one is under way the window is not restyled and its frame is not saved. The Dock and menu-bar options are reconciled, so what a native Space in front kept from being set or taken off is done afterwards. - Info.plist: NSPrefersDisplaySafeAreaCompatibilityMode = false. The page (src/web/public/host-cutout.js, styles.css): - A page is drawn behind the housing only after it said it copes (CodemanHost.cutoutReady); the app answers with where the housing is, and the toolbar's box starts left of it and pads its content past it, so the tabs end before the housing and the toolbar begins after it. - Until then the web view stays below the housing with a black strip above it, which is what full screen looked like before: an older server, the connect page and a raw file are unchanged. - With the tabs grouped by state, by case or as a ledger in the header strip the page says no: ending every row at the housing costs more height than the strip gives. Not yet seen on a MacBook with a housing: the AppKit path was type-checked, unit-tested where it is pure and reviewed, on a Mac mini without one. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> |
||
|
|
8d7d0c5c7f |
Merge #795: feat(desktop): keep the Mac awake while agents work, lid closed included
# Conflicts: # packages/desktop/README.md |
||
|
|
79a6c03363 |
feat(desktop): keep the Mac awake while agents work, lid closed included
Codeman > Keep This Mac Awake in the macOS app: While Agents Work (an agent at work, plus 5 minutes after the last one stops) or Always While Codeman Is Open. Off by default, and only for a Codeman on this Mac. - Idle sleep needs no password: the app holds an NSProcessInfo activity with IdleSystemSleepDisabled, which the kernel drops with the process. While it only watches for work, an activity that still allows sleep keeps App Nap from slowing its look at the server. - On a MacBook, Only on Power Adapter (on by default) pauses it on battery, and Also With the Lid Closed installs a small LaunchDaemon behind macOS's administrator prompt. It sets pmset disablesleep only while the app keeps a fresh request file with its live pid, only on the power adapter, and undoes only what it set itself. The app writes the script and plist as root from the copies built into it. - A status line at the bottom of the submenu says what it does now. This brings the macOS part of the keep-awake idea from PR #595 into the app; the server-side setting and the Linux route are left out for now. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
7d96b3dcf6 |
feat(desktop): the lid logo breathes, blinks and flashes on its own fades, behind one switch
The 1.50.0 blink switched LEBacklightMode on and off. Every style was a lit logo with short dark blips that differed only in how many there were, and Working (Heartbeat) looked busier than Waiting for you (Wink), so urgency read backwards. Each change was also a write to a setting corebrightnessd keeps in root's preferences, and new users had to pick a style in three submenus before anything happened. Now one rule: the more the logo moves, the more it needs you. - View > Blink Apple Logo is one switch, off until turned on. It shows Breathe while agents work, Calm for a yellow tab and Alarm for a red one. Each state can take another style under View > Apple Logo Blink Styles. Picking a style turns the switch on, and turning it on with every state off brings back those three. - Breathe is new: a slow fade out and back in, every 6.3 s. - The logo moves on the LED's own hardware fades (LEPWMFactorFadeDuration, then DisplayLogicalState Blank or Unblank), as LogoLight measured them on the real logo (MIT, reimplemented in Rust, not copied). A blink writes no setting and leaves nothing behind a restart. LEBacklightMode is only read, so a logo the user switched off stays off. - The direction of a fade is tracked, because the daemon ignores a write in the direction it already heads and the state can't be read back. When the direction is unknown, the logo is turned round with a 1e9 s fade first. - After every Blank the keyboards alone are told Unblank, and only while the built-in display is awake (CGDisplayIsAsleep). They are told Blank when it sleeps and Unblank when it wakes. When it sleeps, the fade duration also goes back to automatic, as LogoLight does. - A rise from exactly dark waits for a display frame, up to 0.5 s. Short dark beats (up to 0.35 s) turn round before their fall ends, so they never reach 0. Long ones time their light from when the rise starts. - Every end puts the logo back: lit, with the automatic fade duration. A new marker file (logo-fade) covers a killed child. 1.50.0's marker (logo-blink) still switches back on a logo that version left off. - While LogoLight runs, Codeman leaves the logo to it (process-name check), and the app says so when the switch is turned on. - Settings from 1.50.0 keep their styles, with the switch on if any was chosen. All three off was that version's default, so it reads as untouched. The tests run the blink against a fake corebrightnessd that moves in 17.5 ms frames on the measured spring curve. It starts each fade 19 ms after the write, ignores a write in the direction it already heads, and holds a rise from exactly dark back by a configurable delay. They pin these cases: - dips never reach 0 - long dark beats keep their light - no keyboard is told to light while the display sleeps - every end leaves the automatic duration and a lit logo - a logo switched off or driven by LogoLight is left alone - old settings are migrated An ignored probe (what_this_mac_answers) reads a Mac's displays, processes, keyboards and logo without writing anything. Not measured on the real logo, since there was no MacBook to test on: - how the 0.12 to 0.36 s fades of the hard styles look - whether a rise from a dip (about 7%) really skips the frame wait - the keyboard during Alarm - the keyboards through a real display sleep Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
ad5455044a |
refactor(desktop): main.rs says each repeated step once
No behavior change. What was written out two to four times now has one name: - AppWindow::new and AppWindow::hidden_for_download, window_builder, placed_position (the corner tao places, which the frame save and the pop-out cascade both read; cfg! instead of two attribute pairs), file_name_of and UNNAMED_FILE for the download toast. - page_sender, which in_background, attach_to_run and both install starts use; plan_message and remote_install_failed for the connect page's answers; open_external_raw for the two OpenExternal commands; choosing() for the four phase checks. - An accepted probe (Ok, or a password to change) runs one set of steps. - macos::install runs inside build_webview, so no web view can be built without the dialog and login handlers. - ProbeDone no longer carries the Authorization header beside the username and password it is made from; basic_auth makes it. - Load::ConnectPage loses its manual flag, which was never true there. - MIN_SIZE reads config's limits, the default username is setup::DEFAULT_USERNAME, and the repository and wiki addresses live in menu.rs. - The module doc names the modules as they are now, and two doc comments that had slid onto the wrong item are back on theirs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
7edf1a1c27 |
feat(desktop): a blink style for each state of the agents
The logo said one thing: agents are working. It now has a style of its own for each state the tabs show: at work, finished and waiting for you (yellow), and stopped on a permission or a question (red), set under View > Blink Apple Logo. The most urgent state with a style wins, red then yellow then work, and a state set to Off falls through to the next instead of silencing the logo. Red and yellow come from `GET /api/approvals`, the list the page rebuilds those tabs from after a reload, read natively for the reason the session list is: WebKit stalls a hidden page's stream. An idle item stops counting once it is acknowledged, so the logo stops when the tab's colour goes. The request is skipped while neither alert has a style, a 404 from an older server reads as no alerts, and a request that fails keeps the last answer. A dialog on screen costs the server one tmux capture per poll. Alarm is new: three sharp flashes and a short rest. It stays under the limit of three flashes in any second, so its urgency comes from its shape. A style saved by the earlier version stays as the one for work, and yellow and red start as Wink and Alarm, since whoever chose one asked for a logo that talks. `SETTLE` goes from 2 s to 3 s, the time the server takes to judge a new dialog, so a prompt answered before its hook landed never flashes red. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
cd4cee15a7 |
feat(desktop): blink the lid Apple logo while agents work
On a MacBook Pro with a PROLED XDR display, the lit Apple logo on the lid can blink while agents work and stop when they finish, so a run can be read from across the room. View > Blink Apple Logo While Agents Work picks a style (Calm, Slow, Wink, Heartbeat, Fast). It is off by default, and the menu exists only on a Mac that has the logo. Apple documents one control for the logo, `sudo defaults write com.apple.CoreBrightness LEBacklightMode -int 0`. The same setting is a property of BrightnessSystemClient in the private CoreBrightness framework, which a process of the logged-in user can set with no administrator, so nothing here needs a helper or a password. The setting is system-wide and survives a reboot, and the release profile has panic = "abort", so the work runs in a child process (this binary with --logo-blink) tied to the app by a pipe. When the pipe closes, however the app ended, the child restores the logo and exits. A marker file covers power loss and a SIGKILL of the child itself. The child asks api/sessions itself: WebKit stalls the event stream of a hidden page, which lost whole turns and ran a blink 39 s past the end. It sends the session cookie of its first answer with every poll, because a good password without a cookie creates a login session each time and Codeman evicts the oldest of 100. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
a42ce9c79f |
fix(desktop): a starting server, windows that open where expected, and the review's smaller findings
Found by the three-part review of this branch. Each was checked against the source first; every decision that can run without a window has a unit test. This Mac: - A Codeman that runs but listens nowhere yet (the first seconds after login, a restart) was reported as "already running ... it listens at process N, which this app cannot open", and Start was refused for it. It is now its own state: the tab says "starting", looks again every second, and opens Codeman once it is up when a connect to this Mac had just been refused. The state table is a pure function with a test (setup::local_state). - A server the app starts runs in the home folder, like one started by launchd or in a terminal. It ran in the app's own directory (`/` after a Finder launch), which Codeman then used as the default for sessions. - Server detection accepts any entry word that `web` follows, so a dev server under a folder named codeman is seen and never gets a second server beside it. - A login shell is polled from 5 ms up instead of every 100 ms, and the port after a launchd start every 100 ms instead of 500: both were pure waiting. - The last line of stdout is no longer glued to the first line of stderr. Addresses and policy: - A tailnet name typed with a port gets http://, not https://. With a port it is Codeman's own listener; https there ended in a TLS error with no hint. - within_base refuses `..%2F` and the other encoded ways out of the base path, so a sibling app behind a decoding proxy never sees the login. - A status answer whose body stalls is a timeout, not "something else answers here". - The folder pop-out pattern matches the two routes the server has. - A malformed `window` in desktop.json no longer costs the server list. Windows: - Pop-outs step off the window in use. tao centres a window with no position, so every pop-out opened exactly on top of the one before. - A window opened by a script no longer brings the app to the front: wry activated the application for it, whatever the window itself was told. - The first-run window sits between the menu bar and the Dock. Centred in the whole display, its bottom was under the Dock on a 900 pt high one. - The window frame is saved once after a move or resize ends, not once a second during the drag. Also makes the connect page independent of TextEncoder and scrollIntoView, so it runs in jsdom as well as in a web view. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> |
||
|
|
8ba5134174 |
feat(desktop): native macOS app that runs, installs or connects to Codeman
Adds packages/desktop, a small native app (Rust: tao, wry/WKWebView, muda, objc2) that opens Codeman in its own window. The universal app is about 5 MB (3.2 MB as a DMG) and runs on macOS 11.3 or later. - Connect screen with two tabs. This Mac finds the local Codeman and offers Open, Start or Install. Start uses launchd for a LaunchAgent install and codeman web -d otherwise. It never starts a second server while one runs, because two servers on one data dir share live sessions. Another machine connects by address (recent servers, Keychain logins) and can install Codeman there over SSH. - Installs run Codeman's install.sh in Terminal from a self-deleting .command script. The installer needs a terminal for sudo, Homebrew and ssh. A local install uses --local --service and the first free port from 3000, and the app opens Codeman once it answers. - The local Codeman's login is read from its LaunchAgent or ~/.codeman/.env. It is sent only to 127.0.0.1 on that port, only while the user's own Codeman process holds it, and is never saved. - Native JS dialogs (alert, confirm, prompt) and HTTP Basic challenge answers, both scoped to Codeman's own pages, so the page keeps working after a server restart. App cookies are cleared before every connect. - Pop-outs through window.CodemanHost, with an allowlist (webview/ never opens a window), external links in the default browser, downloads to ~/Downloads, real full screen and window state that is remembered. - The connect page refuses a WebKit older than Safari 16.4, which Codeman's terminal needs. Codeman side: viewSubagentTranscript shows a toast when the pop-up is refused instead of failing, with zh-CN strings and a test that pins them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> |