Commit Graph
512 Commits
Author SHA1 Message Date
cyrus d8f79dbd2c Refactor OAuth login URLs and improve deep link handling.
Updated OAuth provider login URLs to use "responseType=json" for development mode. Enhanced deep link handling by adding support for an additional "key" parameter to distinguish token types.
2026-03-11 17:18:55 +05:30
Cyrus GrayandGitHub b5774817ea Merge pull request #168 from graycyrus/develop
working
2026-03-10 13:25:33 +05:30
cyrus 8be4852c54 Merge remote-tracking branch 'megamind/feat/set-tool-call' into develop 2026-03-10 11:31:32 +05:30
M3gA-Mind 01c6fd9421 refactor: streamline JSON formatting and enhance documentation clarity
- Consolidated JSON structure in `.mcp.json` and `.claude/mcp.json` for improved readability.
- Updated `CLAUDE.md` and other documentation files to enhance formatting consistency and clarity.
- Improved the organization of agent roles and initialization procedures in `AGENTS.md`, `BOOTSTRAP.md`, and `IDENTITY.md`.
- Enhanced user understanding and personalization strategies in `USER.md` and `MEMORY.md`.
- Refined tool generation scripts for better error handling and output formatting in `discover-tools.js` and `openClaw-formatter.js`.
2026-03-10 05:31:26 +05:30
M3gA-Mind 65baaaced5 feat: enhance Conversations component with detailed logging and tool call execution
- Updated the inference request structure to improve type safety and added comprehensive logging for both requests and responses.
- Modified tool call execution to handle only the latest tool call while sending placeholders for previous calls.
- Implemented error handling for tool results, ensuring proper logging and formatting of error messages.
- Introduced a timeout parameter for network requests in the ops_net module to enhance request reliability.
2026-03-10 05:24:16 +05:30
M3gA-Mind 9436fdef1c Merge remote-tracking branch 'substream/develop' into feat/set-tool-call 2026-03-10 03:29:31 +05:30
cyrus bd3b93523a feat: add agent tool registry types and update tool schema mapping
- Introduced `AgentToolSchema` and `AgentToolExecution` interfaces to define tool registry types based on ZeroClaw compatibility.
- Added `IAgentToolRegistry` interface to provide type-safe operations for managing and executing tools.
- Updated `agentToolRegistry.ts` to explicitly map tool schemas to the `function` type for improved type consistency.
2026-03-10 02:32:39 +05:30
cyrus e0af9e923d log: enhance runtime logging and tool filtering for debugging
- Added detailed logging for tool schema generation, tool execution, and runtime state checks to improve traceability.
- Enhanced Gmail/Notion tool filtering with additional
2026-03-10 02:00:58 +05:30
cyrus cae9f7335c remove: deprecated agent system files and types
- Removed unused `agent.ts` system types, agent loop service (`agentLoop.ts`), corresponding UI components (`AgentExecutionPanel.tsx`), and tests (`agentSlice.test.ts`).
- Cleaned up related imports and ensured no functionality depends on the deprecated files.
2026-03-10 01:12:31 +05:30
cyrus ae187de9d1 feat: introduce agent system types, execution panel, and service tests
- Added new `AgentSystem` types to support enhanced agent execution, tool tracking, API compatibility, and integration with thread system.
- Developed `AgentExecutionPanel` React component for detailed real-time monitoring of agent execution status and history.
- Created comprehensive tests for `AgentLoopService` covering execution flow, tool integration, error handling, and timeout scenarios.
2026-03-10 00:40:00 +05:30
M3gA-Mind e24db395b8 feat: integrate Notion skill support into Conversations and SkillProvider
- Added Notion context building functionality to Conversations component, enhancing user messages with relevant Notion workspace information.
- Implemented synchronization of Notion pages and summaries in SkillProvider, ensuring state consistency with the Notion skill.
- Expanded Notion slice to include new state properties for pages and summaries, along with corresponding actions for state management.
- Enhanced type definitions for Notion-related data structures to improve type safety and clarity.
2026-03-09 21:15:47 +05:30
M3gA-Mind f91e409a0d Enhance development scripts and improve tool documentation
- Updated `package.json` scripts for better error handling and streamlined execution of Tauri commands.
- Added a new `gmail-skill-integration.md` document detailing the Gmail skill integration process, including OAuth2 flow and tool definitions.
- Improved formatting and consistency in `TOOLS.md` for better readability and clarity.
- Enhanced logging in skill management and transport layers for better debugging and monitoring of tool calls.
2026-03-09 19:27:48 +05:30
Cyrus GrayandGitHub 675335d1fe Merge pull request #164 from graycyrus/feature/tools-injection-system
Feature/tools injection system
2026-03-06 16:25:18 +05:30
cyrus 48eb31922d Reduce toolset by removing Telegram integration
The toolset has been streamlined to eliminate the Telegram integration, reducing the total tools from 152 to 104 and integrations from 4 to 3. This change simplifies the environment by focusing on the remaining three integrations.
2026-03-06 16:09:56 +05:30
cyrusandClaude c00ba2f045 feat: implement automatic TOOLS.md cache synchronization with bundled-only loading
- Remove GitHub remote loading to eliminate 404 errors in development
- Implement automatic cache invalidation when TOOLS.md is updated
- Add file watcher system for real-time cache refresh
- Create useToolsUpdates hook for reactive UI components
- Ensure AI Config page immediately reflects updated tool data
- Auto-dispatch tools-updated events for seamless UI synchronization

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-03-06 16:09:36 +05:30
Cyrus GrayandGitHub 323bc5eb72 Merge pull request #162 from graycyrus/feature/tools-injection-system
docs: add TODO for AI config repository to fix 404 fallback errors
2026-03-05 21:52:00 +05:30
cyrusandClaude 35662f051d docs: add TODO for AI config repository to fix 404 fallback errors
Document expected 404 behavior in AI configuration system where loaders
attempt GitHub remote fetch first, then gracefully fallback to bundled files.

