oficina / equipo Public

Merge branch 'activity-says-what' into main

Name what the coordinator is doing on the thinking line

Tool activity shows its real label with a verified subject: the
person's task title, catalog project or branch, never tool input.
The chosen word set now fills only the gaps between tools.
claude agent, operated by paul@keymail.dev ff430af0a2a98685c0568cdd37466962b22e4dcb parent 3ab2a3aparent 59c73b9
20 files changed, +323 −84
  • .rastrillo/budgets.txt +3 −3
  • docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md +16 −1
  • internal/equipo/chat/activity.go +71 −0
  • internal/equipo/chat/questions.go +7 −3
  • internal/equipo/chat/stars.go +26 −15
  • internal/equipo/chat/store.go +3 −2
  • internal/equipo/chat/tools.go +5 −10
  • internal/equipo/chat_wiring.go +8 −6
  • internal/equipo/copy.go +10 −1
  • internal/equipo/static/chat-stream.js +11 −10
  • internal/equipo/static/thinking-preview.js +2 −3
  • internal/headless/browser_cards_test.go +1 −1
  • internal/headless/projects_test.go +1 −1
  • internal/thintest/activity_browser_test.go +50 −0
  • internal/thintest/activity_subjects_contract_test.go +81 −0
  • internal/thintest/questions_contract_test.go +8 −0
  • internal/thintest/thinking_browser_test.go +13 −20
  • internal/thintest/tools_contract_test.go +1 −1
  • internal/wire/api.go +2 −2
  • internal/wire/thinking.go +4 −5

CI passed — run details

