oficina / equipo Public

Composer after Eleven's; attachments in the feed; Settings save in place

The composer: a round + (Photo or image, File; paste and drop on a
desktop), a pill that grows to six lines with attachment chips above the
words (progress, Remove, errors in words), and a round send arrow that
shows only with something to send. Enter sends on a keyboard, Return
starts a line on touch. The task thread takes the same pill and arrow,
without attachments. Sent images and files show inside the person's own
message as a thumbnail (full size in the page) or a file chip; the
bubbles are unchanged.

Settings (Thinking words, Prefer, Pause, quiet hours) save in the
background with a quiet Saved tick: no navigation, so the shell's slide
does not replay. The native forms stay for no script.

Browser tests at 1280 and 390, light and dark; screenshots before and
after under docs/mockups/built/2026-11-08/composer-*.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paul Campbell pushed by claude agent, operated by paul@keymail.dev 6fb9e96c85f4686db6ba5092a4a588ea29979e6c parent 599d2cb
41 files changed, +929 −46
  • docs/mockups/built/2026-11-08/composer-after-chips-1280.png binary
  • docs/mockups/built/2026-11-08/composer-after-chips-390.png binary
  • docs/mockups/built/2026-11-08/composer-after-errors-1280.png binary
  • docs/mockups/built/2026-11-08/composer-after-errors-390.png binary
  • docs/mockups/built/2026-11-08/composer-after-feed-1280.png binary
  • docs/mockups/built/2026-11-08/composer-after-feed-390.png binary
  • docs/mockups/built/2026-11-08/composer-after-full-size-1280.png binary
  • docs/mockups/built/2026-11-08/composer-after-full-size-390.png binary
  • docs/mockups/built/2026-11-08/composer-after-lines-dark-1280.png binary
  • docs/mockups/built/2026-11-08/composer-after-lines-dark-390.png binary
  • docs/mockups/built/2026-11-08/composer-after-lines-light-1280.png binary
  • docs/mockups/built/2026-11-08/composer-after-lines-light-390.png binary
  • docs/mockups/built/2026-11-08/composer-after-menu-1280.png binary
  • docs/mockups/built/2026-11-08/composer-after-menu-390.png binary
  • docs/mockups/built/2026-11-08/composer-after-rest-dark-1280.png binary
  • docs/mockups/built/2026-11-08/composer-after-rest-dark-390.png binary
  • docs/mockups/built/2026-11-08/composer-after-rest-light-1280.png binary
  • docs/mockups/built/2026-11-08/composer-after-rest-light-390.png binary
  • docs/mockups/built/2026-11-08/composer-before-1280-dark.png binary
  • docs/mockups/built/2026-11-08/composer-before-1280-light.png binary
  • docs/mockups/built/2026-11-08/composer-before-390-dark.png binary
  • docs/mockups/built/2026-11-08/composer-before-390-light.png binary
  • internal/equipo/chat_page.go +5 −3
  • internal/equipo/copy.go +24 −10
  • internal/equipo/icons/icons.go +3 −0
  • internal/equipo/render.go +13 −1
  • internal/equipo/static/chat-attach.js +244 −0
  • internal/equipo/static/chat-compose.js +30 −4
  • internal/equipo/static/chat-stream.js +66 −5
  • internal/equipo/static/equipo.css +99 −0
  • internal/equipo/static/settings.js +71 −0
  • internal/equipo/templates/chat.html +14 −4
  • internal/equipo/templates/chrome.html +1 −1
  • internal/equipo/templates/settings_hub.html +2 −1
  • internal/equipo/templates/work_parts.html +1 −1
  • internal/equipo/templates/work_task.html +9 −4
  • internal/headless/browser_attach_test.go +235 −0
  • internal/headless/browser_composer_test.go +26 −9
  • internal/thintest/housekeeping_browser_test.go +4 −2
  • internal/thintest/settings_browser_test.go +80 −0
  • internal/thintest/thinking_browser_test.go +2 −1
