Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ indexmap = "2"
include_dir = "0.7"

# HTTP client
reqwest = { version = "0.12", default-features = false, features = ["rustls-tls-native-roots", "json", "stream", "multipart"] }
reqwest = { version = "0.12", default-features = false, features = ["native-tls", "rustls-tls-native-roots", "json", "stream", "multipart"] }

# Debug Log HTTP Server
axum = { version = "0.7", features = ["json", "ws"] }
Expand Down
2 changes: 1 addition & 1 deletion src/apps/cli/src/ui/theme.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use once_cell::sync::Lazy;
/// Theme and style definitions
use std::collections::{HashMap, HashSet};
use std::io::IsTerminal;
use std::path::Path;
use std::time::{Duration, Instant};

use once_cell::sync::Lazy;
use ratatui::style::{Color, Modifier, Style};

#[cfg(unix)]
Expand Down
1 change: 1 addition & 0 deletions src/apps/desktop/src/api/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ pub mod miniapp_api;
pub mod path_target;
pub mod project_context_api;
pub mod remote_connect_api;
pub mod review_platform_api;
pub mod runtime_api;
pub mod search_api;
pub mod session_api;
Expand Down
201 changes: 201 additions & 0 deletions src/apps/desktop/src/api/review_platform_api.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,201 @@
//! Review platform Tauri commands.

use crate::api::app_state::AppState;
use bitfun_core::service::review_platform::{
ReviewPlatformCiLog, ReviewPlatformDetailSection, ReviewPlatformKind,
ReviewPlatformPullRequestDetail, ReviewPlatformPullRequestDetailPage, ReviewPlatformService,
ReviewPlatformWorkspaceSnapshot,
};
use log::error;
use serde::Deserialize;
use tauri::State;

#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ReviewPlatformWorkspaceSnapshotRequest {
pub repository_path: String,
pub remote_id: Option<String>,
pub page: Option<u32>,
pub per_page: Option<u32>,
}

#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ReviewPlatformPullRequestDetailRequest {
pub repository_path: String,
pub remote_id: String,
pub pull_request_id: String,
}

#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ReviewPlatformPullRequestDetailPageRequest {
pub repository_path: String,
pub remote_id: String,
pub pull_request_id: String,
pub section: ReviewPlatformDetailSection,
pub page: Option<u32>,
pub per_page: Option<u32>,
}

#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ReviewPlatformPullRequestCiLogRequest {
pub repository_path: String,
pub remote_id: String,
pub pull_request_id: String,
pub ci_item_id: String,
pub ci_item_name: String,
}

#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ReviewPlatformUpdateAuthTokenRequest {
pub platform: ReviewPlatformKind,
pub host: String,
pub token: String,
}

#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct ReviewPlatformClearAuthTokenRequest {
pub platform: ReviewPlatformKind,
pub host: String,
}

#[tauri::command]
pub async fn review_platform_get_workspace_snapshot(
_state: State<'_, AppState>,
request: ReviewPlatformWorkspaceSnapshotRequest,
) -> Result<ReviewPlatformWorkspaceSnapshot, String> {
ReviewPlatformService::workspace_snapshot(
&request.repository_path,
request.remote_id.as_deref(),
request.page,
request.per_page,
)
.await
.map_err(|error| {
error!(
"Failed to get review platform workspace snapshot: path={}, remote_id={:?}, error={}",
request.repository_path, request.remote_id, error
);
format!(
"Failed to get review platform workspace snapshot: {}",
error
)
})
}

#[tauri::command]
pub async fn review_platform_get_pull_request_detail(
_state: State<'_, AppState>,
request: ReviewPlatformPullRequestDetailRequest,
) -> Result<ReviewPlatformPullRequestDetail, String> {
ReviewPlatformService::pull_request_detail(
&request.repository_path,
&request.remote_id,
&request.pull_request_id,
)
.await
.map_err(|error| {
error!(
"Failed to get review platform pull request detail: path={}, remote_id={}, pull_request_id={}, error={}",
request.repository_path,
request.remote_id,
request.pull_request_id,
error
);
format!("Failed to get review platform pull request detail: {}", error)
})
}