diff --git a/.rastrillo/budgets.txt b/.rastrillo/budgets.txt
index 50b31089..6a2ef244 100644
--- a/.rastrillo/budgets.txt
+++ b/.rastrillo/budgets.txt
@@ -14,7 +14,7 @@ perf GET /* skip Unknown private paths render 404; this fallback contains no scr
time internal/equipo/team 60s Plan 3 loaded CI measured 45.985s; niced serial reruns measured 18.079s and 22.031s. Keep migration, recovery, accounting and concurrency assertions; 60s leaves 30 percent headroom above loaded CI.
time internal/equipotest 300s Final fix package rerun measured 187.035s (review 172.4s); 300s gives 60 percent headroom for HTTP, sandbox, authority and final regression coverage.
-size internal/equipo 19453 - Web pages, handlers, templates and runtime copy. Connections now shares Usage plan and age labels. Measured 19453 source lines.
+size internal/equipo 19464 - Web pages, handlers, templates and runtime copy stay together. Adds reviewed activity subject formats beside existing activity copy. Measured 19464 source lines.
size internal/wire 6014 - Runner and person API types stay together for Encode. Protocol 20 adds Claude usage flags and their downgrade. Measured 6014 source lines.
size internal/equipotest - 13400 Task 21 repairs historical migration and conversation fixtures after Plan 3. Measured 13024 test lines; the 300s time ceiling is unchanged.
time internal/runner/checks 90s CI worker measured 44.553s (44.6s rounded);
@@ -56,7 +56,7 @@ perf GET /api/v1/tasks/{id} skip Thin v1 person API: bearer-only JSON for device
perf GET /api/v1/assistant/snapshot skip Assistant person API: bearer-only JSON for Base's chat, not a browser screen.
perf GET /api/v1/assistant/messages skip Assistant person API: bearer-only JSON for Base's chat, not a browser screen.
perf GET /api/v1/assistant/events skip Assistant event stream (Server-Sent Events), bearer-only and long-lived; not a screen.
-size internal/equipo/chat 25235 - The instance store: tasks, steps, cards, merges, housekeeping, metered connections and models, Research, scheduler, sites, and the Assistant's lane and hand-off. Measured 25235 source lines.
+size internal/equipo/chat 25317 - The instance store shares transaction and authority helpers. Adds activity subject resolution beside task and catalog access. Measured 25317 source lines.
perf GET /api/v1/questions/{id} skip Thin v1 person API: bearer-only JSON for devices; the browser reads questions on /tasks/{id}.
perf GET /api/v1/steps/{id}/log skip Thin v1 person API: bearer-only JSON for devices; the browser shows the log tail on /tasks/{id}.
perf GET /api/v1/connections/preference skip Connections slice 1 person API: bearer-only JSON for devices; the browser shows the preference on /conversation/connections.
@@ -71,7 +71,7 @@ perf GET /tasks/{id}/files/{file} skip Research kept images: the bytes of one im
perf GET /api/v1/runners skip Mac runners person API: bearer-only JSON for devices; the browser shows runners in the Team section.
time cmd/equipo-runner 60s TestReleaseRunnerHasNoFakeWorker builds the release runner and the thin package under testbuild (about 12s locally).
size internal/headless - 10352 End-to-end scenarios through a real runner and instance, browser drives and the Assistant's included. Measured 10352 test lines.
-size internal/thintest - 24433 Thin v1 contract and page tests, the Assistant's (hand-off, outcome, ledger cases) and the models' included; one package keeps one instance harness. Measured 24433 test lines.
+size internal/thintest - 24565 Contract and browser tests share one instance harness. Adds activity subject privacy, plain tool labels, long titles and accessible text checks. Measured 24565 test lines.
perf GET /api/v1/projects/{id}/merge-policy skip Merge authority person API: bearer-only JSON for devices; the browser reads the policy on /projects/{id}.
perf GET /api/v1/usage skip Thin v1 person API: bearer-only JSON for devices; the browser reads usage through /usage.
perf GET /api/v1/advice skip Thin v1 person API: bearer-only JSON for devices; the browser reads advice through /usage and /conversation.
diff --git a/docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md b/docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md
index 8a5ae658..1a046c29 100644
--- a/docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md
+++ b/docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md
@@ -4704,6 +4704,21 @@ All eight entries have individual `COPY REVIEW REQUIRED` markers. The API guide
## Plan 3 copy inventory (for Paul's review)
+Activity subjects: COPY ACCEPTED BY DELEGATION (Astra, 2026-11-13). Names come from the person’s task records or runner catalog. Long quoted subjects shorten only on screen; the tooltip and accessible label keep the full text.
+
+| Key | Copy | Surface | Review |
+| --- | --- | --- | --- |
+| `chat.activity.read_task_subject` | Checking ‘%s’… | Conversation activity | COPY ACCEPTED BY DELEGATION (Astra, 2026-11-13) |
+| `chat.activity.cancel_task_subject` | Cancelling ‘%s’… | Conversation activity | COPY ACCEPTED BY DELEGATION (Astra, 2026-11-13) |
+| `chat.activity.add_report_subject` | Adding to ‘%s’… | Conversation activity | COPY ACCEPTED BY DELEGATION (Astra, 2026-11-13) |
+| `chat.activity.hold_merge_subject` | Holding the merge for ‘%s’… | Conversation activity | COPY ACCEPTED BY DELEGATION (Astra, 2026-11-13) |
+| `chat.activity.start_task_subject` | Handing ‘%s’ to Engineering… | Conversation activity | COPY ACCEPTED BY DELEGATION (Astra, 2026-11-13) |
+| `chat.activity.read_change_subject` | Looking at the change on ‘%s’… | Conversation activity | COPY ACCEPTED BY DELEGATION (Astra, 2026-11-13) |
+| `chat.activity.add_project_repo` | Adding %s… | Conversation activity | COPY ACCEPTED BY DELEGATION (Astra, 2026-11-13) |
+| `chat.activity.create_project_repo` | Creating %s… | Conversation activity | COPY ACCEPTED BY DELEGATION (Astra, 2026-11-13) |
+| `chat.activity.star_project_repo` | Starring %s… | Conversation activity | COPY ACCEPTED BY DELEGATION (Astra, 2026-11-13) |
+
+
COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context). Paul accepted all entries for now. This is the current
consolidated review inventory, compared with merged Plan 2b baseline `ff73f89`.
Runtime rows contain the exact current draft text; owning tasks come from the
@@ -4928,7 +4943,7 @@ records remain unchanged.
| `thinking.set.random` | Random | Thin v1 UX1 thinking words (settings, thinking line) | Runtime; Paul tweaks the sets; COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) |
| `thinking.about.random` | A different set for each turn. | Thin v1 UX1 thinking words (settings, thinking line) | Runtime; Paul tweaks the sets; COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) |
| `thinking.title` | Thinking words | Thin v1 UX1 thinking words (settings, thinking line) | Runtime; Paul tweaks the sets; COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) |
-| `thinking.lede` | The words on the line while Equipo works. What it is really doing stays in the tooltip and for screen readers. | Thin v1 UX1 thinking words (settings, thinking line) | Runtime; Paul tweaks the sets; COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) |
+| `thinking.lede` | The words while Equipo thinks. What it is doing is always shown plainly. | Thinking words settings | Runtime; COPY ACCEPTED BY DELEGATION (Astra, 2026-11-13) |
| `thinking.preview` | Preview | Thin v1 UX1 thinking words (settings, thinking line) | Runtime; Paul tweaks the sets; COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) |
| `thinking.use` | Use these words | Thin v1 UX1 thinking words (settings, thinking line) | Runtime; Paul tweaks the sets; COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) |
| `thinking.saved` | Saved. Your next message uses them. | Thin v1 UX1 thinking words (settings, thinking line) | Runtime; Paul tweaks the sets; COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) |
diff --git a/internal/equipo/chat/activity.go b/internal/equipo/chat/activity.go
new file mode 100644
index 00000000..ff52c5be
--- /dev/null
+++ b/internal/equipo/chat/activity.go
@@ -0,0 +1,71 @@
+package chat
+
+import (
+ "encoding/json"
+ "strings"
+
+ "amadan.net/oficina/equipo/internal/wire"
+)
+
+// toolActivity refreshes the runner's early label once the instance has
+// the arguments. Arguments select records; only those records supply text.
+func (t *txn) toolActivity(r turnRecord, call *wire.ToolCall) error {
+ tool := call.Name
+ switch tool {
+ case wire.ToolReadTask, wire.ToolCancelTask, wire.ToolAddReport, wire.ToolHoldMerge, wire.ToolStartTask,
+ wire.ToolReadFile, wire.ToolSearchCode, wire.ToolAddProject, wire.ToolCreateProject, wire.ToolStarProject:
+ default:
+ return nil
+ }
+ a := wire.Activity{TurnID: r.ID, Attempt: r.Attempt, Kind: wire.ActivityTool, Tool: tool}
+ var in struct {
+ Task string `json:"task"`
+ Repo string `json:"repo"`
+ Project string `json:"project"`
+ }
+ subject := ""
+ if json.Unmarshal(call.Args, &in) == nil {
+ switch tool {
+ case wire.ToolReadTask, wire.ToolCancelTask, wire.ToolAddReport, wire.ToolHoldMerge, wire.ToolStartTask:
+ subject = t.activityTask(r.Person, in.Task, false)
+ case wire.ToolReadFile, wire.ToolSearchCode, wire.ToolAddProject, wire.ToolCreateProject:
+ a.Repo = t.activityRepo(r.Person, in.Repo)
+ case wire.ToolStarProject:
+ if p, err := t.namedProject(in.Project); err == nil && p != nil {
+ a.Repo = t.activityRepo(r.Person, p.Repo)
+ }
+ }
+ }
+ if t.s.authority.ActivityLabel != nil {
+ a.Label = t.s.authority.ActivityLabel(a, r.Kind, subject)
+ }
+ return t.event(r.Lane, r.Person, wire.EventActivity, "turn", r.ID, 0, r.ID, "", r.Attempt, a)
+}
+
+// A task may be shared for reading, but activity names only the person's
+// own task. Ended tasks still have a useful title when checking delivery.
+// Missing records and lookup failures leave the activity plain.
+func (t *txn) activityTask(person, id string, branch bool) string {
+ k, err := t.loadTask(strings.TrimSpace(id))
+ if err != nil || k.Creator != person {
+ return ""
+ }
+ if branch && k.Branch != "" {
+ return k.Branch
+ }
+ return k.Title
+}
+
+func (t *txn) activityRepo(person, input string) string {
+ h, err := t.hello(person)
+ if err != nil {
+ return ""
+ }
+ repo := NormalizeRepo(input)
+ for _, e := range h.Catalog {
+ if e.Repo == repo {
+ return ProjectName(e.Repo)
+ }
+ }
+ return ""
+}
diff --git a/internal/equipo/chat/questions.go b/internal/equipo/chat/questions.go
index 3382a54e..bf00861d 100644
--- a/internal/equipo/chat/questions.go
+++ b/internal/equipo/chat/questions.go
@@ -382,14 +382,18 @@ func (t *txn) questionActivity(l Lease, a *wire.ActivityReport) error {
return nil
}
v := wire.Activity{TurnID: q.ID, Attempt: q.Attempt, Kind: a.Kind, Tool: tool}
- if t.s.authority.ActivityLabel != nil {
- v.Label = t.s.authority.ActivityLabel(v, wire.ResourceQuestion)
- }
members, err := t.members()
if err != nil {
return err
}
for _, m := range members {
+ subject := ""
+ if tool == ToolReadChange {
+ subject = t.activityTask(m, q.TaskID, true)
+ }
+ if t.s.authority.ActivityLabel != nil {
+ v.Label = t.s.authority.ActivityLabel(v, wire.ResourceQuestion, subject)
+ }
if err := t.event("", m, wire.EventActivity, wire.ResourceQuestion, q.ID, 0, q.ID, "", q.Attempt, v); err != nil {
return err
}
diff --git a/internal/equipo/chat/stars.go b/internal/equipo/chat/stars.go
index c6965b79..d8451bf6 100644
--- a/internal/equipo/chat/stars.go
+++ b/internal/equipo/chat/stars.go
@@ -214,25 +214,13 @@ ON CONFLICT(person, project_id) DO UPDATE SET starred = excluded.starred, set_by
// project is (or no longer is) a priority. project is its name, title or
// repository, as the person said it.
func (t *txn) starProject(r turnRecord, project string, starred bool) (wire.ToolResult, error) {
- var rows []projectRecord
- if err := t.db.Where("state = ?", wire.ProjectActive).Order("repo").Find(&rows).Error; err != nil {
+ p, err := t.namedProject(project)
+ if err != nil {
return wire.ToolResult{}, err
}
- want := strings.ToLower(strings.TrimSpace(project))
- var match []projectRecord
- for _, p := range rows {
- title := p.Title
- if title == "" {
- title = ProjectTitle(p.Repo, nil)
- }
- if want == strings.ToLower(title) || want == strings.ToLower(ProjectName(p.Repo)) || NormalizeRepo(want) == strings.ToLower(p.Repo) {
- match = append(match, p)
- }
- }
- if len(match) != 1 {
+ if p == nil {
return refused("unknown_project", toolUnknownProject), nil
}
- p := match[0]
if err := t.setStar(r.Person, p.ID, starred, StarByCoordinator); err != nil {
return wire.ToolResult{}, err
}
@@ -246,3 +234,26 @@ func (t *txn) starProject(r turnRecord, project string, starred bool) (wire.Tool
}
return wire.ToolResult{Code: "unstarred", Repo: p.Repo, Text: "Unstarred " + title + "."}, nil
}
+
+// namedProject resolves the same unique active project for stars and activity.
+func (t *txn) namedProject(project string) (*projectRecord, error) {
+ var rows []projectRecord
+ if err := t.db.Where("state = ?", wire.ProjectActive).Order("repo").Find(&rows).Error; err != nil {
+ return nil, err
+ }
+ want := strings.ToLower(strings.TrimSpace(project))
+ var match []projectRecord
+ for _, p := range rows {
+ title := p.Title
+ if title == "" {
+ title = ProjectTitle(p.Repo, nil)
+ }
+ if want == strings.ToLower(title) || want == strings.ToLower(ProjectName(p.Repo)) || NormalizeRepo(want) == strings.ToLower(p.Repo) {
+ match = append(match, p)
+ }
+ }
+ if len(match) != 1 {
+ return nil, nil
+ }
+ return &match[0], nil
+}
diff --git a/internal/equipo/chat/store.go b/internal/equipo/chat/store.go
index 10e43f6a..5f091343 100644
--- a/internal/equipo/chat/store.go
+++ b/internal/equipo/chat/store.go
@@ -64,8 +64,9 @@ type Authority struct {
// Audit records an action in the instance's audit log.
Audit func(tx *gorm.DB, actor, kind, record string) error
// ActivityLabel is the line a client shows for an activity, in a turn
- // of turnKind (wire.TurnPerson, TurnMoveIn or TurnExplore).
- ActivityLabel func(a wire.Activity, turnKind string) string
+ // of turnKind (wire.TurnPerson, TurnMoveIn or TurnExplore). The subject
+ // is resolved from an authorised record, never copied from tool input.
+ ActivityLabel func(a wire.Activity, turnKind, subject string) string
// Copy is the instance's copy for a key (copy.go): the words the
// instance itself writes into a conversation (the merge card, the
// merged line). "" for an unknown key.
diff --git a/internal/equipo/chat/tools.go b/internal/equipo/chat/tools.go
index e73b0aa1..e0aa45e9 100644
--- a/internal/equipo/chat/tools.go
+++ b/internal/equipo/chat/tools.go
@@ -420,6 +420,9 @@ func (t *txn) runTool(l Lease, v *wire.ToolCall) (wire.ToolResult, error) {
if fenced, err := t.handoffFenced(r, v.Name); err != nil || fenced {
return refused("request_cancelled", toolRequestCancelled), err
}
+ if err := t.toolActivity(r, v); err != nil {
+ return wire.ToolResult{}, err
+ }
switch v.Name {
case wire.ToolStatus:
return t.status(l)
@@ -774,19 +777,11 @@ func (t *txn) activity(l Lease, a *wire.ActivityReport) error {
return nil
}
v := wire.Activity{TurnID: r.ID, Attempt: r.Attempt, Kind: a.Kind, Tool: tool}
- // Only a repository from the catalog is named, never a path or query.
if a.Repo != "" && (tool == wire.ToolReadFile || tool == wire.ToolSearchCode) {
- h, err := t.hello(r.Person)
- if err != nil {
- return err
- }
- repo := NormalizeRepo(a.Repo)
- if slices.ContainsFunc(h.Catalog, func(e wire.RepoInfo) bool { return e.Repo == repo }) {
- v.Repo = ProjectName(repo)
- }
+ v.Repo = t.activityRepo(r.Person, a.Repo)
}
if t.s.authority.ActivityLabel != nil {
- v.Label = t.s.authority.ActivityLabel(v, r.Kind)
+ v.Label = t.s.authority.ActivityLabel(v, r.Kind, "")
}
return t.event(r.Lane, r.Person, wire.EventActivity, "turn", r.ID, 0, r.ID, "", r.Attempt, v)
}
diff --git a/internal/equipo/chat_wiring.go b/internal/equipo/chat_wiring.go
index 810d12ce..4640e57a 100644
--- a/internal/equipo/chat_wiring.go
+++ b/internal/equipo/chat_wiring.go
@@ -158,19 +158,21 @@ func (s *Store) RunnerStreamHandler(logger *slog.Logger) http.Handler {
return h.RunnerStream(s.Chat().Process())
}
-// activityLabel is the line shown while the coordinator thinks or uses a
-// tool (chat names the tool, or "other", and a catalog repository for the
-// read tools); never the tool's input. While moving in or exploring the
-// line says so: "Moving in… reading oficina/equipo".
-func activityLabel(a wire.Activity, turnKind string) string {
+// activityLabel formats only server-resolved subjects and catalog names.
+// The full label is also the tooltip and accessible text; the browser
+// shortens long quoted subjects on the visible line.
+func activityLabel(a wire.Activity, turnKind, subject string) string {
tool := a.Tool
if a.Kind == wire.ActivityThink {
tool = "thinking"
}
label := copyText("chat.activity." + tool)
- if a.Repo != "" && (tool == wire.ToolReadFile || tool == wire.ToolSearchCode) {
+ if a.Repo != "" && copyText("chat.activity."+tool+"_repo") != "" {
label = fmt.Sprintf(copyText("chat.activity."+tool+"_repo"), a.Repo)
}
+ if subject != "" && copyText("chat.activity."+tool+"_subject") != "" {
+ label = fmt.Sprintf(copyText("chat.activity."+tool+"_subject"), subject)
+ }
if label == "" {
label = copyText("chat.activity.other")
}
diff --git a/internal/equipo/copy.go b/internal/equipo/copy.go
index aa05bc73..8226507d 100644
--- a/internal/equipo/copy.go
+++ b/internal/equipo/copy.go
@@ -592,6 +592,15 @@ var pageCopy = map[string]string{
"chat.failed": "The coordinator could not answer this message.", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context)
"chat.failed_many": "The coordinator could not answer these messages.", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11)
"chat.cancelled": "Stopped.", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context)
+ "chat.activity.read_task_subject": "Checking ‘%s’…", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-13)
+ "chat.activity.cancel_task_subject": "Cancelling ‘%s’…", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-13)
+ "chat.activity.add_report_subject": "Adding to ‘%s’…", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-13)
+ "chat.activity.hold_merge_subject": "Holding the merge for ‘%s’…", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-13)
+ "chat.activity.start_task_subject": "Handing ‘%s’ to Engineering…", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-13)
+ "chat.activity.read_change_subject": "Looking at the change on ‘%s’…", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-13)
+ "chat.activity.add_project_repo": "Adding %s…", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-13)
+ "chat.activity.create_project_repo": "Creating %s…", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-13)
+ "chat.activity.star_project_repo": "Starring %s…", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-13)
"chat.activity.thinking": "Thinking", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context)
"chat.activity.status": "Checking your projects…", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context)
"chat.activity.add_project": "Adding a project…", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context)
@@ -1182,7 +1191,7 @@ var pageCopy = map[string]string{
"thinking.set.random": "Random", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context)
"thinking.about.random": "A different set for each turn.", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context)
"thinking.title": "Thinking words", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context)
- "thinking.lede": "The words on the line while Equipo works. What it is really doing stays in the tooltip and for screen readers.", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context)
+ "thinking.lede": "The words while Equipo thinks. What it is doing is always shown plainly.", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-13)
"thinking.preview": "Preview", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context)
"thinking.use": "Use these words", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context)
"thinking.saved": "Saved. Your next message uses them.", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context)
diff --git a/internal/equipo/static/chat-stream.js b/internal/equipo/static/chat-stream.js
index c9c2617a..a0646e54 100644
--- a/internal/equipo/static/chat-stream.js
+++ b/internal/equipo/static/chat-stream.js
@@ -74,17 +74,12 @@
});
return out;
}
- // Thinking words (Settings): the person's set flavours the phrase the
- // line draws, by situation; the real activity stays the label (for
- // screen readers) and the tooltip. Random picks a set per turn. A set
- // changed elsewhere arrives as a thinking event and applies from the
- // next phrase.
+ // Settings words fill thinking gaps. Tools always show the server's
+ // plain label, with the same transition and full accessible text.
var WORDS = {};
try { WORDS = JSON.parse(root.dataset.thinkingWords || "{}"); } catch (_) { WORDS = {}; }
- var SITUATION = { read_file: "read", read_notes: "read", read_task: "read", read_change: "read", search_code: "search", find: "search", status: "search", write_note: "note", record_task: "note", add_finding: "note", add_report: "note", start_task: "handoff" };
function situationOf(v) {
- if (!v || v.kind === "thinking") return "think";
- return SITUATION[v.tool] || "tool";
+ return !v || v.kind === "thinking" ? "think" : "tool";
}
function setFor(li) {
var set = root.dataset.thinkingSet || "professional";
@@ -99,7 +94,7 @@
// The phrases a situation cycles through: its own, and when it has
// only one or two, the set's thinking phrases too.
function phrases(li) {
- if (li.dataset.kind) return [];
+ if (li.dataset.kind || li.situation === "tool") return [];
var set = WORDS[setFor(li)] || {}, own = set[li.situation || "think"] || [];
if (own.length > 2) return own;
return own.concat((set.think || []).filter(function (p) { return own.indexOf(p) < 0; }));
@@ -155,7 +150,13 @@
var list = phrases(li);
li.dataset.thinkingWords = setFor(li);
li.wordAt = Date.now();
- if (!list.length) return label;
+ if (!list.length) {
+ li.wordKey = "";
+ return label.replace(/‘(.*)’/u, function (_, subject) {
+ var chars = Array.from(subject);
+ return "‘" + (chars.length > 40 ? chars.slice(0, 39).join("") + "…" : subject) + "’";
+ });
+ }
var key = setFor(li) + "." + (li.situation || "think");
if (li.wordKey !== key) {
// A new situation (or set): the deck's next phrase at once.
diff --git a/internal/equipo/static/thinking-preview.js b/internal/equipo/static/thinking-preview.js
index 6912e60a..f6c8a87e 100644
--- a/internal/equipo/static/thinking-preview.js
+++ b/internal/equipo/static/thinking-preview.js
@@ -1,6 +1,5 @@
// The Thinking words page: a live preview of the chosen set on the
-// Stardust line, cycling its phrases situation by situation (thinking,
-// reading, searching, a note, a handoff, a tool). Words are content, so
+// Stardust line, cycling the phrases used between tools. Words are content, so
// they keep changing under reduced motion; only the sparkle is still.
(function () {
"use strict";
@@ -9,7 +8,7 @@
if (!line || !window.EquipoStardust) return;
var words = {};
try { words = JSON.parse(root.dataset.thinkingWords || "{}"); } catch (e) {}
- var situations = ["think", "read", "search", "note", "handoff", "tool"];
+ var situations = ["think"];
var out = line.querySelector("[data-preview-phrase]");
line.prepend(window.EquipoStardust.spark(window.EquipoStardust.look));
var step = 0, randomSet = "";
diff --git a/internal/headless/browser_cards_test.go b/internal/headless/browser_cards_test.go
index 717baab0..5e94e05b 100644
--- a/internal/headless/browser_cards_test.go
+++ b/internal/headless/browser_cards_test.go
@@ -63,7 +63,7 @@ func TestBrowserThinkingAndCards(t *testing.T) {
// The timer counts in seconds from the send; the line shows the
// latest activity, then gives way to the streamed reply.
send("think pause:2600 sleep:1500 tool:status\ntool:add_project:oficina/sample")
- run(browsertest.Wait(`(()=>{const l=document.querySelector('[equipo-thinking] [equipo-activity]');return !!l && l.textContent==='Adding a project…'})()`))
+ run(browsertest.Wait(`(()=>{const l=document.querySelector('[equipo-thinking] [equipo-activity]');return !!l && l.textContent==='Adding oficina/sample…'})()`))
run(browsertest.Wait(`(()=>{const e=document.querySelector('[equipo-thinking] [equipo-elapsed]');return !!e && /^[1-9][0-9]*s$/.test(e.textContent)})()`))
check(`!!document.querySelector('[equipo-thinking] [equipo-sparkle] svg') && [...document.querySelectorAll('[equipo-thinking] [equipo-phrase] [data-in] > span')].some(s=>getComputedStyle(s).animationName.includes('equipo-wave'))`, "no sparkle or wave")
check(`!document.querySelector('[equipo-thinking-dots]')`, "dots still shown")
diff --git a/internal/headless/projects_test.go b/internal/headless/projects_test.go
index 7ff0762a..7e9a3d1f 100644
--- a/internal/headless/projects_test.go
+++ b/internal/headless/projects_test.go
@@ -327,7 +327,7 @@ func scenarioProject(t *testing.T, env *Env) {
for _, a := range acts {
kinds = append(kinds, a.Kind+":"+a.Tool+":"+a.Label)
}
- want := []string{"thinking::Thinking", "tool:status:Checking your projects…", "tool:add_project:Adding a project…"}
+ want := []string{"thinking::Thinking", "tool:status:Checking your projects…", "tool:add_project:Adding a project…", "tool:add_project:Adding oficina/sample…"}
if !slices.Equal(kinds, want) {
t.Fatalf("activity %q, want %q", kinds, want)
}
diff --git a/internal/thintest/activity_browser_test.go b/internal/thintest/activity_browser_test.go
new file mode 100644
index 00000000..a23b6456
--- /dev/null
+++ b/internal/thintest/activity_browser_test.go
@@ -0,0 +1,50 @@
+//go:build browser
+
+package thintest
+
+import (
+ "encoding/json"
+ "fmt"
+ "strings"
+ "testing"
+
+ "amadan.net/oficina/equipo/internal/wire"
+)
+
+func TestBrowserActivitySubjects(t *testing.T) {
+ r := newToolRig(t)
+ title := "Project threads with a long title " + strings.Repeat("é", 20)
+ id := taskID(t, r.call("record", wire.ToolRecordTask, map[string]string{"repo": "oficina/sample", "title": title}))
+ words, _ := r.client.Thinking(r.ctx)
+ raw, _ := json.Marshal(words.Sets[0].Phrases["think"])
+ js := func(v string) string { b, _ := json.Marshal(v); return string(b) }
+ for _, width := range []int64{1280, 390} {
+ t.Run(fmt.Sprint(width), func(t *testing.T) {
+ p := openInner(t, r.inst.URL, r.inst.Cookie(), width, 900, width == 390, "light", "no-preference")
+ defer p.stop()
+ p.open("/conversation")
+ line := `document.querySelector('[equipo-thinking][data-turn="` + r.turn + `"]')`
+ phrase := line + `?.querySelector('[equipo-phrase] [data-in]')?.textContent`
+ p.wait(string(raw)+`.includes(`+phrase+`)`, "set phrase during thinking")
+ r.call("read-"+fmt.Sprint(width), wire.ToolReadTask, map[string]string{"task": id})
+ short := "Checking ‘" + string([]rune(title)[:39]) + "…’…"
+ full := "Checking ‘" + title + "’…"
+ p.wait(phrase+`===`+js(short), "named activity, with a shortened title")
+ p.check(line+`.querySelector('[equipo-activity]').textContent===`+js(full)+` && `+line+`.querySelector('[equipo-activity-line]').title===`+js(full), "full label for screen readers and tooltip")
+ // The cycling timer must never replace tool activity with a set phrase.
+ elapsed := eval[string](p, line+`.querySelector('[equipo-elapsed]').textContent`)
+ p.check(`(()=>{const now=Date.now;Date.now=()=>now()+60000;return true})()`, "advance phrase clock")
+ p.wait(line+`.querySelector('[equipo-elapsed]').textContent!==`+js(elapsed), "elapsed timer advanced")
+ if width == 1280 {
+ p.check(`!`+line+`.querySelector('[equipo-phrase]').hasAttribute('data-cut')`, "desktop has room for the shortened label")
+ }
+ p.shot(fmt.Sprintf("activity-subject-%d", width))
+ p.check(phrase+`===`+js(short), "tool label stays visible")
+ if err := r.runner.Send(r.ctx, "think-"+fmt.Sprint(width), wire.FrameActivity, wire.ActivityReport{TurnID: r.turn, Attempt: 1, Kind: wire.ActivityThink}); err != nil {
+ t.Fatal(err)
+ }
+ p.wait(string(raw)+`.includes(`+phrase+`)`, "set phrase returns between tools")
+ p.check(line+`.querySelector('[equipo-activity]').textContent==='Thinking'`, "plain thinking label for screen readers")
+ })
+ }
+}
diff --git a/internal/thintest/activity_subjects_contract_test.go b/internal/thintest/activity_subjects_contract_test.go
new file mode 100644
index 00000000..725d1cba
--- /dev/null
+++ b/internal/thintest/activity_subjects_contract_test.go
@@ -0,0 +1,81 @@
+package thintest
+
+import (
+ "encoding/json"
+ "strings"
+ "testing"
+
+ "amadan.net/oficina/equipo/internal/equipo"
+ "amadan.net/oficina/equipo/internal/wire"
+)
+
+func activityEvents(t *testing.T, r *toolRig) []wire.Activity {
+ t.Helper()
+ events, err := r.inst.Store.Chat().Events(r.ctx, Owner, 0, 1000)
+ if err != nil {
+ t.Fatal(err)
+ }
+ var out []wire.Activity
+ for _, e := range events {
+ if e.Type == wire.EventActivity && e.ID == r.turn {
+ var a wire.Activity
+ if err := json.Unmarshal(e.Data, &a); err != nil {
+ t.Fatal(err)
+ }
+ out = append(out, a)
+ }
+ }
+ return out
+}
+
+func TestContractActivitySubjects(t *testing.T) {
+ r := newToolRig(t) // An unchanged protocol-1 runner gets named activities too.
+ other := personToolRig(t, r, "second@example.com", equipo.RoleOwner)
+ own := taskID(t, r.call("record", wire.ToolRecordTask, map[string]string{"repo": "oficina/sample", "title": "Project threads"}))
+ secret := taskID(t, other.call("record", wire.ToolRecordTask, map[string]string{"repo": "oficina/sample", "title": "Someone else's private title"}))
+ cases := []struct {
+ name, tool string
+ args any
+ want string
+ }{
+ {"own", wire.ToolReadTask, map[string]string{"task": own}, "Checking ‘Project threads’…"},
+ {"other", wire.ToolReadTask, map[string]string{"task": secret}, "Checking the task…"},
+ {"unknown", wire.ToolReadTask, map[string]string{"task": "/private/raw-input"}, "Checking the task…"},
+ {"report", wire.ToolAddReport, map[string]string{"task": own, "text": "/private/raw-input"}, "Adding to ‘Project threads’…"},
+ {"hold", wire.ToolHoldMerge, map[string]string{"task": own}, "Holding the merge for ‘Project threads’…"},
+ {"read", wire.ToolReadFile, map[string]string{"repo": "oficina/sample", "path": "/private/raw-input"}, "Reading oficina/sample…"},
+ {"search", wire.ToolSearchCode, map[string]string{"repo": "oficina/sample", "query": "/private/raw-input"}, "Searching oficina/sample…"},
+ {"unreachable", wire.ToolSearchCode, map[string]string{"repo": "/private/raw-input", "query": "secret"}, "Searching the code…"},
+ {"add", wire.ToolAddProject, map[string]string{"repo": "oficina/sample"}, "Adding oficina/sample…"},
+ {"star", wire.ToolStarProject, map[string]any{"project": "oficina/sample", "starred": true}, "Starring oficina/sample…"},
+ {"create-known", wire.ToolCreateProject, map[string]string{"repo": "amadan.net/oficina/sample"}, "Creating oficina/sample…"},
+ {"create-new", wire.ToolCreateProject, map[string]string{"repo": "amadan.net/oficina/raw-input"}, "Creating a repository…"},
+ {"start", wire.ToolStartTask, map[string]string{"task": own}, "Handing ‘Project threads’ to Engineering…"},
+ {"cancel", wire.ToolCancelTask, map[string]string{"task": own}, "Cancelling ‘Project threads’…"},
+ }
+ for _, tc := range cases {
+ t.Run(tc.name, func(t *testing.T) {
+ before := len(activityEvents(t, r))
+ r.call(tc.name, tc.tool, tc.args)
+ acts := activityEvents(t, r)
+ if len(acts) != before+1 {
+ t.Fatalf("got %d new activities, want 1", len(acts)-before)
+ }
+ got := acts[len(acts)-1]
+ if got.Tool != tc.tool || got.Label != tc.want {
+ t.Fatalf("activity %+v, want %q", got, tc.want)
+ }
+ raw, _ := json.Marshal(got)
+ if strings.Contains(string(raw), "raw-input") || strings.Contains(string(raw), "private title") {
+ t.Fatalf("input or another person's subject leaked: %s", raw)
+ }
+ })
+ }
+ // An old attempt cannot publish a new subject.
+ before := len(activityEvents(t, r))
+ r.attempt = 2
+ r.call("stale", wire.ToolReadTask, map[string]string{"task": own})
+ if len(activityEvents(t, r)) != before {
+ t.Fatal("stale call published activity")
+ }
+}
diff --git a/internal/thintest/questions_contract_test.go b/internal/thintest/questions_contract_test.go
index 583759cc..910a2f0c 100644
--- a/internal/thintest/questions_contract_test.go
+++ b/internal/thintest/questions_contract_test.go
@@ -174,6 +174,14 @@ func TestContractAskImplementer(t *testing.T) {
if act.Tool != "read_change" || act.Label == "" {
t.Fatalf("activity %+v", act)
}
+ if act.Label != "Looking at the change on ‘"+eng.Branch+"’…" {
+ t.Fatalf("creator's change subject: %+v", act)
+ }
+ mate.conv.Locked(func(c *Conversation) {
+ if got := c.Activity[q1.ID][0].Label; got != "Looking at the change…" {
+ t.Fatalf("another person's change was named: %q", got)
+ }
+ })
// Nothing streams into anyone's conversation.
r.conv.Locked(func(c *Conversation) {
if c.DeltaResources["turn"] != 0 {
diff --git a/internal/thintest/thinking_browser_test.go b/internal/thintest/thinking_browser_test.go
index 10b389b5..ff921bfc 100644
--- a/internal/thintest/thinking_browser_test.go
+++ b/internal/thintest/thinking_browser_test.go
@@ -17,7 +17,7 @@ import (
// TestBrowserThinkingWords: the Thinking words page previews the chosen
// set on the Stardust line, at 1280 and 390; a set chosen elsewhere
// reaches an open conversation's thinking line with no reload, while the
-// line's label and tooltip stay the plain activity; Random takes one of
+// tool labels stay plain; Random takes one of
// the sets for the turn.
func TestBrowserThinkingWords(t *testing.T) {
r := newToolRig(t)
@@ -33,14 +33,7 @@ func TestBrowserThinkingWords(t *testing.T) {
raw, _ := json.Marshal(phrases[set][sit])
return string(raw)
}
- anyOf := func(set string) string {
- var all []string
- for _, l := range phrases[set] {
- all = append(all, l...)
- }
- raw, _ := json.Marshal(all)
- return string(raw)
- }
+
for _, size := range []struct {
w, h int64
touch bool
@@ -48,13 +41,13 @@ func TestBrowserThinkingWords(t *testing.T) {
p := openInner(t, r.inst.URL, r.inst.Cookie(), size.w, size.h, size.touch, "light", "no-preference")
p.open("/settings/thinking")
preview := `document.querySelector('[data-preview-phrase]').textContent`
- p.wait(anyOf("professional")+`.includes(`+preview+`)`, "the preview shows Professional")
+ p.wait(in("professional", "think")+`.includes(`+preview+`)`, "the preview shows Professional")
// Picking a set saves it at once (Paul, iPhone: the button below was
// easy to miss, and the line kept the default).
p.check(`(()=>{document.querySelector('[data-set="pirate"] label').click();return document.querySelector('input[value="pirate"]').checked})()`, "pick Pirate adventure")
p.wait(`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.wait(in("pirate", "think")+`.includes(`+preview+`)`, "the preview shows Pirate adventure")
p.check(`document.querySelector('[data-preview-line]').dataset.set==='pirate'`, "preview set")
if got, _ := r.client.Thinking(r.ctx); got.Set != "pirate" {
t.Fatalf("saved %s", got.Set)
@@ -83,17 +76,17 @@ func TestBrowserThinkingWords(t *testing.T) {
if err := r.runner.Send(r.ctx, "act-read", wire.FrameActivity, wire.ActivityReport{TurnID: r.turn, Attempt: 1, Kind: wire.ActivityTool, Tool: wire.ToolReadFile}); err != nil {
t.Fatal(err)
}
- p.wait(in("galaxy", "read")+`.includes(`+phrase+`)`, "Galaxy far away while reading")
+ p.wait(phrase+`==='Reading the code…'`, "plain label while reading")
p.check(line+`.querySelector('[equipo-activity]').textContent==='Reading the code…' && `+line+`.querySelector('[equipo-activity-line]').title==='Reading the code…'`, "the plain activity is not the label and tooltip")
cur, _ = r.client.Thinking(r.ctx)
if _, err := r.client.SetThinking(r.ctx, "random", cur.Revision); err != nil {
t.Fatal(err)
}
p.wait(`document.querySelector('[data-chat-stream]').dataset.thinkingSet==='random'`, "Random reached the page")
- if err := r.runner.Send(r.ctx, "act-search", wire.FrameActivity, wire.ActivityReport{TurnID: r.turn, Attempt: 1, Kind: wire.ActivityTool, Tool: wire.ToolSearchCode}); err != nil {
+ if err := r.runner.Send(r.ctx, "act-search", wire.FrameActivity, wire.ActivityReport{TurnID: r.turn, Attempt: 1, Kind: wire.ActivityThink}); err != nil {
t.Fatal(err)
}
- p.wait(`(()=>{const l=`+line+`;const s=l?.dataset.thinkingWords;const all={professional:`+in("professional", "search")+`,playful:`+in("playful", "search")+`,galaxy:`+in("galaxy", "search")+`,bridge:`+in("bridge", "search")+`,pirate:`+in("pirate", "search")+`,terminal:`+in("terminal", "search")+`};return !!s && s!=='random' && (all[s]||[]).includes(`+phrase+`)})()`, "Random took one set for the turn")
+ p.wait(`(()=>{const l=`+line+`;const s=l?.dataset.thinkingWords;const all={professional:`+in("professional", "think")+`,playful:`+in("playful", "think")+`,galaxy:`+in("galaxy", "think")+`,bridge:`+in("bridge", "think")+`,pirate:`+in("pirate", "think")+`,terminal:`+in("terminal", "think")+`};return !!s && s!=='random' && (all[s]||[]).includes(`+phrase+`)})()`, "Random took one set for the turn")
p.stayed("conversation")
}
@@ -103,8 +96,8 @@ func TestBrowserThinkingWords(t *testing.T) {
// situation's first phrase holds 5 s, then a new one every 6 to 8 s; the
// phrases come from a shuffled deck, none again until all have shown,
// across two turns (a reload keeps only localStorage); after the deck runs
-// out the next is none of the last three; a new activity switches to its
-// own phrases at once; under reduced motion the words still change.
+// out the next is none of the last three; a tool shows its plain label
+// at once; under reduced motion the thinking words still change.
//
// The page's clock stands still but for the test (clock below): each
// phrase is held to just under its minimum while the phrase timer looks,
@@ -114,10 +107,10 @@ func TestBrowserThinkingWords(t *testing.T) {
func TestBrowserThinkingCycles(t *testing.T) {
r := newToolRig(t)
words, _ := r.client.Thinking(r.ctx)
- var think, read []string
+ var think []string
for _, s := range words.Sets {
if s.ID == wire.DefaultThinking {
- think, read = s.Phrases["think"], s.Phrases["read"]
+ think = s.Phrases["think"]
}
}
js := func(v any) string { raw, _ := json.Marshal(v); return string(raw) }
@@ -224,11 +217,11 @@ func TestBrowserThinkingCycles(t *testing.T) {
}
}
dwelt(from)
- // A new activity: its own phrases at once.
+ // A tool activity: its plain label at once.
if err := r.runner.Send(r.ctx, "cyc-read-"+motion, wire.FrameActivity, wire.ActivityReport{TurnID: r.turn, Attempt: 1, Kind: wire.ActivityTool, Tool: wire.ToolReadFile}); err != nil {
t.Fatal(err)
}
- p.wait(js(read)+`.includes(`+phrase+`)`, "a reading phrase at once")
+ p.wait(phrase+`==='Reading the code…'`, "a plain reading label at once")
if motion == "reduce" {
p.check(`getComputedStyle(document.querySelector('[equipo-sparkle] path')).animationName==='none'`, "the mark moves under reduced motion")
}
diff --git a/internal/thintest/tools_contract_test.go b/internal/thintest/tools_contract_test.go
index 3318ed7e..ae446861 100644
--- a/internal/thintest/tools_contract_test.go
+++ b/internal/thintest/tools_contract_test.go
@@ -238,7 +238,7 @@ func TestContractTools(t *testing.T) {
shape(t, "api/event-activity.json", raw)
var a wire.Activity
_ = json.Unmarshal(e.Data, &a)
- if a.Label != "Adding a project…" || a.Tool != wire.ToolAddProject {
+ if (a.Label != "Adding a project…" && a.Label != "Adding oficina/sample…") || a.Tool != wire.ToolAddProject {
t.Fatalf("activity %+v", a)
}
}
diff --git a/internal/wire/api.go b/internal/wire/api.go
index e57b7537..faffef6b 100644
--- a/internal/wire/api.go
+++ b/internal/wire/api.go
@@ -279,8 +279,8 @@ type Activity struct {
Attempt int64 `json:"attempt"`
Kind string `json:"kind"`
Tool string `json:"tool"`
- // Repo is the repository a read tool looks at, when known (a name
- // from the catalog, never a path or query).
+ // Repo is the repository named by the activity, when known (a name
+ // from the person's catalog, never a path or query).
Repo string `json:"repo"`
Label string `json:"label"`
}
diff --git a/internal/wire/thinking.go b/internal/wire/thinking.go
index 90bb13c3..b27b9e09 100644
--- a/internal/wire/thinking.go
+++ b/internal/wire/thinking.go
@@ -2,8 +2,8 @@ package wire
// Thinking words: the phrases the thinking line shows while a turn runs,
// in a set each person picks (GET and PUT /api/v1/thinking). The words
-// only flavour what is happening; the line's accessible label and its
-// tooltip stay the plain activity. Sets and situations are fixed here;
+// fill the gaps between tools; tool labels stay plain. The accessible
+// label and tooltip keep the full activity. Sets are fixed here;
// their names and phrases are the instance's copy.
// ThinkingSets are the sets, the default first; ThinkingRandom picks one
@@ -16,9 +16,8 @@ const (
ThinkingRandom = "random"
)
-// ThinkingSituations are what a turn can be doing: thinking, reading,
-// searching, writing a note, handing work to Engineering, or any other
-// tool.
+// ThinkingSituations keeps the existing API phrase groups for older
+// clients. Current conversation and Settings views use only "think".
var ThinkingSituations = []string{"think", "read", "search", "note", "handoff", "tool"}
// ThinkingSet is one set: its name, a line about it, and its phrases by