Files
openhuman/.env.example
T
8aa5547af4 feat: Telegram managed login, channel messaging, and inbound agent loop (#338)
* feat: add managed Telegram login flow and API endpoints

- Introduced a new managed Telegram login flow, allowing users to link their Telegram accounts via a deep link.
- Added `telegram_login_start` and `telegram_login_check` functions to handle the creation of link tokens and status checks for user linking.
- Updated the API with new endpoints for managing Telegram login, including detailed response structures for link token creation and status verification.
- Enhanced the `.env.example` file to include a configuration option for the Telegram bot username, facilitating easier setup for developers.

* refactor: update Telegram integration to use core RPC for login flow

- Replaced the managed DM API with core RPC calls for initiating and checking Telegram login status.
- Introduced new API methods `telegramLoginStart` and `telegramLoginCheck` to handle link token creation and verification.
- Updated the TelegramConfig and MessagingPanel components to utilize the new login flow, enhancing the user experience and simplifying the codebase.
- Adjusted tests to reflect changes in the login process and ensure proper functionality.

* docs: update TODO list with new user interaction registration task for memory skill

* feat: add ChannelSetupModal for configuring channel integrations

- Introduced a new reusable modal component, ChannelSetupModal, for configuring channel integrations such as Telegram and Discord.
- The modal can be opened from the Skills page or Settings, enhancing user experience by providing a centralized configuration interface.
- Updated MessagingPanel and Skills components to integrate the new modal, allowing users to easily manage their channel settings.
- Implemented channel-specific configuration components for better modularity and maintainability.

* feat: add ChannelSetupModal for configuring channel integrations

- Introduced a new reusable modal component, ChannelSetupModal, for configuring channel integrations such as Telegram and Discord.
- The modal can be opened from the Skills page or Settings, enhancing user experience by providing a centralized configuration interface.
- Updated MessagingPanel and Skills components to integrate the new modal, allowing users to easily manage their channel settings.
- Implemented channel-specific configuration components for better modularity and maintainability.

* style: update channel components for improved UI consistency

- Refactored styles across various channel configuration components, including ChannelCapabilities, ChannelConfigPanel, ChannelFieldInput, ChannelSelector, DiscordConfig, TelegramConfig, and WebChannelConfig.
- Enhanced color schemes and layout for better readability and visual appeal, ensuring a cohesive design across the application.
- Updated status badge styles in definitions.ts to align with the new design standards.
- Improved error message visibility and loading indicators in Channels page for a more user-friendly experience.

* refactor: update WebChannelConfig and tests for improved clarity and functionality

- Renamed the `definition` prop in WebChannelConfig to `_definition` for clarity.
- Updated test cases in DiscordConfig and TelegramConfig to reflect changes in auth mode labels, ensuring accurate rendering of UI elements.
- Adjusted the TelegramConfig test to fix the click event on the connect button, enhancing test reliability.
- Modified channel definitions to streamline the managed DM auth mode, improving code organization and maintainability.

* fix: enhance WebGL error handling in MeshGradient and RotatingTetrahedronCanvas components

- Added error handling in the MeshGradient component to gracefully catch WebGL initialization failures, ensuring the app remains functional when the GPU context is unavailable.
- Updated the RotatingTetrahedronCanvas component to verify WebGL context availability before initializing the renderer, preventing crashes and improving user experience.
- Modified channel definitions to update auth mode labels for clarity and consistency across the application.

* style: update RotatingTetrahedronCanvas colors and animation speed

- Changed fill and edge colors in the RotatingTetrahedronCanvas component for improved visual appeal.
- Adjusted opacity of the fill material to enhance transparency effects.
- Introduced a speed multiplier for rotation animations, allowing for more dynamic visual effects.

* refactor: improve WebGL error handling and cleanup in MeshGradient component

- Removed unused canvas reference and WebGL context probing to streamline the MeshGradient component.
- Enhanced error handling during shader compilation to throw an error when WebGL context may be lost, improving robustness.
- Wrapped initialization logic in a try-catch block to gracefully handle failures, ensuring the gradient functionality is disabled if initialization fails.

* refactor: simplify Telegram login flow by removing unused link token check

- Removed the `check_channel_link_status` method from the `BackendOAuthClient`, streamlining the authentication process.
- Updated `telegram_login_check` to directly fetch the user profile and determine link status based on the presence of `telegramId`, enhancing clarity and reducing complexity.
- Adjusted logging to reflect the new flow and ensure accurate debugging information.

* feat: enhance JSON-RPC method invocation with session expiration handling

- Added logic to automatically clear stored session on receiving a 401 error from the backend, improving user experience by ensuring users are redirected to the login page when their session expires.
- Introduced a helper function to identify session expiration errors, enhancing code clarity and maintainability.
- Refactored the `invoke_method` function to incorporate this new error handling mechanism, ensuring robust session management during RPC calls.

* style: update app-dotted-canvas background gradient for improved visibility

- Changed the radial gradient background color in the app-dotted-canvas from rgba(0, 0, 0, 0.2) to rgba(0, 0, 0, 0.5), enhancing the contrast and overall visual appeal of the component.

* feat: implement channel messaging API with end-to-end testing script

- Added a new script `test-channel-messaging.sh` for end-to-end testing of message sending to Telegram via the backend API.
- Implemented new backend API methods for sending messages, reactions, creating threads, updating threads, and listing threads in channels.
- Enhanced the `BackendOAuthClient` with methods to handle channel messaging operations.
- Updated controller schemas and handlers to support the new messaging functionalities, ensuring robust interaction with the backend.
- Improved logging for better debugging and tracking of channel operations.

* feat: add test-channel-receive script for real-time channel message listening

- Introduced a new script `test-channel-receive.mjs` that connects to the backend Socket.IO server and listens for incoming channel messages.
- Implemented session token retrieval and validation against the backend, ensuring secure message handling.
- Added options for debugging and sending test messages, enhancing the script's usability for testing purposes.
- Improved logging for better visibility of connection status and incoming messages.

* feat: implement inbound channel message handling for real-time responses

- Added functionality to handle inbound messages from channels (e.g., Telegram, Discord) by introducing the `handle_channel_inbound_message` function.
- Implemented agent inference loop to process messages and send replies back to the originating channel via the REST API.
- Enhanced logging for better tracking of message reception and response handling.
- Integrated timeout handling to manage long-running requests effectively.

* style: fix prettier formatting for channel components

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-05 22:08:17 -07:00

167 lines
7.0 KiB
Bash

# Root environment variables — Rust core, Tauri shell, and shared settings.
# Copy to .env and fill in values as needed.
# Loaded via: source scripts/load-dotenv.sh
#
# Tags: [required] must be set, [optional] has a sensible default or can be blank
# ---------------------------------------------------------------------------
# Backend API
# ---------------------------------------------------------------------------
# [required] Primary backend URL (read by Rust core and QuickJS skills sandbox)
BACKEND_URL=https://staging-api.alphahuman.xyz
# [required] Also read by Vite frontend (VITE_ prefix required for browser exposure)
VITE_BACKEND_URL=https://staging-api.alphahuman.xyz
# ---------------------------------------------------------------------------
# Authentication (for skills OAuth proxy and debug scripts)
# ---------------------------------------------------------------------------
# [optional] Session JWT — used by QuickJS skills sandbox for oauth.fetch proxy calls.
# Also used by debug scripts (scripts/debug-skill.sh, scripts/debug-notion-live.sh).
# Get from login flow or browser devtools.
JWT_TOKEN=
# ---------------------------------------------------------------------------
# Core process
# ---------------------------------------------------------------------------
# [optional] Default: 127.0.0.1 (use 0.0.0.0 for Docker / cloud).
# Leave unset to keep the default; the Docker image sets 0.0.0.0 automatically.
# OPENHUMAN_CORE_HOST=
# [optional] Default: 7788
OPENHUMAN_CORE_PORT=7788
# [optional] Default: http://127.0.0.1:7788/rpc
OPENHUMAN_CORE_RPC_URL=http://127.0.0.1:7788/rpc
# [optional] Run mode: child (default, spawns sidecar) | inprocess
OPENHUMAN_CORE_RUN_MODE=child
# [optional] Override path to openhuman core binary (leave blank for auto-detection)
OPENHUMAN_CORE_BIN=
# ---------------------------------------------------------------------------
# Config overrides (override config.toml values at runtime)
# ---------------------------------------------------------------------------
# [required] API key for the LLM provider
OPENHUMAN_API_KEY=
# [optional] Default model to use
OPENHUMAN_MODEL=
# [optional] Workspace directory (default: ~/.openhuman)
OPENHUMAN_WORKSPACE=
# [optional] Default: 0.7
OPENHUMAN_TEMPERATURE=0.7
# [optional] Skill + agent tool execution timeout in seconds (default 120, max 3600)
# OPENHUMAN_TOOL_TIMEOUT_SECS=
# ---------------------------------------------------------------------------
# Runtime flags
# ---------------------------------------------------------------------------
# [optional] Default: 0
OPENHUMAN_BROWSER_ALLOW_ALL=0
# [optional] Default: 0
OPENHUMAN_LOG_PROMPTS=0
# [optional] Enable reasoning mode
OPENHUMAN_REASONING_ENABLED=
# ---------------------------------------------------------------------------
# Web search
# ---------------------------------------------------------------------------
# [optional] Default: false
OPENHUMAN_WEB_SEARCH_ENABLED=false
# [optional] Search provider name
OPENHUMAN_WEB_SEARCH_PROVIDER=
# [optional] Required if web search provider is Brave
OPENHUMAN_BRAVE_API_KEY=
# [optional] Default: 5
OPENHUMAN_WEB_SEARCH_MAX_RESULTS=5
# [optional] Default: 10
OPENHUMAN_WEB_SEARCH_TIMEOUT_SECS=10
# ---------------------------------------------------------------------------
# Storage
# ---------------------------------------------------------------------------
# [optional] Storage backend (default: SQLite)
OPENHUMAN_STORAGE_PROVIDER=
# [optional] Database connection URL
OPENHUMAN_STORAGE_DB_URL=
# [optional] Connection timeout in seconds
OPENHUMAN_STORAGE_CONNECT_TIMEOUT_SECS=
# ---------------------------------------------------------------------------
# Proxy
# ---------------------------------------------------------------------------
# [optional] Default: false
OPENHUMAN_PROXY_ENABLED=false
# [optional] HTTP proxy URL
OPENHUMAN_HTTP_PROXY=
# [optional] HTTPS proxy URL
OPENHUMAN_HTTPS_PROXY=
# [optional] Catch-all proxy URL
OPENHUMAN_ALL_PROXY=
# [optional] Comma-separated hosts to bypass proxy
OPENHUMAN_NO_PROXY=
# [optional] Proxy scope
OPENHUMAN_PROXY_SCOPE=
# [optional] Comma-separated services to proxy
OPENHUMAN_PROXY_SERVICES=
# ---------------------------------------------------------------------------
# Local AI model tier
# ---------------------------------------------------------------------------
# [optional] Override selected model tier: low, medium, high
# Applies the corresponding preset at config load time (overrides config.toml).
OPENHUMAN_LOCAL_AI_TIER=
# ---------------------------------------------------------------------------
# Local AI binary overrides
# ---------------------------------------------------------------------------
# [optional] Override path to whisper binary
WHISPER_BIN=
# [optional] Override path to piper binary
PIPER_BIN=
# [optional] Override path to ollama binary
OLLAMA_BIN=
# ---------------------------------------------------------------------------
# Telegram managed login
# ---------------------------------------------------------------------------
# [optional] Bot username for managed Telegram DM linking (default: openhuman_bot)
OPENHUMAN_TELEGRAM_BOT_USERNAME=openhuman_bot
# ---------------------------------------------------------------------------
# Skills
# ---------------------------------------------------------------------------
# [optional] Override skills registry URL.
# Supports remote HTTP URLs and local file paths for development:
# SKILLS_REGISTRY_URL=https://example.com/registry.json (remote)
# SKILLS_REGISTRY_URL=/path/to/openhuman-skills/skills/registry.json (local)
# When set to a local path, the registry is read directly from disk on every
# call (no caching), so changes are picked up immediately.
SKILLS_REGISTRY_URL=
# [optional] Local skills source directory for development.
# Points to the built skills directory (the folder containing per-skill subdirs
# with manifest.json + index.js). When set, this takes highest priority for
# skill discovery and install will copy from this directory instead of downloading.
# Example: SKILLS_LOCAL_DIR=/Users/you/work/openhuman-skills/skills
SKILLS_LOCAL_DIR=
# ---------------------------------------------------------------------------
# Error Reporting (Sentry)
# ---------------------------------------------------------------------------
# [optional] Sentry DSN for Rust core error reporting (no PII is sent)
OPENHUMAN_SENTRY_DSN=
# [optional] Default: true — set to false to disable anonymized analytics & crash reports
OPENHUMAN_ANALYTICS_ENABLED=true
# ---------------------------------------------------------------------------
# Logging
# ---------------------------------------------------------------------------
# [optional] Default: info
RUST_LOG=info
# [optional] Default: 0 (set to 1 for full backtraces)
RUST_BACKTRACE=1
# ---------------------------------------------------------------------------
# Testing (do not set in production)
# ---------------------------------------------------------------------------
# [optional] Enable mock service mode
# OPENHUMAN_SERVICE_MOCK=0
# [optional] Path to mock state file
# OPENHUMAN_SERVICE_MOCK_STATE_FILE=