feat: Enhance OAuth module and OpenRouter client functionality

- Updated OAuth module to include unused imports for better clarity.
- Refactored OpenRouterClient to improve chat functionality and added support for tools in chat requests.
- Modified internet tools (Download, Fetch, Search) to use a more flexible internet mode check.
- Introduced new Bash tools for managing background jobs (BashOutput, BashKill).
- Enhanced workflow tool to parse and execute workflow scripts with arguments.
- Updated status and workflow views to reflect new agent and findings counts.
- Added IPC protocol definitions for client requests and state payloads.
This commit is contained in:
asepharyana
2026-07-11 20:21:59 +07:00
parent c1ad206a00
commit 802d9677ae
42 changed files with 1423 additions and 925 deletions
+1
View File
@@ -8,6 +8,7 @@ pub fn handle_bash_submit(state: &mut AppStateRest, command: String) {
}
}
#[expect(dead_code)]
pub fn handle_bash_dismiss(state: &mut AppStateRest) {
state.misc.overlay = Overlay::None;
state.dirty = true;
-5
View File
@@ -2,7 +2,6 @@ use serde::{Deserialize, Serialize};
#[expect(dead_code)]
pub mod agents;
#[expect(dead_code)]
pub mod bash;
#[expect(dead_code)]
pub mod editor;
@@ -22,17 +21,13 @@ pub mod onboard;
pub mod onboard_provider;
#[expect(dead_code)]
pub mod picker;
#[expect(dead_code)]
pub mod quit_confirm;
#[expect(dead_code)]
pub mod rewind;
#[expect(dead_code)]
pub mod security;
#[expect(dead_code)]
pub mod session_hub;
#[expect(dead_code)]
pub mod settings;
#[expect(dead_code)]
pub mod todo;
#[expect(dead_code)]
pub mod workflow;
+1
View File
@@ -6,6 +6,7 @@ pub fn toggle_security_arm(state: &mut AppStateRest) {
state.dirty = true;
}
#[expect(dead_code)]
pub fn acknowledge_security(state: &mut AppStateRest) {
if !state.misc.security_acknowledged {
state.misc.security_acknowledged = true;
+36 -10
View File
@@ -1,20 +1,46 @@
use crate::model::session::Session;
use crate::app::state::rest::AppStateRest;
use crate::app::state::types::Overlay;
pub fn load_sessions(state: &mut AppStateRest) {
state.sessions = Session::list(&state.session_dir);
let base = state.store_base_dir();
state.sessions = crate::model::session::Session::list(&base);
state.dirty = true;
}
pub fn select_session(state: &mut AppStateRest, session_id: &str) {
if let Some(session) = state.sessions.iter().find(|s| s.id == session_id) {
let display = crate::app::state::rest::ChatMessageDisplay::new(
crate::dto::chat::message::Role::System,
format!("switched to session: {}", session.title),
);
state.push_transcript(display);
state.misc.overlay = Overlay::None;
state.dirty = true;
let base = state.store_base_dir();
let session = crate::model::session::Session::load(session_id, &base).ok();
if session.is_none() {
return;
}
let session = session.unwrap();
let conv_path = session.conversation_path(&base);
let loaded_msgs: Vec<crate::dto::chat::message::ChatMessage> =
std::fs::read_to_string(&conv_path)
.ok()
.and_then(|data| serde_json::from_str(&data).ok())
.unwrap_or_default();
state.session_id = session.id.clone();
state.session_dir = session.session_dir(&base);
state.session_runtime = Some(crate::app::state::runtime::SessionRuntime::new(
state.session_dir.clone(),
));
state.transcript_cache.messages.clear();
if let Some(ref mut rt) = state.session_runtime {
for msg in loaded_msgs {
let display = crate::app::state::rest::ChatMessageDisplay::new(
msg.role.clone(),
msg.content.clone().unwrap_or_default(),
);
state.transcript_cache.messages.push(display);
rt.push_message(msg);
}
}
state.push_transcript(crate::app::state::rest::ChatMessageDisplay::new(
crate::dto::chat::message::Role::System,
format!("switched to session: {}", session.title),
));
state.misc.overlay = Overlay::None;
state.dirty = true;
}
+2
View File
@@ -2,6 +2,7 @@ use crate::app::runtime::actions::Action;
use crate::app::state::rest::AppStateRest;
use crate::model::settings::{Settings, InternetMode};
#[expect(dead_code)]
pub fn apply_settings_action(state: &mut AppStateRest, action: &Action) {
if let Action::ToggleYoloArm = action {
state.misc.yolo_armed = !state.misc.yolo_armed;
@@ -17,6 +18,7 @@ pub fn cycle_internet_mode(settings: &mut Settings) {
};
}
#[expect(dead_code)]
pub fn cycle_review_enabled(settings: &mut Settings) {
settings.review_enabled = !settings.review_enabled;
}