cmux NEXT: a folded long thought reads "Thought for 12s"

Merged
TE
19d ago
+7059-780

A long thought folded by #20948's fold now reads "Thought for 12s", the time from its first chunk to its latest, the way Codex's reasoning trace reads once it ends. A thought that's undated or under a second reads "Thought". The fold itself is still behind the Debug toggle agentPane.debug.foldLongThoughts.

#20948's folded line ("Thought" plus the thought's first line) is kept as a choice. Debug Settings > Pages > "Folded thought header" (agentPane.debug.thoughtHeader) offers duration (the default) or preview. When it's preview, the app sets data-thought-header="preview" on the agent page's <html>, the same way foldLongThoughts sets its attribute. New agent tabs read it.

  • thoughtDuration in ThoughtRow.tsx clamps with Math.max(0, endedAt - startedAt), as toolGroups.ts does for tool calls, so out-of-order events never give a negative time.
  • The comments in direct.ts and model.ts from #21630 now name thoughtDuration, which exists as of this PR.
  • The new string tools.thoughtFor ("Thought for {time}") is in all 21 pane locales. The English is translated; the other locales are needs_review, like their neighbours. The translations come from #20963. generated/strings.json and home-channels/generated/pane-strings.json are regenerated with gen-strings.mjs.

Part of #20963's split. The live viewport and the default-on fold come in later slices.

Freeze WINDOW areas: Packages/macOS/CmuxNext (Debug tunables in AgentPaneTunables.swift), and the agent pane string catalog webviews/src/agent-session/acpmux/Localizable.xcstrings.

Testing

  • bun test src/agent-session/acpmux/conversation/ThoughtRow.test.tsx passes, 12 tests. They cover:
    • a folded thought reading "Thought for 12s" without its text, opened or closed;
    • an undated thought, or one under a second, reading "Thought";
    • the clamp on out-of-order dates;
    • the preview choice reading "Thought" plus the first line.
  • bun run check in webviews/ passes. gen-strings.mjs --check is current. lint-ios-package-conventions.sh --namespace-fix is clean.
  • Localization audit: there's one new user-facing string, tools.thoughtFor, with all 21 locales in the catalog and in both generated files. check-l10n.sh reports no error for the agent pane catalog. The errors it does report are all in CmuxNextSidebar, which this PR doesn't touch. The Debug tunable's title and help are bare English, like every other Debug tunable.
  • Not run here (Linux): AgentPaneThoughtTunablesTests.swift, which checks the tunable key, its default, its data-thought-header attribute and its listing in Debug Settings, and the Chromium gallery lanes (no Chromium on this host). CI runs both.

Changelog

none

๐Ÿค– Generated with Claude Code


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.


Summary by cubic

A folded long thought now reads "Thought for 12s" โ€” the time from its first chunk to its latest, the way Codex's reasoning trace reads once it ends. An undated thought, or one under a second, reads "Thought". The branch also carries the merged feat-cmux-next work: evicted terminals show their last frame at once when shown again, workspaces record name provenance, acpmux starts no-ask modes by inherit or an approved preset, and indicators name their state under the static look.

Thought header

  • agentPane.debug.thoughtHeader in Debug Settings keeps #20948's "Thought" plus first line as the preview choice alongside the duration default; preview sets data-thought-header on the page's <html> for new agent tabs.
  • Duration clamps at zero so out-of-order events never show a negative time; new string tools.thoughtFor is in all 21 pane locales.

Merged feat-cmux-next work

  • An evicted terminal's last IOSurface is kept volatile (no copy) and shows at once when the terminal is shown again, until its fresh surface draws; GhosttyNextKit is pinned to a19c884fa.
  • Workspaces carry name_source and name_revision; rename-workspace gains source, expected_name_revision and release, with name-pinned and revision-conflict fences.
  • acpmux starts a no-ask mode when a proven caller session runs that exact mode or a preset the person approved once; refusals name where to approve.
  • Under the static look (or Reduce Motion) tabs draw still marks, the attention ring is steady, and every indicator's tooltip and VoiceOver label names its state.