mirror of
https://github.com/tinyhumansai/openhuman.git
synced 2026-07-28 05:12:33 +00:00
* feat(config): add user ID retrieval and workspace scoping for authenticated users - Implemented `read_authenticated_user_id` to extract the user's ID from `auth-profiles.json`, avoiding a dependency cycle with the credentials module. - Introduced `maybe_scope_workspace_to_user` to create user-specific workspace directories based on the authenticated user ID, ensuring isolated workspace data. - Updated the configuration loading process to call `maybe_scope_workspace_to_user`, enhancing user data management. - Added unit tests for the new functionality, ensuring correct behavior in various scenarios. This change improves user experience by providing personalized workspace management based on authentication status. * feat(config): enhance user management with active user state handling - Added functions to manage the active user state, including `read_active_user_id`, `write_active_user_id`, and `clear_active_user`, allowing for user-specific configuration and workspace isolation. - Introduced `default_root_openhuman_dir` to standardize the retrieval of the root directory for user data. - Updated configuration loading to support user-scoped directories, improving the overall user experience by ensuring personalized settings and workspace management. This change enhances the OpenHuman platform by enabling better user data management and isolation. * feat(credentials): enhance user directory management during session storage - Added logic to create and activate user-scoped directories based on the resolved user ID when storing session data, ensuring credentials are saved in the correct location. - Implemented error handling for directory creation and active user ID writing, with appropriate logging for failures. - Updated the configuration loading process to reflect the newly activated user directory, improving user-specific settings management. - Enhanced the `get_data_dir` function to return user-scoped directories if an active user is set, streamlining data access. This change improves user experience by ensuring that session data is correctly organized and accessible based on user context. * refactor(tests): update user ID handling and improve test coverage - Renamed and refactored tests to better reflect functionality, focusing on active user ID management. - Removed the `write_auth_profiles` helper function and replaced it with direct calls to `write_active_user_id` for clarity. - Enhanced tests to cover scenarios for reading and clearing active user IDs, ensuring accurate behavior in user-specific configurations. - Added a new test for building user directory paths, improving overall test coverage for user management features. This change streamlines the testing process and enhances the clarity of user ID handling in the configuration schema. * refactor(paths): streamline model and binary path resolution - Introduced a new `shared_root_dir` function to centralize the logic for determining the shared root openhuman directory, improving code clarity and reducing duplication. - Updated `workspace_ollama_dir` and `workspace_local_models_dir` functions to utilize the new shared root directory, ensuring consistent path resolution for user-specific and shared resources. - Enhanced the `model_artifact_path` function to leverage the new directory structure, improving the organization of model artifacts. This refactor enhances maintainability and clarity in the path management for local AI resources. * style: apply cargo fmt formatting Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * refactor(paths): streamline directory management for model artifacts - Updated the `model_artifact_path` function to utilize a new `shared_root_dir` function, which centralizes the logic for determining the root openhuman directory. - Enhanced the `config_root_dir` function to improve clarity and maintainability. - Adjusted the `workspace_ollama_dir` and `workspace_local_models_dir` functions to leverage the new shared directory logic, ensuring consistent path resolution across the application. These changes improve the organization of directory management and enhance the overall clarity of the codebase. --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>