Details:
- Console shows "Failed to load resource: 404" during Settings → AI Config refresh
- Affects: soul/loader.ts and tools/loader.ts GitHub URL attempts
- Fallback works correctly, 404s are cosmetic console warnings
- TODO: Setup public AI config repository for clean remote loading

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-03-05 21:50:49 +05:30
Cyrus GrayandGitHub 8cfcfc582e Merge pull request #161 from graycyrus/feature/tools-injection-system
feat: tools.md file realtime update
2026-03-05 21:50:10 +05:30
cyrus 9de11561a4 Merge remote-tracking branch 'upstream/develop' into feature/tools-injection-system 2026-03-05 21:33:43 +05:30
cyrus 72fe40db84 Remove noisy logs and update package references
Redundant debug logs in the daemon were removed to reduce noise in the logging system. Updated package references in `yarn.lock` and `package.json` to use `registry.npmjs.org` instead of `registry.yarnpkg.com`, ensuring consistency in package resolution.
2026-03-05 21:22:12 +05:30
cyrusandClaude f55a0de3f8 feat: implement auto-update TOOLS.md system with real runtime tool discovery
Replace hardcoded mock data (4 tools) with dynamic discovery system that
generates TOOLS.md from actual V8 skills runtime (152+ tools).

Key Features:
- Real-time tool discovery via runtime_all_tools() command
- Auto-generates comprehensive documentation with examples
- Throttled updates (10s limit) to prevent excessive calls
- Vite file watching exclusion to prevent reload loops
- Manual update capability via dev mode button
- OpenClaw-compliant formatting for AI context injection

Technical Implementation:
- New auto-update.ts module with discovery, grouping & markdown generation
- Enhanced Tauri write_ai_config_file command for secure file operations
- Removed auto-trigger from skill activation for better performance
- Added ai/ directory to Vite ignore list

Result: TOOLS.md now shows real tools from telegram (48), gmail (7),
notion (25), github (72) instead of 4 hardcoded examples.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-03-05 21:20:50 +05:30
Cyrus GrayandGitHub 07365d67e3 Merge pull request #160 from M3gA-Mind/feat/final-flow-check
Sync Emails with the Memory Layer
2026-03-05 21:04:10 +05:30
M3gA-Mind c12fb22f9d Merge remote-tracking branch 'upstream/develop' into feat/final-flow-check 2026-03-05 20:57:53 +05:30
M3gA-Mind 05581d9d85 Refactor Gmail metadata synchronization logic
- Updated the `syncGmailMetadataToBackend` function to accept a new `GmailStateForSync` interface, enhancing type safety and clarity.
- Introduced a new `GmailEmailSummaryLike` interface to represent email summaries in the synchronization process.
- Adjusted the handling of Gmail profile data to ensure proper extraction and emission of metadata to the backend.
- Updated the `SkillProvider` to dispatch Gmail emails to the Redux store and synchronize the Gmail state effectively.
2026-03-05 20:55:45 +05:30
cyrusandClaude aef7df5dce feat: implement unified AI injection system with dynamic TOOLS.md generation
- Create complete modular AI configuration system following OpenClaw standards
- Add dynamic TOOLS.md generation from V8 skills runtime discovery
- Implement unified injection system with injectAll() for SOUL + TOOLS contexts
- Update all 4 integration points to use unified injection consistently

## New Features:

### Modular AI Configuration System
- loadSoul() → SoulConfig (personality, voice, behavior)
- loadTools() → ToolsConfig (available tools and capabilities)
- loadAIConfig() → AIConfig (unified SOUL + TOOLS configuration)
- Multi-layer caching: memory → localStorage → GitHub → bundled

### Dynamic TOOLS.md Generation
- yarn tools:generate command for build-time tool discovery
- Spawns Tauri runtime to call runtime_all_tools() from V8 skills
- Generates OpenClaw-compliant documentation with usage examples
- Professional formatting with environment configs and statistics
- Currently discovers 4 tools from 3 skills (telegram, notion, gmail)

### Unified Injection System
- injectAll() function combines SOUL + TOOLS injection
- injectSoul() and injectTools() for individual injection
- Consistent [PERSONA_CONTEXT] and [TOOLS_CONTEXT] formatting
- Updated all integration points: Conversations.tsx, threadSlice.ts, threadApi.ts, tauriCommands.ts

### Build System Integration
- Added tools:generate script to package.json
- Rust binary: src-tauri/src/bin/alphahuman-tools-discovery.rs
- Cross-platform discovery scripts in scripts/tools-generator/
- Fixed Cargo.toml binary configuration and main.rs imports

### Enhanced Settings UI
- AI Configuration panel shows both SOUL and TOOLS
- Individual refresh buttons for each component
- Combined "Refresh All AI Configuration" functionality
- Source indicators and statistics display

## Technical Implementation:

### File Structure:
- /ai/TOOLS.md - Auto-generated tool documentation
- src/lib/ai/tools/injector.ts - Tools injection system
- src/lib/ai/injector.ts - Unified injection orchestrator
- src/lib/ai/loader.ts - Unified configuration loader
- scripts/tools-generator/ - Build-time discovery system

### Message Format:
```
[PERSONA_CONTEXT]
I am AlphaHuman: incredibly smart, funny friend...
[/PERSONA_CONTEXT]

[TOOLS_CONTEXT]
4 tools across 3 skills
Categories: Communication (2), Productivity (1), Email (1)
[/TOOLS_CONTEXT]

User message: Hello!
```

### Performance & Reliability:
- Multi-layer caching with 30min TTL
- Graceful degradation if injection fails
- Cross-platform build support (Windows, macOS, Linux)
- Full TypeScript compliance with comprehensive error handling