#[tauri::command]
pub async fn review_platform_get_pull_request_detail_page(
_state: State<'_, AppState>,
request: ReviewPlatformPullRequestDetailPageRequest,
) -> Result<ReviewPlatformPullRequestDetailPage, String> {
ReviewPlatformService::pull_request_detail_page(
&request.repository_path,
&request.remote_id,
&request.pull_request_id,
request.section,
request.page,
request.per_page,
)
.await
.map_err(|error| {
error!(
"Failed to get review platform pull request detail page: path={}, remote_id={}, pull_request_id={}, section={:?}, page={:?}, per_page={:?}, error={}",
request.repository_path,
request.remote_id,
request.pull_request_id,
request.section,
request.page,
request.per_page,
error
);
format!(
"Failed to get review platform pull request detail page: {}",
error
)
})
}

#[tauri::command]
pub async fn review_platform_get_pull_request_ci_log(
_state: State<'_, AppState>,
request: ReviewPlatformPullRequestCiLogRequest,
) -> Result<ReviewPlatformCiLog, String> {
ReviewPlatformService::pull_request_ci_log(
&request.repository_path,
&request.remote_id,
&request.pull_request_id,
&request.ci_item_id,
&request.ci_item_name,
)
.await
.map_err(|error| {
error!(
"Failed to get review platform CI log: path={}, remote_id={}, pull_request_id={}, ci_item_id={}, error={}",
request.repository_path,
request.remote_id,
request.pull_request_id,
request.ci_item_id,
error
);
format!("Failed to get review platform CI log: {}", error)
})
}

#[tauri::command]
pub async fn review_platform_update_auth_token(
_state: State<'_, AppState>,
request: ReviewPlatformUpdateAuthTokenRequest,
) -> Result<(), String> {
ReviewPlatformService::update_auth_token(request.platform, &request.host, &request.token)
.await
.map_err(|error| {
error!(
"Failed to update review platform auth token: platform={:?}, host={}, error={}",
request.platform, request.host, error
);
format!("Failed to update review platform auth token: {}", error)
})
}

#[tauri::command]
pub async fn review_platform_clear_auth_token(
_state: State<'_, AppState>,
request: ReviewPlatformClearAuthTokenRequest,
) -> Result<(), String> {
ReviewPlatformService::clear_auth_token(request.platform, &request.host)
.await
.map_err(|error| {
error!(
"Failed to clear review platform auth token: platform={:?}, host={}, error={}",
request.platform, request.host, error
);
format!("Failed to clear review platform auth token: {}", error)
})
}
7 changes: 7 additions & 0 deletions src/apps/desktop/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ use api::i18n_api::*;
use api::lsp_api::*;
use api::lsp_workspace_api::*;
use api::mcp_api::*;
use api::review_platform_api::*;
use api::runtime_api::*;
use api::search_api::*;
use api::session_api::*;
Expand Down Expand Up @@ -713,6 +714,12 @@ pub async fn run() {
git_is_repository,
git_get_repository_basic,
git_get_repository,
review_platform_get_workspace_snapshot,
review_platform_get_pull_request_detail,
review_platform_get_pull_request_detail_page,
review_platform_get_pull_request_ci_log,
review_platform_update_auth_token,
review_platform_clear_auth_token,
git_get_status,
git_get_branches,
git_get_enhanced_branches,
Expand Down
1 change: 1 addition & 0 deletions src/crates/ai-adapters/src/client/http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ pub(crate) fn create_http_client(
skip_ssl_verify: bool,
) -> Client {
let mut builder = Client::builder()
.use_rustls_tls()
.connect_timeout(std::time::Duration::from_secs(
AIClient::STREAM_CONNECT_TIMEOUT_SECS,
))
Expand Down
2 changes: 2 additions & 0 deletions src/crates/core/src/agentic/tools/implementations/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ pub mod ls_tool;
pub mod mcp_tools;
pub mod miniapp_init_tool;
pub mod playbook_tool;
pub mod review_platform_tool;
pub mod session_control_tool;
pub mod session_history_tool;
pub mod session_message_tool;
Expand Down Expand Up @@ -68,6 +69,7 @@ pub use mcp_tools::{
};
pub use miniapp_init_tool::InitMiniAppTool;
pub use playbook_tool::PlaybookTool;
pub use review_platform_tool::ReviewPlatformTool;
pub use session_control_tool::SessionControlTool;
pub use session_history_tool::SessionHistoryTool;
pub use session_message_tool::SessionMessageTool;
Expand Down
Loading
Loading