Contracts crate — shared domain types #2

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

User story

As a backend or frontend developer, I want a contracts crate containing all shared domain types (Project, Thread, Turn, Message, Checkpoint, enums, read model, git types, terminal types, keybinding types), so that both sides of the application use a single source of truth for data structures.

Acceptance criteria

Orchestration types (orchestration.rs)

  • Project struct with fields: id: Uuid, name: String, path: String, created_at: DateTime<Utc>
  • Thread struct with fields: id, project_id, title: Option<String>, provider: Provider, model: String, runtime_mode: RuntimeMode, status: ThreadStatus, created_at, updated_at
  • Provider enum: Claude, Codex
  • RuntimeMode enum: FullAccess, Supervised
  • ThreadStatus enum: Idle, Running, AwaitingApproval, Error(String), Completed
  • Turn struct with all fields from spec §4.1
  • TurnStatus enum: Running, Completed, Interrupted, Failed(String)
  • Message struct with id, turn_id, role: MessageRole, content: MessageContent, created_at
  • MessageRole enum: User, Assistant, Tool, System
  • MessageContent enum: Text, ToolCall, ToolResult, ThinkingBlock
  • Checkpoint struct with all fields from spec §4.1
  • OrchestrationReadModel struct with projects, threads, turns_by_thread, checkpoints_by_thread, active_thread_id, active_project_id

Git types (git.rs)

  • GitStatus, FileChange, FileChangeStatus, FileDiff, DiffHunk, DiffLine, CommitInfo, BranchInfo — all as per spec §8.3

Terminal types (terminal.rs)

  • TerminalStatus enum: Starting, Running, Stopped

Keybinding types (keybindings.rs)

  • Keybinding, KeySpec, KeyScope structs/enums as per spec §11.1

Quality

  • All types derive Debug, Clone, Serialize, Deserialize
  • Crate compiles with only serde, uuid, chrono, serde_json as dependencies (no heavy deps)
  • Unit tests for serde round-trip on key types

Out of scope

  • IPC types (AppCommand, AppEvent) — those live in backend::ipc (see issue for IPC/bootstrap)
  • Event types (OrchestrationEvent) — see event sourcing story

References

  • Spec §4 (Modèle de données)
  • Spec §8.3 (Types contrats Git)
  • Spec §11.1 (Keybindings définition)
## User story As a **backend or frontend developer**, I want a `contracts` crate containing all shared domain types (Project, Thread, Turn, Message, Checkpoint, enums, read model, git types, terminal types, keybinding types), so that both sides of the application use a single source of truth for data structures. ## Acceptance criteria ### Orchestration types (`orchestration.rs`) - [ ] `Project` struct with fields: `id: Uuid`, `name: String`, `path: String`, `created_at: DateTime<Utc>` - [ ] `Thread` struct with fields: `id`, `project_id`, `title: Option<String>`, `provider: Provider`, `model: String`, `runtime_mode: RuntimeMode`, `status: ThreadStatus`, `created_at`, `updated_at` - [ ] `Provider` enum: `Claude`, `Codex` - [ ] `RuntimeMode` enum: `FullAccess`, `Supervised` - [ ] `ThreadStatus` enum: `Idle`, `Running`, `AwaitingApproval`, `Error(String)`, `Completed` - [ ] `Turn` struct with all fields from spec §4.1 - [ ] `TurnStatus` enum: `Running`, `Completed`, `Interrupted`, `Failed(String)` - [ ] `Message` struct with `id`, `turn_id`, `role: MessageRole`, `content: MessageContent`, `created_at` - [ ] `MessageRole` enum: `User`, `Assistant`, `Tool`, `System` - [ ] `MessageContent` enum: `Text`, `ToolCall`, `ToolResult`, `ThinkingBlock` - [ ] `Checkpoint` struct with all fields from spec §4.1 - [ ] `OrchestrationReadModel` struct with `projects`, `threads`, `turns_by_thread`, `checkpoints_by_thread`, `active_thread_id`, `active_project_id` ### Git types (`git.rs`) - [ ] `GitStatus`, `FileChange`, `FileChangeStatus`, `FileDiff`, `DiffHunk`, `DiffLine`, `CommitInfo`, `BranchInfo` — all as per spec §8.3 ### Terminal types (`terminal.rs`) - [ ] `TerminalStatus` enum: `Starting`, `Running`, `Stopped` ### Keybinding types (`keybindings.rs`) - [ ] `Keybinding`, `KeySpec`, `KeyScope` structs/enums as per spec §11.1 ### Quality - [ ] All types derive `Debug, Clone, Serialize, Deserialize` - [ ] Crate compiles with only `serde`, `uuid`, `chrono`, `serde_json` as dependencies (no heavy deps) - [ ] Unit tests for serde round-trip on key types ## Out of scope - IPC types (`AppCommand`, `AppEvent`) — those live in `backend::ipc` (see issue for IPC/bootstrap) - Event types (`OrchestrationEvent`) — see event sourcing story ## References - Spec §4 (Modèle de données) - Spec §8.3 (Types contrats Git) - Spec §11.1 (Keybindings définition)
claude-desktop added this to the v0.1.0 milestone 2026-04-16 11:27:53 +00:00
Sign in to join this conversation.
No description provided.