diff --git a/docs/mockups/built/2026-11-08/composer-after-chips-1280.png b/docs/mockups/built/2026-11-08/composer-after-chips-1280.png
new file mode 100644
index 00000000..74119d47
Binary files /dev/null and b/docs/mockups/built/2026-11-08/composer-after-chips-1280.png differ
diff --git a/docs/mockups/built/2026-11-08/composer-after-chips-390.png b/docs/mockups/built/2026-11-08/composer-after-chips-390.png
new file mode 100644
index 00000000..4debb027
Binary files /dev/null and b/docs/mockups/built/2026-11-08/composer-after-chips-390.png differ
diff --git a/docs/mockups/built/2026-11-08/composer-after-errors-1280.png b/docs/mockups/built/2026-11-08/composer-after-errors-1280.png
new file mode 100644
index 00000000..ace862e1
Binary files /dev/null and b/docs/mockups/built/2026-11-08/composer-after-errors-1280.png differ
diff --git a/docs/mockups/built/2026-11-08/composer-after-errors-390.png b/docs/mockups/built/2026-11-08/composer-after-errors-390.png
new file mode 100644
index 00000000..8a503661
Binary files /dev/null and b/docs/mockups/built/2026-11-08/composer-after-errors-390.png differ
diff --git a/docs/mockups/built/2026-11-08/composer-after-feed-1280.png b/docs/mockups/built/2026-11-08/composer-after-feed-1280.png
new file mode 100644
index 00000000..a9889c27
Binary files /dev/null and b/docs/mockups/built/2026-11-08/composer-after-feed-1280.png differ
diff --git a/docs/mockups/built/2026-11-08/composer-after-feed-390.png b/docs/mockups/built/2026-11-08/composer-after-feed-390.png
new file mode 100644
index 00000000..823313d8
Binary files /dev/null and b/docs/mockups/built/2026-11-08/composer-after-feed-390.png differ
diff --git a/docs/mockups/built/2026-11-08/composer-after-full-size-1280.png b/docs/mockups/built/2026-11-08/composer-after-full-size-1280.png
new file mode 100644
index 00000000..6a1bc448
Binary files /dev/null and b/docs/mockups/built/2026-11-08/composer-after-full-size-1280.png differ
diff --git a/docs/mockups/built/2026-11-08/composer-after-full-size-390.png b/docs/mockups/built/2026-11-08/composer-after-full-size-390.png
new file mode 100644
index 00000000..88a3c8b2
Binary files /dev/null and b/docs/mockups/built/2026-11-08/composer-after-full-size-390.png differ
diff --git a/docs/mockups/built/2026-11-08/composer-after-lines-dark-1280.png b/docs/mockups/built/2026-11-08/composer-after-lines-dark-1280.png
new file mode 100644
index 00000000..dec73feb
Binary files /dev/null and b/docs/mockups/built/2026-11-08/composer-after-lines-dark-1280.png differ
diff --git a/docs/mockups/built/2026-11-08/composer-after-lines-dark-390.png b/docs/mockups/built/2026-11-08/composer-after-lines-dark-390.png
new file mode 100644
index 00000000..2768a2ea
Binary files /dev/null and b/docs/mockups/built/2026-11-08/composer-after-lines-dark-390.png differ
diff --git a/docs/mockups/built/2026-11-08/composer-after-lines-light-1280.png b/docs/mockups/built/2026-11-08/composer-after-lines-light-1280.png
new file mode 100644
index 00000000..b44a6136
Binary files /dev/null and b/docs/mockups/built/2026-11-08/composer-after-lines-light-1280.png differ
diff --git a/docs/mockups/built/2026-11-08/composer-after-lines-light-390.png b/docs/mockups/built/2026-11-08/composer-after-lines-light-390.png
new file mode 100644
index 00000000..2d72d009
Binary files /dev/null and b/docs/mockups/built/2026-11-08/composer-after-lines-light-390.png differ
diff --git a/docs/mockups/built/2026-11-08/composer-after-menu-1280.png b/docs/mockups/built/2026-11-08/composer-after-menu-1280.png
new file mode 100644
index 00000000..0825ead5
Binary files /dev/null and b/docs/mockups/built/2026-11-08/composer-after-menu-1280.png differ
diff --git a/docs/mockups/built/2026-11-08/composer-after-menu-390.png b/docs/mockups/built/2026-11-08/composer-after-menu-390.png
new file mode 100644
index 00000000..43ab5bc2
Binary files /dev/null and b/docs/mockups/built/2026-11-08/composer-after-menu-390.png differ
diff --git a/docs/mockups/built/2026-11-08/composer-after-rest-dark-1280.png b/docs/mockups/built/2026-11-08/composer-after-rest-dark-1280.png
new file mode 100644
index 00000000..fc5a57a0
Binary files /dev/null and b/docs/mockups/built/2026-11-08/composer-after-rest-dark-1280.png differ
diff --git a/docs/mockups/built/2026-11-08/composer-after-rest-dark-390.png b/docs/mockups/built/2026-11-08/composer-after-rest-dark-390.png
new file mode 100644
index 00000000..912a136e
Binary files /dev/null and b/docs/mockups/built/2026-11-08/composer-after-rest-dark-390.png differ
diff --git a/docs/mockups/built/2026-11-08/composer-after-rest-light-1280.png b/docs/mockups/built/2026-11-08/composer-after-rest-light-1280.png
new file mode 100644
index 00000000..f4a62e40
Binary files /dev/null and b/docs/mockups/built/2026-11-08/composer-after-rest-light-1280.png differ
diff --git a/docs/mockups/built/2026-11-08/composer-after-rest-light-390.png b/docs/mockups/built/2026-11-08/composer-after-rest-light-390.png
new file mode 100644
index 00000000..174da629
Binary files /dev/null and b/docs/mockups/built/2026-11-08/composer-after-rest-light-390.png differ
diff --git a/docs/mockups/built/2026-11-08/composer-before-1280-dark.png b/docs/mockups/built/2026-11-08/composer-before-1280-dark.png
new file mode 100644
index 00000000..615d6e3c
Binary files /dev/null and b/docs/mockups/built/2026-11-08/composer-before-1280-dark.png differ
diff --git a/docs/mockups/built/2026-11-08/composer-before-1280-light.png b/docs/mockups/built/2026-11-08/composer-before-1280-light.png
new file mode 100644
index 00000000..6c73cf04
Binary files /dev/null and b/docs/mockups/built/2026-11-08/composer-before-1280-light.png differ
diff --git a/docs/mockups/built/2026-11-08/composer-before-390-dark.png b/docs/mockups/built/2026-11-08/composer-before-390-dark.png
new file mode 100644
index 00000000..b6bb79ff
Binary files /dev/null and b/docs/mockups/built/2026-11-08/composer-before-390-dark.png differ
diff --git a/docs/mockups/built/2026-11-08/composer-before-390-light.png b/docs/mockups/built/2026-11-08/composer-before-390-light.png
new file mode 100644
index 00000000..fc3695a0
Binary files /dev/null and b/docs/mockups/built/2026-11-08/composer-before-390-light.png differ
diff --git a/internal/equipo/chat_page.go b/internal/equipo/chat_page.go
index f47f6a0f..1dfbd5b4 100644
--- a/internal/equipo/chat_page.go
+++ b/internal/equipo/chat_page.go
@@ -42,8 +42,10 @@ type chatLine struct {
// waits for a connection (no thinking line, no timer).
Waiting string
ID, Text, TurnID string
- Own bool
- CreatedAt time.Time
+ // Files are what the person attached to their message.
+ Files []wire.MessageAttachment
+ Own bool
+ CreatedAt time.Time
// Receipts (what the coordinator did during the turn) come before its
// reply; Cards (what needs the person) after the message.
Receipts, Cards []chatCard
@@ -172,7 +174,7 @@ func (a *application) chatPage(w http.ResponseWriter, r *http.Request) {
view := chatView{Offline: !snap.Runner.Online, Cursor: snap.Cursor}
last := map[string]int{}
for i, m := range snap.Messages {
- view.Messages = append(view.Messages, chatLine{ID: m.ID, Text: m.Text, TurnID: m.TurnID, Own: m.Role == wire.RolePerson, CreatedAt: m.CreatedAt, Switched: switchedText(m.Switched)})
+ view.Messages = append(view.Messages, chatLine{ID: m.ID, Text: m.Text, TurnID: m.TurnID, Own: m.Role == wire.RolePerson, CreatedAt: m.CreatedAt, Switched: switchedText(m.Switched), Files: m.Attachments})
last[m.TurnID] = i
}
choices, err := a.store.Chat().ProjectChoices(ctx, address)
diff --git a/internal/equipo/copy.go b/internal/equipo/copy.go
index a170fa3b..7db8f85c 100644
--- a/internal/equipo/copy.go
+++ b/internal/equipo/copy.go
@@ -1059,18 +1059,32 @@ var pageCopy = map[string]string{
"conversation.sending": "Sending",
// COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context): conversation.retry
"conversation.retry": "Retry",
- "conversation.send_short": "Send", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context)
- "nav.queued": "queued", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context)
- "nav.switch": "switch", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context)
- "nav.idle": "idle", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context)
- "nav.waiting": "waiting", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context)
- "conversation.placeholder": "Ask for a fix, a feature, or what’s next", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context)
- "conversation.today": "Today", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context)
- "conversation.message_actions": "Message actions", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context)
- "conversation.any_project": "Any project", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context)
- "conversation.why_models": "Why these models?", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context)
+ "conversation.send_short": "Send", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context)
+ "nav.queued": "queued", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context)
+ "nav.switch": "switch", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context)
+ "nav.idle": "idle", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context)
+ "nav.waiting": "waiting", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context)
+ "conversation.placeholder": "Message", // COPY ACCEPTED FOR NOW (Paul, 2026-11-08; composer, iterate in context)
+ "conversation.today": "Today", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context)
+ "conversation.message_actions": "Message actions", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context)
+ "conversation.any_project": "Any project", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context)
+ "conversation.why_models": "Why these models?", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context)
// COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context): conversation.composer
"conversation.composer": "Message your coordinator",
+ // Composer attachments (2026-11-08). COPY ACCEPTED FOR NOW (Paul, 2026-11-08; iterate in context): chat.attach.*, api.attachment_*
+ "settings.saved": "Saved",
+ "chat.attach.add": "Attach",
+ "chat.attach.image": "Photo or image",
+ "chat.attach.file": "File",
+ "chat.attach.list": "Attachments",
+ "chat.attach.remove": "Remove %s",
+ "chat.attach.uploading": "Uploading…",
+ "chat.attach.failed": "Could not upload. Try again.",
+ "chat.attach.too_many": "At most 5 files in one message.",
+ "api.attachment_too_large": "That file is over 10 MB.",
+ "api.attachment_type": "Equipo takes images (PNG, JPEG, WebP, GIF) and text, Markdown, CSV, JSON, log and PDF files.",
+ "api.attachment_heic": "HEIC photos cannot be read yet. Share it as a JPEG and try again.",
+ "api.attachment_limit": "Too many files are waiting to send. Send or remove some first.",
// COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context): conversation.send
"conversation.send": "Send message",
// COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context): conversation.queued
diff --git a/internal/equipo/icons/icons.go b/internal/equipo/icons/icons.go
index 4ba4a341..e958bd83 100644
--- a/internal/equipo/icons/icons.go
+++ b/internal/equipo/icons/icons.go
@@ -45,6 +45,9 @@ var icons = map[string]template.HTML{
"clock": `<svg class="icon" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" viewBox="0 0 24 24"><circle cx="12" cy="12" r="10"/><polyline points="12 6 12 12 16 14"/></svg>`,
"kebab": `<svg class="icon" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" viewBox="0 0 24 24"><circle cx="12" cy="12" r="1"/><circle cx="12" cy="5" r="1"/><circle cx="12" cy="19" r="1"/></svg>`,
"menu": `<svg class="icon" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" viewBox="0 0 24 24"><path d="M4 12h16"/><path d="M4 6h16"/><path d="M4 18h16"/></svg>`,
+ "arrow-up": `<svg class="icon" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" viewBox="0 0 24 24"><path d="m5 12 7-7 7 7"/><path d="M12 19V5"/></svg>`,
+ "image": `<svg class="icon" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" viewBox="0 0 24 24"><rect width="18" height="18" x="3" y="3" rx="2" ry="2"/><circle cx="9" cy="9" r="2"/><path d="m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"/></svg>`,
+ "file-text": `<svg class="icon" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" viewBox="0 0 24 24"><path d="M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"/><path d="M14 2v4a2 2 0 0 0 2 2h4"/><path d="M10 9H8"/><path d="M16 13H8"/><path d="M16 17H8"/></svg>`,
"plus": `<svg class="icon" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" viewBox="0 0 24 24"><path d="M5 12h14"/><path d="M12 5v14"/></svg>`,
"search": `<svg class="icon" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" viewBox="0 0 24 24"><circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/></svg>`,
"external-link": `<svg class="icon" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" viewBox="0 0 24 24"><path d="M15 3h6v6"/><path d="M10 14 21 3"/><path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"/></svg>`,
diff --git a/internal/equipo/render.go b/internal/equipo/render.go
index be21b507..32761140 100644
--- a/internal/equipo/render.go
+++ b/internal/equipo/render.go
@@ -9,6 +9,7 @@ import (
"html"
"html/template"
"net/http"
+ "strconv"
"strings"
"time"
@@ -36,7 +37,7 @@ 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", "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"} },
+ Funcs(template.FuncMap{"chatMarkdown": chatmarkdown.Render, "fileSize": fileSize, "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"} },
"kindKey": func(k ProjectKind) string { return "kind." + string(k) },
"ownerKey": func(k string) string { return "owner." + k },
"roleKey": func(k Role) string { return "role." + string(k) },
@@ -134,3 +135,14 @@ func agoFormats() string {
raw, _ := json.Marshal(out)
return string(raw)
}
+
+// fileSize is a file's size in a few characters: "840 B", "12 KB", "3.4 MB".
+func fileSize(n int64) string {
+ switch {
+ case n < 1<<10:
+ return strconv.FormatInt(n, 10) + " B"
+ case n < 1<<20:
+ return strconv.FormatInt((n+512)>>10, 10) + " KB"
+ }
+ return strconv.FormatFloat(float64(n)/(1<<20), 'f', 1, 64) + " MB"
+}
diff --git a/internal/equipo/static/chat-attach.js b/internal/equipo/static/chat-attach.js
new file mode 100644
index 00000000..91da2c15
--- /dev/null
+++ b/internal/equipo/static/chat-attach.js
@@ -0,0 +1,244 @@
+// Attachments in the conversation's composer: the + and its menu (a photo
+// or image, which on a phone offers the library and the camera, or a
+// file), paste and drop on a desktop, and a chip per file above the words
+// with its upload's progress, Remove, and what went wrong in words. Each
+// file uploads at once (POST /conversation/attachments, the bytes as the
+// body); a send takes the chips that uploaded. The server decides what is
+// allowed; here only the size and HEIC are refused early, in its words.
+// Thumbnails in the feed open full size in the page.
+(function () {
+ "use strict";
+ var form = document.querySelector("#composer[equipo-composer][data-upload]");
+ if (!form || !window.XMLHttpRequest) return;
+ var box = form.querySelector("[equipo-adder]");
+ var plus = box.querySelector("[equipo-plus]");
+ var menu = box.querySelector("[equipo-add-menu]");
+ var chips = form.querySelector("[equipo-chips]");
+ var note = form.querySelector("[equipo-add-note]");
+ var input = form.querySelector("textarea");
+ var template = document.querySelector("template[equipo-chip-template]");
+ var max = Number(form.dataset.maxFiles) || 5;
+ var maxBytes = Number(form.dataset.maxBytes) || 10 << 20;
+ var items = [];
+ box.hidden = false;
+
+ // ── The + menu ───────────────────────────────────────────────────
+ function show(open, focus) {
+ menu.hidden = !open;
+ plus.setAttribute("aria-expanded", String(open));
+ if (open && focus) menu.querySelector("[role=menuitem]").focus();
+ }
+ plus.addEventListener("click", function (event) {
+ // A keyboard press (detail 0) moves focus into the menu.
+ show(menu.hidden, event.detail === 0);
+ });
+ menu.addEventListener("click", function (event) {
+ var pick = event.target.closest("[data-pick]");
+ if (!pick) return;
+ show(false);
+ box.querySelector('[data-picker="' + pick.dataset.pick + '"]').click();
+ });
+ menu.addEventListener("keydown", function (event) {
+ var all = Array.from(menu.querySelectorAll("[role=menuitem]"));
+ var at = all.indexOf(document.activeElement);
+ if (event.key === "ArrowDown" || event.key === "ArrowUp") {
+ event.preventDefault();
+ all[(at + (event.key === "ArrowDown" ? 1 : all.length - 1)) % all.length].focus();
+ } else if (event.key === "Escape") {
+ event.preventDefault();
+ show(false);
+ plus.focus();
+ } else if (event.key === "Tab") {
+ show(false);
+ }
+ });
+ document.addEventListener("click", function (event) {
+ if (!menu.hidden && !box.contains(event.target)) show(false);
+ });
+ box.querySelectorAll("[data-picker]").forEach(function (picker) {
+ picker.addEventListener("change", function () {
+ add(picker.files);
+ picker.value = "";
+ input.focus({ preventScroll: true });
+ });
+ });
+
+ // ── Chips ────────────────────────────────────────────────────────
+ function say(text) {
+ note.textContent = text || "";
+ note.hidden = !text;
+ }
+ function size(n) {
+ if (n < 1024) return n + " B";
+ if (n < 1048576) return Math.round(n / 1024) + " KB";
+ return (n / 1048576).toFixed(1) + " MB";
+ }
+ function changed() {
+ chips.hidden = items.length === 0;
+ form.dispatchEvent(new CustomEvent("equipo:changed"));
+ }
+ function add(list) {
+ say("");
+ Array.from(list || []).forEach(function (file) {
+ if (items.length >= max) {
+ say(form.dataset.tooMany);
+ return;
+ }
+ items.push(chip(file));
+ });
+ changed();
+ }
+ function heic(file) {
+ return /hei[cf]/i.test(file.type) || /\.(heic|heif|hif)$/i.test(file.name || "");
+ }
+ function chip(file) {
+ var el = template.content.firstElementChild.cloneNode(true);
+ var image = /^image\//.test(file.type) && !heic(file);
+ var name = file.name || "image";
+ var item = { el: el, file: file, name: name, kind: image ? "image" : "file", state: "uploading", done: Promise.resolve() };
+ el.dataset.kind = item.kind;
+ el.querySelector("[equipo-chip-name]").textContent = name;
+ el.querySelector("[equipo-chip-note]").textContent = form.dataset.uploading || "";
+ el.querySelector("[equipo-chip-progress]").setAttribute("aria-label", (form.dataset.uploading || "") + " " + name);
+ var remove = el.querySelector("[equipo-chip-remove]");
+ remove.setAttribute("aria-label", (form.dataset.remove || "%s").replace("%s", name));
+ remove.title = remove.getAttribute("aria-label");
+ remove.addEventListener("click", function () { drop(item); });
+ if (image) {
+ item.url = URL.createObjectURL(file);
+ var img = document.createElement("img");
+ img.src = item.url;
+ img.alt = "";
+ el.querySelector("[equipo-chip-thumb]").replaceChildren(img);
+ }
+ chips.append(el);
+ chips.hidden = false;
+ if (file.size > maxBytes) fail(item, form.dataset.tooLarge);
+ else if (heic(file)) fail(item, form.dataset.heic);
+ else upload(item);
+ return item;
+ }
+ function fail(item, words) {
+ item.state = item.el.dataset.state = "error";
+ item.el.querySelector("[equipo-chip-note]").textContent = words || form.dataset.uploadFailed;
+ item.el.title = words || form.dataset.uploadFailed;
+ }
+ function progress(item, share) {
+ var pct = Math.round(Math.max(0, Math.min(1, share)) * 100);
+ var bar = item.el.querySelector("[equipo-chip-progress]");
+ bar.setAttribute("aria-valuenow", String(pct));
+ bar.style.setProperty("--p", pct + "%");
+ }
+ function upload(item) {
+ item.done = new Promise(function (resolve) {
+ var x = new XMLHttpRequest();
+ item.xhr = x;
+ x.open("POST", form.dataset.upload);
+ x.setRequestHeader("Accept", "application/json");
+ x.setRequestHeader("Content-Type", item.file.type || "application/octet-stream");
+ x.setRequestHeader("Content-Disposition", "attachment; filename*=UTF-8''" + encodeURIComponent(item.name));
+ x.upload.onprogress = function (e) { if (e.lengthComputable) progress(item, e.loaded / e.total); };
+ x.onload = function () {
+ var body = {};
+ try { body = JSON.parse(x.responseText); } catch (_) { body = {}; }
+ if (x.status === 201 && body.id) {
+ item.meta = body;
+ item.state = item.el.dataset.state = "ready";
+ item.el.querySelector("[equipo-chip-note]").textContent = size(body.size);
+ } else {
+ fail(item, body.message);
+ }
+ changed();
+ resolve();
+ };
+ x.onerror = function () { fail(item); changed(); resolve(); };
+ x.onabort = function () { resolve(); };
+ x.send(item.file);
+ });
+ }
+ function drop(item) {
+ if (item.xhr && item.state === "uploading") item.xhr.abort();
+ if (item.url) URL.revokeObjectURL(item.url);
+ item.el.remove();
+ items = items.filter(function (i) { return i !== item; });
+ say("");
+ changed();
+ input.focus({ preventScroll: true });
+ }
+
+ // ── Paste and drop ───────────────────────────────────────────────
+ input.addEventListener("paste", function (event) {
+ var files = event.clipboardData && event.clipboardData.files;
+ if (files && files.length) {
+ event.preventDefault();
+ add(files);
+ }
+ });
+ var area = document.querySelector("[equipo-conversation]") || form;
+ function carriesFiles(event) {
+ return event.dataTransfer && Array.from(event.dataTransfer.types || []).indexOf("Files") >= 0;
+ }
+ area.addEventListener("dragover", function (event) {
+ if (!carriesFiles(event)) return;
+ event.preventDefault();
+ event.dataTransfer.dropEffect = "copy";
+ form.setAttribute("data-dropping", "");
+ });
+ area.addEventListener("dragleave", function (event) {
+ if (!event.relatedTarget || !area.contains(event.relatedTarget)) form.removeAttribute("data-dropping");
+ });
+ area.addEventListener("drop", function (event) {
+ if (!carriesFiles(event)) return;
+ event.preventDefault();
+ form.removeAttribute("data-dropping");
+ add(event.dataTransfer.files);
+ input.focus({ preventScroll: true });
+ });
+
+ // ── For a send ───────────────────────────────────────────────────
+ window.EquipoAttach = {
+ // count is the attachments a send would carry (refused ones stay out).
+ count: function () {
+ return items.filter(function (i) { return i.state !== "error"; }).length;
+ },
+ // take hands the waiting attachments to a send and clears the chips:
+ // items (with a local preview url for images) and ready, the uploaded
+ // ones' records once every upload has settled.
+ take: function () {
+ var mine = items.filter(function (i) { return i.state !== "error"; });
+ items.forEach(function (i) {
+ if (i.state === "error" && i.url) URL.revokeObjectURL(i.url);
+ });
+ items = [];
+ chips.replaceChildren();
+ say("");
+ changed();
+ var ready = Promise.all(mine.map(function (i) { return i.done; })).then(function () {
+ var out = mine.filter(function (i) { return i.state === "ready"; }).map(function (i) { return i.meta; });
+ if (out.length < mine.length) say(form.dataset.uploadFailed);
+ return out;
+ });
+ return { items: mine, ready: ready };
+ }
+ };
+
+ // ── Full size, in the page ───────────────────────────────────────
+ var viewer = null;
+ document.addEventListener("click", function (event) {
+ var link = event.target.closest && event.target.closest("[equipo-file-thumb]");
+ if (!link || event.metaKey || event.ctrlKey || event.shiftKey || !window.HTMLDialogElement) return;
+ event.preventDefault();
+ if (!viewer) {
+ viewer = document.createElement("dialog");
+ viewer.setAttribute("equipo-lightbox", "");
+ viewer.addEventListener("click", function () { viewer.close(); });
+ document.body.append(viewer);
+ }
+ var img = document.createElement("img");
+ var thumb = link.querySelector("img");
+ img.src = link.href;
+ img.alt = thumb ? thumb.alt : "";
+ viewer.replaceChildren(img);
+ viewer.showModal();
+ });
+})();
diff --git a/internal/equipo/static/chat-compose.js b/internal/equipo/static/chat-compose.js
index 9dd49298..e5594cac 100644
--- a/internal/equipo/static/chat-compose.js
+++ b/internal/equipo/static/chat-compose.js
@@ -1,12 +1,38 @@
-// A click anywhere in the compose box (its padding, the space beside
-// Send) puts the cursor in the message; the box's controls keep their
-// own clicks.
+// The composer, on the conversation and a task's thread. A click anywhere
+// in the compose box (the pill's padding, the dock around it) puts the
+// cursor in the message; the box's controls keep their own clicks. With
+// script, the send arrow shows only when there is something to send
+// (words, or an attachment that is not refused), and the message grows to
+// about six lines, then scrolls.
(function () {
"use strict";
document.addEventListener("click", function (event) {
var box = event.target.closest && event.target.closest("#chat-composer");
- if (!box || event.target.closest("button, a, select, input, textarea, summary, label, [contenteditable]")) return;
+ if (!box || event.target.closest("button, a, select, input, textarea, summary, label, [contenteditable], [equipo-chips], [equipo-add-menu]")) return;
var input = box.querySelector("textarea");
if (input && document.activeElement !== input) input.focus({ preventScroll: true });
});
+ var form = document.querySelector("#composer[equipo-composer]");
+ if (!form) return;
+ var input = form.querySelector("textarea");
+ // Script decides what can go: words, attachments or both.
+ input.required = false;
+ form.setAttribute("data-enhanced", "");
+ var sized = window.CSS && CSS.supports && CSS.supports("field-sizing", "content");
+ function grow() {
+ if (sized) return;
+ var cs = getComputedStyle(input);
+ var pad = parseFloat(cs.paddingTop) + parseFloat(cs.paddingBottom);
+ input.style.height = "auto";
+ input.style.height = Math.min(input.scrollHeight - pad, parseFloat(cs.maxHeight) || Infinity) + "px";
+ }
+ function state() {
+ var files = form.querySelectorAll("[equipo-chip]:not([data-state='error'])").length;
+ form.toggleAttribute("data-has-content", /\S/.test(input.value) || files > 0);
+ grow();
+ }
+ input.addEventListener("input", state);
+ form.addEventListener("equipo:changed", state);
+ form.addEventListener("equipo:sent", state);
+ state();
})();
diff --git a/internal/equipo/static/chat-stream.js b/internal/equipo/static/chat-stream.js
index c0b3aecf..04743fb1 100644
--- a/internal/equipo/static/chat-stream.js
+++ b/internal/equipo/static/chat-stream.js
@@ -504,6 +504,10 @@
var own = template("equipo-own-template");
own.dataset.message = v.id;
own.querySelector("[equipo-message-body]").textContent = v.text;
+ sentFiles(own, (v.attachments || []).map(function (a) {
+ var at = "/conversation/attachments/" + encodeURIComponent(a.id);
+ return { kind: a.kind, name: a.name, size: a.size, href: at, src: at + "/preview", width: a.width, height: a.height, id: a.id };
+ }));
own.querySelector("time").textContent = new Date(v.created_at).toTimeString().slice(0, 5);
var waiting = feed.querySelector("[equipo-thinking]");
feed.insertBefore(own, waiting);
@@ -590,7 +594,38 @@
feed.insertBefore(el, feed.querySelector("[equipo-thinking]"));
scroll();
}
- function post(el, text, id, extra) {
+ // sentFiles draws a message's attachments inside the person's own
+ // message, above the words: a thumbnail or a file chip.
+ function sentFiles(el, files) {
+ var box = el.querySelector("[equipo-message-files]");
+ if (!box || !files.length) return;
+ files.forEach(function (f) {
+ var a;
+ if (f.kind === "image") {
+ a = document.createElement("a");
+ a.setAttribute("equipo-file-thumb", "");
+ var img = document.createElement("img");
+ img.src = f.src;
+ img.alt = f.name;
+ if (f.width) {
+ img.width = f.width;
+ img.height = f.height;
+ }
+ a.append(img);
+ } else {
+ a = template("equipo-file-template");
+ a.querySelector("[equipo-file-name]").textContent = f.name;
+ a.querySelector("[equipo-file-size]").textContent = f.size < 1024 ? f.size + " B" : f.size < 1048576 ? Math.round(f.size / 1024) + " KB" : (f.size / 1048576).toFixed(1) + " MB";
+ }
+ a.href = f.href;
+ a.target = "_blank";
+ a.rel = "noopener";
+ if (f.id) a.dataset.attachment = f.id;
+ box.append(a);
+ });
+ box.hidden = false;
+ }
+ function post(el, text, id, extra, files) {
el.dataset.pending = "";
delete el.dataset.sendFailed;
var old = el.querySelector("[data-retry-send]");
@@ -598,6 +633,7 @@
var params = new URLSearchParams(extra || {});
params.set("body", text);
params.set("request_id", id);
+ (files || []).forEach(function (f) { params.append("attachment", f); });
fetch(form.action, { method: "POST", credentials: "same-origin", headers: { "Accept": "application/json" }, body: params })
.then(function (r) { if (!r.ok) throw new Error("send"); return r.json(); })
.then(function (sent) {
@@ -614,19 +650,26 @@
retry.setAttribute("rst-btn", "");
retry.dataset.retrySend = "";
retry.textContent = form.dataset.retry;
- retry.addEventListener("click", function () { post(el, text, id, extra); });
+ retry.addEventListener("click", function () { post(el, text, id, extra, files); });
el.querySelector("[equipo-bubble]").append(retry);
});
}
function send() {
+ // Attachments (chat-attach.js, loaded after this) belong to the
+ // conversation's composer.
+ var attach = form.hasAttribute("data-upload") ? window.EquipoAttach : null;
var text = input.value.trim();
- if (!text) return;
+ var waiting = attach ? attach.count() : 0;
+ if (!text && !waiting) return;
+ var taken = waiting ? attach.take() : null;
input.value = "";
input.focus();
var el = template("equipo-own-template");
el.dataset.message = "";
el.querySelector("[equipo-message-body]").textContent = text;
el.querySelector("time").textContent = new Date().toTimeString().slice(0, 5);
+ // The attachments show at once, from this device's copies.
+ if (taken) sentFiles(el, taken.items.map(function (i) { return { kind: i.kind, name: i.name, size: i.file.size, href: i.url || "#", src: i.url }; }));
local.add(el);
lastSend = Date.now();
place(el);
@@ -636,12 +679,30 @@
form.querySelectorAll("input[type=hidden][name]").forEach(function (i) {
if (i.name !== "request_id") extra[i.name] = i.value;
});
- post(el, text, requestID(), extra);
+ var id = requestID();
+ if (taken) {
+ // The post waits for the uploads still going; one that failed stays
+ // out (the composer says so), and nothing left to send sends nothing.
+ el.dataset.pending = "";
+ taken.ready.then(function (files) {
+ if (!files.length && !text) {
+ local.delete(el);
+ el.remove();
+ return;
+ }
+ post(el, text, id, extra, files.map(function (f) { return f.id; }));
+ });
+ } else {
+ post(el, text, id, extra);
+ }
form.dispatchEvent(new CustomEvent("equipo:sent"));
}
form.addEventListener("submit", function (event) { event.preventDefault(); send(); });
+ // Enter sends on a keyboard and Shift+Enter starts a line. On a touch
+ // screen Return starts a line and the arrow sends.
+ var touch = window.matchMedia ? matchMedia("(hover: none) and (pointer: coarse)") : null;
input.addEventListener("keydown", function (event) {
- if (event.key === "Enter" && !event.shiftKey && !event.isComposing && event.keyCode !== 229) {
+ if (event.key === "Enter" && !event.shiftKey && !event.isComposing && event.keyCode !== 229 && !(touch && touch.matches)) {
event.preventDefault();
send();
}
diff --git a/internal/equipo/static/equipo.css b/internal/equipo/static/equipo.css
index e5b29b98..f30b3977 100644
--- a/internal/equipo/static/equipo.css
+++ b/internal/equipo/static/equipo.css
@@ -983,3 +983,102 @@ a[equipo-source]:hover { color: var(--rst-text); text-decoration: underline; tex
[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); }
+
+/* ── The composer (Paul, 2026-11-08, after Eleven's): a round + on the
+ left, a pill that grows to about six lines, and inside it on the right
+ a round send arrow that shows only when there is something to send.
+ Attachments wait as chips above the words, inside the pill. Every
+ control is a 44 px target; the + and the arrow sit on the last line. */
+#composer[equipo-composer] { display: flex; align-items: flex-end; gap: var(--rst-sp-3); max-width: none; margin: 0; padding: 0; border: 0; background: transparent; cursor: default; }
+#composer[equipo-composer]:focus-within { border-color: transparent; }
+#composer[equipo-composer] [equipo-pill] { position: relative; flex: 1; min-inline-size: 0; display: flex; flex-direction: column; border: 1px solid var(--rst-line); border-radius: 1.375rem; background: var(--rst-surface); cursor: text; transition: border-color .15s ease, box-shadow .15s ease; }
+#composer[equipo-composer] [equipo-pill]:focus-within { border-color: color-mix(in oklab, var(--rst-line), var(--rst-text) 30%); }
+#composer[equipo-composer][data-dropping] [equipo-pill] { border-color: var(--rst-accent); box-shadow: 0 0 0 3px var(--rst-accent-soft); }
+#composer[equipo-composer] [equipo-pill-row] { display: flex; align-items: flex-end; min-block-size: 2.75rem; }
+#composer[equipo-composer] textarea { font: inherit; flex: 1; min-inline-size: 0; box-sizing: content-box; margin: 0; padding: .625rem .25rem .625rem 1.125rem; border: 0; background: transparent; box-shadow: none; resize: none; line-height: 1.5rem; min-block-size: 1.5rem; max-block-size: 9rem; overflow-y: auto; field-sizing: content; color: var(--rst-text); font-size: var(--rst-fs-base); }
+@media (pointer: coarse) { #composer[equipo-composer] textarea { font-size: max(1rem, 16px); } }
+#composer[equipo-composer] textarea::placeholder { color: var(--rst-text-faint); }
+/* The send arrow: a 44 px target holding a 32 px accent circle. */
+#composer[equipo-composer] [equipo-send] { position: relative; flex: none; display: grid; place-items: center; inline-size: 2.75rem; block-size: 2.75rem; margin: 0; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--rst-on-accent-fill, #fff); cursor: pointer; }
+#composer[equipo-composer] [equipo-send]::before { content: ""; position: absolute; inset: .375rem; border-radius: 50%; background: var(--rst-accent-fill, var(--rst-accent)); transition: background-color .15s ease; }
+#composer[equipo-composer] [equipo-send]:hover::before { background: var(--rst-accent-fill-hover, var(--rst-accent-strong)); }
+#composer[equipo-composer] [equipo-send] .icon { position: relative; inline-size: 1.125rem; block-size: 1.125rem; stroke-width: 2.5; margin: 0; }
+#composer[equipo-composer] [equipo-send]:focus-visible { outline: none; }
+#composer[equipo-composer] [equipo-send]:focus-visible::before { box-shadow: 0 0 0 2px var(--rst-surface), 0 0 0 4px var(--rst-focus-edge, var(--rst-accent)); }
+/* With script, the arrow waits for words or an attachment: a quick,
+ gentle scale and fade; gone from the tab order while hidden. */
+#composer[equipo-composer][data-enhanced] [equipo-send] { opacity: 1; transform: scale(1); visibility: visible; transition: opacity .14s ease-out, transform .18s cubic-bezier(.2, .9, .3, 1.2), visibility 0s; }
+#composer[equipo-composer][data-enhanced]:not([data-has-content]) [equipo-send] { opacity: 0; transform: scale(.6); visibility: hidden; pointer-events: none; transition: opacity .12s ease-in, transform .12s ease-in, visibility 0s linear .12s; }
+/* The +: a 44 px round button and its small menu, above it. */
+#composer[equipo-composer] [equipo-adder] { position: relative; flex: none; }
+#composer[equipo-composer] [equipo-adder][hidden] { display: none; }
+#composer[equipo-composer] [equipo-plus] { display: grid; place-items: center; inline-size: 2.75rem; block-size: 2.75rem; margin: 0; padding: 0; border: 1px solid var(--rst-line); border-radius: 50%; background: var(--rst-surface); color: var(--rst-text-muted); cursor: pointer; transition: background-color .15s ease, color .15s ease, transform .2s ease; }
+#composer[equipo-composer] [equipo-plus]:hover { background: var(--rst-surface-2); color: var(--rst-text); }
+#composer[equipo-composer] [equipo-plus][aria-expanded="true"] { color: var(--rst-text); background: var(--rst-surface-2); }
+#composer[equipo-composer] [equipo-plus][aria-expanded="true"] .icon { transform: rotate(45deg); }
+#composer[equipo-composer] [equipo-plus] .icon { inline-size: 1.25rem; block-size: 1.25rem; margin: 0; transition: transform .2s ease; }
+#composer[equipo-composer] [equipo-add-menu] { position: absolute; inset-inline-start: 0; inset-block-end: calc(100% + var(--rst-sp-2)); z-index: 5; display: grid; min-inline-size: 13rem; padding: var(--rst-sp-1); border: 1px solid var(--rst-line); border-radius: calc(2 * var(--rst-radius)); background: var(--rst-surface); box-shadow: var(--rst-shadow-pop); }
+#composer[equipo-composer] [equipo-add-menu][hidden] { display: none; }
+#composer[equipo-composer] [equipo-add-menu] button { display: flex; align-items: center; gap: var(--rst-sp-3); min-block-size: 2.75rem; margin: 0; padding: 0 var(--rst-sp-3); border: 0; border-radius: var(--rst-radius); background: transparent; color: var(--rst-text); font: inherit; font-size: var(--rst-fs-sm); text-align: start; cursor: pointer; }
+#composer[equipo-composer] [equipo-add-menu] button:hover, #composer[equipo-composer] [equipo-add-menu] button:focus-visible { background: var(--rst-tint-hover, var(--rst-surface-2)); outline: none; }
+#composer[equipo-composer] [equipo-add-menu] .icon { inline-size: 1.125rem; block-size: 1.125rem; margin: 0; color: var(--rst-text-muted); }
+/* Attachments waiting to go: chips above the words, inside the pill. */
+#composer[equipo-composer] [equipo-chips] { display: flex; flex-wrap: wrap; gap: var(--rst-sp-2); margin: 0; padding: var(--rst-sp-2) var(--rst-sp-2) 0; list-style: none; }
+#composer[equipo-composer] [equipo-chips][hidden], #composer[equipo-composer] [equipo-add-note][hidden] { display: none; }
+[equipo-chip] { position: relative; flex: none; display: flex; align-items: center; gap: var(--rst-sp-2); block-size: 3.5rem; max-inline-size: min(12.5rem, calc(100% - 4rem)); padding: 0 2.25rem 0 .375rem; border: 1px solid var(--rst-line); border-radius: .875rem; background: var(--rst-surface-2); font-size: var(--rst-fs-xs); overflow: hidden; }
+[equipo-chip] [equipo-chip-thumb] { flex: none; display: grid; place-items: center; inline-size: 2.75rem; block-size: 2.75rem; border-radius: .625rem; background: var(--rst-surface); color: var(--rst-text-muted); overflow: hidden; }
+[equipo-chip] [equipo-chip-thumb] img { inline-size: 100%; block-size: 100%; object-fit: cover; }
+[equipo-chip] [equipo-chip-thumb] .icon { inline-size: 1.25rem; block-size: 1.25rem; margin: 0; }
+[equipo-chip] [equipo-chip-text] { display: grid; min-inline-size: 0; line-height: 1.3; }
+[equipo-chip] [equipo-chip-name] { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--rst-text); }
+[equipo-chip] [equipo-chip-note] { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--rst-text-muted); }
+/* An image that uploads well is a thumbnail alone. */
+[equipo-chip][data-kind="image"]:not([data-state="error"]) { inline-size: 3.5rem; padding: 0; border-radius: .875rem; }
+[equipo-chip][data-kind="image"]:not([data-state="error"]) [equipo-chip-thumb] { inline-size: 100%; block-size: 100%; border-radius: 0; }
+[equipo-chip][data-kind="image"]:not([data-state="error"]) [equipo-chip-text] { position: absolute; inline-size: 1px; block-size: 1px; overflow: hidden; clip-path: inset(50%); }
+[equipo-chip][data-state="error"] { border-color: color-mix(in oklab, var(--rst-tone-negative-fg) 45%, var(--rst-line)); background: var(--rst-tone-negative-bg); }
+[equipo-chip][data-state="error"] [equipo-chip-note] { color: var(--rst-tone-negative-fg); white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
+[equipo-chip][data-state="error"] { block-size: auto; min-block-size: 3.5rem; padding-block: .25rem; }
+/* Upload progress: a thin bar along the chip's foot. */
+[equipo-chip] [equipo-chip-progress] { position: absolute; inset-inline: .5rem; inset-block-end: .3rem; block-size: 3px; border-radius: 2px; background: color-mix(in oklab, var(--rst-text) 15%, transparent); overflow: hidden; }
+[equipo-chip] [equipo-chip-progress] i { display: block; block-size: 100%; inline-size: var(--p, 0%); background: var(--rst-accent); transition: inline-size .2s ease; }
+[equipo-chip]:not([data-state="uploading"]) [equipo-chip-progress] { display: none; }
+[equipo-chip][data-state="uploading"] [equipo-chip-thumb] img { opacity: .55; }
+/* Remove: a 28 px round x in the chip's corner, a 44 px reach on touch. */
+#composer [equipo-chip] [equipo-chip-remove] { position: absolute; inset-block-start: .25rem; inset-inline-end: .25rem; display: grid; place-items: center; inline-size: 1.5rem; block-size: 1.5rem; margin: 0; padding: 0; border: 0; border-radius: 50%; background: color-mix(in oklab, var(--rst-text) 70%, transparent); color: var(--rst-surface); cursor: pointer; }
+#composer [equipo-chip] [equipo-chip-remove]::after { content: ""; position: absolute; inset: -.625rem; }
+#composer [equipo-chip] [equipo-chip-remove] .icon { inline-size: .875rem; block-size: .875rem; stroke-width: 3; margin: 0; }
+#composer[equipo-composer] [equipo-add-note] { margin: var(--rst-sp-1) var(--rst-sp-4) 0; color: var(--rst-tone-negative-fg); font-size: var(--rst-fs-xs); }
+/* The task thread's composer: the same pill, its "Asking" line below. */
+#composer[equipo-composer]:has([equipo-composer-tools]) { flex-wrap: wrap; }
+#composer[equipo-composer] [equipo-composer-tools] { flex-basis: 100%; padding-inline: var(--rst-sp-4); }
+@media (prefers-reduced-motion: reduce) {
+ #composer[equipo-composer][data-enhanced] [equipo-send], #composer[equipo-composer][data-enhanced]:not([data-has-content]) [equipo-send], #composer[equipo-composer] [equipo-plus], #composer[equipo-composer] [equipo-plus] .icon, #composer[equipo-composer] [equipo-pill], [equipo-chip] [equipo-chip-progress] i { transition: none; }
+ #composer[equipo-composer][data-enhanced]:not([data-has-content]) [equipo-send] { transform: none; }
+}
+
+/* Sent attachments, inside the person's own message as it is: a
+ thumbnail (tap for full size) or a file chip, above the words; a
+ message with no words shows no empty bubble. */
+[equipo-message-files] { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--rst-sp-2); margin-block-end: var(--rst-sp-1); }
+[equipo-message-files][hidden] { display: none; }
+[equipo-file-thumb] { display: block; line-height: 0; border-radius: calc(2 * var(--rst-radius)); overflow: hidden; border: 1px solid var(--rst-line); background: var(--rst-surface-2); }
+[equipo-file-thumb] img { display: block; inline-size: auto; block-size: auto; min-inline-size: 4rem; min-block-size: 4rem; max-inline-size: min(16rem, 60vw); max-block-size: 18rem; object-fit: cover; }
+[equipo-file-thumb]:focus-visible { outline: 2px solid var(--rst-focus-edge, var(--rst-accent)); outline-offset: 2px; }
+[equipo-file-chip] { display: inline-flex; align-items: center; gap: var(--rst-sp-2); max-inline-size: 16rem; min-block-size: 2.75rem; padding: 0 var(--rst-sp-3); border: 1px solid var(--rst-line); border-radius: calc(2 * var(--rst-radius)); background: var(--rst-surface); color: var(--rst-text); font-size: var(--rst-fs-sm); text-decoration: none; }
+[equipo-file-chip]:hover { background: var(--rst-surface-2); }
+[equipo-file-chip] .icon { flex: none; inline-size: 1.125rem; block-size: 1.125rem; margin: 0; color: var(--rst-text-muted); }
+[equipo-file-chip] [equipo-file-name] { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
+[equipo-file-chip] [equipo-file-size] { flex: none; color: var(--rst-text-muted); font-size: var(--rst-fs-xs); }
+[equipo-message="own"]:has([equipo-message-files]:not([hidden])) [equipo-bubble]:has(> [equipo-message-body]:empty):not(:has([data-retry-send])) { display: none; }
+/* Full size, in the page: the image on a dimmed backdrop; tap or Escape. */
+[equipo-lightbox] { max-inline-size: 100vw; max-block-size: 100dvh; inline-size: 100vw; block-size: 100dvh; margin: 0; padding: 0; border: 0; background: transparent; display: grid; place-items: center; }
+[equipo-lightbox]:not([open]) { display: none; }
+[equipo-lightbox]::backdrop { background: rgb(0 0 0 / .82); }
+[equipo-lightbox] img { max-inline-size: calc(100vw - 2rem); max-block-size: calc(100dvh - 2rem); object-fit: contain; border-radius: var(--rst-radius); }
+/* Settings saved in the background: a quiet tick by the heading. */
+[equipo-saved-tick] { display: inline-flex; align-items: center; gap: .25em; margin-inline-start: var(--rst-sp-3); color: var(--rst-tone-positive-fg); font-size: var(--rst-fs-xs); font-weight: 500; vertical-align: middle; opacity: 0; transition: opacity .2s ease; }
+[equipo-saved-tick][data-shown]:not([data-gone]) { opacity: 1; }
+[equipo-saved-tick] .icon { inline-size: 1em; block-size: 1em; margin: 0; }
+[data-settings-live] [aria-busy="true"] form, [data-settings-live][aria-busy="true"] form { opacity: .7; }
+@media (prefers-reduced-motion: reduce) { [equipo-saved-tick] { transition: none; } }
diff --git a/internal/equipo/static/settings.js b/internal/equipo/static/settings.js
new file mode 100644
index 00000000..86166cda
--- /dev/null
+++ b/internal/equipo/static/settings.js
@@ -0,0 +1,71 @@
+// Settings save in the background (Paul: choosing an option made the
+// sliding nav play again, because each change posted and came back to
+// the page). A change posts with fetch, the page is read again, and only
+// what changed is put back in place (the Prefer control, the Housekeeping
+// section, a form's revision), with a quiet "Saved" tick by the section's
+// heading. No navigation, no reload. Without script the forms post as
+// before.
+(function () {
+ "use strict";
+ var root = document.querySelector("[data-settings-live]");
+ if (!root || !window.fetch) return;
+ var swaps = ["[equipo-conn-prefer]", "[data-hk-settings]"];
+ var template = document.querySelector("template[equipo-saved-template]");
+ root.addEventListener("submit", function (event) {
+ var form = event.target;
+ if (!form.matches("form[method=post]")) return;
+ event.preventDefault();
+ save(form, event.submitter);
+ });
+ function save(form, submitter) {
+ var body = new URLSearchParams(new FormData(form, submitter || undefined));
+ var section = form.closest("[equipo-settings-section]") || root;
+ section.setAttribute("aria-busy", "true");
+ fetch(form.action, { method: "POST", credentials: "same-origin", headers: { "Accept": "application/json" }, body: body })
+ .then(function (r) {
+ if (!r.ok) throw new Error("save");
+ return fetch(location.pathname + location.search, { credentials: "same-origin", headers: { "Accept": "text/html" } });
+ })
+ .then(function (r) {
+ if (!r.ok) throw new Error("read");
+ return r.text();
+ })
+ .then(function (html) {
+ refresh(form, new DOMParser().parseFromString(html, "text/html"));
+ section.removeAttribute("aria-busy");
+ tick(section);
+ })
+ .catch(function () {
+ // The server's own answer, as without script.
+ section.removeAttribute("aria-busy");
+ HTMLFormElement.prototype.submit.call(form);
+ });
+ }
+ // refresh puts back the part of the page the change touched.
+ function refresh(form, doc) {
+ for (var i = 0; i < swaps.length; i++) {
+ var mine = form.closest(swaps[i]), fresh = doc.querySelector(swaps[i]);
+ if (mine && fresh) {
+ mine.replaceWith(document.importNode(fresh, true));
+ return;
+ }
+ }
+ // A form that stays (Thinking words): its revision moves on.
+ var next = doc.querySelector('form[action="' + form.getAttribute("action") + '"] input[name=revision]');
+ var mine = form.querySelector("input[name=revision]");
+ if (next && mine) mine.value = next.value;
+ }
+ function tick(section) {
+ if (!template) return;
+ var head = section.querySelector("h2, h1") || section;
+ var t = head.querySelector("[equipo-saved-tick]");
+ if (!t) {
+ t = template.content.firstElementChild.cloneNode(true);
+ head.append(t);
+ }
+ t.removeAttribute("data-gone");
+ t.setAttribute("data-shown", "");
+ clearTimeout(t.timer);
+ t.timer = setTimeout(function () { t.setAttribute("data-gone", ""); }, 2400);
+ }
+})();
diff --git a/internal/equipo/templates/chat.html b/internal/equipo/templates/chat.html
index 25acd1e7..7aa406db 100644
--- a/internal/equipo/templates/chat.html
+++ b/internal/equipo/templates/chat.html
@@ -10,6 +10,7 @@
{{else if eq .Kind "access"}}<p equipo-card-line>{{.Line}}</p>{{if .Open}}<details equipo-grant><summary rst-btn>{{copy "chat.card.grant"}}</summary><p>{{copy "chat.card.grant_how"}}</p><code>amadan agent grant {{.Agent}} {{.Namespace}}</code><form method="post" action="/conversation/cards/{{.ID}}/answer" data-card-form><input type="hidden" name="revision" value="{{.Revision}}"><button rst-btn name="choice" value="check" type="submit" data-grant-check>{{copy "chat.card.grant_check"}}</button></form></details>{{end}}
{{end}}</li>{{end}}
{{define "work-task-receipt"}}{{with .Task}}<p equipo-card-line>{{icon "check-circle"}}<span><a href="/tasks/{{.ID}}">{{.Title}}</a></span><span equipo-stage data-stage="{{.Stage}}" data-needs="{{.NeedsYou}}">{{.StageLine}}</span></p>{{if and .Pushed (not .MergedLine)}}<p equipo-card-note data-pushed><span>{{.Pushed}}</span><a href="{{.URL}}" rel="noopener" target="_blank" data-open-amadan>{{copy "work.open"}}</a></p>{{end}}{{if or .ChecksLine .ReviewLine}}<p equipo-card-note data-judged>{{with .ChecksLine}}<span data-checks>{{.}}</span>{{end}}{{with .ReviewLine}}<span data-verdict>{{.}}</span>{{end}}</p>{{end}}{{if .MergedLine}}<p equipo-card-note data-merged><span>{{.MergedLine}}</span><a href="{{.RepoURL}}" rel="noopener" target="_blank" data-open-amadan>{{copy "work.open"}}</a></p>{{end}}{{end}}{{if .Open}}<button type="button" equipo-receipt-more aria-expanded="false" aria-controls="acts-{{.ID}}" aria-label="{{copy "chat.card.more"}}">⋯</button><span equipo-receipt-actions id="acts-{{.ID}}">{{template "work-task-actions" .Task}}</span>{{end}}{{end}}
+{{define "message-files"}}{{with .}}<div equipo-message-files>{{range .}}{{if eq .Kind "image"}}<a equipo-file-thumb href="/conversation/attachments/{{.ID}}" target="_blank" rel="noopener" data-attachment="{{.ID}}"><img src="/conversation/attachments/{{.ID}}/preview" alt="{{.Name}}"{{if .Width}} width="{{.Width}}" height="{{.Height}}"{{end}} loading="lazy" decoding="async"></a>{{else}}<a equipo-file-chip href="/conversation/attachments/{{.ID}}" target="_blank" rel="noopener" data-attachment="{{.ID}}">{{icon "file-text"}}<span equipo-file-name>{{.Name}}</span><span equipo-file-size>{{fileSize .Size}}</span></a>{{end}}{{end}}</div>{{end}}{{end}}
{{define "content"}}
<div equipo-conversation data-chat-stream data-thinking-set="{{.ThinkingSet}}" data-thinking-words="{{.ThinkingWords}}" data-cursor="{{.Chat.Cursor}}" data-person="{{.Address}}" data-elapsed="{{copy "chat.elapsed"}}" data-moving-in="{{copy "chat.moving_in"}}" data-exploring="{{copy "chat.exploring"}}">
<header equipo-chat-header><h1>{{copy "conversation.title"}}</h1><a href="/conversation/notebook" equipo-header-button aria-label="{{copy "chat.notebook.link"}}" title="{{copy "chat.notebook.link"}}">{{icon "notebook"}}</a><a href="/housekeeping" equipo-header-button aria-label="{{copy "chat.housekeeping.link"}}" title="{{copy "chat.housekeeping.link"}}" data-housekeeping-link>{{icon "list-checks"}}</a><a href="/conversation/connections" equipo-header-button aria-label="{{copy "chat.connections.title"}}" title="{{copy "chat.connections.title"}}" data-connections-link>{{icon "plug"}}</a></header>
@@ -17,7 +18,9 @@
<div equipo-scroll tabindex="0" role="region" aria-label="{{copy "conversation.title"}}">
<section id="conversation-feed">
<template equipo-message-template><li equipo-message="incoming" data-message=""><div equipo-message-meta><strong>{{icon "message-circle"}}{{copy "conversation.coordinator"}}</strong><time></time></div><div equipo-bubble><div equipo-message-body equipo-chat-text></div></div></li></template>
-<template equipo-own-template><li equipo-message="own" data-message=""><div equipo-message-meta><strong equipo-visually-hidden>{{.Address}}</strong><time></time></div><div equipo-bubble><p equipo-message-body></p></div></li></template>
+<template equipo-own-template><li equipo-message="own" data-message=""><div equipo-message-meta><strong equipo-visually-hidden>{{.Address}}</strong><time></time></div><div equipo-message-files hidden></div><div equipo-bubble><p equipo-message-body></p></div></li></template>
+<template equipo-file-template><a equipo-file-chip href="" target="_blank" rel="noopener" data-attachment="">{{icon "file-text"}}<span equipo-file-name></span><span equipo-file-size></span></a></template>
+<template equipo-chip-template><li equipo-chip data-state="uploading"><span equipo-chip-thumb>{{icon "file-text"}}</span><span equipo-chip-text><span equipo-chip-name></span><span equipo-chip-note></span></span><span equipo-chip-progress role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="0"><i></i></span><button type="button" equipo-chip-remove>{{icon "x"}}</button></li></template>
<template equipo-thinking-template><li equipo-message="incoming" equipo-thinking data-turn="" data-started="" 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>{{copy "chat.activity.thinking"}}</span><span equipo-activity-sep aria-hidden="true">·</span><span equipo-elapsed></span></p></div></li></template>
<template equipo-ended-template><li equipo-system-note data-ended=""><p></p></li></template>
<ol equipo-feed>
@@ -26,7 +29,7 @@
{{range .Receipts}}{{template "chat-card" .}}{{end}}
<li equipo-message="{{if .Own}}own{{else}}incoming{{end}}" data-message="{{.ID}}" data-turn-id="{{.TurnID}}">
<div equipo-message-meta><strong{{if .Own}} equipo-visually-hidden{{end}}>{{if .Own}}{{$.Address}}{{else}}{{icon "message-circle"}}{{copy "conversation.coordinator"}}{{end}}</strong><time datetime="{{.CreatedAt.Format "2006-01-02T15:04:05Z07:00"}}">{{.CreatedAt.Format "15:04"}}</time></div>
-<div equipo-bubble>{{if .Own}}<p equipo-message-body>{{.Text}}</p>{{else}}<div equipo-message-body equipo-markdown>{{chatMarkdown .Text}}</div>{{end}}</div>
+{{if .Own}}{{template "message-files" .Files}}{{end}}<div equipo-bubble>{{if .Own}}<p equipo-message-body>{{.Text}}</p>{{else}}<div equipo-message-body equipo-markdown>{{chatMarkdown .Text}}</div>{{end}}</div>
{{with .Waiting}}<p equipo-card-note data-waiting-connection>{{.}}</p>{{end}}
{{with .Switched}}<p equipo-card-note data-switched>{{.}}</p>{{end}}
</li>
@@ -40,10 +43,17 @@
</div>
<div equipo-announcements role="status" aria-live="polite" aria-atomic="false"></div>
<div id="chat-composer">
-<form id="composer" equipo-form method="post" action="/conversation" data-failed="{{copy "chat.failed"}}" data-retry="{{copy "conversation.retry"}}" data-cancelled="{{copy "chat.cancelled"}}">
+<form id="composer" equipo-form equipo-composer method="post" action="/conversation" data-failed="{{copy "chat.failed"}}" data-retry="{{copy "conversation.retry"}}" data-cancelled="{{copy "chat.cancelled"}}" data-upload="/conversation/attachments" data-max-files="5" data-max-bytes="10485760" data-too-large="{{copy "api.attachment_too_large"}}" data-heic="{{copy "api.attachment_heic"}}" data-too-many="{{copy "chat.attach.too_many"}}" data-upload-failed="{{copy "chat.attach.failed"}}" data-uploading="{{copy "chat.attach.uploading"}}" data-remove="{{copy "chat.attach.remove"}}">
<input type="hidden" name="request_id" value="{{.RequestID}}">
+<div equipo-adder hidden><button type="button" equipo-plus aria-label="{{copy "chat.attach.add"}}" title="{{copy "chat.attach.add"}}" aria-haspopup="menu" aria-expanded="false" aria-controls="attach-menu">{{icon "plus"}}</button><div equipo-add-menu id="attach-menu" role="menu" aria-label="{{copy "chat.attach.add"}}" hidden><button type="button" role="menuitem" data-pick="image">{{icon "image"}}<span>{{copy "chat.attach.image"}}</span></button><button type="button" role="menuitem" data-pick="file">{{icon "file-text"}}<span>{{copy "chat.attach.file"}}</span></button></div><input type="file" data-picker="image" accept="image/*" multiple tabindex="-1" aria-hidden="true" equipo-visually-hidden><input type="file" data-picker="file" accept=".txt,.md,.markdown,.csv,.json,.log,.pdf,text/plain,text/markdown,text/csv,application/json,application/pdf" multiple tabindex="-1" aria-hidden="true" equipo-visually-hidden></div>
+<div equipo-pill>
+<ul equipo-chips aria-label="{{copy "chat.attach.list"}}" hidden></ul>
+<p equipo-add-note role="alert" hidden></p>
+<div equipo-pill-row>
<textarea id="chat-body" rst-input name="body" required maxlength="16384" rows="1" aria-label="{{copy "conversation.composer"}}" placeholder="{{copy "conversation.placeholder"}}"></textarea>
-<div equipo-composer-tools><button rst-btn="primary" type="submit">{{copy "conversation.send_short"}}</button></div>
+<button type="submit" equipo-send aria-label="{{copy "conversation.send_short"}}" title="{{copy "conversation.send_short"}}">{{icon "arrow-up"}}</button>
+</div>
+</div>
</form>
</div>
</div>
diff --git a/internal/equipo/templates/chrome.html b/internal/equipo/templates/chrome.html
index 480697f6..70301bf5 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 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 "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><script defer src="{{asset "static/settings.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><script defer src="{{asset "static/chat-attach.js"}}"></script>{{end}}{{else if eq .Key "conversation"}}<script defer blocking="render" src="{{asset "static/chat-navigation.js"}}"></script><script defer src="{{asset "static/chat.js"}}"></script><script defer src="{{asset "static/chat-send.js"}}"></script>{{end}}{{end}}
{{define "up"}}/work{{if .Key}}#nav-{{.Key}}{{end}}{{end}}
{{define "up-label"}}{{.TeamName}}{{end}}
{{define "brand"}}<a rst-shell-brand href="/work">{{icon "users"}}{{.TeamName}}</a>{{end}}
diff --git a/internal/equipo/templates/settings_hub.html b/internal/equipo/templates/settings_hub.html
index 502d8b39..378936da 100644
--- a/internal/equipo/templates/settings_hub.html
+++ b/internal/equipo/templates/settings_hub.html
@@ -1,6 +1,7 @@
{{define "title"}}{{copy "nav.settings"}}{{end}}
{{define "content"}}
-<section equipo-inner equipo-settings>
+<section equipo-inner equipo-settings data-settings-live>
+<template equipo-saved-template><span equipo-saved-tick role="status">{{icon "check"}}<span>{{copy "settings.saved"}}</span></span></template>
<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")}}
diff --git a/internal/equipo/templates/work_parts.html b/internal/equipo/templates/work_parts.html
index 002a3572..92231f92 100644
--- a/internal/equipo/templates/work_parts.html
+++ b/internal/equipo/templates/work_parts.html
@@ -33,7 +33,7 @@
<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}}">
+{{define "thinking-form"}}{{with .Thinking}}<div equipo-thinking-words data-thinking-words="{{.JSON}}"{{if not $.From}} data-settings-live{{end}}>{{if not $.From}}<template equipo-saved-template><span equipo-saved-tick role="status">{{icon "check"}}<span>{{copy "settings.saved"}}</span></span></template>{{end}}
{{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}}
diff --git a/internal/equipo/templates/work_task.html b/internal/equipo/templates/work_task.html
index 8cfb242f..4123a317 100644
--- a/internal/equipo/templates/work_task.html
+++ b/internal/equipo/templates/work_task.html
@@ -51,15 +51,20 @@
{{end}}{{end}}{{else}}<li data-empty-state="work.thread_empty">{{copy "work.thread_empty"}}</li>{{end}}
</ol>
<div id="chat-composer">
-{{if $thread.Ask}}{{$first := index $thread.Choices 0}}<form id="composer" equipo-form method="post" action="/tasks/{{.ID}}/ask" data-retry="{{copy "conversation.retry"}}">
+{{if $thread.Ask}}{{$first := index $thread.Choices 0}}<form id="composer" equipo-form equipo-composer method="post" action="/tasks/{{.ID}}/ask" data-retry="{{copy "conversation.retry"}}">
<input type="hidden" name="request_id" value="{{$.RequestID}}">
<input type="hidden" name="specialist" value="" data-ask-specialist>
+<div equipo-pill><div equipo-pill-row>
<textarea id="chat-body" rst-input name="body" required maxlength="4000" rows="1" aria-label="{{printf (copy "work.ask.placeholder") (index $thread.Names $first)}}" placeholder="{{printf (copy "work.ask.placeholder") (index $thread.Names $first)}}"></textarea>
-<div equipo-composer-tools><p equipo-ask-target data-choices="{{range $i, $c := $thread.Choices}}{{if $i}},{{end}}{{$c}}{{end}}"><span data-ask-line>{{printf (copy "work.ask.target") (index $thread.Names $first)}}</span>{{if gt (len $thread.Choices) 1}}<span aria-hidden="true" data-ask-sep hidden> · </span><button type="button" equipo-link data-ask-change hidden>{{copy "work.ask.change"}}</button>{{end}}</p><button rst-btn="primary" type="submit">{{copy "conversation.send_short"}}</button></div>
-</form>{{else}}<form id="composer" equipo-form method="post" action="/tasks/{{.ID}}/notes" data-retry="{{copy "conversation.retry"}}">
+<button type="submit" equipo-send aria-label="{{copy "conversation.send_short"}}" title="{{copy "conversation.send_short"}}">{{icon "arrow-up"}}</button>
+</div></div>
+<div equipo-composer-tools><p equipo-ask-target data-choices="{{range $i, $c := $thread.Choices}}{{if $i}},{{end}}{{$c}}{{end}}"><span data-ask-line>{{printf (copy "work.ask.target") (index $thread.Names $first)}}</span>{{if gt (len $thread.Choices) 1}}<span aria-hidden="true" data-ask-sep hidden> · </span><button type="button" equipo-link data-ask-change hidden>{{copy "work.ask.change"}}</button>{{end}}</p></div>
+</form>{{else}}<form id="composer" equipo-form equipo-composer method="post" action="/tasks/{{.ID}}/notes" data-retry="{{copy "conversation.retry"}}">
<input type="hidden" name="request_id" value="{{$.RequestID}}">
+<div equipo-pill><div equipo-pill-row>
<textarea id="chat-body" rst-input name="body" required maxlength="4000" rows="1" aria-label="{{copy "work.note_add"}}" placeholder="{{copy "work.note_add"}}"></textarea>
-<div equipo-composer-tools><button rst-btn="primary" type="submit">{{copy "conversation.send_short"}}</button></div>
+<button type="submit" equipo-send aria-label="{{copy "conversation.send_short"}}" title="{{copy "conversation.send_short"}}">{{icon "arrow-up"}}</button>
+</div></div>
</form>{{end}}
</div>
</section></div></div>{{end}}
diff --git a/internal/headless/browser_attach_test.go b/internal/headless/browser_attach_test.go
new file mode 100644
index 00000000..3f952538
--- /dev/null
+++ b/internal/headless/browser_attach_test.go
@@ -0,0 +1,235 @@
+//go:build browser
+
+package headless
+
+import (
+ "bytes"
+ "context"
+ "encoding/base64"
+ "os"
+ "path/filepath"
+ "strconv"
+ "testing"
+
+ "amadan.net/oficina/equipo/internal/attach/attachtest"
+ "amadan.net/oficina/equipo/internal/browsertest"
+ "github.com/chromedp/cdproto/cdp"
+ "github.com/chromedp/cdproto/emulation"
+ "github.com/chromedp/chromedp"
+)
+
+// The send arrow, by its computed style.
+const (
+ sendShown = `(()=>{const c=getComputedStyle(document.querySelector('[equipo-send]'));return c.visibility==='visible'&&c.opacity==='1'})()`
+ sendHidden = `(()=>{const c=getComputedStyle(document.querySelector('[equipo-send]'));return c.visibility==='hidden'&&c.opacity==='0'})()`
+)
+
+func typeText(text string) string {
+ return `(()=>{const b=document.querySelector('#chat-body');b.focus();b.value=` + jsonString(text) + `;b.dispatchEvent(new Event('input',{bubbles:true}));return true})()`
+}
+
+// TestBrowserComposer: Paul, 2026-11-08, after Eleven's composer. At 1280
+// with a mouse and 390 on touch, light and dark: the send arrow shows only
+// with words or an attachment; Enter and Shift+Enter on a keyboard, Return
+// a new line on touch; the + menu (by click and by keyboard); a picked
+// image becomes a chip, then a thumbnail in the feed that reaches the
+// coordinator and opens full size; Remove; a size error and a type error
+// in words; paste and drop on a desktop; 44 px targets; reduced motion.
+// Set EQUIPO_SCREENSHOTS to a directory to save composer-after-*.png.
+func TestBrowserComposer(t *testing.T) {
+ _, inst, r := localEnv(t)
+ r.start(t)
+ c := inst.Cookie()
+ dir := t.TempDir()
+ write := func(name string, data []byte) string {
+ path := filepath.Join(dir, name)
+ if err := os.WriteFile(path, data, 0600); err != nil {
+ t.Fatal(err)
+ }
+ return path
+ }
+ screen := write("screen.png", attachtest.PNG(120, 80))
+ notes := write("notes.md", []byte("# Notes\n\nStep three fails.\n"))
+ big := write("big.log", bytes.Repeat([]byte("x"), 10<<20+1))
+ binary := write("tool.bin", []byte{0x4d, 0x5a, 0, 1, 2, 3})
+ small := base64.StdEncoding.EncodeToString(attachtest.PNG(8, 8))
+ shots := os.Getenv("EQUIPO_SCREENSHOTS")
+ for _, tc := range []struct {
+ width, height int64
+ touch bool
+ }{{1280, 900, false}, {390, 844, true}} {
+ p := openPage(t, inst.URL, c.Name, c.Value, tc.width, tc.height, !tc.touch)
+ at := strconv.FormatInt(tc.width, 10)
+ if tc.touch {
+ p.run(chromedp.Func(func(ctx context.Context, target *chromedp.Target) error {
+ _, err := cdp.Call(ctx, target, emulation.SetTouchEmulationEnabled, emulation.SetTouchEmulationEnabledParams{Enabled: true, MaxTouchPoints: 5})
+ return err
+ }))
+ }
+ shot := func(name string) {
+ t.Helper()
+ if shots == "" {
+ return
+ }
+ var raw []byte
+ p.run(chromedp.Func(func(ctx context.Context, target *chromedp.Target) error {
+ var err error
+ raw, err = chromedp.CaptureScreenshot()(ctx, target)
+ return err
+ }))
+ if err := os.WriteFile(filepath.Join(shots, "composer-after-"+name+"-"+at+".png"), raw, 0644); err != nil {
+ t.Fatal(err)
+ }
+ }
+ pick := func(which, path string) {
+ t.Helper()
+ p.run(chromedp.SetUploadFiles(chromedp.CSS(`[data-picker="`+which+`"]`), []string{path}))
+ }
+ chip := func(state string) string {
+ return `document.querySelector('[equipo-chip][data-state="` + state + `"]')`
+ }
+ own := `document.querySelectorAll('[equipo-message="own"]').length`
+
+ // The deferred scripts have run: the + is shown, the arrow managed.
+ p.run(browsertest.Wait(`!!document.querySelector('#composer[data-enhanced]') && !document.querySelector('[equipo-adder]').hidden && !!window.EquipoAttach`))
+ // Targets: the + and the arrow are 44 px (by layout: the hidden arrow
+ // is scaled down); the placeholder is short.
+ var sizes string
+ p.run(chromedp.Func(func(ctx context.Context, target *chromedp.Target) error {
+ var err error
+ sizes, err = chromedp.Evaluate[string](`(()=>{const a=document.querySelector('[equipo-plus]'),b=document.querySelector('[equipo-send]');return [a.offsetWidth,a.offsetHeight,b.offsetWidth,b.offsetHeight,document.querySelector('#chat-body').placeholder].join(' ')})()`)(ctx, target)
+ return err
+ }))
+ if sizes != "44 44 44 44 Message" {
+ t.Fatalf("%s: targets and placeholder %q, want 44 px each and Message", at, sizes)
+ }
+ // Baselines: the +, the words and the arrow share a centre line.
+ p.check(`(()=>{const c=e=>{const r=document.querySelector(e).getBoundingClientRect();return r.y+r.height/2};return Math.abs(c('[equipo-plus]')-c('#chat-body'))<=1.5&&Math.abs(c('[equipo-send]')-c('#chat-body'))<=1.5})()`, at+": the +, the words and the arrow are not on one line")
+
+ // The arrow shows only with something to send.
+ p.run(browsertest.Wait(sendHidden))
+ p.check(typeText(" "), "spaces")
+ p.run(browsertest.Wait(sendHidden))
+ p.check(typeText("hello"), "type")
+ p.run(browsertest.Wait(sendShown))
+ p.check(typeText(""), "clear")
+ p.run(browsertest.Wait(sendHidden))
+
+ // Keys: Enter sends on a keyboard, Shift+Enter starts a line; on touch
+ // Return starts a line and nothing goes.
+ before := 0
+ p.run(chromedp.Func(func(ctx context.Context, target *chromedp.Target) error {
+ var err error
+ before, err = chromedp.Evaluate[int](own)(ctx, target)
+ return err
+ }))
+ p.check(typeText("keys "+at), "type")
+ p.check(`(()=>{const e=new KeyboardEvent('keydown',{key:'Enter',shiftKey:true,bubbles:true,cancelable:true});document.querySelector('#chat-body').dispatchEvent(e);return !e.defaultPrevented})()`, at+": Shift+Enter did not start a line")
+ enter := `(()=>{const e=new KeyboardEvent('keydown',{key:'Enter',bubbles:true,cancelable:true});document.querySelector('#chat-body').dispatchEvent(e);return e.defaultPrevented})()`
+ if tc.touch {
+ p.check(`!`+enter, "390: Return sent on touch")
+ p.check(`document.querySelector('#chat-body').value==='keys 390' && `+own+`===`+strconv.Itoa(before), "390: Return sent on touch")
+ p.check(typeText(""), "clear")
+ } else {
+ p.check(enter, "1280: Enter did not send")
+ p.run(browsertest.Wait(own + `===` + strconv.Itoa(before+1) + ` && document.querySelector('#chat-body').value===''`))
+ p.run(browsertest.Wait(sendHidden))
+ }
+
+ // The + menu: Photo or image (the library or camera on a phone)
+ // and File; it closes on a pick, outside, and Escape.
+ p.run(chromedp.Click(chromedp.CSS(`[equipo-plus]`)))
+ p.run(browsertest.Wait(`!document.querySelector('[equipo-add-menu]').hidden && document.querySelector('[equipo-plus]').getAttribute('aria-expanded')==='true'`))
+ p.check(`(()=>{const i=[...document.querySelectorAll('[equipo-add-menu] [role=menuitem]')].map(e=>e.textContent.trim());return i.join('|')==='Photo or image|File'&&document.querySelector('[data-picker=image]').accept==='image/*'})()`, at+": menu items")
+ p.check(`(()=>{const m=document.querySelector('[equipo-add-menu]').getBoundingClientRect(),c=document.querySelector('#chat-composer').getBoundingClientRect();return m.bottom<=c.top+c.height&&m.left>=0&&m.right<=innerWidth&&[...document.querySelectorAll('[equipo-add-menu] [role=menuitem]')].every(e=>e.getBoundingClientRect().height>=44)})()`, at+": the menu is off screen or its items are small")
+ shot("menu")
+ p.run(chromedp.Click(chromedp.CSS(`[equipo-scroll]`)))
+ p.run(browsertest.Wait(`document.querySelector('[equipo-add-menu]').hidden`))
+ if !tc.touch {
+ // By keyboard: Enter on the + opens it at its first item, arrows
+ // move, Escape closes and returns to the +.
+ p.check(`(()=>{document.querySelector('[equipo-plus]').focus();return true})()`, "focus")
+ p.run(chromedp.KeyEvent("\r"))
+ p.run(browsertest.Wait(`document.activeElement===document.querySelector('[data-pick=image]')`))
+ p.check(`(()=>{document.activeElement.dispatchEvent(new KeyboardEvent('keydown',{key:'ArrowDown',bubbles:true,cancelable:true}));return document.activeElement===document.querySelector('[data-pick=file]')})()`, "ArrowDown")
+ p.check(`(()=>{document.activeElement.dispatchEvent(new KeyboardEvent('keydown',{key:'Escape',bubbles:true,cancelable:true}));return document.querySelector('[equipo-add-menu]').hidden&&document.activeElement===document.querySelector('[equipo-plus]')})()`, "Escape")
+ }
+
+ // A picked image: a chip that uploads, then the arrow.
+ pick("image", screen)
+ p.run(browsertest.Wait(chip("ready") + ` && ` + chip("ready") + `.dataset.kind==='image' && !!` + chip("ready") + `.querySelector('img') && !document.querySelector('[equipo-chips]').hidden`))
+ p.run(browsertest.Wait(sendShown))
+ p.check(`(()=>{const c=document.querySelector('[equipo-chips]').getBoundingClientRect(),i=document.querySelector('#chat-body').getBoundingClientRect(),p=document.querySelector('[equipo-pill]').getBoundingClientRect();return c.bottom<=i.top+1&&c.top>=p.top&&c.left>=p.left})()`, at+": the chip is not above the words inside the pill")
+ // A file beside it, then removed with its x.
+ pick("file", notes)
+ p.run(browsertest.Wait(`document.querySelectorAll('[equipo-chip][data-state="ready"]').length===2`))
+ p.check(`(()=>{const f=document.querySelector('[equipo-chip][data-kind="file"]');return f.querySelector('[equipo-chip-name]').textContent==='notes.md'&&/B$/.test(f.querySelector('[equipo-chip-note]').textContent)&&f.querySelector('[equipo-chip-remove]').getAttribute('aria-label')==='Remove notes.md'})()`, at+": the file chip")
+ shot("chips")
+ p.check(`(()=>{document.querySelector('[equipo-chip][data-kind="file"] [equipo-chip-remove]').click();return document.querySelectorAll('[equipo-chip]').length===1})()`, at+": remove")
+ // Errors in words: too large (refused here), a type (refused by the
+ // server); they stay out of a send and do not show the arrow alone.
+ pick("file", big)
+ p.run(browsertest.Wait(chip("error") + ` && ` + chip("error") + `.querySelector('[equipo-chip-note]').textContent==='That file is over 10 MB.'`))
+ pick("file", binary)
+ p.run(browsertest.Wait(`[...document.querySelectorAll('[equipo-chip][data-state="error"] [equipo-chip-note]')].some(e=>e.textContent.startsWith('Equipo takes images'))`))
+ shot("errors")
+ p.check(`(()=>{document.querySelectorAll('[equipo-chip][data-state="error"] [equipo-chip-remove]').forEach(b=>b.click());return document.querySelectorAll('[equipo-chip]').length===1})()`, at+": remove errors")
+
+ // Sent with no words: the thumbnail in the person's message, no empty
+ // bubble; it reaches the coordinator as an image.
+ p.run(chromedp.Click(chromedp.CSS(`[equipo-send]`)))
+ p.run(browsertest.Wait(`document.querySelector('[equipo-chips]').hidden && document.querySelectorAll('[equipo-chip]').length===0`))
+ p.run(browsertest.Wait(`[...document.querySelectorAll('[equipo-message="incoming"] [equipo-markdown]:not([data-stream-text])')].some(e=>e.textContent.includes('[image image/png 120x80'))`))
+ thumb := `[...document.querySelectorAll('[equipo-message="own"] [equipo-file-thumb] img')].pop()`
+ p.run(browsertest.Wait(`(()=>{const i=` + thumb + `;return !!i&&/\/conversation\/attachments\/at_[a-z0-9]+\/preview$/.test(new URL(i.src).pathname)&&i.complete&&i.naturalWidth===120})()`))
+ p.check(`(()=>{`+thumb+`.scrollIntoView({block:'center'});return true})()`, "scroll")
+ shot("feed")
+ p.check(`(()=>{const li=`+thumb+`.closest('[equipo-message]');const b=li.querySelector('[equipo-bubble]');return li.getAttribute('equipo-message')==='own'&&getComputedStyle(b).display==='none'})()`, at+": an empty bubble shows under the image")
+ // Tap for full size, in the page; tap again to close.
+ p.check(`(()=>{`+thumb+`.scrollIntoView({block:'center'});return true})()`, "scroll")
+ var spot []float64
+ p.run(chromedp.Func(func(ctx context.Context, target *chromedp.Target) error {
+ var err error
+ spot, err = chromedp.Evaluate[[]float64](`(()=>{const r=`+thumb+`.getBoundingClientRect();return [r.x+r.width/2,r.y+r.height/2]})()`)(ctx, target)
+ return err
+ }))
+ p.run(chromedp.MouseClickXY(spot[0], spot[1]))
+ p.run(browsertest.Wait(`!!document.querySelector('[equipo-lightbox][open] img') && document.querySelector('[equipo-lightbox] img').src.endsWith(` + thumb + `.closest('a').getAttribute('href'))`))
+ shot("full-size")
+ p.check(`(()=>{document.querySelector('[equipo-lightbox]').click();return !document.querySelector('[equipo-lightbox]').open})()`, at+": full size did not close")
+
+ if !tc.touch {
+ // Paste and drop on a desktop.
+ file := `new File([Uint8Array.from(atob('` + small + `'),c=>c.charCodeAt(0))],'pasted.png',{type:'image/png'})`
+ p.check(`(()=>{const d=new DataTransfer();d.items.add(`+file+`);const e=new ClipboardEvent('paste',{clipboardData:d,bubbles:true,cancelable:true});document.querySelector('#chat-body').dispatchEvent(e);return e.defaultPrevented})()`, "paste was not taken")
+ p.run(browsertest.Wait(`document.querySelectorAll('[equipo-chip][data-state="ready"]').length===1`))
+ p.check(`(()=>{const d=new DataTransfer();d.items.add(new File(['a,b\n1,2\n'],'rows.csv',{type:'text/csv'}));const area=document.querySelector('[equipo-conversation]');area.dispatchEvent(new DragEvent('dragover',{dataTransfer:d,bubbles:true,cancelable:true}));const lit=document.querySelector('#composer').hasAttribute('data-dropping');area.dispatchEvent(new DragEvent('drop',{dataTransfer:d,bubbles:true,cancelable:true}));return lit&&!document.querySelector('#composer').hasAttribute('data-dropping')})()`, "drop was not shown or taken")
+ p.run(browsertest.Wait(`document.querySelectorAll('[equipo-chip][data-state="ready"]').length===2`))
+ p.check(typeText("pasted and dropped"), "type")
+ p.check(enter, "send")
+ p.run(browsertest.Wait(`(()=>{const li=[...document.querySelectorAll('[equipo-message="own"]')].find(e=>e.textContent.includes('pasted and dropped'));return !!li&&li.querySelectorAll('[equipo-file-thumb]').length===1&&li.querySelector('[equipo-file-chip] [equipo-file-name]').textContent==='rows.csv'&&getComputedStyle(li.querySelector('[equipo-bubble]')).display!=='none'})()`))
+ }
+
+ // Light and dark: the composer as it rests, and growing to six lines.
+ for _, theme := range []string{"light", "dark"} {
+ p.theme(theme)
+ p.check(`(()=>{const s=document.querySelector('[equipo-scroll]');s.scrollTop=s.scrollHeight;return true})()`, "scroll")
+ p.check(`(()=>{const b=getComputedStyle(document.querySelector('[equipo-pill]'));return parseFloat(b.borderTopWidth)>=1&&b.backgroundColor!=='rgba(0, 0, 0, 0)'})()`, theme+": the pill lost its field")
+ shot("rest-" + theme)
+ p.check(typeText("one\ntwo\nthree\nfour\nfive\nsix\nseven\neight\nnine"), "lines")
+ p.check(`(()=>{const i=document.querySelector('#chat-body'),c=getComputedStyle(i),l=parseFloat(c.lineHeight),h=i.clientHeight-parseFloat(c.paddingTop)-parseFloat(c.paddingBottom);return h>=l*5.5&&h<=l*6.5&&i.scrollHeight>i.clientHeight})()`, theme+": the message does not grow to six lines and scroll")
+ p.run(browsertest.Wait(sendShown + ` && ['none','matrix(1, 0, 0, 1, 0, 0)'].includes(getComputedStyle(document.querySelector('[equipo-send]')).transform)`))
+ p.check(`(()=>{const c=e=>document.querySelector(e).getBoundingClientRect().bottom;return Math.abs(c('[equipo-plus]')-c('[equipo-send]'))<=1.5})()`, theme+": the + and the arrow left the last line")
+ shot("lines-" + theme)
+ p.check(typeText(""), "clear")
+ }
+ p.theme("light")
+ // Reduced motion: the arrow appears without moving.
+ p.run(chromedp.Func(func(ctx context.Context, target *chromedp.Target) error {
+ _, err := cdp.Call(ctx, target, emulation.SetEmulatedMedia, emulation.SetEmulatedMediaParams{Features: []*emulation.MediaFeature{{Name: "prefers-reduced-motion", Value: "reduce"}}})
+ return err
+ }))
+ p.check(`getComputedStyle(document.querySelector('[equipo-send]')).transitionDuration.split(',').every(d=>parseFloat(d)===0)`, at+": the arrow moves under reduced motion")
+ p.stop()
+ }
+}
diff --git a/internal/headless/browser_composer_test.go b/internal/headless/browser_composer_test.go
index 6c613e93..379d0095 100644
--- a/internal/headless/browser_composer_test.go
+++ b/internal/headless/browser_composer_test.go
@@ -15,9 +15,10 @@ import (
"github.com/chromedp/chromedp"
)
-// Paul: clicking anywhere in the compose box, its padding or the empty
-// space left of Send, puts the cursor in the message; Send keeps its own
-// click. Desktop with a mouse at 1280, touch at 390.
+// Paul: clicking anywhere in the compose box, the dock around the pill,
+// the pill's edge, the space beside the send arrow or between the + and
+// the pill, puts the cursor in the message; the arrow and the + keep their
+// own clicks. Desktop with a mouse at 1280, touch at 390.
func TestBrowserComposerFocus(t *testing.T) {
_, inst, r := localEnv(t)
r.start(t)
@@ -52,20 +53,36 @@ func TestBrowserComposerFocus(t *testing.T) {
return v[0], v[1]
}
for name, expr := range map[string]string{
- "outer padding": `(()=>{const b=document.querySelector('#chat-composer').getBoundingClientRect();const f=document.querySelector('#composer').getBoundingClientRect();return [(b.x+f.x)/2,f.y+f.height/2]})()`,
- "box padding": `(()=>{const b=document.querySelector('#composer').getBoundingClientRect();return [b.x+5,b.y+b.height/2]})()`,
- "left of Send": `(()=>{const b=document.querySelector('[equipo-composer-tools]').getBoundingClientRect();return [b.x+8,b.y+b.height/2]})()`,
+ "outer padding": `(()=>{const b=document.querySelector('#chat-composer').getBoundingClientRect();const f=document.querySelector('#composer').getBoundingClientRect();return [f.right+(b.right-f.right)/2,f.y+f.height/2]})()`,
+ "below the pill": `(()=>{const b=document.querySelector('#chat-composer').getBoundingClientRect();const f=document.querySelector('[equipo-pill]').getBoundingClientRect();return [f.x+f.width/2,f.bottom+(b.bottom-f.bottom)/2]})()`,
+ "pill edge": `(()=>{const b=document.querySelector('[equipo-pill]').getBoundingClientRect();return [b.x+2,b.y+b.height/2]})()`,
+ "beside the arrow": `(()=>{const b=document.querySelector('[equipo-send]').getBoundingClientRect();return [b.x-3,b.y+b.height/2]})()`,
+ "between + and pill": `(()=>{const a=document.querySelector('[equipo-plus]').getBoundingClientRect();const f=document.querySelector('[equipo-pill]').getBoundingClientRect();return [(a.right+f.x)/2,f.y+f.height/2]})()`,
} {
+ // A tap in the narrow gap beside the + lands on the + (touch
+ // adjustment snaps taps to the nearest control), as on a phone.
+ if tc.touch && name == "between + and pill" {
+ continue
+ }
p.check(`(()=>{document.activeElement&&document.activeElement.blur();return document.activeElement!==document.querySelector('#chat-body')})()`, "blur")
x, y := point(expr)
click(x, y)
p.run(browsertest.Wait(`document.activeElement===document.querySelector('#chat-body')`))
t.Logf("%dpx %s: focused", tc.width, name)
}
+ // The + keeps its own click: its menu opens and the message keeps
+ // no focus it did not have.
+ p.check(`(()=>{document.activeElement&&document.activeElement.blur();return true})()`, "blur")
+ x, y := point(`(()=>{const b=document.querySelector('[equipo-plus]').getBoundingClientRect();return [b.x+b.width/2,b.y+b.height/2]})()`)
+ click(x, y)
+ p.run(browsertest.Wait(`!document.querySelector('[equipo-add-menu]').hidden && document.activeElement!==document.querySelector('#chat-body')`))
+ click(x, y)
+ p.run(browsertest.Wait(`document.querySelector('[equipo-add-menu]').hidden`))
// Send keeps its own click: the message goes.
text := "composer focus " + map[bool]string{true: "touch", false: "mouse"}[tc.touch]
- p.check(`(()=>{document.querySelector('#chat-body').value=`+jsonString(text)+`;return true})()`, "type")
- x, y := point(`(()=>{const b=document.querySelector('#composer button[type=submit]').getBoundingClientRect();return [b.x+b.width/2,b.y+b.height/2]})()`)
+ p.check(`(()=>{const b=document.querySelector('#chat-body');b.value=`+jsonString(text)+`;b.dispatchEvent(new Event('input',{bubbles:true}));return true})()`, "type")
+ p.run(browsertest.Wait(`getComputedStyle(document.querySelector('[equipo-send]')).visibility==='visible' && getComputedStyle(document.querySelector('[equipo-send]')).opacity==='1'`))
+ x, y = point(`(()=>{const b=document.querySelector('[equipo-send]').getBoundingClientRect();return [b.x+b.width/2,b.y+b.height/2]})()`)
click(x, y)
p.run(browsertest.Wait(`[...document.querySelectorAll('[equipo-message="own"] [equipo-message-body]')].some(e=>e.textContent===` + jsonString(text) + `)`))
p.stop()
@@ -99,7 +116,7 @@ func TestBrowserComposerDock(t *testing.T) {
p.check(`(`+effectiveBackground+`)(document.querySelector('#chat-composer'))===(`+effectiveBackground+`)(document.querySelector('[equipo-scroll]'))`, theme+": the dock is not the feed's colour")
p.check(`(()=>{const own=getComputedStyle(document.querySelector('#chat-composer')).backgroundColor;return own==='rgba(0, 0, 0, 0)'||own===(`+effectiveBackground+`)(document.querySelector('[equipo-scroll]'))})()`, theme+": the dock paints a band")
p.check(`(()=>{const f=getComputedStyle(document.querySelector('#chat-composer'),'::before');return f.content!=='none'&&f.backgroundImage.includes('linear-gradient')&&f.backgroundImage.includes((`+effectiveBackground+`)(document.querySelector('[equipo-scroll]')))&&f.pointerEvents==='none'&&parseFloat(f.height)>0&&parseFloat(f.height)<=40})()`, theme+": no short fade at the dock's top")
- p.check(`(()=>{const b=getComputedStyle(document.querySelector('#composer'));return parseFloat(b.borderTopWidth)>=1&&b.backgroundColor!=='rgba(0, 0, 0, 0)'})()`, theme+": the compose box lost its field")
+ p.check(`(()=>{const b=getComputedStyle(document.querySelector('[equipo-pill]'));return parseFloat(b.borderTopWidth)>=1&&b.backgroundColor!=='rgba(0, 0, 0, 0)'})()`, theme+": the compose box lost its field")
if dir := os.Getenv("EQUIPO_SCREENSHOTS"); dir != "" {
var shot []byte
p.run(chromedp.Func(func(ctx context.Context, target *chromedp.Target) error {
diff --git a/internal/thintest/housekeeping_browser_test.go b/internal/thintest/housekeeping_browser_test.go
index f6aef9ac..dc4ccbfc 100644
--- a/internal/thintest/housekeeping_browser_test.go
+++ b/internal/thintest/housekeeping_browser_test.go
@@ -134,13 +134,15 @@ func TestBrowserHousekeeping(t *testing.T) {
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")
+ // Saved in the background (Paul: a page post replayed the sliding nav).
+ q.wait(`window.__hkmark===1 && document.querySelector('#housekeeping [equipo-saved-tick][data-shown]') && document.querySelector('[data-hk-quiet-from]').value==='23' && document.querySelector('[data-hk-quiet-until]').value==='7'`, "quiet hours saved")
if h := r.housekeeping(); h.Quiet != (wire.QuietHours{From: 23, Until: 7}) {
t.Fatalf("quiet hours from Settings: %+v", h.Quiet)
}
q.check(`(()=>{window.__hkmark=1;return true})()`, "mark")
q.click(`[data-hk-pause]`)
- q.wait(`!window.__hkmark && document.querySelector('[data-hk-settings][data-paused] [data-hk-resume]')`, "paused")
+ q.wait(`window.__hkmark===1 && document.querySelector('[data-hk-settings][data-paused] [data-hk-resume]')`, "paused")
+ q.stayed("Pause from Settings")
if h := r.housekeeping(); !h.Paused {
t.Fatal("Pause from Settings did not take")
}
diff --git a/internal/thintest/settings_browser_test.go b/internal/thintest/settings_browser_test.go
new file mode 100644
index 00000000..2c075ae5
--- /dev/null
+++ b/internal/thintest/settings_browser_test.go
@@ -0,0 +1,80 @@
+//go:build browser
+
+package thintest
+
+import (
+ "testing"
+ "time"
+)
+
+// TestBrowserSettingsStayOnPage: Paul, 2026-11-08: "Choosing a different
+// option in settings causes the sliding nav to repeat." Every Settings
+// change (Thinking words, Prefer, Pause and Resume, quiet hours) saves in
+// the background and shows a quiet Saved tick: no navigation, no page
+// swap or reveal, the shell (and its nav) the same nodes, at 1280 with a
+// mouse and 390 on touch. The server has each change.
+func TestBrowserSettingsStayOnPage(t *testing.T) {
+ r := newToolRig(t)
+ for _, size := range []struct {
+ w, h int64
+ touch bool
+ }{{1280, 900, false}, {390, 844, true}} {
+ p := openInner(t, r.inst.URL, r.inst.Cookie(), size.w, size.h, size.touch, "light", "no-preference")
+ p.open("/conversation/settings")
+ p.check(`(()=>{window.__page=1;window.__rail=document.querySelector('#rail');window.__swapped=0;addEventListener('pageswap',()=>window.__swapped++);addEventListener('pagereveal',()=>window.__swapped++);return true})()`, "mark")
+ same := func(what string) {
+ t.Helper()
+ p.check(`window.__page===1 && window.__swapped===0 && document.querySelector('#rail')===window.__rail`, what+": the page or its nav was replaced")
+ p.stayed(what)
+ }
+ tick := func(section string) string {
+ return `!!document.querySelector('#` + section + ` [equipo-saved-tick][data-shown]:not([data-gone])')`
+ }
+
+ // Thinking words: picking a set saves it.
+ p.check(`(()=>{document.querySelector('#thinking [data-set="terminal"] label').click();return true})()`, "pick Terminal")
+ p.wait(tick("thinking"), "Thinking words saved")
+ same("Thinking words")
+ if got, _ := r.client.Thinking(r.ctx); got.Set != "terminal" {
+ t.Fatalf("%d: thinking %s", size.w, got.Set)
+ }
+ // A second pick goes too: the form's revision moved on in place.
+ p.check(`(()=>{document.querySelector('#thinking [data-set="professional"] label').click();return true})()`, "pick Professional")
+ p.wait(`document.querySelector('#thinking input[value="professional"]').checked`, "picked")
+ p.waitFor(func() bool { got, _ := r.client.Thinking(r.ctx); return got.Set == "professional" }, "the second pick saved")
+ same("Thinking words again")
+
+ // Prefer: the pressed choice moves in place.
+ p.check(`(()=>{const b=[...document.querySelectorAll('#connections [data-prefer]')].find(b=>b.getAttribute('aria-pressed')!=='true');window.__want=b.dataset.prefer;b.click();return true})()`, "Prefer")
+ p.wait(`document.querySelector('#connections [data-prefer="'+window.__want+'"]').getAttribute('aria-pressed')==='true' && `+tick("connections"), "Prefer saved")
+ same("Prefer")
+
+ // Pause and Resume, then quiet hours.
+ p.click(`[data-hk-pause]`)
+ p.wait(`!!document.querySelector('[data-hk-settings][data-paused] [data-hk-resume]') && `+tick("housekeeping"), "paused")
+ same("Pause")
+ if h := r.housekeeping(); !h.Paused {
+ t.Fatalf("%d: Pause did not take", size.w)
+ }
+ p.click(`[data-hk-resume]`)
+ p.wait(`!!document.querySelector('[data-hk-settings]:not([data-paused]) [data-hk-pause]')`, "resumed")
+ p.check(`(()=>{document.querySelector('[data-hk-quiet-from]').value='21';document.querySelector('[data-hk-quiet-until]').value='6';return true})()`, "hours")
+ p.click(`[data-hk-quiet-save]`)
+ p.waitFor(func() bool { return r.housekeeping().Quiet.From == 21 && !r.housekeeping().Paused }, "quiet hours saved")
+ p.wait(tick("housekeeping"), "quiet hours tick")
+ same("quiet hours")
+ p.stop()
+ }
+}
+
+// waitFor polls a server-side condition.
+func (p *innerPage) waitFor(cond func() bool, what string) {
+ p.t.Helper()
+ for i := 0; i < 100; i++ {
+ if cond() {
+ return
+ }
+ time.Sleep(50 * time.Millisecond)
+ }
+ p.t.Fatalf("timed out waiting for %s", what)
+}
diff --git a/internal/thintest/thinking_browser_test.go b/internal/thintest/thinking_browser_test.go
index 18bf77d5..6b9c4a87 100644
--- a/internal/thintest/thinking_browser_test.go
+++ b/internal/thintest/thinking_browser_test.go
@@ -52,7 +52,8 @@ func TestBrowserThinkingWords(t *testing.T) {
// 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(`location.search.includes('saved=1') && document.querySelector('input[value="pirate"]').checked && document.querySelector('[equipo-saved]')`, "picking saved the set")
+ p.wait(`document.querySelector('input[value="pirate"]').checked && document.querySelector('[equipo-saved-tick][data-shown]')`, "picking saved the set")
+ p.stayed("picking a 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" {