Skip to content

Commit 7d75f2b

Browse files
committed
update files
1 parent 9bdf40b commit 7d75f2b

198 files changed

Lines changed: 13142 additions & 3511 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎Cargo.lock‎

Lines changed: 410 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎Cargo.toml‎

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,9 @@ base64 = "0.22"
8282
include_dir = "0.7"
8383
image = { version = "0.25", default-features = false, features = ["jpeg", "png", "ico"] }
8484

85+
enigo = { version = "0.6", optional = true }
86+
xcap = { version = "0.9", optional = true }
87+
8588
urlencoding = "2.1"
8689

8790
nanohtml2text = "0.2"
@@ -110,6 +113,7 @@ globset = "0.4"
110113
uuid = { version = "1.22", default-features = false, features = ["v4", "std"] }
111114

112115
chacha20poly1305 = "0.10"
116+
argon2 = "0.5"
113117

114118
hmac = "0.12"
115119
sha2 = "0.10"
@@ -192,6 +196,9 @@ local-ip-address = { version = "0.6", optional = true }
192196
x25519-dalek = { version = "2", default-features = false, features = ["static_secrets", "zeroize"], optional = true }
193197
calamine = { version = "0.35.0", optional = true }
194198
quick-xml = { version = "0.40.1", optional = true }
199+
rust_xlsxwriter = { version = "0.95", optional = true }
200+
lopdf = { version = "0.41", optional = true }
201+
printpdf = { version = "0.9", default-features = false, optional = true }
195202

