oficina / equipo Public

Merge branch 'thin-v1-conn-add' into main

Connections: an Add page, the Settings rail, four row fixes

Add a connection opens its own page in Settings; the Settings nav
replaces the main rail inside Settings; the summary and rows name the
account when a provider has two, drop stale meters after a reset, say
where work actually went, and describe Automatic as it behaves; an
expired sign-in note can be dismissed and clears itself.
claude agent, operated by paul@keymail.dev 85404a090bcc2f59baff840ea6e3265a2cffdbdd parent c6319a5parent 7f4a900
54 files changed, +869 −137
  • .rastrillo/budgets.txt +2 −2
  • docs/mockups/built/2026-11-10/conn-add-chooser-1280.png binary
  • docs/mockups/built/2026-11-10/conn-add-chooser-390.png binary
  • docs/mockups/built/2026-11-10/conn-add-codex-code-1280.png binary
  • docs/mockups/built/2026-11-10/conn-add-codex-code-390.png binary
  • docs/mockups/built/2026-11-10/conn-add-connected-1280.png binary
  • docs/mockups/built/2026-11-10/conn-add-connected-390.png binary
  • docs/mockups/built/2026-11-10/conn-claude-copy-link-1280.png binary
  • docs/mockups/built/2026-11-10/conn-claude-copy-link-390.png binary
  • docs/mockups/built/2026-11-10/conn-codex-copy-link-1280.png binary
  • docs/mockups/built/2026-11-10/conn-codex-copy-link-390.png binary
  • docs/mockups/built/2026-11-10/conn-ended-note-1280.png binary
  • docs/mockups/built/2026-11-10/conn-ended-note-390.png binary
  • docs/mockups/built/2026-11-10/conn-token-bad-1280.png binary
  • docs/mockups/built/2026-11-10/conn-token-bad-390.png binary
  • docs/mockups/built/2026-11-10/conn-token-card-1280.png binary
  • docs/mockups/built/2026-11-10/conn-token-card-390.png binary
  • docs/mockups/built/2026-11-10/conn-token-chooser-1280.png binary
  • docs/mockups/built/2026-11-10/conn-token-chooser-390.png binary
  • docs/mockups/built/2026-11-10/conn-token-connected-1280.png binary
  • docs/mockups/built/2026-11-10/conn-token-connected-390.png binary
  • docs/mockups/built/2026-11-10/conn-token-rejected-1280.png binary
  • docs/mockups/built/2026-11-10/conn-token-rejected-390.png binary
  • docs/mockups/built/2026-11-10/conn-token-renew-1280.png binary
  • docs/mockups/built/2026-11-10/conn-token-renew-390.png binary
  • docs/mockups/built/2026-11-10/conn-token-waiting-1280.png binary
  • docs/mockups/built/2026-11-10/conn-token-waiting-390.png binary
  • docs/mockups/built/2026-11-10/settings-rail-1280.png binary
  • docs/mockups/built/2026-11-10/settings-rail-390.png binary
  • docs/mockups/built/2026-11-10/settings-rail-add-1280.png binary
  • docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md +5 −1
  • internal/equipo/app.go +1 −0
  • internal/equipo/chat_connections.go +39 −4
  • internal/equipo/connections_view.go +120 −27
  • internal/equipo/connections_view_test.go +153 −0
  • internal/equipo/copy.go +5 −1
  • internal/equipo/handlers.go +13 −8
  • internal/equipo/icons/icons.go +1 −0
  • internal/equipo/settings_hub.go +19 −0
  • internal/equipo/static/connections.js +45 −35
  • internal/equipo/static/equipo.css +43 −10
  • internal/equipo/static/nav-stream.js +8 −0
  • internal/equipo/templates/chat.html +1 −1
  • internal/equipo/templates/chrome.html +2 −2
  • internal/equipo/templates/models.html +22 −20
  • internal/equipo/templates/settings_nav.html +1 −0
  • internal/headless/browser_conn_add_test.go +128 −0
  • internal/headless/browser_connections_test.go +14 −9
  • internal/headless/browser_token_test.go +9 −8
  • internal/headless/connections_test.go +2 −2
  • internal/thintest/connections_add_pages_test.go +91 −0
  • internal/thintest/inline_style_test.go +1 −1
  • internal/thintest/settings_browser_test.go +60 −6
  • internal/thintest/settings_rail_pages_test.go +84 −0

CI failed — run details

