diff options
| author | soryu <soryu@soryu.co> | 2026-01-17 06:20:07 +0000 |
|---|---|---|
| committer | soryu <soryu@soryu.co> | 2026-01-17 16:39:24 +0000 |
| commit | bfc5d837c6212a8253accfdf95ae1a2fd692df4e (patch) | |
| tree | 0cc78ff56fd28333d1e502176873d23a26d4c4a1 /makima/src/db/models.rs | |
| parent | 06fb883b2b7a49c7123722463d24b0b4e57c3277 (diff) | |
| download | soryu-bfc5d837c6212a8253accfdf95ae1a2fd692df4e.tar.gz soryu-bfc5d837c6212a8253accfdf95ae1a2fd692df4e.zip | |
feat: Add phase_guard for contract phase transitions
Implement phase_guard logic in the advance_phase tool. When a contract
has phase_guard enabled, the phase transition now:
1. Asks for user confirmation before advancing
2. Allows users to request changes to phase deliverables
3. Passes feedback to the task without advancing if changes requested
Changes:
- Add phase_guard field to Contract model and CreateContractRequest
- Add PhaseTransitionRequest, PhaseFileInfo, PhaseTaskInfo structs
- Update ChangePhaseRequest with confirmed and feedback fields
- Update ContractToolRequest::AdvancePhase with confirmed/feedback
- Modify advance_phase handling in contract_chat.rs with phase_guard logic
- Update change_phase endpoint in contracts.rs with phase_guard support
- Add database migration for phase_guard column
When phase_guard=false: Phase advances immediately (current behavior)
When phase_guard=true: Returns pending_confirmation status with deliverables
If user provides feedback: Returns feedback to task, doesn't advance
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Diffstat (limited to 'makima/src/db/models.rs')
| -rw-r--r-- | makima/src/db/models.rs | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/makima/src/db/models.rs b/makima/src/db/models.rs index 33ef52e..99c8b8e 100644 --- a/makima/src/db/models.rs +++ b/makima/src/db/models.rs @@ -1458,6 +1458,51 @@ pub struct CreateManagedRepositoryRequest { #[serde(rename_all = "camelCase")] pub struct ChangePhaseRequest { pub phase: String, + /// If phase_guard is enabled, this must be true to confirm the transition. + /// If not provided or false, returns phase deliverables for review. + #[serde(default)] + pub confirmed: Option<bool>, + /// User feedback for changes (used when not confirming) + #[serde(skip_serializing_if = "Option::is_none")] + pub feedback: Option<String>, +} + +/// Response for phase transition when phase_guard is enabled +#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)] +#[serde(rename_all = "camelCase")] +pub struct PhaseTransitionRequest { + /// Current contract phase + pub current_phase: String, + /// Requested next phase + pub next_phase: String, + /// Summary of phase deliverables/outputs + pub deliverables_summary: String, + /// List of files created in this phase + pub phase_files: Vec<PhaseFileInfo>, + /// List of completed tasks in this phase + pub phase_tasks: Vec<PhaseTaskInfo>, + /// Whether user confirmation is required + pub requires_confirmation: bool, + /// Unique ID for tracking this transition request + pub transition_id: String, +} + +/// File info for phase transition review +#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)] +#[serde(rename_all = "camelCase")] +pub struct PhaseFileInfo { + pub id: Uuid, + pub name: String, + pub description: Option<String>, +} + +/// Task info for phase transition review +#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)] +#[serde(rename_all = "camelCase")] +pub struct PhaseTaskInfo { + pub id: Uuid, + pub name: String, + pub status: String, } /// Contract event record from the database |