196203
[target.'cfg(any(target_os = "linux", target_os = "macos", target_os = "windows"))'.dependencies]
197204
nusb = { version = "0.2", default-features = false, optional = true }
@@ -218,6 +225,7 @@ tree-sitter = { version = "0.24", optional = true }
218225
tree-sitter-highlight = { version = "0.24", optional = true }
219226
tree-sitter-rust = { version = "0.23", optional = true }
220227
tree-sitter-javascript = { version = "0.23", optional = true }
228+
tree-sitter-typescript = { version = "0.23", optional = true }
221229
tree-sitter-python = { version = "0.23", optional = true }
222230
tree-sitter-json = { version = "0.24", optional = true }
223231
tree-sitter-toml-ng = { version = "0.7", optional = true }
@@ -273,6 +281,7 @@ code-intel = [
273281
"dep:tree-sitter-highlight",
274282
"dep:tree-sitter-rust",
275283
"dep:tree-sitter-javascript",
284+
"dep:tree-sitter-typescript",
276285
"dep:tree-sitter-python",
277286
"dep:tree-sitter-json",
278287
"dep:tree-sitter-toml-ng",
@@ -324,6 +333,7 @@ plugins-wasm = ["dep:extism"]
324333
runtime-wasm = ["dep:wasmi"]
325334
webauthn = []
326335
crdt-coordination = []
336+
computer-use = ["dep:enigo", "dep:xcap"]
327337
lsp-push-diagnostics = []
328338
evals-swebench-docker = []
329339
ci-all = [
@@ -386,8 +396,8 @@ tool-image = []
386396
tool-search-broad = []
387397
tool-workspace-deep = []
388398
tool-curator = ["dep:docx-rs"]
389-
office-docs = ["dep:calamine", "dep:quick-xml", "rag-pdf"]
390-
extras = ["tool-cron", "tool-sop", "tool-team", "tool-cloud-ops", "tool-reports", "tool-linkedin", "tool-pushover", "tool-search-social", "tool-productivity", "tool-utility-misc", "tool-image", "tool-search-broad", "tool-workspace-deep", "tool-curator", "office-docs"]
399+
office-docs = ["dep:calamine", "dep:quick-xml", "dep:rust_xlsxwriter", "dep:lopdf", "dep:printpdf", "rag-pdf"]
400+
extras = ["tool-cron", "tool-sop", "tool-team", "tool-cloud-ops", "tool-reports", "tool-linkedin", "tool-pushover", "tool-search-social", "tool-productivity", "tool-utility-misc", "tool-image", "tool-search-broad", "tool-workspace-deep", "tool-curator", "office-docs", "computer-use"]
391401

392402
[profile.dev]
393403
incremental = true

‎desktop/src-tauri/Cargo.toml‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,15 @@ senweavercoding = { path = "../..", package = "SenWeaverCoding", default-feature
4242
"channels-lite",
4343
"whatsapp-web",
4444
"lan-comms",
45+
"computer-use",
4546
] }
4647

47-
tauri = { version = "2.11", features = ["unstable", "image-png"] }
48+
tauri = { version = "2.11", features = ["unstable", "image-png", "tray-icon"] }
4849
tauri-plugin-shell = "2"
4950
tauri-plugin-dialog = "2"
5051
tauri-plugin-process = "2"
5152
tauri-plugin-updater = "2"
53+
tauri-plugin-single-instance = "2"
5254

5355
tokio = { version = "1.50", default-features = false, features = ["rt-multi-thread", "macros", "time", "net", "io-util", "sync"] }
5456
axum = { version = "0.8", default-features = false, features = ["http1", "json", "tokio", "query", "ws", "macros"] }

‎desktop/src-tauri/capabilities/default.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"core:window:allow-is-focused",
1313
"core:window:allow-is-minimized",
1414
"core:window:allow-show",
15+
"core:window:allow-hide",
1516
"core:window:allow-set-focus",
1617
"core:window:allow-start-dragging",
1718
"core:window:allow-start-resize-dragging",

‎desktop/src-tauri/src/lib.rs‎

Lines changed: 141 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -786,6 +786,137 @@ fn signal_frontend_ready(
786786
Ok(())
787787
}
788788

789+
#[tauri::command]
790+
fn quit_app(app: AppHandle) {
791+
app.exit(0);
792+
}
793+
794+
#[cfg(target_os = "windows")]
795+
fn force_show_foreground_window(window: &tauri::WebviewWindow) {
796+
use windows_sys::Win32::Foundation::HWND;
797+
use windows_sys::Win32::UI::WindowsAndMessaging::{
798+
BringWindowToTop, IsIconic, SetForegroundWindow, SetWindowPos, ShowWindow, HWND_NOTOPMOST,
799+
HWND_TOPMOST, SWP_NOACTIVATE, SWP_NOMOVE, SWP_NOSIZE, SW_RESTORE, SW_SHOW,
800+
};
801+
802+
let Ok(hwnd) = window.hwnd() else {
803+
return;
804+
};
805+
let raw = hwnd.0 as HWND;
806+
if raw.is_null() {
807+
return;
808+
}
809+
810+
unsafe {
811+
if IsIconic(raw) != 0 {
812+
ShowWindow(raw, SW_RESTORE);
813+
} else {
814+
ShowWindow(raw, SW_SHOW);
815+
}
816+
817+
SetWindowPos(
818+
raw,
819+
HWND_TOPMOST,
820+
0,
821+
0,
822+
0,
823+
0,
824+
SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE,
825+
);
826+
SetWindowPos(
827+
raw,
828+
HWND_NOTOPMOST,
829+
0,
830+
0,
831+
0,
832+
0,
833+
SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE,
834+
);
835+
BringWindowToTop(raw);
836+
SetForegroundWindow(raw);
837+
}
838+
839+
reapply_chrome_styles(raw);
840+
}
841+
842+
fn show_and_focus_main_window(app: &AppHandle) {
843+
let win = app
844+
.get_webview_window("main")
845+
.or_else(|| app.webview_windows().into_values().next())
846+
.or_else(|| app.try_state::<MainWindowHandle>().map(|h| h.inner().0.clone()));
847+
let Some(win) = win else {
848+
tracing::warn!("[sen-desktop] tray reveal: no main window handle available");
849+
return;
850+
};
851+
852+
#[cfg(target_os = "windows")]
853+
force_show_foreground_window(&win);
854+
855+
let win_main = win.clone();
856+
let dispatched = app.run_on_main_thread(move || {
857+
if win_main.is_minimized().unwrap_or(false) {
858+
let _ = win_main.unminimize();
859+
}
860+
if let Err(err) = win_main.show() {
861+
tracing::warn!("[sen-desktop] tray reveal show() failed: {err}");
862+
}
863+
let _ = win_main.set_focus();
864+
#[cfg(target_os = "windows")]
865+
force_show_foreground_window(&win_main);
866+
});
867+
if let Err(err) = dispatched {
868+
tracing::warn!("[sen-desktop] tray reveal run_on_main_thread failed: {err}");
869+
let _ = win.show();
870+
let _ = win.set_focus();
871+
}
872+
}
873+
874+
const TRAY_QUIT_EVENT: &str = "tray://quit-requested";
875+
876+
fn setup_system_tray(app: &AppHandle) -> tauri::Result<()> {
877+
use tauri::menu::{Menu, MenuItem};
878+
use tauri::tray::{MouseButton, MouseButtonState, TrayIconBuilder, TrayIconEvent};
879+
880+
let show_item = MenuItem::with_id(app, "tray_show", "显示主窗口", true, None::<&str>)?;
881+
let quit_item = MenuItem::with_id(app, "tray_quit", "退出", true, None::<&str>)?;
882+
let menu = Menu::with_items(app, &[&show_item, &quit_item])?;
883+
884+
let mut builder = TrayIconBuilder::with_id("sen-main-tray")
885+
.tooltip("SenWeaverCoding")
886+
.menu(&menu)
887+
.show_menu_on_left_click(false)
888+
.on_menu_event(|app, event| match event.id.as_ref() {
889+
"tray_show" => show_and_focus_main_window(app),
890+
"tray_quit" => {
891+
if let Err(err) = app.emit(TRAY_QUIT_EVENT, ()) {
892+
tracing::warn!("[sen-desktop] emit {TRAY_QUIT_EVENT} failed: {err}");
893+
}
894+
}
895+
_ => {}
896+
})
897+
.on_tray_icon_event(|tray, event| match event {
898+
TrayIconEvent::Click {
899+
button: MouseButton::Left,
900+
button_state: MouseButtonState::Up,
901+
..
902+
}
903+
| TrayIconEvent::DoubleClick {
904+
button: MouseButton::Left,
905+
..
906+
} => {
907+
show_and_focus_main_window(tray.app_handle());
908+
}
909+
_ => {}
910+
});
911+
912+
if let Some(icon) = app.default_window_icon() {
913+
builder = builder.icon(icon.clone());
914+
}
915+
916+
builder.build(app)?;
917+
Ok(())
918+
}
919+
789920
const FRONTEND_READY_TIMEOUT_MS: u64 = 60_000;
790921

791922
fn show_main_window_now(window: &tauri::WebviewWindow) {
@@ -1132,6 +1263,9 @@ pub fn run() {
11321263
.manage(TerminalState::default())
11331264
.manage(DockSharedState::new())
11341265
.register_uri_scheme_protocol("senbridge", browser_dock::senbridge_protocol_handler)
1266+
.plugin(tauri_plugin_single_instance::init(|app, _argv, _cwd| {
1267+
show_and_focus_main_window(app);
1268+
}))
11351269
.plugin(tauri_plugin_shell::init())
11361270
.plugin(tauri_plugin_dialog::init())
11371271
.plugin(tauri_plugin_process::init())
@@ -1144,6 +1278,7 @@ pub fn run() {
11441278
open_log_dir,
11451279
prepare_for_update_install,
11461280
signal_frontend_ready,
1281+
quit_app,
11471282
reveal_in_explorer,
11481283
read_local_image_data_url,
11491284
curator_render_docx_with_diagrams,
@@ -1201,6 +1336,10 @@ pub fn run() {
12011336
browser_dock::install_into(app.handle());
12021337
fetch_worker::install_into(app.handle());
12031338

1339+
if let Err(err) = setup_system_tray(app.handle()) {
1340+
tracing::warn!("[sen-desktop] system tray setup failed: {err}");
1341+
}
1342+
12041343
let handle = app.handle().clone();
12051344

12061345
let server_state = app.state::<ServerState>().inner().clone();
@@ -1278,12 +1417,12 @@ pub fn run() {
12781417

12791418
app.run(|app_handle, event| match event {
12801419
RunEvent::ExitRequested { .. } => {
1281-
1420+
let _ = app_handle.remove_tray_by_id("sen-main-tray");
12821421
process_lifetime::run_full_shutdown(app_handle, Duration::from_secs(8));
12831422
kill_gateway_child();
12841423
}
12851424
RunEvent::Exit => {
1286-
1425+
let _ = app_handle.remove_tray_by_id("sen-main-tray");
12871426
process_lifetime::run_full_shutdown(app_handle, Duration::from_secs(2));
12881427
kill_gateway_child();
12891428
}

‎desktop/src/api/autoDream.ts‎

Lines changed: 0 additions & 64 deletions
This file was deleted.

‎desktop/src/api/browser.ts‎

Lines changed: 0 additions & 31 deletions
This file was deleted.

‎desktop/src/api/computer.ts‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// SPDX-License-Identifier: MIT
2+
// Copyright (c) 2025-2026 SenWeaverCoding
3+
// Licensed under the MIT License.
4+
5+
import { api } from './client'
6+
7+
export type VisionModel = {
8+
provider: string
9+
provider_name: string
10+
model: string
11+
explicit_vision: boolean
12+
recommended: boolean
13+
}
14+
15+
export async function listVisionModels(): Promise<VisionModel[]> {
16+
const res = await api.get<{ models: VisionModel[] }>('/api/computer/vision-models')
17+
return res.models ?? []
18+
}
19+
20+
export async function stopComputerRun(runId: string): Promise<void> {
21+
await api.post('/api/computer/stop', { runId })
22+
}

0 commit comments

Comments
 (0)