The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
test: cover platform and clipboard branches
Steven Enamakelbd83973780b4
diff --git a/app/src/components/assistant-ui/__tests__/UserActionBar.test.tsx b/app/src/components/assistant-ui/__tests__/UserActionBar.test.tsxindex 452d44e8a6..d9e4e83694 100644--- a/app/src/components/assistant-ui/__tests__/UserActionBar.test.tsx+++ b/app/src/components/assistant-ui/__tests__/UserActionBar.test.tsx@@ -29,7 +29,7 @@ import { AssistantUiRuntimeProvider } from '../../../providers/AssistantUiRuntimimport chatRuntimeReducer from '../../../store/chatRuntimeSlice';import threadReducer from '../../../store/threadSlice';import type { ThreadMessage } from '../../../types/thread';-import { Thread } from '../thread';+import { extractComposerPasteFiles, Thread } from '../thread';const THREAD_ID = 't-action-bar';@@ -64,6 +64,19 @@ function renderThreadWithOneUserMessage() {}describe('User-message action bar — capability-gated Edit (#5897)', () => {+ it('extracts media from either clipboard representation', () => {+ const file = new File(['x'], 'clip.png', { type: 'image/png' });+ expect(+ extractComposerPasteFiles({ items: [], files: [file] } as unknown as DataTransfer)+ ).toEqual([file]);+ expect(+ extractComposerPasteFiles({+ items: [{ kind: 'file', type: 'image/png', getAsFile: () => file }],+ files: [],+ } as unknown as DataTransfer)+ ).toEqual([file]);+ });+it('renders the user message and its action bar', async () => {const { container } = renderThreadWithOneUserMessage();diff --git a/app/src/components/assistant-ui/thread.tsx b/app/src/components/assistant-ui/thread.tsxindex 96bf6cd936..9c36570db4 100644--- a/app/src/components/assistant-ui/thread.tsx+++ b/app/src/components/assistant-ui/thread.tsx@@ -909,6 +909,16 @@ const ThreadSuggestionItem: FC = () => {);};+export function extractComposerPasteFiles(+ clipboardData: DataTransfer | null | undefined+): globalThis.File[] {+ const itemFiles = Array.from(clipboardData?.items ?? [])+ .filter(item => item.kind === 'file' && /^(image|video)\//.test(item.type))+ .map(item => item.getAsFile())+ .filter((file): file is globalThis.File => file !== null);+ return itemFiles.length > 0 ? itemFiles : Array.from(clipboardData?.files ?? []);+}+const Composer: FC<{model: string | null;onModelChange?: (value: string | null, contextWindow?: number | null) => void;@@ -967,15 +977,7 @@ const Composer: FC<{debug('[assistant-composer] paste: refused, ingest not accepting');return;}- const itemFiles = Array.from(event.clipboardData?.items ?? [])- .filter(item => item.kind === 'file' && /^(image|video)\//.test(item.type))- .map(item => item.getAsFile())- .filter((file): file is File => file !== null);- // Real clipboard events expose media through `items`; synthetic browser- // events (including the Playwright path) may populate only `files`.- // Accept both representations so paste follows the same ingest path as- // the picker and dropzone.- const files = itemFiles.length > 0 ? itemFiles : Array.from(event.clipboardData?.files ?? []);+ const files = extractComposerPasteFiles(event.clipboardData);if (files.length === 0) {// The overwhelmingly common case: an ordinary text paste. Left for Lexical.return;diff --git a/crates/openhuman-app/src/lib.rs b/crates/openhuman-app/src/lib.rsindex 86d83e8de5..994afdeea8 100644--- a/crates/openhuman-app/src/lib.rs+++ b/crates/openhuman-app/src/lib.rs@@ -3285,9 +3285,9 @@ pub fn run() {window_state::install_dpi_guard(&window);// Windows starts at a compact near-square size. Other desktop// targets keep their existing work-area first-launch layout.- if !window_state::restore_main(&window)- && (cfg!(windows) || !window_state::maximize_to_work_area(&window))- {+ let restored = window_state::restore_main(&window);+ let maximized = !restored && !cfg!(windows) && window_state::maximize_to_work_area(&window);+ if should_center_main_window(restored, cfg!(windows), maximized) {window_state::center_main(&window);}if !daemon_mode {@@ -3631,6 +3631,10 @@ pub fn run() {process_kill::sweep_orphan_children();}+fn should_center_main_window(restored: bool, windows: bool, maximized: bool) -> bool {+ !restored && (windows || !maximized)+}+pub fn run_core_from_args(args: &[String]) -> Result<(), String> {// Core lives in-process: dispatch directly through the linked `openhuman_core`// library instead of shelling out to a separate binary. The Tauri main()diff --git a/crates/openhuman-app/src/lib_tests.rs b/crates/openhuman-app/src/lib_tests.rsindex 8e2c231880..bc130a4341 100644--- a/crates/openhuman-app/src/lib_tests.rs+++ b/crates/openhuman-app/src/lib_tests.rs@@ -1,5 +1,13 @@use super::*;+#[test]+fn main_window_centering_only_follows_failed_restore_and_maximize() {+ assert!(!should_center_main_window(true, false, false));+ assert!(should_center_main_window(false, true, false));+ assert!(!should_center_main_window(false, false, true));+ assert!(should_center_main_window(false, false, false));+}+// Tests that read/write process-global env vars must serialize through this// mutex. Rust's test runner executes tests in parallel by default; without// coordination, concurrent set_var / remove_var calls race and producediff --git a/crates/openhuman-core/src/security/approval/store_tests.rs b/crates/openhuman-core/src/security/approval/store_tests.rsindex 96f7b4bd89..8293a64bd4 100644--- a/crates/openhuman-core/src/security/approval/store_tests.rs+++ b/crates/openhuman-core/src/security/approval/store_tests.rs@@ -13,6 +13,15 @@ fn test_config() -> (Config, TempDir) {(config, dir)}+#[test]+fn schema_migration_surfaces_non_duplicate_alter_errors() {+ let conn = rusqlite::Connection::open_in_memory().unwrap();+ conn.execute_batch("CREATE VIEW pending_approvals AS SELECT 1 AS id")+ .unwrap();+ let error = migrate_columns(&conn).expect_err("a view cannot be migrated as a table");+ assert!(error.to_string().contains("add column executed_at"));+}+/// Build a sample `PendingApproval`. The `_session_id` parameter/// is preserved as a positional argument for call-site readability/// (so a reader can see "this row belongs to sess-A") even though