fix: onboarding endpoints send token secret (#4575)

This commit is contained in:
Jack Amadeo
2025-09-09 13:43:46 -04:00
committed by GitHub
parent 0a4c60998f
commit 2080425d9a
7 changed files with 135 additions and 36 deletions
+3
View File
@@ -400,6 +400,8 @@ impl<'__s> ToSchema<'__s> for AnnotatedSchema {
super::routes::recipe::scan_recipe,
super::routes::recipe::list_recipes,
super::routes::recipe::delete_recipe,
super::routes::setup::start_openrouter_setup,
super::routes::setup::start_tetrate_setup,
),
components(schemas(
super::routes::config_management::UpsertConfigQuery,
@@ -496,6 +498,7 @@ impl<'__s> ToSchema<'__s> for AnnotatedSchema {
super::routes::agent::ResumeAgentRequest,
super::routes::agent::StartAgentResponse,
super::routes::agent::ErrorResponse,
super::routes::setup::SetupResponse,
))
)]
pub struct ApiDoc;
+19 -8
View File
@@ -1,12 +1,13 @@
use crate::state::AppState;
use axum::{extract::State, http::StatusCode, routing::post, Json, Router};
use axum::{http::StatusCode, routing::post, Json, Router};
use goose::config::signup_openrouter::OpenRouterAuth;
use goose::config::signup_tetrate::{configure_tetrate, TetrateAuth};
use goose::config::{configure_openrouter, Config};
use serde::Serialize;
use std::sync::Arc;
use utoipa::ToSchema;
#[derive(Serialize)]
#[derive(Serialize, ToSchema)]
pub struct SetupResponse {
pub success: bool,
pub message: String,
@@ -19,9 +20,14 @@ pub fn routes(state: Arc<AppState>) -> Router {
.with_state(state)
}
async fn start_openrouter_setup(
State(_state): State<Arc<AppState>>,
) -> Result<Json<SetupResponse>, StatusCode> {
#[utoipa::path(
post,
path = "/handle_openrouter",
responses(
(status = 200, body=SetupResponse)
),
)]
async fn start_openrouter_setup() -> Result<Json<SetupResponse>, StatusCode> {
tracing::info!("Starting OpenRouter setup flow");
let mut auth_flow = OpenRouterAuth::new().map_err(|e| {
@@ -61,9 +67,14 @@ async fn start_openrouter_setup(
}
}
async fn start_tetrate_setup(
State(_state): State<Arc<AppState>>,
) -> Result<Json<SetupResponse>, StatusCode> {
#[utoipa::path(
post,
path = "/handle_tetrate",
responses(
(status = 200, body=SetupResponse)
),
)]
async fn start_tetrate_setup() -> Result<Json<SetupResponse>, StatusCode> {
tracing::info!("Starting Tetrate Agent Router Service setup flow");
let mut auth_flow = TetrateAuth::new().map_err(|e| {