[CMUX Next] Chief pet: quick reply into a session or the Chief

Closed
TE
14d ago
+1030-67

Summary

Third of four Chief pet PRs, stacked on #21732. Click the pet to chat with a session or the Chief from anywhere, even when cmux isn't focused.

Clicking the pet, or the rail's compose button, opens a reply capsule just above the pet. It's the same size and glass as the notice capsules. Codex's Chief Dock has no reply from outside cmux, so this part is new. The capsule takes the keys without activating cmux, the same way Start Agent's panel does, so the app you're in stays in front. A menu picks who the message goes to: the notices over the pet, newest first, then the Chief.

  • Chief: Return sends the text to the Chief's conversation through HomeStore.send. That covers this Mac's Chief or a paired server's (TopHomePageView.chief).
  • A terminal session (the notice's tab is a pty): Return pastes the text into that terminal and sends Return as its own key, on the tab's own machine. This is the notify --reply banner's path, now shared as NotificationCenterService.type(_:into:). The reply reads the tab, so its notice leaves the capsules.
  • An agent chat: Return opens the session in the floating chat when that is on (quickComposer.moveToFloatingChat), and otherwise opens its tab. The pet never injects a prompt into a local acpmux chat. That relay requires a gesture ticket from the chat's own composer and refuses prompts without one (AgentPaneHandshake), so typing happens in the chat itself. The placeholder says so ("Return opens …").
  • ⌘Return opens the target instead: Home for the Chief, or the notice's tab.
  • Esc, a click elsewhere, or a sent reply closes the box. A failed send beeps and keeps the text.

Also moves code (no behavior change): to keep CmuxNextApp from growing (SW14), this PR moves the Quick Agent Chat's panel (QuickComposerPanel, its floating extension, and QuickComposerWindow) into CmuxNextFloating alongside the pet. It needs only AppKit and the design system. The App's source shrinks by 155 lines.

Testing

ChiefPetReplyTests (CmuxNextFloatingTests) covers:

  • the target list and the Return/⌘Return decisions, including that an agent chat opens instead of sending;
  • the placeholders;
  • that a pet click opens the box on the newest notice in the bubble's place, without activating cmux and able to take keys, and that a second click puts it away;
  • that a failed send keeps the text and a sent one clears and closes the box;
  • that agent chats and ⌘Return call open, not send.

ChiefPetNoticeTests checks that terminal notices arrive with the typed-reply mode. The existing FloatingChatTests still cover the moved panel.

These run in this PR's cmux-next CI lane. They were not run locally (Linux host).

Not covered by a test: the App's sendChiefPetReply and openChiefPetTarget routing against a live Chief and a live terminal. That needs a dogfood build.

Localization: four new strings in ChiefPet.xcstrings with all 20 locales: "Message Chief", "Reply to %@", "Return opens %@", "Send to". Chief stays untranslated.

Changelog

none (off by default behind a Debug Settings toggle)

Proof

Matched: chief-chat-source-captures/d154d558 (the compose rail and capsule size), same 1034 × 670 pixel size. The references show no composer, so the reply box takes the capsule's look:

reply

The right side is a composite at @2x from this PR's sizes, not a screen capture; the live look needs a dogfood build.

🤖 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

Lets the Chief pet answer a session or the Chief from anywhere, even when cmux isn’t focused.

  • Clicking the pet or the rail’s compose button opens a reply capsule over the notices’ place; it takes the keys without activating cmux.
  • A menu picks who gets the message: the notices over the pet, newest first, then the Chief.
  • Return types into a terminal or sends to the Chief’s conversation; for an agent chat it opens the chat, since the pet can’t send a prompt without the chat’s own gesture.
  • ⌘Return opens the target; Esc, a click elsewhere, or a sent reply closes the box, and a failed send beeps and keeps the text.

Refactors

  • Moves the Quick Agent Chat panel into CmuxNextFloating alongside the pet; no behavior change.