Files
hikari-desktop/src-tauri/src/lib.rs
T
hikari 2e5de9dc5e feat: add temp file management system for file uploads (#62)
Implements the foundation for file upload support by adding a temp file
management system that tracks files per conversation.

- Add temp_manager.rs module with TempFileManager struct
- Add Tauri commands: save_temp_file, register_temp_file, get_temp_files,
  cleanup_temp_files, cleanup_all_temp_files, cleanup_orphaned_temp_files
- Clean up orphaned files from previous sessions on app startup
- Clean up temp files when conversation is deleted
- Store temp files in /tmp/hikari-uploads/ with unique UUIDs
2026-01-24 13:50:50 -08:00

83 lines
2.5 KiB
Rust

mod achievements;
mod bridge_manager;
mod commands;
mod config;
mod notifications;
mod stats;
mod temp_manager;
mod types;
mod vbs_notification;
mod windows_toast;
mod wsl_bridge;
mod wsl_notifications;
use bridge_manager::create_shared_bridge_manager;
use commands::load_saved_achievements;
use commands::*;
use notifications::*;
use temp_manager::create_shared_temp_manager;
use vbs_notification::*;
use windows_toast::*;
use wsl_notifications::*;
#[cfg_attr(mobile, tauri::mobile_entry_point)]
pub fn run() {
let bridge_manager = create_shared_bridge_manager();
let temp_manager = create_shared_temp_manager().expect("Failed to create temp file manager");
tauri::Builder::default()
.plugin(tauri_plugin_dialog::init())
.plugin(tauri_plugin_opener::init())
.plugin(tauri_plugin_shell::init())
.plugin(tauri_plugin_store::Builder::new().build())
.plugin(tauri_plugin_notification::init())
.plugin(tauri_plugin_os::init())
.plugin(tauri_plugin_http::init())
.manage(bridge_manager.clone())
.manage(temp_manager.clone())
.setup(move |app| {
// Initialize the app handle in the bridge manager
bridge_manager.lock().set_app_handle(app.handle().clone());
// Clean up any orphaned temp files from previous sessions
if let Ok(count) = temp_manager.lock().cleanup_orphaned_files() {
if count > 0 {
println!("Cleaned up {} orphaned temp files", count);
}
}
Ok(())
})
.invoke_handler(tauri::generate_handler![
start_claude,
stop_claude,
interrupt_claude,
send_prompt,
is_claude_running,
get_working_directory,
select_wsl_directory,
get_config,
save_config,
get_usage_stats,
load_saved_achievements,
answer_question,
send_windows_notification,
send_simple_notification,
send_windows_toast,
send_notify_send,
send_wsl_notification,
send_vbs_notification,
validate_directory,
list_skills,
check_for_updates,
save_temp_file,
register_temp_file,
get_temp_files,
cleanup_temp_files,
cleanup_all_temp_files,
cleanup_orphaned_temp_files,
])
.run(tauri::generate_context!())
.expect("error while running tauri application");
}