810608d3d8
Add notify-based filesystem watcher for .story_kit/work/ that auto-commits changes with deterministic messages and broadcasts events over WebSocket. Push full pipeline state (Upcoming, Current, QA, To Merge) to frontend on connect and after every watcher event. Strip dead UI: remove ReviewPanel, GatePanel, TodoPanel, UpcomingPanel and all associated REST polling. Replace with 4 generic StagePanel components driven by WebSocket. Simplify AgentPanel to roster-only. Delete all 11 workflow HTTP endpoints and 16 request/response types from the server. Clean dead code from workflow module. MCP tools call Rust functions directly and need none of the HTTP layer. Net: ~4,100 lines deleted, ~400 added. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
96 lines
2.4 KiB
Rust
96 lines
2.4 KiB
Rust
pub mod agents;
|
|
pub mod agents_sse;
|
|
pub mod anthropic;
|
|
pub mod assets;
|
|
pub mod chat;
|
|
pub mod context;
|
|
pub mod health;
|
|
pub mod io;
|
|
pub mod mcp;
|
|
pub mod model;
|
|
pub mod settings;
|
|
pub mod workflow;
|
|
|
|
pub mod project;
|
|
pub mod ws;
|
|
|
|
use agents::AgentsApi;
|
|
use anthropic::AnthropicApi;
|
|
use chat::ChatApi;
|
|
use context::AppContext;
|
|
use io::IoApi;
|
|
use model::ModelApi;
|
|
use poem::EndpointExt;
|
|
use poem::{Route, get, post};
|
|
use poem_openapi::OpenApiService;
|
|
use project::ProjectApi;
|
|
use settings::SettingsApi;
|
|
use std::sync::Arc;
|
|
|
|
pub fn build_routes(ctx: AppContext) -> impl poem::Endpoint {
|
|
let ctx_arc = std::sync::Arc::new(ctx);
|
|
|
|
let (api_service, docs_service) = build_openapi_service(ctx_arc.clone());
|
|
|
|
Route::new()
|
|
.nest("/api", api_service)
|
|
.nest("/docs", docs_service.swagger_ui())
|
|
.at("/ws", get(ws::ws_handler))
|
|
.at(
|
|
"/agents/:story_id/:agent_name/stream",
|
|
get(agents_sse::agent_stream),
|
|
)
|
|
.at(
|
|
"/mcp",
|
|
post(mcp::mcp_post_handler).get(mcp::mcp_get_handler),
|
|
)
|
|
.at("/health", get(health::health))
|
|
.at("/assets/*path", get(assets::embedded_asset))
|
|
.at("/", get(assets::embedded_index))
|
|
.at("/*path", get(assets::embedded_file))
|
|
.data(ctx_arc)
|
|
}
|
|
|
|
type ApiTuple = (
|
|
ProjectApi,
|
|
ModelApi,
|
|
AnthropicApi,
|
|
IoApi,
|
|
ChatApi,
|
|
AgentsApi,
|
|
SettingsApi,
|
|
);
|
|
|
|
type ApiService = OpenApiService<ApiTuple, ()>;
|
|
|
|
/// All HTTP methods are documented by OpenAPI at /docs
|
|
pub fn build_openapi_service(ctx: Arc<AppContext>) -> (ApiService, ApiService) {
|
|
let api = (
|
|
ProjectApi { ctx: ctx.clone() },
|
|
ModelApi { ctx: ctx.clone() },
|
|
AnthropicApi::new(ctx.clone()),
|
|
IoApi { ctx: ctx.clone() },
|
|
ChatApi { ctx: ctx.clone() },
|
|
AgentsApi { ctx: ctx.clone() },
|
|
SettingsApi { ctx: ctx.clone() },
|
|
);
|
|
|
|
let api_service =
|
|
OpenApiService::new(api, "Story Kit API", "1.0").server("http://127.0.0.1:3001/api");
|
|
|
|
let docs_api = (
|
|
ProjectApi { ctx: ctx.clone() },
|
|
ModelApi { ctx: ctx.clone() },
|
|
AnthropicApi::new(ctx.clone()),
|
|
IoApi { ctx: ctx.clone() },
|
|
ChatApi { ctx: ctx.clone() },
|
|
AgentsApi { ctx: ctx.clone() },
|
|
SettingsApi { ctx },
|
|
);
|
|
|
|
let docs_service =
|
|
OpenApiService::new(docs_api, "Story Kit API", "1.0").server("http://127.0.0.1:3001/api");
|
|
|
|
(api_service, docs_service)
|
|
}
|