Merged
Conversation
olegklimov
reviewed
Jun 4, 2025
olegklimov
reviewed
Jun 4, 2025
- Introduce a new `gql_subscription` module to handle GraphQL WebSocket connections. - Enable the `remote_tool_calls` flag in the global context for configuring remote server calls. - Update `Cargo.toml` to include the `tokio-tungstenite` dependency for WebSocket communication. - Integrate the GraphQL subscription into background tasks to monitor and process incoming thread events.
- Rename `gql_subscription.rs` to `threads_subscription.rs` and move it under a new `cloud` module. - Create new files `messages_req.rs`, `threads_req.rs`, `experts_req.rs`, and `constants.rs` under the `cloud` module. - Refactor the subscription and message handling logic to utilize the new module structure. - Update all imports and references to maintain functionality.
…subscription and experts_req files
…readMessage` directly - Eliminate redundant code in message serialization - Streamline event processing in `events_loop` for thread updates - Introduce new functions `process_thread_event`, `initialize_thread`, and `call_tools` to organize thread processing logic - Add toolset handling and integration with external services - Cleanup code by removing unnecessary comments and struct definitions.
- Update the `initialize_thread` function to include additional parameters for `Thread` and `messages`. - Add utility functions for converting between `ThreadMessage` and `ChatMessage` formats. - Modify `call_tools` to handle alternate and previous alternate states, and adjust logic for message conversion. - Change `ThreadMessage::ftm_content` type from `Value` to `String`. - Migrate to async calls for creating thread messages. - Revise constants to update default group ID and improve error handling by using `map_err_to_string`.
- Replace `get_blocked_tools` and `get_allowed_tools` with regex-based `is_tool_allowed` method for improved flexibility in tool handling. - Update `Expert` struct to store `owner_fuser_id` as an `Option<String>`. - Modify `Thread` struct to use `Vec<Value>` for `ft_toolset`. - Remove `ThreadPatchInput` struct and update relevant functions to directly handle `ft_toolset`. - Enhance logging by adding tracing format and including provenance in `ThreadMessage`. - Simplify code by removing unused imports and redundant logic, and refactoring JSON handling for improved readability.
Introduce early return for invalid tool calls or errors in `process_thread_event`. Change condition to check all non-system roles in messages before initializing threads. Update `ftm_provenance` with meaningful "important" information in relevant structures.
- Remove the unused `threads_processing` module to clean up the codebase. - Refactor `ftm_content` in `ThreadMessage` to be an `Option<Value>` and adjust related serialization logic. - Modify `update_thread_toolset` to return updated toolset instead of unit. - Filter tool descriptions based on available tools. - Add checks for message processing, including a temporary user filter and tool call validation. - Expose `passthrough_convert_messages` as a public module for reuse.
- Delete `threads_subscription.rs` and create a new file `threads_sub.rs` with updated logic. - Move structs and functions related to thread events and GraphQL subscriptions from `threads_req.rs` and `messages_req.rs` to `threads_sub.rs`. - Simplify error handling and logging throughout the codebase for consistency. - Update module references in `mod.rs` and `background_tasks.rs` to point to the new `threads_sub` module. - Enhance overall readability by restructuring and consolidating related functionalities.
…nd updating error handling - Change `located_fgroup_id` to an `Option<String>` in `experts_req.rs` and update GraphQL query accordingly. - Remove major and minor version fields from both expert and thread structures. - Refactor `ft_error` to use `Option<String>` for null checks. - Modify logging of multiple experts warning to avoid immediate errors.
…ub.rs - Use HashSet for storing tool names to streamline tool filtering. - Simplify the process of retrieving available tools by calling get_available_tools directly. - Remove unnecessary variables and redundant filtering steps. - Update function calls and their parameters to align with new implementations. - Improve code readability by reducing lines and enhancing logical flow.
- Introduce a new field `app_searchable_id` in the `GlobalContext` struct to uniquely identify applications based on workspace folders and MAC address. - Implement the function `get_app_searchable_id` to generate this identifier by concatenating folder names with MAC address. - Update `files_in_workspace.rs` and `global_context.rs` to compute and store `app_searchable_id` during initialization. - Add a new HTTP route `/get-app-searchable-id` in `routers/v1.rs` and implement its handler in `workspace.rs` to expose this identifier via API. - Modify GraphQL query in `threads_sub.rs` to include `ft_app_searchable` field and update thread processing logic to respect this ID. - Add `pnet_datalink` dependency to `Cargo.toml` to facilitate MAC address retrieval.
Remove unused constants from `constants.rs`. Simplify API key retrieval in request and subscription functions by accessing it directly from the global context. Remove unnecessary variables and streamline GraphQL query variables usage. Also, remove redundant log messages and improve error handling throughout the code.
…ve loop for connection initialization
Introduce a mechanism to restart the threads subscription when certain conditions are met. Add a new function `trigger_threads_subscription_restart` to set a restart flag and initiate a subscription restart process in the `watch_threads_subscription` loop. Update global context to include a `threads_subscription_restart_flag` for managing this state. Additionally, update cloud-related configurations to support this feature by renaming the command line option to enable cloud threads support and improving code readability and error handling in subscription logic.
Implement `lock_thread` and `unlock_thread` asynchronous functions in `threads_req.rs` to manage thread access via GraphQL API. Update `threads_sub.rs` to include a random hash generator and utilize the lock/unlock functions to prevent processing of locked threads. Remove outdated logic for skipping locked threads based on `ft_locked_by`.
Implement distinct logic for retrieving unique identifiers on Windows by utilizing the machine GUID from the Windows registry. Include 'winreg' crate as a dependency for Windows-specific code. Modify existing function to be non-Windows specific by using conditional compilation attributes.
- Move `constants.rs` from `cloud` directory to the main `src` directory. - Update the URLs in `constants.rs` to point to `test-teams-v1.smallcloud.ai`. - Adjust imports and references to the `constants` module across the codebase. - Update hard-coded `CLOUD_URL` in `memories.rs` to use the new `constants` module.
Update the GraphQL query in `threads_req.rs` to fetch a single thread by ID instead of fetching all threads by group ID. Simplify the JSON response parsing logic accordingly. Additionally, add a condition in `threads_sub.rs` to skip processing if a thread has no messages, accompanied by an informational log statement.
4900519 to
52344af
Compare
olegklimov
approved these changes
Jun 4, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.