machines: move Machines under Settings with a list and Add a machine
Machines is a Settings section beside Connections and drawn like it: /conversation/settings/machines lists the person's machines as compact rows (name, state, role, platform) that open in place for the details. Other people's machines, which only an owner sees, are folded with a count. Revoke and Remove now are quiet buttons in the details, each asking once more before it posts the same form as before. A machine with no runner session reads Never connected with a hint to check that its runner is running. /conversation/settings/machines/add shows the /install.sh line, the code field and the person's new machines, following the person's event stream: nav-stream.js passes the runner event on and machines.js swaps the list in place. /runners/enrol, the address runners print, still serves both screens. The approval, inspect, revoke and remove-now handlers keep their checks; only the pages and 303 targets moved. 35 new strings, accepted by a delegated Astra pass (5 changed). Budgets raised to the measured values: internal/equipo source lines 16450 to 16664, internal/thintest test lines 11600 to 11759.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
31 files changed,
+1,005
−79
.rastrillo/budgets.txt+2 −2docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md+85 −0internal/equipo/app.go+2 −0internal/equipo/chat/store.go+4 −0internal/equipo/copy.go+38 −0internal/equipo/handlers.go+5 −2internal/equipo/icons/icons.go+3 −0internal/equipo/mac_view_test.go+4 −3internal/equipo/machines_view.go+144 −0internal/equipo/machines_view_test.go+181 −0internal/equipo/runner_handlers.go+57 −20internal/equipo/runners.go+61 −3internal/equipo/settings_hub.go+1 −0internal/equipo/static/equipo.css+62 −0internal/equipo/static/machines.js+90 −0internal/equipo/static/nav-stream.js+7 −1internal/equipo/templates/chrome.html+1 −1internal/equipo/templates/connections.html+1 −1internal/equipo/templates/empty.html+1 −1internal/equipo/templates/onboarding.html+1 −1internal/equipo/templates/runners.html+76 −37internal/equipo/templates/settings_nav.html+1 −1internal/equipo/templates/work_parts.html+1 −1internal/thintest/inline_style_test.go+1 −1internal/thintest/machines_browser_test.go+55 −0internal/thintest/machines_fixture_test.go+39 −0internal/thintest/machines_pages_test.go+74 −0internal/thintest/projects_pages_test.go+1 −1internal/thintest/settings_pages_test.go+3 −1internal/thintest/settings_rail_pages_test.go+3 −1internal/thintest/settings_ux_browser_test.go+1 −1
CI failed — run details
Intent
diff --git a/.rastrillo/budgets.txt b/.rastrillo/budgets.txt| index 01305a54..e24eb314 100644 |
| --- a/.rastrillo/budgets.txt |
| +++ b/.rastrillo/budgets.txt |
| @@ -14,7 +14,7 @@ perf GET /* skip Unknown private paths render 404; this fallback contains no scr |
| time internal/equipo/team 60s Plan 3 loaded CI measured 45.985s; niced serial reruns measured 18.079s and 22.031s. Keep migration, recovery, accounting and concurrency assertions; 60s leaves 30 percent headroom above loaded CI. |
| time internal/equipotest 300s Final fix package rerun measured 187.035s (review 172.4s); 300s gives 60 percent headroom for HTTP, sandbox, authority and final regression coverage. |
| -size internal/equipo 16450 - Spend 1 (work_spend.go and the task page lines, about 90 lines) merged onto the four UI branches: measured 16381. The team panel merged onto Projects UX, the Settings pattern and the Connections countdown: measured 16280 with all four. The team panel adds the compact specialist rows, the drawer page and its view (team_panel.go, team.html, team-panel.js, about 420 lines), the activity wording (team_activity.go) and their CSS and copy; the command reading went to its own package (internal/equipo/activity); measured 15788. Projects UX merged onto the Connections countdown and the Settings pattern: measured 15942 with all three. Projects UX adds the Projects page order (starred, active, quiet folded), the auto-star rules and their receipt, whole-word descriptions and the star action (project_order.go, about 200 lines), the Mac decision and Ask about this; measured 15815. Connection resets as a countdown (inText and its words, about 60 lines) and the Settings page pattern (settings_hub.go, team_links.go, about 30 lines) together; measured 15577 with both merged. The Connections Add page and four display fixes add the Add page handler, account naming, stale meter filtering and the resting row's destination (connections_view.go, chat_connections.go, about 120 lines); measured 15467. Claude setup tokens add the token card, sealing route and Check again beside the composer and Mac lines; measured 15350. Settings in sections adds the section pages, the secondary menu and the old URLs' redirects (settings_hub.go, about 110 lines, less the removed Thinking words page); measured 14922. Mac runners (Darwin worker) add the one-tap enrolment link, the runners view's self-probes, /install.sh, the outside-the-sandbox label and their copy (about 90 lines); measured 15058. Mac runners add the runner role, the protocol route and the placement minute, then two-phase removal, Remove now and Recover (about 110 lines). Housekeeping slice 1 adds the Housekeeping view beside the Notebook, the digest line and their copy (housekeeping_page.go, about 170 lines); measured 14513. Thin v1 UX1 thinking words adds the settings page and the set registry wiring (thinking_words.go) and 55 strings of phrases; measured 14411. The Connections page to Paul's approved mockup (connections_view.go: what is answering, the preference, rows with headroom, roles, usage and the recovery action, about 300 lines); measured 14268. Merged with UX1 round 3 (duplicate combining with Undo, timeline headlines) beside the Connections page; measured 13895. Connections slice 1 adds the Connections page, the switched line and the no_connection card and their copy (chat_connections.go, about 220 lines). Measured 12269. Thin v1 UX1 adds the inner screens' view model (work_views.go: stage track, badges, timeline, decisions, project facts, about 830 lines), the rich page handlers and their copy (about 170 lines); measured 13263. Thin v1 slice 4c adds the merged line, the merge card and its copy (about 60 lines). Thin v1 slice 4 adds the thin sidebar (rail.go), review and checks lines on the task card and pages, and their copy (about 190 lines). Thin v1 slice 3 adds the task card, the thin Tasks and Projects pages and their actions over the chat store, and their copy (about 280 lines). Thin v1 slice 2 adds activity labels, card copy and card rendering on the chat page (about 250 lines); slice 1 added the chat wiring and page (about 180 lines) beside code its slice 7 sweep deletes (the live hub, the old coordinator); lower then. Task 7 keeps the existing ceiling by moving transaction-bound event lookup into conversation. Measured 10796 source and 437 test lines; roster, database, pending copy and execution wiring remain here. |
| +size internal/equipo 16664 - Machines in Settings adds the Machines list and Add a machine screens (machines_view.go, the runners.html rewrite, machines.js, their CSS, three icons and 35 strings, about 280 lines); measured 16664. Spend 1 (work_spend.go and the task page lines, about 90 lines) merged onto the four UI branches: measured 16381. The team panel merged onto Projects UX, the Settings pattern and the Connections countdown: measured 16280 with all four. The team panel adds the compact specialist rows, the drawer page and its view (team_panel.go, team.html, team-panel.js, about 420 lines), the activity wording (team_activity.go) and their CSS and copy; the command reading went to its own package (internal/equipo/activity); measured 15788. Projects UX merged onto the Connections countdown and the Settings pattern: measured 15942 with all three. Projects UX adds the Projects page order (starred, active, quiet folded), the auto-star rules and their receipt, whole-word descriptions and the star action (project_order.go, about 200 lines), the Mac decision and Ask about this; measured 15815. Connection resets as a countdown (inText and its words, about 60 lines) and the Settings page pattern (settings_hub.go, team_links.go, about 30 lines) together; measured 15577 with both merged. The Connections Add page and four display fixes add the Add page handler, account naming, stale meter filtering and the resting row's destination (connections_view.go, chat_connections.go, about 120 lines); measured 15467. Claude setup tokens add the token card, sealing route and Check again beside the composer and Mac lines; measured 15350. Settings in sections adds the section pages, the secondary menu and the old URLs' redirects (settings_hub.go, about 110 lines, less the removed Thinking words page); measured 14922. Mac runners (Darwin worker) add the one-tap enrolment link, the runners view's self-probes, /install.sh, the outside-the-sandbox label and their copy (about 90 lines); measured 15058. Mac runners add the runner role, the protocol route and the placement minute, then two-phase removal, Remove now and Recover (about 110 lines). Housekeeping slice 1 adds the Housekeeping view beside the Notebook, the digest line and their copy (housekeeping_page.go, about 170 lines); measured 14513. Thin v1 UX1 thinking words adds the settings page and the set registry wiring (thinking_words.go) and 55 strings of phrases; measured 14411. The Connections page to Paul's approved mockup (connections_view.go: what is answering, the preference, rows with headroom, roles, usage and the recovery action, about 300 lines); measured 14268. Merged with UX1 round 3 (duplicate combining with Undo, timeline headlines) beside the Connections page; measured 13895. Connections slice 1 adds the Connections page, the switched line and the no_connection card and their copy (chat_connections.go, about 220 lines). Measured 12269. Thin v1 UX1 adds the inner screens' view model (work_views.go: stage track, badges, timeline, decisions, project facts, about 830 lines), the rich page handlers and their copy (about 170 lines); measured 13263. Thin v1 slice 4c adds the merged line, the merge card and its copy (about 60 lines). Thin v1 slice 4 adds the thin sidebar (rail.go), review and checks lines on the task card and pages, and their copy (about 190 lines). Thin v1 slice 3 adds the task card, the thin Tasks and Projects pages and their actions over the chat store, and their copy (about 280 lines). Thin v1 slice 2 adds activity labels, card copy and card rendering on the chat page (about 250 lines); slice 1 added the chat wiring and page (about 180 lines) beside code its slice 7 sweep deletes (the live hub, the old coordinator); lower then. Task 7 keeps the existing ceiling by moving transaction-bound event lookup into conversation. Measured 10796 source and 437 test lines; roster, database, pending copy and execution wiring remain here. |
| size internal/equipotest - 13400 Task 21 repairs historical migration and conversation fixtures after Plan 3. Measured 13024 test lines; the 300s time ceiling is unchanged. |
| time internal/runner/checks 90s CI worker measured 44.553s (44.6s rounded); 60s gives 34 percent headroom. Shared baseline capture reduces repeated Go runs; retain the CI allowance for sandbox sentinels, timeout and child cleanup. 2026-11-07: loaded CI (host load about 24) measured 66.5s with the package unchanged by thin v1 slice 4 beyond optional check mounts; 90s keeps 35 percent headroom. |
| time internal/runner 330s Plan 3 CI repair measured 292.120s for the full package (controller CI 472.184s). Parallel plan graphs and removal of repeated progress floods reduced their local targeted run from 146.920s to 30.784s; the original bug graph retains volume coverage. Keep 330s for journal, proxy, recovery and namespace integration, with 13 percent headroom. |
| @@ -62,4 +62,4 @@ perf GET /conversation/attachments/{id}/preview skip Composer attachments: an im |
| perf GET /api/v1/runners skip Mac runners person API: bearer-only JSON for devices; the browser shows runners in the Team section. |
| time cmd/equipo-runner 60s Mac runners slice B: TestReleaseRunnerHasNoFakeWorker builds the release runner exactly as make release-runner does and the thin package under the testbuild tag (measured 11.9s locally with a warm cache). |
| size internal/headless - 8300 Claude's sign-in by a link adds its end-to-end, contained-launch and real runner kill tests (signin_test.go, signin_contained_test.go, about 400 lines); measured 8090. |
| -size internal/thintest - 11600 Mac recheck adds its enrolment, skip and outcome contracts (macrecheck_contract_test.go, about 210 lines); measured 11537. Spend 1 merged onto the four UI branches: measured 11325. Spend 1 marks overcounting Claude rows (about 120 lines); it adds the task page's spend contract and the 0059 upgrade (spend_pages_test.go, about 100 lines) and the fix round feedback by protocol (about 40); measured 10224. The team panel merged onto Projects UX and the Settings UX pass: measured 11064 with all three. The team panel adds its page contract and the drawer's browser drive at 1280 and 390 (team_panel_test.go, team_panel_browser_test.go, about 300 lines); measured 10235. Projects UX merged onto the Settings UX pass: measured 10768 with both. Projects UX adds the Projects page contracts (order, quiet fold, filter, stars and Undo, the coordinator's star, repository counts, whole words), the decision cards' Mac and Ask about this contracts and their browser drive (projects_pages_test.go, projects_browser_test.go, about 330 lines); measured 10321. The Settings UX pass adds the Settings pattern's page contracts and the savebar, Housekeeping groups and Teams browser drives (settings_ux_pages_test.go, settings_ux_browser_test.go, about 430 lines); measured 10390. Claude's sign-in by a link adds the code contract (signin_contract_test.go: the card, the code route's refusals, the wrong-code card, the kind it becomes and the canary sweep, about 220 lines); measured 9896. The Connections Add page and the Settings rail add their page contracts and the rail's browser drive (connections_add_pages_test.go, settings_rail_pages_test.go, about 230 lines); measured 9676. Claude setup tokens add the token and Check again contracts; measured 9444 with the composer and Mac lines merged. The instant thinking line adds its browser drive (instant_browser_test.go, about 230 lines); measured 9064 with the composer and Mac lines merged. Mac runners add the role, scoping, migration, placement, withdrawal, transfer and publication contracts (about 900 test lines) beside the thin v1 contracts; one package keeps one instance harness. |
| +size internal/thintest - 11759 Machines in Settings adds its fixture, page and browser tests (machines_fixture_test.go, machines_pages_test.go, machines_browser_test.go, about 160 lines); measured 11759. Mac recheck adds its enrolment, skip and outcome contracts (macrecheck_contract_test.go, about 210 lines); measured 11537. Spend 1 merged onto the four UI branches: measured 11325. Spend 1 marks overcounting Claude rows (about 120 lines); it adds the task page's spend contract and the 0059 upgrade (spend_pages_test.go, about 100 lines) and the fix round feedback by protocol (about 40); measured 10224. The team panel merged onto Projects UX and the Settings UX pass: measured 11064 with all three. The team panel adds its page contract and the drawer's browser drive at 1280 and 390 (team_panel_test.go, team_panel_browser_test.go, about 300 lines); measured 10235. Projects UX merged onto the Settings UX pass: measured 10768 with both. Projects UX adds the Projects page contracts (order, quiet fold, filter, stars and Undo, the coordinator's star, repository counts, whole words), the decision cards' Mac and Ask about this contracts and their browser drive (projects_pages_test.go, projects_browser_test.go, about 330 lines); measured 10321. The Settings UX pass adds the Settings pattern's page contracts and the savebar, Housekeeping groups and Teams browser drives (settings_ux_pages_test.go, settings_ux_browser_test.go, about 430 lines); measured 10390. Claude's sign-in by a link adds the code contract (signin_contract_test.go: the card, the code route's refusals, the wrong-code card, the kind it becomes and the canary sweep, about 220 lines); measured 9896. The Connections Add page and the Settings rail add their page contracts and the rail's browser drive (connections_add_pages_test.go, settings_rail_pages_test.go, about 230 lines); measured 9676. Claude setup tokens add the token and Check again contracts; measured 9444 with the composer and Mac lines merged. The instant thinking line adds its browser drive (instant_browser_test.go, about 230 lines); measured 9064 with the composer and Mac lines merged. Mac runners add the role, scoping, migration, placement, withdrawal, transfer and publication contracts (about 900 test lines) beside the thin v1 contracts; one package keeps one instance harness. |
diff --git a/docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md b/docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md| index 11f0396b..ce6b740e 100644 |
| --- a/docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md |
| +++ b/docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md |
| @@ -5995,6 +5995,41 @@ records remain unchanged. |
| | `work.spend_questions` | Questions | Spend 1 (task page and specialist panel) | Runtime; COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11) | |
| | `work.spend_left_out` | Earlier usage not shown | Spend 1 (task page) | Runtime; COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11) | |
| | `work.spend_steps` | Tokens each step used | Spend 1 (task page and specialist panel) | Runtime; COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11) | |
| +| `machines.lede` | The computers that do your work. A machine is online when its runner is connected to Equipo. | Machines (Settings): head line | Runtime; COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11) | |
| +| `machines.mine` | Your machines | Machines (Settings): group heading | Runtime; COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11) | |
| +| `machines.mine_none` | You have no machines yet. | Machines (Settings): an owner with none of their own | Runtime; COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11) | |
| +| `machines.others` | Other people's machines | Machines (Settings): folded group of other people's machines | Runtime; COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11) | |
| +| `machines.state.online` | Online | Machines and Add a machine: row state | Runtime; COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11) | |
| +| `machines.state.offline` | Offline | Machines and Add a machine: row state | Runtime; COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11) | |
| +| `machines.state.never` | Never connected | Machines and Add a machine: row state | Runtime; COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11) | |
| +| `machines.state.removing` | Removing | Machines: row state | Runtime; COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11) | |
| +| `machines.state.revoked` | Revoked | Machines: row state (an owner's trial machine) | Runtime; COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11) | |
| +| `machines.never_hint` | This machine was added but has never connected. Check that the runner is running on it. | Machines and Add a machine: row of a machine that never connected | Runtime; COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11) | |
| +| `machines.last_seen` | Last seen %s | Machines: offline row, after the state | Runtime; COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11) | |
| +| `machines.role.primary` | Main runner | Machines: row role | Runtime; COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11) | |
| +| `machines.role.worker` | Runs checks | Machines: row role | Runtime; COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11) | |
| +| `machines.platform.darwin` | macOS | Machines: row platform | Runtime; COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11) | |
| +| `machines.platform.linux` | Linux | Machines: row platform | Runtime; COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11) | |
| +| `machines.version` | Version | Machines: row details label | Runtime; COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11) | |
| +| `machines.protocol` | Protocol | Machines: row details label | Runtime; COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11) | |
| +| `machines.tags` | Tags | Machines: row details label | Runtime; COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11) | |
| +| `machines.enrolled` | Added | Machines: row details label | Runtime; COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11) | |
| +| `machines.enrolled_by` | Added by | Machines: row details label | Runtime; COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11) | |
| +| `machines.not_reported` | Not reported yet | Machines: row details value before the first connection | Runtime; COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11) | |
| +| `machines.revoke_confirm` | Equipo gives this machine no new work and asks it to stop its current work. It removes the machine once it confirms that work has stopped. | Machines: row details, Revoke machine opened | Runtime; COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11) | |
| +| `machines.revoke_yes` | Yes, revoke it | Machines: row details, Revoke machine confirm button | Runtime; COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11) | |
| +| `machines.remove_confirm` | For a lost or compromised machine. Equipo removes its access now. Work may still be running on it. Any step it may have started is blocked from retrying until the task's creator recovers it. | Machines: row details, Remove now opened | Runtime; COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11) | |
| +| `machines.remove_yes` | Yes, remove it now | Machines: row details, Remove now confirm button | Runtime; COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11) | |
| +| `machines.add` | Add a machine | Machines: add link; Add a machine: title; Settings rail entry | Runtime; COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11) | |
| +| `machines.add_hint` | Install the runner on a Mac or a Linux machine, then approve it here. | Machines: beside the add link | Runtime; COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11) | |
| +| `machines.empty_title` | No machines yet | Machines: empty state heading | Runtime; COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11) | |
| +| `machines.empty_body` | Equipo does its work on your machines. Add one to get started. | Machines: empty state line | Runtime; COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11) | |
| +| `machines.add_lede` | Install the runner on the machine you want to add, then approve it here. | Add a machine: head line | Runtime; COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11) | |
| +| `machines.step_install` | On that machine, run this in a terminal. | Add a machine: step 1, above the install line | Runtime; COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11) | |
| +| `machines.step_code` | It prints a link and a code. Open the link, or type the code here. | Add a machine: step 2, above the code field | Runtime; COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11) | |
| +| `machines.step_approve` | Check that the label and key fingerprint match the machine, then approve it. You can check its connection below. | Add a machine: step 3 | Runtime; COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11) | |
| +| `machines.new` | New machines | Add a machine: group heading | Runtime; COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11) | |
| +| `machines.new_none` | Recently approved machines appear here, along with any that have never connected. | Add a machine: group with no new machines | Runtime; COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11) | |
| ## Task 21 |
| @@ -6719,3 +6754,53 @@ pass merges under slice 4c. The hint is a plain line again: "Merge now |
| merges it without checks. Wait for a Mac keeps it ready. Once a Mac is set |
| up, checks run, and if they pass, Equipo merges it by itself." Accepted by |
| delegation like its neighbours. |
| + |
| +## Machines in Settings (2026-11-11) |
| + |
| +Machines moved under Settings, beside Connections and drawn like it: |
| +`/conversation/settings/machines` lists the person's machines as compact |
| +rows (name, state, role, platform) that open in place for the details |
| +(platform, version, protocol, tags, checks, when and by whom it was |
| +added, key fingerprint, self-checks, trial history, taint or removal). |
| +Other people's machines, which only an owner sees, are folded and closed |
| +with a count. Revoke and Remove now sit in the details as quiet buttons, |
| +each opening a short explanation and a confirm button that posts the |
| +same form as before. A machine with no runner session reads Never |
| +connected, tinted, with a line saying to check its runner is running. |
| + |
| +`/conversation/settings/machines/add` is Add a machine: the install line |
| +`/install.sh` answers (shown only when it answers), the code field, and |
| +the person's new machines (never connected, or approved in the last half |
| +hour). It follows the person's event stream: nav-stream.js passes the |
| +`runner` event on as `equipo:runner` and machines.js reads the page again |
| +without the code and swaps the list in place. There is no new external |
| +polling; it also rereads its own page once a minute while visible, as a |
| +runner that stops answering goes offline with no event. |
| + |
| +`/runners/enrol` is the address runners print and check, so it still |
| +serves: without a code it is the Machines list, with `?code=` the Add a |
| +machine page and its approval card. The approval, inspect, revoke and |
| +remove-now POSTs, their checks and `approveOrInspect` are unchanged; |
| +only the pages they render and the 303 targets moved (approval to Add a |
| +machine, revoke and remove-now to Machines). Machines that have not yet |
| +been approved cannot appear on Add a machine before their code is |
| +entered: the enrolment holds only the code's hash and binds no person |
| +until approval, so listing them would change the approval model. |
| + |
| +Copy: 35 new strings. One delegated Astra pass (gpt-6-astra, effort |
| +high) kept 30 and changed 5 (`machines.lede`, `machines.revoke_confirm`, |
| +`machines.remove_confirm`, `machines.step_approve`, |
| +`machines.new_none`); all 35 rows above are marked COPY ACCEPTED BY |
| +DELEGATION (Astra, 2026-11-11), and copy.go matches. Astra's one flag: |
| +a machine stays under New machines for half an hour after approval even |
| +once it connects. That is intended (the person sees it come online), and |
| +`machines.new_none` now says so. |
| + |
| +Verification (targeted, niced): |
| + |
| +- `go test ./internal/equipo -run 'TestMachines|TestRunnersViewShowsProbes|TestTemplateCopyKeys|TestRunnerCopyInventory|TestInstallScript'`: ok. Mutations: the others fold rendered open, and the never-connected hint removed: TestMachinesList red for each; restored. |
| +- `go test ./internal/thintest -run 'TestPagesMachines|TestPagesSettingsSections|TestPagesSettingsRail|TestPagesRemovalAndRecover|TestPagesTaskDecisionsSayWhy|TestPagesInnerScreens'`: ok. |
| +- `go test -tags browser ./internal/thintest -run 'TestBrowserMachines$'` then `'TestBrowserSettingsShots$'`: ok (the never-connected Mac comes online in place, no reload). |
| +- `go test ./internal/equipotest -run 'TestEnrolment|TestMacEnrolment|TestRunnerRemovalRevokes|TestRunnerAppCSRF|TestRunnerTrialHistoryLabel'`: ok. |
| +- `go test ./internal/plan3test -run 'TestPlan3ReleaseBoundaries|TestOnboarding|TestCoordinatorAcceptance3B|TestInviteSignInPendingMember|TestInviteCurrentAuthority'`: ok. |
| +- `go test -tags perf ./internal/equipotest -run '^TestPerfScreens$'`: ok. `make budget`: ok after raising internal/equipo to 16664 and internal/thintest to 11759 test lines (measured). |
diff --git a/internal/equipo/app.go b/internal/equipo/app.go| index 5cbdba01..20d25eb8 100644 |
| --- a/internal/equipo/app.go |
| +++ b/internal/equipo/app.go |
| @@ -262,6 +262,8 @@ func RouterWithStore(d *db.DB, cfg Config, mailer mail.Sender, logger *slog.Logg |
| r.Get("/conversation/connections", movedTo("/conversation/settings/connections")) |
| r.Get("/conversation/settings/connections", a.connectionsView) |
| r.Get("/conversation/settings/connections/add", a.connectionsAdd) |
| + r.Get("/conversation/settings/machines", a.machinesList) |
| + r.Get("/conversation/settings/machines/add", a.machinesAdd) |
| r.Post("/conversation/connections", a.connectionsStart) |
| r.Post("/conversation/connections/{id}/cancel", a.connectionsCancel) |
| r.Post("/conversation/connections/{id}/secret", a.connectionsSecret) |
diff --git a/internal/equipo/chat/store.go b/internal/equipo/chat/store.go| index eb9b2aed..b249c051 100644 |
| --- a/internal/equipo/chat/store.go |
| +++ b/internal/equipo/chat/store.go |
| @@ -631,6 +631,10 @@ func maxEvent(tx *gorm.DB) (int64, error) { |
| // runnerOnline is how long a runner stays online after its last hello. |
| const runnerOnline = 75 * time.Second |
| +// RunnerOnline is runnerOnline for the Machines screens, so a machine |
| +// reads online there exactly when placement counts it online. |
| +const RunnerOnline = runnerOnline |
| + |
| func (s *Store) runnerView(tx *gorm.DB, person string) (wire.Runner, error) { |
| id, err := s.authority.PrimaryRunner(tx, person) |
| if err != nil || id == "" { |
diff --git a/internal/equipo/copy.go b/internal/equipo/copy.go| index 431ebc85..d9c789a1 100644 |
| --- a/internal/equipo/copy.go |
| +++ b/internal/equipo/copy.go |
| @@ -159,6 +159,44 @@ var pageCopy = map[string]string{ |
| "teams.forgotten": "%s forgotten.", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11) |
| "teams.undo": "Undo", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11) |
| + // Machines in Settings (Paul, 2026-11-11), accepted by Astra's |
| + // delegated copy pass. |
| + "machines.lede": "The computers that do your work. A machine is online when its runner is connected to Equipo.", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11) |
| + "machines.mine": "Your machines", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11) |
| + "machines.mine_none": "You have no machines yet.", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11) |
| + "machines.others": "Other people's machines", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11) |
| + "machines.state.online": "Online", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11) |
| + "machines.state.offline": "Offline", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11) |
| + "machines.state.never": "Never connected", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11) |
| + "machines.state.removing": "Removing", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11) |
| + "machines.state.revoked": "Revoked", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11) |
| + "machines.never_hint": "This machine was added but has never connected. Check that the runner is running on it.", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11) |
| + "machines.last_seen": "Last seen %s", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11) |
| + "machines.role.primary": "Main runner", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11) |
| + "machines.role.worker": "Runs checks", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11) |
| + "machines.platform.darwin": "macOS", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11) |
| + "machines.platform.linux": "Linux", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11) |
| + "machines.version": "Version", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11) |
| + "machines.protocol": "Protocol", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11) |
| + "machines.tags": "Tags", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11) |
| + "machines.enrolled": "Added", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11) |
| + "machines.enrolled_by": "Added by", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11) |
| + "machines.not_reported": "Not reported yet", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11) |
| + "machines.revoke_confirm": "Equipo gives this machine no new work and asks it to stop its current work. It removes the machine once it confirms that work has stopped.", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11) |
| + "machines.revoke_yes": "Yes, revoke it", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11) |
| + "machines.remove_confirm": "For a lost or compromised machine. Equipo removes its access now. Work may still be running on it. Any step it may have started is blocked from retrying until the task's creator recovers it.", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11) |
| + "machines.remove_yes": "Yes, remove it now", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11) |
| + "machines.add": "Add a machine", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11) |
| + "machines.add_hint": "Install the runner on a Mac or a Linux machine, then approve it here.", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11) |
| + "machines.empty_title": "No machines yet", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11) |
| + "machines.empty_body": "Equipo does its work on your machines. Add one to get started.", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11) |
| + "machines.add_lede": "Install the runner on the machine you want to add, then approve it here.", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11) |
| + "machines.step_install": "On that machine, run this in a terminal.", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11) |
| + "machines.step_code": "It prints a link and a code. Open the link, or type the code here.", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11) |
| + "machines.step_approve": "Check that the label and key fingerprint match the machine, then approve it. You can check its connection below.", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11) |
| + "machines.new": "New machines", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11) |
| + "machines.new_none": "Recently approved machines appear here, along with any that have never connected.", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11) |
| + |
| "account_setup.title": "Connect a model account", |
| "account_setup.label": "Account label", |
| "account_setup.runner": "Paired machine", |
diff --git a/internal/equipo/handlers.go b/internal/equipo/handlers.go| index a6c7c988..0993fdb7 100644 |
| --- a/internal/equipo/handlers.go |
| +++ b/internal/equipo/handlers.go |
| @@ -47,7 +47,11 @@ type pageData struct { |
| HousekeepingStream bool |
| Models modelsView |
| ConnectionsStream bool |
| - ChatStream bool |
| + // Machines is the Machines screens' (machines_view.go); |
| + // MachinesStream loads machines.js. |
| + Machines machinesView |
| + MachinesStream bool |
| + ChatStream bool |
| // ThinkingSet and ThinkingWords are the person's thinking words for |
| // the thinking line (thinking_words.go). |
| ThinkingSet, ThinkingWords string |
| @@ -75,7 +79,6 @@ type pageData struct { |
| Question TaskQuestion |
| PairingConfirmation, Origin, UserCode string |
| Enrolment Runner |
| - Runners []Runner |
| Nav []NavItem |
| Key, Title, EmptyKey, Address, TeamName string |
| Owner bool |
diff --git a/internal/equipo/icons/icons.go b/internal/equipo/icons/icons.go| index ee91a325..06d4af0b 100644 |
| --- a/internal/equipo/icons/icons.go |
| +++ b/internal/equipo/icons/icons.go |
| @@ -53,6 +53,9 @@ var icons = map[string]template.HTML{ |
| "external-link": `<svg class="icon" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" viewBox="0 0 24 24"><path d="M15 3h6v6"/><path d="M10 14 21 3"/><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/></svg>`, |
| "star": `<svg class="icon" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" viewBox="0 0 24 24"><path d="M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z"/></svg>`, |
| "cpu": `<svg class="icon" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" viewBox="0 0 24 24"><rect width="16" height="16" x="4" y="4" rx="2"/><rect width="6" height="6" x="9" y="9" rx="1"/><path d="M15 2v2"/><path d="M15 20v2"/><path d="M2 15h2"/><path d="M2 9h2"/><path d="M20 15h2"/><path d="M20 9h2"/><path d="M9 2v2"/><path d="M9 20v2"/></svg>`, |
| + "monitor": `<svg class="icon" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" viewBox="0 0 24 24"><rect width="20" height="14" x="2" y="3" rx="2"/><path d="M8 21h8"/><path d="M12 17v4"/></svg>`, |
| + "laptop": `<svg class="icon" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" viewBox="0 0 24 24"><path d="M18 5a2 2 0 0 1 2 2v8.526a2 2 0 0 0 .212.897l1.068 2.127a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45l1.068-2.127A2 2 0 0 0 4 15.526V7a2 2 0 0 1 2-2z"/><path d="M20.054 15.987H3.946"/></svg>`, |
| + "server": `<svg class="icon" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" viewBox="0 0 24 24"><rect width="20" height="8" x="2" y="2" rx="2" ry="2"/><rect width="20" height="8" x="2" y="14" rx="2" ry="2"/><path d="M6 6h.01"/><path d="M6 18h.01"/></svg>`, |
| "more-horizontal": `<svg class="icon" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" viewBox="0 0 24 24"><circle cx="12" cy="12" r="1"/><circle cx="19" cy="12" r="1"/><circle cx="5" cy="12" r="1"/></svg>`, |
| "chevron-right": `<svg class="icon" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" viewBox="0 0 24 24"><path d="m9 18 6-6-6-6"/></svg>`, |
| "chevron-left": `<svg class="icon" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" viewBox="0 0 24 24"><path d="m15 18-6-6 6-6"/></svg>`, |
diff --git a/internal/equipo/mac_view_test.go b/internal/equipo/mac_view_test.go| index c2dcb627..a11f4c73 100644 |
| --- a/internal/equipo/mac_view_test.go |
| +++ b/internal/equipo/mac_view_test.go |
| @@ -38,12 +38,13 @@ func TestChecksOutsideTheSandboxAreLabelled(t *testing.T) { |
| } |
| } |
| -// The Connections runner view shows what a Mac said of itself: its |
| -// platform, where checks run, and each self-probe in words. |
| +// The Machines details show what a Mac said of itself: its platform, |
| +// where checks run, and each self-probe in words. |
| func TestRunnersViewShowsProbes(t *testing.T) { |
| tainted := time.Now() |
| - data := pageData{Runners: []Runner{{ID: "r1", Label: "Tito Studio", TaintedAt: &tainted, Report: &setup.RunnerReport{Platform: "darwin/arm64", Sandbox: wire.SandboxNone, |
| + records := []machineRecord{{Runner: Runner{ID: "r1", Person: "a@example.com", Label: "Tito Studio", TaintedAt: &tainted, Report: &setup.RunnerReport{Platform: "darwin/arm64", Sandbox: wire.SandboxNone, |
| Probes: []setup.RunnerProbe{{ID: "P2", Verdict: wire.ProbeFailed, Detail: "allowed: test.keychain; xcodebuild ran in srt"}, {ID: "P7", Verdict: wire.ProbePassed, Detail: "srt 0.0.81"}}}}}} |
| + data := pageData{Machines: machinesPage(records, "a@example.com", time.Now(), false, "")} |
| var buf bytes.Buffer |
| if err := pages["runners"].ExecuteTemplate(&buf, "content", data); err != nil { |
| t.Fatal(err) |
diff --git a/internal/equipo/machines_view.go b/internal/equipo/machines_view.go| new file mode 100644 |
| index 00000000..99970e09 |
| --- /dev/null |
| +++ b/internal/equipo/machines_view.go |
| @@ -0,0 +1,144 @@ |
| +package equipo |
| + |
| +import ( |
| + "fmt" |
| + "slices" |
| + "strconv" |
| + "strings" |
| + "time" |
| + |
| + "amadan.net/oficina/equipo/internal/equipo/chat" |
| + "amadan.net/oficina/equipo/internal/equipo/setup" |
| +) |
| + |
| +// The Machines screens (Paul, 2026-11-11), in Settings beside |
| +// Connections and drawn like it: one compact row per machine with its |
| +// name, its state in words with a dot, its role and its platform; the |
| +// rest behind a click (the row is a <details>, so it opens without |
| +// scripts). The person's own machines show; other people's (only an |
| +// owner sees them) are folded with a count. Revoke and Remove now sit |
| +// inside the details as quiet buttons, each behind a confirming second |
| +// click. Add a machine is its own screen: the install line, the code, |
| +// and the person's new machines until they connect, following the |
| +// person's event stream. Only presentation lives here: who sees which |
| +// machine is runnersFor's, approval is the enrolment flow's. |
| + |
| +// Machine states, as data-s on the row's state. |
| +const ( |
| + machineOnline = "online" |
| + machineOffline = "offline" |
| + machineNever = "never" |
| + machineRemoving = "removing" |
| + machineRevoked = "revoked" |
| +) |
| + |
| +// machineNewFor is how long a machine stays on the Add page after it |
| +// was approved, so the person sees it come online. |
| +const machineNewFor = 30 * time.Minute |
| + |
| +// machinesView is the Machines list and the Add a machine page. |
| +type machinesView struct { |
| + Adding bool |
| + // Mine are the person's machines; Others everyone else's an owner |
| + // sees, folded. |
| + Mine, Others []machineRow |
| + // New are the person's machines on the Add page: never connected, |
| + // or approved in the last half hour. |
| + New []machineRow |
| + // Install is the install line, "" when this release has none. |
| + Install string |
| +} |
| + |
| +// machineRow is one machine. |
| +type machineRow struct { |
| + ID, Name, Person string |
| + // State is one of the machine states; Words says it, Seen when an |
| + // offline machine was last seen. |
| + State, Words, Seen string |
| + // Role and Platform are the row's facts in words; Mark is the icon |
| + // in its tile. |
| + Role, Platform, Mark string |
| + // The details. |
| + Raw, Version, Protocol, Tags, Enrolled, EnrolledBy, Fingerprint string |
| + Report *setup.RunnerReport |
| + Tainted, Removing, Revoked bool |
| + Revision int64 |
| + TrialOwner, TrialVersions string |
| + TrialAt time.Time |
| +} |
| + |
| +func machinesPage(records []machineRecord, me string, now time.Time, adding bool, install string) machinesView { |
| + v := machinesView{Adding: adding, Install: install} |
| + for _, r := range records { |
| + row := machineRowOf(r, now) |
| + switch { |
| + case r.Person != me: |
| + v.Others = append(v.Others, row) |
| + default: |
| + v.Mine = append(v.Mine, row) |
| + fresh := r.Facts.EnrolledAt != nil && now.Sub(*r.Facts.EnrolledAt) < machineNewFor |
| + if adding && !row.Revoked && (row.State == machineNever || fresh) { |
| + v.New = append(v.New, row) |
| + } |
| + } |
| + } |
| + for _, rows := range [][]machineRow{v.Mine, v.Others, v.New} { |
| + slices.SortStableFunc(rows, func(a, b machineRow) int { |
| + if c := strings.Compare(strings.ToLower(a.Name), strings.ToLower(b.Name)); c != 0 { |
| + return c |
| + } |
| + return strings.Compare(a.ID, b.ID) |
| + }) |
| + } |
| + return v |
| +} |
| + |
| +func machineRowOf(r machineRecord, now time.Time) machineRow { |
| + f := r.Facts |
| + row := machineRow{ID: r.ID, Name: r.Label, Person: r.Person, Fingerprint: r.MachineKeyHash, Report: r.Report, Tainted: r.TaintedAt != nil, Removing: r.RemovingAt != nil, Revoked: r.RevokedAt != nil, Revision: r.Revision, TrialOwner: r.TrialOwner, TrialAt: r.TrialAt, TrialVersions: r.TrialVersions, Mark: "monitor"} |
| + if f.Label != "" { |
| + row.Name = f.Label |
| + } |
| + switch { |
| + case row.Revoked: |
| + row.State = machineRevoked |
| + case row.Removing: |
| + row.State = machineRemoving |
| + case !f.Session: |
| + row.State = machineNever |
| + case f.Connected && now.Sub(f.SeenAt) < chat.RunnerOnline: |
| + row.State = machineOnline |
| + default: |
| + row.State = machineOffline |
| + row.Seen = fmt.Sprintf(copyText("machines.last_seen"), ago(now, f.SeenAt)) |
| + } |
| + row.Words = copyText("machines.state." + row.State) |
| + row.Role = copyText("machines.role.primary") |
| + if r.Role == setup.RoleWorker { |
| + row.Role = copyText("machines.role.worker") |
| + } |
| + if r.Report != nil { |
| + row.Raw = r.Report.Platform |
| + os, _, _ := strings.Cut(r.Report.Platform, "/") |
| + row.Platform = copyText("machines.platform." + os) |
| + if row.Platform == "" { |
| + row.Platform = os |
| + } |
| + switch os { |
| + case "darwin": |
| + row.Mark = "laptop" |
| + case "linux": |
| + row.Mark = "server" |
| + } |
| + } |
| + row.Version = f.Versions["runner"] |
| + if f.Session { |
| + row.Protocol = strconv.Itoa(f.Protocol) |
| + } |
| + row.Tags = strings.Join(f.Tags, ", ") |
| + if f.EnrolledAt != nil { |
| + row.Enrolled = f.EnrolledAt.UTC().Format(copyText("runner.requested_format")) |
| + row.EnrolledBy = f.EnrolledBy |
| + } |
| + return row |
| +} |
diff --git a/internal/equipo/machines_view_test.go b/internal/equipo/machines_view_test.go| new file mode 100644 |
| index 00000000..987aafa3 |
| --- /dev/null |
| +++ b/internal/equipo/machines_view_test.go |
| @@ -0,0 +1,181 @@ |
| +package equipo |
| + |
| +import ( |
| + "bytes" |
| + "regexp" |
| + "strings" |
| + "testing" |
| + "time" |
| + |
| + "amadan.net/oficina/equipo/internal/equipo/setup" |
| + "amadan.net/oficina/equipo/internal/wire" |
| +) |
| + |
| +// machinesFixture: the person's online Linux primary, their Mac that |
| +// went quiet, their Mac enrolled at 12:53 UTC that never connected |
| +// (staging's), a machine being removed, and two of other people's. |
| +func machinesFixture(now time.Time) []machineRecord { |
| + enrolled := time.Date(2026, 11, 11, 12, 53, 0, 0, time.UTC) |
| + removing := now |
| + return []machineRecord{ |
| + {Runner: Runner{ID: "r-desk", Person: "me@example.com", Label: "Desk", Role: setup.RolePrimary, Revision: 3, MachineKeyHash: "abc123", Report: &setup.RunnerReport{Platform: "linux/amd64", Sandbox: wire.SandboxBubblewrap}}, |
| + Facts: machineFacts{Session: true, Connected: true, SeenAt: now.Add(-10 * time.Second), Protocol: 2, Versions: map[string]string{"runner": "v0.9.1"}, Tags: []string{"linux", "go"}, EnrolledAt: &enrolled, EnrolledBy: "me@example.com"}}, |
| + {Runner: Runner{ID: "r-studio", Person: "me@example.com", Label: "Headless runner", Role: setup.RoleWorker, Revision: 2, Report: &setup.RunnerReport{Platform: "darwin/arm64"}}, |
| + Facts: machineFacts{Session: true, Connected: true, SeenAt: now.Add(-3 * time.Hour), Protocol: 2, Label: "Tito Studio"}}, |
| + {Runner: Runner{ID: "r-air", Person: "me@example.com", Label: "Paul's MacBook Air", Role: setup.RoleWorker, Revision: 1}, |
| + Facts: machineFacts{EnrolledAt: &enrolled, EnrolledBy: "me@example.com"}}, |
| + {Runner: Runner{ID: "r-old", Person: "me@example.com", Label: "Old box", Role: setup.RoleWorker, Revision: 4, RemovingAt: &removing}, |
| + Facts: machineFacts{Session: true, SeenAt: now.Add(-time.Minute)}}, |
| + {Runner: Runner{ID: "r-ana", Person: "ana@example.com", Label: "Ana's desk", Role: setup.RolePrimary, Revision: 1}}, |
| + {Runner: Runner{ID: "r-bo", Person: "bo@example.com", Label: "Bo's laptop", Role: setup.RolePrimary, Revision: 1}}, |
| + } |
| +} |
| + |
| +func machinesHTML(t *testing.T, v machinesView) string { |
| + t.Helper() |
| + var buf bytes.Buffer |
| + if err := pages["runners"].ExecuteTemplate(&buf, "content", pageData{Machines: v, Address: "me@example.com"}); err != nil { |
| + t.Fatal(err) |
| + } |
| + return buf.String() |
| +} |
| + |
| +// TestMachinesList: Machines in Settings (Paul, 2026-11-11). The |
| +// person's own machines are compact rows (name, state, role, platform) |
| +// whose details open on a click; other people's are folded, closed, |
| +// with their count; Revoke and Remove now are quiet and ask once more; |
| +// a machine that never connected says so with what to check. |
| +func TestMachinesList(t *testing.T) { |
| + now := time.Date(2026, 11, 11, 15, 0, 0, 0, time.UTC) |
| + v := machinesPage(machinesFixture(now), "me@example.com", now, false, "") |
| + if len(v.Mine) != 4 || len(v.Others) != 2 || len(v.New) != 0 { |
| + t.Fatalf("mine %d others %d new %d", len(v.Mine), len(v.Others), len(v.New)) |
| + } |
| + state := map[string]string{} |
| + for _, m := range append(append([]machineRow{}, v.Mine...), v.Others...) { |
| + state[m.ID] = m.State |
| + } |
| + for id, want := range map[string]string{"r-desk": "online", "r-studio": "offline", "r-air": "never", "r-old": "removing", "r-ana": "never"} { |
| + if state[id] != want { |
| + t.Fatalf("%s: state %q, want %q", id, state[id], want) |
| + } |
| + } |
| + html := machinesHTML(t, v) |
| + row := func(id string) string { |
| + t.Helper() |
| + m := regexp.MustCompile(`(?s)<details equipo-mach data-machine="` + id + `".*?</summary>`).FindString(html) |
| + if m == "" { |
| + t.Fatalf("no row %s:\n%s", id, html) |
| + } |
| + return m |
| + } |
| + // The row: name, state in words, role, platform; the details only |
| + // behind the click. |
| + for id, wants := range map[string][]string{ |
| + "r-desk": {">Desk<", `data-s="online" data-machine-state>Online<`, ">Main runner<", ">Linux<"}, |
| + "r-studio": {">Tito Studio<", `data-s="offline" data-machine-state>Offline<`, "Last seen 3 h ago", ">Runs checks<", ">macOS<"}, |
| + "r-air": {">Paul's MacBook Air<", `data-s="never" data-machine-state>Never connected<`, "data-never-hint>This machine was added but has never connected. Check that the runner is running on it.<"}, |
| + "r-old": {`data-machine-state>Removing<`}, |
| + } { |
| + r := row(id) |
| + for _, want := range wants { |
| + if !strings.Contains(r, want) { |
| + t.Fatalf("%s row lacks %q: %s", id, want, r) |
| + } |
| + } |
| + if strings.Contains(r, " open") || strings.Contains(r, "Key fingerprint") || strings.Contains(r, "/revoke") { |
| + t.Fatalf("%s row shows its details unasked: %s", id, r) |
| + } |
| + } |
| + if strings.Contains(row("r-desk"), "data-never-hint") { |
| + t.Fatal("an online machine reads never connected") |
| + } |
| + // The details. |
| + for _, want := range []string{"<dt>Version</dt><dd>v0.9.1</dd>", "<dt>Protocol</dt><dd>2</dd>", "<dt>Tags</dt><dd>linux, go</dd>", "<dt>Added</dt><dd>11 Nov 2026, 12:53 UTC</dd>", "<dt>Added by</dt><dd>me@example.com</dd>", "abc123", `data-sandbox="bubblewrap"`, "Removing: waiting for it to stop its work"} { |
| + if !strings.Contains(html, want) { |
| + t.Fatalf("details lack %q", want) |
| + } |
| + } |
| + // Quiet destructive actions, each behind a second click, posting the |
| + // same forms as ever. |
| + for _, want := range []string{ |
| + `<details equipo-mach-confirm><summary rst-btn data-quiet>Revoke machine</summary>`, |
| + `action="/runners/r-desk/revoke"`, `<input type="hidden" name="revision" value="3">`, `data-revoke>Yes, revoke it<`, |
| + `<details equipo-mach-confirm><summary rst-btn data-quiet>Remove now</summary>`, |
| + `action="/runners/r-desk/remove-now"`, `data-danger data-remove-now>Yes, remove it now<`, |
| + } { |
| + if !strings.Contains(html, want) { |
| + t.Fatalf("actions lack %q", want) |
| + } |
| + } |
| + if strings.Contains(html, `rst-btn="primary"`) && strings.Contains(html, "revoke\" equipo") { |
| + t.Fatal("a destructive action is a primary button") |
| + } |
| + if strings.Contains(regexp.MustCompile(`(?s)data-machine="r-old".*?</details>\n</div>\n</details>`).FindString(html), "/revoke") { |
| + t.Fatal("a machine being removed offers Revoke again") |
| + } |
| + // Other people's machines: folded, closed, counted, each with whose. |
| + others := regexp.MustCompile(`<details equipo-mach-others data-other-machines><summary><span>Other people's machines</span> <span equipo-conn-n>2</span>`) |
| + if !others.MatchString(html) || strings.Contains(html, "data-other-machines open") { |
| + t.Fatalf("others not folded with a count:\n%s", html) |
| + } |
| + if !strings.Contains(row("r-ana"), "<span equipo-conn-account>ana@example.com</span>") { |
| + t.Fatal("another person's row does not say whose") |
| + } |
| + if strings.Index(html, "data-my-machines") > strings.Index(html, "data-other-machines") { |
| + t.Fatal("other people's machines come before the person's own") |
| + } |
| + // A member sees only their own: no fold. |
| + if html := machinesHTML(t, machinesPage(machinesFixture(now)[:4], "me@example.com", now, false, "")); strings.Contains(html, "data-other-machines") { |
| + t.Fatal("a fold with nothing in it") |
| + } |
| + // No machines: one way forward. |
| + if html := machinesHTML(t, machinesPage(nil, "me@example.com", now, false, "")); !strings.Contains(html, `data-empty-state="machines.empty_title"`) || !strings.Contains(html, `href="/conversation/settings/machines/add"`) { |
| + t.Fatalf("empty state:\n%s", html) |
| + } |
| +} |
| + |
| +// TestMachinesAdd: Add a machine is its own screen: the install line |
| +// /install.sh answers, the code, and the person's new machines (never |
| +// connected, or approved in the last half hour) until they connect. |
| +// With a machine's code it shows that machine and the same approval |
| +// form as ever. |
| +func TestMachinesAdd(t *testing.T) { |
| + now := time.Date(2026, 11, 11, 13, 0, 0, 0, time.UTC) |
| + install := "curl -fsSL https://equipo.example/install.sh | sh" |
| + v := machinesPage(machinesFixture(now), "me@example.com", now, true, install) |
| + var ids []string |
| + for _, m := range v.New { |
| + ids = append(ids, m.ID) |
| + } |
| + if strings.Join(ids, " ") != "r-desk r-air" { |
| + t.Fatalf("new machines %v", ids) |
| + } |
| + html := machinesHTML(t, v) |
| + for _, want := range []string{"<code equipo-conn-code data-command data-install>" + install + "</code>", `data-copy="` + install + `"`, `<form method="post" action="/runners/enrol"`, `name="action" value="inspect"`, `name="user_code"`, "data-new-machines", "data-never-hint", `data-src="/conversation/settings/machines/add"`} { |
| + if !strings.Contains(html, want) { |
| + t.Fatalf("add page lacks %q:\n%s", want, html) |
| + } |
| + } |
| + if strings.Contains(html, "ana@example.com") { |
| + t.Fatal("another person's machine on the person's Add page") |
| + } |
| + if html := machinesHTML(t, machinesPage(nil, "me@example.com", now, true, "")); !strings.Contains(html, "A versioned runner release is not available.") || !strings.Contains(html, "Recently approved machines appear here, along with any that have never connected.") { |
| + t.Fatalf("no release, no machines:\n%s", html) |
| + } |
| + // With a code: the approval card and its form, unchanged fields. |
| + var buf bytes.Buffer |
| + data := pageData{Machines: v, Address: "me@example.com", UserCode: "ABCDEFGHJK", PairingConfirmation: "conf", Origin: "https://equipo.example", Enrolment: Runner{Label: "Tito Studio", MachineKeyHash: "abc123", RequestedAt: now}} |
| + if err := pages["runners"].ExecuteTemplate(&buf, "content", data); err != nil { |
| + t.Fatal(err) |
| + } |
| + card := buf.String() |
| + for _, want := range []string{"Add Tito Studio to your team", "abc123", "https://equipo.example", `name="action" value="approve"`, `name="confirmation" value="conf"`, `name="user_code" value="ABCDEFGHJK"`, `rst-btn="primary" type="submit">Approve machine<`} { |
| + if !strings.Contains(card, want) { |
| + t.Fatalf("approval lacks %q", want) |
| + } |
| + } |
| + if strings.Contains(card, `value="inspect"`) { |
| + t.Fatal("the code form beside an approval") |
| + } |
| +} |
diff --git a/internal/equipo/runner_handlers.go b/internal/equipo/runner_handlers.go| index 9edf7427..7d22398b 100644 |
| --- a/internal/equipo/runner_handlers.go |
| +++ b/internal/equipo/runner_handlers.go |
| @@ -11,6 +11,7 @@ import ( |
| "amadan.net/oficina/equipo/internal/equipo/team" |
| "amadan.net/oficina/equipo/internal/runnerproto" |
| + "amadan.net/rastrillo/rastrillo" |
| "amadan.net/rastrillo/rastrillo/auth" |
| "github.com/go-chi/chi/v5" |
| ) |
| @@ -140,29 +141,40 @@ func (a *application) exchangeEnrolment(w http.ResponseWriter, r *http.Request) |
| runnerJSON(w, http.StatusOK, result) |
| } |
| +// enrolmentPage is GET /runners/enrol, the address a runner prints |
| +// (its VerificationURI, which the runner checks, so it stays): with the |
| +// machine's code it is the Add a machine page showing that machine with |
| +// its one button (approval is still the confirmed POST below); without, |
| +// the Machines list. |
| func (a *application) enrolmentPage(w http.ResponseWriter, r *http.Request) { |
| + a.machinesScreen(w, r, r.URL.Query().Get("code") != "") |
| +} |
| + |
| +// machinesList is GET /conversation/settings/machines. |
| +func (a *application) machinesList(w http.ResponseWriter, r *http.Request) { |
| + a.machinesScreen(w, r, false) |
| +} |
| + |
| +// machinesAdd is GET /conversation/settings/machines/add, with ?code= |
| +// as at /runners/enrol. |
| +func (a *application) machinesAdd(w http.ResponseWriter, r *http.Request) { |
| + a.machinesScreen(w, r, true) |
| +} |
| + |
| +func (a *application) machinesScreen(w http.ResponseWriter, r *http.Request, adding bool) { |
| w.Header().Set("Cache-Control", "no-store") |
| w.Header().Set("Referrer-Policy", "no-referrer") |
| - data, err := a.page(r, "connections") |
| - if err != nil { |
| - a.failure(w, r, err) |
| - return |
| - } |
| - data.Title = "runner.title" |
| - data.Origin = a.origin |
| id, ok := auth.From(r) |
| if !ok { |
| a.failure(w, r, ErrForbidden) |
| return |
| } |
| - data.Runners, err = a.store.runnersFor(r.Context(), Actor{Address: id.Address}) |
| + data, err := a.machinesData(r, id.Address, adding) |
| if err != nil { |
| a.failure(w, r, err) |
| return |
| } |
| - // The link a runner prints carries its code: show that machine with |
| - // its one button (approval is still the confirmed POST below). |
| - if code := r.URL.Query().Get("code"); code != "" && len(code) <= 16 { |
| + if code := r.URL.Query().Get("code"); adding && code != "" && len(code) <= 16 { |
| data.Enrolment, err = a.store.approveOrInspect(r.Context(), Actor{Address: id.Address}, code, false) |
| if err != nil { |
| a.runnerFormFailure(w, r, err) |
| @@ -171,8 +183,35 @@ func (a *application) enrolmentPage(w http.ResponseWriter, r *http.Request) { |
| data.UserCode = code |
| data.PairingConfirmation = setup.PairingConfirmation(a.store.invitationKey, id.Address, code, a.store.runnerClock.Now()) |
| } |
| + render(w, "runners", data) |
| +} |
| - a.renderLive(w, r, "runners", data) |
| +// machinesData is a Machines screen's page: Settings with Machines |
| +// current, and the machines the person may see. |
| +func (a *application) machinesData(r *http.Request, address string, adding bool) (pageData, error) { |
| + data, err := a.settingsPage(r, "machines", false) |
| + if err != nil { |
| + return data, err |
| + } |
| + data.Title = "runner.title" |
| + if adding { |
| + data.Title = "machines.add" |
| + } |
| + data.Origin = a.origin |
| + records, err := a.store.runnersFor(r.Context(), Actor{Address: address}) |
| + if err != nil { |
| + return data, err |
| + } |
| + // The install line is the one /install.sh answers, shown only when |
| + // that answers (installScript's own conditions). |
| + install := "" |
| + if instance, err := runnerInstance(a.store.db.G); err == nil && a.installAssets.CachedAvailable() { |
| + if _, err := installScriptBody(a.origin, rastrillo.BuildVersion, instance); err == nil { |
| + install = "curl -fsSL " + a.origin + "/install.sh | sh" |
| + } |
| + } |
| + data.Machines, data.MachinesStream = machinesPage(records, address, a.store.runnerClock.Now(), adding, install), true |
| + return data, nil |
| } |
| func (a *application) approveEnrolment(w http.ResponseWriter, r *http.Request) { |
| w.Header().Set("Cache-Control", "no-store") |
| @@ -195,7 +234,7 @@ func (a *application) approveEnrolment(w http.ResponseWriter, r *http.Request) { |
| } |
| } |
| if r.PostForm.Get("action") == "inspect" { |
| - data, err := a.page(r, "connections") |
| + data, err := a.machinesData(r, id.Address, true) |
| if err != nil { |
| a.failure(w, r, err) |
| return |
| @@ -205,8 +244,6 @@ func (a *application) approveEnrolment(w http.ResponseWriter, r *http.Request) { |
| a.runnerFormFailure(w, r, err) |
| return |
| } |
| - data.Title = "runner.title" |
| - data.Origin = a.origin |
| data.UserCode = code |
| data.PairingConfirmation = setup.PairingConfirmation(a.store.invitationKey, id.Address, code, a.store.runnerClock.Now()) |
| render(w, "runners", data) |
| @@ -220,7 +257,7 @@ func (a *application) approveEnrolment(w http.ResponseWriter, r *http.Request) { |
| a.runnerFormFailure(w, r, err) |
| return |
| } |
| - http.Redirect(w, r, "/runners/enrol", http.StatusSeeOther) |
| + http.Redirect(w, r, "/conversation/settings/machines/add", http.StatusSeeOther) |
| } |
| func (a *application) revokeRunner(w http.ResponseWriter, r *http.Request) { |
| r.Body = http.MaxBytesReader(w, r.Body, 4096) |
| @@ -242,7 +279,7 @@ func (a *application) revokeRunner(w http.ResponseWriter, r *http.Request) { |
| a.failure(w, r, err) |
| return |
| } |
| - http.Redirect(w, r, "/runners/enrol", http.StatusSeeOther) |
| + http.Redirect(w, r, "/conversation/settings/machines", http.StatusSeeOther) |
| } |
| // removeRunnerNow removes a lost or compromised machine at once. |
| @@ -266,12 +303,12 @@ func (a *application) removeRunnerNow(w http.ResponseWriter, r *http.Request) { |
| a.failure(w, r, err) |
| return |
| } |
| - http.Redirect(w, r, "/runners/enrol", http.StatusSeeOther) |
| + http.Redirect(w, r, "/conversation/settings/machines", http.StatusSeeOther) |
| } |
| func (a *application) runnerFormFailure(w http.ResponseWriter, r *http.Request, err error) { |
| if errors.Is(err, ErrRunnerNeedsPrimary) { |
| - renderStatus(w, http.StatusConflict, "form_error", pageData{Nav: Navigation(), Key: "connections", Title: "runner.title", ErrorKey: "runner.needs_primary", Back: "/runners/enrol"}) |
| + renderStatus(w, http.StatusConflict, "form_error", pageData{Nav: Navigation(), Key: "connections", Title: "runner.title", ErrorKey: "runner.needs_primary", Back: "/conversation/settings/machines/add"}) |
| return |
| } |
| if !errors.Is(err, ErrRunnerRateLimited) { |
| @@ -279,5 +316,5 @@ func (a *application) runnerFormFailure(w http.ResponseWriter, r *http.Request, |
| return |
| } |
| w.Header().Set("Retry-After", "60") |
| - renderStatus(w, 429, "form_error", pageData{Nav: Navigation(), Key: "connections", Title: "runner.title", ErrorKey: "runner.rate-limited", Back: "/runners/enrol"}) |
| + renderStatus(w, 429, "form_error", pageData{Nav: Navigation(), Key: "connections", Title: "runner.title", ErrorKey: "runner.rate-limited", Back: "/conversation/settings/machines/add"}) |
| } |
diff --git a/internal/equipo/runners.go b/internal/equipo/runners.go| index cdc043fe..da13d81c 100644 |
| --- a/internal/equipo/runners.go |
| +++ b/internal/equipo/runners.go |
| @@ -228,8 +228,8 @@ func revokePersonRunners(tx *gorm.DB, person string, now time.Time) error { |
| return nil |
| } |
| -func (s *Store) runnersFor(ctx context.Context, actor Actor) ([]Runner, error) { |
| - var result []Runner |
| +func (s *Store) runnersFor(ctx context.Context, actor Actor) ([]machineRecord, error) { |
| + var result []machineRecord |
| err := s.write(ctx, func(tx *gorm.DB) error { |
| member, err := currentRunnerMember(tx, actor.Address) |
| if err != nil { |
| @@ -263,7 +263,11 @@ func (s *Store) runnersFor(ctx context.Context, actor Actor) ([]Runner, error) { |
| if record.Report, err = runnerReport(tx, record.ID); err != nil { |
| return storeError(err) |
| } |
| - result = append(result, record.Runner) |
| + facts, err := machineFactsOf(tx, record.ID) |
| + if err != nil { |
| + return storeError(err) |
| + } |
| + result = append(result, machineRecord{Runner: record.Runner, Facts: facts}) |
| } |
| return nil |
| }) |
| @@ -273,6 +277,60 @@ func (s *Store) runnersFor(ctx context.Context, actor Actor) ([]Runner, error) { |
| return result, nil |
| } |
| +// machineFacts is what the Machines screens say of a runner beyond its |
| +// record, read only for runners runnersFor already allowed: its |
| +// connection (none until its first hello), what its last hello said, |
| +// and its enrolment's approval. |
| +type machineFacts struct { |
| + // Session: the runner has connected at least once. |
| + Session, Connected bool |
| + SeenAt time.Time |
| + Protocol int |
| + Label string |
| + Versions map[string]string |
| + Tags []string |
| + EnrolledAt *time.Time |
| + EnrolledBy string |
| +} |
| + |
| +// machineRecord is a runner as the Machines screens list it. |
| +type machineRecord struct { |
| + Runner |
| + Facts machineFacts |
| +} |
| + |
| +func machineFactsOf(tx *gorm.DB, id string) (machineFacts, error) { |
| + var f machineFacts |
| + var sessions []struct { |
| + Connected bool |
| + SeenAt *time.Time |
| + Protocol int |
| + Hello string |
| + } |
| + if err := tx.Raw(`SELECT coalesce(connected, 0) AS connected, seen_at, coalesce(protocol, 1) AS protocol, coalesce(hello, '') AS hello FROM runner_sessions WHERE runner_id = ?`, id).Scan(&sessions).Error; err != nil { |
| + return f, err |
| + } |
| + if len(sessions) == 1 && sessions[0].SeenAt != nil { |
| + v := sessions[0] |
| + f.Session, f.Connected, f.SeenAt, f.Protocol = true, v.Connected, *v.SeenAt, max(v.Protocol, wire.Protocol1) |
| + var h wire.Hello |
| + if v.Hello != "" && json.Unmarshal([]byte(v.Hello), &h) == nil { |
| + f.Label, f.Versions = h.Label, h.Versions |
| + if h.Capabilities != nil && wire.ValidCapabilities(*h.Capabilities) == nil { |
| + f.Tags = h.Capabilities.Tags |
| + } |
| + } |
| + } |
| + var enrolments []setup.EnrolmentRecord |
| + if err := tx.Where("runner_id = ? AND approved_at IS NOT NULL", id).Order("approved_at DESC").Limit(1).Find(&enrolments).Error; err != nil { |
| + return f, err |
| + } |
| + if len(enrolments) == 1 { |
| + f.EnrolledAt, f.EnrolledBy = enrolments[0].ApprovedAt, enrolments[0].Person |
| + } |
| + return f, nil |
| +} |
| + |
| // runnerReport is the runner's newest hello as the Connections view |
| // shows it: platform, confinement of checks and self-probes, each value |
| // already checked by the hello's bounds when it was stored. |
diff --git a/internal/equipo/settings_hub.go b/internal/equipo/settings_hub.go| index 3bdf0195..fb3e20f1 100644 |
| --- a/internal/equipo/settings_hub.go |
| +++ b/internal/equipo/settings_hub.go |
| @@ -44,6 +44,7 @@ type settingsLink struct { |
| var settingsSections = []settingsLink{ |
| {Key: "thinking", Href: "/conversation/settings/thinking", CopyKey: "thinking.title", Icon: "type"}, |
| {Key: "connections", Href: "/conversation/settings/connections", CopyKey: "settings.connections", Icon: "plug"}, |
| + {Key: "machines", Href: "/conversation/settings/machines", CopyKey: "runner.title", Icon: "monitor"}, |
| {Key: "housekeeping", Href: "/conversation/settings/housekeeping", CopyKey: "settings.housekeeping", Icon: "list-checks"}, |
| {Key: "notebook", Href: "/conversation/settings/notebook", CopyKey: "settings.notebook_open", Icon: "notebook"}, |
| {Key: "teams", Href: "/teams", CopyKey: "settings.teams_open", Icon: "users"}, |
diff --git a/internal/equipo/static/equipo.css b/internal/equipo/static/equipo.css| index b557db40..ee8a7989 100644 |
| --- a/internal/equipo/static/equipo.css |
| +++ b/internal/equipo/static/equipo.css |
| @@ -1440,3 +1440,65 @@ label[equipo-sp-label] { cursor: pointer; } |
| [equipo-team-facts] { flex-direction: column; } |
| [equipo-team-facts] > * + *::before { content: none; } |
| } |
| + |
| +/* Machines (Paul, 2026-11-11), in Settings and drawn like Connections: |
| + the same list, dots, tiles and quiet actions. A row is a <details> |
| + that opens in place for the rest; a machine that never connected is |
| + tinted and says what to check. Revoke and Remove now are quiet and |
| + ask once more. Hairlines and tints only, never a stripe. */ |
| +[equipo-machines] { container: mach / inline-size; } |
| +[equipo-mach] + [equipo-mach] { border-block-start: 1px solid var(--rst-line); } |
| +[equipo-mach-sum] { list-style: none; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; column-gap: var(--rst-sp-4); align-items: center; padding: var(--rst-sp-4); cursor: pointer; transition: background .15s; } |
| +[equipo-mach-sum]::-webkit-details-marker { display: none; } |
| +[equipo-mach-sum]:hover { background: var(--rst-tint-hover, var(--rst-surface-2)); } |
| +[equipo-mach-sum]:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--rst-focus-edge, var(--rst-accent)); } |
| +[equipo-mach-sum] > .icon, [equipo-mach-others] > summary > .icon { inline-size: 1rem; block-size: 1rem; margin: 0; color: var(--rst-text-faint, var(--rst-text-muted)); transition: transform .2s var(--equipo-ease, ease); } |
| +[equipo-mach][open] > [equipo-mach-sum] > .icon, [equipo-mach-others][open] > summary > .icon { transform: rotate(180deg); } |
| +[equipo-mach-body] { min-inline-size: 0; display: grid; gap: .35rem; } |
| +[equipo-mach-hint] { font-size: var(--rst-fs-sm); color: var(--rst-text); max-inline-size: 60ch; line-height: 1.45; } |
| +[equipo-mach][data-state="never"] > [equipo-mach-sum] { background: color-mix(in srgb, var(--rst-tone-warning-bg) 30%, var(--rst-surface)); } |
| +[equipo-mach][data-state="never"] > [equipo-mach-sum]:hover { background: color-mix(in srgb, var(--rst-tone-warning-bg) 45%, var(--rst-surface)); } |
| +[equipo-mach][data-new] { animation: equipo-row-in .55s var(--equipo-ease, ease) both, equipo-row-glow 2.4s ease-out .3s backwards; } |
| +[equipo-conn-state][data-s="online"]::before { background: var(--rst-tone-positive-fg); box-shadow: 0 0 0 3px color-mix(in srgb, var(--rst-tone-positive-fg) 18%, transparent); } |
| +[equipo-conn-state][data-s="never"]::before { background: var(--rst-tone-warning-fg); } |
| +[equipo-conn-state]:is([data-s="offline"], [data-s="removing"], [data-s="revoked"]) { color: var(--rst-text-muted); font-weight: 400; } |
| +[equipo-conn-state]:is([data-s="offline"], [data-s="removing"], [data-s="revoked"])::before { background: transparent; box-shadow: inset 0 0 0 1.5px var(--rst-line-strong, var(--rst-text-muted)); } |
| +[equipo-mach-sum] [equipo-pmark]:not([data-s="online"]) { filter: saturate(.35); opacity: .75; } |
| +[equipo-mach-detail] { display: grid; gap: var(--rst-sp-3); padding: 0 var(--rst-sp-4) var(--rst-sp-4) calc(2 * var(--rst-sp-4) + 2.25rem); font-size: var(--rst-fs-sm); } |
| +[equipo-mach-facts] { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: .35rem var(--rst-sp-5); margin: 0; font-size: var(--rst-fs-sm); } |
| +[equipo-mach-facts] dt { color: var(--rst-text-muted); } |
| +[equipo-mach-facts] dd { margin: 0; min-inline-size: 0; overflow-wrap: anywhere; } |
| +[equipo-mach-key] { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: var(--rst-fs-xs); } |
| +[equipo-mach-unknown] { color: var(--rst-text-faint, var(--rst-text-muted)); } |
| +[equipo-mach-note] { margin: 0; color: var(--rst-text-muted); max-inline-size: 62ch; line-height: 1.45; } |
| +[equipo-mach-sub] { margin: var(--rst-sp-1) 0 0; font-size: var(--rst-fs-sm); font-weight: 600; } |
| +[equipo-mach-detail] [equipo-probes] { list-style: none; margin: 0; padding: 0; display: grid; gap: .3rem; } |
| +[equipo-probe-verdict] { color: var(--rst-text-muted); } |
| +[data-verdict="passed"] > [equipo-probe-verdict], [data-verdict="denied"] > [equipo-probe-verdict] { color: var(--rst-tone-positive-fg); } |
| +[data-verdict="failed"] > [equipo-probe-verdict] { color: var(--rst-tone-negative-fg); } |
| +[equipo-mach-pre] { margin: 0; font-size: var(--rst-fs-xs); white-space: pre-wrap; overflow-wrap: anywhere; color: var(--rst-text-muted); } |
| +[equipo-mach-actions] { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: flex-start; gap: var(--rst-sp-2); padding-block-start: var(--rst-sp-3); border-block-start: 1px solid var(--rst-line); } |
| +[equipo-mach-actions] > [equipo-mach-note] { margin-inline-end: auto; align-self: center; } |
| +[equipo-mach-confirm] > summary { list-style: none; cursor: pointer; } |
| +[equipo-mach-confirm] > summary::-webkit-details-marker { display: none; } |
| +[equipo-mach-confirm] > summary:hover { color: var(--rst-text); } |
| +[equipo-mach-confirm][open] { flex-basis: 100%; display: grid; justify-items: end; } |
| +[equipo-mach-confirm][open] > summary { color: var(--rst-text); } |
| +[equipo-mach-confirm] > div { display: grid; justify-items: end; gap: var(--rst-sp-2); max-inline-size: 30rem; margin-block-start: var(--rst-sp-1); text-align: end; } |
| +[equipo-mach-confirm] > div > p { margin: 0; color: var(--rst-text-muted); font-size: var(--rst-fs-sm); line-height: 1.45; } |
| +[equipo-mach-confirm] [data-danger] { color: var(--rst-tone-negative-fg); border-color: color-mix(in srgb, var(--rst-tone-negative-fg) 35%, var(--rst-line)); } |
| +[equipo-mach-others] { margin: 0 0 var(--rst-sp-5); } |
| +[equipo-mach-others] > summary { list-style: none; display: inline-flex; align-items: center; gap: var(--rst-sp-2); margin: 0 0 var(--rst-sp-2); padding: .25rem 0; font-weight: 600; cursor: pointer; border-radius: var(--rst-radius-sm, 4px); } |
| +[equipo-mach-others] > summary::-webkit-details-marker { display: none; } |
| +[equipo-mach-others] > summary:focus-visible { outline: 2px solid var(--rst-focus-edge, var(--rst-accent)); outline-offset: 2px; } |
| +[equipo-mach-none] { margin: 0; padding: var(--rst-sp-4); border: 1px dashed var(--rst-line-strong, var(--rst-line)); border-radius: calc(2 * var(--rst-radius)); color: var(--rst-text-muted); font-size: var(--rst-fs-sm); } |
| +[equipo-machines] [equipo-conn-card] { margin-block-end: var(--rst-sp-6); } |
| +[equipo-machines] [equipo-conn-card] [equipo-mach-facts] { margin-block-start: var(--rst-sp-2); } |
| +[equipo-machines] [equipo-conn-add-foot] .icon { margin-inline-end: .35em; } |
| +@container mach (max-width: 600px) { |
| + [equipo-mach-sum] { padding: var(--rst-sp-3); column-gap: var(--rst-sp-3); } |
| + [equipo-mach-detail] { padding: 0 var(--rst-sp-3) var(--rst-sp-4); } |
| + [equipo-mach-facts] { grid-template-columns: minmax(0, 1fr); row-gap: 0; } |
| + [equipo-mach-facts] dd + dt { margin-block-start: var(--rst-sp-2); } |
| +} |
| +[equipo-machines] [equipo-conn-add-foot] > a { flex: none; white-space: nowrap; } |
diff --git a/internal/equipo/static/machines.js b/internal/equipo/static/machines.js| new file mode 100644 |
| index 00000000..359282b4 |
| --- /dev/null |
| +++ b/internal/equipo/static/machines.js |
| @@ -0,0 +1,90 @@ |
| +// The Machines screens follow the person's event stream: nav-stream.js |
| +// hears a runner come online or go away and says so (equipo:runner); |
| +// this reads the screen again and swaps its live part in place, so a |
| +// machine just approved on Add a machine shows connecting without a |
| +// reload. It also reads it again each minute while it is seen, as a |
| +// machine whose runner stops answering goes offline with no event. |
| +// Rows open stay open; nothing is read again while a confirmation is |
| +// open or a control in the live part has focus. The address read is |
| +// always the screen's own without its code: a refresh never inspects a |
| +// machine's code again. Copy puts the install line on the clipboard. |
| +(function () { |
| + "use strict"; |
| + var root = document.querySelector("[data-machines]"); |
| + if (!root || !window.fetch || !window.DOMParser) return; |
| + var src = root.dataset.src; |
| + var inflight = null, again = false; |
| + |
| + function busy(box) { |
| + return box.querySelector("[equipo-mach-confirm][open]") || box.contains(document.activeElement) && document.activeElement !== document.body && !document.activeElement.matches("summary"); |
| + } |
| + function load() { |
| + var box = root.querySelector("[data-machines-live]"); |
| + if (!box || busy(box)) return Promise.resolve(); |
| + return fetch(src, { credentials: "same-origin", headers: { "Accept": "text/html" } }) |
| + .then(function (r) { if (!r.ok) throw new Error("refresh"); return r.text(); }) |
| + .then(function (body) { |
| + var next = new DOMParser().parseFromString(body, "text/html").querySelector("[data-machines-live]"); |
| + if (!next || busy(box)) return; |
| + var open = {}, seen = {}; |
| + box.querySelectorAll("[data-machine]").forEach(function (el) { |
| + seen[el.dataset.machine] = true; |
| + if (el.open) open[el.dataset.machine] = true; |
| + }); |
| + var others = box.querySelector("[data-other-machines]"); |
| + next.querySelectorAll("[data-machine]").forEach(function (el) { |
| + if (open[el.dataset.machine]) el.open = true; |
| + // Only what is new arrives with its motion. |
| + if (!seen[el.dataset.machine]) el.setAttribute("data-new", ""); |
| + }); |
| + var folded = next.querySelector("[data-other-machines]"); |
| + if (others && folded && others.open) folded.open = true; |
| + box.replaceChildren.apply(box, Array.from(next.children)); |
| + setTimeout(function () { |
| + box.querySelectorAll("[data-machine][data-new]").forEach(function (el) { el.removeAttribute("data-new"); }); |
| + }, 2800); |
| + }); |
| + } |
| + function refresh() { |
| + if (inflight) { again = true; return; } |
| + inflight = load().catch(function () {}).finally(function () { |
| + inflight = null; |
| + if (again) { again = false; refresh(); } |
| + }); |
| + } |
| + document.addEventListener("equipo:runner", function () { setTimeout(refresh, 150); }); |
| + var ticked = Date.now(); |
| + function tick() { |
| + if (document.hidden) return; |
| + ticked = Date.now(); |
| + refresh(); |
| + } |
| + setInterval(tick, 60000); |
| + document.addEventListener("visibilitychange", function () { |
| + if (Date.now() - ticked >= 60000) tick(); |
| + }); |
| + |
| + // Copy: the clipboard where it can, the line selected otherwise. |
| + root.addEventListener("click", function (event) { |
| + var button = event.target.closest("[data-copy]"); |
| + if (!button) return; |
| + var label = button.textContent; |
| + function done() { |
| + button.textContent = button.dataset.copied; |
| + button.setAttribute("data-done", ""); |
| + setTimeout(function () { button.textContent = label; button.removeAttribute("data-done"); }, 1800); |
| + } |
| + function select() { |
| + var code = button.parentNode.querySelector("code"); |
| + if (!code) return; |
| + var range = document.createRange(); |
| + range.selectNodeContents(code); |
| + var sel = getSelection(); |
| + sel.removeAllRanges(); |
| + sel.addRange(range); |
| + try { if (document.execCommand("copy")) done(); } catch (e) { /* selected for the person to copy */ } |
| + } |
| + if (navigator.clipboard && window.isSecureContext) navigator.clipboard.writeText(button.dataset.copy).then(done, select); |
| + else select(); |
| + }); |
| +})(); |
diff --git a/internal/equipo/static/nav-stream.js b/internal/equipo/static/nav-stream.js| index af9e6e12..765b7d57 100644 |
| --- a/internal/equipo/static/nav-stream.js |
| +++ b/internal/equipo/static/nav-stream.js |
| @@ -149,9 +149,15 @@ |
| seen(event); |
| work("housekeeping"); |
| }); |
| - ["message", "turn", "runner", "ping"].forEach(function (type) { |
| + ["message", "turn", "ping"].forEach(function (type) { |
| source.addEventListener(type, seen); |
| }); |
| + // A runner came online or went away: the Machines screens follow |
| + // it from this stream (machines.js) rather than opening their own. |
| + source.addEventListener("runner", function (event) { |
| + seen(event); |
| + document.dispatchEvent(new CustomEvent("equipo:runner")); |
| + }); |
| source.onerror = function () { |
| source.close(); |
| // Past retention (410) or a lost session: render afresh, then |
diff --git a/internal/equipo/templates/chrome.html b/internal/equipo/templates/chrome.html| index 67c821b8..4787801b 100644 |
| --- a/internal/equipo/templates/chrome.html |
| +++ b/internal/equipo/templates/chrome.html |
| @@ -1,6 +1,6 @@ |
| {{define "rail-brand"}}<span hidden></span>{{end}} |
| {{define "title"}}{{copy .Title}} · {{copy "brand"}}{{end}} |
| -{{define "head"}}{{.Live.Head (T "rastrillo.ui.live.paused") (T "rastrillo.ui.live.unconfirmed")}}<link rel="stylesheet" href="{{asset "static/equipo.css"}}"><script defer src="{{asset "static/nav-stream.js"}}"></script><script defer src="{{asset "static/work-stream.js"}}"></script><script defer src="{{asset "static/stardust.js"}}"></script><script defer src="{{asset "static/team-panel.js"}}"></script>{{if .HousekeepingStream}}<script defer src="{{asset "static/housekeeping.js"}}"></script>{{end}}{{if or (eq .Key "thinking") (eq .Key "settings-hub")}}<script defer src="{{asset "static/thinking-preview.js"}}"></script><script defer src="{{asset "static/settings.js"}}"></script>{{end}}{{if .ConnectionsStream}}<script defer src="{{asset "static/vendor/tweetnacl/nacl-fast.js"}}"></script><script defer src="{{asset "static/seal.js"}}"></script><script defer src="{{asset "static/connections.js"}}"></script>{{end}}{{if .ChatStream}}<script defer src="{{asset "static/chat-stream.js"}}"></script><script defer src="{{asset "static/chat-compose.js"}}"></script><script defer src="{{asset "static/ask-target.js"}}"></script>{{if eq .Key "conversation"}}<script defer src="{{asset "static/chat-anchor.js"}}"></script><script defer src="{{asset "static/chat-attach.js"}}"></script>{{end}}{{else if eq .Key "conversation"}}<script defer blocking="render" src="{{asset "static/chat-navigation.js"}}"></script><script defer src="{{asset "static/chat.js"}}"></script><script defer src="{{asset "static/chat-send.js"}}"></script>{{end}}{{end}} |
| +{{define "head"}}{{.Live.Head (T "rastrillo.ui.live.paused") (T "rastrillo.ui.live.unconfirmed")}}<link rel="stylesheet" href="{{asset "static/equipo.css"}}"><script defer src="{{asset "static/nav-stream.js"}}"></script><script defer src="{{asset "static/work-stream.js"}}"></script><script defer src="{{asset "static/stardust.js"}}"></script><script defer src="{{asset "static/team-panel.js"}}"></script>{{if .HousekeepingStream}}<script defer src="{{asset "static/housekeeping.js"}}"></script>{{end}}{{if or (eq .Key "thinking") (eq .Key "settings-hub")}}<script defer src="{{asset "static/thinking-preview.js"}}"></script><script defer src="{{asset "static/settings.js"}}"></script>{{end}}{{if .ConnectionsStream}}<script defer src="{{asset "static/vendor/tweetnacl/nacl-fast.js"}}"></script><script defer src="{{asset "static/seal.js"}}"></script><script defer src="{{asset "static/connections.js"}}"></script>{{end}}{{if .MachinesStream}}<script defer src="{{asset "static/machines.js"}}"></script>{{end}}{{if .ChatStream}}<script defer src="{{asset "static/chat-stream.js"}}"></script><script defer src="{{asset "static/chat-compose.js"}}"></script><script defer src="{{asset "static/ask-target.js"}}"></script>{{if eq .Key "conversation"}}<script defer src="{{asset "static/chat-anchor.js"}}"></script><script defer src="{{asset "static/chat-attach.js"}}"></script>{{end}}{{else if eq .Key "conversation"}}<script defer blocking="render" src="{{asset "static/chat-navigation.js"}}"></script><script defer src="{{asset "static/chat.js"}}"></script><script defer src="{{asset "static/chat-send.js"}}"></script>{{end}}{{end}} |
| {{define "up"}}/work{{if .Key}}#nav-{{.Key}}{{end}}{{end}} |
| {{define "up-label"}}{{.TeamName}}{{end}} |
| {{define "brand"}}<a rst-shell-brand href="/work">{{icon "users"}}{{.TeamName}}</a>{{end}} |
diff --git a/internal/equipo/templates/connections.html b/internal/equipo/templates/connections.html| index 7742d041..f4128e6a 100644 |
| --- a/internal/equipo/templates/connections.html |
| +++ b/internal/equipo/templates/connections.html |
| @@ -1,3 +1,3 @@ |
| -{{define "content"}}<h1>{{copy "nav.connections"}}</h1><a rst-btn href="/runners/enrol">{{copy "connections.enrol"}}</a>{{template "region:activity" .}} |
| +{{define "content"}}<h1>{{copy "nav.connections"}}</h1><a rst-btn href="/conversation/settings/machines/add">{{copy "connections.enrol"}}</a>{{template "region:activity" .}} |
| <a rst-btn href="/onboarding">{{copy "account_setup.add"}}</a><h2>{{copy "connections.personal"}}</h2>{{range .Choices}}<form equipo-form method="post" action="/projects/{{.Project.ID}}/connections"><h3>{{.Project.Name}}</h3><input type="hidden" name="revision" value="{{.Revision}}">{{range .Options}}<label><input type="checkbox" name="connection_id" value="{{.ID}}"{{if .Enabled}} checked{{end}}>{{copy "connections.enable"}}: {{.Label}}</label>{{end}}<label>{{copy "connections.reason"}}<select rst-input name="mode"><option value="best_fit"{{if eq .Mode "best_fit"}} selected{{end}}>{{copy "connections.best_fit"}}</option><option value="pinned"{{if eq .Mode "pinned"}} selected{{end}}>{{copy "connections.pinned"}}</option><option value="ask"{{if eq .Mode "ask"}} selected{{end}}>{{copy "connections.ask"}}</option></select></label><label>{{copy "connections.pin"}}<select rst-input name="pinned_id"><option value="">{{copy "value.none"}}</option>{{$pinned:=.PinnedID}}{{range .Options}}<option value="{{.ID}}"{{if eq .ID $pinned}} selected{{end}}>{{.Label}}</option>{{end}}</select></label><button rst-btn>{{copy "form.save"}}</button></form>{{end}}{{end}} |
| {{define "region:activity"}}<div id="activity" {{.Live.Attrs .Topic}}>{{range .Connections}}<section equipo-card><h2>{{.Report.AccountLabel}}</h2><p>{{.Person}}</p><p>{{copy "connections.counted_usage"}}</p>{{if .Report.AllowanceKnown}}<span equipo-value>{{.Report.AllowanceRemaining}}</span>{{else}}<p>{{copy "connections.remaining_unknown"}}</p>{{end}}{{if not .Available}}<p>{{if eq .Report.UnavailableReason "account.sign_in_again"}}{{copy "account.sign_in_again"}}{{else}}{{copy "runner.preflight.unavailable"}}{{end}}</p>{{end}}{{template "trial-label" .Isolation}}{{if eq .Isolation.Mode "owner mode"}}<p>{{copy "connections.owner_mode"}}</p>{{end}}<p>{{copy "connections.versions"}}: {{.Report.Provider}} {{.Report.ProviderVersion}} / {{.Report.LauncherVersion}} / {{.Report.BwrapVersion}}</p>{{if .Unverified}}<p>{{copy "isolation.unverified"}}</p>{{else}}<p>{{copy "isolation.confined"}}</p>{{end}}</section>{{else}}<p data-empty-state="connections.empty">{{copy "connections.empty"}}</p>{{end}}</div>{{end}} |
diff --git a/internal/equipo/templates/empty.html b/internal/equipo/templates/empty.html| index 31302b9d..3cad0841 100644 |
| --- a/internal/equipo/templates/empty.html |
| +++ b/internal/equipo/templates/empty.html |
| @@ -1 +1 @@ |
| -{{define "content"}}<h1>{{copy .Title}}</h1><section equipo-note data-empty-state="{{.EmptyKey}}"><p>{{copy .EmptyKey}}</p></section>{{if eq .Key "connections"}}<p><a href="/runners/enrol">{{copy "runner.title"}}</a></p>{{end}}{{end}} |
| +{{define "content"}}<h1>{{copy .Title}}</h1><section equipo-note data-empty-state="{{.EmptyKey}}"><p>{{copy .EmptyKey}}</p></section>{{if eq .Key "connections"}}<p><a href="/conversation/settings/machines">{{copy "runner.title"}}</a></p>{{end}}{{end}} |
diff --git a/internal/equipo/templates/onboarding.html b/internal/equipo/templates/onboarding.html| index e2b57b04..f2e2ab3c 100644 |
| --- a/internal/equipo/templates/onboarding.html |
| +++ b/internal/equipo/templates/onboarding.html |
| @@ -14,7 +14,7 @@ |
| {{if eq .Onboarding.State.CurrentStep "runner"}} |
| <p>{{copy "onboarding.own_machine"}}</p> |
| {{if .Onboarding.InstallCommand}}<pre>{{.Onboarding.InstallCommand}}</pre>{{else}}<p>{{copy "runner.install.release"}}</p>{{end}} |
| -<p>{{copy "onboarding.pair"}}</p><a href="/runners/enrol">{{copy "runner.title"}}</a> |
| +<p>{{copy "onboarding.pair"}}</p><a href="/conversation/settings/machines/add">{{copy "runner.title"}}</a> |
| <p>{{copy "onboarding.account_pending"}}</p> |
| {{end}} |
| {{if eq .Onboarding.State.CurrentStep "specialists"}}<ul data-onboarding-specialists>{{range .Onboarding.Specialists}}<li><a href="/specialists/{{.Key}}">{{.Name}}</a>{{if .Required}} <span equipo-value>{{copy "specialists.required"}}</span>{{end}}</li>{{end}}</ul> |
diff --git a/internal/equipo/templates/runners.html b/internal/equipo/templates/runners.html| index cfad7dc6..6b1d1f95 100644 |
| --- a/internal/equipo/templates/runners.html |
| +++ b/internal/equipo/templates/runners.html |
| @@ -1,50 +1,89 @@ |
| +{{define "up"}}{{if .Machines.Adding}}/conversation/settings/machines{{else}}{{template "settings-up" .}}{{end}}{{end}} |
| +{{define "up-label"}}{{if .Machines.Adding}}{{copy "runner.title"}}{{else}}{{template "settings-up-label" .}}{{end}}{{end}} |
| +{{define "title"}}{{if .Machines.Adding}}{{copy "machines.add"}}{{else}}{{copy "runner.title"}}{{end}}{{end}} |
| +{{/* The Machines screens (machines_view.go). A row is a <details>: its |
| + summary is the compact line, the rest opens under it. Revoke and |
| + Remove now are quiet and each asks once more before it posts the |
| + same form as ever. */}} |
| +{{define "mach-row"}}{{$m := .Row}}<details equipo-mach data-machine="{{$m.ID}}" data-state="{{$m.State}}"> |
| +<summary equipo-mach-sum><span equipo-pmark data-s="{{$m.State}}" aria-hidden="true">{{icon $m.Mark}}</span><span equipo-mach-body><span equipo-conn-head><span equipo-conn-name>{{$m.Name}}</span>{{if .Others}}<span equipo-conn-account>{{$m.Person}}</span>{{end}}</span><span equipo-conn-facts><span equipo-conn-state data-s="{{$m.State}}" data-machine-state>{{$m.Words}}</span>{{with $m.Seen}}<span>{{.}}</span>{{end}}<span data-machine-role>{{$m.Role}}</span>{{with $m.Platform}}<span data-machine-platform>{{.}}</span>{{end}}</span>{{if eq $m.State "never"}}<span equipo-mach-hint data-never-hint>{{copy "machines.never_hint"}}</span>{{end}}</span>{{icon "chevron-down"}}</summary> |
| +<div equipo-mach-detail> |
| +<dl equipo-mach-facts> |
| +<dt>{{copy "runner.platform"}}</dt><dd>{{with $m.Raw}}{{.}}{{else}}<span equipo-mach-unknown>{{copy "machines.not_reported"}}</span>{{end}}</dd> |
| +<dt>{{copy "machines.version"}}</dt><dd>{{with $m.Version}}{{.}}{{else}}<span equipo-mach-unknown>{{copy "machines.not_reported"}}</span>{{end}}</dd> |
| +<dt>{{copy "machines.protocol"}}</dt><dd>{{with $m.Protocol}}{{.}}{{else}}<span equipo-mach-unknown>{{copy "machines.not_reported"}}</span>{{end}}</dd> |
| +{{with $m.Tags}}<dt>{{copy "machines.tags"}}</dt><dd>{{.}}</dd>{{end}} |
| +{{with $m.Report}}{{with .Sandbox}}<dt>{{copy "runner.checks_run"}}</dt><dd data-sandbox="{{.}}">{{copy (printf "runner.sandbox.%s" .)}}</dd>{{end}}{{end}} |
| +{{with $m.Enrolled}}<dt>{{copy "machines.enrolled"}}</dt><dd>{{.}}</dd>{{end}} |
| +{{with $m.EnrolledBy}}<dt>{{copy "machines.enrolled_by"}}</dt><dd>{{.}}</dd>{{end}} |
| +{{if .Others}}<dt>{{copy "runner.person"}}</dt><dd>{{$m.Person}}</dd>{{end}} |
| +<dt>{{copy "runner.fingerprint"}}</dt><dd equipo-mach-key>{{$m.Fingerprint}}</dd> |
| +</dl> |
| +{{if $m.Tainted}}<p equipo-mach-note data-tainted>{{copy "runner.tainted"}}</p>{{end}} |
| +{{with $m.Report}}{{if .Probes}}<h4 equipo-mach-sub>{{copy "runner.probes"}}</h4> |
| +<ul equipo-probes>{{range .Probes}}<li data-probe="{{.ID}}" data-verdict="{{.Verdict}}"><span>{{copy (printf "runner.probe.%s" .ID)}}</span> <span equipo-probe-verdict>{{copy (printf "runner.verdict.%s" .Verdict)}}</span>{{with .Detail}} <span equipo-quiet>{{.}}</span>{{end}}</li>{{end}}</ul>{{end}}{{end}} |
| +{{if $m.TrialOwner}}<p equipo-mach-note>{{copy "trial.history"}}: {{$m.TrialOwner}} / {{$m.TrialAt}}</p><pre equipo-mach-pre>{{$m.TrialVersions}}</pre>{{end}} |
| +{{if not $m.Revoked}}<div equipo-mach-actions>{{if $m.Removing}}<p equipo-mach-note>{{copy "runner.removing"}}</p>{{else}}<details equipo-mach-confirm><summary rst-btn data-quiet>{{copy "runner.revoke"}}</summary><div><p>{{copy "machines.revoke_confirm"}}</p><form method="post" action="/runners/{{$m.ID}}/revoke" equipo-inline-form> |
| +<input type="hidden" name="revision" value="{{$m.Revision}}"> |
| +<button rst-btn type="submit" data-revoke>{{copy "machines.revoke_yes"}}</button> |
| +</form></div></details>{{end}}<details equipo-mach-confirm><summary rst-btn data-quiet>{{copy "runner.remove_now"}}</summary><div><p>{{copy "machines.remove_confirm"}}</p><form method="post" action="/runners/{{$m.ID}}/remove-now" equipo-inline-form> |
| +<input type="hidden" name="revision" value="{{$m.Revision}}"> |
| +<button rst-btn type="submit" data-danger data-remove-now>{{copy "machines.remove_yes"}}</button> |
| +</form></div></details></div>{{end}} |
| +</div> |
| +</details>{{end}} |
| {{define "content"}} |
| -<h1>{{copy "runner.title"}}</h1> |
| -<p>{{copy "runner.origin"}} <span>{{.Origin}}</span></p> |
| -{{if .UserCode}} |
| -<section equipo-card> |
| -<h2>{{printf (copy "runner.add_title") .Enrolment.Label}}</h2> |
| -<dl equipo-metadata> |
| +<div equipo-settings-layout data-section="machines"> |
| +{{template "settings-nav" .}} |
| +<section equipo-settings-body equipo-machines data-machines{{if .Machines.Adding}} data-adding data-src="/conversation/settings/machines/add"{{else}} data-src="/conversation/settings/machines"{{end}}> |
| +{{if .Machines.Adding}}{{template "settings-head" (dict "Title" "machines.add" "Lede" "machines.add_lede")}} |
| +{{if .UserCode}}<div equipo-conn-card data-approve-machine> |
| +<div equipo-conn-card-head><span equipo-pmark aria-hidden="true">{{icon "monitor"}}</span><div><h3>{{printf (copy "runner.add_title") .Enrolment.Label}}</h3><p>{{copy "runner.confirm"}}</p></div></div> |
| +<dl equipo-mach-facts> |
| <dt>{{copy "runner.label"}}</dt><dd>{{.Enrolment.Label}}</dd> |
| <dt>{{copy "runner.requested"}}</dt><dd>{{.Enrolment.RequestedAt.UTC.Format (copy "runner.requested_format")}}</dd> |
| -<dt>{{copy "runner.fingerprint"}}</dt><dd>{{.Enrolment.MachineKeyHash}}</dd> |
| +<dt>{{copy "runner.fingerprint"}}</dt><dd equipo-mach-key>{{.Enrolment.MachineKeyHash}}</dd> |
| <dt>{{copy "runner.person"}}</dt><dd>{{.Address}}</dd> |
| </dl> |
| -<p>{{copy "runner.confirm"}}</p> |
| -<form method="post" action="/runners/enrol" equipo-form> |
| +<p equipo-conn-small>{{copy "runner.origin"}} <span>{{.Origin}}</span></p> |
| +<div equipo-conn-card-foot><span></span><form method="post" action="/runners/enrol" equipo-inline-form> |
| <input type="hidden" name="action" value="approve"> |
| <input type="hidden" name="confirmation" value="{{.PairingConfirmation}}"> |
| <input type="hidden" name="user_code" value="{{.UserCode}}"> |
| <button rst-btn="primary" type="submit">{{copy "runner.approve"}}</button> |
| -</form> |
| -</section> |
| -{{else}} |
| -<form method="post" action="/runners/enrol" equipo-form> |
| +</form></div> |
| +</div> |
| +{{else}}<div equipo-conn-card data-add-machine-steps> |
| +<ol equipo-conn-steps> |
| +<li><div><p>{{copy "machines.step_install"}}</p>{{with .Machines.Install}}<div equipo-conn-code-row><code equipo-conn-code data-command data-install>{{.}}</code><button type="button" rst-btn data-copy="{{.}}" data-copied="{{copy "chat.connections.copied"}}">{{copy "chat.connections.copy"}}</button></div>{{else}}<p equipo-conn-small>{{copy "runner.install.release"}}</p>{{end}}</div></li> |
| +<li><div><p>{{copy "machines.step_code"}}</p><form method="post" action="/runners/enrol" equipo-conn-token autocomplete="off"> |
| <input type="hidden" name="action" value="inspect"> |
| -<label>{{copy "runner.code"}}<input rst-input name="user_code" minlength="10" maxlength="10" autocomplete="off" required></label> |
| -<button rst-btn="primary" type="submit">{{copy "runner.inspect"}}</button> |
| -</form> |
| +<label for="machine-code">{{copy "runner.code"}}</label><span equipo-conn-token-row><input rst-input id="machine-code" name="user_code" minlength="10" maxlength="10" autocomplete="off" autocapitalize="characters" spellcheck="false" required><button rst-btn type="submit">{{copy "runner.inspect"}}</button></span> |
| +</form></div></li> |
| +<li><div><p>{{copy "machines.step_approve"}}</p></div></li> |
| +</ol> |
| +</div>{{end}} |
| +<div data-machines-live> |
| +<section equipo-conn-group data-new-machines><h2>{{copy "machines.new"}}{{if .Machines.New}} <span equipo-conn-n>{{len .Machines.New}}</span>{{end}}</h2> |
| +{{if .Machines.New}}<div equipo-conn-list>{{range .Machines.New}}{{template "mach-row" (dict "Row" . "Others" false)}}{{end}}</div>{{else}}<p equipo-mach-none>{{copy "machines.new_none"}}</p>{{end}} |
| +</section> |
| +</div> |
| +{{else}}{{template "settings-head" (dict "Title" "runner.title" "Lede" "machines.lede")}} |
| +<div data-machines-live> |
| +{{if or .Machines.Mine .Machines.Others}}<section equipo-conn-group data-my-machines><h2>{{copy "machines.mine"}} <span equipo-conn-n>{{len .Machines.Mine}}</span></h2> |
| +{{if .Machines.Mine}}<div equipo-conn-list>{{range .Machines.Mine}}{{template "mach-row" (dict "Row" . "Others" false)}}{{end}}</div>{{else}}<p equipo-mach-none>{{copy "machines.mine_none"}}</p>{{end}} |
| +<div equipo-conn-add-foot><a rst-btn href="/conversation/settings/machines/add" data-add-machine>{{icon "plus"}}{{copy "machines.add"}}</a><span>{{copy "machines.add_hint"}}</span></div> |
| +</section> |
| +{{with .Machines.Others}}<details equipo-mach-others data-other-machines><summary><span>{{copy "machines.others"}}</span> <span equipo-conn-n>{{len .}}</span>{{icon "chevron-down"}}</summary> |
| +<div equipo-conn-list>{{range .}}{{template "mach-row" (dict "Row" . "Others" true)}}{{end}}</div> |
| +</details>{{end}} |
| +{{else}}<section equipo-conn-empty data-empty-state="machines.empty_title"><p equipo-conn-pair><span equipo-pmark aria-hidden="true">{{icon "laptop"}}</span><span equipo-pmark aria-hidden="true">{{icon "server"}}</span></p> |
| +<h2>{{copy "machines.empty_title"}}</h2> |
| +<p>{{copy "machines.empty_body"}}</p> |
| +<a rst-btn="primary" href="/conversation/settings/machines/add" data-add-machine>{{icon "plus"}}{{copy "machines.add"}}</a> |
| +</section>{{end}} |
| +</div> |
| {{end}} |
| -<h2>{{copy "runner.enrolled"}}</h2> |
| -{{range .Runners}} |
| -<section equipo-card> |
| -<h3>{{.Label}}</h3> |
| -<dl equipo-metadata> |
| -<dt>{{copy "runner.person"}}</dt><dd>{{.Person}}</dd> |
| -<dt>{{copy "runner.fingerprint"}}</dt><dd>{{.MachineKeyHash}}</dd> |
| -{{with .Report}}<dt>{{copy "runner.platform"}}</dt><dd>{{.Platform}}</dd>{{with .Sandbox}}<dt>{{copy "runner.checks_run"}}</dt><dd data-sandbox="{{.}}">{{copy (printf "runner.sandbox.%s" .)}}</dd>{{end}}{{end}} |
| -</dl> |
| -{{if .TaintedAt}}<p data-tainted>{{copy "runner.tainted"}}</p>{{end}} |
| -{{with .Report}}{{if .Probes}}<h4>{{copy "runner.probes"}}</h4> |
| -<ul equipo-probes>{{range .Probes}}<li data-probe="{{.ID}}" data-verdict="{{.Verdict}}"><span>{{copy (printf "runner.probe.%s" .ID)}}</span> <span>{{copy (printf "runner.verdict.%s" .Verdict)}}</span>{{with .Detail}} <span equipo-quiet>{{.}}</span>{{end}}</li>{{end}}</ul>{{end}}{{end}} |
| -{{if .TrialOwner}}<p>{{copy "trial.history"}}: {{.TrialOwner}} / {{.TrialAt}}</p><pre>{{.TrialVersions}}</pre>{{end}} |
| -{{if not .RevokedAt}}{{if .RemovingAt}}<p>{{copy "runner.removing"}}</p>{{else}}<form method="post" action="/runners/{{.ID}}/revoke" equipo-form> |
| -<input type="hidden" name="revision" value="{{.Revision}}"> |
| -<button rst-btn type="submit">{{copy "runner.revoke"}}</button> |
| -</form>{{end}}<form method="post" action="/runners/{{.ID}}/remove-now" equipo-form> |
| -<input type="hidden" name="revision" value="{{.Revision}}"> |
| -<button rst-btn type="submit">{{copy "runner.remove_now"}}</button> |
| -</form>{{end}} |
| </section> |
| -{{else}}<p>{{copy "runner.empty"}}</p>{{end}} |
| +</div> |
| {{end}} |
diff --git a/internal/equipo/templates/settings_nav.html b/internal/equipo/templates/settings_nav.html| index a078a431..cb6d86e1 100644 |
| --- a/internal/equipo/templates/settings_nav.html |
| +++ b/internal/equipo/templates/settings_nav.html |
| @@ -1,7 +1,7 @@ |
| {{define "settings-nav"}}<nav equipo-settings-nav aria-label="{{copy "nav.settings"}}"><h2 equipo-settings-nav-title>{{copy "nav.settings"}}</h2><ul role="list">{{range .SettingsNav}}<li><a href="{{.Href}}" equipo-settings-link data-settings-link="{{.Key}}"{{if .Current}} aria-current="page"{{end}}>{{icon .Icon}}<span>{{copy .CopyKey}}</span>{{icon "chevron-right"}}</a></li>{{end}}</ul></nav>{{end}} |
| {{define "settings-up"}}{{if .Settings.Root}}/work#nav-settings-hub{{else}}/conversation/settings{{end}}{{end}} |
| {{define "settings-up-label"}}{{if .Settings.Root}}{{.TeamName}}{{else}}{{copy "nav.settings"}}{{end}}{{end}} |
| -{{define "settings-rail"}}<nav rst-shell-nav equipo-settings-rail{{if .RailArriving}} data-arriving{{end}} aria-label="{{copy "nav.settings"}}"><a href="/conversation" equipo-settings-leave data-settings-leave>{{icon "chevron-left"}}<span>{{copy "brand"}}</span></a><p equipo-nav-group>{{copy "nav.settings"}}</p>{{range .SettingsNav}}<a href="{{.Href}}" data-rail-settings="{{.Key}}"{{if and .Current (not $.Models.Adding)}} aria-current="page"{{end}}>{{icon .Icon}}<span>{{copy .CopyKey}}</span></a>{{if eq .Key "connections"}}<a href="/conversation/settings/connections/add" equipo-settings-sub data-rail-settings="connections-add"{{if $.Models.Adding}} aria-current="page"{{end}}>{{icon "plus"}}<span>{{copy "chat.connections.add"}}</span></a>{{end}}{{end}}</nav>{{end}} |
| +{{define "settings-rail"}}<nav rst-shell-nav equipo-settings-rail{{if .RailArriving}} data-arriving{{end}} aria-label="{{copy "nav.settings"}}"><a href="/conversation" equipo-settings-leave data-settings-leave>{{icon "chevron-left"}}<span>{{copy "brand"}}</span></a><p equipo-nav-group>{{copy "nav.settings"}}</p>{{range .SettingsNav}}<a href="{{.Href}}" data-rail-settings="{{.Key}}"{{if and .Current (not $.Models.Adding) (not $.Machines.Adding)}} aria-current="page"{{end}}>{{icon .Icon}}<span>{{copy .CopyKey}}</span></a>{{if eq .Key "connections"}}<a href="/conversation/settings/connections/add" equipo-settings-sub data-rail-settings="connections-add"{{if $.Models.Adding}} aria-current="page"{{end}}>{{icon "plus"}}<span>{{copy "chat.connections.add"}}</span></a>{{end}}{{if eq .Key "machines"}}<a href="/conversation/settings/machines/add" equipo-settings-sub data-rail-settings="machines-add"{{if $.Machines.Adding}} aria-current="page"{{end}}>{{icon "plus"}}<span>{{copy "machines.add"}}</span></a>{{end}}{{end}}</nav>{{end}} |
| {{/* The one Settings page pattern (Paul, 2026-11-11: "make sure all the |
| settings screens have proper UX and aren't just random forms"): |
| settings-head is every section's title and its one line; a section |
diff --git a/internal/equipo/templates/work_parts.html b/internal/equipo/templates/work_parts.html| index 57d19b95..98d7776e 100644 |
| --- a/internal/equipo/templates/work_parts.html |
| +++ b/internal/equipo/templates/work_parts.html |
| @@ -30,7 +30,7 @@ |
| {{if $.Head}}{{template "mono" $t.Mono}}<div equipo-d-title><a href="/tasks/{{$t.ID}}">{{$t.Title}}</a><span equipo-quiet>{{$t.Project}} · {{template "source" $t}}</span></div>{{end}} |
| <p equipo-d-why>{{.Why}}</p> |
| <p equipo-d-ask>{{.Ask}}</p> |
| -<div equipo-d-actions>{{with .Card}}<form method="post" action="/conversation/cards/{{.ID}}/answer"><input type="hidden" name="revision" value="{{.Revision}}"><input type="hidden" name="from" value="{{$.From}}"><input type="hidden" name="task" value="{{$t.ID}}">{{range $.Task.Decision.Choices}}<button equipo-btn{{if .Primary}} data-primary{{end}} type="submit" name="choice" value="{{.Value}}" data-merge-choice="{{.Value}}">{{.Label}}</button>{{end}}</form>{{end}}{{if .Fold}}<form method="post" action="/tasks/{{$t.ID}}/duplicate"><input type="hidden" name="from" value="{{$.From}}"><input type="hidden" name="of" value="{{$t.Dup.ID}}"><button equipo-btn data-primary type="submit" data-task-duplicate>{{copy "work.decide.fold"}}</button></form>{{end}}{{if .Recover}}<form method="post" action="/conversation/tasks/{{$t.ID}}/recover"><input type="hidden" name="from" value="{{$.From}}"><button equipo-btn data-primary type="submit" data-task-recover>{{copy "work.recover"}}</button></form>{{end}}{{if .Retry}}<form method="post" action="/conversation/tasks/{{$t.ID}}/retry"><input type="hidden" name="from" value="{{$.From}}"><button {{if .Fold}}equipo-link{{else}}equipo-btn data-primary{{end}} type="submit" data-task-retry>{{copy "work.retry"}}</button></form>{{end}}{{if .Talk}}<a equipo-btn href="/conversation">{{copy "work.decide.talk"}}</a>{{end}}{{if .Cancel}}<form method="post" action="/conversation/tasks/{{$t.ID}}/cancel"><input type="hidden" name="from" value="{{$.From}}"><button equipo-link type="submit" data-task-cancel>{{copy "work.decide.cancel"}}</button></form>{{end}}{{with .Hint}}<span equipo-quiet>{{.}}</span>{{end}}<span equipo-d-quiet>{{if .Mac}}<a equipo-link href="/runners/enrol" data-set-up-mac>{{copy "work.decide.mac_set_up"}}</a>{{end}}<a equipo-link href="/conversation?about={{$t.ID}}" data-ask-about>{{copy "work.ask_about"}}</a></span></div> |
| +<div equipo-d-actions>{{with .Card}}<form method="post" action="/conversation/cards/{{.ID}}/answer"><input type="hidden" name="revision" value="{{.Revision}}"><input type="hidden" name="from" value="{{$.From}}"><input type="hidden" name="task" value="{{$t.ID}}">{{range $.Task.Decision.Choices}}<button equipo-btn{{if .Primary}} data-primary{{end}} type="submit" name="choice" value="{{.Value}}" data-merge-choice="{{.Value}}">{{.Label}}</button>{{end}}</form>{{end}}{{if .Fold}}<form method="post" action="/tasks/{{$t.ID}}/duplicate"><input type="hidden" name="from" value="{{$.From}}"><input type="hidden" name="of" value="{{$t.Dup.ID}}"><button equipo-btn data-primary type="submit" data-task-duplicate>{{copy "work.decide.fold"}}</button></form>{{end}}{{if .Recover}}<form method="post" action="/conversation/tasks/{{$t.ID}}/recover"><input type="hidden" name="from" value="{{$.From}}"><button equipo-btn data-primary type="submit" data-task-recover>{{copy "work.recover"}}</button></form>{{end}}{{if .Retry}}<form method="post" action="/conversation/tasks/{{$t.ID}}/retry"><input type="hidden" name="from" value="{{$.From}}"><button {{if .Fold}}equipo-link{{else}}equipo-btn data-primary{{end}} type="submit" data-task-retry>{{copy "work.retry"}}</button></form>{{end}}{{if .Talk}}<a equipo-btn href="/conversation">{{copy "work.decide.talk"}}</a>{{end}}{{if .Cancel}}<form method="post" action="/conversation/tasks/{{$t.ID}}/cancel"><input type="hidden" name="from" value="{{$.From}}"><button equipo-link type="submit" data-task-cancel>{{copy "work.decide.cancel"}}</button></form>{{end}}{{with .Hint}}<span equipo-quiet>{{.}}</span>{{end}}<span equipo-d-quiet>{{if .Mac}}<a equipo-link href="/conversation/settings/machines/add" data-set-up-mac>{{copy "work.decide.mac_set_up"}}</a>{{end}}<a equipo-link href="/conversation?about={{$t.ID}}" data-ask-about>{{copy "work.ask_about"}}</a></span></div> |
| </div>{{end}}{{end}} |
| {{define "star-toggle"}}{{$p := .P}}<form method="post" action="/projects/{{$p.ID}}/star" equipo-star-form><input type="hidden" name="starred" value="{{if $p.Star.On}}0{{else}}1{{end}}"><input type="hidden" name="from" value="{{.From}}"><button type="submit" equipo-star{{if $p.Star.On}} aria-pressed="true"{{if $p.Star.Auto}} data-auto{{end}}{{else}} aria-pressed="false"{{end}} aria-label="{{$p.Star.Label}}" title="{{$p.Star.Who}}" data-star-toggle>{{icon "star"}}</button></form>{{end}} |
| {{define "project-facts"}}{{with .StackLine}}<span>{{if $.PhoneStack}}{{icon "phone"}}{{else}}{{icon "code"}}{{end}}{{.}}</span>{{end}}{{with .Repos}}<span data-repos>{{icon "git"}}{{if eq (len .) 1}}{{copy "work.project.one_repo"}}{{else}}{{printf (copy "work.project.repos") (len .)}}{{end}}</span>{{end}}{{with .ChecksLine}}<span data-tone="{{if $.Checks.Here}}positive{{else}}warning{{end}}" data-checks-fact>{{if $.Checks.Here}}{{icon "check-circle"}}{{else}}{{icon "help-circle"}}{{end}}{{.}}</span>{{end}}{{end}} |
diff --git a/internal/thintest/inline_style_test.go b/internal/thintest/inline_style_test.go| index b38448b0..58d784b9 100644 |
| --- a/internal/thintest/inline_style_test.go |
| +++ b/internal/thintest/inline_style_test.go |
| @@ -17,7 +17,7 @@ func noInlineStyles(t *testing.T, g *gallery) { |
| t.Helper() |
| a := g.a |
| owner := a.inst.Cookie() |
| - paths := []string{"/conversation", "/tasks", "/projects", "/needs-you", "/housekeeping", "/conversation/settings", "/conversation/settings/thinking", "/conversation/settings/connections", "/conversation/settings/connections/add", "/conversation/settings/housekeeping", "/conversation/settings/notebook", "/work"} |
| + paths := []string{"/conversation", "/tasks", "/projects", "/needs-you", "/housekeeping", "/conversation/settings", "/conversation/settings/thinking", "/conversation/settings/connections", "/conversation/settings/connections/add", "/conversation/settings/machines", "/conversation/settings/machines/add", "/conversation/settings/housekeeping", "/conversation/settings/notebook", "/work"} |
| for _, id := range []string{g.unchecked, g.stopped, g.noras, g.merging, g.running, g.looking} { |
| if id != "" { |
| paths = append(paths, "/tasks/"+id) |
diff --git a/internal/thintest/machines_browser_test.go b/internal/thintest/machines_browser_test.go| new file mode 100644 |
| index 00000000..46aaa813 |
| --- /dev/null |
| +++ b/internal/thintest/machines_browser_test.go |
| @@ -0,0 +1,55 @@ |
| +//go:build browser |
| + |
| +package thintest |
| + |
| +import ( |
| + "strconv" |
| + "testing" |
| +) |
| + |
| +// TestBrowserMachines: the Machines screens at 1280 and 390. Nothing is |
| +// wider than the screen; Other people's machines opens on a click; a |
| +// row opens for its details; Revoke asks once more before its form |
| +// shows. On Add a machine, the machine that never connected comes |
| +// online in place when its runner connects, with no reload (the |
| +// person's stream through nav-stream.js). Saves the after shots when |
| +// EQUIPO_BROWSER_ARTIFACTS names a directory. |
| +func TestBrowserMachines(t *testing.T) { |
| + settled := func(p *innerPage) { |
| + p.wait(`document.getAnimations().every(a=>a.playState!=='running'||a.effect&&a.effect.getTiming().iterations===Infinity)`, "the page settled") |
| + } |
| + r := newMachinesRig(t) |
| + for i, size := range settingsSizes { |
| + w := strconv.FormatInt(size.w, 10) |
| + p := openInner(t, r.inst.URL, r.inst.Cookie(), size.w, size.h, size.touch, "light", "no-preference") |
| + p.open("/conversation/settings/machines") |
| + p.fits("machines") |
| + p.check(`!document.querySelector('[data-other-machines]').open && !document.querySelector('[data-other-machines] [data-machine]').checkVisibility()`, "others not folded") |
| + p.check(`[...document.querySelectorAll('[data-my-machines] [equipo-mach]')].every(d=>!d.open)`, "a row open unasked") |
| + p.check(`getComputedStyle(document.querySelector('[data-state="never"] [data-never-hint]')).display!=='none'`, "the never-connected hint is hidden") |
| + settled(p) |
| + p.shot("after-machines-" + w) |
| + p.check(`(document.querySelector('[data-other-machines] > summary').click(),document.querySelector('[data-other-machines]').open)`, "others do not open") |
| + never := `document.querySelector('[data-machine="` + r.never + `"]')` |
| + p.check(`(`+never+`.querySelector('summary').click(),`+never+`.open)`, "a row does not open") |
| + p.check(`!`+never+`.querySelector('[data-revoke]').checkVisibility()`, "Revoke posts without asking") |
| + p.check(`(`+never+`.querySelector('[equipo-mach-confirm] > summary').click(),`+never+`.querySelector('[data-revoke]').checkVisibility())`, "Revoke does not ask") |
| + p.fits("machines open") |
| + settled(p) |
| + p.shot("after-machines-open-" + w) |
| + p.open("/conversation/settings/machines/add") |
| + p.fits("add a machine") |
| + settled(p) |
| + p.shot("after-machines-add-" + w) |
| + if i == 0 { |
| + // The machine comes online on the page, which stays. |
| + p.check(never+`.dataset.state==='never'`, "not never connected first") |
| + r.dialWorker(r.neverToken, "Paul's MacBook Air", 0) |
| + p.wait(never+`&&`+never+`.dataset.state==='online'`, "the new machine online in place") |
| + p.stayed("machine online") |
| + settled(p) |
| + p.shot("after-machines-add-online-" + w) |
| + } |
| + p.stop() |
| + } |
| +} |
diff --git a/internal/thintest/machines_fixture_test.go b/internal/thintest/machines_fixture_test.go| new file mode 100644 |
| index 00000000..39253ebf |
| --- /dev/null |
| +++ b/internal/thintest/machines_fixture_test.go |
| @@ -0,0 +1,39 @@ |
| +package thintest |
| + |
| +import ( |
| + "context" |
| + "testing" |
| + |
| + "amadan.net/oficina/equipo/internal/equipo" |
| +) |
| + |
| +// machinesRig is the Machines screens' fixture: the owner's primary and |
| +// a Mac worker, both online; one of the owner's machines enrolled that |
| +// never connected (staging's Mac at 12:53 UTC); and a member's machine, |
| +// which only an owner sees, folded. |
| +type machinesRig struct { |
| + *runnersRig |
| + worker, never, others string |
| + // neverToken is the never-connected machine's credential, so a test |
| + // can bring it online. |
| + neverToken string |
| +} |
| + |
| +const machinesMember = "ana@example.com" |
| + |
| +func newMachinesRig(t *testing.T) *machinesRig { |
| + t.Helper() |
| + r := newRunnersRig(t) |
| + w, _ := r.newWorker("Tito Studio") |
| + never := r.inst.EnrolRunner(t) |
| + if err := r.inst.Store.SetMember(context.Background(), equipo.Actor{Address: Owner}, machinesMember, equipo.RoleMember, true, 0); err != nil { |
| + t.Fatal(err) |
| + } |
| + other := r.inst.EnrolRunnerFor(t, machinesMember) |
| + for id, label := range map[string]string{never.RunnerID: "Paul's MacBook Air", other.RunnerID: "Ana's desk"} { |
| + if _, err := r.inst.DB.Writer().Exec("UPDATE runners SET label = ? WHERE id = ?", label, id); err != nil { |
| + t.Fatal(err) |
| + } |
| + } |
| + return &machinesRig{runnersRig: r, worker: w.fr.Welcome.RunnerID, never: never.RunnerID, others: other.RunnerID, neverToken: never.Token} |
| +} |
diff --git a/internal/thintest/machines_pages_test.go b/internal/thintest/machines_pages_test.go| new file mode 100644 |
| index 00000000..daa52165 |
| --- /dev/null |
| +++ b/internal/thintest/machines_pages_test.go |
| @@ -0,0 +1,74 @@ |
| +package thintest |
| + |
| +import ( |
| + "regexp" |
| + "strings" |
| + "testing" |
| +) |
| + |
| +// TestPagesMachines: Machines in Settings (Paul, 2026-11-11) on a real |
| +// instance. The owner's own machines are rows (the online primary and |
| +// Mac, the Mac that never connected saying what to check); a member's |
| +// machine is folded under Other people's machines, closed, with its |
| +// count; the details and the quiet, confirmed Revoke and Remove now are |
| +// behind a click. The member sees only their own. /runners/enrol, the |
| +// address a runner prints, still serves the list, and with a code the |
| +// Add a machine page; Add a machine lists the new machine. |
| +func TestPagesMachines(t *testing.T) { |
| + r := newMachinesRig(t) |
| + owner := r.inst.Cookie() |
| + row := func(page, id string) string { |
| + t.Helper() |
| + m := regexp.MustCompile(`(?s)<details equipo-mach data-machine="` + id + `" data-state="([a-z]+)">.*?</summary>`).FindString(page) |
| + if m == "" { |
| + t.Fatalf("no row %s", id) |
| + } |
| + return m |
| + } |
| + for _, path := range []string{"/conversation/settings/machines", "/runners/enrol"} { |
| + page := r.get(owner, path, 200) |
| + mine, others, ok := strings.Cut(page, "data-other-machines") |
| + if !ok || !strings.Contains(mine, "data-my-machines") { |
| + t.Fatalf("%s: no folded others after the person's own", path) |
| + } |
| + if !regexp.MustCompile(`<details equipo-mach-others data-other-machines><summary><span>Other people's machines</span> <span equipo-conn-n>1</span>`).MatchString(page) { |
| + t.Fatalf("%s: others not folded, closed, with a count", path) |
| + } |
| + for id, state := range map[string]string{r.worker: "online", r.never: "never"} { |
| + if got := row(mine, id); !strings.Contains(got, `data-state="`+state+`"`) { |
| + t.Fatalf("%s: %s is not %s: %s", path, id, state, got) |
| + } |
| + } |
| + if !strings.Contains(row(mine, r.worker), ">Tito Studio<") || !strings.Contains(row(mine, r.worker), ">Runs checks<") { |
| + t.Fatalf("%s: the Mac's row: %s", path, row(mine, r.worker)) |
| + } |
| + never := row(mine, r.never) |
| + if !strings.Contains(never, "Never connected") || !strings.Contains(never, "Check that the runner is running on it.") { |
| + t.Fatalf("%s: never connected unclear: %s", path, never) |
| + } |
| + if !strings.Contains(row(others, r.others), "ana@example.com") || strings.Contains(mine, r.others) { |
| + t.Fatalf("%s: the member's machine is not folded with whose it is", path) |
| + } |
| + for _, id := range []string{r.worker, r.never} { |
| + if !strings.Contains(page, `<form method="post" action="/runners/`+id+`/revoke" equipo-inline-form>`) || !strings.Contains(page, `action="/runners/`+id+`/remove-now"`) { |
| + t.Fatalf("%s: %s has no confirmed Revoke and Remove now", path, id) |
| + } |
| + } |
| + if strings.Count(page, "<details equipo-mach-confirm><summary rst-btn data-quiet>") < 4 { |
| + t.Fatalf("%s: destructive actions are not quiet confirmations", path) |
| + } |
| + } |
| + // A member sees only their own machine, and no fold. |
| + member := r.get(r.inst.SessionFor(t, machinesMember), "/conversation/settings/machines", 200) |
| + if strings.Contains(member, "data-other-machines") || !strings.Contains(member, r.others) || strings.Contains(member, r.never) { |
| + t.Fatal("a member's Machines shows other people's machines") |
| + } |
| + // Add a machine: the code, and the new machine waiting to connect. |
| + add := r.get(owner, "/conversation/settings/machines/add", 200) |
| + if !strings.Contains(add, "data-add-machine-steps") || !strings.Contains(add, `name="action" value="inspect"`) || !strings.Contains(row(add, r.never), `data-state="never"`) || !strings.Contains(add, `href="/conversation/settings/machines" rel="up"`) { |
| + t.Fatal("Add a machine lacks its steps, its new machine or its way back") |
| + } |
| + if strings.Contains(add, "ana@example.com") { |
| + t.Fatal("another person's machine on Add a machine") |
| + } |
| +} |
diff --git a/internal/thintest/projects_pages_test.go b/internal/thintest/projects_pages_test.go| index f6705f04..824134be 100644 |
| --- a/internal/thintest/projects_pages_test.go |
| +++ b/internal/thintest/projects_pages_test.go |
| @@ -253,7 +253,7 @@ func TestPagesTaskDecisionsSayWhy(t *testing.T) { |
| for _, want := range []string{"Review approved. Checks need a Mac, and no Mac is set up to run them.", "Merge without checks?", |
| `data-merge-choice="merge">Merge now</button>`, `data-merge-choice="wait">Wait for a Mac</button>`, |
| "Merge now merges it without checks. Wait for a Mac keeps it ready. Once a Mac is set up, checks run, and if they pass, Equipo merges it by itself.", |
| - `<a equipo-link href="/runners/enrol" data-set-up-mac>Set up a Mac</a>`, `href="/conversation?about=` + g.unchecked + `" data-ask-about>Ask about this</a>`} { |
| + `<a equipo-link href="/conversation/settings/machines/add" data-set-up-mac>Set up a Mac</a>`, `href="/conversation?about=` + g.unchecked + `" data-ask-about>Ask about this</a>`} { |
| if !strings.Contains(card, want) { |
| t.Fatalf("Mac decision lacks %q:\n%s", want, card) |
| } |
diff --git a/internal/thintest/settings_pages_test.go b/internal/thintest/settings_pages_test.go| index 9931864d..27a3166c 100644 |
| --- a/internal/thintest/settings_pages_test.go |
| +++ b/internal/thintest/settings_pages_test.go |
| @@ -13,11 +13,13 @@ import ( |
| func TestPagesSettingsSections(t *testing.T) { |
| r := newToolRig(t) |
| owner := r.inst.Cookie() |
| - links := []string{`data-settings-link="thinking"`, `data-settings-link="connections"`, `data-settings-link="housekeeping"`, `data-settings-link="notebook"`, `data-settings-link="teams"`} |
| + links := []string{`data-settings-link="thinking"`, `data-settings-link="connections"`, `data-settings-link="machines"`, `data-settings-link="housekeeping"`, `data-settings-link="notebook"`, `data-settings-link="teams"`} |
| for _, tc := range []struct{ path, current, want string }{ |
| {"/conversation/settings", "thinking", `data-root`}, |
| {"/conversation/settings/thinking", "thinking", `data-thinking-words`}, |
| {"/conversation/settings/connections", "connections", `data-connections`}, |
| + {"/conversation/settings/machines", "machines", `data-machines`}, |
| + {"/runners/enrol", "machines", `data-my-machines`}, |
| {"/conversation/settings/housekeeping", "housekeeping", `data-hk-settings`}, |
| {"/conversation/settings/notebook", "notebook", `data-notebook-reset`}, |
| } { |
diff --git a/internal/thintest/settings_rail_pages_test.go b/internal/thintest/settings_rail_pages_test.go| index eee89860..e2e1c850 100644 |
| --- a/internal/thintest/settings_rail_pages_test.go |
| +++ b/internal/thintest/settings_rail_pages_test.go |
| @@ -46,6 +46,8 @@ func TestPagesSettingsRail(t *testing.T) { |
| "/conversation/settings/thinking": "thinking", |
| "/conversation/settings/connections": "connections", |
| "/conversation/settings/connections/add": "connections-add", |
| + "/conversation/settings/machines": "machines", |
| + "/conversation/settings/machines/add": "machines-add", |
| "/conversation/settings/housekeeping": "housekeeping", |
| "/conversation/settings/notebook": "notebook", |
| } { |
| @@ -53,7 +55,7 @@ func TestPagesSettingsRail(t *testing.T) { |
| if nav == "" { |
| t.Fatalf("%s: no Settings nav in the rail", path) |
| } |
| - for _, want := range []string{`<a href="/conversation" equipo-settings-leave data-settings-leave>`, ">Equipo</span>", `data-rail-settings="thinking"`, `data-rail-settings="connections"`, `href="/conversation/settings/connections/add" equipo-settings-sub data-rail-settings="connections-add"`, `data-rail-settings="housekeeping"`, `data-rail-settings="notebook"`, `data-rail-settings="teams"`} { |
| + for _, want := range []string{`<a href="/conversation" equipo-settings-leave data-settings-leave>`, ">Equipo</span>", `data-rail-settings="thinking"`, `data-rail-settings="connections"`, `href="/conversation/settings/connections/add" equipo-settings-sub data-rail-settings="connections-add"`, `data-rail-settings="machines"`, `data-rail-settings="housekeeping"`, `data-rail-settings="notebook"`, `data-rail-settings="teams"`} { |
| if !strings.Contains(nav, want) { |
| t.Fatalf("%s: the rail's Settings nav lacks %s", path, want) |
| } |
diff --git a/internal/thintest/settings_ux_browser_test.go b/internal/thintest/settings_ux_browser_test.go| index be9ba845..32a28a16 100644 |
| --- a/internal/thintest/settings_ux_browser_test.go |
| +++ b/internal/thintest/settings_ux_browser_test.go |
| @@ -261,7 +261,7 @@ func TestBrowserSettingsShots(t *testing.T) { |
| for _, size := range settingsSizes { |
| p := openInner(t, r.inst.URL, r.inst.Cookie(), size.w, size.h, size.touch, "light", "no-preference") |
| var width float64 |
| - for _, s := range []struct{ name, path string }{{"thinking", "/conversation/settings/thinking"}, {"connections", "/conversation/settings/connections"}, {"connections-add", "/conversation/settings/connections/add"}, {"housekeeping", "/conversation/settings/housekeeping"}, {"notebook", "/conversation/settings/notebook"}, {"teams", "/teams"}} { |
| + for _, s := range []struct{ name, path string }{{"thinking", "/conversation/settings/thinking"}, {"connections", "/conversation/settings/connections"}, {"connections-add", "/conversation/settings/connections/add"}, {"machines", "/conversation/settings/machines"}, {"machines-add", "/conversation/settings/machines/add"}, {"housekeeping", "/conversation/settings/housekeeping"}, {"notebook", "/conversation/settings/notebook"}, {"teams", "/teams"}} { |
| p.open(s.path) |
| p.check(`document.querySelectorAll('[equipo-settings-body] h1').length===1 && !!document.querySelector('[equipo-settings-body] [equipo-sp-head] h1') && getComputedStyle(document.querySelector('[equipo-sp-head] h1')).fontSize==='24px'`, s.name+": not one Settings head") |
| got := eval[float64](p, `document.querySelector('[equipo-settings-body]').getBoundingClientRect().width`) |