Refactor UI auth/bootstrap and remove legacy UI runtime layers#63
Merged
Conversation
- Updated `e2e-build.sh` to set CI environment variable correctly for compatibility with various CI runners. - Refactored `backendUrl.ts` to support dynamic backend URL resolution from Vite environment variables, improving flexibility in different deployment contexts.
- Introduced new web channel commands for sending and canceling chat messages, improving user interaction with the chat system. - Added support for server-sent events (SSE) to handle real-time updates for chat interactions, enhancing responsiveness. - Refactored existing code to improve readability and maintainability, including updates to the core HTTP router and JSON-RPC handling. - Implemented comprehensive end-to-end tests for the web channel flow, ensuring robust functionality and user experience. - Enhanced the overall structure of the web channel module, including event publishing and subscription mechanisms for better scalability.
- Removed Tauri-specific socket handling from various components, streamlining the codebase to use a single Socket.IO client for both web and desktop environments. - Updated the `useIntelligenceSocket` hook to eliminate Tauri checks and directly utilize the socket service for message sending and chat initialization. - Refactored metadata synchronization in Gmail and Notion services to use the unified socket service, enhancing consistency in socket communication. - Improved error handling and logging across socket interactions to provide clearer feedback during connection issues. - Enhanced the Conversations component to manage socket connection status, ensuring a more robust user experience during chat interactions.
- Replaced the deprecated `getBackendUrl` function with `resolveCoreSocketBaseUrl` to improve backend URL resolution for socket connections, accommodating both Tauri and non-Tauri environments. - Introduced `coreSocketBaseFromRpcUrl` to streamline the processing of RPC URLs. - Removed the `tauriSocket.ts` file, consolidating socket handling into a unified service for better maintainability and clarity. - Updated the socket connection logging to provide more informative messages during connection attempts.
…argo.toml - Introduced new packages: `engineioxide` and `socketioxide`, both at version 0.15.2, enhancing the project's capabilities. - Updated `Cargo.toml` to include `socketioxide` with the "extensions" feature, ensuring proper integration with the existing codebase. - Added dependencies for both packages, improving modularity and functionality across the application.
- Removed unused imports and functions related to Notion context and socket handling, simplifying the Conversations component. - Enhanced error handling during chat interactions, ensuring clearer feedback for users. - Updated chatSend function parameters to eliminate unnecessary context, improving the clarity of the API call. - Consolidated logic for managing chat message history and context, enhancing maintainability and readability of the code.
- Introduced debug logging for socket RPC requests and responses, providing better visibility into the communication process. - Enhanced error handling in the core RPC client to log detailed error messages, improving debugging capabilities. - Updated socket service to log inbound events, ensuring comprehensive tracking of socket interactions. - Removed deprecated MCP handlers from the socket service, streamlining the codebase and improving maintainability.
- Changed the declaration of `_getToken` from `let` to `var` in `apiClient.ts` to enhance variable scoping. - Removed unused imports in `socketService.ts`, streamlining the code and improving readability.
- Updated the deep link configuration in `lib.rs` to use a more generalized `#[cfg(desktop)]` directive, improving compatibility across desktop platforms. - Enhanced the `triggerDeepLink` function in `deep-link-helpers.ts` to include macOS-specific app activation and launching logic, ensuring better integration with the macOS environment. - Introduced a new `buildBypassJwt` function to generate bypass JWT tokens for E2E testing, improving the flexibility of authentication flows in tests. - Updated E2E tests in `conversations-web-channel-flow.spec.ts` to utilize the new `triggerAuthDeepLinkBypass` function, enhancing the testing of authentication scenarios.
- Updated `triggerAuthDeepLink` in `deep-link-helpers.ts` to support environment-based bypass tokens, improving flexibility in authentication flows during E2E tests. - Modified the `serve_on_ephemeral` function call in `json_rpc_e2e.rs` to disable the core HTTP router's default behavior, enhancing test isolation and control over the testing environment.
- Updated `authFlow.e2e.test.tsx` to utilize `window.__simulateDeepLink` for simulating deep links, improving test accuracy and alignment with real-world scenarios. - Modified `lib.rs` to restrict deep link registration to Windows and Linux platforms, clarifying platform-specific behavior. - Enhanced `deep-link-helpers.ts` with a new function to simulate deep links in the WebView, providing a fallback mechanism for E2E tests. - Updated `conversations-web-channel-flow.spec.ts` to reflect changes in deep link triggering, improving logging and test clarity.
… stability - Removed several unused dependencies from `Cargo.lock` and `Cargo.toml`, including `aes-gcm`, `argon2`, and `async-imap`, streamlining the project and reducing potential security vulnerabilities. - Updated existing dependencies to their latest versions, ensuring compatibility and leveraging improvements in performance and security. - Simplified the dependency structure by consolidating features and removing unnecessary comments, enhancing clarity and maintainability of the configuration files.
- Removed `AIProvider` and `SkillProvider` from the `App` component, streamlining the component structure and improving readability. - Updated the `UserProvider` to focus solely on bootstrapping the authentication token, enhancing its clarity and purpose. - Adjusted the layout within the `App` component to maintain functionality without the removed providers, ensuring a smooth user experience.
- Deleted the `index.ts`, `loader.ts`, `types.ts`, and related test files from the AI module, streamlining the codebase by removing unused and outdated components. - Eliminated the `default-constitution.md` and associated constitution files, which were no longer relevant to the current architecture. - This cleanup enhances maintainability and reduces complexity within the AI system.
- Enhanced the `useUser` hook to prevent infinite retry loops by implementing a token check with a reference to track the last auto-fetch token. - Removed the legacy file watcher for `TOOLS.md`, transitioning to a core RPC and socket event-based refresh mechanism for tool/config updates. - Updated test state structure to include `isAuthBootstrapComplete` and `channelConnections`, improving test coverage and state management.
- Consolidated channel modules under a new `providers` directory, improving organization and clarity. - Introduced new channel providers for DingTalk, Discord, Email, iMessage, IRC, and Lark, expanding the messaging capabilities of the application. - Updated the `mod.rs` file to reflect the new structure and ensure proper module exports, enhancing maintainability and ease of use.
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.
Summary
AIProvider,SkillProvider) from app composition and deleted their modules./telegram/meduring startup./telegram/meretry behavior by limiting auto-fetch inuseUserto once per token.app/src/libmodules that duplicated core/runtime logic.libsurfaces (skills, mcp, channels routing, local core ai memory shim, tools file watcher compatibility) to avoid UI breakage.Problem
/telegram/mefailed./telegram/mecaused repeated fetch attempts and noisy/infinite request loops.Solution
App.tsx.get_state+get_session_token)./telegram/mefromUserProvider.useUserwith a per-token auto-fetch guard to prevent repeated failed retries.gmailSlice,notionSlice, unusedapp/src/libtrees) and adjusted tests/types where needed.forceToolsCacheRefreshno-op).Testing
yarn -s compilecargo check --manifest-path app/src-tauri/Cargo.tomlyarn --cwd app vitest run --config test/vitest.config.ts src/utils/__tests__/authFlow.e2e.test.tsx src/store/__tests__/authSelectors.test.tsyarn format:check(via pre-push)yarn lint(via pre-push)yarn compile(via pre-push)/telegram/mecheck.Impact
Breaking Changes
Related