Merge thin-v1-ux1 99b19e8; Housekeeping in the Settings page
UX1's Settings page (/conversation/settings) with its Housekeeping placeholder: the section now holds the way to the activity view, Pause and quiet hours in the page's row style; the old section at the end of /settings is gone, and Pause, quiet hours and the view's link return to /conversation/settings#housekeeping. Conflicts: the page list and the head scripts take both; CSS keeps both. Labels in the quiet-hours row no longer wrap at 390.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
32 files changed,
+405
−70
docs/mockups/built/2026-11-08/ux1-after-index-profile-390.pngbinarydocs/mockups/built/2026-11-08/ux1-after-settings-390.pngbinarydocs/mockups/built/2026-11-08/ux1-before-index-profile-390.pngbinarydocs/superpowers/plans/CONTROLLER-REPORT-plan-3.md+10 −0docs/superpowers/plans/HK1-PROGRESS.md+3 −4docs/superpowers/plans/UX1-PROGRESS.md+25 −0internal/equipo/app.go+1 −0internal/equipo/chat_connections.go+5 −1internal/equipo/connections_view.go+18 −11internal/equipo/copy.go+10 −0internal/equipo/handlers.go+1 −5internal/equipo/housekeeping_page.go+2 −2internal/equipo/rail.go+1 −0internal/equipo/render.go+1 −1internal/equipo/settings_hub.go+51 −0internal/equipo/static/chat-stream.js+51 −10internal/equipo/static/equipo.css+30 −0internal/equipo/static/thinking-preview.js+6 −1internal/equipo/templates/chrome.html+3 −3internal/equipo/templates/housekeeping.html+1 −1internal/equipo/templates/housekeeping_settings.html+4 −6internal/equipo/templates/settings.html+0 −1internal/equipo/templates/settings_hub.html+20 −0internal/equipo/templates/thinking_words.html+1 −13internal/equipo/templates/work_parts.html+13 −0internal/equipo/thinking_words.go+5 −1internal/equipotest/pages_test.go+2 −2internal/thintest/housekeeping_browser_test.go+3 −3internal/thintest/housekeeping_contract_test.go+4 −1internal/thintest/index_browser_test.go+43 −0internal/thintest/pages_test.go+2 −2internal/thintest/thinking_browser_test.go+89 −2
CI passed — run details
Intent
diff --git a/docs/mockups/built/2026-11-08/ux1-after-index-profile-390.png b/docs/mockups/built/2026-11-08/ux1-after-index-profile-390.png| new file mode 100644 |
| index 00000000..698eca6e |
| Binary files /dev/null and b/docs/mockups/built/2026-11-08/ux1-after-index-profile-390.png differ |
diff --git a/docs/mockups/built/2026-11-08/ux1-after-settings-390.png b/docs/mockups/built/2026-11-08/ux1-after-settings-390.png| new file mode 100644 |
| index 00000000..d433b5e7 |
| Binary files /dev/null and b/docs/mockups/built/2026-11-08/ux1-after-settings-390.png differ |
diff --git a/docs/mockups/built/2026-11-08/ux1-before-index-profile-390.png b/docs/mockups/built/2026-11-08/ux1-before-index-profile-390.png| new file mode 100644 |
| index 00000000..7868f864 |
| Binary files /dev/null and b/docs/mockups/built/2026-11-08/ux1-before-index-profile-390.png differ |
diff --git a/docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md b/docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md| index 84b3ace4..bb4ef4d2 100644 |
| --- a/docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md |
| +++ b/docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md |
| @@ -4926,6 +4926,16 @@ records remain unchanged. |
| | `thinking.preview` | Preview | Thin v1 UX1 thinking words (settings, thinking line) | Runtime; Paul tweaks the sets; COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) | |
| | `thinking.use` | Use these words | Thin v1 UX1 thinking words (settings, thinking line) | Runtime; Paul tweaks the sets; COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) | |
| | `thinking.saved` | Saved. Your next message uses them. | Thin v1 UX1 thinking words (settings, thinking line) | Runtime; Paul tweaks the sets; COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) | |
| +| `settings.connections` | Connections | Thin v1 UX1 Settings section | Runtime; COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) | |
| +| `settings.connections_open` | Your connections | Thin v1 UX1 Settings section | Runtime; COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) | |
| +| `settings.connections_about` | The accounts Equipo works with, and which it prefers. | Thin v1 UX1 Settings section | Runtime; COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) | |
| +| `settings.housekeeping` | Housekeeping | Thin v1 UX1 Settings section | Runtime; COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) | |
| +| `settings.housekeeping_about` | Tidying old tasks and kept sessions. Coming soon. | Thin v1 UX1 Settings section | Runtime; COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) | |
| +| `settings.notebook` | Notebook and teams | Thin v1 UX1 Settings section | Runtime; COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) | |
| +| `settings.notebook_open` | Notebook | Thin v1 UX1 Settings section | Runtime; COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) | |
| +| `settings.notebook_about` | What your coordinator has noted. Reset starts it afresh. | Thin v1 UX1 Settings section | Runtime; COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) | |
| +| `settings.teams_open` | Teams | Thin v1 UX1 Settings section | Runtime; COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) | |
| +| `settings.teams_about` | Switch to another team or start a new one. | Thin v1 UX1 Settings section | Runtime; COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) | |
| | `nav.checks` | Checks | Thin v1 UX1 inner screens (Tasks, task, Projects, project, Needs you, sidebar) | Runtime; COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) | |
| | `nav.attempt` | attempt %d | Thin v1 UX1 inner screens (Tasks, task, Projects, project, Needs you, sidebar) | Runtime; COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) | |
| | `nav.now` | now | Thin v1 UX1 inner screens (Tasks, task, Projects, project, Needs you, sidebar) | Runtime; COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) | |
diff --git a/docs/superpowers/plans/HK1-PROGRESS.md b/docs/superpowers/plans/HK1-PROGRESS.md| index 21368422..14675284 100644 |
| --- a/docs/superpowers/plans/HK1-PROGRESS.md |
| +++ b/docs/superpowers/plans/HK1-PROGRESS.md |
| @@ -132,8 +132,9 @@ suggestions (the Suggestions lane is not drawn). Conventions as in |
| Resume, quiet hours (on, from, until in whole hours, UTC until a zone |
| is known) and "See what Equipo did"; posts to |
| `/settings/housekeeping/pause` and `/settings/housekeeping/quiet`. It |
| - stands at the end of today's `/settings` until UX1's Settings page |
| - lands, then moves into its Housekeeping section. Quiet hours are per |
| + stands in the Housekeeping section of UX1's Settings page |
| + (`/conversation/settings#housekeeping`, merged at 99b19e8), in its |
| + row style; the old section at the end of `/settings` is gone. Quiet hours are per |
| person now (`chat_housekeeping_settings.quiet_from`, `quiet_until`, |
| null for 22:00 to 08:00, equal for none; `Housekeeping.quiet`, |
| `SetHousekeeping.quiet`, fixture `housekeeping-quiet-request.json`); |
| @@ -237,8 +238,6 @@ suggestions (the Suggestions lane is not drawn). Conventions as in |
| recorded `separate` (kept apart), so the combine acts on pairs filed |
| before Equipo looked or after an Undo's pair is forgotten; the headless |
| bwrap form of H1 is not built. |
| -- Settings' section is on today's `/settings` page until UX1's Settings |
| - page is merged. |
| - Person's zone is UTC everywhere (quiet hours, the day, 03:00, 08:00). |
| - Version skew as before: an old runner is unaffected (no new frames). |
diff --git a/docs/superpowers/plans/UX1-PROGRESS.md b/docs/superpowers/plans/UX1-PROGRESS.md| index 6b735c4c..f0575573 100644 |
| --- a/docs/superpowers/plans/UX1-PROGRESS.md |
| +++ b/docs/superpowers/plans/UX1-PROGRESS.md |
| @@ -343,6 +343,31 @@ pass". Conventions as in `SLICE1-PROGRESS.md` to `SLICE4C-PROGRESS.md`. |
| - Any other tool: Running tools… | Compiling… | Spinning up… |
| - **Random**: A different set for each turn. |
| +14. Round after staging f2602d3 (Paul, an iPhone, dark mode): |
| + - "Still says 'Thinking' for me": the line cycled only after 6 s, and |
| + Paul's pick was never saved (staging held no thinking setting: on |
| + the Thinking words page a pick needed the button below). Now the |
| + first phrase holds about 3 s, then the situation's phrases come in |
| + a shuffled order every 3 to 4 s, never twice in a row; a situation |
| + with one or two phrases adds the set's thinking ones; a new |
| + activity switches at once; under reduced motion the words still |
| + change. Picking a set saves it at once. `TestBrowserThinkingCycles` |
| + (a fake clock; both motion settings). |
| + - Home screen alignment: the "‹ Teams" back strip above the phone's |
| + home screen is gone (Teams moved to Settings); the team's name and |
| + the avatar share one bar and centre line below the safe area; every |
| + nav group has the same hairline, radius and label gap (the first |
| + group and Team lacked their top edge); counts and the specialists' |
| + words sit in one column before the chevrons. |
| + `TestBrowserPhoneIndex` measures each in pixels; shots |
| + `ux1-before-index-profile-390.png`, `ux1-after-index-profile-390.png`. |
| + - Settings is its own section (`/conversation/settings`, in the nav's |
| + Team group): Thinking words with the preview, Connections (the page |
| + and the Prefer control), Housekeeping (a slot for its slice, marked |
| + `data-settings-slot`), Notebook and Teams, as full-row links. The |
| + profile menu holds the person and Sign out only. Shot |
| + `ux1-after-settings-390.png`. |
| + |
| ## Staging |
| Release c14b833 (built by `scripts/staging-thin.py build`, deployed with |
diff --git a/internal/equipo/app.go b/internal/equipo/app.go| index 34978656..d33d9775 100644 |
| --- a/internal/equipo/app.go |
| +++ b/internal/equipo/app.go |
| @@ -236,6 +236,7 @@ func RouterWithStore(d *db.DB, cfg Config, mailer mail.Sender, logger *slog.Logg |
| r.Post("/housekeeping/detectors/{id}", a.housekeepingDetector) |
| r.Post("/housekeeping/actions/{id}/undo", a.housekeepingUndo) |
| r.Post("/conversation/notebook/reset", a.chatNotebookReset) |
| + r.Get("/conversation/settings", a.settingsHub) |
| r.Get("/conversation/connections", a.connectionsView) |
| r.Post("/conversation/connections", a.connectionsStart) |
| r.Post("/conversation/connections/{id}/cancel", a.connectionsCancel) |
diff --git a/internal/equipo/chat_connections.go b/internal/equipo/chat_connections.go| index 0fb6fcc4..1615e617 100644 |
| --- a/internal/equipo/chat_connections.go |
| +++ b/internal/equipo/chat_connections.go |
| @@ -229,7 +229,11 @@ func (a *application) connectionsSignOut(w http.ResponseWriter, r *http.Request) |
| // connectionsPrefer is the Prefer control and a row's Make preferred. |
| func (a *application) connectionsPrefer(w http.ResponseWriter, r *http.Request) { |
| - a.chatActionTo(w, r, "/conversation/connections", func(ctx context.Context, address string) error { |
| + back := "/conversation/connections" |
| + if r.PostFormValue("from") == "settings" { |
| + back = "/conversation/settings#connections" |
| + } |
| + a.chatActionTo(w, r, back, func(ctx context.Context, address string) error { |
| revision, _ := strconv.ParseInt(r.PostFormValue("revision"), 10, 64) |
| _, err := a.store.Chat().SetPreference(ctx, address, wire.Preferences{Provider: r.PostFormValue("provider"), Revision: revision}) |
| if errors.Is(err, chat.ErrConflict) { |
diff --git a/internal/equipo/connections_view.go b/internal/equipo/connections_view.go| index dff0e19f..5e525379 100644 |
| --- a/internal/equipo/connections_view.go |
| +++ b/internal/equipo/connections_view.go |
| @@ -78,17 +78,7 @@ type connOption struct { |
| // connection and the preference. |
| func connectionsPage(snap wire.Snapshot, today map[string]int64, prefer wire.Preferences, runner string) modelsView { |
| v := modelsView{Offline: !snap.Runner.Online, Runner: runner, Cursor: snap.Cursor} |
| - v.Prefer = connPrefer{Provider: prefer.Provider, Revision: prefer.Revision, Hint: copyText("chat.connections.prefer_hint")} |
| - if prefer.Provider == "" { |
| - v.Prefer.Hint = copyText("chat.connections.prefer_hint_auto") |
| - } |
| - for _, o := range []string{"", wire.ProviderClaude, wire.ProviderCodex} { |
| - label := providerName(o) |
| - if o == "" { |
| - label = copyText("chat.connections.prefer_auto") |
| - } |
| - v.Prefer.Options = append(v.Prefer.Options, connOption{Value: o, Label: label, On: o == prefer.Provider}) |
| - } |
| + v.Prefer = preferControl(prefer) |
| live := liveRoles(snap) |
| coord := coordinatorOn(snap) |
| var held []wire.Connection |
| @@ -306,3 +296,20 @@ func providerGlyph(p string) string { |
| } |
| return p |
| } |
| + |
| +// preferControl is the Prefer control: Automatic, Claude or Codex, the |
| +// person's on, with its hint (the Connections page and Settings). |
| +func preferControl(prefer wire.Preferences) connPrefer { |
| + p := connPrefer{Provider: prefer.Provider, Revision: prefer.Revision, Hint: copyText("chat.connections.prefer_hint")} |
| + if prefer.Provider == "" { |
| + p.Hint = copyText("chat.connections.prefer_hint_auto") |
| + } |
| + for _, o := range []string{"", wire.ProviderClaude, wire.ProviderCodex} { |
| + label := providerName(o) |
| + if o == "" { |
| + label = copyText("chat.connections.prefer_auto") |
| + } |
| + p.Options = append(p.Options, connOption{Value: o, Label: label, On: o == prefer.Provider}) |
| + } |
| + return p |
| +} |
diff --git a/internal/equipo/copy.go b/internal/equipo/copy.go| index 2c94fcde..a170fa3b 100644 |
| --- a/internal/equipo/copy.go |
| +++ b/internal/equipo/copy.go |
| @@ -831,6 +831,16 @@ var pageCopy = map[string]string{ |
| "thinking.preview": "Preview", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) |
| "thinking.use": "Use these words", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) |
| "thinking.saved": "Saved. Your next message uses them.", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) |
| + "settings.connections": "Connections", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) |
| + "settings.connections_open": "Your connections", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) |
| + "settings.connections_about": "The accounts Equipo works with, and which it prefers.", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) |
| + "settings.housekeeping": "Housekeeping", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) |
| + "settings.housekeeping_about": "Tidying old tasks and kept sessions. Coming soon.", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) |
| + "settings.notebook": "Notebook and teams", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) |
| + "settings.notebook_open": "Notebook", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) |
| + "settings.notebook_about": "What your coordinator has noted. Reset starts it afresh.", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) |
| + "settings.teams_open": "Teams", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) |
| + "settings.teams_about": "Switch to another team or start a new one.", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) |
| "nav.checks": "Checks", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) |
| "nav.attempt": "attempt %d", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) |
| "nav.now": "now", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) |
diff --git a/internal/equipo/handlers.go b/internal/equipo/handlers.go| index fa031385..049e2038 100644 |
| --- a/internal/equipo/handlers.go |
| +++ b/internal/equipo/handlers.go |
| @@ -52,6 +52,7 @@ type pageData struct { |
| // the thinking line (thinking_words.go). |
| ThinkingSet, ThinkingWords string |
| Thinking thinkingView |
| + Settings settingsHubView |
| Coordinator conversation.CoordinatorPage |
| Plan planning.Page |
| Rendered RenderedChangeView |
| @@ -312,11 +313,6 @@ func (a *application) settings(w http.ResponseWriter, r *http.Request) { |
| data.Key = "settings" |
| data.Title = "nav.settings" |
| data.BudgetForms = budgetForms(data.Budget, data.Groups) |
| - if ctx, address, ok := sessionContext(r); ok { |
| - if h, err := a.store.Chat().Housekeeping(ctx, address); err == nil { |
| - data.HousekeepingSettings = housekeepingSettings(h) |
| - } |
| - } |
| a.renderLive(w, r, "settings", data) |
| } |
diff --git a/internal/equipo/housekeeping_page.go b/internal/equipo/housekeeping_page.go| index 691c718c..36da9156 100644 |
| --- a/internal/equipo/housekeeping_page.go |
| +++ b/internal/equipo/housekeeping_page.go |
| @@ -169,7 +169,7 @@ func housekeepingSettings(h wire.Housekeeping) *hkSettingsView { |
| // housekeepingQuiet saves the person's quiet hours from Settings; off is |
| // a window of no hours. |
| func (a *application) housekeepingQuiet(w http.ResponseWriter, r *http.Request) { |
| - a.chatActionTo(w, r, "/settings#housekeeping", func(ctx context.Context, address string) error { |
| + a.chatActionTo(w, r, "/conversation/settings#housekeeping", func(ctx context.Context, address string) error { |
| revision, _ := strconv.ParseInt(r.PostFormValue("revision"), 10, 64) |
| from, err1 := strconv.Atoi(r.PostFormValue("from")) |
| until, err2 := strconv.Atoi(r.PostFormValue("until")) |
| @@ -192,7 +192,7 @@ func (a *application) housekeepingQuiet(w http.ResponseWriter, r *http.Request) |
| // housekeepingPause is Pause and Resume, from Settings. |
| func (a *application) housekeepingPause(w http.ResponseWriter, r *http.Request) { |
| - a.chatActionTo(w, r, "/settings#housekeeping", func(ctx context.Context, address string) error { |
| + a.chatActionTo(w, r, "/conversation/settings#housekeeping", func(ctx context.Context, address string) error { |
| revision, _ := strconv.ParseInt(r.PostFormValue("revision"), 10, 64) |
| _, err := a.store.Chat().SetHousekeeping(ctx, address, wire.SetHousekeeping{Paused: r.PostFormValue("paused") == "1", Revision: revision}) |
| return hkPageError(err) |
diff --git a/internal/equipo/rail.go b/internal/equipo/rail.go| index 7f01096b..93cae661 100644 |
| --- a/internal/equipo/rail.go |
| +++ b/internal/equipo/rail.go |
| @@ -22,6 +22,7 @@ var railItems = []NavItem{ |
| {Key: "tasks", Href: "/tasks", CopyKey: "nav.tasks", Icon: "check-circle"}, |
| {Key: "needs-you", Href: "/tasks?needs=you", CopyKey: "nav.needs-you", Icon: "inbox"}, |
| {Key: "people", Group: "team", Href: "/people", CopyKey: "nav.people", Icon: "users"}, |
| + {Key: "settings-hub", Group: "team", Href: "/conversation/settings", CopyKey: "nav.settings", Icon: "sliders"}, |
| } |
| // railSpecialist is one specialist the thin core runs: idle, or working |
diff --git a/internal/equipo/render.go b/internal/equipo/render.go| index 3ca9c8c1..be21b507 100644 |
| --- a/internal/equipo/render.go |
| +++ b/internal/equipo/render.go |
| @@ -33,7 +33,7 @@ var assets = rastrillo.NewAssets(appFS) |
| var pages = map[string]*template.Template{} |
| func init() { |
| - for _, name := range []string{"person_devices", "person_device", "teams", "onboarding", "invite", "playbooks", "playbook_form", "playbook_diff", "specialist_form", "template_library", "template_diff", "conversation", "chat", "thread", "plan", "coordinator", "preferences", "index", "empty", "projects", "project", "project_form", "people", "settings", "specialist", "errors", "signin_page", "form_error", "runners", "tasks", "task", "task_form", "question", "merge", "connections", "recovery", "recovery_form", "rendered_approval", "notebook", "housekeeping", "work_tasks", "work_task", "work_projects", "work_project", "models", "work_needs", "thinking_words"} { |
| + for _, name := range []string{"person_devices", "person_device", "teams", "onboarding", "invite", "playbooks", "playbook_form", "playbook_diff", "specialist_form", "template_library", "template_diff", "conversation", "chat", "thread", "plan", "coordinator", "preferences", "index", "empty", "projects", "project", "project_form", "people", "settings", "specialist", "errors", "signin_page", "form_error", "runners", "tasks", "task", "task_form", "question", "merge", "connections", "recovery", "recovery_form", "rendered_approval", "notebook", "housekeeping", "work_tasks", "work_task", "work_projects", "work_project", "models", "work_needs", "thinking_words", "settings_hub"} { |
| page := template.Must(template.New("layout"). |
| Funcs(ui.Funcs(ui.WithIcons(icons.Icon, icons.Assets))). |
| Funcs(template.FuncMap{"chatMarkdown": chatmarkdown.Render, "loadingLine": loadingLine, "split": strings.Split, "since": sinceMillis, "elapsed": elapsedText, "short": short, "agoData": agoData, "agoFormats": agoFormats, "projectAllows": library.ProjectAllowed, "asset": assets.Path, "copy": copyText, "taskGroups": func() []string { return []string{"needs-person", "running", "queued", "finished"} }, |
diff --git a/internal/equipo/settings_hub.go b/internal/equipo/settings_hub.go| new file mode 100644 |
| index 00000000..13c05dd3 |
| --- /dev/null |
| +++ b/internal/equipo/settings_hub.go |
| @@ -0,0 +1,51 @@ |
| +package equipo |
| + |
| +import ( |
| + "net/http" |
| +) |
| + |
| +// The Settings section (Paul: "Settings should be its own section... not |
| +// an option in the profile dropdown"): Thinking words with its preview, |
| +// Connections with Prefer, Housekeeping (Pause, quiet hours and the way |
| +// to the activity view; housekeeping_settings.html), |
| +// Notebook and Teams. The profile menu keeps only the person. |
| + |
| +// settingsHubView is the Settings page. |
| +type settingsHubView struct { |
| + Thinking thinkingView |
| + Prefer connPrefer |
| +} |
| + |
| +// settingsHub is GET /conversation/settings. |
| +func (a *application) settingsHub(w http.ResponseWriter, r *http.Request) { |
| + w.Header().Set("Cache-Control", "no-store") |
| + ctx, address, ok := sessionContext(r) |
| + if !ok { |
| + a.failure(w, r, ErrForbidden) |
| + return |
| + } |
| + words, err := a.store.Chat().Thinking(ctx, address) |
| + if err != nil { |
| + a.failure(w, r, chatError(err)) |
| + return |
| + } |
| + prefer, err := a.store.Chat().Preference(ctx, address) |
| + if err != nil { |
| + a.failure(w, r, chatError(err)) |
| + return |
| + } |
| + data, err := a.page(r, "settings-hub") |
| + if err != nil { |
| + a.failure(w, r, err) |
| + return |
| + } |
| + data.Title = "nav.settings" |
| + h, err := a.store.Chat().Housekeeping(ctx, address) |
| + if err != nil { |
| + a.failure(w, r, chatError(err)) |
| + return |
| + } |
| + data.HousekeepingSettings = housekeepingSettings(h) |
| + data.Settings = settingsHubView{Thinking: thinkingView{ThinkingWords: words, JSON: thinkingJSON(words.Sets), Saved: r.URL.Query().Get("saved") == "1"}, Prefer: preferControl(prefer)} |
| + render(w, "settings_hub", data) |
| +} |
diff --git a/internal/equipo/static/chat-stream.js b/internal/equipo/static/chat-stream.js| index 2e671281..c0b3aecf 100644 |
| --- a/internal/equipo/static/chat-stream.js |
| +++ b/internal/equipo/static/chat-stream.js |
| @@ -94,15 +94,58 @@ |
| for (var i = 0; i < turn.length; i++) h = (h * 31 + turn.charCodeAt(i)) >>> 0; |
| return ids.length ? ids[h % ids.length] : "professional"; |
| } |
| + // The phrases a situation cycles through: its own, and when it has |
| + // only one or two, the set's thinking phrases too, so the line always |
| + // moves after the threshold. |
| function phrases(li) { |
| if (li.dataset.kind) return []; |
| - return (WORDS[setFor(li)] || {})[li.situation || "think"] || []; |
| + var set = WORDS[setFor(li)] || {}, own = set[li.situation || "think"] || []; |
| + if (own.length > 2) return own; |
| + return own.concat((set.think || []).filter(function (p) { return own.indexOf(p) < 0; })); |
| + } |
| + // A situation starts on its first phrase; after about 3 s the rest come |
| + // in a shuffled order, one every 3 to 4 s, none again until all have |
| + // shown, and never the same one twice in a row. |
| + var FIRST = 3000; |
| + function shuffled(n, avoid) { |
| + var out = []; |
| + for (var i = 0; i < n; i++) out.push(i); |
| + for (var j = n - 1; j > 0; j--) { |
| + var k = Math.floor(Math.random() * (j + 1)), t = out[j]; |
| + out[j] = out[k]; |
| + out[k] = t; |
| + } |
| + if (n > 1 && out[0] === avoid) out.push(out.shift()); |
| + return out; |
| } |
| function themed(li, label) { |
| var list = phrases(li); |
| - li.wordAt = Date.now(); |
| li.dataset.thinkingWords = setFor(li); |
| - return list.length ? list[(li.wordIndex || 0) % list.length] : label; |
| + li.wordAt = Date.now(); |
| + if (!list.length) return label; |
| + var key = setFor(li) + "/" + (li.situation || "think") + "/" + list.length; |
| + if (li.wordKey !== key) { |
| + // A new situation (or set): its first phrase at once. |
| + li.wordKey = key; |
| + li.wordOrder = [0].concat(shuffled(list.length, 0).filter(function (i) { return i !== 0; })); |
| + li.wordPos = 0; |
| + li.wordDelay = FIRST; |
| + } |
| + return list[li.wordOrder[li.wordPos] % list.length]; |
| + } |
| + // The next phrase of the situation, when its time has come. |
| + function cycle(li) { |
| + var list = phrases(li); |
| + if (list.length < 2 || !li.wordOrder || Date.now() - (li.wordAt || 0) < li.wordDelay) return; |
| + var last = li.wordOrder[li.wordPos]; |
| + li.wordPos++; |
| + if (li.wordPos >= li.wordOrder.length) { |
| + li.wordOrder = shuffled(list.length, last); |
| + li.wordPos = 0; |
| + } |
| + li.wordDelay = 3000 + Math.random() * 1000; |
| + li.wordAt = Date.now(); |
| + draw(li, list[li.wordOrder[li.wordPos] % list.length], false); |
| } |
| // The thinking line comes alive: the sparkle, and the drawn phrase |
| // beside the label, which stays for screen readers. |
| @@ -187,7 +230,6 @@ |
| var span = li.querySelector("[equipo-activity]"); |
| situation = situation || "think"; |
| if (!span || !label || span.textContent === label && li.situation === situation) return; |
| - if (li.situation !== situation) li.wordIndex = 0; |
| li.situation = situation; |
| span.textContent = label; |
| var line = li.querySelector("[equipo-activity-line]"); |
| @@ -304,16 +346,15 @@ |
| var out = el.querySelector("[equipo-elapsed]"); |
| var started = Number(el.dataset.started) || Date.now(); |
| if (out) out.textContent = format.replace("{n}", String(Math.max(0, Math.floor((Date.now() - started) / 1000)))); |
| - // The set's phrases take turns, slowly, while the activity holds. |
| - if (el.wordAt && !el.hasAttribute("data-streaming") && Date.now() - el.wordAt > 6000 && phrases(el).length > 1) { |
| - el.wordIndex = (el.wordIndex || 0) + 1; |
| - var span = el.querySelector("[equipo-activity]"); |
| - draw(el, themed(el, span ? span.textContent : ""), false); |
| - } |
| if (LOOK.star.every && !el.hasAttribute("data-streaming") && Date.now() - (el.flourished || 0) > LOOK.star.every) flourish(el); |
| }); |
| } |
| setInterval(tick, 1000); |
| + // The set's phrases take turns while the activity holds (words are |
| + // content: they change under reduced motion too, without the motion). |
| + setInterval(function () { |
| + feed.querySelectorAll("[equipo-thinking]:not([data-streaming])").forEach(cycle); |
| + }, 250); |
| function showDraft(turn) { |
| var el = bubble(turn); |
| var text = drafts[turn] ? drafts[turn].text : ""; |
diff --git a/internal/equipo/static/equipo.css b/internal/equipo/static/equipo.css| index 886fa858..e5b29b98 100644 |
| --- a/internal/equipo/static/equipo.css |
| +++ b/internal/equipo/static/equipo.css |
| @@ -953,3 +953,33 @@ a[equipo-source]:hover { color: var(--rst-text); text-decoration: underline; tex |
| [equipo-hk-hours] label { display: inline-flex; align-items: center; gap: var(--rst-sp-2); } |
| [equipo-hk-to-settings] { margin: var(--rst-sp-1) 0 0; font-size: var(--rst-fs-sm); } |
| [equipo-hk-to-settings] a { color: var(--rst-text-muted); text-underline-offset: 2px; } |
| +/* The phone's home screen (Paul, f2602d3: "Vertical alignment of header |
| + and top borders are all over the place"): no back strip above it; the |
| + team's name and the avatar on one bar below the safe area; every nav |
| + group drawn alike; counts and the specialists' words in one column |
| + just before the chevrons. */ |
| +@media (max-width: 799.98px) { |
| + [equipo-team-index] > [rst-shell-back] { display: none; } |
| + [rst-shell-sidebar~="index"] [equipo-team-heading] { box-sizing: border-box; block-size: var(--rst-shell-strip); min-block-size: 0; padding-block: 0; margin-block: env(safe-area-inset-top, 0px) var(--rst-sp-3); } |
| + [rst-shell-sidebar~="index"] [rst-shell-rail-foot]:has(> [rst-shell-profile]) { inset-block-start: env(safe-area-inset-top, 0px); } |
| + [rst-shell-sidebar~="index"] [rst-shell-nav] > [equipo-team-heading] + a, |
| + [rst-shell-sidebar~="index"] [rst-shell-nav] > [equipo-nav-group] + a { border-block-start-width: 1px; border-start-start-radius: var(--rst-radius); border-start-end-radius: var(--rst-radius); } |
| + [rst-shell-sidebar~="index"] [rst-shell-nav] > a:has(+ [equipo-nav-group]) { border-end-start-radius: var(--rst-radius); border-end-end-radius: var(--rst-radius); } |
| + [rst-shell-sidebar~="index"] [equipo-nav-group] { margin: var(--rst-sp-5) 0 var(--rst-sp-2); padding: 0 1rem; line-height: 1.3; } |
| + [rst-shell-sidebar~="index"] [rst-shell-nav] > a [equipo-count] { margin-inline-start: auto; } |
| + [rst-shell-sidebar~="index"] [rst-shell-nav] > a:has([equipo-count])::after { margin-inline-start: 0; } |
| + [rst-shell-sidebar~="index"] [equipo-spec] > summary { grid-template-columns: auto minmax(0, 1fr) auto .625rem; padding-inline: 1rem .75rem; column-gap: .75rem; } |
| + [rst-shell-sidebar~="index"] [equipo-spec] > summary > .icon:last-child { justify-self: center; } |
| +} |
| +/* Settings: sections of full-row links with quiet descriptions. */ |
| +[equipo-settings-section] { margin-block: 0 var(--rst-sp-6); } |
| +[equipo-settings-section] > h2 { font-size: var(--rst-fs-base); font-weight: 600; margin: 0 0 var(--rst-sp-3); } |
| +[equipo-setting-row] [equipo-mono] { --h: 230; } |
| +[equipo-setting-row] [equipo-mono] .icon { inline-size: .9em; block-size: .9em; margin: 0; } |
| +[equipo-setting-row] [equipo-desc] { margin: 0; color: var(--rst-text-muted); font-size: var(--rst-fs-sm); } |
| +[equipo-setting-row][data-placeholder] { color: var(--rst-text-muted); } |
| +[equipo-settings-section] [equipo-conn-prefer] { margin-block-start: var(--rst-sp-3); } |
| +[equipo-hk-hours] label { white-space: nowrap; flex: none; } |
| +[equipo-hk-hours] select { inline-size: auto; } |
| +[equipo-hk-settings] [equipo-hk-quiet] [equipo-desc] { margin: var(--rst-sp-1) 0 0; font-size: var(--rst-fs-sm); color: var(--rst-text-muted); } |
| +[equipo-hk-settings] [equipo-hk-pause-form] { margin-block: var(--rst-sp-3); } |
diff --git a/internal/equipo/static/thinking-preview.js b/internal/equipo/static/thinking-preview.js| index 603cb3ff..6912e60a 100644 |
| --- a/internal/equipo/static/thinking-preview.js |
| +++ b/internal/equipo/static/thinking-preview.js |
| @@ -31,8 +31,13 @@ |
| line.dataset.set = set; |
| step++; |
| } |
| + // Picking a set saves it at once (on a phone the button below is easy |
| + // to miss): the page returns with "Saved." and the preview of that set. |
| root.addEventListener("change", function (e) { |
| - if (e.target.name === "set") { step = 0; randomSet = ""; show(); } |
| + if (e.target.name !== "set") return; |
| + step = 0; randomSet = ""; show(); |
| + var form = e.target.form; |
| + if (form && form.requestSubmit) form.requestSubmit(); |
| }); |
| show(); |
| setInterval(show, 2200); |
diff --git a/internal/equipo/templates/chrome.html b/internal/equipo/templates/chrome.html| index 371bd8b0..480697f6 100644 |
| --- a/internal/equipo/templates/chrome.html |
| +++ b/internal/equipo/templates/chrome.html |
| @@ -1,6 +1,6 @@ |
| {{define "rail-brand"}}<span hidden></span>{{end}} |
| {{define "title"}}{{copy .Title}} · {{copy "brand"}}{{end}} |
| -{{define "head"}}{{.Live.Head (T "rastrillo.ui.live.paused") (T "rastrillo.ui.live.unconfirmed")}}<link rel="stylesheet" href="{{asset "static/equipo.css"}}"><script defer src="{{asset "static/nav-stream.js"}}"></script><script defer src="{{asset "static/work-stream.js"}}"></script>{{if .HousekeepingStream}}<script defer src="{{asset "static/housekeeping.js"}}"></script>{{end}}{{if eq .Key "thinking"}}<script defer src="{{asset "static/stardust.js"}}"></script><script defer src="{{asset "static/thinking-preview.js"}}"></script>{{end}}{{if or .ConnectionsStream .ChatStream}}<script defer src="{{asset "static/stardust.js"}}"></script>{{end}}{{if .ConnectionsStream}}<script defer src="{{asset "static/connections.js"}}"></script>{{end}}{{if .ChatStream}}<script defer src="{{asset "static/chat-stream.js"}}"></script><script defer src="{{asset "static/chat-compose.js"}}"></script><script defer src="{{asset "static/ask-target.js"}}"></script>{{if eq .Key "conversation"}}<script defer src="{{asset "static/chat-anchor.js"}}"></script>{{end}}{{else if eq .Key "conversation"}}<script defer blocking="render" src="{{asset "static/chat-navigation.js"}}"></script><script defer src="{{asset "static/chat.js"}}"></script><script defer src="{{asset "static/chat-send.js"}}"></script>{{end}}{{end}} |
| +{{define "head"}}{{.Live.Head (T "rastrillo.ui.live.paused") (T "rastrillo.ui.live.unconfirmed")}}<link rel="stylesheet" href="{{asset "static/equipo.css"}}"><script defer src="{{asset "static/nav-stream.js"}}"></script><script defer src="{{asset "static/work-stream.js"}}"></script>{{if .HousekeepingStream}}<script defer src="{{asset "static/housekeeping.js"}}"></script>{{end}}{{if or (eq .Key "thinking") (eq .Key "settings-hub")}}<script defer src="{{asset "static/stardust.js"}}"></script><script defer src="{{asset "static/thinking-preview.js"}}"></script>{{end}}{{if or .ConnectionsStream .ChatStream}}<script defer src="{{asset "static/stardust.js"}}"></script>{{end}}{{if .ConnectionsStream}}<script defer src="{{asset "static/connections.js"}}"></script>{{end}}{{if .ChatStream}}<script defer src="{{asset "static/chat-stream.js"}}"></script><script defer src="{{asset "static/chat-compose.js"}}"></script><script defer src="{{asset "static/ask-target.js"}}"></script>{{if eq .Key "conversation"}}<script defer src="{{asset "static/chat-anchor.js"}}"></script>{{end}}{{else if eq .Key "conversation"}}<script defer blocking="render" src="{{asset "static/chat-navigation.js"}}"></script><script defer src="{{asset "static/chat.js"}}"></script><script defer src="{{asset "static/chat-send.js"}}"></script>{{end}}{{end}} |
| {{define "up"}}/work{{if .Key}}#nav-{{.Key}}{{end}}{{end}} |
| {{define "up-label"}}{{.TeamName}}{{end}} |
| {{define "brand"}}<a rst-shell-brand href="/work">{{icon "users"}}{{.TeamName}}</a>{{end}} |
| @@ -9,7 +9,7 @@ |
| {{define "region:rail"}}<nav rst-shell-nav id="rail" 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}} |
| -{{range .Nav}}{{if eq .Group "team"}}{{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> |
| +{{$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> |
| {{end}} |
| </nav>{{end}} |
| {{define "rail-count"}}{{if not .Known}}<small equipo-count data-count>{{copy "counts.unavailable"}}</small>{{else if .N}}<small equipo-count data-count>{{.N}}</small>{{end}}{{end}} |
| @@ -22,4 +22,4 @@ |
| </div>{{end}}</details>{{end}}{{end}} |
| {{define "region:notice"}}<div id="notice" role="status"></div>{{end}} |
| {{define "profile"}}{{if .Address}}<span rst-person-av aria-hidden="true">{{icon "users"}}</span><span rst-person-name>{{.Address}}</span>{{else}}<span rst-person-av="empty placeholder" aria-hidden="true"></span><span rst-person-name>{{copy "nav.account"}}</span>{{end}}{{end}} |
| -{{define "account"}}{{if .Address}}<a href="/settings/thinking" data-thinking-link>{{copy "thinking.title"}}</a><form method="post" action="/signout"><button rst-btn type="submit">{{copy "nav.signout"}}</button></form>{{end}}{{end}} |
| +{{define "account"}}{{if .Address}}<form method="post" action="/signout"><button rst-btn type="submit">{{copy "nav.signout"}}</button></form>{{end}}{{end}} |
diff --git a/internal/equipo/templates/housekeeping.html b/internal/equipo/templates/housekeeping.html| index 8d34a82d..e58c1e25 100644 |
| --- a/internal/equipo/templates/housekeeping.html |
| +++ b/internal/equipo/templates/housekeeping.html |
| @@ -4,7 +4,7 @@ |
| {{define "content"}}{{with .Housekeeping}} |
| <section equipo-notebook equipo-hk data-housekeeping data-work-live data-work-region id="housekeeping-view"{{if .Paused}} data-paused{{end}}> |
| <header equipo-notebook-head equipo-hk-head><div><h1>{{copy "housekeeping.title"}}</h1><p>{{copy "housekeeping.lede"}}</p></div> |
| -<p equipo-hk-to-settings><a href="/settings#housekeeping" data-hk-settings-link>{{copy "housekeeping.settings_link"}}</a></p></header> |
| +<p equipo-hk-to-settings><a href="/conversation/settings#housekeeping" data-hk-settings-link>{{copy "housekeeping.settings_link"}}</a></p></header> |
| {{if .Paused}}<p equipo-hk-paused role="status">{{copy "housekeeping.paused"}}</p>{{end}} |
| <section equipo-hk-part aria-labelledby="hk-today"><h2 id="hk-today">{{copy "housekeeping.today"}}</h2> |
| <ul equipo-hk-meters role="list">{{range .Meters}}<li equipo-conn-meter data-hk-meter><span>{{.Label}}</span><span equipo-conn-bar aria-hidden="true"><i style="inline-size:{{.Percent}}%"></i></span><span><b>{{.Used}}</b>{{with .Held}}, {{.}}{{end}}</span></li>{{end}}</ul></section> |
diff --git a/internal/equipo/templates/housekeeping_settings.html b/internal/equipo/templates/housekeeping_settings.html| index df681d91..b56cd67e 100644 |
| --- a/internal/equipo/templates/housekeeping_settings.html |
| +++ b/internal/equipo/templates/housekeeping_settings.html |
| @@ -1,12 +1,10 @@ |
| -{{define "housekeeping-settings"}}<section id="housekeeping" equipo-card equipo-hk-settings data-hk-settings{{if .Paused}} data-paused{{end}} aria-labelledby="hk-settings-title"> |
| -<h2 id="hk-settings-title">{{copy "housekeeping.title"}}</h2> |
| -<p equipo-lede>{{copy "housekeeping.settings.lede"}}</p> |
| +{{define "housekeeping-settings"}}<div equipo-hk-settings data-hk-settings{{if .Paused}} data-paused{{end}}> |
| +<ol equipo-rows><li equipo-row equipo-setting-row><span equipo-mono data-size="s" aria-hidden="true">{{icon "list-checks"}}</span><div equipo-row-body><p equipo-row-title><a equipo-row-link href="/housekeeping" data-hk-activity>{{copy "housekeeping.settings.activity"}}</a></p><p equipo-desc>{{copy "housekeeping.settings.lede"}}</p></div></li></ol> |
| <form method="post" action="/settings/housekeeping/pause" equipo-hk-pause-form><input type="hidden" name="revision" value="{{.Revision}}">{{if .Paused}}<p equipo-hk-paused role="status">{{copy "housekeeping.paused"}}</p><input type="hidden" name="paused" value="0"><button rst-btn type="submit" data-hk-resume>{{copy "housekeeping.resume"}}</button>{{else}}<input type="hidden" name="paused" value="1"><button rst-btn type="submit" data-hk-pause>{{copy "housekeeping.pause"}}</button>{{end}}</form> |
| <form method="post" action="/settings/housekeeping/quiet" equipo-form equipo-hk-quiet data-hk-quiet><input type="hidden" name="revision" value="{{.Revision}}"> |
| -<fieldset><legend>{{copy "housekeeping.settings.quiet"}}</legend><p equipo-quiet>{{copy "housekeeping.settings.quiet_hint"}}</p> |
| +<fieldset><legend>{{copy "housekeeping.settings.quiet"}}</legend><p equipo-desc>{{copy "housekeeping.settings.quiet_hint"}}</p> |
| <label equipo-hk-check><input type="checkbox" name="on" value="1"{{if .QuietOn}} checked{{end}} data-hk-quiet-on>{{copy "housekeeping.settings.quiet_on"}}</label> |
| <span equipo-hk-hours><label>{{copy "housekeeping.settings.from"}}<select rst-input name="from" data-hk-quiet-from>{{$f := .From}}{{range .Hours}}<option value="{{.Value}}"{{if eq .Value $f}} selected{{end}}>{{.Label}}</option>{{end}}</select></label> |
| <label>{{copy "housekeeping.settings.until"}}<select rst-input name="until" data-hk-quiet-until>{{$u := .Until}}{{range .Hours}}<option value="{{.Value}}"{{if eq .Value $u}} selected{{end}}>{{.Label}}</option>{{end}}</select></label></span></fieldset> |
| <button rst-btn="primary" type="submit" data-hk-quiet-save>{{copy "form.save"}}</button></form> |
| -<p><a href="/housekeeping" data-hk-activity>{{copy "housekeeping.settings.activity"}}</a></p> |
| -</section>{{end}} |
| +</div>{{end}} |
diff --git a/internal/equipo/templates/settings.html b/internal/equipo/templates/settings.html| index 15ef6d17..bde94ddb 100644 |
| --- a/internal/equipo/templates/settings.html |
| +++ b/internal/equipo/templates/settings.html |
| @@ -17,5 +17,4 @@ |
| {{else}}{{template "budget-summary" .}}{{end}} |
| <h3>{{copy "budget.usage"}}</h3><p data-usage="unavailable">{{copy "usage.unknown"}}</p> |
| </section> |
| -{{with .HousekeepingSettings}}{{template "housekeeping-settings" .}}{{end}} |
| {{end}} |
diff --git a/internal/equipo/templates/settings_hub.html b/internal/equipo/templates/settings_hub.html| new file mode 100644 |
| index 00000000..502d8b39 |
| --- /dev/null |
| +++ b/internal/equipo/templates/settings_hub.html |
| @@ -0,0 +1,20 @@ |
| +{{define "title"}}{{copy "nav.settings"}}{{end}} |
| +{{define "content"}} |
| +<section equipo-inner equipo-settings> |
| +<div equipo-page-head><h1>{{copy "nav.settings"}}</h1></div> |
| +<section equipo-settings-section id="thinking"><h2>{{copy "thinking.title"}}</h2> |
| +{{template "thinking-form" (dict "Thinking" .Settings.Thinking "From" "settings")}} |
| +</section> |
| +<section equipo-settings-section id="connections"><h2>{{copy "settings.connections"}}</h2> |
| +<ol equipo-rows><li equipo-row equipo-setting-row><span equipo-mono data-size="s" aria-hidden="true">{{icon "plug"}}</span><div equipo-row-body><p equipo-row-title><a equipo-row-link href="/conversation/connections" data-connections-link>{{copy "settings.connections_open"}}</a></p><p equipo-desc>{{copy "settings.connections_about"}}</p></div></li></ol> |
| +{{with .Settings.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="{{$.Settings.Prefer.Revision}}"><input type="hidden" name="from" value="settings"><button type="submit" aria-pressed="{{.On}}" data-prefer="{{.Value}}">{{.Label}}</button></form>{{end}}</span><span equipo-conn-hint>{{.Hint}}</span></div>{{end}} |
| +</section> |
| +<section equipo-settings-section id="housekeeping" data-settings-slot="housekeeping"><h2>{{copy "settings.housekeeping"}}</h2> |
| +{{with .HousekeepingSettings}}{{template "housekeeping-settings" .}}{{end}} |
| +</section> |
| +<section equipo-settings-section id="notebook"><h2>{{copy "settings.notebook"}}</h2> |
| +<ol equipo-rows><li equipo-row equipo-setting-row><span equipo-mono data-size="s" aria-hidden="true">{{icon "notebook"}}</span><div equipo-row-body><p equipo-row-title><a equipo-row-link href="/conversation/notebook">{{copy "settings.notebook_open"}}</a></p><p equipo-desc>{{copy "settings.notebook_about"}}</p></div></li> |
| +<li equipo-row equipo-setting-row><span equipo-mono data-size="s" aria-hidden="true">{{icon "users"}}</span><div equipo-row-body><p equipo-row-title><a equipo-row-link href="/teams">{{copy "settings.teams_open"}}</a></p><p equipo-desc>{{copy "settings.teams_about"}}</p></div></li></ol> |
| +</section> |
| +</section> |
| +{{end}} |
diff --git a/internal/equipo/templates/thinking_words.html b/internal/equipo/templates/thinking_words.html| index 6d2d2454..d70e46a2 100644 |
| --- a/internal/equipo/templates/thinking_words.html |
| +++ b/internal/equipo/templates/thinking_words.html |
| @@ -1,16 +1,4 @@ |
| {{define "title"}}{{copy "thinking.title"}}{{end}} |
| {{define "content"}} |
| -{{with .Thinking}}<section equipo-inner equipo-thinking-words data-thinking-words="{{.JSON}}"> |
| -<div equipo-page-head><h1>{{copy "thinking.title"}}</h1></div> |
| -<p equipo-lede>{{copy "thinking.lede"}}</p> |
| -{{if .Saved}}<p equipo-saved role="status">{{copy "thinking.saved"}}</p>{{end}} |
| -<div equipo-thinking-preview aria-hidden="true"><p equipo-quiet>{{copy "thinking.preview"}}</p><p equipo-activity-line data-preview-line><span data-preview-phrase></span></p></div> |
| -<form method="post" action="/settings/thinking" equipo-thinking-form> |
| -<input type="hidden" name="revision" value="{{.Revision}}"> |
| -<fieldset><legend equipo-visually-hidden>{{copy "thinking.title"}}</legend> |
| -<ol equipo-rows>{{$cur := .Set}}{{range .Sets}}<li equipo-row equipo-set-row data-set="{{.ID}}"><label><input type="radio" name="set" value="{{.ID}}"{{if eq .ID $cur}} checked{{end}}><span equipo-set-name>{{.Name}}</span><span equipo-desc>{{.Description}}</span>{{with index .Phrases "think"}}<span equipo-set-sample>{{range $i, $p := .}}{{if lt $i 3}}{{if $i}} · {{end}}{{$p}}{{end}}{{end}}</span>{{end}}</label></li>{{end}}</ol> |
| -</fieldset> |
| -<button equipo-btn data-primary type="submit">{{copy "thinking.use"}}</button> |
| -</form> |
| -</section>{{end}} |
| +<section equipo-inner>{{template "thinking-form" (dict "Thinking" .Thinking "From" "")}}</section> |
| {{end}} |
diff --git a/internal/equipo/templates/work_parts.html b/internal/equipo/templates/work_parts.html| index f8df4baa..002a3572 100644 |
| --- a/internal/equipo/templates/work_parts.html |
| +++ b/internal/equipo/templates/work_parts.html |
| @@ -33,3 +33,16 @@ |
| <div equipo-d-actions>{{with .Card}}<form method="post" action="/conversation/cards/{{.ID}}/answer"><input type="hidden" name="revision" value="{{.Revision}}"><input type="hidden" name="from" value="{{$.From}}"><input type="hidden" name="task" value="{{$t.ID}}">{{range $.Task.Decision.Choices}}<button equipo-btn{{if .Primary}} data-primary{{end}} type="submit" name="choice" value="{{.Value}}" data-merge-choice="{{.Value}}">{{.Label}}</button>{{end}}</form>{{end}}{{if .Fold}}<form method="post" action="/tasks/{{$t.ID}}/duplicate"><input type="hidden" name="from" value="{{$.From}}"><input type="hidden" name="of" value="{{$t.Dup.ID}}"><button equipo-btn data-primary type="submit" data-task-duplicate>{{copy "work.decide.fold"}}</button></form>{{end}}{{if .Retry}}<form method="post" action="/conversation/tasks/{{$t.ID}}/retry"><input type="hidden" name="from" value="{{$.From}}"><button {{if .Fold}}equipo-link{{else}}equipo-btn data-primary{{end}} type="submit" data-task-retry>{{copy "work.retry"}}</button></form>{{end}}{{if .Talk}}<a equipo-btn href="/conversation">{{copy "work.decide.talk"}}</a>{{end}}{{if .Cancel}}<form method="post" action="/conversation/tasks/{{$t.ID}}/cancel"><input type="hidden" name="from" value="{{$.From}}"><button equipo-link type="submit" data-task-cancel>{{copy "work.decide.cancel"}}</button></form>{{end}}{{with .Hint}}<span equipo-quiet>{{.}}</span>{{end}}</div> |
| </div>{{end}}{{end}} |
| {{define "project-facts"}}{{with .StackLine}}<span>{{if $.PhoneStack}}{{icon "phone"}}{{else}}{{icon "code"}}{{end}}{{.}}</span>{{end}}<span>{{icon "git"}}{{if eq (len .Repos) 1}}{{copy "work.project.one_repo"}}{{else}}{{printf (copy "work.project.repos") (len .Repos)}}{{end}}</span>{{with .ChecksLine}}<span data-tone="{{if $.Checks.Here}}positive{{else}}warning{{end}}" data-checks-fact>{{if $.Checks.Here}}{{icon "check-circle"}}{{else}}{{icon "help-circle"}}{{end}}{{.}}</span>{{end}}{{end}} |
| +{{define "thinking-form"}}{{with .Thinking}}<div equipo-thinking-words data-thinking-words="{{.JSON}}"> |
| +{{if not $.From}}<div equipo-page-head><h1>{{copy "thinking.title"}}</h1></div>{{end}} |
| +<p equipo-lede>{{copy "thinking.lede"}}</p> |
| +{{if .Saved}}<p equipo-saved role="status">{{copy "thinking.saved"}}</p>{{end}} |
| +<div equipo-thinking-preview aria-hidden="true"><p equipo-quiet>{{copy "thinking.preview"}}</p><p equipo-activity-line data-preview-line><span data-preview-phrase></span></p></div> |
| +<form method="post" action="/settings/thinking" equipo-thinking-form> |
| +<input type="hidden" name="revision" value="{{.Revision}}"><input type="hidden" name="from" value="{{$.From}}"> |
| +<fieldset><legend equipo-visually-hidden>{{copy "thinking.title"}}</legend> |
| +<ol equipo-rows>{{$cur := .Set}}{{range .Sets}}<li equipo-row equipo-set-row data-set="{{.ID}}"><label><input type="radio" name="set" value="{{.ID}}"{{if eq .ID $cur}} checked{{end}}><span equipo-set-name>{{.Name}}</span><span equipo-desc>{{.Description}}</span>{{with index .Phrases "think"}}<span equipo-set-sample>{{range $i, $p := .}}{{if lt $i 3}}{{if $i}} · {{end}}{{$p}}{{end}}{{end}}</span>{{end}}</label></li>{{end}}</ol> |
| +</fieldset> |
| +<button equipo-btn data-primary type="submit">{{copy "thinking.use"}}</button> |
| +</form> |
| +</div>{{end}}{{end}} |
diff --git a/internal/equipo/thinking_words.go b/internal/equipo/thinking_words.go| index cf40b6bf..2dc306d8 100644 |
| --- a/internal/equipo/thinking_words.go |
| +++ b/internal/equipo/thinking_words.go |
| @@ -69,7 +69,11 @@ func (a *application) thinkingPage(w http.ResponseWriter, r *http.Request) { |
| func (a *application) thinkingSave(w http.ResponseWriter, r *http.Request) { |
| revision, _ := strconv.ParseInt(r.PostFormValue("revision"), 10, 64) |
| set := r.PostFormValue("set") |
| - a.chatActionTo(w, r, "/settings/thinking?saved=1", func(ctx context.Context, address string) error { |
| + back := "/settings/thinking?saved=1" |
| + if r.PostFormValue("from") == "settings" { |
| + back = "/conversation/settings?saved=1#thinking" |
| + } |
| + a.chatActionTo(w, r, back, func(ctx context.Context, address string) error { |
| _, err := a.store.Chat().SetThinking(ctx, address, wire.ThinkingChoice{Set: set, Revision: revision}) |
| return err |
| }) |
diff --git a/internal/equipotest/pages_test.go b/internal/equipotest/pages_test.go| index 96ce6390..3a035b9f 100644 |
| --- a/internal/equipotest/pages_test.go |
| +++ b/internal/equipotest/pages_test.go |
| @@ -25,8 +25,8 @@ var railPaths = []string{"/teams", "/conversation", "/tasks", "/needs-you", "/jo |
| // railLinks are the thin v1 sidebar's links (slice 4, reordered in UX1: |
| // Projects above Tasks): the pages above that the thin core does not |
| // back are still served, but not linked. |
| -var railLinks = []string{"/conversation", "/projects", "/tasks", "/tasks?needs=you", "/people"} |
| -var railLinkNames = []string{"Conversation", "Projects", "Tasks", "Needs you", "People"} |
| +var railLinks = []string{"/conversation", "/projects", "/tasks", "/tasks?needs=you", "/people", "/conversation/settings"} |
| +var railLinkNames = []string{"Conversation", "Projects", "Tasks", "Needs you", "People", "Settings"} |
| func newPageFixture(t *testing.T) authFixture { |
| t.Helper() |
diff --git a/internal/thintest/housekeeping_browser_test.go b/internal/thintest/housekeeping_browser_test.go| index 59dcb8dc..f6aef9ac 100644 |
| --- a/internal/thintest/housekeeping_browser_test.go |
| +++ b/internal/thintest/housekeeping_browser_test.go |
| @@ -68,7 +68,7 @@ func TestBrowserHousekeeping(t *testing.T) { |
| p.check(`[...document.querySelectorAll('[equipo-hk-action] [equipo-hk-line]')].every(e=>e.textContent.includes('Combined'))`, "action lines") |
| p.check(`[...document.querySelectorAll('[equipo-hk-action] [equipo-hk-meta]')].every(e=>/\d+% alike, \d+ words in common/.test(e.textContent))`, "evidence") |
| p.check(`document.querySelectorAll('[data-detector]').length===2 && !document.querySelector('[data-detector][data-off]')`, "detectors on") |
| - p.check(`document.querySelector('[data-hk-settings-link]').getAttribute('href')==='/settings#housekeeping'`, "the way to Settings") |
| + p.check(`document.querySelector('[data-hk-settings-link]').getAttribute('href')==='/conversation/settings#housekeeping'`, "the way to Settings") |
| if size.touch { |
| p.check(`[...document.querySelectorAll('[data-hk-undo]')].every(b=>{const r=b.getBoundingClientRect();return r.height>=44&&r.width>0})`, "Undo within reach on touch") |
| } else { |
| @@ -122,7 +122,7 @@ func TestBrowserHousekeeping(t *testing.T) { |
| touch bool |
| }{{1280, 900, false}, {390, 844, true}} { |
| q := openInner(t, r.inst.URL, r.inst.Cookie(), size.w, size.h, size.touch, "light", "no-preference") |
| - q.open("/settings#housekeeping") |
| + q.open("/conversation/settings#housekeeping") |
| q.check(`!!document.querySelector('[data-hk-settings] [data-hk-pause]') && document.querySelector('[data-hk-activity]').getAttribute('href')==='/housekeeping'`, "the section") |
| q.check(`document.querySelector('[data-hk-quiet-on]').checked && document.querySelector('[data-hk-quiet-from]').value==='22' && document.querySelector('[data-hk-quiet-until]').value==='8'`, "default quiet hours") |
| q.fits("settings") |
| @@ -131,7 +131,7 @@ func TestBrowserHousekeeping(t *testing.T) { |
| } |
| q := openInner(t, r.inst.URL, r.inst.Cookie(), 1280, 900, false, "light", "no-preference") |
| defer q.stop() |
| - q.open("/settings") |
| + q.open("/conversation/settings") |
| q.check(`(()=>{window.__hkmark=1;document.querySelector('[data-hk-quiet-from]').value='23';document.querySelector('[data-hk-quiet-until]').value='7';return true})()`, "choose hours") |
| q.click(`[data-hk-quiet-save]`) |
| q.wait(`!window.__hkmark && document.querySelector('[data-hk-quiet-from]') && document.querySelector('[data-hk-quiet-from]').value==='23' && document.querySelector('[data-hk-quiet-until]').value==='7'`, "quiet hours saved") |
diff --git a/internal/thintest/housekeeping_contract_test.go b/internal/thintest/housekeeping_contract_test.go| index 4d538ece..455d5309 100644 |
| --- a/internal/thintest/housekeeping_contract_test.go |
| +++ b/internal/thintest/housekeeping_contract_test.go |
| @@ -135,12 +135,15 @@ func TestContractHousekeepingCombine(t *testing.T) { |
| t.Fatal("no way from the conversation to the view") |
| } |
| // Settings' Housekeeping section: Pause, quiet hours, the activity view. |
| - settings := r.inst.Get(t, "/settings") |
| + settings := r.inst.Get(t, "/conversation/settings") |
| for _, want := range []string{`id="housekeeping"`, "data-hk-pause", "data-hk-quiet-on", `<option value="22" selected>22:00</option>`, `<option value="8" selected>08:00</option>`, `href="/housekeeping" data-hk-activity`} { |
| if !strings.Contains(settings, want) { |
| t.Fatalf("Settings lacks %q", want) |
| } |
| } |
| + if strings.Contains(settings, "data-placeholder") || strings.Contains(r.inst.Get(t, "/settings"), "data-hk-settings") { |
| + t.Fatal("the placeholder or the old /settings section is still there") |
| + } |
| // A teammate sees none of it, and cannot undo it. |
| member := personToolRig(t, r, "member@example.com", equipo.RoleMember) |
| if mh, err := member.client.Housekeeping(r.ctx); err != nil || len(mh.Actions) != 0 { |
diff --git a/internal/thintest/index_browser_test.go b/internal/thintest/index_browser_test.go| new file mode 100644 |
| index 00000000..5cdb3462 |
| --- /dev/null |
| +++ b/internal/thintest/index_browser_test.go |
| @@ -0,0 +1,43 @@ |
| +//go:build browser |
| + |
| +package thintest |
| + |
| +import ( |
| + "testing" |
| +) |
| + |
| +// TestBrowserPhoneIndex: Paul, f2602d3, an iPhone in dark mode: "Vertical |
| +// alignment of header and top borders are all over the place here." The |
| +// phone's home screen (the sidebar as a page): no back strip above it; |
| +// the team's name and the avatar on one centre line; every nav group |
| +// drawn alike (a hairline on every side, one radius, one gap under its |
| +// label); counts and the specialists' words in one column before the |
| +// chevrons; the profile menu holds the person only, and Settings is in |
| +// the nav. |
| +func TestBrowserPhoneIndex(t *testing.T) { |
| + g := newGallery(t) |
| + p := openInner(t, g.a.inst.URL, g.a.inst.Cookie(), 390, 844, true, "dark", "reduce") |
| + defer p.stop() |
| + p.open("/work") |
| + p.check(`(()=>{const b=document.querySelector('[equipo-team-index] > [rst-shell-back]');return !b || b.getBoundingClientRect().height===0})()`, "a back strip above the home screen") |
| + mid := `(e=>{const r=e.getBoundingClientRect();return (r.top+r.bottom)/2})` |
| + p.check(`(()=>{const m=`+mid+`;return Math.abs(m(document.querySelector('[equipo-team-heading] [rst-shell-brand]'))-m(document.querySelector('[rst-shell-profile] > summary')))<=1})()`, "the team's name and the avatar are not on one centre line") |
| + // Counts and specialist words share one right edge. |
| + p.check(`(()=>{const xs=[...document.querySelectorAll('#rail > a [equipo-count], #rail [equipo-spec-state]')].map(e=>Math.round(e.getBoundingClientRect().right));return xs.length>=4 && Math.max(...xs)-Math.min(...xs)<=1})()`, "counts and specialist words in different columns") |
| + // Every group: its first row has a top hairline and the radius, its |
| + // last row the radius, and every label sits the same gap above. |
| + p.check(`(()=>{const nav=document.querySelector('#rail');const kids=[...nav.children].filter(e=>e.matches('a,[equipo-spec],[equipo-nav-group],[equipo-team-heading]'));const groups=[];let cur=null;for(const k of kids){if(k.matches('[equipo-nav-group],[equipo-team-heading]')){cur={label:k,rows:[]};groups.push(cur)}else if(cur){cur.rows.push(k)}} |
| + const firsts=groups.filter(g=>g.rows.length).map(g=>getComputedStyle(g.rows[0]));const lasts=groups.filter(g=>g.rows.length).map(g=>getComputedStyle(g.rows[g.rows.length-1])); |
| + const tops=firsts.every(s=>s.borderTopWidth==='1px' && s.borderTopLeftRadius===firsts[0].borderTopLeftRadius && parseFloat(s.borderTopLeftRadius)>0); |
| + const bottoms=lasts.every(s=>s.borderBottomLeftRadius===firsts[0].borderTopLeftRadius); |
| + const sides=[...nav.querySelectorAll(':scope > a, :scope > [equipo-spec]')].every(e=>{const s=getComputedStyle(e);return s.borderLeftWidth==='1px' && s.borderRightWidth==='1px'}); |
| + const gaps=groups.slice(1).map(g=>Math.round(g.rows[0].getBoundingClientRect().top-g.label.getBoundingClientRect().bottom)); |
| + return groups.length>=3 && tops && bottoms && sides && gaps.every(x=>x===gaps[0])})()`, "nav groups drawn differently") |
| + p.check(`!!document.querySelector('#rail a[href="/conversation/settings"]')`, "no Settings in the nav") |
| + p.check(`(()=>{const d=document.querySelector('[rst-shell-profile]');d.open=true;const links=[...d.querySelectorAll('a')].map(a=>a.getAttribute('href'));return !links.includes('/settings/thinking') && !!d.querySelector('form[action="/signout"]')})()`, "the profile menu holds more than the person") |
| + p.shot("ux1-index-profile-390") |
| + p.open("/conversation/settings") |
| + p.check(`['thinking','connections','housekeeping','notebook'].every(id=>!!document.getElementById(id)) && !!document.querySelector('#thinking [data-preview-line]') && !!document.querySelector('#connections [data-prefer]')`, "Settings sections") |
| + p.check(`getComputedStyle(document.querySelector('#notebook [equipo-row-link]'),'::after').cursor==='pointer'`, "Settings rows are not whole-row links") |
| + p.shot("ux1-settings-390") |
| +} |
diff --git a/internal/thintest/pages_test.go b/internal/thintest/pages_test.go| index a4ccf85b..ad35813a 100644 |
| --- a/internal/thintest/pages_test.go |
| +++ b/internal/thintest/pages_test.go |
| @@ -271,7 +271,7 @@ var hrefs = regexp.MustCompile(`href="([^"]*)"`) |
| func TestPagesRail(t *testing.T) { |
| r := newToolRig(t) |
| owner := r.inst.Cookie() |
| - allowed := regexp.MustCompile(`^/(conversation|tasks|projects|people|work|tasks\?needs=you|tasks/tk[a-z0-9]+)$`) |
| + allowed := regexp.MustCompile(`^/(conversation|conversation/settings|tasks|projects|people|work|tasks\?needs=you|tasks/tk[a-z0-9]+)$`) |
| for _, path := range []string{"/conversation", "/tasks", "/projects", "/people", "/tasks?needs=you"} { |
| rail := railOf(t, r.get(owner, path, 200)) |
| for _, m := range hrefs.FindAllStringSubmatch(rail, -1) { |
| @@ -279,7 +279,7 @@ func TestPagesRail(t *testing.T) { |
| t.Fatalf("%s: the sidebar links %q", path, m[1]) |
| } |
| } |
| - for _, gone := range []string{"Journey", "Playbooks", "Product", "Design", "Copy", "nav-coordinator", "nav-connections", "nav-settings"} { |
| + for _, gone := range []string{"Journey", "Playbooks", "Product", "Design", "Copy", "nav-coordinator", "nav-connections", `id="nav-settings"`} { |
| if strings.Contains(rail, gone) { |
| t.Fatalf("%s: the sidebar shows %s", path, gone) |
| } |
diff --git a/internal/thintest/thinking_browser_test.go b/internal/thintest/thinking_browser_test.go| index 4ad2f348..18bf77d5 100644 |
| --- a/internal/thintest/thinking_browser_test.go |
| +++ b/internal/thintest/thinking_browser_test.go |
| @@ -3,11 +3,15 @@ |
| package thintest |
| import ( |
| + "context" |
| "encoding/json" |
| "fmt" |
| "testing" |
| "amadan.net/oficina/equipo/internal/wire" |
| + "github.com/chromedp/cdproto/cdp" |
| + "github.com/chromedp/cdproto/page" |
| + "github.com/chromedp/chromedp" |
| ) |
| // TestBrowserThinkingWords: the Thinking words page previews the chosen |
| @@ -45,11 +49,20 @@ func TestBrowserThinkingWords(t *testing.T) { |
| p.open("/settings/thinking") |
| preview := `document.querySelector('[data-preview-phrase]').textContent` |
| p.wait(anyOf("professional")+`.includes(`+preview+`)`, "the preview shows Professional") |
| + // Picking a set saves it at once (Paul, iPhone: the button below was |
| + // easy to miss, and the line kept the default). |
| p.check(`(()=>{document.querySelector('[data-set="pirate"] label').click();return document.querySelector('input[value="pirate"]').checked})()`, "pick Pirate adventure") |
| - p.wait(anyOf("pirate")+`.includes(`+preview+`)`, "the preview shows Pirate adventure at once") |
| + p.wait(`location.search.includes('saved=1') && document.querySelector('input[value="pirate"]').checked && document.querySelector('[equipo-saved]')`, "picking saved the set") |
| + p.wait(anyOf("pirate")+`.includes(`+preview+`)`, "the preview shows Pirate adventure") |
| p.check(`document.querySelector('[data-preview-line]').dataset.set==='pirate'`, "preview set") |
| + if got, _ := r.client.Thinking(r.ctx); got.Set != "pirate" { |
| + t.Fatalf("saved %s", got.Set) |
| + } |
| p.shot(fmt.Sprintf("ux1-thinking-words-%d", size.w)) |
| - p.stayed("preview") |
| + cur, _ := r.client.Thinking(r.ctx) |
| + if _, err := r.client.SetThinking(r.ctx, "professional", cur.Revision); err != nil { |
| + t.Fatal(err) |
| + } |
| p.stop() |
| } |
| @@ -60,6 +73,7 @@ func TestBrowserThinkingWords(t *testing.T) { |
| line := `document.querySelector('[equipo-thinking][data-turn="` + r.turn + `"]')` |
| phrase := line + `?.querySelector('[equipo-phrase] [data-in]')?.textContent` |
| p.wait(in("professional", "think")+`.includes(`+phrase+`)`, "Professional while thinking") |
| + _ = p |
| cur, _ := r.client.Thinking(r.ctx) |
| if _, err := r.client.SetThinking(r.ctx, "galaxy", cur.Revision); err != nil { |
| t.Fatal(err) |
| @@ -81,3 +95,76 @@ func TestBrowserThinkingWords(t *testing.T) { |
| p.wait(`(()=>{const l=`+line+`;const s=l?.dataset.thinkingWords;const all={professional:`+in("professional", "search")+`,playful:`+in("playful", "search")+`,galaxy:`+in("galaxy", "search")+`,bridge:`+in("bridge", "search")+`,pirate:`+in("pirate", "search")+`,terminal:`+in("terminal", "search")+`};return !!s && s!=='random' && (all[s]||[]).includes(`+phrase+`)})()`, "Random took one set for the turn") |
| p.stayed("conversation") |
| } |
| + |
| +// TestBrowserThinkingCycles: Paul, staging f2602d3, an iPhone: "Still says |
| +// 'Thinking' for me. Shouldn't it cycle if it goes over a waiting |
| +// threshold?" With a fake clock: the first phrase holds until about 3 s, |
| +// then the set's phrases come one after another, every 3 to 4 s, never |
| +// the same twice in a row; a new activity switches to its own phrases at |
| +// once (a situation with only two adds the thinking ones); under reduced |
| +// motion the words still change. |
| +func TestBrowserThinkingCycles(t *testing.T) { |
| + r := newToolRig(t) |
| + words, _ := r.client.Thinking(r.ctx) |
| + var think, read []string |
| + for _, s := range words.Sets { |
| + if s.ID == wire.DefaultThinking { |
| + think, read = s.Phrases["think"], s.Phrases["read"] |
| + } |
| + } |
| + js := func(v any) string { raw, _ := json.Marshal(v); return string(raw) } |
| + for _, motion := range []string{"no-preference", "reduce"} { |
| + p := openInner(t, r.inst.URL, r.inst.Cookie(), 390, 844, true, "dark", motion) |
| + p.do(chromedp.Func(func(ctx context.Context, target *chromedp.Target) error { |
| + _, err := cdp.Call(ctx, target, page.AddScriptToEvaluateOnNewDocument, page.AddScriptToEvaluateOnNewDocumentParams{Source: `(()=>{const real=Date.now.bind(Date);window.__skew=0;Date.now=()=>real()+window.__skew;})()`}) |
| + return err |
| + })) |
| + p.open("/conversation") |
| + line := `document.querySelector('[equipo-thinking][data-turn="` + r.turn + `"]')` |
| + phrase := line + `?.querySelector('[equipo-phrase] [data-in]')?.textContent` |
| + p.wait(phrase+`===`+js(think[0]), "the first thinking phrase") |
| + p.check(phrase+`===`+js(think[0]), "changed before the threshold") |
| + seen := []string{think[0]} |
| + for i := 0; i < 7; i++ { |
| + skew := 4100 |
| + if i == 0 { |
| + skew = 3100 |
| + } |
| + p.check(fmt.Sprintf(`(()=>{window.__skew+=%d;return true})()`, skew), "advance the clock") |
| + p.wait(phrase+`!==`+js(seen[len(seen)-1])+` && `+js(think)+`.includes(`+phrase+`)`, fmt.Sprintf("phrase %d after the threshold", i+1)) |
| + seen = append(seen, eval[string](p, phrase)) |
| + } |
| + distinct := map[string]bool{} |
| + for i, s := range seen { |
| + distinct[s] = true |
| + if i > 0 && s == seen[i-1] { |
| + t.Fatalf("%s: the same phrase twice in a row: %v", motion, seen) |
| + } |
| + } |
| + if len(distinct) != len(think) { |
| + t.Fatalf("%s: not every phrase came round: %v", motion, seen) |
| + } |
| + // A new activity: its own phrases at once, then (only two of its |
| + // own) the thinking ones join the rotation. |
| + if err := r.runner.Send(r.ctx, "cyc-read-"+motion, wire.FrameActivity, wire.ActivityReport{TurnID: r.turn, Attempt: 1, Kind: wire.ActivityTool, Tool: wire.ToolReadFile}); err != nil { |
| + t.Fatal(err) |
| + } |
| + p.wait(phrase+`===`+js(read[0]), "the reading phrase at once") |
| + pool := append(append([]string{}, read...), think...) |
| + last := read[0] |
| + for i := 0; i < 5; i++ { |
| + p.check(`(()=>{window.__skew+=4100;return true})()`, "advance the clock") |
| + p.wait(phrase+`!==`+js(last)+` && `+js(pool)+`.includes(`+phrase+`)`, "reading cycles with the thinking phrases") |
| + last = eval[string](p, phrase) |
| + } |
| + if motion == "reduce" { |
| + p.check(`getComputedStyle(document.querySelector('[equipo-sparkle] path')).animationName==='none'`, "the mark moves under reduced motion") |
| + } |
| + p.stayed("conversation") |
| + p.stop() |
| + // The next pass starts from the thinking situation again. |
| + if err := r.runner.Send(r.ctx, "cyc-think-"+motion, wire.FrameActivity, wire.ActivityReport{TurnID: r.turn, Attempt: 1, Kind: wire.ActivityThink}); err != nil { |
| + t.Fatal(err) |
| + } |
| + } |
| +} |