oficina / equipo Public

Connections: Add a connection on its own page

Paul, 2026-11-10: "Can 'Add a connection' go to a new screen?"

/conversation/settings/connections/add is a Settings page (Connections
current; on a phone, Connections in its bar) with the chooser: Claude
(paste a token, or sign in on the runner), Codex (device code) and three
greyed. Each flow's card runs there, live from the stream with no
reload. Once the attempt connects the flourish plays and the page goes
back to Connections, the new row marked briefly (a still tint under
reduced motion). Connections keeps an Add a connection link; a row's
Sign in again or Paste a new token posts to the Add page. Without
scripts every Add posts and returns to the Add page, whose Check again
leads back to Connections once connected.

Tests: TestPagesConnectionsAdd (scriptless flow, marked row) and
TestBrowserConnectionsAddPage at 1280 and 390, with screenshots in
docs/mockups/built/2026-11-10/; existing connection browser tests follow
the flow to the new page. The equipo source budget rises by 100 lines,
with its reason.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paul Campbell pushed by claude agent, operated by paul@keymail.dev 553eff97b83b8452fb2747c4708d5d87354e69c9 parent 461ce02
38 files changed, +297 −85
  • .rastrillo/budgets.txt +1 −1
  • 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-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
  • internal/equipo/app.go +1 −0
  • internal/equipo/chat_connections.go +33 −2
  • internal/equipo/connections_view.go +2 −0
  • internal/equipo/static/connections.js +40 −35
  • internal/equipo/static/equipo.css +11 −8
  • internal/equipo/templates/chat.html +1 −1
  • internal/equipo/templates/models.html +19 −18
  • internal/headless/browser_conn_add_test.go +72 −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
diff --git a/.rastrillo/budgets.txt b/.rastrillo/budgets.txt
index ba6dd3f6..4b0ce67b 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.
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..20589fc0
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..dd6a013d
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..7e77def3
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..ef167ddc
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..d4646d65
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..350ad816
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..d161e910 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..214d93fc 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..9e609d58 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..26a18fbf 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-token-bad-1280.png b/docs/mockups/built/2026-11-10/conn-token-bad-1280.png
index c8af8a28..65be9c5e 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..55f09ad1 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..4a632c3c 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..6641bf8e 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..68451735 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..8a54faa2 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..cf29e293 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..51b3cab8 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..ac45c345 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..0cc9bfaa 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..07a09b8f 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..a3aabf31 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..8a2a3c25 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..2bf440ba 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/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 76b7734c..fb1bd34b 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")
@@ -196,6 +223,10 @@ func (a *application) connectionsView(w http.ResponseWriter, r *http.Request) {
return
}
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 {
@@ -304,7 +335,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 c92167ef..2b032ff7 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.
diff --git a/internal/equipo/static/connections.js b/internal/equipo/static/connections.js
index ff293b4e..b178d8ae 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,10 +222,12 @@
}
// 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; }
if (form.matches("[data-add-form]")) {
@@ -265,10 +269,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..4f60c74b 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; }
@@ -794,12 +797,11 @@ a[equipo-source]:hover { color: var(--rst-text); text-decoration: underline; tex
[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] > 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-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); }
@@ -894,11 +896,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. */
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/models.html b/internal/equipo/templates/models.html
index b1f8eb20..daea6f4c 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,9 @@
<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-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 +73,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}}<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"}}{{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>
+<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>
+{{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/headless/browser_conn_add_test.go b/internal/headless/browser_conn_add_test.go
new file mode 100644
index 00000000..87919247
--- /dev/null
+++ b/internal/headless/browser_conn_add_test.go
@@ -0,0 +1,72 @@
+//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-nav]').checkVisibility()`, "1280: the Settings menu is not beside the page")
+ }
+ 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]')`))
+ })
+ }
+}
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)