Commit Graph
28 Commits
Author SHA1 Message Date
e2833f27e0 Adopt supermemory patterns into AI memory system (#11)
* Add submodule for skills and initialize skills repository

- Created a new .gitmodules file to include the skills submodule.
- Initialized the skills submodule with a commit reference, linking to the skills repository on GitHub.

This update integrates the skills component into the project, enhancing the AI system's capabilities.

* Implement subscription billing UI with Stripe and Coinbase integration

Replace the placeholder BillingPanel with a working subscription billing
interface. Users can view their current plan and token usage, upgrade via
Stripe (card) or Coinbase (crypto, annual-only), and manage subscriptions
through Stripe's Customer Portal. Adds billing API service and types.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Add unified skill system with core type definitions and management features

- Introduced a comprehensive skill system that includes lifecycle management, tool definitions, state management, entity extensions, and intelligence rules.
- Implemented a skill state manager using Zustand for managing skill-specific state.
- Created an entity extension registry for registering new entity and relation types.
- Developed an intelligence engine for evaluating rules and executing actions based on events.
- Established a unified tool registry to streamline tool management across various integrations.

This update enhances the AI system's capabilities by providing a robust framework for skill management and interaction.

* Add billing helpers and refactor BillingPanel for improved plan management

- Introduced a new `billingHelpers.ts` file containing plan metadata, utility functions for plan management, and pricing calculations.
- Refactored `BillingPanel` to utilize the new billing helpers, streamlining the display of plan information and pricing.
- Added unit tests for billing helpers to ensure functionality and correctness of plan-related operations.

This update enhances the billing system's structure and maintainability, providing a clearer separation of concerns for plan management.

* Enhance skill management system with new features and integrations

- Added path aliases in `tsconfig.json` for improved module resolution.
- Updated `vite.config.ts` to include skill types path for better integration.
- Integrated `SkillsProvider` into the application to manage skill lifecycle, including registration and activation of virtual skills like Telegram, bulk operations, and reminders.
- Implemented a unified skill system with a new orchestrator for managing skill states and tool definitions.
- Enhanced bundled skill loading mechanism to utilize a unified skill system, improving the overall architecture and maintainability.

This update strengthens the skill management framework, enabling better organization and functionality within the AI system.

* Adopt supermemory patterns into AI memory system

Port 5 patterns from claude-supermemory reference implementation to fill
gaps in the existing memory pipeline:

1. Tool observation compression — compress verbose tool outputs before
   compaction summarization and memory flush, saving tokens and signal
2. Categorized memory context — render memory as structured XML with
   profile facts, recent context, and search results with dedup
3. Relative timestamps — surface updated_at from FTS chunks and display
   human-readable relative times in search results
4. Memory deduplication on write — filter duplicate facts before appending
   to memory files during flush
5. Auto-capture on session end — lightweight memory flush for short sessions
   that never trigger compaction

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Refactor TelegramMCPServer to delegate entirely to unified tool registry

The server was still maintaining its own tool map with 80+ handler entries
and legacy fallback paths. Now it delegates all tool listing and execution
to skillOrchestrator.toolRegistry, matching the architecture established
in the skills system. Updated tests to mock the unified registry instead
of individual tool handlers.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Consolidate skill system and migrate Telegram state to Zustand

Remove legacy skill implementations (src/lib/ai/skills/, src/lib/mcp/skills/)
and consolidate everything into the unified skill orchestrator at
src/lib/skills/. Add runtime skill subprocess support with stdio JSON-RPC
transport for Python/Node/Deno skills.

Key changes:
- Delete old SkillRegistry, installer, loader, runner, frontmatter parser
- Delete MCP skills layer (bulk.ts, reminders.ts, index.ts) and move
  skill definitions to src/lib/skills/definitions/
- Add RuntimeHost and StdioTransport for subprocess-based skills
- Add shell plugin (tauri-plugin-shell) with scoped permissions for
  python3, node, deno, npx executables
- Extend orchestrator with runtime skill lifecycle (spawn, load, activate,
  tick, deactivate, shutdown) and reverse RPC handling
- Add overrideTier parameter to enforceRateLimit for unified registry
- Decouple prompt system from old SkillEntry type
- Remove old SkillRegistry from AIProvider
- Migrate Telegram state functions from Redux dispatch to Zustand store
- Add Telegram Zustand store, selectors, actions, migration utilities
- Add hello-python example skill

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Migrate Telegram state from Redux to Zustand

Replace the Redux telegram slice with a Zustand store using immer middleware.
All 49 reducers ported as store methods, 5 thunks converted to standalone async
functions, and 30+ selectors migrated to Zustand hooks and plain functions.
Updates all consumers: services, API helpers, tool adapters, and UI components.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Refactor skill management and remove Telegram components

- Updated TODO.md to include integration of the payments flow.
- Refactored App.tsx to remove unused TelegramProvider and SkillsProvider, streamlining the component structure.
- Deleted obsolete test fixtures related to Telegram state and skills, including mcpContext.ts, rootState.ts, telegramState.ts, and TelegramConnection components.
- Removed legacy skill loading and entity extension files, consolidating the skill system into a unified orchestrator.
- Updated documentation to reflect changes in skill management and structure.

This commit enhances the overall architecture by eliminating deprecated components and improving the skill management framework.

* Update skills submodule to latest commit 22e42c9, ensuring alignment with the current project structure and dependencies.

* Integrate Python skills system with JSON-RPC IPC and interactive setup UI

Wire the Python skills runtime into the Tauri frontend via the shell plugin,
communicating over JSON-RPC 2.0 stdin/stdout. Replace "Coming Soon" Telegram
entries in onboarding and settings with a live setup wizard that drives the
skill's multi-step authentication flow.

- Phase 0: Create skill.py SkillDefinition for Telegram, update __main__.py
  to use SkillServer (MCP preserved via --mcp flag)
- Phase 1: Add skills lib (types, transport, runtime, manager, paths),
  Redux skillsSlice with persistence, setup UI components
  (SetupFormRenderer, SkillSetupWizard, SkillSetupModal)
- Phase 2: Add SkillProvider to provider chain, Rust skill data I/O commands
- Phase 3: Tool bridge for AI registry integration in AIProvider

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Update skill management and billing helpers

- Updated skills submodule to the latest commit, ensuring alignment with project dependencies.
- Refactored SkillSetupWizard to ensure the skill is running before starting the setup flow, improving user experience.
- Adjusted billingHelpers test to import PlanTier from the correct path, enhancing type safety.
- Modified embedQuery method in NullEmbeddingProvider to accept a parameter, improving method signature clarity.

These changes enhance the overall functionality and maintainability of the skill management and billing systems.

* Enhance deep link handling and skill setup error management

- Added a note in CLAUDE.md regarding the requirement to run the .app for deep link testing on macOS.
- Introduced a simulation feature for deep links in development mode within desktopDeepLinkListener.ts.
- Updated SkillSetupWizard to throw descriptive errors if a skill fails to start, improving error handling and user feedback.

These changes improve the development experience and robustness of the skill setup process.

* Add Python sidecar setup script and update dependencies

- Introduced a new script `setup-python-sidecar.mjs` to symlink the system Python to the Tauri runtime for local development.
- Updated the `package.json` to include a new npm script for setting up the Python sidecar.
- Changed the version specification for `@tauri-apps/plugin-shell` from `^2` to `~2` for more controlled updates.
- Updated the `tauri.conf.json` to include the new Python sidecar in the external binaries list.
- Updated the skills submodule to the latest commit for alignment with project dependencies.

These changes enhance the development workflow for Python skills integration and improve dependency management.

* Update skills submodule to latest commit and modify TODO.md

- Updated the skills submodule to the latest commit for better alignment with project dependencies.
- Added a note in TODO.md to skip the connect account page and redirect to the home page during the payment flow integration.

These changes ensure the project remains up-to-date and clarify the next steps for the payment flow implementation.

* Refactor Python sidecar integration and enhance skill runtime management

- Updated `setup-python-sidecar.mjs` to symlink system Python to `src-tauri/runtime-skill-python-<target>` for local development.
- Introduced new commands in Rust for retrieving the current working directory and virtual environment site-packages for Python skills.
- Modified `SkillTransport` to support spawning skills using the sidecar for bundled runtimes, improving the execution flow.
- Updated `tauri.conf.json` to reflect changes in external binaries and added documentation for the Python sidecar setup.
- Adjusted skill management to ensure proper error handling and logging during skill execution.

These changes streamline the development process for Python skills and enhance the overall robustness of the skill management system.

* Enhance skill connection indicators and logging

- Added a new `TelegramConnectionIndicator` component to display real-time connection status for the Telegram skill.
- Integrated `useSkillConnectionStatus` hook across various components to provide unified connection status for skills.
- Updated `ConnectionsPanel` and `ConnectStep` to utilize the new connection status logic, improving user feedback during skill setup.
- Enhanced logging in `SocketService` and `SocketProvider` for better debugging and error tracking.
- Introduced utility functions for sanitizing sensitive data before logging, ensuring security during error handling.

These changes improve the user experience by providing clear connection statuses and enhance the robustness of the logging system.

* Remove console logging from SocketProvider for cleaner code

- Eliminated console log statements related to socket connection and disconnection events, as well as error handling, to streamline the codebase.
- This change enhances the maintainability of the SocketProvider component by reducing unnecessary logging clutter.

* Enhance SocketService with MCP transport and tool management

- Introduced `SocketIOMCPTransportImpl` for handling client-server MCP requests, improving communication efficiency.
- Updated the `mcp:listTools` event to aggregate tools from all ready skills, providing a comprehensive tool list in response to requests.
- Enhanced the `mcp:toolCall` event to validate tool name formats and handle tool calls asynchronously, improving error handling and logging.
- Added a method to retrieve the MCP transport instance, enhancing the SocketService's functionality.

These changes improve the robustness and usability of the SocketService in managing MCP interactions.

* Remove logger service and replace with debug package in SocketService

- Deleted the custom logger implementation in favor of using the `debug` package for logging in the SocketService.
- Updated the SocketService to enable logging based on the development environment, improving debugging capabilities.

These changes streamline the logging process and enhance the maintainability of the codebase.

* Add SkillsGrid component to enhance skill management interface

- Introduced a new SkillsGrid component to display a grid of skills with connection statuses and setup options.
- Implemented skill icons and status badges for better visual representation of skill states.
- Integrated skills catalog loading functionality to dynamically fetch and display available skills.
- Updated Home component to include the SkillsGrid, improving user interaction with skills.

These changes enhance the user experience by providing a clear and interactive skills management interface.

* Update skills submodule and add skills catalog JSON

- Updated the skills submodule to the latest commit for improved functionality.
- Introduced a new `skills-catalog.json` file containing detailed descriptions and configurations for various skills, enhancing the skills management system.
- Enhanced the `SkillsGrid` component to validate skill names, ensuring they do not contain underscores, which are reserved for tool namespacing.

These changes improve the robustness of the skills management interface and ensure better adherence to naming conventions.

* Update skills submodule and modify tool name formatting in SocketService

- Updated the skills submodule to the latest commit for improved functionality.
- Changed the tool name formatting in SocketService to use double underscores instead of single underscores, enhancing clarity in tool identification.

These changes ensure better alignment with naming conventions and improve the overall functionality of the skills management system.

* Add DownloadScreen component and update Welcome page

- Introduced a new DownloadScreen component to provide users with platform-specific download options for the application.
- Updated the Welcome page to conditionally display the DownloadScreen for web users while showing the Telegram login button for Tauri users.
- Modified the greeting text and adjusted layout for improved user experience.

These changes enhance the onboarding process by offering clear download options based on the user's platform.

* Enhance AppRoutes and Welcome component for web detection

- Added logic in AppRoutes to determine if the application is running on the web or Tauri, using the `isTauri` utility.
- Updated the Welcome component to accept a prop indicating the platform, allowing for tailored rendering based on the environment.
- This change improves the onboarding experience by providing a more context-aware interface for users depending on their platform.

* Refactor SkillsGrid and Home components for improved clarity

- Removed unused Telegram and Gmail connection indicators from the Home component to streamline the interface.
- Simplified the SkillCard function in SkillsGrid by renaming the description parameter for better clarity.
- These changes enhance code readability and maintainability by eliminating unnecessary components and improving parameter naming.

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 06:44:53 +05:30
378a803dd7 Feat/payment (#10)
* Add submodule for skills and initialize skills repository

- Created a new .gitmodules file to include the skills submodule.
- Initialized the skills submodule with a commit reference, linking to the skills repository on GitHub.

This update integrates the skills component into the project, enhancing the AI system's capabilities.

* Implement subscription billing UI with Stripe and Coinbase integration

Replace the placeholder BillingPanel with a working subscription billing
interface. Users can view their current plan and token usage, upgrade via
Stripe (card) or Coinbase (crypto, annual-only), and manage subscriptions
through Stripe's Customer Portal. Adds billing API service and types.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Add unified skill system with core type definitions and management features

- Introduced a comprehensive skill system that includes lifecycle management, tool definitions, state management, entity extensions, and intelligence rules.
- Implemented a skill state manager using Zustand for managing skill-specific state.
- Created an entity extension registry for registering new entity and relation types.
- Developed an intelligence engine for evaluating rules and executing actions based on events.
- Established a unified tool registry to streamline tool management across various integrations.

This update enhances the AI system's capabilities by providing a robust framework for skill management and interaction.

* Add billing helpers and refactor BillingPanel for improved plan management

- Introduced a new `billingHelpers.ts` file containing plan metadata, utility functions for plan management, and pricing calculations.
- Refactored `BillingPanel` to utilize the new billing helpers, streamlining the display of plan information and pricing.
- Added unit tests for billing helpers to ensure functionality and correctness of plan-related operations.

This update enhances the billing system's structure and maintainability, providing a clearer separation of concerns for plan management.

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 21:41:51 +05:30
d668a3a66a Migrate entity graph from SQLite to Neo4j backend API (#9)
* Migrate entity graph from local SQLite to remote Neo4j backend API

Replace Tauri IPC invoke() calls with REST API calls to /api/entity-graph/
endpoints. EntityManager public API is unchanged so all consumers (AIProvider,
EntityQuery, SkillRegistry) need no modifications.

- Rewrite manager.ts to use apiClient instead of Tauri invoke()
- Add Neo4j response types and conversion helpers in types.ts
- Remove Rust entity_db.rs (607 lines) and rusqlite dependency
- Remove 12 ai_entity_* commands from Tauri generate_handler

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Add Git workflow guidelines to CLAUDE.md

- Introduced a new section outlining the requirement for all pull requests to target the `develop` branch instead of `main`. This update aims to standardize the contribution process and improve collaboration among developers.

* Enhance EntityManager with optimistic concurrency control for tag management

- Introduced MAX_TAG_RETRIES constant to handle HTTP 409 Conflict errors during tag addition and removal.
- Refactored addTag and removeTag methods to implement retry logic using If-Match headers for optimistic concurrency control.
- Updated search and getByTag methods to utilize URLSearchParams for improved query handling.
- Simplified entity fetching logic in getById and search methods to enhance performance and clarity.

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 20:56:54 +05:30
6e4eeecc0c Fetch constitution from public GitHub repo and enhance AI system (#8)
* Add AI intelligence system with memory, sessions, skills and constitution

Implements a client-side AI system inspired by OpenClaw's architecture:

Rust backend (src-tauri/src/ai/):
- SQLite memory database with FTS5 full-text search (memory_db.rs)
- AES-256-GCM encryption with Argon2id key derivation (encryption.rs)
- Session JSONL file I/O and memory file management (sessions.rs)
- 30 new Tauri commands for memory, encryption, and session operations

TypeScript AI modules (src/lib/ai/):
- Constitution framework: safety rules, memory principles, action validation
- Memory system: markdown chunking, hybrid FTS5+vector search, encryption
- Prompt system: modular builder with 7 sections (constitution, identity,
  crypto-intelligence, memory-recall, skills, tools, context)
- Session system: JSONL transcripts, context compaction, memory flush
- Skills framework: SKILL.md loader, registry, GitHub installer
- LLM providers: pluggable interface with custom and OpenAI implementations
- AI tools: memory_search, memory_read, memory_write, web_search

Integration:
- Redux aiSlice with persisted config
- AIProvider in the app provider chain
- All data encrypted at rest, zero-knowledge architecture

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Apply cargo fmt formatting

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Add unit tests for AI intelligence system

Cover constitution (loader, validator), memory (chunker), prompts
(system-prompt, sections), providers (embeddings), sessions (types),
skills (frontmatter, registry), tools (registry), and Redux aiSlice.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Enhance AI system with entity management and constitution updates

- Introduced EntityManager and EntityQuery classes for managing entity relationships and queries within the AI platform.
- Updated constitution loader to fetch the constitution from a public GitHub repository, with fallback to a bundled default.
- Enhanced constitution parsing to support new formats and improved error handling.
- Updated memory schema to reflect changes in storage management.
- Added support for loading skill definitions from TypeScript files, improving skill lifecycle management.

This update strengthens the AI system's capabilities in entity management and constitution handling, ensuring better compliance and functionality.

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 20:25:12 +05:30
Steven Enamakel 07ce7f966e Refactor integration structure and state management
- Restructured integration libraries to have dedicated directories for each integration (e.g., Telegram, future Gmail) under `src/lib/<integration>/`, improving organization and clarity.
- Updated state management to ensure all Redux dispatches for each integration are routed through specific state functions, enhancing maintainability.
- Consolidated services related to each integration within their respective folders, separating them from cross-cutting services.

This update streamlines the architecture for better scalability and maintainability of integrations.
2026-01-31 01:22:49 +05:30
Steven Enamakel cc4d40b391 Refactor Telegram services and update state management
- Moved `mtprotoService` and other Telegram-related services to a dedicated `src/lib/telegram/services/` directory for better organization.
- Updated import paths across various files to reflect the new service structure.
- Enhanced state management by ensuring all Redux dispatches for Telegram state are routed through dedicated functions, improving maintainability and clarity.
- Consolidated unit tests to ensure they align with the new service structure and state management approach.

This update streamlines the Telegram integration and enhances the overall architecture of the application.
2026-01-31 01:18:20 +05:30
Steven Enamakel 862effe87e Add message loading and update management services for Telegram integration
- Introduced a new `messageLoader` service to handle smart message fetching with three-direction loading, request cancellation via AbortController, and batch ID fetching.
- Implemented a `mtprotoService` for managing the MTProto client lifecycle, including initialization, connection, and authentication processes.
- Added an `updateManager` service to track and process updates with gap detection and recovery mechanisms, ensuring reliable message delivery.
- Included comprehensive tests for the update manager to validate its functionality and state management.

This update enhances the Telegram integration by providing robust message handling and update processing capabilities.
2026-01-31 01:13:29 +05:30
Steven Enamakel 32488245be Add debug package and related types for improved logging
- Added the `debug` package to enhance logging capabilities across the application.
- Included `@types/debug` for TypeScript support, ensuring type safety in logging implementations.
- Updated package-lock and yarn.lock files to reflect these changes.

This update aims to facilitate better debugging and monitoring of the Telegram MCP system.
2026-01-31 00:54:58 +05:30
Steven Enamakel 95e06bc54a Refactor Telegram MCP integration and add new API functionalities
- Updated import paths for Telegram types and API functions to improve module organization.
- Introduced new helper functions for reading typed values from MCP tool arguments.
- Added comprehensive API functions for managing Telegram contacts, chats, and messages, including creating groups, channels, and polls.
- Implemented a tool action parser to convert tool inputs into human-readable descriptions.
- Added tests for new functionalities to ensure reliability and correctness.

This update enhances the Telegram MCP server's capabilities and improves code maintainability.
2026-01-31 00:51:52 +05:30
Steven EnamakelandClaude Opus 4.5 c270f44c08 Add Redux state updates to Telegram API read functions
API read functions previously fetched data from Telegram but never
persisted it to Redux, causing the cache to stay empty after API calls.
Now all read functions that fetch from the Telegram API dispatch Redux
actions to update chats, messages, and users in the store.

Introduces src/lib/mcp/telegram/state/ with dispatch helpers for chat,
message, and user state updates. Modifies 15 API functions to call
these after successful API fetches.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 00:47:21 +05:30
Steven EnamakelandClaude Opus 4.5 3b677a3656 Add comprehensive Vitest test suite for Telegram MCP system
Set up Vitest with node polyfills and add 338 tests across 18 test files
covering the MCP tools, API layer, Redux state, selectors, and update
manager. Fix shallow-copy bug in ensureUser that caused shared state
between Redux user entries.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 15:46:43 +05:30
Steven EnamakelandClaude Opus 4.5 5bd41b2859 Refactor Telegram MCP into separate API and Tools layers
Split monolithic tool handlers into a clean two-layer architecture:
- `api/` layer: ~80 files with raw Telegram API calls returning typed `ApiResult<T>` with `fromCache` boolean
- `tools/` layer: thinned to validation + formatting wrappers delegating to api/

Key changes:
- Add `ApiResult<T>` type and `fromCache` field to `MCPToolResult`
- Extract shared helpers (getChatById, formatMessage, etc.) into `api/helpers.ts`
- Move `apiResultTypes.ts` and `apiCastHelpers.ts` into `api/`
- Delete `telegramApi.ts` (all logic migrated to individual api/ files)
- Add `validatePositiveInt` to validation utilities
- Auto-infer `fromCache` in server.ts via `isStateOnlyTool()` safety net
- Update `bulk.ts` skill to import from new api layer

Net reduction of ~2,475 lines across 86 files.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-30 12:10:27 +05:30
Steven Enamakel b9cf9452f4 Enhance MCP tool classification and API fallback mechanisms
- Introduced a three-tier tool classification system for rate limiting: state_only, api_read, and api_write, improving the management of tool execution based on their API call characteristics.
- Updated rate limiting configuration to reflect new classifications, ensuring appropriate delays for different tool types.
- Implemented API fallback mechanisms in various tools to first attempt data retrieval from cached Redux state before falling back to Telegram API calls, enhancing performance and reliability.
- Refactored multiple Telegram tools to utilize the new API fallback approach, improving user experience during data retrieval.

This update significantly enhances the efficiency and responsiveness of the MCP by optimizing tool execution and data retrieval processes.
2026-01-30 08:39:27 +05:30
Steven Enamakel b9d4076b37 Add rate limiting and bulk/reminder skills to MCP
- Introduced a new rate limiter to manage tool execution frequency, preventing excessive API calls and ensuring smoother performance.
- Added bulk operations skill for batch processing of messages, including sending, archiving, and deleting across multiple chats.
- Implemented reminders skill for creating and managing time-based reminders, enhancing user interaction capabilities.
- Updated MCP server to integrate new skills and enforce rate limits on tool execution, improving overall system reliability and user experience.

This update significantly enhances the functionality of the MCP by providing powerful new tools while ensuring responsible API usage through rate limiting.
2026-01-30 08:13:43 +05:30
Steven EnamakelandGitHub 520bfdb74c Fix/telegram login (#4)
* Add UserProvider to App component and enhance user data fetching logic

- Integrated UserProvider into the App component to manage user state.
- Updated UserProvider to fetch current user data on token availability and handle token expiration by clearing the token on fetch failure.
- Improved user data fetching logic for better error handling and user experience.

* Enhance Telegram connection handling and error management

- Added logic to handle Telegram account mismatch, providing user feedback and resetting connection state.
- Improved user verification during authentication to ensure the logged-in account matches the Telegram account.
- Refactored connection status checks and error handling for better user experience.
- Introduced a method to clear session and disconnect when account mismatch occurs.
- Updated polling mechanism for authentication status to ensure timely updates.

This update improves the robustness of the Telegram connection process and enhances user feedback during authentication failures.

* ran prettier

* Refactor socket and auth state management for user-specific handling

- Updated socket state management to support multiple users by introducing user-specific selectors and actions.
- Refactored connection status handling in the socket service to dispatch user-specific status updates.
- Enhanced onboarding state management to track completion per user, allowing for more granular control.
- Introduced new selectors for socket and auth states to improve readability and maintainability.
- Updated relevant components to utilize the new user-specific state management.

This update improves the application's ability to handle multiple users and enhances the overall user experience during onboarding and socket connections.

* Enhance MTProto client session management and introduce user-specific session handling

- Updated the MTProtoService to manage sessions per user by storing session data under a user-specific key.
- Modified the initialize method to accept a userId parameter, allowing for user-specific session initialization and management.
- Improved session loading and saving logic to ensure proper handling of user sessions.
- Added a utility function to generate session keys based on userId for better maintainability.

This update enhances the application's ability to handle multiple user sessions effectively.

* Refactor Telegram state management for user-specific handling

- Introduced user-specific state management in the Telegram store, allowing for better handling of multiple users.
- Updated selectors to retrieve state based on the current user, improving data encapsulation and reducing global state dependencies.
- Enhanced reducers and thunks to ensure actions are dispatched with user context, maintaining user-specific data integrity.
- Modified persistence configuration to store Telegram state scoped by user, ensuring isolated state management.

This update significantly improves the application's ability to manage multiple user sessions effectively and enhances overall user experience.

* Enhance MTProtoService connection handling with user-specific initialization

- Updated the checkConnection method to accept an optional userId parameter, allowing for user-specific connection initialization.
- Modified the connection logic to ensure proper initialization only occurs when a userId is provided, improving session management.
- Refactored related thunks to use a consistent naming convention for userId parameters, enhancing code clarity.

This update improves the handling of user sessions in the MTProtoService, aligning with recent enhancements in user-specific state management.

* Refactor Telegram connection handling for user-specific management

- Updated the TelegramConnectionModal to utilize user-specific identifiers for connection status and authentication processes, enhancing session management.
- Refactored related components and selectors to ensure userId is consistently passed and utilized, improving clarity and maintainability.
- Enhanced the ConnectionsPanel and ConnectStep to check for saved sessions based on userId, allowing for better handling of multiple user connections.

This update significantly improves the application's ability to manage user-specific Telegram connections and enhances the overall user experience.

* Refactor Telegram connection logic to simplify session management

- Removed unnecessary userId checks and localStorage interactions from ConnectionsPanel and ConnectStep components, streamlining the connection status determination.
- Updated MTProtoService to manage session data through Redux instead of localStorage, enhancing consistency and maintainability.
- Improved session loading and saving logic to focus solely on Redux state, ensuring better integration with user-specific session handling.

This update enhances the clarity and efficiency of the Telegram connection management process, aligning with recent improvements in user-specific state management.

* Update CLAUDE.md to clarify localStorage usage and emphasize Redux for state management

- Revised documentation to discourage the use of localStorage and sessionStorage for app state, advocating for Redux and Redux Persist instead.
- Added guidelines for removing existing localStorage usage and migrating relevant data to Redux.
- Updated service layer documentation to reflect changes in session management, specifying that session data is now stored in Redux rather than localStorage.
- Enhanced clarity on deep link handling and the prevention of infinite reload loops.

This update aligns with recent improvements in user-specific state management and reinforces best practices for state handling.

* Enhance onboarding process with error handling and API integration

- Updated the Onboarding component to include an API call for marking onboarding as complete, with error handling to provide user feedback.
- Refactored the GetStartedStep component to support asynchronous completion handling, including loading state and error messages.
- Introduced a new onboardingComplete method in the userApi service to facilitate the onboarding completion process.

This update improves the user experience during onboarding by ensuring proper error management and feedback.

* Enhance TelegramConnectionModal with socket connection management and improved initialization flow

- Integrated socket connection handling in the TelegramConnectionModal to ensure the socket is connected when the modal opens, enhancing real-time features.
- Refactored the initialization logic to streamline the connection process, including user verification and error handling.
- Introduced a reference to track the QR code flow state, preventing multiple initiations and improving user experience during authentication.

This update improves the reliability of the Telegram connection process and enhances user feedback during the onboarding experience.

* Refactor Telegram connection checks for improved logic consistency

- Updated the ConnectionsPanel and ConnectStep components to refine the logic for determining if a Telegram connection is established, ensuring that both session string and authentication status are required for a valid connection.
- Simplified className definitions in the UI components for better readability and maintainability.

This update enhances the clarity of connection status checks and improves the overall user experience during the onboarding process.

* Refactor Telegram authentication flow and improve error handling

- Simplified the TelegramLoginButton component by removing complex authentication logic and replacing it with a direct link to the Telegram bot for login.
- Enhanced the Login page to consume a login token from the URL, providing better error handling and user feedback during the authentication process.
- Introduced a new API service for consuming login tokens, ensuring secure retrieval of JWT tokens from the backend.

This update streamlines the authentication experience and improves error management, enhancing overall user experience during login.
2026-01-29 07:38:34 +05:30
Steven Enamakel 5a0425c021 Add type casting helpers for Telegram MTProto API
- Introduced `apiCastHelpers.ts` to centralize type casting functions for Telegram's complex union types, improving type safety and code clarity.
- Updated multiple Telegram tools to utilize these helpers for casting input entities, enhancing maintainability and consistency across the codebase.
- Modified `apiResultTypes.ts` to refine type definitions, ensuring better integration with the Telegram API.

These changes streamline type handling in Telegram MCP tools, facilitating improved development practices and reducing the risk of type-related errors.
2026-01-28 09:20:34 +05:30
Steven Enamakel d0e1191c88 Refactor Telegram MCP tools for improved type safety and consistency
- Updated ApiPhoto interface in apiResultTypes.ts to require accessHash and fileReference properties, enhancing type safety.
- Modified getContactIds, getMediaInfo, getRecentActions, getUserPhotos, listTopics, and subscribePublicChannel tools to utilize type casting for better type handling and clarity.
- Ensured consistent handling of input entities across multiple tools by using 'unknown' type casting.

These changes strengthen the reliability and maintainability of the Telegram MCP tools, facilitating better integration with the Telegram API.
2026-01-28 07:33:35 +05:30
Steven Enamakel 86cc53aa76 Add CLAUDE.md and apiResultTypes.ts for Telegram MCP documentation and type definitions
- Created CLAUDE.md to provide comprehensive guidance on the project, including architecture, commands, and environment variables.
- Introduced apiResultTypes.ts to define TypeScript interfaces for various API responses from the Telegram MTProto API, enhancing type safety and clarity in tool implementations.
- Updated multiple Telegram MCP tools to utilize the new type definitions, improving consistency and maintainability across the codebase.

These changes establish a solid foundation for documentation and type safety, facilitating better development practices and integration with the Telegram API.
2026-01-28 07:31:35 +05:30
Steven Enamakel d7d848df36 Refactor App and MCPProvider integration for improved structure and cleanup
- Removed MCPProvider from App.tsx to streamline the component hierarchy.
- Added cleanup functionality for the Telegram MCP server in SocketProvider to ensure proper resource management on socket disconnection.
- Introduced a new cleanup function in the Telegram MCP tools to enhance server management.

These changes enhance the overall structure of the application and improve resource handling within the Telegram MCP integration.
2026-01-28 07:20:46 +05:30
Steven Enamakel 0abed4dfd6 Refactor Telegram MCP tools to utilize 'big-integer' library for consistent large integer handling
- Replaced instances of BigInt with the 'big-integer' library across multiple Telegram tools, ensuring uniformity in handling large integers.
- Updated type casting for input entities and user IDs to improve type safety and maintainability.
- Enhanced overall code clarity by standardizing import statements and ensuring consistent use of type casting practices.

These changes strengthen the reliability and consistency of the Telegram MCP tools, facilitating better integration with the Telegram API.
2026-01-28 07:14:43 +05:30
Steven Enamakel b5857beade Implement Telegram MCP tools for user and chat interactions
- Developed various tools for managing user interactions, including adding, deleting, and blocking contacts, as well as managing chat drafts and polls.
- Enhanced error handling and input validation across all tools, ensuring clear feedback for invalid inputs and operational errors.
- Improved logging and error formatting to streamline error management and enhance the reliability of user and chat operations.

These updates significantly enhance the Telegram MCP tools, providing comprehensive functionalities for user and chat management while ensuring a smooth user experience through improved error handling and validation.
2026-01-28 07:06:55 +05:30
Steven Enamakel 8850f9d34d Refactor Telegram MCP tools for improved consistency and type safety
- Replaced BrowserRouter with HashRouter in App.tsx for better routing management.
- Enhanced type safety in multiple Telegram tools by standardizing string and number checks.
- Updated return statements in various tools to ensure consistent formatting of response content.
- Improved overall code clarity by unifying import statements and ensuring consistent use of double quotes.

These changes enhance the maintainability and reliability of the Telegram MCP tools, facilitating better integration with the Telegram API.
2026-01-28 07:02:45 +05:30
Steven Enamakel 1f430a6551 Refactor Telegram MCP tools for type safety and consistency
- Updated multiple Telegram tools to cast input entities and chat IDs using 'unknown' for improved type safety.
- Replaced instances of BigInt with the 'big-integer' library for consistent handling of large integers across tools.
- Enhanced overall code clarity and maintainability by ensuring uniform type casting practices.

These changes strengthen the type safety and reliability of the Telegram MCP tools, facilitating better integration with the Telegram API.
2026-01-28 07:00:29 +05:30
Steven Enamakel b00852b77c Implement Telegram MCP tools for chat management and user interactions
- Developed various Telegram tools for managing chats, including archiving, unarchiving, muting, and unmuting chats, as well as inviting users to groups and managing chat photos.
- Enhanced user management capabilities with tools for banning, unbanning, promoting, and demoting users in groups and channels.
- Integrated robust error handling and input validation across all tools, ensuring clear feedback for invalid inputs and operational errors.
- Improved logging and error formatting to streamline error management and enhance the reliability of chat and user operations.

These updates significantly enhance the Telegram MCP tools, providing comprehensive functionalities for chat and user management while ensuring a smooth user experience through improved error handling and validation.
2026-01-28 06:56:23 +05:30
Steven Enamakel ec4966d9e3 Implement Telegram MCP tools for message management and error handling
- Refactored multiple Telegram tools to replace the notImplemented function with actual implementations for deleting, editing, forwarding, pinning, unpinning, and marking messages as read.
- Added input validation for message IDs and chat IDs, ensuring robust error handling and user feedback for invalid inputs.
- Integrated logging and error formatting to enhance error management across all tools, improving the overall reliability of message operations.
- Implemented functionality to retrieve message history and context, providing users with better access to chat information.

These changes significantly enhance the Telegram MCP tools, enabling comprehensive message management capabilities while ensuring a smooth user experience through improved error handling and validation.
2026-01-28 06:52:21 +05:30
Steven Enamakel cf1031cc0b Integrate MCPProvider and enhance Telegram MCP tools
- Added MCPProvider to manage the initialization and updates of MCP servers within the SocketProvider context.
- Introduced utility functions for handling typed values from MCP tool arguments, improving input validation across various tools.
- Updated TelegramMCPServer to include enhanced logging and type safety for tool handling.
- Refactored multiple Telegram tools to utilize the new argument handling functions, ensuring consistent input processing and error management.

These changes enhance the overall structure and functionality of the Telegram MCP integration, providing a more robust framework for managing Telegram interactions.
2026-01-28 06:33:43 +05:30
Steven Enamakel f5e54efa72 Add Telegram MCP tools and server components for enhanced functionality
- Introduced core components for Telegram MCP integration, including server management, API helpers, and tool action parsers.
- Implemented various tools for user and chat management, such as adding contacts, archiving chats, and sending messages.
- Created utility functions for handling Telegram-specific actions and responses, improving interaction with the Telegram API.
- Defined types and context for better type safety and clarity in tool implementations.

These changes establish a comprehensive framework for Telegram MCP interactions, enhancing the application's capabilities in managing Telegram functionalities.
2026-01-28 06:24:33 +05:30
Steven Enamakel 1d687a07f8 Add MCP core components for error handling, logging, validation, and transport
- Introduced error handling utilities in errorHandler.ts, including a structured error logging mechanism and a function for generating error codes.
- Added a logger module in logger.ts for standardized logging with a [MCP] prefix.
- Implemented validation utilities in validation.ts to ensure proper input handling for MCP tools, including ID validation and error management.
- Created transport.ts to manage Socket.IO communication, facilitating interaction between frontend and backend MCP components.
- Defined shared types in types.ts to standardize data structures used across MCP modules.
- Updated index.ts to export new modules, ensuring a cohesive structure for MCP integration.

These changes lay the groundwork for a robust MCP framework, enhancing error management, logging, and communication capabilities within the application.
2026-01-28 06:09:49 +05:30