diff options
| author | soryu <soryu@soryu.co> | 2026-02-05 23:42:48 +0000 |
|---|---|---|
| committer | soryu <soryu@soryu.co> | 2026-02-05 23:42:48 +0000 |
| commit | 88a4f15ce1310f8ee8693835be14aa5280233f17 (patch) | |
| tree | 5c1a0417e02071d2198d13478ffa85533b19f891 /makima/src/daemon/task/completion_gate.rs | |
| parent | f1a50b80f3969d150bd1c31edde0aff05369157e (diff) | |
| download | soryu-88a4f15ce1310f8ee8693835be14aa5280233f17.tar.gz soryu-88a4f15ce1310f8ee8693835be14aa5280233f17.zip | |
Add directive-first chain system redesign
Redesigns the chain system with a directive-first architecture where
Directive is the top-level entity (the "why/what") and Chains are
generated execution plans (the "how") that can be dynamically modified.
Backend:
- Add database migration for directive system tables
- Add Directive, DirectiveChain, ChainStep, DirectiveEvent models
- Add DirectiveVerifier and DirectiveApproval models
- Add orchestration module with engine, planner, and verifier
- Add comprehensive API handlers for directives
- Add daemon CLI commands for directive management
- Add directive skill documentation
- Integrate contract completion with directive engine
- Add SSE endpoint for real-time directive events
Frontend:
- Add directives route with split-view layout
- Add 6-tab detail view (Overview, Chain, Events, Evaluations, Approvals, Verifiers)
- Add React Flow DAG visualization for chain steps
- Add SSE subscription hook for real-time event updates
- Add useDirectives and useDirectiveEventSubscription hooks
- Add directive types and API functions
Fixes:
- Fix test failures in ws/protocol, task_output, completion_gate, patch
- Fix word boundary matching in looks_like_task()
- Fix parse_last() to find actual last completion gate
- Fix create_export_patch when merge-base equals HEAD
- Clean up clippy warnings in new code
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Diffstat (limited to 'makima/src/daemon/task/completion_gate.rs')
| -rw-r--r-- | makima/src/daemon/task/completion_gate.rs | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/makima/src/daemon/task/completion_gate.rs b/makima/src/daemon/task/completion_gate.rs index 69b7c6a..40a6466 100644 --- a/makima/src/daemon/task/completion_gate.rs +++ b/makima/src/daemon/task/completion_gate.rs @@ -5,7 +5,7 @@ //! development framework. //! //! Format: -//! ``` +//! ```text //! <COMPLETION_GATE> //! ready: true|false //! reason: "explanation of completion status" @@ -133,19 +133,18 @@ impl CompletionGate { /// This is useful when Claude produces multiple completion gates during /// a long-running task, and we want to use the final status. pub fn parse_last(text: &str) -> Option<Self> { + let start_tag = "<COMPLETION_GATE>"; let end_tag = "</COMPLETION_GATE>"; - let mut last_gate = None; - let mut search_start = 0; - while let Some(end_idx) = text[search_start..].find(end_tag) { - let absolute_end = search_start + end_idx + end_tag.len(); - if let Some(gate) = Self::parse(&text[..absolute_end]) { - last_gate = Some(gate); - } - search_start = absolute_end; - } + // Find the last occurrence of the start tag + let start_idx = text.rfind(start_tag)?; + let remaining = &text[start_idx..]; + + // Find the end tag after the last start tag + let end_idx = remaining.find(end_tag)?; - last_gate + // Parse just this last gate + Self::parse(&remaining[..end_idx + end_tag.len()]) } } |
