IPC types & channel setup #6

Closed
opened 2026-04-16 11:28:46 +00:00 by claude-desktop · 0 comments
Collaborator

User story

As a developer wiring the app crate, I want clearly defined IPC types (AppCommand, AppEvent, TerminalCommand, GitCommand) and a factory for creating the tokio channel pair (mpsc + broadcast), so that the frontend and backend can communicate without network sockets.

Acceptance criteria

IPC types (backend/src/ipc.rs)

  • AppCommand enum with variants: Orchestration(OrchestrationCommand), Terminal(TerminalCommand), Git(GitCommand), Settings(SettingsCommand)
  • AppEvent enum with variants: DomainEvent(StoredEvent), TerminalOutput { terminal_id, data: Vec<u8> }, TerminalSnapshot { terminal_id, history: Vec<u8> }, GitStatus { project_path, status }, Error { context, message }
  • TerminalCommand enum: Open, Write, Resize, Close, Restart — all with fields matching spec §6.1
  • GitCommand enum: GetStatus, GetDiff, GetBranches, GetLog — all with fields matching spec §6.1
  • SettingsCommand placeholder (at minimum an UpdateConfig variant)

Channel factory (IpcChannels)

  • IpcChannels struct holding: command_tx: mpsc::Sender<AppCommand>, command_rx: mpsc::Receiver<AppCommand>, event_tx: broadcast::Sender<AppEvent>, event_rx: broadcast::Receiver<AppEvent>
  • IpcChannels::new(cmd_buffer: usize, evt_buffer: usize) -> Self factory
  • All AppCommand and AppEvent types implement Debug + Clone + Send

IpcClient (frontend/src/ipc_client.rs)

  • IpcClient struct wrapping mpsc::Sender<AppCommand> and broadcast::Receiver<AppEvent>
  • send(&self, cmd: AppCommand) -> Result<(), IpcError> — async send
  • next_event(&self) -> Result<AppEvent, IpcError> — async receive
  • IpcClient is Clone-able (sender clones, receiver subscribes to broadcast)

Tests

  • Test: send command through channel, receive on other end
  • Test: broadcast event reaches multiple subscribers

Out of scope

  • GTK ↔ tokio thread bridge (covered by the bootstrap/app-shell story)
  • Actual command handling logic (engine story)

References

  • Spec §6 (IPC interne)

Dependencies

  • Blocked by: #4 (OrchestrationCommand, StoredEvent)
  • Blocks: #7, #13
  • Branch off: issue-4-event-sourcing
  • Full graph: #21
## User story As a **developer wiring the app crate**, I want clearly defined IPC types (`AppCommand`, `AppEvent`, `TerminalCommand`, `GitCommand`) and a factory for creating the tokio channel pair (mpsc + broadcast), so that the frontend and backend can communicate without network sockets. ## Acceptance criteria ### IPC types (`backend/src/ipc.rs`) - [ ] `AppCommand` enum with variants: `Orchestration(OrchestrationCommand)`, `Terminal(TerminalCommand)`, `Git(GitCommand)`, `Settings(SettingsCommand)` - [ ] `AppEvent` enum with variants: `DomainEvent(StoredEvent)`, `TerminalOutput { terminal_id, data: Vec<u8> }`, `TerminalSnapshot { terminal_id, history: Vec<u8> }`, `GitStatus { project_path, status }`, `Error { context, message }` - [ ] `TerminalCommand` enum: `Open`, `Write`, `Resize`, `Close`, `Restart` — all with fields matching spec §6.1 - [ ] `GitCommand` enum: `GetStatus`, `GetDiff`, `GetBranches`, `GetLog` — all with fields matching spec §6.1 - [ ] `SettingsCommand` placeholder (at minimum an `UpdateConfig` variant) ### Channel factory (`IpcChannels`) - [ ] `IpcChannels` struct holding: `command_tx: mpsc::Sender<AppCommand>`, `command_rx: mpsc::Receiver<AppCommand>`, `event_tx: broadcast::Sender<AppEvent>`, `event_rx: broadcast::Receiver<AppEvent>` - [ ] `IpcChannels::new(cmd_buffer: usize, evt_buffer: usize) -> Self` factory - [ ] All `AppCommand` and `AppEvent` types implement `Debug + Clone + Send` ### IpcClient (`frontend/src/ipc_client.rs`) - [ ] `IpcClient` struct wrapping `mpsc::Sender<AppCommand>` and `broadcast::Receiver<AppEvent>` - [ ] `send(&self, cmd: AppCommand) -> Result<(), IpcError>` — async send - [ ] `next_event(&self) -> Result<AppEvent, IpcError>` — async receive - [ ] `IpcClient` is `Clone`-able (sender clones, receiver subscribes to broadcast) ### Tests - [ ] Test: send command through channel, receive on other end - [ ] Test: broadcast event reaches multiple subscribers ## Out of scope - GTK ↔ tokio thread bridge (covered by the bootstrap/app-shell story) - Actual command handling logic (engine story) ## References - Spec §6 (IPC interne) ## Dependencies - **Blocked by:** #4 (OrchestrationCommand, StoredEvent) - **Blocks:** #7, #13 - **Branch off:** `issue-4-event-sourcing` - **Full graph:** #21
claude-desktop added this to the v0.1.0 milestone 2026-04-16 11:28:46 +00:00
Sign in to join this conversation.
No description provided.