diff --git a/AGENTS.md b/AGENTS.md index 77d8237..c5a86ba 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -3,9 +3,9 @@ This project implements a lightweight Windows system tray controller for `sing-box` (a universal proxy platform) written in the **Jai** programming language. **Key Project Notes**: -- The built executable is `sing-box_tray.exe`. +- The built executable is `sing-box-tray.exe`. - sing-box core is downloaded on-demand and installed to `%LOCALAPPDATA%\sing-box-tray\`. -- **CRITICAL**: Never terminate sing-box or sing-box_tray processes (see section 5). +- **CRITICAL**: Never terminate sing-box or sing-box-tray processes (see section 5). - Uses only native Win32 APIs (WinINet, no libcurl dependency). - Build via `build.jai` metaprogram (sets windows subsystem, custom entry). @@ -52,6 +52,5 @@ These guidelines apply to any agent working with the Jai programming language. - **Linting & Safety**: Avoid using uninitialized variables unless performance-critical (explicitly mark as `---` if needed). ## 5. Process Management Warning (VPN Connectivity) -- **CRITICAL WARNING**: Do NOT kill, terminate, or stop the `sing-box` or `sing-box_tray` processes during runtime unless explicitly instructed by the user. The agent's own network connection and container/sandbox internet access might be routed through this active VPN. Killing it will sever the agent's connection. +- **CRITICAL WARNING**: Do NOT kill, terminate, or stop the `sing-box` or `sing-box-tray` processes during runtime unless explicitly instructed by the user. The agent's own network connection and container/sandbox internet access might be routed through this active VPN. Killing it will sever the agent's connection. - **Rebuilding & Locked Executables**: Always try to compile the project first. Do not preemptively ask the user to close the executable unless compilation actually fails with a file lock error (e.g. `LNK1104` or similar) and you have verified that the locked file is indeed the output binary in the build directory. Only ask the user to close/free the executable in that specific failure case. - diff --git a/build.jai b/build.jai index 4be614c..3cad85d 100644 --- a/build.jai +++ b/build.jai @@ -13,7 +13,7 @@ if !w return; options := get_build_options(w); - options.output_executable_name = "sing-box_tray"; + options.output_executable_name = "sing-box-tray"; // No longer need to copy libcurl.dll since we use native Windows WinINet API. diff --git a/main.jai b/main.jai index af2c873..8bcae37 100644 --- a/main.jai +++ b/main.jai @@ -39,7 +39,7 @@ init_userspace_paths :: (is_test: bool) { config_name := ifx is_test then "config_test.json" else "config.json"; config_run_name := ifx is_test then "config_run_test.json" else "config_run.json"; - log_name := ifx is_test then "sing-box_tray_test.log" else "sing-box_tray.log"; + log_name := ifx is_test then "sing-box-tray_test.log" else "sing-box-tray.log"; global_config_path = sprint("%\\%", global_userspace_dir, config_name); global_config_run_path = sprint("%\\%", global_userspace_dir, config_run_name); @@ -62,7 +62,7 @@ init_userspace_paths :: (is_test: bool) { defer free(test_config); test_config_run := sprint("%\\config_run_test.json", global_userspace_dir); defer free(test_config_run); - test_log := sprint("%\\sing-box_tray_test.log", global_userspace_dir); + test_log := sprint("%\\sing-box-tray_test.log", global_userspace_dir); defer free(test_log); test_singbox_log := sprint("%\\sing-box_test.log", global_userspace_dir); defer free(test_singbox_log); @@ -129,7 +129,7 @@ append_to_log_file :: (text: string) { OPEN_ALWAYS :: 4; FILE_END :: 2; - filename := ifx global_log_path.count > 0 then global_log_path else (ifx global_is_test_mode then "sing-box_tray_test.log" else "sing-box_tray.log"); + filename := ifx global_log_path.count > 0 then global_log_path else (ifx global_is_test_mode then "sing-box-tray_test.log" else "sing-box-tray.log"); wide_path := utf8_to_wide(filename); hFile := CreateFileW( @@ -194,7 +194,7 @@ log_write :: (level: Log_Level, format_string: string, args: .. Any) { // Write to OutputDebugStringW (useful for live debugging in VS / DebugView) OutputDebugStringW(utf8_to_wide(colored_log)); - // Append to sing-box_tray.log file + // Append to sing-box-tray.log file append_to_log_file(colored_log); } @@ -218,7 +218,7 @@ log_singbox :: (message: string, is_test_mode: bool) { OutputDebugStringW(utf8_to_wide(colored_log)); // Append to the correct log file - filename := ifx global_log_path.count > 0 then global_log_path else (ifx is_test_mode then "sing-box_tray_test.log" else "sing-box_tray.log"); + filename := ifx global_log_path.count > 0 then global_log_path else (ifx is_test_mode then "sing-box-tray_test.log" else "sing-box-tray.log"); wide_path := utf8_to_wide(filename); hFile := CreateFileW(