diff --git a/.rastrillo/budgets.txt b/.rastrillo/budgets.txt
index ba6dd3f6..bb92ff94 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 15450 - 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 15550 - 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.
@@ -63,4 +63,4 @@ perf GET /conversation/attachments/{id} skip Composer attachments: the bytes of
perf GET /conversation/attachments/{id}/preview skip Composer attachments: an image thumbnail inside the conversation; a file, not a screen.
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/thintest - 9550 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 - 9750 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/mockups/built/2026-11-10/conn-add-chooser-1280.png b/docs/mockups/built/2026-11-10/conn-add-chooser-1280.png
new file mode 100644
index 00000000..21272af6
Binary files /dev/null and b/docs/mockups/built/2026-11-10/conn-add-chooser-1280.png differ
diff --git a/docs/mockups/built/2026-11-10/conn-add-chooser-390.png b/docs/mockups/built/2026-11-10/conn-add-chooser-390.png
new file mode 100644
index 00000000..88b3ce1e
Binary files /dev/null and b/docs/mockups/built/2026-11-10/conn-add-chooser-390.png differ
diff --git a/docs/mockups/built/2026-11-10/conn-add-codex-code-1280.png b/docs/mockups/built/2026-11-10/conn-add-codex-code-1280.png
new file mode 100644
index 00000000..67d17e47
Binary files /dev/null and b/docs/mockups/built/2026-11-10/conn-add-codex-code-1280.png differ
diff --git a/docs/mockups/built/2026-11-10/conn-add-codex-code-390.png b/docs/mockups/built/2026-11-10/conn-add-codex-code-390.png
new file mode 100644
index 00000000..11b3985d
Binary files /dev/null and b/docs/mockups/built/2026-11-10/conn-add-codex-code-390.png differ
diff --git a/docs/mockups/built/2026-11-10/conn-add-connected-1280.png b/docs/mockups/built/2026-11-10/conn-add-connected-1280.png
new file mode 100644
index 00000000..23f5743b
Binary files /dev/null and b/docs/mockups/built/2026-11-10/conn-add-connected-1280.png differ
diff --git a/docs/mockups/built/2026-11-10/conn-add-connected-390.png b/docs/mockups/built/2026-11-10/conn-add-connected-390.png
new file mode 100644
index 00000000..68365968
Binary files /dev/null and b/docs/mockups/built/2026-11-10/conn-add-connected-390.png differ
diff --git a/docs/mockups/built/2026-11-10/conn-claude-copy-link-1280.png b/docs/mockups/built/2026-11-10/conn-claude-copy-link-1280.png
index d454014a..801007a9 100644
Binary files a/docs/mockups/built/2026-11-10/conn-claude-copy-link-1280.png and b/docs/mockups/built/2026-11-10/conn-claude-copy-link-1280.png differ
diff --git a/docs/mockups/built/2026-11-10/conn-claude-copy-link-390.png b/docs/mockups/built/2026-11-10/conn-claude-copy-link-390.png
index 1df77d1d..aed490c0 100644
Binary files a/docs/mockups/built/2026-11-10/conn-claude-copy-link-390.png and b/docs/mockups/built/2026-11-10/conn-claude-copy-link-390.png differ
diff --git a/docs/mockups/built/2026-11-10/conn-codex-copy-link-1280.png b/docs/mockups/built/2026-11-10/conn-codex-copy-link-1280.png
index 7d11279a..154fc42b 100644
Binary files a/docs/mockups/built/2026-11-10/conn-codex-copy-link-1280.png and b/docs/mockups/built/2026-11-10/conn-codex-copy-link-1280.png differ
diff --git a/docs/mockups/built/2026-11-10/conn-codex-copy-link-390.png b/docs/mockups/built/2026-11-10/conn-codex-copy-link-390.png
index f56610ac..b85d4984 100644
Binary files a/docs/mockups/built/2026-11-10/conn-codex-copy-link-390.png and b/docs/mockups/built/2026-11-10/conn-codex-copy-link-390.png differ
diff --git a/docs/mockups/built/2026-11-10/conn-ended-note-1280.png b/docs/mockups/built/2026-11-10/conn-ended-note-1280.png
new file mode 100644
index 00000000..12156572
Binary files /dev/null and b/docs/mockups/built/2026-11-10/conn-ended-note-1280.png differ
diff --git a/docs/mockups/built/2026-11-10/conn-ended-note-390.png b/docs/mockups/built/2026-11-10/conn-ended-note-390.png
new file mode 100644
index 00000000..8c8e11c1
Binary files /dev/null and b/docs/mockups/built/2026-11-10/conn-ended-note-390.png differ
diff --git a/docs/mockups/built/2026-11-10/conn-token-bad-1280.png b/docs/mockups/built/2026-11-10/conn-token-bad-1280.png
index c8af8a28..c5801fb5 100644
Binary files a/docs/mockups/built/2026-11-10/conn-token-bad-1280.png and b/docs/mockups/built/2026-11-10/conn-token-bad-1280.png differ
diff --git a/docs/mockups/built/2026-11-10/conn-token-bad-390.png b/docs/mockups/built/2026-11-10/conn-token-bad-390.png
index e78e41da..066ca1ad 100644
Binary files a/docs/mockups/built/2026-11-10/conn-token-bad-390.png and b/docs/mockups/built/2026-11-10/conn-token-bad-390.png differ
diff --git a/docs/mockups/built/2026-11-10/conn-token-card-1280.png b/docs/mockups/built/2026-11-10/conn-token-card-1280.png
index be0d09df..58f9386c 100644
Binary files a/docs/mockups/built/2026-11-10/conn-token-card-1280.png and b/docs/mockups/built/2026-11-10/conn-token-card-1280.png differ
diff --git a/docs/mockups/built/2026-11-10/conn-token-card-390.png b/docs/mockups/built/2026-11-10/conn-token-card-390.png
index d8e9ef8e..6a979844 100644
Binary files a/docs/mockups/built/2026-11-10/conn-token-card-390.png and b/docs/mockups/built/2026-11-10/conn-token-card-390.png differ
diff --git a/docs/mockups/built/2026-11-10/conn-token-chooser-1280.png b/docs/mockups/built/2026-11-10/conn-token-chooser-1280.png
index 6ecc5de1..0c3c1761 100644
Binary files a/docs/mockups/built/2026-11-10/conn-token-chooser-1280.png and b/docs/mockups/built/2026-11-10/conn-token-chooser-1280.png differ
diff --git a/docs/mockups/built/2026-11-10/conn-token-chooser-390.png b/docs/mockups/built/2026-11-10/conn-token-chooser-390.png
index 853d2f07..5dee3246 100644
Binary files a/docs/mockups/built/2026-11-10/conn-token-chooser-390.png and b/docs/mockups/built/2026-11-10/conn-token-chooser-390.png differ
diff --git a/docs/mockups/built/2026-11-10/conn-token-connected-1280.png b/docs/mockups/built/2026-11-10/conn-token-connected-1280.png
index 04d1674f..91ddc526 100644
Binary files a/docs/mockups/built/2026-11-10/conn-token-connected-1280.png and b/docs/mockups/built/2026-11-10/conn-token-connected-1280.png differ
diff --git a/docs/mockups/built/2026-11-10/conn-token-connected-390.png b/docs/mockups/built/2026-11-10/conn-token-connected-390.png
index b203f7f3..05a7f755 100644
Binary files a/docs/mockups/built/2026-11-10/conn-token-connected-390.png and b/docs/mockups/built/2026-11-10/conn-token-connected-390.png differ
diff --git a/docs/mockups/built/2026-11-10/conn-token-rejected-1280.png b/docs/mockups/built/2026-11-10/conn-token-rejected-1280.png
index e55a73b4..d14579f9 100644
Binary files a/docs/mockups/built/2026-11-10/conn-token-rejected-1280.png and b/docs/mockups/built/2026-11-10/conn-token-rejected-1280.png differ
diff --git a/docs/mockups/built/2026-11-10/conn-token-rejected-390.png b/docs/mockups/built/2026-11-10/conn-token-rejected-390.png
index 8dd022c2..f6fe9b94 100644
Binary files a/docs/mockups/built/2026-11-10/conn-token-rejected-390.png and b/docs/mockups/built/2026-11-10/conn-token-rejected-390.png differ
diff --git a/docs/mockups/built/2026-11-10/conn-token-renew-1280.png b/docs/mockups/built/2026-11-10/conn-token-renew-1280.png
index 79ea0f09..3e1cf3bc 100644
Binary files a/docs/mockups/built/2026-11-10/conn-token-renew-1280.png and b/docs/mockups/built/2026-11-10/conn-token-renew-1280.png differ
diff --git a/docs/mockups/built/2026-11-10/conn-token-renew-390.png b/docs/mockups/built/2026-11-10/conn-token-renew-390.png
index 14790070..9baee42b 100644
Binary files a/docs/mockups/built/2026-11-10/conn-token-renew-390.png and b/docs/mockups/built/2026-11-10/conn-token-renew-390.png differ
diff --git a/docs/mockups/built/2026-11-10/conn-token-waiting-1280.png b/docs/mockups/built/2026-11-10/conn-token-waiting-1280.png
index 92af3f71..6250461b 100644
Binary files a/docs/mockups/built/2026-11-10/conn-token-waiting-1280.png and b/docs/mockups/built/2026-11-10/conn-token-waiting-1280.png differ
diff --git a/docs/mockups/built/2026-11-10/conn-token-waiting-390.png b/docs/mockups/built/2026-11-10/conn-token-waiting-390.png
index f74182ac..66aab193 100644
Binary files a/docs/mockups/built/2026-11-10/conn-token-waiting-390.png and b/docs/mockups/built/2026-11-10/conn-token-waiting-390.png differ
diff --git a/docs/mockups/built/2026-11-10/settings-rail-1280.png b/docs/mockups/built/2026-11-10/settings-rail-1280.png
new file mode 100644
index 00000000..d775ceea
Binary files /dev/null and b/docs/mockups/built/2026-11-10/settings-rail-1280.png differ
diff --git a/docs/mockups/built/2026-11-10/settings-rail-390.png b/docs/mockups/built/2026-11-10/settings-rail-390.png
new file mode 100644
index 00000000..c79c2e2e
Binary files /dev/null and b/docs/mockups/built/2026-11-10/settings-rail-390.png differ
diff --git a/docs/mockups/built/2026-11-10/settings-rail-add-1280.png b/docs/mockups/built/2026-11-10/settings-rail-add-1280.png
new file mode 100644
index 00000000..b1929210
Binary files /dev/null and b/docs/mockups/built/2026-11-10/settings-rail-add-1280.png differ
diff --git a/docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md b/docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md
index 870453dc..84204747 100644
--- a/docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md
+++ b/docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md
@@ -5253,7 +5253,11 @@ records remain unchanged.
| `chat.connections.answering.rests_until` | %s rests until %s | Connections slice 1 (Connections page, Paul's approved mockup) | Runtime; COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) |
| `chat.connections.and` | and | Connections slice 1 (Connections page, Paul's approved mockup) | Runtime; COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) |
| `chat.connections.answering.too` | Engineering and Review are on %s too. | Connections slice 1 (Connections page, Paul's approved mockup) | Runtime; COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) |
-| `chat.connections.answering.back` | Everything moves back when %s returns. | Connections slice 1 (Connections page, Paul's approved mockup) | Runtime; COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) |
+| `chat.connections.answering.stays` | Work stays where it is until the next message or step, then Equipo picks the healthiest connection with headroom. | Connections page fixes (Paul, 2026-11-10: name the account, say what Automatic does) | Runtime; COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) |
+| `chat.connections.answering.to_preferred` | Work moves to %s, your preference, from the next message or step once it is ready. | Connections page fixes (Paul, 2026-11-10: name the account, say what Automatic does) | Runtime; COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) |
+| `chat.connections.answering.other` | your other %s account | Connections page fixes (Paul, 2026-11-10: name the account, say what Automatic does) | Runtime; COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) |
+| `chat.connections.named` | %s (%s) | Connections page fixes (Paul, 2026-11-10: name the account, say what Automatic does) | Runtime; COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) |
+| `chat.connections.dismiss` | Dismiss | Connections page (an ended attempt's quiet notice, Paul, 2026-11-10) | Runtime; COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) |
| `chat.connections.answering.connecting` | %s is connecting. Once it is ready, Review can run on another model family. | Connections slice 1 (Connections page, Paul's approved mockup) | Runtime; COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) |
| `chat.connections.answering.none` | Nothing can answer right now. | Connections slice 1 (Connections page, Paul's approved mockup) | Runtime; COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) |
| `chat.connections.answering.no_reset` | %s reported no reset time, so Equipo checks again in 15 minutes | Connections slice 1 (Connections page, Paul's approved mockup) | Runtime; COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) |
diff --git a/internal/equipo/app.go b/internal/equipo/app.go
index 75206953..4dbfd7a6 100644
--- a/internal/equipo/app.go
+++ b/internal/equipo/app.go
@@ -260,6 +260,7 @@ func RouterWithStore(d *db.DB, cfg Config, mailer mail.Sender, logger *slog.Logg
r.Get("/conversation/settings/housekeeping", a.settingsSectionHandler("housekeeping"))
r.Get("/conversation/connections", movedTo("/conversation/settings/connections"))
r.Get("/conversation/settings/connections", a.connectionsView)
+ r.Get("/conversation/settings/connections/add", a.connectionsAdd)
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_connections.go b/internal/equipo/chat_connections.go
index 00c5e10b..9dde2b50 100644
--- a/internal/equipo/chat_connections.go
+++ b/internal/equipo/chat_connections.go
@@ -7,6 +7,7 @@ import (
"io"
"mime"
"net/http"
+ "net/url"
"strconv"
"strings"
"time"
@@ -55,6 +56,10 @@ type modelsView struct {
// attempt is open (without scripts the page offers Check again).
Cursor int64
Connecting bool
+ // Adding is the Add a connection page: the chooser and the attempt's
+ // card (Paul, 2026-11-10: "Can 'Add a connection' go to a new
+ // screen?").
+ Adding bool
}
// loadingLine is the card an Add shows at once, before the server has
@@ -164,6 +169,17 @@ func (a *application) runnerLabel(ctx context.Context, address, id string) strin
}
func (a *application) connectionsView(w http.ResponseWriter, r *http.Request) {
+ a.connectionsPageFor(w, r, false)
+}
+
+// connectionsAdd is the Add a connection page. Its attempt, once
+// connected (?attempt= from the scriptless Check again), leads back to
+// Connections with the new row marked; with scripts connections.js does.
+func (a *application) connectionsAdd(w http.ResponseWriter, r *http.Request) {
+ a.connectionsPageFor(w, r, true)
+}
+
+func (a *application) connectionsPageFor(w http.ResponseWriter, r *http.Request, adding bool) {
w.Header().Set("Cache-Control", "no-store")
ctx, address, ok := sessionContext(r)
if !ok {
@@ -175,12 +191,23 @@ func (a *application) connectionsView(w http.ResponseWriter, r *http.Request) {
a.failure(w, r, chatError(err))
return
}
+ if id := r.URL.Query().Get("attempt"); adding && id != "" {
+ for _, c := range snap.Connections {
+ if c.ID == id && c.State == wire.ConnHealthy {
+ http.Redirect(w, r, "/conversation/settings/connections?added="+url.QueryEscape(id), http.StatusSeeOther)
+ return
+ }
+ }
+ }
data, err := a.settingsPage(r, "connections", false)
if err != nil {
a.failure(w, r, err)
return
}
data.Title = "chat.connections.title"
+ if adding {
+ data.Title = "chat.connections.add"
+ }
runner := a.runnerLabel(ctx, address, snap.Runner.ID)
if runner == "" {
runner = copyText("chat.connections.your_runner")
@@ -195,7 +222,11 @@ func (a *application) connectionsView(w http.ResponseWriter, r *http.Request) {
a.failure(w, r, chatError(err))
return
}
- v := connectionsPage(snap, today, prefer, runner)
+ v := connectionsPage(snap, today, prefer, runner, time.Now())
+ v.Adding = adding
+ for i := range v.Rows {
+ v.Rows[i].New = !adding && v.Rows[i].ID == r.URL.Query().Get("added")
+ }
data.Models, data.ConnectionsStream = v, true
render(w, "models", data)
}
@@ -204,7 +235,7 @@ func (a *application) connectionsView(w http.ResponseWriter, r *http.Request) {
// sign-in on the runner), "I am at this machine" and a row's Sign in
// again or Paste a new token.
func (a *application) connectionsStart(w http.ResponseWriter, r *http.Request) {
- a.chatActionTo(w, r, "/conversation/settings/connections", func(ctx context.Context, address string) error {
+ a.chatActionTo(w, r, "/conversation/settings/connections/add", func(ctx context.Context, address string) error {
provider, same := r.PostFormValue("provider"), r.PostFormValue("same_machine") == "1"
kind := wire.KindSubscription
if r.PostFormValue("kind") == wire.KindToken && !same {
@@ -274,7 +305,11 @@ func (a *application) connectionsCheck(w http.ResponseWriter, r *http.Request) {
// connectionsForget removes a signed-out connection, or an ended
// attempt, from the list.
func (a *application) connectionsForget(w http.ResponseWriter, r *http.Request) {
- a.chatActionTo(w, r, "/conversation/settings/connections", func(ctx context.Context, address string) error {
+ back := "/conversation/settings/connections"
+ if r.PostFormValue("from") == "add" {
+ back += "/add"
+ }
+ a.chatActionTo(w, r, back, func(ctx context.Context, address string) error {
return a.store.Chat().Forget(ctx, address, chi.URLParam(r, "id"))
})
}
@@ -304,7 +339,7 @@ func (a *application) connectionsSecret(w http.ResponseWriter, r *http.Request)
}
func (a *application) connectionsCancel(w http.ResponseWriter, r *http.Request) {
- a.chatActionTo(w, r, "/conversation/settings/connections", func(ctx context.Context, address string) error {
+ a.chatActionTo(w, r, "/conversation/settings/connections/add", func(ctx context.Context, address string) error {
_, err := a.store.Chat().CancelConnection(ctx, address, chi.URLParam(r, "id"))
return err
})
diff --git a/internal/equipo/connections_view.go b/internal/equipo/connections_view.go
index 747a8f54..ff5aa90d 100644
--- a/internal/equipo/connections_view.go
+++ b/internal/equipo/connections_view.go
@@ -44,6 +44,8 @@ type connRow struct {
CheckAgain bool
// Note: an attempt that ended, said once.
Note string
+ // New: the row just added, highlighted once.
+ New bool
}
// connMeter is one provider-reported rate window.
@@ -83,7 +85,7 @@ type connOption struct {
// connectionsPage builds the page from the snapshot, today's usage per
// connection and the preference.
-func connectionsPage(snap wire.Snapshot, today map[string]int64, prefer wire.Preferences, runner string) modelsView {
+func connectionsPage(snap wire.Snapshot, today map[string]int64, prefer wire.Preferences, runner string, now time.Time) modelsView {
v := modelsView{Offline: !snap.Runner.Online, Runner: runner, Cursor: snap.Cursor}
v.Prefer = preferControl(prefer)
live := liveRoles(snap)
@@ -102,8 +104,9 @@ func connectionsPage(snap wire.Snapshot, today map[string]int64, prefer wire.Pre
v.Attempts = append(v.Attempts, line)
v.Connecting = true
case c.State == wire.ConnError && c.LocalID == "":
- // An attempt that ended says why once, then the page moves on.
- if time.Since(c.UpdatedAt) < 10*time.Minute {
+ // An attempt that ended says why once, then the page moves on:
+ // after ten minutes, or once a newer attempt started.
+ if now.Sub(c.UpdatedAt) < 10*time.Minute && !newerThan(snap.Connections, c) {
note := copyText("chat.connections.reason." + c.Reason)
if c.Kind == wire.KindToken && c.Reason == "provider_refused" {
note = copyText("chat.connections.token_rejected")
@@ -114,13 +117,10 @@ func connectionsPage(snap wire.Snapshot, today map[string]int64, prefer wire.Pre
held = append(held, c)
}
}
- healthy := ""
- for _, c := range held {
- if c.State == wire.ConnHealthy {
- healthy = providerName(c.Provider)
- break
- }
+ for i, c := range held {
+ held[i] = freshen(c, now)
}
+ names := namesOf(held)
if coord == "" {
// Nothing answered yet: the first that can, the preferred first.
for _, c := range held {
@@ -129,6 +129,7 @@ func connectionsPage(snap wire.Snapshot, today map[string]int64, prefer wire.Pre
}
}
}
+ work := workOn(snap, held, coord)
for _, c := range held {
row := connRow{ID: c.ID, Provider: c.Provider, Name: providerName(c.Provider), Glyph: providerGlyph(c.Provider), Label: c.Label, Plan: c.Plan, Kind: c.Kind, State: c.State, Words: connectionState(c), Usage: tokensText(today[c.LocalID]), PreferRevision: prefer.Revision}
_, row.UsageTail, _ = strings.Cut(copyText("chat.connections.usage_today"), "%s")
@@ -136,7 +137,7 @@ func connectionsPage(snap wire.Snapshot, today map[string]int64, prefer wire.Pre
row.State = wire.ConnSignInAgain
}
if c.Kind == wire.KindToken {
- tokenFacts(&row, c, time.Now())
+ tokenFacts(&row, c, now)
}
if c.Headroom != nil && row.State != wire.ConnSignedOut && row.State != wire.ConnSignInAgain {
for _, w := range c.Headroom.Windows {
@@ -151,8 +152,14 @@ func connectionsPage(snap wire.Snapshot, today map[string]int64, prefer wire.Pre
row.CheckAgain = c.Kind == wire.KindToken && c.LocalID != ""
case wire.ConnLimited:
row.RolesNote = copyText("chat.connections.roles.resting_none")
- if healthy != "" {
- row.RolesNote = fmt.Sprintf(copyText("chat.connections.roles.resting_moved"), healthy)
+ var to []string
+ for _, w := range work {
+ if w.LocalID != c.LocalID {
+ to = append(to, names.of(w))
+ }
+ }
+ if len(to) > 0 {
+ row.RolesNote = fmt.Sprintf(copyText("chat.connections.roles.resting_moved"), strings.Join(to, copyText("chat.connections.and")))
}
default:
if c.LocalID == coord {
@@ -174,10 +181,20 @@ func connectionsPage(snap wire.Snapshot, today map[string]int64, prefer wire.Pre
}
v.Rows = append(v.Rows, row)
}
- v.Answering = answering(held, coord, v.Attempts)
+ v.Answering = answering(held, coord, v.Attempts, names, prefer.Provider)
return v
}
+// newerThan: an attempt was started after c ended.
+func newerThan(conns []wire.Connection, c wire.Connection) bool {
+ for _, o := range conns {
+ if o.ID != c.ID && o.CreatedAt.After(c.UpdatedAt) {
+ return true
+ }
+ }
+ return false
+}
+
// tokenFacts says when a pasted token expires (about when, for an
// estimate), asks for a new one within TokenRenewal of then, and says a
// rejected one was rejected.
@@ -235,25 +252,29 @@ func coordinatorOn(snap wire.Snapshot) string {
return ""
}
-// answering says what answers now, or why nothing can.
-func answering(held []wire.Connection, coord string, attempts []modelLine) connAnswering {
+// answering says what answers now, or why nothing can. A connection is
+// named by its account when the person holds more than one of its
+// provider; what happens next is what the choice does, not a promise
+// (Paul, 2026-11-10): under Automatic work stays put until its next
+// message or step; with a preference it moves to the preferred one.
+func answering(held []wire.Connection, coord string, attempts []modelLine, names connNames, prefer string) connAnswering {
if len(held) == 0 {
return connAnswering{}
}
- var on string
+ var on *wire.Connection
var resting []wire.Connection
- for _, c := range held {
+ for i, c := range held {
if c.LocalID == coord && c.State == wire.ConnHealthy {
- on = providerName(c.Provider)
+ on = &held[i]
}
if c.State == wire.ConnLimited {
resting = append(resting, c)
}
}
- if on == "" {
+ if on == nil {
var parts []string
for _, c := range held {
- name := providerName(c.Provider)
+ name := names.of(c)
switch c.State {
case wire.ConnLimited:
if c.Headroom != nil && c.Headroom.ResetsAt != nil {
@@ -275,12 +296,15 @@ func answering(held []wire.Connection, coord string, attempts []modelLine) connA
}
a := connAnswering{}
a.LeadStart, a.LeadEnd, _ = strings.Cut(copyText("chat.connections.answering.on"), "%s")
- a.LeadName = on
+ a.LeadName = names.of(*on)
+ a.Sub = fmt.Sprintf(copyText("chat.connections.answering.too"), a.LeadName)
if len(resting) > 0 {
- var rests, names []string
+ var rests []string
for _, c := range resting {
- name := providerName(c.Provider)
- names = append(names, name)
+ name := names.of(c)
+ if c.Provider == on.Provider && names[c.Provider] == 2 {
+ name = fmt.Sprintf(copyText("chat.connections.answering.other"), providerName(c.Provider))
+ }
if c.Headroom != nil && c.Headroom.ResetsAt != nil {
rests = append(rests, fmt.Sprintf(copyText("chat.connections.answering.rests_until"), name, resetText(*c.Headroom.ResetsAt)))
} else {
@@ -288,9 +312,12 @@ func answering(held []wire.Connection, coord string, attempts []modelLine) connA
}
}
a.LeadEnd = fmt.Sprintf(copyText("chat.connections.answering.while"), strings.Join(rests, copyText("chat.connections.and")))
- a.Sub = fmt.Sprintf(copyText("chat.connections.answering.too"), on) + " " + fmt.Sprintf(copyText("chat.connections.answering.back"), strings.Join(names, copyText("chat.connections.and")))
- } else {
- a.Sub = fmt.Sprintf(copyText("chat.connections.answering.too"), on)
+ switch {
+ case prefer == "":
+ a.Sub += " " + copyText("chat.connections.answering.stays")
+ case prefer != on.Provider && names[prefer] > 0:
+ a.Sub += " " + fmt.Sprintf(copyText("chat.connections.answering.to_preferred"), providerName(prefer))
+ }
}
if len(attempts) > 0 {
a.Sub = fmt.Sprintf(copyText("chat.connections.answering.connecting"), attempts[0].Name)
@@ -298,6 +325,72 @@ func answering(held []wire.Connection, coord string, attempts []modelLine) connA
return a
}
+// connNames counts the person's connections by provider, to name each:
+// the provider, and the account when there is more than one of it.
+type connNames map[string]int
+
+func namesOf(held []wire.Connection) connNames {
+ n := connNames{}
+ for _, c := range held {
+ n[c.Provider]++
+ }
+ return n
+}
+
+func (n connNames) of(c wire.Connection) string {
+ if n[c.Provider] > 1 && c.Label != "" {
+ return fmt.Sprintf(copyText("chat.connections.named"), providerName(c.Provider), c.Label)
+ }
+ return providerName(c.Provider)
+}
+
+// workOn is where the person's work runs now: the coordinator's
+// connection, then those running a step, each once.
+func workOn(snap wire.Snapshot, held []wire.Connection, coord string) []wire.Connection {
+ ids := []string{coord}
+ for _, k := range snap.Tasks {
+ for _, s := range k.Steps {
+ if s.State == wire.StepRunning && s.Account != "" {
+ ids = append(ids, s.Account)
+ }
+ }
+ }
+ var out []wire.Connection
+ seen := map[string]bool{"": true}
+ for _, id := range ids {
+ for _, c := range held {
+ if c.LocalID == id && !seen[id] && c.State == wire.ConnHealthy {
+ seen[id] = true
+ out = append(out, c)
+ }
+ }
+ }
+ return out
+}
+
+// freshen drops what the provider reported that has gone stale: a
+// window or reset time already passed, and a full window on a
+// connection that answers (Paul, 2026-11-10: Ready with a full bar
+// after its reset). The meter stays away until fresh numbers come.
+func freshen(c wire.Connection, now time.Time) wire.Connection {
+ if c.Headroom == nil {
+ return c
+ }
+ h := *c.Headroom
+ if h.ResetsAt != nil && !h.ResetsAt.After(now) {
+ h.ResetsAt = nil
+ }
+ h.Windows = nil
+ for _, w := range c.Headroom.Windows {
+ if w.ResetsAt != nil && !w.ResetsAt.After(now) || c.State == wire.ConnHealthy && w.UsedPercent >= 99.5 {
+ continue
+ }
+ h.Windows = append(h.Windows, w)
+ }
+ c.Headroom = &h
+ return c
+}
+
// meterOf is one reported window in words.
func meterOf(w wire.Window) connMeter {
m := connMeter{Used: int(w.UsedPercent + 0.5), Level: "ok"}
diff --git a/internal/equipo/connections_view_test.go b/internal/equipo/connections_view_test.go
new file mode 100644
index 00000000..7556a0af
--- /dev/null
+++ b/internal/equipo/connections_view_test.go
@@ -0,0 +1,153 @@
+package equipo
+
+import (
+ "strings"
+ "testing"
+ "time"
+
+ "amadan.net/oficina/equipo/internal/wire"
+)
+
+// Paul's screenshot, Tue 2026-11-10 22:30 UTC: Claude paul@tito.io Ready
+// (its week window reported full, resetting Tue 21:00, which has passed);
+// Codex paul@tito.io promax limited until Thu 09:36; Codex
+// paul@keymail.dev prolite Ready, the coordinator's last turn on it.
+var screenshotNow = time.Date(2026, 11, 10, 22, 30, 0, 0, time.UTC)
+
+func screenshotSnapshot() wire.Snapshot {
+ weekReset := time.Date(2026, 11, 10, 21, 0, 0, 0, time.UTC)
+ codexReset := time.Date(2026, 11, 12, 9, 36, 0, 0, time.UTC)
+ return wire.Snapshot{
+ Runner: wire.Runner{ID: "r1", Online: true},
+ Connections: []wire.Connection{
+ {ID: "c-claude", LocalID: "claude-1", Provider: wire.ProviderClaude, Label: "paul@tito.io", State: wire.ConnHealthy, Headroom: &wire.Headroom{Windows: []wire.Window{{Name: "seven_day", UsedPercent: 100, Minutes: 7 * 24 * 60, ResetsAt: &weekReset}}}},
+ {ID: "c-promax", LocalID: "codex-1", Provider: wire.ProviderCodex, Label: "paul@tito.io", Plan: "promax", State: wire.ConnLimited, Headroom: &wire.Headroom{ResetsAt: &codexReset, Windows: []wire.Window{{Name: "secondary", UsedPercent: 100, Minutes: 7 * 24 * 60, ResetsAt: &codexReset}}}},
+ {ID: "c-prolite", LocalID: "codex-2", Provider: wire.ProviderCodex, Label: "paul@keymail.dev", Plan: "prolite", State: wire.ConnHealthy},
+ },
+ Turns: []wire.Turn{
+ {ID: "t1", State: wire.TurnReplied, Connection: "codex-1", UpdatedAt: screenshotNow.Add(-3 * time.Hour)},
+ {ID: "t2", State: wire.TurnReplied, Connection: "codex-2", UpdatedAt: screenshotNow.Add(-10 * time.Minute)},
+ },
+ }
+}
+
+func rowOf(t *testing.T, v modelsView, id string) connRow {
+ t.Helper()
+ for _, r := range v.Rows {
+ if r.ID == id {
+ return r
+ }
+ }
+ t.Fatalf("no row %s", id)
+ return connRow{}
+}
+
+func lead(a connAnswering) string { return a.LeadStart + a.LeadName + a.LeadEnd }
+
+// Bug 1: with two Codex connections, the summary names the account, and
+// the resting one is the other Codex account, not "Codex".
+func TestConnectionsSummaryNamesTheAccount(t *testing.T) {
+ v := connectionsPage(screenshotSnapshot(), nil, wire.Preferences{}, "Tito Studio", screenshotNow)
+ want := "Your coordinator is on Codex (paul@keymail.dev) while your other Codex account rests until Thu 09:36 UTC."
+ if got := lead(v.Answering); got != want {
+ t.Fatalf("lead %q, want %q", got, want)
+ }
+ if v.Answering.LeadName != "Codex (paul@keymail.dev)" {
+ t.Fatalf("bold name %q", v.Answering.LeadName)
+ }
+ // One connection of a provider: the provider alone.
+ snap := screenshotSnapshot()
+ snap.Connections = snap.Connections[:2]
+ snap.Turns = snap.Turns[:0]
+ one := connectionsPage(snap, nil, wire.Preferences{}, "Tito Studio", screenshotNow)
+ if got := lead(one.Answering); got != "Your coordinator is on Claude while Codex rests until Thu 09:36 UTC." {
+ t.Fatalf("one of each: %q", got)
+ }
+}
+
+// Bug 2: a window whose reset has passed shows no stale percentage or
+// reset; nor does a full window on a connection that answers.
+func TestConnectionsStaleMeterAfterReset(t *testing.T) {
+ v := connectionsPage(screenshotSnapshot(), nil, wire.Preferences{}, "Tito Studio", screenshotNow)
+ if m := rowOf(t, v, "c-claude").Meters; len(m) != 0 {
+ t.Fatalf("Claude shows a stale meter after its reset: %+v", m)
+ }
+ // The resting Codex keeps its reported window: its reset is ahead.
+ if m := rowOf(t, v, "c-promax").Meters; len(m) != 1 || m[0].Used != 100 || m[0].Resets != "resets Thu 09:36 UTC" {
+ t.Fatalf("promax meters %+v", m)
+ }
+ snap := screenshotSnapshot()
+ ahead := screenshotNow.Add(30 * time.Hour)
+ snap.Connections[0].Headroom = &wire.Headroom{Windows: []wire.Window{
+ {Name: "five_hour", UsedPercent: 40, Minutes: 300, ResetsAt: &ahead},
+ {Name: "seven_day", UsedPercent: 100, Minutes: 7 * 24 * 60, ResetsAt: &ahead},
+ }}
+ m := rowOf(t, connectionsPage(snap, nil, wire.Preferences{}, "", screenshotNow), "c-claude").Meters
+ if len(m) != 1 || m[0].Used != 40 {
+ t.Fatalf("a Ready connection shows a full window, or lost its fresh one: %+v", m)
+ }
+ // A limited connection whose reset has passed is not "until" then.
+ past := screenshotNow.Add(-time.Hour)
+ snap.Connections[1].Headroom = &wire.Headroom{ResetsAt: &past}
+ if w := rowOf(t, connectionsPage(snap, nil, wire.Preferences{}, "", screenshotNow), "c-promax").Words; w != copyText("chat.connections.limited") {
+ t.Fatalf("limited words %q", w)
+ }
+}
+
+// Bug 3: the resting row says where its work went: the connection the
+// coordinator last answered on, named by account, not the first healthy.
+func TestConnectionsRestingDestination(t *testing.T) {
+ v := connectionsPage(screenshotSnapshot(), nil, wire.Preferences{}, "Tito Studio", screenshotNow)
+ if got := rowOf(t, v, "c-promax").RolesNote; got != "Resting. Its work moved to Codex (paul@keymail.dev)." {
+ t.Fatalf("resting note %q", got)
+ }
+ if r := rowOf(t, v, "c-prolite"); len(r.Roles) != 1 || r.Roles[0].Name != copyText("conversation.coordinator") {
+ t.Fatalf("keymail roles %+v", r.Roles)
+ }
+ if r := rowOf(t, v, "c-claude"); len(r.Roles) != 0 {
+ t.Fatalf("Claude claims a role %+v", r.Roles)
+ }
+ // A step running on Claude: the work went there too.
+ snap := screenshotSnapshot()
+ snap.Tasks = []wire.Task{{ID: "k1", Steps: []wire.Step{{ID: "s1", Specialist: wire.SpecialistEngineering, State: wire.StepRunning, Account: "claude-1"}}}}
+ v = connectionsPage(snap, nil, wire.Preferences{}, "", screenshotNow)
+ if got := rowOf(t, v, "c-promax").RolesNote; got != "Resting. Its work moved to Codex (paul@keymail.dev) and Claude." {
+ t.Fatalf("resting note with a step %q", got)
+ }
+}
+
+// Bug 4: under Automatic there is no "moves back": work stays until its
+// next message or step, then the healthiest with headroom is picked.
+// With a preference, the summary may say work moves to it.
+func TestConnectionsSummaryNoInventedPreference(t *testing.T) {
+ v := connectionsPage(screenshotSnapshot(), nil, wire.Preferences{}, "Tito Studio", screenshotNow)
+ if strings.Contains(v.Answering.Sub, "moves back") || !strings.Contains(v.Answering.Sub, copyText("chat.connections.answering.stays")) {
+ t.Fatalf("automatic sub %q", v.Answering.Sub)
+ }
+ v = connectionsPage(screenshotSnapshot(), nil, wire.Preferences{Provider: wire.ProviderClaude, Revision: 1}, "Tito Studio", screenshotNow)
+ if !strings.Contains(v.Answering.Sub, "Work moves to Claude, your preference,") || strings.Contains(v.Answering.Sub, copyText("chat.connections.answering.stays")) {
+ t.Fatalf("preferred sub %q", v.Answering.Sub)
+ }
+}
+
+// An ended attempt's note (Paul, 2026-11-10: "The sign-in was not
+// finished in time." stayed under the list) gives way to a newer
+// attempt: one connecting, or one that connected.
+func TestConnectionsEndedNoteClears(t *testing.T) {
+ snap := screenshotSnapshot()
+ ended := wire.Connection{ID: "c-ended", Provider: wire.ProviderClaude, State: wire.ConnError, Reason: "timed_out", CreatedAt: screenshotNow.Add(-20 * time.Minute), UpdatedAt: screenshotNow.Add(-5 * time.Minute)}
+ snap.Connections = append(snap.Connections, ended)
+ v := connectionsPage(snap, nil, wire.Preferences{}, "", screenshotNow)
+ if len(v.Ended) != 1 || v.Ended[0].Note != "The sign-in was not finished in time." {
+ t.Fatalf("ended %+v", v.Ended)
+ }
+ for _, state := range []string{wire.ConnConnecting, wire.ConnHealthy} {
+ later := append([]wire.Connection{}, snap.Connections...)
+ later = append(later, wire.Connection{ID: "c-new", LocalID: map[string]string{wire.ConnHealthy: "claude-2"}[state], Provider: wire.ProviderClaude, State: state, CreatedAt: screenshotNow.Add(-time.Minute), UpdatedAt: screenshotNow})
+ s := snap
+ s.Connections = later
+ if v := connectionsPage(s, nil, wire.Preferences{}, "", screenshotNow); len(v.Ended) != 0 {
+ t.Fatalf("a %s attempt after it leaves the note: %+v", state, v.Ended)
+ }
+ }
+}
diff --git a/internal/equipo/copy.go b/internal/equipo/copy.go
index aecced71..4c73bc3b 100644
--- a/internal/equipo/copy.go
+++ b/internal/equipo/copy.go
@@ -740,7 +740,11 @@ var pageCopy = map[string]string{
"chat.connections.answering.rests_until": "%s rests until %s", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context)
"chat.connections.and": " and ", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context)
"chat.connections.answering.too": "Engineering and Review are on %s too.", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context)
- "chat.connections.answering.back": "Everything moves back when %s returns.", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context)
+ "chat.connections.answering.stays": "Work stays where it is until the next message or step, then Equipo picks the healthiest connection with headroom.", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context)
+ "chat.connections.answering.to_preferred": "Work moves to %s, your preference, from the next message or step once it is ready.", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context)
+ "chat.connections.answering.other": "your other %s account", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context)
+ "chat.connections.named": "%s (%s)", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context)
+ "chat.connections.dismiss": "Dismiss", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context)
"chat.connections.answering.connecting": "%s is connecting. Once it is ready, Review can run on another model family.", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context)
"chat.connections.answering.none": "Nothing can answer right now.", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context)
"chat.connections.answering.no_reset": "%s reported no reset time, so Equipo checks again in 15 minutes", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context)
diff --git a/internal/equipo/handlers.go b/internal/equipo/handlers.go
index af75128e..035b2559 100644
--- a/internal/equipo/handlers.go
+++ b/internal/equipo/handlers.go
@@ -54,14 +54,18 @@ type pageData struct {
Thinking thinkingView
Settings settingsHubView
SettingsNav []settingsLink
- Coordinator conversation.CoordinatorPage
- Plan planning.Page
- Rendered RenderedChangeView
- Live live.View
- Topic, CollectionTopic string
- Tasks []TaskViewData
- TaskView TaskViewData
- Work SpecialistWorkView
+ // RailArriving: the person crossed into or out of Settings, so the
+ // rail's nav (the Settings one or the main one) arrives with a calm
+ // slide (settings_hub.go).
+ RailArriving bool
+ Coordinator conversation.CoordinatorPage
+ Plan planning.Page
+ Rendered RenderedChangeView
+ Live live.View
+ Topic, CollectionTopic string
+ Tasks []TaskViewData
+ TaskView TaskViewData
+ Work SpecialistWorkView
library.NavigationView
Rail railView
Connections []ConnectionView
@@ -110,6 +114,7 @@ func (a *application) page(r *http.Request, key string) (pageData, error) {
if ctx, address, ok := sessionContext(r); ok {
data.Rail = a.rail(ctx, address)
}
+ data.RailArriving = crossedSettings(r)
return data, nil
}
func (a *application) failure(w http.ResponseWriter, r *http.Request, err error) {
diff --git a/internal/equipo/icons/icons.go b/internal/equipo/icons/icons.go
index e958bd83..ee91a325 100644
--- a/internal/equipo/icons/icons.go
+++ b/internal/equipo/icons/icons.go
@@ -55,6 +55,7 @@ var icons = map[string]template.HTML{
"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>`,
"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>`,
"copy": `<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="14" height="14" x="8" y="8" rx="2" ry="2"/><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"/></svg>`,
"x": `<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 6 6 18"/><path d="m6 6 12 12"/></svg>`,
"x-circle": `<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="10"/><path d="m15 9-6 6"/><path d="m9 9 6 6"/></svg>`,
diff --git a/internal/equipo/settings_hub.go b/internal/equipo/settings_hub.go
index 95fa3bee..7cfcc017 100644
--- a/internal/equipo/settings_hub.go
+++ b/internal/equipo/settings_hub.go
@@ -2,6 +2,8 @@ package equipo
import (
"net/http"
+ "net/url"
+ "strings"
)
// Settings (Paul, 2026-11-09: "settings could probably get a submenu on
@@ -15,6 +17,23 @@ import (
//
// Usage is not a section yet: there is no usage view to put there.
+// Paul, 2026-11-10: "The settings nav should probably replace the main
+// nav on this view, right?" On a desktop the rail itself becomes the
+// Settings nav ("‹ Equipo", then the sections), so Settings is two
+// columns; the phone keeps its drill-in. The swap is the same rail with a
+// calm slide of its nav, only when the person crosses into or out of
+// Settings (the Referer says from where), never between sections.
+func crossedSettings(r *http.Request) bool {
+ from, err := url.Parse(r.Referer())
+ if r.Referer() == "" || err != nil || from.Host != r.Host {
+ return false
+ }
+ in := func(p string) bool {
+ return p == "/conversation/settings" || strings.HasPrefix(p, "/conversation/settings/")
+ }
+ return in(from.Path) != in(r.URL.Path)
+}
+
// settingsLink is one entry of the Settings menu.
type settingsLink struct {
Key, Href, CopyKey, Icon string
diff --git a/internal/equipo/static/connections.js b/internal/equipo/static/connections.js
index ff293b4e..689e5b2b 100644
--- a/internal/equipo/static/connections.js
+++ b/internal/equipo/static/connections.js
@@ -1,13 +1,18 @@
-// The Connections page follows the person's event stream: an attempt's
-// sign-in steps, its approval, every change of a connection's state and
-// the preference arrive in place, rendered by the server. Nothing reloads
-// the page. Add, Cancel, Prefer, Sign out and Forget post in the
-// background. The living marks are the shared Stardust (stardust.js).
+// The Connections page and its Add a connection page follow the person's
+// event stream: an attempt's sign-in steps, its approval, every change of
+// a connection's state and the preference arrive in place, rendered by
+// the server. Nothing reloads the page. Add, Cancel, Prefer, Sign out and
+// Forget post in the background; a row's Sign in again or Paste a new
+// token goes to the Add page, where its card is. Once an attempt
+// connects, the Add page shows the flourish and goes back to Connections
+// with the new row marked. The living marks are the shared Stardust
+// (stardust.js).
(function () {
"use strict";
var root = document.querySelector("[data-connections]");
if (!root || !window.fetch) return;
var cursor = Number(root.dataset.cursor) || 0;
+ var adding = root.hasAttribute("data-adding"), leaving = false;
var still = window.matchMedia ? matchMedia("(prefers-reduced-motion: reduce)") : null;
function moving() { return !(still && still.matches); }
var dust = window.EquipoStardust;
@@ -41,11 +46,15 @@
function live(scope) { enliven(scope); animate(scope); }
// A connection that just finished connecting: the success card with a
- // gentle flourish of the shared mark, then the new row slides in.
- function celebrate(row, provider, account) {
+ // gentle flourish of the shared mark, then back to Connections, where
+ // the new row is marked.
+ function celebrate(id, provider, account) {
var area = root.querySelector("[data-attempts]");
var tpl = document.querySelector("[data-success-template]");
- if (!area || !tpl) return;
+ var back = "/conversation/settings/connections?added=" + encodeURIComponent(id);
+ leaving = true;
+ if (source) source.close();
+ if (!area || !tpl) { location.assign(back); return; }
var name = provider === "codex" ? "Codex" : provider === "claude" ? "Claude" : provider;
var card = tpl.content.firstElementChild.cloneNode(true);
card.querySelector("[data-success-title]").textContent = (root.dataset.connected || "%s is connected").replace("%s", name);
@@ -56,24 +65,24 @@
spark.setAttribute("data-flourish", "");
spark.style.fontSize = "2.5rem";
}
- var waiting = Array.from(area.children);
- waiting.forEach(function (el) { el.hidden = true; });
- area.prepend(card);
- row.hidden = true;
- var show = function () {
- card.remove();
- waiting.forEach(function (el) { if (el.isConnected) el.hidden = false; });
- row.hidden = false;
- if (moving()) row.setAttribute("data-new", "");
- };
- if (!moving()) { setTimeout(show, 900); return; }
+ area.replaceChildren(card);
+ if (!moving()) { setTimeout(function () { location.assign(back); }, 900); return; }
setTimeout(function () { card.setAttribute("data-leaving", ""); }, 1700);
- setTimeout(show, 2100);
+ setTimeout(function () { location.assign(back); }, 2100);
+ }
+
+ // The row just added keeps its mark once: a reload of the page does not
+ // play it again, and it fades.
+ if (!adding && /[?&]added=/.test(location.search)) {
+ history.replaceState(history.state, "", location.pathname);
+ var fresh = root.querySelector("[equipo-conn-row][data-new]");
+ if (fresh) setTimeout(function () { fresh.removeAttribute("data-new"); }, 2800);
}
// Refreshes run one at a time; a request during one runs once after it.
var inflight = null, again = false;
function refresh() {
+ if (leaving) return Promise.resolve();
if (inflight) { again = true; return inflight; }
inflight = load().finally(function () {
inflight = null;
@@ -82,17 +91,16 @@
return inflight;
}
// load reads the page again and swaps its live part in place. An Add
- // whose attempt the server has not shown yet keeps its loading card; a
- // chooser the person opened stays open.
+ // whose attempt the server has not shown yet keeps its loading card.
function load() {
var box = root.querySelector("[data-connections-live]");
var connecting = {};
box.querySelectorAll("[data-connecting]").forEach(function (el) { connecting[el.dataset.connection] = el.dataset.provider; });
var pending = box.querySelector('[data-connection="pending"]');
- var chooserOpen = !!box.querySelector("[data-add-area][open]");
return fetch(location.pathname, { credentials: "same-origin", headers: { "Accept": "text/html" } })
.then(function (r) { if (!r.ok) throw new Error("refresh"); return r.text(); })
.then(function (body) {
+ if (leaving) return;
var doc = new DOMParser().parseFromString(body, "text/html");
var next = doc.querySelector("[data-connections-live]");
if (!next) return;
@@ -104,10 +112,6 @@
var area = next.querySelector("[data-attempts]");
if (area) area.replaceChildren(pending);
}
- if (chooserOpen && !pending) {
- var d = next.querySelector("[data-add-area]");
- if (d) d.open = true;
- }
// What was on the page already stays still: only what is new
// arrives with its motion.
var seen = {};
@@ -129,12 +133,10 @@
box.replaceChildren.apply(box, Array.from(next.children));
if (typing) typing.focus();
live(box);
- Object.keys(connecting).forEach(function (id) {
- var row = box.querySelector('[equipo-conn-row][data-connection="' + CSS.escape(id) + '"]');
- if (row && row.dataset.state === "healthy") {
- var acct = row.querySelector("[equipo-conn-account]");
- celebrate(row, connecting[id], acct ? acct.textContent : "");
- }
+ Object.keys(connecting).some(function (id) {
+ var done = box.querySelector('[data-held-connection="' + CSS.escape(id) + '"][data-state="healthy"]');
+ if (done) celebrate(id, connecting[id], done.dataset.account);
+ return !!done;
});
});
}
@@ -220,13 +222,20 @@
}
// Forms post in the background; an Add shows its loading card at once,
- // in the chooser's place.
+ // in the chooser's place. On Connections, a row's Sign in again or
+ // Paste a new token posts as a form: it leads to the Add page.
root.addEventListener("submit", function (event) {
var form = event.target;
if (!form.matches || !form.matches("form")) return;
+ if (!adding && form.matches("[data-add-form]")) return;
event.preventDefault();
if (form.matches("[data-token-form]")) { sealToken(form); return; }
+ // An ended attempt's note goes once dismissed, or once a new
+ // attempt starts.
+ var note = form.closest("[data-connection-note]");
+ if (note) note.hidden = true;
if (form.matches("[data-add-form]")) {
+ root.querySelectorAll("[data-connection-note]").forEach(function (n) { n.hidden = true; });
var provider = form.querySelector('[name="provider"]').value;
var area = root.querySelector("[data-attempts]");
if (area && !area.querySelector('[data-connecting][data-provider="' + provider + '"]')) {
@@ -265,10 +274,11 @@
clearTimeout(t.timer);
t.timer = setTimeout(function () { t.setAttribute("data-gone", ""); }, 2400);
}
+ var source, failures = 0;
live(root);
if (!window.EventSource) return;
- var source, failures = 0;
function open() {
+ if (leaving) return;
source = new EventSource("/api/v1/events?after=" + cursor);
["connection", "preference", "turn", "step"].forEach(function (type) {
source.addEventListener(type, function (event) {
diff --git a/internal/equipo/static/equipo.css b/internal/equipo/static/equipo.css
index 6d1b9803..cf4d90de 100644
--- a/internal/equipo/static/equipo.css
+++ b/internal/equipo/static/equipo.css
@@ -741,7 +741,10 @@ a[equipo-source]:hover { color: var(--rst-text); text-decoration: underline; tex
[equipo-conn-row][data-needs], [equipo-conn-row][data-state="limited"] { background: color-mix(in srgb, var(--rst-tone-warning-bg) 30%, var(--rst-surface)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--rst-tone-warning-fg) 14%, transparent); }
[equipo-conn-row][data-state="signed_out"] { background: var(--rst-surface-2); box-shadow: inset 0 0 0 1px var(--rst-line); }
[equipo-conn-row][data-state="signed_out"] [equipo-pmark], [equipo-conn-row][data-state="sign_in_again"] [equipo-pmark] { filter: saturate(.35); opacity: .75; }
-[equipo-conn-row][data-new] { animation: equipo-row-in .55s var(--equipo-ease, ease) both; }
+/* The row just added, back from the Add page: it arrives, then a soft
+ accent wash fades from it. */
+[equipo-conn-row][data-new] { animation: equipo-row-in .55s var(--equipo-ease, ease) both, equipo-row-glow 2.4s ease-out .3s backwards; }
+@keyframes equipo-row-glow { from { background-color: var(--rst-accent-soft); } }
@keyframes equipo-row-in { from { opacity: 0; transform: translateY(-.5rem); } }
[equipo-conn-body] { min-inline-size: 0; display: grid; gap: .45rem; }
[equipo-conn-body] p { margin: 0; }
@@ -792,14 +795,14 @@ a[equipo-source]:hover { color: var(--rst-text); text-decoration: underline; tex
[equipo-conn-row][data-needs] [equipo-conn-quiet] { display: none; }
[equipo-conn-row][data-needs] [equipo-conn-more] { display: block; order: -1; }
[equipo-conn-add-area] { margin-block-start: var(--rst-sp-3); }
-[equipo-conn-add-foot] { display: flex; align-items: flex-start; gap: var(--rst-sp-3); color: var(--rst-text-faint, var(--rst-text-muted)); font-size: var(--rst-fs-xs); }
+[equipo-conn-add-foot] { display: flex; align-items: flex-start; gap: var(--rst-sp-3); margin-block-start: var(--rst-sp-3); color: var(--rst-text-faint, var(--rst-text-muted)); font-size: var(--rst-fs-xs); }
[equipo-conn-add-foot] > span { padding-block-start: .45rem; }
-[equipo-conn-add] > summary { list-style: none; display: inline-flex; align-items: center; gap: .4em; cursor: pointer; }
-[equipo-conn-add] > summary::-webkit-details-marker { display: none; }
-[equipo-conn-add] > summary .icon { margin: 0; }
-[equipo-conn-add][open] > summary { display: none; }
-[equipo-conn-add][open] { flex: 1; }
-[equipo-conn-add][open] ~ span { display: none; }
+[equipo-conn-add] { display: inline-flex; align-items: center; gap: .4em; }
+[equipo-conn-add] .icon { margin: 0; }
+/* Add a connection, its own page (Paul, 2026-11-10): the chooser is the
+ page's card, its heading the page's. */
+[equipo-conn-chooser] > form:first-child [equipo-conn-opt] { border-block-start: 0; }
+[equipo-connections][data-adding] [equipo-conn-page-head] { flex-direction: column; align-items: flex-start; gap: var(--rst-sp-1); }
[equipo-conn-chooser], [equipo-conn-card] { border: 1px solid var(--rst-line); border-radius: calc(2 * var(--rst-radius)); background: var(--rst-surface); box-shadow: var(--rst-shadow-lift, none); max-inline-size: 34rem; overflow: hidden; animation: equipo-pop-in .25s var(--equipo-ease, ease) both; }
@keyframes equipo-pop-in { from { opacity: 0; transform: translateY(-.3rem) scale(.985); } }
[equipo-conn-chooser] header { padding: var(--rst-sp-3) var(--rst-sp-4) var(--rst-sp-2); }
@@ -857,6 +860,14 @@ a[equipo-source]:hover { color: var(--rst-text); text-decoration: underline; tex
[equipo-conn-empty] [equipo-conn-add-area] { inline-size: 100%; display: grid; justify-items: center; }
[equipo-conn-empty] [equipo-conn-chooser], [equipo-conn-empty] [equipo-conn-card] { text-align: start; inline-size: 100%; }
[equipo-inline-form] { display: inline; margin: 0; }
+/* An ended attempt's quiet notice (Paul, 2026-11-10): dismissible, and
+ gone once a newer attempt starts. */
+[equipo-conn-note] { display: flex; align-items: center; justify-content: space-between; gap: var(--rst-sp-2); max-inline-size: 34rem; margin: var(--rst-sp-3) 0 0; padding: .3rem .3rem .3rem .75rem; border: 1px solid var(--rst-line); border-radius: var(--rst-radius); background: var(--rst-surface-2); color: var(--rst-text-muted); font-size: var(--rst-fs-xs); }
+[equipo-conn-note][hidden] { display: none; }
+[equipo-conn-dismiss] { display: inline-grid; place-items: center; flex: none; inline-size: 2rem; block-size: 2rem; padding: 0; border: 0; border-radius: var(--rst-radius-sm, 4px); background: none; color: var(--rst-text-faint, var(--rst-text-muted)); cursor: pointer; }
+[equipo-conn-dismiss]:hover { color: var(--rst-text); background: var(--rst-tint-hover, var(--rst-surface)); }
+[equipo-conn-dismiss] .icon { inline-size: 1rem; block-size: 1rem; margin: 0; }
+[equipo-conn-empty] [equipo-conn-note] { inline-size: 100%; text-align: start; }
[data-copy][data-done] { color: var(--rst-tone-positive-fg); }
/* Copy link beside an Open button (Paul, 2026-11-09: to open the link in
another browser). */
@@ -894,11 +905,12 @@ a[equipo-source]:hover { color: var(--rst-text); text-decoration: underline; tex
[equipo-conn-code] { font-size: 1.4rem; }
[equipo-conn-card-foot] { flex-direction: column-reverse; align-items: stretch; }
[equipo-conn-add-foot] { flex-direction: column; align-items: stretch; }
- [equipo-conn-add-foot] > [equipo-conn-add] > summary { inline-size: 100%; justify-content: center; }
+ [equipo-conn-add-foot] > [equipo-conn-add] { justify-content: center; }
[equipo-conn-empty] { padding: var(--rst-sp-5) var(--rst-sp-3); }
}
@media (prefers-reduced-motion: reduce) {
[equipo-conn-row][data-new], [equipo-conn-chooser], [equipo-conn-card], [equipo-conn-card][data-leaving] { animation: none !important; }
+ [equipo-conn-row][data-new] { background: var(--rst-accent-soft); }
[equipo-conn-loading] [data-phrase] { transition: none; }
}
/* A combined duplicate: a quiet line with Undo on hover, focus or touch. */
@@ -1136,8 +1148,29 @@ a[equipo-source]:hover { color: var(--rst-text); text-decoration: underline; tex
[equipo-settings-link] > span { flex: 1; min-inline-size: 0; }
[equipo-settings-link] > .icon:last-child { flex: none; inline-size: 1rem; block-size: 1rem; margin: 0; color: var(--rst-text-faint); }
[equipo-settings-body] { min-inline-size: 0; }
+/* On a desktop the rail itself is the Settings nav (Paul, 2026-11-10):
+ two columns, the main nav waiting behind "‹ Equipo". It arrives with
+ a short slide when the person crosses into Settings, and the main nav
+ slides back when they leave; between sections nothing moves. */
+[equipo-settings-rail] { display: none; }
+[equipo-settings-rail] [equipo-settings-leave] { margin-block-end: var(--rst-sp-2); color: var(--rst-text-muted); font-weight: 500; }
+[equipo-settings-rail] [equipo-settings-leave] .icon { margin-inline-end: var(--rst-sp-1); }
+[equipo-settings-rail] [equipo-nav-group] { margin-block-start: 0; }
+[equipo-settings-rail] [equipo-settings-sub] { padding-inline-start: 1.9rem; font-size: var(--rst-fs-sm); }
+[equipo-settings-rail] [equipo-settings-sub] .icon { inline-size: .9em; block-size: .9em; }
+@keyframes equipo-rail-deeper { from { opacity: 0; transform: translateX(.75rem); } }
+@keyframes equipo-rail-back { from { opacity: 0; transform: translateX(-.75rem); } }
@media (min-width: 800px) {
- [equipo-settings-layout] { grid-template-columns: 13rem minmax(0, 1fr); }
+ [rst-shell-rail]:has([equipo-settings-rail]) > #rail { display: none; }
+ [equipo-settings-rail] { display: flex; }
+ [equipo-settings-layout] > [equipo-settings-nav] { display: none; }
+}
+@media (min-width: 800px) and (prefers-reduced-motion: no-preference) {
+ [equipo-settings-rail][data-arriving] { animation: equipo-rail-deeper .28s var(--equipo-ease, ease) both; }
+ #rail[data-arriving] { animation: equipo-rail-back .28s var(--equipo-ease, ease) both; }
+}
+@media (min-width: 800px) {
+ [equipo-settings-layout] { grid-template-columns: minmax(0, 1fr); }
[equipo-settings-nav] { position: sticky; inset-block-start: var(--rst-sp-4); }
[equipo-settings-link] { min-block-size: 2.25rem; padding: 0 var(--rst-sp-3); border-radius: var(--rst-radius); font-size: var(--rst-fs-sm); }
[equipo-settings-link]:hover { background: var(--rst-tint-hover, var(--rst-surface-2)); }
diff --git a/internal/equipo/static/nav-stream.js b/internal/equipo/static/nav-stream.js
index 0300f8f0..d7e926fc 100644
--- a/internal/equipo/static/nav-stream.js
+++ b/internal/equipo/static/nav-stream.js
@@ -7,6 +7,14 @@
// follow, and elapsed clocks tick here, on every page.
(function () {
"use strict";
+ // Settings' "‹ Equipo" goes back to where the person was before
+ // Settings (the Conversation without scripts, or when there is none).
+ var BEFORE = "equipo.before-settings";
+ try {
+ var leave = document.querySelector("[data-settings-leave]");
+ if (!leave) sessionStorage.setItem(BEFORE, location.pathname + location.search + location.hash);
+ else if (sessionStorage.getItem(BEFORE)) leave.setAttribute("href", sessionStorage.getItem(BEFORE));
+ } catch (e) { /* the Conversation it is */ }
var rail = document.querySelector("[data-nav-stream]");
var KEY = "equipo.spec.open";
function opened() {
diff --git a/internal/equipo/templates/chat.html b/internal/equipo/templates/chat.html
index 819f0eb0..019006d6 100644
--- a/internal/equipo/templates/chat.html
+++ b/internal/equipo/templates/chat.html
@@ -36,7 +36,7 @@
{{range .Cards}}{{template "chat-card" .}}{{end}}{{end}}
{{else}}<li data-empty-state="conversation.empty">{{copy "conversation.empty"}}</li>{{end}}
{{range .Chat.Waiting}}<li equipo-message="incoming" equipo-thinking data-turn="{{.ID}}"{{with .Kind}} data-kind="{{.}}"{{end}} data-started="{{.CreatedAt.UnixMilli}}" aria-busy="true"><div equipo-message-meta><strong>{{icon "message-circle"}}{{copy "conversation.coordinator"}}</strong><time></time></div><div equipo-bubble><div equipo-message-body equipo-markdown data-stream-text></div><p equipo-activity-line><span equipo-activity>{{if eq .Kind "move_in"}}{{copy "chat.moving_in"}}{{else if eq .Kind "explore"}}{{copy "chat.exploring"}}{{else}}{{copy "chat.activity.thinking"}}{{end}}</span><span equipo-activity-sep aria-hidden="true">·</span><span equipo-elapsed></span></p></div></li>{{end}}
-{{with .Chat.NoConnection}}<li equipo-card="no_connection" data-no-connection="{{.TurnID}}"><p equipo-card-line>{{.Line}}</p><p equipo-actions><a rst-btn="primary" href="/conversation/settings/connections" data-add-connection>{{copy "chat.no_connection.add"}}</a></p></li>{{end}}
+{{with .Chat.NoConnection}}<li equipo-card="no_connection" data-no-connection="{{.TurnID}}"><p equipo-card-line>{{.Line}}</p><p equipo-actions><a rst-btn="primary" href="/conversation/settings/connections/add" data-add-connection>{{copy "chat.no_connection.add"}}</a></p></li>{{end}}
{{with .Chat.Ended}}<li equipo-system-note data-ended="{{.ID}}"><p>{{copy .Key}}</p></li>{{end}}
</ol>
</section>
diff --git a/internal/equipo/templates/chrome.html b/internal/equipo/templates/chrome.html
index e5b731cd..e4496628 100644
--- a/internal/equipo/templates/chrome.html
+++ b/internal/equipo/templates/chrome.html
@@ -5,8 +5,8 @@
{{define "up-label"}}{{.TeamName}}{{end}}
{{define "brand"}}<a rst-shell-brand href="/work">{{icon "users"}}{{.TeamName}}</a>{{end}}
{{define "nav"}}
-{{template "region:rail" .}}{{end}}
-{{define "region:rail"}}<nav rst-shell-nav id="rail" data-nav-stream data-cursor="{{.Rail.Cursor}}" data-key="{{.Key}}" data-ago-formats="{{agoFormats}}">
+{{template "region:rail" .}}{{if .SettingsNav}}{{template "settings-rail" .}}{{end}}{{end}}
+{{define "region:rail"}}<nav rst-shell-nav id="rail"{{if and .RailArriving (not .SettingsNav)}} data-arriving{{end}} data-nav-stream data-cursor="{{.Rail.Cursor}}" data-key="{{.Key}}" data-ago-formats="{{agoFormats}}">
<div equipo-team-heading>{{template "brand" .}}</div>
{{$key := .Key}}{{$rail := .Rail}}
{{$team := false}}{{range .Nav}}{{if and (eq .Group "team") (not $team)}}{{$team = true}}{{template "rail-specialists" $rail}}<p equipo-nav-group>{{copy "nav.team"}}</p>{{end}}<a id="nav-{{.Key}}" href="{{.Href}}"{{if eq .Key $key}} aria-current="page"{{end}}>{{icon .Icon}}<span>{{copy .CopyKey}}</span>{{if eq .Key "tasks"}}{{template "rail-count" $rail.Tasks}}{{else if eq .Key "projects"}}{{template "rail-count" $rail.Projects}}{{else if eq .Key "needs-you"}}{{template "rail-count-attention" $rail.Needs}}{{end}}</a>
diff --git a/internal/equipo/templates/models.html b/internal/equipo/templates/models.html
index b1f8eb20..33384eec 100644
--- a/internal/equipo/templates/models.html
+++ b/internal/equipo/templates/models.html
@@ -1,6 +1,6 @@
-{{define "up-label"}}{{template "settings-up-label" .}}{{end}}
-{{define "up"}}{{template "settings-up" .}}{{end}}
-{{define "title"}}{{copy "chat.connections.title"}}{{end}}
+{{define "up-label"}}{{if .Models.Adding}}{{copy "chat.connections.title"}}{{else}}{{template "settings-up-label" .}}{{end}}{{end}}
+{{define "up"}}{{if .Models.Adding}}/conversation/settings/connections{{else}}{{template "settings-up" .}}{{end}}{{end}}
+{{define "title"}}{{if .Models.Adding}}{{copy "chat.connections.add"}}{{else}}{{copy "chat.connections.title"}}{{end}}{{end}}
{{define "conn-star"}}<span equipo-sparkle data-conn-star aria-hidden="true"><svg viewBox="0 0 16 16" focusable="false"><path d="M8 0C8.6 4.6 11.4 7.4 16 8 11.4 8.6 8.6 11.4 8 16 7.4 11.4 4.6 8.6 0 8 4.6 7.4 7.4 4.6 8 0Z"/><circle cx="8" cy="8" r="1.7"/></svg><i data-sat="1"></i><i data-sat="2"></i><i data-sat="3"></i></span>{{end}}
{{define "conn-mark"}}<span equipo-pmark data-provider="{{.}}" aria-hidden="true">{{if eq . "claude"}}Cl{{else if eq . "codex"}}Cx{{else if eq . "mistral"}}Mi{{else if eq . "tensorx"}}Tx{{else}}{{icon "cpu"}}{{end}}</span>{{end}}
{{define "conn-copy"}}<button type="button" rst-btn data-copy="{{.}}" data-copied="{{copy "chat.connections.copied"}}">{{copy "chat.connections.copy"}}</button>{{end}}
@@ -45,10 +45,7 @@
<p equipo-conn-small>{{copy "chat.connections.claude_fine"}}</p>
<div equipo-conn-card-foot><span equipo-conn-small>{{copy "chat.connections.same_machine_hint"}} <form method="post" action="/conversation/connections" equipo-inline-form><input type="hidden" name="provider" value="claude"><input type="hidden" name="same_machine" value="1"><button equipo-link type="submit" data-same-machine>{{copy "chat.connections.same_machine"}}</button></form></span>{{template "conn-cancel" .ID}}</div>
{{end}}</div>{{end}}
-{{define "conn-chooser"}}<details equipo-conn-add data-add-area>
-<summary rst-btn{{if .}}="primary"{{end}} data-add-open>{{icon "plug"}}{{copy "chat.connections.add"}}</summary>
-<div equipo-conn-chooser role="group" aria-label="{{copy "chat.connections.add"}}">
-<header><h3>{{copy "chat.connections.add"}}</h3><p>{{copy "chat.connections.chooser_lede"}}</p></header>
+{{define "conn-chooser"}}<div equipo-conn-chooser role="group" aria-label="{{copy "chat.connections.add"}}">
<form method="post" action="/conversation/connections" data-add-form><input type="hidden" name="provider" value="claude"><input type="hidden" name="kind" value="token"><button type="submit" equipo-conn-opt data-add="claude">{{template "conn-mark" "claude"}}<span><span equipo-conn-opt-name>Claude</span><span equipo-conn-opt-desc>{{copy "chat.connections.claude_desc"}}</span><span equipo-conn-opt-how data-paste-token>{{copy "chat.connections.paste_token"}}</span></span>{{icon "chevron-right"}}</button></form>
<div equipo-conn-alt>{{template "conn-sign-in-instead"}}</div>
<form method="post" action="/conversation/connections" data-add-form><input type="hidden" name="provider" value="codex"><button type="submit" equipo-conn-opt data-add="codex">{{template "conn-mark" "codex"}}<span><span equipo-conn-opt-name>Codex</span><span equipo-conn-opt-desc>{{copy "chat.connections.codex_desc"}}</span></span>{{icon "chevron-right"}}</button></form>
@@ -56,9 +53,10 @@
<button type="button" equipo-conn-opt disabled>{{template "conn-mark" "local"}}<span><span equipo-conn-opt-name>{{copy "chat.connections.local"}}</span><span equipo-conn-opt-desc>{{copy "chat.connections.local_desc"}}</span></span><span equipo-conn-soon>{{copy "chat.connections.soon"}}</span></button>
<button type="button" equipo-conn-opt disabled>{{template "conn-mark" "mistral"}}<span><span equipo-conn-opt-name>{{copy "chat.connections.mistral"}}</span><span equipo-conn-opt-desc>{{copy "chat.connections.mistral_desc"}}</span></span><span equipo-conn-soon>{{copy "chat.connections.soon"}}</span></button>
<button type="button" equipo-conn-opt disabled>{{template "conn-mark" "tensorx"}}<span><span equipo-conn-opt-name>{{copy "chat.connections.tensorx"}}</span><span equipo-conn-opt-desc>{{copy "chat.connections.tensorx_desc"}}</span></span><span equipo-conn-soon>{{copy "chat.connections.soon"}}</span></button>
-</div>
-</details>{{end}}
-{{define "conn-row"}}<article equipo-conn-row data-connection="{{.ID}}" data-provider="{{.Provider}}" data-state="{{.State}}"{{if .Needs}} data-needs{{end}}>
+</div>{{end}}
+{{define "conn-add-link"}}<a rst-btn{{if .}}="primary"{{end}} href="/conversation/settings/connections/add" equipo-conn-add data-add-link>{{icon "plug"}}{{copy "chat.connections.add"}}</a>{{end}}
+{{define "conn-note"}}<div equipo-conn-note data-connection="{{.Row.ID}}" data-connection-note role="status"><span>{{.Row.Note}}</span><form method="post" action="/conversation/connections/{{.Row.ID}}/forget" equipo-inline-form>{{if .Add}}<input type="hidden" name="from" value="add">{{end}}<button type="submit" equipo-conn-dismiss aria-label="{{copy "chat.connections.dismiss"}}" title="{{copy "chat.connections.dismiss"}}" data-dismiss>{{icon "x"}}</button></form></div>{{end}}
+{{define "conn-row"}}<article equipo-conn-row data-connection="{{.ID}}" data-provider="{{.Provider}}" data-state="{{.State}}"{{if .Needs}} data-needs{{end}}{{if .New}} data-new{{end}}>
{{template "conn-mark" .Provider}}
<div equipo-conn-body>
<p equipo-conn-head><span equipo-conn-name>{{.Name}}</span><span equipo-conn-account>{{.Label}}{{with .Plan}}, {{.}}{{end}}</span>{{if .Preferred}}<span equipo-conn-pref>{{icon "star"}}{{copy "chat.connections.preferred"}}</span>{{end}}</p>
@@ -76,31 +74,35 @@
<div equipo-settings-layout data-section="connections">
<template equipo-saved-template><span equipo-saved-tick role="status">{{icon "check"}}<span>{{copy "settings.saved"}}</span></span></template>
{{template "settings-nav" .}}
-<section equipo-settings-body equipo-connections data-connections data-cursor="{{.Models.Cursor}}" data-connected="{{copy "chat.connections.connected_big"}}" data-connected-next="{{copy "chat.connections.connected_next"}}">
-<header equipo-conn-page-head><h1>{{copy "chat.connections.title"}}</h1>{{if .Models.Rows}}<p>{{copy "chat.connections.lede"}}</p>{{end}}</header>
+<section equipo-settings-body equipo-connections data-connections{{if .Models.Adding}} data-adding{{end}} data-cursor="{{.Models.Cursor}}" data-connected="{{copy "chat.connections.connected_big"}}" data-connected-next="{{copy "chat.connections.connected_next"}}">
+{{if .Models.Adding}}<header equipo-conn-page-head><h1>{{copy "chat.connections.add"}}</h1><p>{{copy "chat.connections.chooser_lede"}}</p></header>
+{{else}}<header equipo-conn-page-head><h1>{{copy "chat.connections.title"}}</h1>{{if .Models.Rows}}<p>{{copy "chat.connections.lede"}}</p>{{end}}</header>{{end}}
{{if .Models.Offline}}<p equipo-offline role="status">{{copy "chat.connections.offline"}}</p>{{end}}
<div data-connections-live>
-{{if .Models.Rows}}{{with .Models.Answering}}<section equipo-conn-answering{{with .Tone}} data-tone="{{.}}"{{end}} aria-label="{{copy "chat.connections.title"}}" data-answering>{{if .Tone}}<span equipo-conn-lead-icon aria-hidden="true">{{icon "alert-triangle"}}</span>{{else}}{{template "conn-star"}}{{end}}<p equipo-conn-lead>{{.LeadStart}}<b>{{.LeadName}}</b>{{.LeadEnd}}</p><p equipo-conn-sub>{{.Sub}}{{if .SeeConversation}} <a href="/conversation">{{copy "chat.connections.answering.see"}}</a>{{end}}</p>
+{{if .Models.Adding}}{{range .Models.Ended}}{{template "conn-note" (dict "Row" . "Add" $.Models.Adding)}}{{end}}
+<div equipo-conn-add-area data-attempts>{{range .Models.Attempts}}{{template "conn-attempt" .}}{{else}}{{template "conn-chooser"}}{{end}}</div>
+<div hidden>{{range .Models.Rows}}<i data-held-connection="{{.ID}}" data-state="{{.State}}" data-account="{{.Label}}"></i>{{end}}</div>
+{{else if .Models.Rows}}{{with .Models.Answering}}<section equipo-conn-answering{{with .Tone}} data-tone="{{.}}"{{end}} aria-label="{{copy "chat.connections.title"}}" data-answering>{{if .Tone}}<span equipo-conn-lead-icon aria-hidden="true">{{icon "alert-triangle"}}</span>{{else}}{{template "conn-star"}}{{end}}<p equipo-conn-lead>{{.LeadStart}}<b>{{.LeadName}}</b>{{.LeadEnd}}</p><p equipo-conn-sub>{{.Sub}}{{if .SeeConversation}} <a href="/conversation">{{copy "chat.connections.answering.see"}}</a>{{end}}</p>
{{if not .Tone}}{{with $.Models.Prefer}}<div equipo-conn-prefer><span>{{copy "chat.connections.prefer"}}</span><span equipo-seg role="group" aria-label="{{copy "chat.connections.prefer"}}">{{range .Options}}<form method="post" action="/conversation/connections/prefer" equipo-inline-form><input type="hidden" name="provider" value="{{.Value}}"><input type="hidden" name="revision" value="{{$.Models.Prefer.Revision}}"><button type="submit" aria-pressed="{{.On}}" data-prefer="{{.Value}}">{{.Label}}</button></form>{{end}}</span><span equipo-conn-hint>{{.Hint}}</span></div>{{end}}{{end}}
</section>{{end}}
<section equipo-conn-group><h2>{{copy "chat.connections.group"}} <span equipo-conn-n>{{len .Models.Rows}}</span><span equipo-conn-hint>{{copy "chat.connections.usage_resets"}}</span></h2>
<div equipo-conn-list data-connection-list aria-live="polite">{{range .Models.Rows}}{{template "conn-row" .}}{{end}}</div>
-{{range .Models.Ended}}<p equipo-conn-small data-connection="{{.ID}}" data-connection-note>{{.Note}}</p>{{end}}
-<div equipo-conn-add-area data-attempts>{{range .Models.Attempts}}{{template "conn-attempt" .}}{{else}}<div equipo-conn-add-foot>{{template "conn-chooser" false}}<span>{{copy "chat.connections.add_hint"}}</span></div>{{end}}</div>
+{{range .Models.Ended}}{{template "conn-note" (dict "Row" . "Add" $.Models.Adding)}}{{end}}
+<div equipo-conn-add-foot>{{template "conn-add-link" false}}<span>{{copy "chat.connections.add_hint"}}</span></div>
</section>
{{else}}<section equipo-conn-empty data-empty-state="chat.connections.empty"><p equipo-conn-pair>{{template "conn-mark" "claude"}}{{template "conn-mark" "codex"}}</p>
<h2>{{copy "chat.connections.empty_title"}}</h2>
<p>{{copy "chat.connections.empty_body"}}</p>
-{{range .Models.Ended}}<p equipo-conn-small data-connection="{{.ID}}" data-connection-note>{{.Note}}</p>{{end}}
-<div equipo-conn-add-area data-attempts>{{range .Models.Attempts}}{{template "conn-attempt" .}}{{else}}{{template "conn-chooser" true}}{{end}}</div>
+{{range .Models.Ended}}{{template "conn-note" (dict "Row" . "Add" $.Models.Adding)}}{{end}}
+{{template "conn-add-link" true}}
<p equipo-conn-fine>{{copy "chat.connections.empty_fine"}}</p>
<div hidden data-connection-list></div>
</section>{{end}}
</div>
-{{if .Models.Connecting}}<noscript><p equipo-conn-small><a href="/conversation/settings/connections">{{copy "chat.connections.check_again"}}</a></p></noscript>{{end}}
+{{if and .Models.Adding .Models.Connecting}}{{with index .Models.Attempts 0}}<noscript><p equipo-conn-small><a href="/conversation/settings/connections/add?attempt={{.ID}}">{{copy "chat.connections.check_again"}}</a></p></noscript>{{end}}{{end}}
</section>
-<template data-loading-template>{{template "conn-attempt" (loadingLine "codex")}}</template>
+{{if .Models.Adding}}<template data-loading-template>{{template "conn-attempt" (loadingLine "codex")}}</template>
<template data-loading-template-claude>{{template "conn-attempt" (loadingLine "claude")}}</template>
-<template data-success-template><div equipo-conn-card data-success aria-live="polite"><div equipo-conn-success><span equipo-conn-burst>{{template "conn-star"}}</span><p equipo-conn-big data-success-title></p><p equipo-conn-account data-success-account></p></div></div></template>
+<template data-success-template><div equipo-conn-card data-success aria-live="polite"><div equipo-conn-success><span equipo-conn-burst>{{template "conn-star"}}</span><p equipo-conn-big data-success-title></p><p equipo-conn-account data-success-account></p></div></div></template>{{end}}
</div>
{{end}}
diff --git a/internal/equipo/templates/settings_nav.html b/internal/equipo/templates/settings_nav.html
index a3b922e9..02bae4f3 100644
--- a/internal/equipo/templates/settings_nav.html
+++ b/internal/equipo/templates/settings_nav.html
@@ -1,3 +1,4 @@
{{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}}
diff --git a/internal/headless/browser_conn_add_test.go b/internal/headless/browser_conn_add_test.go
new file mode 100644
index 00000000..66bf47a1
--- /dev/null
+++ b/internal/headless/browser_conn_add_test.go
@@ -0,0 +1,128 @@
+//go:build browser
+
+package headless
+
+import (
+ "strconv"
+ "testing"
+
+ "amadan.net/oficina/equipo/internal/browsertest"
+ "amadan.net/oficina/equipo/internal/thintest"
+ "amadan.net/oficina/equipo/internal/wire"
+ "github.com/chromedp/chromedp"
+)
+
+// addDay is where the Add page's screenshots go.
+const addDay = "2026-11-10"
+
+// Paul, 2026-11-10: "Can 'Add a connection' go to a new screen?" From
+// Connections, Add a connection opens its own page in Settings (on a
+// phone, Connections in its bar). The chooser is there; Codex's device
+// code card arrives in place from the stream, with no reload; once the
+// runner reports the connection healthy, the flourish plays and the page
+// goes back to Connections, the new row marked for a moment.
+func TestBrowserConnectionsAddPage(t *testing.T) {
+ for _, width := range []int64{1280, 390} {
+ t.Run(strconv.FormatInt(width, 10), func(t *testing.T) {
+ inst := thintest.StartInstance(t)
+ runner := dialFake(t, inst)
+ c := inst.Cookie()
+ p := openPage(t, inst.URL, c.Name, c.Value, width, 900, width > 600)
+ t.Cleanup(p.stop)
+ shot := func(name string) { t.Helper(); connShotOn(t, p, addDay, name, width) }
+ p.run(chromedp.Navigate(inst.URL+"/conversation/settings/connections"), browsertest.Wait(`!!document.querySelector('[data-connections]')`))
+ p.check(`(()=>{const a=document.querySelector('[data-add-link]');return !!a && a.checkVisibility() && a.textContent.trim()==='Add a connection' && !document.querySelector('[equipo-conn-chooser]')})()`, "Connections has no Add a connection link, or still holds the chooser")
+ p.check(`(()=>{document.querySelector('[data-add-link]').click();return true})()`, "Add a connection")
+ p.run(waitLong(`location.pathname==='/conversation/settings/connections/add' && !!document.querySelector('[equipo-conn-chooser]')`))
+ p.check(`(()=>{window.__equipoStayed=true;sessionStorage.removeItem('success');new MutationObserver(()=>{if(document.querySelector('[data-success]'))sessionStorage.setItem('success','1')}).observe(document.body,{childList:true,subtree:true});return true})()`, "mark")
+
+ // The page: its heading, the chooser with Claude and Codex
+ // live and three greyed, in Settings with Connections current.
+ p.check(`(()=>{const c=document.querySelector('[equipo-conn-chooser]');return document.querySelector('[equipo-settings-body] h1').textContent==='Add a connection' && c.checkVisibility() && !document.querySelector('[data-add="codex"]').disabled && !document.querySelector('[data-add="claude"]').disabled && c.querySelectorAll('[equipo-conn-opt][disabled]').length===3 && document.querySelector('[equipo-settings-link][aria-current="page"]').dataset.settingsLink==='connections' && document.documentElement.scrollWidth<=innerWidth+1})()`, "the Add page is not the chooser in Settings")
+ if width < 600 {
+ p.check(`(()=>{const back=document.querySelector('[rst-shell-back] a');return back.checkVisibility() && back.getAttribute('href')==='/conversation/settings/connections' && back.textContent.trim()==='Connections' && !document.querySelector('[equipo-settings-nav]').checkVisibility()})()`, "390: no way back to Connections in the bar")
+ } else {
+ p.check(`document.querySelector('[equipo-settings-rail]').checkVisibility() && document.querySelector('[equipo-settings-rail] [aria-current="page"]').dataset.railSettings==='connections-add'`, "1280: the rail is not the Settings nav with Add a connection current")
+ }
+ p.run(waitLong(`document.getAnimations().every(a=>a.playState!=='running'||a.effect&&a.effect.getTiming().iterations===Infinity)`))
+ shot("add-chooser")
+
+ // Codex: the card at once, then the device code from the stream.
+ p.check(`(()=>{document.querySelector('[data-add="codex"]').click();return !!document.querySelector('[data-connecting][data-provider="codex"]')})()`, "no card the instant Codex is chosen")
+ cmd := runner.expect(t, wire.FrameConnect).(*wire.ConnectCommand)
+ if cmd.Provider != "codex" {
+ t.Fatalf("connect frame %+v", cmd)
+ }
+ runner.send(t, wire.FrameConnection, wire.ConnectionReport{Connection: cmd.Connection, Person: thintest.Owner, Provider: "codex", State: wire.ConnConnecting, Prompt: &wire.ConnectPrompt{Kind: wire.PromptDeviceCode, URL: "https://auth.openai.com/codex/device", Code: "FAKE-2468"}})
+ p.run(waitLong(`!!document.querySelector('[data-device-code]')`))
+ p.check(`(()=>{const card=document.querySelector('[data-connecting][data-provider="codex"]');return card.querySelector('[data-code]').textContent==='FAKE-2468' && card.querySelectorAll('ol > li').length===3 && !!card.querySelector('[data-copy-link]') && !!card.querySelector('[equipo-conn-waiting]') && !document.querySelector('[equipo-conn-chooser]')})()`, "the device code card is not the three steps")
+ p.check(stayed, "the page reloaded or navigated while the code arrived")
+ shot("add-codex-code")
+
+ // Approved: the flourish here, then Connections with the row.
+ runner.send(t, wire.FrameConnection, wire.ConnectionReport{Connection: cmd.Connection, Person: thintest.Owner, LocalID: "codex-1", Provider: "codex", State: wire.ConnHealthy, Label: second, Plan: "pro"})
+ runner.hello(t, wire.HeldConnection{LocalID: "codex-1", Person: thintest.Owner, Provider: "codex", Kind: wire.KindSubscription, Label: second, State: wire.ConnHealthy, Plan: "pro"})
+ p.run(waitLong(`location.pathname==='/conversation/settings/connections' && !!document.querySelector('[equipo-conn-row][data-connection="` + cmd.Connection + `"][data-new]')`))
+ p.check(`(()=>{const row=document.querySelector('[equipo-conn-row][data-connection="`+cmd.Connection+`"]');const nav=performance.getEntriesByType('navigation')[0];return sessionStorage.getItem('success')==='1' && nav.type==='navigate' && location.search==='' && row.checkVisibility() && row.querySelector('[data-connection-state]').textContent==='Ready' && row.textContent.includes('`+second+`') && row.getAnimations().length>0})()`, "no flourish before Connections, or the new row is not marked")
+ shot("add-connected")
+ // The mark fades and does not come back with the stream.
+ p.run(waitLong(`!document.querySelector('[equipo-conn-row][data-new]')`))
+ })
+ }
+}
+
+// Paul, 2026-11-10: after an expired Claude sign-in, "The sign-in was
+// not finished in time." stayed under the list. It is a quiet notice
+// with Dismiss, and it goes by itself, live, once a newer attempt starts
+// or connects.
+func TestBrowserConnectionsEndedNote(t *testing.T) {
+ const note = `[...document.querySelectorAll('[data-connection-note]')].filter(n=>n.checkVisibility() && n.textContent==='The sign-in was not finished in time.')`
+ for _, width := range []int64{1280, 390} {
+ t.Run(strconv.FormatInt(width, 10), func(t *testing.T) {
+ inst := thintest.StartInstance(t)
+ runner := dialFake(t, inst)
+ client := thintest.NewClient(inst.URL, inst.DeviceToken(t))
+ c := inst.Cookie()
+ p := openPage(t, inst.URL, c.Name, c.Value, width, 900, width > 600)
+ t.Cleanup(p.stop)
+ ended := func(provider string) {
+ t.Helper()
+ a, err := client.Connect(t.Context(), wire.Connect{Provider: provider})
+ if err != nil {
+ t.Fatal(err)
+ }
+ runner.expect(t, wire.FrameConnect)
+ runner.send(t, wire.FrameConnection, wire.ConnectionReport{Connection: a.ID, Person: thintest.Owner, Provider: provider, State: wire.ConnError, Reason: "timed_out"})
+ }
+ ended("claude")
+ p.run(chromedp.Navigate(inst.URL+"/conversation/settings/connections"), browsertest.Wait(note+`.length===1`))
+ p.check(`(()=>{window.__equipoStayed=true;const b=document.querySelector('[data-connection-note] [data-dismiss]');return b.checkVisibility() && b.getAttribute('aria-label')==='Dismiss'})()`, "the notice has no Dismiss")
+ connShotOn(t, p, addDay, "ended-note", width)
+ // Dismissed: gone at once, and for good.
+ p.check(`(()=>{document.querySelector('[data-connection-note] [data-dismiss]').click();return `+note+`.length===0})()`, "Dismiss did not hide the notice")
+ p.run(waitLong(`!document.querySelector('[data-connection-note]')`))
+ p.check(stayed, "the page reloaded or navigated on Dismiss")
+
+ // A newer attempt that connects clears it, live.
+ ended("claude")
+ p.run(waitLong(note + `.length===1`))
+ a, err := client.Connect(t.Context(), wire.Connect{Provider: "codex"})
+ if err != nil {
+ t.Fatal(err)
+ }
+ runner.expect(t, wire.FrameConnect)
+ runner.send(t, wire.FrameConnection, wire.ConnectionReport{Connection: a.ID, Person: thintest.Owner, LocalID: "codex-1", Provider: "codex", State: wire.ConnHealthy, Label: second, Plan: "pro"})
+ p.run(waitLong(`!!document.querySelector('[equipo-conn-row][data-provider="codex"]') && ` + note + `.length===0`))
+ p.check(stayed, "the page reloaded or navigated")
+
+ // On the Add page, choosing a provider starts a newer attempt:
+ // the notice goes at once and stays gone.
+ ended("claude")
+ p.run(chromedp.Navigate(inst.URL+"/conversation/settings/connections/add"), browsertest.Wait(note+`.length===1`))
+ p.check(`(()=>{window.__equipoStayed=true;document.querySelector('[data-add="claude"]').click();return `+note+`.length===0})()`, "a new attempt left the notice")
+ runner.expect(t, wire.FrameConnect)
+ p.run(waitLong(`!!document.querySelector('[data-token-form]') && ` + note + `.length===0`))
+ p.check(stayed, "the page reloaded or navigated")
+ })
+ }
+}
diff --git a/internal/headless/browser_connections_test.go b/internal/headless/browser_connections_test.go
index 330373e4..aadf5612 100644
--- a/internal/headless/browser_connections_test.go
+++ b/internal/headless/browser_connections_test.go
@@ -89,34 +89,39 @@ func TestBrowserConnectionsAdd(t *testing.T) {
c := inst.Cookie()
p := openPage(t, inst.URL, c.Name, c.Value, width, 900, width > 600)
t.Cleanup(p.stop)
- p.run(chromedp.Navigate(inst.URL+"/conversation/connections"), browsertest.Wait(`!!document.querySelector('[data-connections]')`))
- p.check(`(()=>{window.__equipoStayed=true;return !!document.querySelector('[data-add-open]')})()`, "no Add a connection")
+ p.run(chromedp.Navigate(inst.URL+"/conversation/settings/connections/add"), browsertest.Wait(`!!document.querySelector('[data-connections]')`))
+ p.check(`(()=>{window.__equipoStayed=true;return true})()`, "mark")
p.check(`!document.querySelector('meta[http-equiv="refresh"]')`, "the page refreshes itself")
// The chooser: Claude and Codex live, three more greyed.
- p.check(`(()=>{document.querySelector('[data-add-open]').click();const c=document.querySelector('[equipo-conn-chooser]');return !!c && c.checkVisibility() && !document.querySelector('[data-add="codex"]').disabled && !document.querySelector('[data-add="claude"]').disabled && c.querySelectorAll('[equipo-conn-opt][disabled]').length===3})()`, "the chooser is not Claude and Codex with three greyed")
+ p.check(`(()=>{const c=document.querySelector('[equipo-conn-chooser]');return !!c && c.checkVisibility() && !document.querySelector('[data-add="codex"]').disabled && !document.querySelector('[data-add="claude"]').disabled && c.querySelectorAll('[equipo-conn-opt][disabled]').length===3})()`, "the chooser is not Claude and Codex with three greyed")
p.check(`(()=>{document.querySelector('[data-add="codex"]').click();return !!document.querySelector('[data-connecting][data-provider="codex"]')})()`, "no card the instant Codex is chosen")
p.run(browsertest.Wait(`!!document.querySelector('[data-device-code]')`))
p.check(`(()=>{const card=document.querySelector('[data-connecting][data-provider="codex"]');const code=card.querySelector('[data-code]').textContent;const open=card.querySelector('[data-open-provider]');return /^FAKE-/.test(code) && card.textContent.split(code).length===2 && open.getAttribute('href')==='https://auth.openai.com/codex/device' && open.target==='_blank' && !card.textContent.includes('auth.openai.com') && card.querySelectorAll('ol > li').length===3 && card.querySelector('h3').textContent==='Connect Codex'})()`, "the device code card is not the three steps with the code once")
connShot(t, p, "codex-code", width)
p.check(`(()=>{document.querySelector('[data-device-code] [data-copy]:not([data-copy-link])').click();return true})()`, "Copy")
p.run(browsertest.Wait(`document.querySelector('[data-device-code] [data-copy]:not([data-copy-link])').textContent==='Copied'`))
- // The approval lands with the success card, then the row.
- p.check(`(()=>{window.__success=false;new MutationObserver(()=>{if(document.querySelector('[data-success]'))window.__success=true}).observe(document.body,{childList:true,subtree:true});return true})()`, "observer")
+ // The approval lands with the success card, then Connections
+ // with the new row.
+ p.check(stayed, "the page reloaded or navigated while the code was shown")
writeJSON(t, filepath.Join(r.root, "accounts", ".fake-device.json"), map[string]any{"email": second, "plan": "pro"})
- p.run(waitLong(`window.__success && [...document.querySelectorAll('[equipo-conn-row][data-provider="codex"]')].some(e=>!e.hidden && e.querySelector('[data-connection-state]').textContent==='Ready' && e.textContent.includes('` + second + `')) && !document.querySelector('[data-device-code]') && !document.querySelector('[data-success]')`))
- p.check(stayed, "the page reloaded or navigated while the code was approved")
+ p.run(waitLong(`location.pathname==='/conversation/settings/connections' && [...document.querySelectorAll('[equipo-conn-row][data-provider="codex"]')].some(e=>!e.hidden && e.querySelector('[data-connection-state]').textContent==='Ready' && e.textContent.includes('` + second + `'))`))
connShot(t, p, "codex-connected", width)
// Prefer Codex: pressed at once, and still after the stream's refresh.
p.check(`(()=>{document.querySelector('[data-prefer="codex"]').click();return document.querySelector('[data-prefer="codex"]').getAttribute('aria-pressed')==='true'})()`, "Prefer Codex")
p.run(waitLong(`document.querySelector('[data-prefer="codex"]').getAttribute('aria-pressed')==='true' && !!document.querySelector('[equipo-conn-row][data-provider="codex"] [equipo-conn-pref]')`))
// Claude's sign-in on the runner, the chooser's quiet way in
// beside Paste a token.
- p.check(`(()=>{document.querySelector('[data-add-open]').click();document.querySelector('[data-add-area] [data-sign-in-instead]').click();return !!document.querySelector('[data-connecting][data-provider="claude"]')})()`, "no card the instant Claude's sign-in is chosen")
+ p.check(`(()=>{document.querySelector('[data-add-link]').click();return true})()`, "Add a connection")
+ p.run(waitLong(`location.pathname==='/conversation/settings/connections/add' && !!document.querySelector('[equipo-conn-chooser] [data-sign-in-instead]')`))
+ p.check(`(()=>{window.__equipoStayed=true;document.querySelector('[equipo-conn-chooser] [data-sign-in-instead]').click();return !!document.querySelector('[data-connecting][data-provider="claude"]')})()`, "no card the instant Claude's sign-in is chosen")
p.run(browsertest.Wait(`!!document.querySelector('[data-finish-on]')`))
p.check(`document.querySelector('[data-finish-on] [data-command]').textContent.includes('equipo-runner login claude') && document.querySelectorAll('[data-finish-on] > li').length===3 && !!document.querySelector('[data-finish-on] [data-copy]') && !!document.querySelector('[data-same-machine]') && !document.querySelector('[data-sign-in]') && !document.querySelector('input[type="password"],input[name="code"]')`, "the finish-on-runner card is not the only way shown, or it asks for a paste")
connShot(t, p, "claude-terminal", width)
p.check(`(()=>{document.querySelector('[data-connecting][data-provider="claude"] [data-connection-cancel]').click();return true})()`, "Cancel")
- p.run(waitLong(`!document.querySelector('[data-connecting]')`))
+ p.run(waitLong(`!document.querySelector('[data-connecting]') && !!document.querySelector('[equipo-conn-chooser]')`))
+ p.check(stayed, "the page reloaded or navigated")
+ p.run(chromedp.Navigate(inst.URL+"/conversation/settings/connections"), browsertest.Wait(`!!document.querySelector('[equipo-conn-row]')`))
+ p.check(`(()=>{window.__equipoStayed=true;return true})()`, "mark")
// Signed out: one clear Connect again in the row's action column,
// full width under the state line at 390, the usage under it.
p.check(`(()=>{document.querySelector('[equipo-conn-row][data-provider="codex"] [data-sign-out]').click();return true})()`, "Sign out")
diff --git a/internal/headless/browser_token_test.go b/internal/headless/browser_token_test.go
index 1450b8c7..8772752b 100644
--- a/internal/headless/browser_token_test.go
+++ b/internal/headless/browser_token_test.go
@@ -144,13 +144,13 @@ func TestBrowserConnectionsToken(t *testing.T) {
p := openPage(t, inst.URL, c.Name, c.Value, width, 900, width > 600)
t.Cleanup(p.stop)
shot := func(name string) { t.Helper(); connShotOn(t, p, tokenDay, name, width) }
- p.run(chromedp.Navigate(inst.URL+"/conversation/connections"), browsertest.Wait(`!!document.querySelector('[data-connections]') && !!window.EquipoSeal && !!window.nacl`))
+ p.run(chromedp.Navigate(inst.URL+"/conversation/settings/connections/add"), browsertest.Wait(`!!document.querySelector('[data-connections]') && !!window.EquipoSeal && !!window.nacl`))
p.check(`(()=>{window.__equipoStayed=true;return true})()`, "mark")
p.check(recordPosts, "record posts")
// The chooser: Claude is Paste a token, with the sign-in on
// the runner a quiet link under it.
- p.check(`(()=>{document.querySelector('[data-add-open]').click();const how=document.querySelector('[data-add="claude"] [data-paste-token]');const alt=document.querySelector('[equipo-conn-chooser] [data-sign-in-instead]');return !!how && how.textContent==='Paste a token' && how.checkVisibility() && !!alt && alt.textContent==='Or sign in on the runner instead' && alt.checkVisibility()})()`, "the chooser does not offer Paste a token with the quiet sign-in link")
+ p.check(`(()=>{const how=document.querySelector('[data-add="claude"] [data-paste-token]');const alt=document.querySelector('[equipo-conn-chooser] [data-sign-in-instead]');return !!how && how.textContent==='Paste a token' && how.checkVisibility() && !!alt && alt.textContent==='Or sign in on the runner instead' && alt.checkVisibility()})()`, "the chooser does not offer Paste a token with the quiet sign-in link")
shot("token-chooser")
p.check(`(()=>{document.querySelector('[data-add="claude"]').click();return !!document.querySelector('[data-connecting][data-provider="claude"]')})()`, "no card the instant Claude is chosen")
p.run(waitLong(`!!document.querySelector('[data-token-form]')`))
@@ -185,15 +185,16 @@ func TestBrowserConnectionsToken(t *testing.T) {
// The runner's healthy report: the flourish, then the row with
// the account and the token's expiry.
- p.check(`(()=>{window.__success=false;new MutationObserver(()=>{if(document.querySelector('[data-success]'))window.__success=true}).observe(document.body,{childList:true,subtree:true});return true})()`, "observer")
// Neither the token nor the CLI says when it expires: the date
// is an estimate, and the row says about.
expires := time.Now().UTC().Add(wire.TokenLifetime)
runner.send(t, wire.FrameConnection, wire.ConnectionReport{Connection: cmd.Connection, Person: thintest.Owner, LocalID: "claude-1", Provider: "claude", State: wire.ConnHealthy, Label: second})
runner.hello(t, wire.HeldConnection{LocalID: "claude-1", Person: thintest.Owner, Provider: "claude", Kind: wire.KindToken, Label: second, State: wire.ConnHealthy, ExpiresAt: &expires, ExpiresEstimated: true})
want := "Expires about " + expires.Format("2 Jan 2006")
- p.run(waitLong(`window.__success && !document.querySelector('[data-success]') && [...document.querySelectorAll('[equipo-conn-row][data-provider="claude"]')].some(e=>!e.hidden && e.textContent.includes('` + second + `') && e.querySelector('[data-token-expires]')?.textContent==='` + want + `') && !document.querySelector('[data-token-renew]')`))
+ p.check(stayed, "the page reloaded or navigated before the token connected")
+ p.run(waitLong(`location.pathname==='/conversation/settings/connections' && [...document.querySelectorAll('[equipo-conn-row][data-provider="claude"]')].some(e=>!e.hidden && e.textContent.includes('` + second + `') && e.querySelector('[data-token-expires]')?.textContent==='` + want + `') && !document.querySelector('[data-token-renew]')`))
shot("token-connected")
+ p.check(`(()=>{window.__equipoStayed=true;return true})()`, "mark")
// Within six weeks of the estimated expiry: a quiet line asks
// for a new one.
@@ -206,13 +207,13 @@ func TestBrowserConnectionsToken(t *testing.T) {
runner.hello(t, wire.HeldConnection{LocalID: "claude-1", Person: thintest.Owner, Provider: "claude", Kind: wire.KindToken, Label: second, State: wire.ConnSignInAgain, ExpiresAt: &soon, ExpiresEstimated: true})
p.run(waitLong(`(()=>{const row=document.querySelector('[equipo-conn-row][data-provider="claude"][data-state="sign_in_again"]');return !!row && row.querySelector('[data-connection-state]').textContent==='This token was rejected. Run claude setup-token again.' && row.querySelector('[data-recover]').textContent==='Sign in again'})()`))
shot("token-rejected")
- // Sign in again is a new token attempt.
+ p.check(stayed, "the page reloaded or navigated")
+ // Sign in again is a new token attempt, on the Add page.
p.check(`(()=>{document.querySelector('[equipo-conn-row][data-state="sign_in_again"] [data-recover]').click();return true})()`, "Sign in again")
- p.run(waitLong(`!!document.querySelector('[data-token-form]')`))
+ p.run(waitLong(`location.pathname==='/conversation/settings/connections/add' && !!document.querySelector('[data-token-form]')`))
if cmd := runner.expect(t, wire.FrameConnect).(*wire.ConnectCommand); cmd.Kind != wire.KindToken {
t.Fatalf("Sign in again started %+v", cmd)
}
- p.check(stayed, "the page reloaded or navigated")
})
}
}
@@ -230,7 +231,7 @@ func TestBrowserConnectionsCopyLink(t *testing.T) {
c := inst.Cookie()
p := openPage(t, inst.URL, c.Name, c.Value, width, 900, width > 600)
t.Cleanup(p.stop)
- p.run(chromedp.Navigate(inst.URL+"/conversation/connections"), browsertest.Wait(`!!document.querySelector('[data-connections]')`))
+ p.run(chromedp.Navigate(inst.URL+"/conversation/settings/connections/add"), browsertest.Wait(`!!document.querySelector('[data-connections]')`))
p.check(`(()=>{window.__equipoStayed=true;window.__copied=[];navigator.clipboard.writeText=t=>{window.__copied.push(t);return Promise.resolve()};return true})()`, "clipboard")
const device = "https://auth.openai.com/codex/device"
codex, err := client.Connect(t.Context(), wire.Connect{Provider: "codex"})
diff --git a/internal/headless/connections_test.go b/internal/headless/connections_test.go
index b7acf3fe..9be3cdd7 100644
--- a/internal/headless/connections_test.go
+++ b/internal/headless/connections_test.go
@@ -229,7 +229,7 @@ func connCodexDeviceCode(t *testing.T, env *Env, inst *thintest.Instance, r *loc
if code.Prompt.URL != "https://auth.openai.com/codex/device" || !strings.HasPrefix(code.Prompt.Code, "FAKE-") {
t.Fatalf("prompt %+v", code.Prompt)
}
- page := inst.Get(t, "/conversation/connections")
+ page := inst.Get(t, "/conversation/settings/connections/add")
if !strings.Contains(page, "data-device-code") || strings.Count(page, ">"+code.Prompt.Code+"<") != 1 || !strings.Contains(page, `href="`+code.Prompt.URL+`"`) {
t.Fatal("the device code is not on the page once, or OpenAI's page is not its link")
}
@@ -322,7 +322,7 @@ func connClaudeSignIn(t *testing.T, env *Env, inst *thintest.Instance, r *localR
if err != nil || c2.Prompt == nil || c2.Prompt.Kind != wire.PromptTerminal {
t.Fatalf("terminal card %+v %v", c2, err)
}
- page := inst.Get(t, "/conversation/connections")
+ page := inst.Get(t, "/conversation/settings/connections/add")
if !strings.Contains(page, "data-finish-on") || !strings.Contains(page, "equipo-runner login claude") || !strings.Contains(page, "data-same-machine") {
t.Fatal("terminal card not on the page")
}
diff --git a/internal/thintest/connections_add_pages_test.go b/internal/thintest/connections_add_pages_test.go
new file mode 100644
index 00000000..e9bf4d86
--- /dev/null
+++ b/internal/thintest/connections_add_pages_test.go
@@ -0,0 +1,91 @@
+package thintest
+
+import (
+ "net/http"
+ "net/url"
+ "strings"
+ "testing"
+
+ "amadan.net/oficina/equipo/internal/wire"
+)
+
+// TestPagesConnectionsAdd: Paul, 2026-11-10: "Can 'Add a connection' go
+// to a new screen?" Connections links to its own Add page, a Settings
+// page with Connections current and, on a phone, Connections in its bar;
+// the page is the chooser (Claude and Codex, three greyed) and then the
+// attempt's card. Without scripts the forms still work: an Add posts and
+// comes back to the Add page, its Check again leads back to Connections
+// once the attempt connected, with the new row marked.
+func TestPagesConnectionsAdd(t *testing.T) {
+ r := &toolRig{rig: newRig(t)}
+ owner := r.inst.Cookie()
+ runner := r.dial(0)
+ r.wait("runner online", func(c *Conversation) bool { return c.Runner.Online })
+
+ list := r.get(owner, "/conversation/settings/connections", 200)
+ if !strings.Contains(list, `href="/conversation/settings/connections/add" equipo-conn-add data-add-link`) || strings.Contains(list, "equipo-conn-chooser") {
+ t.Fatal("Connections does not link to the Add page, or still holds the chooser")
+ }
+ add := r.get(owner, "/conversation/settings/connections/add", 200)
+ for _, want := range []string{`data-settings-link="connections" aria-current="page"`, `href="/conversation/settings/connections" rel="up" aria-label="Connections"`, "<title>Add a connection</title>", `data-add="claude"`, `data-add="codex"`, "data-sign-in-instead", "data-adding"} {
+ if !strings.Contains(add, want) {
+ t.Fatalf("the Add page lacks %s", want)
+ }
+ }
+ if n := strings.Count(add, "equipo-conn-opt disabled"); n != 3 {
+ t.Fatalf("%d greyed choices, want 3", n)
+ }
+
+ // Scriptless: Add Codex posts and comes back to the Add page.
+ if status, loc := r.post(owner, "/conversation/connections", url.Values{"provider": {"codex"}}); status != http.StatusSeeOther || loc != "/conversation/settings/connections/add" {
+ t.Fatalf("Add posted: %d to %q", status, loc)
+ }
+ f, body, err := runner.Expect(r.ctx, wire.FrameConnect)
+ if err != nil {
+ t.Fatal(err)
+ }
+ id := body.(*wire.ConnectCommand).Connection
+ if err = runner.Send(r.ctx, "a-c", wire.FrameAck, wire.Ack{ID: f.ID}); err != nil {
+ t.Fatal(err)
+ }
+ if err = runner.Send(r.ctx, "r-1", wire.FrameConnection, wire.ConnectionReport{Connection: id, Person: Owner, Provider: "codex", State: wire.ConnConnecting, Prompt: &wire.ConnectPrompt{Kind: wire.PromptDeviceCode, URL: "https://auth.openai.com/codex/device", Code: "ABCD-1234"}}); err != nil {
+ t.Fatal(err)
+ }
+ r.wait("device code", func(c *Conversation) bool { p := c.Connections[id].Prompt; return p != nil && p.Code == "ABCD-1234" })
+ add = r.get(owner, "/conversation/settings/connections/add", 200)
+ if !strings.Contains(add, "data-device-code") || !strings.Contains(add, `href="/conversation/settings/connections/add?attempt=`+id+`"`) || strings.Contains(add, "equipo-conn-chooser") {
+ t.Fatal("the Add page does not show the attempt's card with its scriptless Check again")
+ }
+ if strings.Contains(r.get(owner, "/conversation/settings/connections", 200), "data-device-code") {
+ t.Fatal("the attempt's card is on Connections too")
+ }
+ // Connecting: Check again stays; connected: back to Connections.
+ noFollow := &http.Client{CheckRedirect: func(*http.Request, []*http.Request) error { return http.ErrUseLastResponse }}
+ check := func() (int, string) {
+ req, _ := http.NewRequest("GET", r.inst.URL+"/conversation/settings/connections/add?attempt="+id, nil)
+ req.AddCookie(owner)
+ res, err := noFollow.Do(req)
+ if err != nil {
+ t.Fatal(err)
+ }
+ res.Body.Close()
+ return res.StatusCode, res.Header.Get("Location")
+ }
+ if status, _ := check(); status != 200 {
+ t.Fatalf("Check again while connecting: %d", status)
+ }
+ if err = runner.Send(r.ctx, "r-2", wire.FrameConnection, wire.ConnectionReport{Connection: id, Person: Owner, LocalID: "codex-1", Provider: "codex", State: wire.ConnHealthy, Label: Owner, Plan: "pro"}); err != nil {
+ t.Fatal(err)
+ }
+ r.wait("connected", func(c *Conversation) bool { return c.Connections[id].State == wire.ConnHealthy })
+ if status, loc := check(); status != http.StatusSeeOther || loc != "/conversation/settings/connections?added="+id {
+ t.Fatalf("Check again once connected: %d to %q", status, loc)
+ }
+ page := r.get(owner, "/conversation/settings/connections?added="+id, 200)
+ if !strings.Contains(page, `data-connection="`+id+`" data-provider="codex" data-state="healthy" data-new>`) {
+ t.Fatal("the new row is not marked")
+ }
+ if strings.Contains(r.get(owner, "/conversation/settings/connections", 200), "data-new") {
+ t.Fatal("a row is marked without ?added")
+ }
+}
diff --git a/internal/thintest/inline_style_test.go b/internal/thintest/inline_style_test.go
index 0b5fc784..b38448b0 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/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/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/settings_browser_test.go b/internal/thintest/settings_browser_test.go
index 186685de..3d87543c 100644
--- a/internal/thintest/settings_browser_test.go
+++ b/internal/thintest/settings_browser_test.go
@@ -100,14 +100,15 @@ func TestBrowserSettingsMenu(t *testing.T) {
// Desktop.
p := openInner(t, r.inst.URL, r.inst.Cookie(), 1280, 900, false, scheme, "no-preference")
p.open("/conversation/settings/thinking")
- p.check(`(()=>{const n=document.querySelector('[equipo-settings-nav]').getBoundingClientRect(),b=document.querySelector('[equipo-settings-body]').getBoundingClientRect(),rail=document.querySelector('[rst-shell-rail]').getBoundingClientRect();return n.width>150&&n.right<=b.left&&Math.abs(n.top-b.top)<40&&rail.width>150&&rail.right<=n.left})()`, scheme+" 1280: the menu is not a second sidebar beside the section")
- p.check(`(()=>{const c=document.querySelector('[equipo-settings-link][aria-current="page"]'),o=document.querySelector('[equipo-settings-link]:not([aria-current])');return c.dataset.settingsLink==='thinking'&&getComputedStyle(c).backgroundColor!==getComputedStyle(o).backgroundColor&&getComputedStyle(c.querySelector('.icon:last-child')).display==='none'})()`, scheme+" 1280: the current section is not marked")
- p.check(`document.querySelector('#rail a[href="/conversation/settings"]').getAttribute('aria-current')==='page'`, scheme+" 1280: the rail does not show Settings")
+ // Two columns (Paul, 2026-11-10): the rail is the Settings nav.
+ p.check(`(()=>{const n=document.querySelector('[equipo-settings-rail]').getBoundingClientRect(),b=document.querySelector('[equipo-settings-body]').getBoundingClientRect();return n.width>150&&n.right<=b.left&&!document.querySelector('#rail').checkVisibility()&&!document.querySelector('[equipo-settings-nav]').checkVisibility()})()`, scheme+" 1280: the rail is not the Settings nav beside the section")
+ p.check(`(()=>{const c=document.querySelector('[equipo-settings-rail] [aria-current="page"]'),o=document.querySelector('[equipo-settings-rail] [data-rail-settings]:not([aria-current])');return c.dataset.railSettings==='thinking'&&getComputedStyle(c).backgroundColor!==getComputedStyle(o).backgroundColor})()`, scheme+" 1280: the current section is not marked")
+ p.check(`document.querySelector('[data-settings-leave]').checkVisibility()`, scheme+" 1280: no way back to Equipo")
p.wait(`document.getAnimations().every(a=>a.playState!=='running'||a.effect&&a.effect.getTiming().iterations===Infinity)`, "the slide settled")
p.shot("settings-menu-1280-" + scheme)
- p.click(`[data-settings-link="housekeeping"]`)
- p.wait(`location.pathname==='/conversation/settings/housekeeping' && document.querySelector('[equipo-settings-link][aria-current="page"]').dataset.settingsLink==='housekeeping' && !!document.querySelector('[data-hk-settings]')`, "Housekeeping from the menu")
- p.click(`[data-settings-link="connections"]`)
+ p.click(`[data-rail-settings="housekeeping"]`)
+ p.wait(`location.pathname==='/conversation/settings/housekeeping' && document.querySelector('[equipo-settings-rail] [aria-current="page"]').dataset.railSettings==='housekeeping' && !!document.querySelector('[data-hk-settings]')`, "Housekeeping from the menu")
+ p.click(`[data-rail-settings="connections"]`)
p.wait(`location.pathname==='/conversation/settings/connections' && !!document.querySelector('[equipo-settings-layout] [data-connections]')`, "Connections from the menu")
p.wait(`document.getAnimations().every(a=>a.playState!=='running'||a.effect&&a.effect.getTiming().iterations===Infinity)`, "the slide settled")
p.shot("settings-connections-1280-" + scheme)
@@ -132,3 +133,56 @@ func TestBrowserSettingsMenu(t *testing.T) {
q.stop()
}
}
+
+// TestBrowserSettingsRail: Paul, 2026-11-10: "The settings nav should
+// probably replace the main nav on this view, right?" At 1280 Settings
+// is two columns: the rail itself turns into the Settings nav ("‹
+// Equipo", the sections, Add a connection under Connections) with a
+// short slide as the person crosses in, and none between sections; "‹
+// Equipo" goes back to where they were, the main nav sliding back. The
+// rail does not move or resize. Under reduced motion nothing slides. At
+// 390 the drill-in stays: no Settings nav in the rail, the way back to
+// Settings in the bar.
+func TestBrowserSettingsRail(t *testing.T) {
+ r := newToolRig(t)
+ const settled = `document.getAnimations().every(a=>a.playState!=='running'||a.effect&&a.effect.getTiming().iterations===Infinity)`
+ const sliding = `(n=>!!n && n.hasAttribute('data-arriving') && n.getAnimations().length>0)`
+ p := openInner(t, r.inst.URL, r.inst.Cookie(), 1280, 900, false, "light", "no-preference")
+ p.open("/tasks")
+ p.check(`(()=>{sessionStorage.setItem('rail',JSON.stringify(document.querySelector('[rst-shell-rail]').getBoundingClientRect()));return document.querySelector('#rail').checkVisibility() && !document.querySelector('[equipo-settings-rail]')})()`, "1280: the main nav is not the rail outside Settings")
+ p.click(`#rail a[href="/conversation/settings"]`)
+ p.wait(`location.pathname==='/conversation/settings' && `+sliding+`(document.querySelector('[equipo-settings-rail]'))`, "the Settings nav slides in")
+ p.check(`(()=>{const was=JSON.parse(sessionStorage.getItem('rail')),now=document.querySelector('[rst-shell-rail]').getBoundingClientRect();const n=document.querySelector('[equipo-settings-rail]');const links=[...n.querySelectorAll('a')].map(a=>a.dataset.railSettings||'leave');return Math.abs(was.left-now.left)<1&&Math.abs(was.width-now.width)<1&&!document.querySelector('#rail').checkVisibility()&&links.join()==='leave,thinking,connections,connections-add,housekeeping,notebook,teams'&&n.querySelector('[data-settings-leave]').textContent.trim()==='Equipo'&&n.querySelector('[data-settings-leave]').getAttribute('href')==='/tasks'})()`, "1280: the rail moved, or is not ‹ Equipo and the sections, or ‹ Equipo does not lead back to Tasks")
+ p.check(`(()=>{const n=document.querySelector('[equipo-settings-rail]').getBoundingClientRect(),b=document.querySelector('[equipo-settings-body]').getBoundingClientRect();return n.right<=b.left&&b.left-n.right<120&&!document.querySelector('[equipo-settings-nav]').checkVisibility()})()`, "1280: Settings is not two columns")
+ p.wait(settled, "the slide settled")
+ p.shot("settings-rail-1280")
+ // Between sections nothing slides.
+ p.click(`[data-rail-settings="connections-add"]`)
+ p.wait(`location.pathname==='/conversation/settings/connections/add'`, "Add a connection from the rail")
+ p.check(`!document.querySelector('[data-arriving]') && document.querySelector('[equipo-settings-rail] [aria-current="page"]').dataset.railSettings==='connections-add'`, "1280: moving between sections slid, or Add a connection is not current")
+ p.shot("settings-rail-add-1280")
+ // ‹ Equipo: back to Tasks, the main nav sliding back.
+ p.click(`[data-settings-leave]`)
+ p.wait(`location.pathname==='/tasks' && `+sliding+`(document.querySelector('#rail'))`, "the main nav slides back")
+ p.stop()
+
+ // Reduced motion: the same swap, nothing slides.
+ q := openInner(t, r.inst.URL, r.inst.Cookie(), 1280, 900, false, "light", "reduce")
+ q.open("/conversation")
+ q.click(`#rail a[href="/conversation/settings"]`)
+ q.wait(`location.pathname==='/conversation/settings' && document.querySelector('[equipo-settings-rail]').checkVisibility()`, "Settings")
+ q.check(`document.querySelector('[equipo-settings-rail]').getAnimations().length===0 && document.querySelector('[data-settings-leave]').getAttribute('href')==='/conversation'`, "1280 reduced motion: the rail slid, or ‹ Equipo does not lead back")
+ q.stop()
+
+ // The phone keeps its drill-in.
+ m := openInner(t, r.inst.URL, r.inst.Cookie(), 390, 844, true, "light", "no-preference")
+ for _, path := range []string{"/conversation/settings", "/conversation/settings/connections", "/conversation/settings/connections/add"} {
+ m.open(path)
+ m.check(`!document.querySelector('[equipo-settings-rail]').checkVisibility() && document.documentElement.scrollWidth<=390`, "390: the Settings nav shows in the rail at "+path)
+ }
+ m.open("/conversation/settings")
+ m.check(`document.querySelector('[equipo-settings-nav]').checkVisibility()`, "390: the Settings menu is not the page")
+ m.wait(settled, "the slide settled")
+ m.shot("settings-rail-390")
+ m.stop()
+}
diff --git a/internal/thintest/settings_rail_pages_test.go b/internal/thintest/settings_rail_pages_test.go
new file mode 100644
index 00000000..eee89860
--- /dev/null
+++ b/internal/thintest/settings_rail_pages_test.go
@@ -0,0 +1,84 @@
+package thintest
+
+import (
+ "io"
+ "net/http"
+ "strings"
+ "testing"
+)
+
+// TestPagesSettingsRail: Paul, 2026-11-10: "The settings nav should
+// probably replace the main nav on this view, right?" Every Settings page
+// carries the Settings nav in the rail itself: "‹ Equipo" first (to the
+// Conversation without scripts), then the sections, Add a connection
+// under Connections, the current one marked. The rail marks its nav as
+// arriving only when the person crossed into or out of Settings.
+func TestPagesSettingsRail(t *testing.T) {
+ r := &toolRig{rig: newRig(t)}
+ owner := r.inst.Cookie()
+ get := func(path, referer string) string {
+ t.Helper()
+ req, _ := http.NewRequest("GET", r.inst.URL+path, nil)
+ req.AddCookie(owner)
+ if referer != "" {
+ req.Header.Set("Referer", r.inst.URL+referer)
+ }
+ res, err := http.DefaultClient.Do(req)
+ if err != nil {
+ t.Fatal(err)
+ }
+ defer res.Body.Close()
+ raw, _ := io.ReadAll(res.Body)
+ if res.StatusCode != 200 {
+ t.Fatalf("GET %s: %d", path, res.StatusCode)
+ }
+ return string(raw)
+ }
+ rail := func(page string) string {
+ _, after, ok := strings.Cut(page, "<nav rst-shell-nav equipo-settings-rail")
+ if !ok {
+ return ""
+ }
+ nav, _, _ := strings.Cut(after, "</nav>")
+ return nav
+ }
+ for path, current := range map[string]string{
+ "/conversation/settings/thinking": "thinking",
+ "/conversation/settings/connections": "connections",
+ "/conversation/settings/connections/add": "connections-add",
+ "/conversation/settings/housekeeping": "housekeeping",
+ "/conversation/settings/notebook": "notebook",
+ } {
+ nav := rail(get(path, ""))
+ 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"`} {
+ if !strings.Contains(nav, want) {
+ t.Fatalf("%s: the rail's Settings nav lacks %s", path, want)
+ }
+ }
+ if strings.Count(nav, `aria-current="page"`) != 1 || !strings.Contains(nav, `data-rail-settings="`+current+`" aria-current="page"`) {
+ t.Fatalf("%s: %s is not the one current entry", path, current)
+ }
+ if strings.Index(nav, "data-settings-leave") > strings.Index(nav, "data-rail-settings") {
+ t.Fatalf("%s: Equipo is not first", path)
+ }
+ }
+ if rail(get("/conversation", "")) != "" {
+ t.Fatal("the Settings nav is in the rail outside Settings")
+ }
+ // Arriving: only across the boundary, and only the nav that is new.
+ if !strings.Contains(get("/conversation/settings/thinking", "/conversation"), "equipo-settings-rail data-arriving") {
+ t.Fatal("entering Settings does not mark its nav arriving")
+ }
+ if strings.Contains(get("/conversation/settings/connections", "/conversation/settings/thinking"), "data-arriving") {
+ t.Fatal("moving between sections marks a nav arriving")
+ }
+ if !strings.Contains(get("/conversation", "/conversation/settings/thinking"), `id="rail" data-arriving`) {
+ t.Fatal("leaving Settings does not mark the main nav arriving")
+ }
+ if strings.Contains(get("/tasks", "/conversation"), "data-arriving") {
+ t.Fatal("an ordinary page marks its nav arriving")
+ }
+}