🤖 Generated with Claude Code(https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-03-05 19:42:55 +05:30
Cyrus GrayandGitHub 9452ea619d Merge pull request #159 from graycyrus/feature/soul-persona-system
refactor: implement organized /ai/ directory with SOUL injection system and OpenClaw bootstrap files
2026-03-05 18:35:10 +05:30
cyrus 01266b1ff4 Merge remote-tracking branch 'upstream/develop' into feature/soul-persona-system
# Conflicts:
#	src/components/settings/panels/AIPanel.tsx
#	src/lib/ai/soul/loader.ts
2026-03-05 18:34:09 +05:30
cyrusandClaude f826612e80 refactor: migrate to organized /ai/ directory structure with OpenClaw bootstrap files
- Move SOUL.md from src/ to /ai/ directory for better organization
- Create comprehensive /ai/ directory structure following OpenClaw framework:
  - /ai/SOUL.md - Moved existing vibrant personality configuration
  - /ai/TOOLS.md - TODO placeholder for available tools and capabilities
  - /ai/AGENTS.md - TODO placeholder for agent definitions and roles
  - /ai/IDENTITY.md - TODO placeholder for core identity and values
  - /ai/USER.md - TODO placeholder for user context and personalization
  - /ai/BOOTSTRAP.md - TODO placeholder for initialization procedures
  - /ai/MEMORY.md - TODO placeholder for curated long-term knowledge
  - /ai/README.md - Comprehensive documentation and implementation guide

- Update import paths in soul/loader.ts:
  - Local import: '../../../../ai/SOUL.md?raw'
  - GitHub URL: 'main/ai/SOUL.md' for remote loading
  - Maintain backward compatibility with existing caching system

- Benefits:
  - Clean separation of AI config from source code
  - Organized structure for future AI configuration expansion
  - User-friendly location for editing AI behavior
  - Scalable foundation for full OpenClaw bootstrap system
  - Better version control and collaboration on AI personality

All TODO placeholder files include detailed structure examples and
implementation guidance for future development.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-03-05 18:28:16 +05:30
cyrusandClaude df03ca19da fix: make SOUL refresh button functional and update persona to be more human
- Fix Refresh SOUL Configuration button to actually refresh cached data
  - Add clearSoulCache() call before loading fresh configuration
  - Create separate refreshSoulConfig() function for button click
  - Add loading state "Refreshing..." for better UX
  - Clear both memory and localStorage cache for fresh data

- Update SOUL.md persona to be more human, funny, and vibrant
  - Transform from robotic assistant to "smart, funny friend" personality
  - Add humor, empathy, and authentic human communication style
  - Update personality traits: Curious, Witty, Empathetic, Authentic, Optimistic
  - Enhance voice & tone with conversational, relatable language
  - Improve behavioral guidelines with natural, friendly examples
  - Maintain professional competence while adding warmth and personality

The refresh button now properly clears cache and reloads SOUL configuration,
and the AI persona is much more engaging and human-like.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-03-05 18:10:47 +05:30
e8c93313cd feat: implement SOUL.md persona injection system for consistent AI behavior (#158)
* feat: add .mcp.json for MCP server configuration

- Introduced `.mcp.json` with server details for managing MCP integrations
- Defines `readme` server with HTTP type and URL endpoint configuration

* fix: Update skills submodule with Telegram error handling improvements

- Fixed setup flow showing false success when TDLib errors occurred
- Improved async error handling in setup steps
- Added client reset mechanisms for error recovery
- Enhanced error messaging for better user experience
- Cleaned up excessive debug logging while maintaining error logs

Resolves issue where Telegram setup showed success modal despite underlying TDLib errors.

🤖 Generated with [Claude Code](https://claude.ai/code)

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

* Add daemon lifecycle management system to frontend UI

This implementation integrates the Rust daemon's health monitoring and lifecycle management into the React frontend. Key features include real-time health indicators, automatic start/error recovery, and detailed control panels, enhancing both user experience and operational reliability.

* Enhance daemon health monitoring with detailed logging, event tracking, and state management improvements.

* Add extensive logging for Tauri socket lifecycle and event listeners

This update improves troubleshooting and debugging by adding detailed logs throughout Tauri socket initialization, event listener setup, and error handling processes.

* Define global Tauri interface types in TypeScript

* Fix daemon service management and health communication issues

This comprehensive fix resolves two critical daemon-related issues:

1. **Launchctl "Input/output error" fix**:
   - Add intelligent state checking before service operations
   - Only load LaunchAgent if not already loaded
   - Treat "already running" as success, not failure
   - Add helper functions for cross-platform service state detection
   - Implement idempotent service start operations

2. **Daemon health communication fix**:
   - Add ALPHAHUMAN_DAEMON_INTERNAL environment variable to external service plist
   - Force external daemon to use file-based communication (daemon_state.json)
   - Implement file watching bridge in main app to emit Tauri events
   - Ensure frontend receives proper health updates from external daemon

**Key Changes**:
- Enhanced `start()` function with state checking across all platforms
- Added `is_service_loaded_macos()`, `is_service_enabled_linux()`, `is_task_exists_windows()`
- Modified macOS plist to include `ALPHAHUMAN_DAEMON_INTERNAL=false`
- Added `watch_daemon_health_file()` function for external daemon communication
- Updated daemon mode detection logic for cross-platform consistency
- Added comprehensive logging for service management operations

**Expected Results**:
- No more "Input/output error" when clicking daemon start button
- External daemon status shows "connected" instead of "disconnected"
- Idempotent service operations (safe to run multiple times)
- Single daemon process prevents resource conflicts
- Cross-platform daemon service reliability

🤖 Generated with [Claude Code](https://claude.ai/code)

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

* Add `ALPHAHUMAN_DAEMON_INTERNAL` env variable to configuration documentation

* Optimize imports in `TauriCommandsPanel.tsx` by removing unused variables and adding necessary hooks.

* Add OAuth login support with configurable provider types and UI components

This update introduces OAuth login functionality, including support for multiple providers (Google, GitHub, Twitter, Discord). Added reusable components for provider buttons and a login section, along with styled configurations and type definitions. Includes enhancements for token handling and updated login flows.

* Add OAuth debug mode support for development environments

Introduce `IS_DEV` checks to enable OAuth debug mode, allowing detailed logging and adjustable OAuth URLs with debug parameters during development.

* Implement hybrid local/API thread storage with message persistence

- Add local-first thread and message storage using Redux Persist
- Persist threads, messages, and UI state (panelWidth, lastViewedAt, selectedThreadId) locally
- Remove API dependencies for thread/message fetching (fetchThreads, fetchThreadMessages)
- Add local thread management actions (createThreadLocal, deleteThreadLocal, addMessageLocal)
- Fix message persistence issue: ensure both user and AI messages survive navigation
- Maintain API integration for sendMessage functionality with AI responses
- Preserve optimistic updates and error handling behavior
- Enable instant app startup and offline conversation viewing

Key changes:
- Enhanced threadSlice with messagesByThreadId storage and local management actions
- Updated Redux persist config to include thread data
- Modified Conversations component to use local thread operations
- Fixed addInferenceResponse to persist preceding user messages
- Maintained all existing UI patterns and error states

🤖 Generated with [Claude Code](https://claude.ai/code)

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

* feat: implement SOUL.md persona injection system

- Add complete SOUL.md persona injection into user messages
- Create AI Configuration panel in Settings for SOUL management
- Implement multi-layer caching (memory → localStorage → GitHub → bundled)
- Add SOUL injection to all message flows:
  - Main Conversations page (inferenceApi flow)
  - Settings Agent Chat (Tauri commands)
  - Redux sendMessage thunk
  - Thread API layer
- Parse SOUL.md sections: personality, safety rules, behaviors, interactions
- Inject persona context with [PERSONA_CONTEXT] tags
- Add graceful error handling with console logging
- Token-optimized context building (top 3 traits, critical safety rules)
- Cross-platform compatibility (Tauri + web environments)

Files added:
- src/lib/ai/soul/types.ts - TypeScript interfaces
- src/lib/ai/soul/loader.ts - SOUL loading with caching
- src/lib/ai/soul/injector.ts - Message injection logic
- src/components/settings/panels/AIPanel.tsx - Settings UI

Files modified:
- src/pages/Conversations.tsx - Add SOUL injection to main chat
- src/store/threadSlice.ts - Add SOUL injection to Redux flow
- src/services/api/threadApi.ts - Add SOUL injection to API layer
- src/utils/tauriCommands.ts - Add SOUL injection to Tauri commands
- src/components/settings/SettingsHome.tsx - Add AI Configuration menu
- src/pages/Settings.tsx - Add AI panel routing

🤖 Generated with [Claude Code](https://claude.ai/code)

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-03-05 17:43:04 +05:30
cyrusandClaude d85313138f feat: implement SOUL.md persona injection system
- Add complete SOUL.md persona injection into user messages
- Create AI Configuration panel in Settings for SOUL management
- Implement multi-layer caching (memory → localStorage → GitHub → bundled)
- Add SOUL injection to all message flows:
  - Main Conversations page (inferenceApi flow)
  - Settings Agent Chat (Tauri commands)
  - Redux sendMessage thunk
  - Thread API layer
- Parse SOUL.md sections: personality, safety rules, behaviors, interactions
- Inject persona context with [PERSONA_CONTEXT] tags
- Add graceful error handling with console logging
- Token-optimized context building (top 3 traits, critical safety rules)
- Cross-platform compatibility (Tauri + web environments)

Files added:
- src/lib/ai/soul/types.ts - TypeScript interfaces
- src/lib/ai/soul/loader.ts - SOUL loading with caching
- src/lib/ai/soul/injector.ts - Message injection logic
- src/components/settings/panels/AIPanel.tsx - Settings UI

Files modified:
- src/pages/Conversations.tsx - Add SOUL injection to main chat
- src/store/threadSlice.ts - Add SOUL injection to Redux flow
- src/services/api/threadApi.ts - Add SOUL injection to API layer
- src/utils/tauriCommands.ts - Add SOUL injection to Tauri commands
- src/components/settings/SettingsHome.tsx - Add AI Configuration menu
- src/pages/Settings.tsx - Add AI panel routing

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-03-05 17:36:18 +05:30
M3gA-Mind cc4fd44843 Merge remote-tracking branch 'upstream/develop' into feat/final-flow-check 2026-03-04 17:06:06 +05:30
cyrus de10d9f572 Merge remote-tracking branch 'upstream/develop' into develop
# Conflicts:
#	src/pages/Conversations.tsx
#	src/store/index.ts
#	src/store/threadSlice.ts
2026-03-04 14:41:30 +05:30
Mega MindandGitHub c3718d9e4f Feat/final flow check (#155)
* feat: add mnemonic recovery flow and encryption key management

- Introduced a new Mnemonic page for users to generate or import their recovery phrase.
- Updated routing to redirect users to the Mnemonic page after onboarding.
- Enhanced state management to store and retrieve AES encryption keys derived from the mnemonic.
- Added utility functions for generating and validating BIP39 mnemonic phrases.
- Updated selectors and reducers to handle encryption key state in the auth slice.
- Included new dependencies for cryptographic operations.

* feat: integrate Web3 wallet functionality and enhance state management

- Added WalletInfoSection component to display connected wallet address, network, and balance.
- Updated auth slice to manage primary wallet address derived from mnemonic.
- Enhanced SkillManager to pass wallet address as load parameters for wallet skill.
- Introduced utility function to derive EVM wallet address from mnemonic.
- Updated dependencies for cryptographic operations related to wallet functionality.

* fix: improve error handling and network selection in WalletInfoSection

- Enhanced the parsing of network data to ensure robustness against undefined values.
- Updated network selection logic to prioritize valid entries and provide a fallback.
- Improved error logging for better debugging of wallet information loading issues.
- Adjusted balance retrieval to handle cases where chain_id may be missing.

* feat: add socket event contract for Tauri integration

- Documented the socket event contract for communication between the backend and frontend in Tauri mode.
- Introduced constants for `REQUEST_ENCRYPTION_KEY` and `ENCRYPTION_KEY_EVENT` to facilitate encryption key management.
- Updated `setupTauriSocketListeners` to handle the encryption key request and response flow.

* Refactor wallet information fetching and connection status handling

- Updated `WalletInfoSection` to improve loading state management and error handling during wallet info retrieval.
- Introduced a retry mechanism for fetching wallet information with a maximum of 5 attempts.
- Enhanced connection status logic in `SkillsGrid` to treat missing authentication status as connected.
- Added a new method in `SkillManager` to set the wallet address and notify the wallet skill accordingly.

* feat: add integration token fetching and decryption functionality

- Introduced `fetchIntegrationTokens` API call to retrieve encrypted OAuth tokens for integrations.
- Implemented decryption logic for integration tokens using a provided key.
- Enhanced deep link handling to support fetching and storing integration tokens upon successful OAuth login.
- Added utility functions for hex and base64 conversions to facilitate token decryption.
- Updated `authApi.ts` and `desktopDeepLinkListener.ts` to integrate new functionality.

* refactor: move integration token encryption/decryption logic to a new utility file

- Extracted encryption and decryption functions for integration tokens into `integrationTokensCrypto.ts`.
- Removed redundant functions from `desktopDeepLinkListener.ts` to streamline the code.
- Updated deep link handling to store only the encrypted tokens instead of decrypted ones.
- Improved type definitions for integration tokens and their payloads.

* feat: enhance Gmail skill integration and state management

- Updated `SkillManager` to accept an optional access token for Gmail during OAuth completion.
- Introduced `gmailSlice` to manage Gmail user profile and emails in the Redux store.
- Implemented synchronization of Gmail skill state with the Redux store to keep user data updated.
- Refactored `SkillProvider` to handle Gmail state changes and fetch initial state from the backend.
- Adjusted deep link handling to pass decrypted access tokens for Gmail integration.
- Modified API endpoint for onboarding completion to remove the Telegram prefix.

* feat: implement Gmail metadata synchronization to backend

- Added a new utility function `syncGmailMetadataToBackend` to emit Gmail profile and email summaries to the backend via the `integration:metadata-sync` socket event.
- Updated `SkillProvider` to call the new synchronization function, ensuring Gmail skill state is sent to the backend when updated.

* refactor: update Tauri socket event handling and improve Mnemonic component typing

- Revised the Tauri socket event contract to clarify that encryption key handling is managed via the API instead of the socket.
- Removed outdated socket event constants related to encryption key requests from `tauriSocket.ts`.
- Enhanced type definitions in the `Mnemonic` component by specifying the event type for keyboard events.

* fix: update Gmail provider constant and adjust metadata synchronization logic

- Changed the constant for the Google provider from 'google' to 'gmail' for clarity.
- Commented out the email metadata synchronization logic in `syncGmailMetadataToBackend` to prevent potential issues with undefined email states.

* feat: implement Gmail metadata synchronization service

- Added a new file `metadataSync.ts` to handle the synchronization of Gmail profile and email summaries to the backend via the `integration:metadata-sync` socket event.
- Updated import paths in `SkillProvider` to reflect the new location of the Gmail metadata synchronization function.
- Enhanced type definitions for Gmail profile and email summaries to ensure proper data structure during synchronization.

* refactor: clean up code formatting and improve readability across multiple components

- Standardized import statements and formatting in various files, including `WalletInfoSection`, `AgentChatPanel`, and `SkillsPanel`.
- Enhanced readability by adjusting line breaks and spacing in JSX elements and function definitions.
- Improved consistency in the use of arrow functions and destructuring across components.
- Updated type definitions and ensured proper alignment of code for better maintainability.

* feat: enhance error handling in WalletInfoSection and improve user feedback

- Added error reporting functionality in `WalletInfoSection` to capture and enqueue errors when wallet info fails to load.
- Updated `Mnemonic` component to handle user state more robustly, ensuring encryption key is only set if the user is loaded.
- Refactored `TauriCommandsPanel` to improve string comparisons for loading states by converting to lowercase.
- Adjusted deep link handling in `desktopDeepLinkListener` to use trimmed hex values for encryption key conversion.

* fix: improve balance parsing and error handling in WalletInfoSection

- Updated balance parsing logic in `WalletInfoSection` to ensure that non-finite values default to zero.
- Enhanced error handling in `desktopDeepLinkListener` by adding error reporting for invalid encryption keys and conversion failures, improving user feedback and debugging capabilities.

* Merge remote-tracking branch 'upstream/develop' into feat/final-flow-check

* chore: update submodule URL for skills repository to use HTTPS

* chore: update skills submodule to latest commit and enhance SkillsGrid component

- Updated the skills submodule to the latest commit for improved functionality.
- Refactored `SkillsGrid` to better handle skill setup logic, ensuring accurate representation of skills with setup requirements.
- Cleaned up code formatting and improved readability in various components, including `SkillActionButton` and `desktopDeepLinkListener`.

* feat: implement Notion metadata synchronization and user profile management

- Added a new service `metadataSync.ts` to handle synchronization of Notion user metadata to the backend via the `integration:metadata-sync` socket event.
- Introduced a new Redux slice `notionSlice.ts` for managing the Notion user profile state.
- Updated `SkillProvider` to fetch and sync Notion user profile upon connection, ensuring seamless integration with the backend.
- Enhanced the store configuration to include the new Notion reducer.

* refactor: remove unnecessary console warnings in SkillProvider

- Eliminated console warnings related to Notion user retrieval errors and auto-loading skills, streamlining the logging process for better clarity and reducing noise in the console output.
- Improved code readability by cleaning up commented-out warning messages that were no longer needed.
2026-03-04 14:33:17 +05:30
M3gA-Mind 29133f7c91 refactor: remove unnecessary console warnings in SkillProvider
- Eliminated console warnings related to Notion user retrieval errors and auto-loading skills, streamlining the logging process for better clarity and reducing noise in the console output.
- Improved code readability by cleaning up commented-out warning messages that were no longer needed.
2026-03-04 04:22:13 +05:30
M3gA-Mind 7fe929414c Merge remote-tracking branch 'upstream/develop' into feat/final-flow-check 2026-03-04 02:19:57 +05:30
M3gA-Mind 3627dc1ef2 feat: implement Notion metadata synchronization and user profile management
- Added a new service `metadataSync.ts` to handle synchronization of Notion user metadata to the backend via the `integration:metadata-sync` socket event.
- Introduced a new Redux slice `notionSlice.ts` for managing the Notion user profile state.
- Updated `SkillProvider` to fetch and sync Notion user profile upon connection, ensuring seamless integration with the backend.
- Enhanced the store configuration to include the new Notion reducer.
2026-03-02 21:17:51 +05:30
6acdfef488 Implement hybrid local/API thread storage with message persistence (#154)
* feat: add .mcp.json for MCP server configuration

- Introduced `.mcp.json` with server details for managing MCP integrations
- Defines `readme` server with HTTP type and URL endpoint configuration

* fix: Update skills submodule with Telegram error handling improvements

- Fixed setup flow showing false success when TDLib errors occurred
- Improved async error handling in setup steps
- Added client reset mechanisms for error recovery
- Enhanced error messaging for better user experience
- Cleaned up excessive debug logging while maintaining error logs

Resolves issue where Telegram setup showed success modal despite underlying TDLib errors.

🤖 Generated with [Claude Code](https://claude.ai/code)

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

* Add daemon lifecycle management system to frontend UI

This implementation integrates the Rust daemon's health monitoring and lifecycle management into the React frontend. Key features include real-time health indicators, automatic start/error recovery, and detailed control panels, enhancing both user experience and operational reliability.

* Enhance daemon health monitoring with detailed logging, event tracking, and state management improvements.

* Add extensive logging for Tauri socket lifecycle and event listeners

This update improves troubleshooting and debugging by adding detailed logs throughout Tauri socket initialization, event listener setup, and error handling processes.

* Define global Tauri interface types in TypeScript

* Fix daemon service management and health communication issues

This comprehensive fix resolves two critical daemon-related issues:

1. **Launchctl "Input/output error" fix**:
   - Add intelligent state checking before service operations
   - Only load LaunchAgent if not already loaded
   - Treat "already running" as success, not failure
   - Add helper functions for cross-platform service state detection
   - Implement idempotent service start operations

2. **Daemon health communication fix**:
   - Add ALPHAHUMAN_DAEMON_INTERNAL environment variable to external service plist
   - Force external daemon to use file-based communication (daemon_state.json)
   - Implement file watching bridge in main app to emit Tauri events
   - Ensure frontend receives proper health updates from external daemon

**Key Changes**:
- Enhanced `start()` function with state checking across all platforms
- Added `is_service_loaded_macos()`, `is_service_enabled_linux()`, `is_task_exists_windows()`
- Modified macOS plist to include `ALPHAHUMAN_DAEMON_INTERNAL=false`
- Added `watch_daemon_health_file()` function for external daemon communication
- Updated daemon mode detection logic for cross-platform consistency
- Added comprehensive logging for service management operations

**Expected Results**:
- No more "Input/output error" when clicking daemon start button
- External daemon status shows "connected" instead of "disconnected"
- Idempotent service operations (safe to run multiple times)
- Single daemon process prevents resource conflicts
- Cross-platform daemon service reliability

🤖 Generated with [Claude Code](https://claude.ai/code)

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

* Add `ALPHAHUMAN_DAEMON_INTERNAL` env variable to configuration documentation

* Optimize imports in `TauriCommandsPanel.tsx` by removing unused variables and adding necessary hooks.

* Add OAuth login support with configurable provider types and UI components

This update introduces OAuth login functionality, including support for multiple providers (Google, GitHub, Twitter, Discord). Added reusable components for provider buttons and a login section, along with styled configurations and type definitions. Includes enhancements for token handling and updated login flows.

* Add OAuth debug mode support for development environments

Introduce `IS_DEV` checks to enable OAuth debug mode, allowing detailed logging and adjustable OAuth URLs with debug parameters during development.

* Implement hybrid local/API thread storage with message persistence

- Add local-first thread and message storage using Redux Persist
- Persist threads, messages, and UI state (panelWidth, lastViewedAt, selectedThreadId) locally
- Remove API dependencies for thread/message fetching (fetchThreads, fetchThreadMessages)
- Add local thread management actions (createThreadLocal, deleteThreadLocal, addMessageLocal)
- Fix message persistence issue: ensure both user and AI messages survive navigation
- Maintain API integration for sendMessage functionality with AI responses
- Preserve optimistic updates and error handling behavior
- Enable instant app startup and offline conversation viewing

Key changes:
- Enhanced threadSlice with messagesByThreadId storage and local management actions
- Updated Redux persist config to include thread data
- Modified Conversations component to use local thread operations
- Fixed addInferenceResponse to persist preceding user messages
- Maintained all existing UI patterns and error states

🤖 Generated with [Claude Code](https://claude.ai/code)

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-03-02 18:13:01 +03:00
M3gA-Mind fef36f963d chore: update skills submodule to latest commit and enhance SkillsGrid component
- Updated the skills submodule to the latest commit for improved functionality.
- Refactored `SkillsGrid` to better handle skill setup logic, ensuring accurate representation of skills with setup requirements.
- Cleaned up code formatting and improved readability in various components, including `SkillActionButton` and `desktopDeepLinkListener`.
2026-03-02 20:13:05 +05:30
cyrusandClaude 70d9ff128d Implement hybrid local/API thread storage with message persistence
- Add local-first thread and message storage using Redux Persist
- Persist threads, messages, and UI state (panelWidth, lastViewedAt, selectedThreadId) locally
- Remove API dependencies for thread/message fetching (fetchThreads, fetchThreadMessages)
- Add local thread management actions (createThreadLocal, deleteThreadLocal, addMessageLocal)
- Fix message persistence issue: ensure both user and AI messages survive navigation
- Maintain API integration for sendMessage functionality with AI responses
- Preserve optimistic updates and error handling behavior
- Enable instant app startup and offline conversation viewing

Key changes:
- Enhanced threadSlice with messagesByThreadId storage and local management actions
- Updated Redux persist config to include thread data
- Modified Conversations component to use local thread operations
- Fixed addInferenceResponse to persist preceding user messages
- Maintained all existing UI patterns and error states

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-03-02 16:20:15 +05:30
cyrus 5cd8193cd6 Merge remote-tracking branch 'upstream/develop' into develop 2026-03-02 15:31:24 +05:30
M3gA-Mind 66b67c8482 chore: update submodule URL for skills repository to use HTTPS 2026-03-02 14:33:40 +05:30
M3gA-Mind 842f099c3c Merge remote-tracking branch 'upstream/develop' into feat/final-flow-check 2026-03-02 13:58:14 +05:30
2c64761b21 Oauth logins added (#153)
* feat: add .mcp.json for MCP server configuration

- Introduced `.mcp.json` with server details for managing MCP integrations
- Defines `readme` server with HTTP type and URL endpoint configuration

* fix: Update skills submodule with Telegram error handling improvements

- Fixed setup flow showing false success when TDLib errors occurred
- Improved async error handling in setup steps
- Added client reset mechanisms for error recovery
- Enhanced error messaging for better user experience
- Cleaned up excessive debug logging while maintaining error logs

Resolves issue where Telegram setup showed success modal despite underlying TDLib errors.

🤖 Generated with [Claude Code](https://claude.ai/code)

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

* Add daemon lifecycle management system to frontend UI

This implementation integrates the Rust daemon's health monitoring and lifecycle management into the React frontend. Key features include real-time health indicators, automatic start/error recovery, and detailed control panels, enhancing both user experience and operational reliability.

* Enhance daemon health monitoring with detailed logging, event tracking, and state management improvements.

* Add extensive logging for Tauri socket lifecycle and event listeners

This update improves troubleshooting and debugging by adding detailed logs throughout Tauri socket initialization, event listener setup, and error handling processes.

* Define global Tauri interface types in TypeScript

* Fix daemon service management and health communication issues

This comprehensive fix resolves two critical daemon-related issues:

1. **Launchctl "Input/output error" fix**:
   - Add intelligent state checking before service operations
   - Only load LaunchAgent if not already loaded
   - Treat "already running" as success, not failure
   - Add helper functions for cross-platform service state detection
   - Implement idempotent service start operations

2. **Daemon health communication fix**:
   - Add ALPHAHUMAN_DAEMON_INTERNAL environment variable to external service plist
   - Force external daemon to use file-based communication (daemon_state.json)
   - Implement file watching bridge in main app to emit Tauri events
   - Ensure frontend receives proper health updates from external daemon

**Key Changes**:
- Enhanced `start()` function with state checking across all platforms
- Added `is_service_loaded_macos()`, `is_service_enabled_linux()`, `is_task_exists_windows()`
- Modified macOS plist to include `ALPHAHUMAN_DAEMON_INTERNAL=false`
- Added `watch_daemon_health_file()` function for external daemon communication
- Updated daemon mode detection logic for cross-platform consistency
- Added comprehensive logging for service management operations

**Expected Results**:
- No more "Input/output error" when clicking daemon start button
- External daemon status shows "connected" instead of "disconnected"
- Idempotent service operations (safe to run multiple times)
- Single daemon process prevents resource conflicts
- Cross-platform daemon service reliability

🤖 Generated with [Claude Code](https://claude.ai/code)

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

* Add `ALPHAHUMAN_DAEMON_INTERNAL` env variable to configuration documentation

* Optimize imports in `TauriCommandsPanel.tsx` by removing unused variables and adding necessary hooks.

* Add OAuth login support with configurable provider types and UI components

This update introduces OAuth login functionality, including support for multiple providers (Google, GitHub, Twitter, Discord). Added reusable components for provider buttons and a login section, along with styled configurations and type definitions. Includes enhancements for token handling and updated login flows.

* Add OAuth debug mode support for development environments

Introduce `IS_DEV` checks to enable OAuth debug mode, allowing detailed logging and adjustable OAuth URLs with debug parameters during development.

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-02-28 10:55:19 +03:00
cyrus 09a6d332d6 Add OAuth debug mode support for development environments
Introduce `IS_DEV` checks to enable OAuth debug mode, allowing detailed logging and adjustable OAuth URLs with debug parameters during development.
2026-02-27 22:16:06 +05:30
cyrus 1ee2f653ec Add OAuth login support with configurable provider types and UI components
This update introduces OAuth login functionality, including support for multiple providers (Google, GitHub, Twitter, Discord). Added reusable components for provider buttons and a login section, along with styled configurations and type definitions. Includes enhancements for token handling and updated login flows.
2026-02-27 20:01:47 +05:30
cyrus 6a1fe574b2 Merge remote-tracking branch 'origin/feat/daemon-setup' into develop
# Conflicts:
#	src/components/settings/panels/TauriCommandsPanel.tsx
2026-02-27 17:57:17 +05:30
cyrus 6d5613a2de Optimize imports in TauriCommandsPanel.tsx by removing unused variables and adding necessary hooks. 2026-02-27 13:25:44 +05:30
cyrus 2e30b4587f Merge remote-tracking branch 'upstream/develop' into develop 2026-02-27 13:18:14 +05:30
fb4a88867a feat: self evolving skills (#150)
* feat(skills): extend GenerateSkillSpec with full_index_js and update generator

- Add optional `full_index_js` field to GenerateSkillSpec so LLM-generated
  JS source can be written verbatim instead of using the default template
- Change generate_alphahuman() return type from PathBuf to Vec<PathBuf>
  (returns both manifest.json and index.js paths for audit logging)
- Add UnifiedSkillRegistry::skills_dir() and engine() helper accessors
  needed by the self-evolve orchestrator

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* feat(skills): add isolated QuickJS skill tester with mock bridge globals

Introduces SkillTester::run_isolated() which spins up a fresh rquickjs
context (no shared state), injects no-op mock globals for all bridge APIs
(db, net, state, platform, cron, skills), loads index.js, and calls
init/start plus each tool's execute() with empty args.

The test passes only if every exported tool returns without throwing and
produces valid output. Used by the self-evolve loop to validate generated
code before registering it into the live registry.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* feat(skills): add LLM code generator using Anthropic Claude API

Introduces LlmGenerator with two methods:
- generate_spec(task): first-pass generation from a natural-language task
  description; produces a complete GenerateSkillSpec including full_index_js
- fix_spec(task, prev_code, error): retry pass that feeds the previous
  code and the test error back to the model for correction

Uses claude-3-5-haiku-20241022 via direct reqwest POST to the Anthropic
messages API. System prompt teaches the model the exact QuickJS index.js
format, available bridge globals, and synchronous net.fetch semantics.
Strips markdown code fences from the response before use.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* feat(skills): add self-evolve orchestrator with iteration loop and audit log

Introduces SkillEvolver::evolve() which implements the full pipeline:
  1. LLM generates a GenerateSkillSpec from a task description
  2. generator::generate_alphahuman() writes manifest.json + index.js
  3. SkillTester::run_isolated() validates the code in a fresh sandbox
  4. On failure: feed error back to LLM and regenerate (up to max_iterations)
  5. On success: discover_skills() + start_skill() to register live, then
     execute() to run the real task and capture final output
  6. Returns SelfEvolveResult with full audit log, files_created, and
     the final UnifiedSkillResult

Wraps the entire evolve() call in tokio::time::timeout (default 120s).
Cleans up written skill directory on permanent failure so no partial
skill is left registered.

Key types:
  SelfEvolveRequest  — task_description, max_iterations, timeout_secs,
                       optional anthropic_api_key override
  SelfEvolveResult   — skill_id, success, iterations_used, audit_log,
                       files_created, final_result, failure_reason
  IterationLog       — per-iteration code, test output, pass/fail flag

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* feat(tauri): register unified_self_evolve_skill command with progress events

Adds unified_self_evolve_skill Tauri command that:
- Accepts a SelfEvolveRequest (task_description + optional limits)
- Emits skill:evolve:progress event after each iteration so the frontend
  can show live progress without polling
- Delegates to SkillEvolver::evolve() and returns SelfEvolveResult
- Mobile stub returns an informative error (feature requires desktop runtime)

Registers the command in generate_handler![] in lib.rs.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* feat(ui): add SelfEvolveModal and Auto-Generate button to SkillsGrid

SelfEvolveModal (src/components/skills/SelfEvolveModal.tsx):
- createPortal modal with 4 states: idle / running / success / failed
- Text input for natural-language task description
- Calls unified_self_evolve_skill via invoke() on submit
- Subscribes to skill:evolve:progress Tauri events to show live iteration
  updates (iteration number, pass/fail indicator)
- On success: displays audit log accordion with per-iteration code,
  test output, and final task result
- On failure: shows failure reason and full audit trail for debugging
- Calls onSkillCreated() callback to trigger grid refresh

SkillsGrid changes:
- Add selfEvolveOpen state + "Auto-Generate" button in the toolbar
- Extract refreshSkills as a named async function reused by both the
  initial load and the SelfEvolveModal's onSkillCreated callback
- Add activeSkillType state so SkillSetupModal shows the correct badge
  when opened from either the Connect or Manage flow

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(skills): fix alphahuman skill template and generation pipeline

- generator.rs: use bare `tools = []` (not const) for globalThis access,
  add `execute: async function(args)` method, fix `input_schema` casing
- mod.rs: call start_skill() after generate() so skills are immediately executable
- llm_generator.rs: update model to claude-haiku-4-5-20251001, sync system prompt

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(skills): fix tools not loading for generated skills and add robustness fixes

- llm_generator: require 'var tools = [...]' in system prompt (const/let are
  block-scoped and do not attach to globalThis, causing extract_tools() to find
  an empty array in the production QuickJS engine)
- llm_generator: add smart_name() — deterministic display name from task
  description (strips preambles + lead fillers + stop words, title-cases 3
  tokens); replaces brittle LLM-dependent naming
- llm_generator: improve sandbox testing rules in system prompt so placeholder
  values prevent test failures when net.fetch returns empty JSON
- skill_tester: detect {error: '...'} return values as test failures (both sync
  and Promise paths) so the iteration loop attempts a fix instead of treating
  them as success
- manager.ts: dispatch setSkillSetupComplete(true) for skills without a setup
  flow so deriveConnectionStatus() returns "connected" instead of "connecting"

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-26 19:58:42 +04:00