feat: complete Epic 1 production foundation
This commit is contained in:
1 parent
767428436d
commit
182bde8ac0
298 files changed
+35711
-5291
No files matched your search
@@ -1,10 +1,15 @@
|
||||
use axum::{
|
||||
Router, middleware,
|
||||
Router,
|
||||
extract::DefaultBodyLimit,
|
||||
middleware,
|
||||
routing::{delete, get, post},
|
||||
};
|
||||
|
||||
use crate::{
|
||||
auth::{require_session, require_workspace_session},
|
||||
auth::{
|
||||
enforce_browser_security, require_csrf_for_browser_mutations, require_session,
|
||||
require_workspace_session,
|
||||
},
|
||||
rate_limit::apply_api_rate_limit,
|
||||
request_context::apply_request_context,
|
||||
routes::{
|
||||
@@ -15,14 +20,18 @@ use crate::{
|
||||
list_agent_platform_api_keys, list_agents, preview_tool_search, publish_agent,
|
||||
revoke_agent_platform_api_key, save_agent_bindings, unpublish_agent, update_agent,
|
||||
},
|
||||
auth::{change_password, get_profile, get_session, login, logout, update_profile},
|
||||
auth::{
|
||||
bootstrap_status, change_password, complete_bootstrap, get_profile, get_session, login,
|
||||
logout, refresh_session_csrf, update_profile,
|
||||
},
|
||||
auth_profiles::{create_auth_profile, get_auth_profile, list_auth_profiles},
|
||||
capabilities::get_capabilities,
|
||||
imports::{create_openapi_import, preview_openapi_import},
|
||||
observability::{
|
||||
get_agent_usage, get_approval, get_log, get_operation_usage, get_usage, list_approvals,
|
||||
list_logs,
|
||||
approve_approval, deny_approval, export_logs_csv, export_usage_csv, get_agent_usage,
|
||||
get_approval, get_log, get_operation_usage, get_usage, list_approvals, list_logs,
|
||||
},
|
||||
onboarding::{get_onboarding, record_onboarding_event, reset_onboarding_selection},
|
||||
operations::{
|
||||
analyze_operation_quality, archive_operation, create_operation, create_version,
|
||||
delete_operation, export_operation, generate_draft, get_operation,
|
||||
@@ -48,7 +57,10 @@ pub fn build_app(state: AppState) -> Router {
|
||||
"/operations/analyze-quality",
|
||||
post(analyze_operation_quality),
|
||||
)
|
||||
.route("/operations/import", post(import_operation))
|
||||
.route(
|
||||
"/operations/import",
|
||||
post(import_operation).layer(DefaultBodyLimit::max(256 * 1024)),
|
||||
)
|
||||
.route(
|
||||
"/operations/{operation_id}",
|
||||
get(get_operation)
|
||||
@@ -126,12 +138,22 @@ pub fn build_app(state: AppState) -> Router {
|
||||
.route("/secrets/{secret_id}/rotate", post(rotate_secret))
|
||||
.route("/export", get(export_workspace))
|
||||
.route("/logs", get(list_logs))
|
||||
.route("/logs/export.csv", get(export_logs_csv))
|
||||
.route("/logs/{log_id}", get(get_log))
|
||||
.route("/approvals", get(list_approvals))
|
||||
.route("/approvals/{approval_id}", get(get_approval))
|
||||
.route("/approvals/{approval_id}/approve", post(approve_approval))
|
||||
.route("/approvals/{approval_id}/deny", post(deny_approval))
|
||||
.route("/usage/export.csv", get(export_usage_csv))
|
||||
.route("/usage", get(get_usage))
|
||||
.route("/usage/operations/{operation_id}", get(get_operation_usage))
|
||||
.route("/usage/agents/{agent_id}", get(get_agent_usage));
|
||||
.route("/usage/agents/{agent_id}", get(get_agent_usage))
|
||||
.route("/onboarding", get(get_onboarding))
|
||||
.route("/onboarding/events", post(record_onboarding_event))
|
||||
.route(
|
||||
"/onboarding/reset-selection",
|
||||
post(reset_onboarding_selection),
|
||||
);
|
||||
|
||||
let workspace_root_router = Router::new()
|
||||
.route("/capabilities", get(get_capabilities))
|
||||
@@ -157,6 +179,7 @@ pub fn build_app(state: AppState) -> Router {
|
||||
let protected_auth_router = Router::new()
|
||||
.route("/logout", post(logout))
|
||||
.route("/session", get(get_session))
|
||||
.route("/session/csrf", post(refresh_session_csrf))
|
||||
.route("/profile", get(get_profile).patch(update_profile))
|
||||
.route("/password", post(change_password))
|
||||
.layer(middleware::from_fn_with_state(
|
||||
@@ -170,10 +193,20 @@ pub fn build_app(state: AppState) -> Router {
|
||||
.nest(
|
||||
"/api/auth",
|
||||
Router::new()
|
||||
.route("/bootstrap/status", get(bootstrap_status))
|
||||
.route("/bootstrap/complete", post(complete_bootstrap))
|
||||
.route("/login", post(login))
|
||||
.merge(protected_auth_router),
|
||||
)
|
||||
.nest("/api/admin", admin_router)
|
||||
.layer(middleware::from_fn_with_state(
|
||||
state.clone(),
|
||||
require_csrf_for_browser_mutations,
|
||||
))
|
||||
.layer(middleware::from_fn_with_state(
|
||||
state.clone(),
|
||||
enforce_browser_security,
|
||||
))
|
||||
.layer(middleware::from_fn_with_state(
|
||||
state.clone(),
|
||||
apply_api_rate_limit,
|
||||
|
||||
Reference in new issue
Block a user