Terminals
Terminal & Message Bus
Terminal windows are project-aware command surfaces. The message bus lets terminals subscribe to named channels and execute commands broadcast by other terminals.
Terminal Model
TerminalManager owns open terminal objects, selected terminal state, chat messages, system metrics, and window creation. SwiftTerminal tracks terminal identity, name, project path, engine, session ID, command history, current path, status, terminal view mode, and message bus subscriptions.
The app also includes GhosttyTerminal, which bridges Ghostty terminal rendering into an AppKit view for a richer terminal experience.
Terminal Features
- New terminal creation from the main window or project window.
- Project-scoped launch for Claude and Codex.
- Resume and fork launch commands for existing sessions.
- Command bar, saved quick commands, and command history.
- CLI and chat-style output modes.
- System monitoring commands and metrics graphing.
- Per-terminal display names and cleanup actions.
Message Bus Concepts
| Concept | Description |
|---|---|
| Channel | A named topic such as dev, test, or monitoring. |
| Subscriber | A terminal registered to receive messages for a channel. |
| Publisher | A terminal that sends a command to a channel. |
| Response | Captured output routed back to the originating terminal when response collection is enabled. |
Basic Message Bus Workflow
- Open two or more terminal windows.
- Open the message bus panel from the terminal header.
- Subscribe receiving terminals to the same channel.
- Publish a command to that channel from a sender terminal.
- Subscriber terminals execute the command and send output back to the sender.
API Shape
// Terminal-level helpers
terminal.subscribeToChannel("dev")
terminal.unsubscribeFromChannel("dev")
terminal.publishCommand("git status", toChannel: "dev", expectResponse: true)
// Bus-level helpers
MessageBus.shared.getActiveChannels()
MessageBus.shared.getChannelInfo()
Practical Patterns
Monitoring
Subscribe several service terminals to monitoring, then broadcast uptime, pwd, or health commands.
Distributed Testing
Subscribe app, worker, and staging terminals to test, then broadcast test commands and compare responses.
Agent Coordination
Use channels to tell multiple project terminals to inspect status, branch state, or logs before assigning work.
Safety Notes
Message bus subscribers execute received commands automatically. Use explicit channel names and avoid subscribing terminals that point at production or sensitive directories unless command broadcast is intended.