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/server/mod.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/server/mod.rs')
| -rw-r--r-- | makima/src/server/mod.rs | 72 |
1 files changed, 38 insertions, 34 deletions
diff --git a/makima/src/server/mod.rs b/makima/src/server/mod.rs index e5b55e7..927e9a5 100644 --- a/makima/src/server/mod.rs +++ b/makima/src/server/mod.rs @@ -18,7 +18,7 @@ use tower_http::trace::TraceLayer; use utoipa::OpenApi; use utoipa_swagger_ui::SwaggerUi; -use crate::server::handlers::{api_keys, chains, chat, contract_chat, contract_daemon, contract_discuss, contracts, file_ws, files, history, listen, mesh, mesh_chat, mesh_daemon, mesh_merge, mesh_supervisor, mesh_ws, repository_history, speak, templates, transcript_analysis, users, versions}; +use crate::server::handlers::{api_keys, chat, contract_chat, contract_daemon, contract_discuss, contracts, directives, file_ws, files, history, listen, mesh, mesh_chat, mesh_daemon, mesh_merge, mesh_supervisor, mesh_ws, repository_history, speak, templates, transcript_analysis, users, versions}; use crate::server::openapi::ApiDoc; use crate::server::state::SharedState; @@ -214,51 +214,55 @@ pub fn make_router(state: SharedState) -> Router { ) // Timeline endpoint (unified history for user) .route("/timeline", get(history::get_timeline)) - // Chain endpoints (multi-contract orchestration) + // Directive endpoints (replacement for chains) .route( - "/chains", - get(chains::list_chains).post(chains::create_chain), + "/directives", + get(directives::list_directives).post(directives::create_directive), ) - .route("/chains/init", post(chains::init_chain)) .route( - "/chains/{id}", - get(chains::get_chain) - .put(chains::update_chain) - .delete(chains::delete_chain), + "/directives/{id}", + get(directives::get_directive) + .put(directives::update_directive) + .delete(directives::archive_directive), ) - .route("/chains/{id}/contracts", get(chains::get_chain_contracts)) - .route("/chains/{id}/graph", get(chains::get_chain_graph)) - .route("/chains/{id}/events", get(chains::get_chain_events)) - .route("/chains/{id}/editor", get(chains::get_chain_editor)) - // Chain contract definitions + .route("/directives/{id}/start", post(directives::start_directive)) + .route("/directives/{id}/pause", post(directives::pause_directive)) + .route("/directives/{id}/resume", post(directives::resume_directive)) + .route("/directives/{id}/stop", post(directives::stop_directive)) + // Directive chain management + .route("/directives/{id}/chain", get(directives::get_chain)) + .route("/directives/{id}/chain/graph", get(directives::get_chain_graph)) + .route("/directives/{id}/chain/replan", post(directives::replan_chain)) + // Directive step management .route( - "/chains/{id}/definitions", - get(chains::list_chain_definitions).post(chains::create_chain_definition), + "/directives/{id}/chain/steps", + post(directives::add_step), ) .route( - "/chains/{chain_id}/definitions/{definition_id}", - put(chains::update_chain_definition).delete(chains::delete_chain_definition), + "/directives/{id}/chain/steps/{step_id}", + get(directives::get_step) + .put(directives::update_step) + .delete(directives::delete_step), ) + .route("/directives/{id}/chain/steps/{step_id}/skip", post(directives::skip_step)) + // Directive evaluations + .route("/directives/{id}/evaluations", get(directives::list_evaluations)) + // Directive events + .route("/directives/{id}/events", get(directives::list_events)) + .route("/directives/{id}/events/stream", get(directives::stream_events)) + // Directive verifiers .route( - "/chains/{id}/definitions/graph", - get(chains::get_chain_definition_graph), + "/directives/{id}/verifiers", + get(directives::list_verifiers).post(directives::add_verifier), ) - // Chain control - .route("/chains/{id}/start", post(chains::start_chain)) - .route("/chains/{id}/stop", post(chains::stop_chain)) - // Chain repositories .route( - "/chains/{id}/repositories", - get(chains::list_chain_repositories).post(chains::add_chain_repository), - ) - .route( - "/chains/{chain_id}/repositories/{repository_id}", - axum::routing::delete(chains::delete_chain_repository), - ) - .route( - "/chains/{chain_id}/repositories/{repository_id}/primary", - put(chains::set_chain_repository_primary), + "/directives/{id}/verifiers/{verifier_id}", + axum::routing::put(directives::update_verifier), ) + // Directive approvals + .route("/directives/{id}/approvals", get(directives::list_approvals)) + .route("/directives/{id}/approvals/{approval_id}/approve", post(directives::approve_request)) + .route("/directives/{id}/approvals/{approval_id}/deny", post(directives::deny_request)) // Contract type templates (built-in only) .route("/contract-types", get(templates::list_contract_types)) // Settings endpoints |
