mirror of
https://github.com/tinyhumansai/openhuman.git
synced 2026-07-27 21:08:00 +00:00
1a676c6d4488fdc1e32b35bb9fb141d5bb8e7bf8
3
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
df99680c18 |
feat(agent/multimodal): support [FILE:…] markers with text extraction (#2777) (#2954)
Co-authored-by: Cyrus Gray <cyrus@tinyhumans.ai> |
||
|
|
95f1f5f063 | Refactor inference around external Ollama routing (#1975) | ||
|
|
ef9c117e9e |
test: expand agent harness coverage (#513)
* feat(tests): add comprehensive unit tests for hooks and memory context - Introduced a suite of tests for the `fire_hooks` function, ensuring that all hooks are dispatched even if one fails, enhancing reliability in the hook execution flow. - Added tests for the `sanitize_tool_output` function to validate the correct mapping of success and failure messages for various tool outputs. - Implemented a mock memory structure to facilitate testing of memory context building, ensuring that working memory is prioritized and deduplication occurs correctly. - Enhanced the `build_memory_context` function tests to verify filtering and truncation of memory entries, improving the robustness of memory management in the system. - Overall, these tests aim to strengthen the codebase by ensuring that critical functionalities related to hooks and memory context are thoroughly validated. * feat(tests): enhance unit tests for provider alias resolution and prompt options - Updated the `provider_alias_and_route_selection_round_trip` test to dynamically resolve the first provider from the registry, ensuring accurate alias resolution. - Added new tests for `DumpPromptOptions` and `ComposioStubTools`, validating default settings and expected tool names. - Introduced tests for rendering main agent dumps, ensuring tool instructions and skill counts are correctly included in the output. - Enhanced prompt handling tests to cover cache boundary extraction and subagent render options, improving overall test coverage and reliability. * feat(tests): enhance error handling and formatting in unit tests - Added new tests for `AgentError` variants to validate string formatting and error recovery from `anyhow`. - Improved formatting consistency in existing tests for better readability. - Enhanced the `sanitize_tool_output` test to ensure accurate mapping of success and failure messages. - Updated memory loader tests to enforce minimum limits and budget constraints, ensuring robust memory management. - Overall, these changes aim to strengthen the test suite by improving coverage and clarity in error handling scenarios. * feat(tests): add unit tests for tool filtering and subagent dump rendering - Introduced new tests to validate the filtering of tools based on named scopes and disallowed tools, ensuring correct tool selection in debug dumps. - Added tests for rendering subagent dumps, including handling file prompt fallbacks and missing files without panicking. - Enhanced the workspace prompt handling to prefer custom prompt locations, improving the flexibility and reliability of agent prompt rendering. - Overall, these additions strengthen the test suite by covering critical functionalities related to tool filtering and prompt rendering. * feat(tests): add comprehensive unit tests for memory loader and multimodal helpers - Introduced new tests for the memory loader to validate behavior when the header exceeds budget and when recall fails, ensuring robust memory management. - Added tests for multimodal helpers, covering image marker counting, payload extraction, and MIME type normalization, enhancing the reliability of multimodal interactions. - Overall, these additions strengthen the test suite by improving coverage and ensuring correct functionality in memory handling and multimodal processing. * feat(tests): add unit tests for tool execution and agent behavior - Introduced new tests for the `run_tool_call_loop` function, validating the rejection of vision markers for non-vision providers and ensuring correct streaming of final text chunks. - Added tests to verify that CLI-only tools are blocked in prompt mode and that native tool results are persisted as tool messages. - Enhanced the `Agent` class with tests for error handling and event publishing during single runs, ensuring robust agent behavior in various scenarios. - Overall, these additions strengthen the test suite by improving coverage and reliability in tool execution and agent interactions. * feat(tests): enhance tool execution and agent behavior tests - Added new tests for the `run_tool_call_loop` function, including scenarios for auto-approving supervised tools on non-CLI channels and handling unknown tools with default max iterations. - Introduced `ErrorResultTool` and `FailingTool` to simulate error conditions during tool execution, improving coverage of error handling in the agent. - Updated the `ScriptedProvider` to return results wrapped in `anyhow::Result`, ensuring consistent error handling across test cases. - Overall, these enhancements strengthen the test suite by validating tool execution paths and agent behavior under various conditions. * refactor(tests): improve test readability and structure - Enhanced formatting in various test cases for better clarity and consistency, including the use of line breaks and indentation. - Updated assertions to improve readability by aligning them with Rust's idiomatic style. - Overall, these changes aim to strengthen the test suite by making it more maintainable and easier to understand. * docs(agent): enhance module documentation for agent domain - Added comprehensive documentation to the `mod.rs` file, detailing the agent domain's purpose, key components, and their functionalities. - Improved clarity on how LLMs interact with the system, manage conversation history, and handle autonomous behaviors. - This update aims to enhance understanding and maintainability of the agent domain within the OpenHuman project. * docs(agent): improve documentation and formatting across multiple files - Enhanced comments and documentation in `dispatcher.rs`, `error.rs`, `hooks.rs`, and `harness/mod.rs` for better clarity and consistency. - Adjusted formatting in the `TurnContext` and `ToolCallRecord` structs to improve readability and understanding of their purpose and functionality. - Overall, these changes aim to strengthen the documentation and maintainability of the agent domain within the OpenHuman project. * feat(tests): add comprehensive tests for memory loader and agent behavior - Introduced new tests for the `DefaultMemoryLoader`, validating error propagation during primary recall failures and ensuring correct context emission when working memory is present. - Added tests to verify behavior when the working memory section exceeds budget constraints, enhancing memory management robustness. - Overall, these additions strengthen the test suite by improving coverage and reliability in memory handling and agent interactions. * refactor(tests): improve formatting and readability in memory loader tests - Reformatted the `load_context` calls in memory loader tests for better readability by chaining method calls. - Enhanced documentation comments in the `pformat.rs` file to clarify the purpose and functionality of functions. - Improved consistency in spacing and formatting across various sections of the codebase, including the `interrupt.rs` and `builder.rs` files. - Overall, these changes aim to enhance code clarity and maintainability within the test suite and related modules. * feat(tests): add new tests for self-healing interceptor and local AI provider - Introduced tests to validate the detection of missing commands in the `SelfHealingInterceptor`, ensuring proper handling of recognized and unrecognized patterns. - Added tests for the `ensure_polyfill_dir` method to confirm directory creation and path exposure. - Enhanced local AI provider tests to verify correct behavior when the service is ready and the appropriate tier is set, as well as ensuring local metadata is utilized during provider resolution. - Overall, these additions strengthen the test suite by improving coverage and reliability in self-healing and local AI functionalities. * refactor(tests): enhance test structure and external ID handling in escalation tests - Updated the `envelope` function to accept an `external_id` parameter, improving flexibility in test scenarios. - Modified various test cases to utilize specific external IDs, enhancing clarity and ensuring accurate event assertions. - Introduced a mutex lock in local AI tests to prevent race conditions, ensuring reliable test execution. - Overall, these changes improve the robustness and maintainability of the test suite for escalation and local AI functionalities. * refactor(tests): remove redundant test modules and improve test organization - Eliminated unused test modules from `hooks.rs`, `memory_loader.rs`, `fork_context.rs`, `interrupt.rs`, and `parse.rs` to streamline the codebase. - Enhanced overall test organization by consolidating relevant tests into appropriate files, improving maintainability and readability. - These changes aim to simplify the test structure and focus on active test cases, ensuring a cleaner and more efficient testing environment. * refactor(tests): improve test formatting and readability - Reformatted assertions in multiple test cases for better readability by aligning them with Rust's idiomatic style. - Enhanced the structure of test cases by using line breaks and consistent indentation, improving overall clarity. - These changes aim to strengthen the test suite by making it more maintainable and easier to understand. * refactor(api): improve string containment check and formatting in transcript handling - Updated the `key_bytes_from_string` function to use a more concise containment check for special characters. - Changed the message writing in the `write_transcript` function to utilize `writeln!` for better formatting. - Enhanced the condition in `latest_in_dir` to use `is_none_or` for improved readability and clarity. - These changes aim to streamline code and enhance maintainability across the API and transcript handling modules. * refactor(code): streamline function implementations and improve readability - Removed unnecessary whitespace in `run_voice_server_command` for cleaner code. - Simplified directory search logic in `bundled_openclaw_prompts_dir` by using `find` instead of a loop. - Updated `request_accessibility_access` to use direct references for keys and values, enhancing clarity. - Improved documentation formatting in `mod.rs` and `types.rs` for better consistency. - Refactored `Config` initialization in `load.rs` to use struct update syntax for clarity. - Added `#[allow(clippy::too_many_arguments)]` annotations in multiple functions to address linter warnings. - Enhanced type definitions and function signatures for better type safety and readability in various modules. - Overall, these changes aim to improve code maintainability and readability across the project. * chore(ci): update typecheck workflow and pre-push hooks to include clippy checks - Modified the GitHub Actions workflow to run clippy with warnings treated as errors for the `openhuman` package. - Enhanced the pre-push hook to include clippy checks, ensuring code quality before pushing changes. - Updated package.json to define a new script for running clippy, integrating it into the format check process. - These changes aim to improve code quality and maintainability by enforcing stricter linting rules. * refactor(api): simplify condition in key_bytes_from_string function - Streamlined the condition in the `key_bytes_from_string` function to improve readability by consolidating the if statement into a single line. - This change enhances code clarity while maintaining the original functionality of the key validation process. * chore(package): update format:check script to remove clippy integration - Modified the `format:check` script in `package.json` to exclude the clippy check, streamlining the formatting process. - This change simplifies the formatting workflow while maintaining the integrity of Rust formatting checks. * refactor(core): enhance documentation and structure in core modules - Improved documentation across various core functions, including `build_registered_controllers`, `run_from_cli_args`, and `dispatch`, to clarify their purpose and usage. - Streamlined comments to provide clearer guidance on the flow of operations and error handling. - Enhanced the structure of the `EventBus` and `NativeRegistry` to improve readability and maintainability. - Overall, these changes aim to improve code clarity and facilitate easier navigation and understanding of the core components. * refactor(core): reorganize imports in engine.rs for clarity - Adjusted the import statements in `engine.rs` to improve organization and readability. - Moved the macOS-specific import of `validate_focused_target` to a more appropriate location and ensured consistent ordering of imports. - These changes aim to enhance code clarity and maintainability within the core module. * refactor(core): enhance WebChannelEvent structure and documentation - Introduced a new `WebChannelEvent` struct to standardize event payloads for chat-related activities, including fields for event name, client ID, thread ID, request ID, and optional response details. - Improved documentation for the `attach_socketio` function, clarifying its role in setting up Socket.IO event handlers and the associated chat logic. - Removed unused structs and streamlined the event handling process to improve code clarity and maintainability across the core module. * refactor(core): streamline Socket.IO event handlers for clarity and consistency - Refactored the Socket.IO event handlers in `attach_socketio` to improve readability by standardizing the formatting and structure of the code. - Enhanced the organization of the event handling logic for `rpc:request`, `chat:start`, and `chat:cancel` events, making it easier to follow the flow of operations. - These changes aim to improve code maintainability and facilitate easier navigation within the Socket.IO integration. * feat(core): add new structs for Socket RPC and chat events - Introduced `SocketRpcRequest`, `ChatStartPayload`, and `ChatCancelPayload` structs to facilitate handling of Socket.IO events related to chat functionality. - These additions enhance the structure and clarity of the event payloads, improving the maintainability of the Socket.IO integration. * refactor(core): remove unused json_type_name function from socketio.rs - Eliminated the `json_type_name` function from `socketio.rs` as it was not utilized in the current codebase. - This change helps to clean up the code and improve maintainability by removing unnecessary functions. * chore(ci): update clippy command in typecheck workflow - Modified the clippy command in the GitHub Actions workflow to remove the `-D warnings` flag for the `openhuman` package, allowing warnings to be displayed without failing the build. - This change aims to improve the development experience by providing more flexibility during code analysis while still encouraging code quality. * chore(husky): remove clippy check from pre-push hook - Eliminated the clippy command from the pre-push hook to streamline the pre-push checks. - Updated the failure message to reflect the removal of clippy, focusing on format, lint, TypeScript, and Rust errors only. - This change simplifies the pre-push process while maintaining essential checks for code quality. * refactor(tests): add macOS-specific imports for enhanced test coverage - Introduced conditional imports for macOS in the tests module of `engine.rs` to support platform-specific functionality. - This change improves the test setup for macOS environments, ensuring compatibility and enhancing overall test coverage. * refactor(tests): update tool call execution in test cases - Modified the `execute_tool_call` method calls in multiple test cases to include a second parameter, improving the accuracy of the tests. - This change ensures that the tests reflect the latest method signature and enhances the reliability of the test outcomes. |