Commit Graph

180 Commits

  • feat: add OpenClaw CLI command and install flow (#25)
    Co-authored-by: chatgpt-codex-connector[bot] <199175422+chatgpt-codex-connector[bot]@users.noreply.github.com>
  • feat: add uv mirror detection and python bootstrap (#24)
    Co-authored-by: chatgpt-codex-connector[bot] <199175422+chatgpt-codex-connector[bot]@users.noreply.github.com>
  • chore(lint): remove ESLint configuration file and update lint scripts
    - Deleted the .eslintrc.cjs file to simplify configuration management.
    - Updated lint scripts in package.json to remove unnecessary extensions for linting.
    - Added new devDependencies for ESLint and globals to enhance linting capabilities.
  • fix(auth): register models.providers for OpenRouter and other providers
    OpenClaw's model resolution checks cfg.models.providers[provider] for
    baseUrl and API type. Without this config entry, any model for that
    provider returns "Unknown model" even if the API key is correct.
    
    - Reverted model names back to user-specified versions
    - Added PROVIDER_CONFIGS with baseUrl, api type, and env var name
    - setOpenClawDefaultModel() now writes models.providers.openrouter
      (and other providers) to openclaw.json so model resolution works
    - Config format: { models: { providers: { openrouter: {
        baseUrl: "https://openrouter.ai/api/v1",
        api: "openai-completions",
        apiKey: "OPENROUTER_API_KEY" } } } }
  • fix(app): scope header overrides to gateway URLs only
    - The session.webRequest.onHeadersReceived was stripping X-Frame-Options
      and modifying CSP for ALL responses including the Vite dev server,
      which could break the main app rendering. Now only applies to
      gateway URLs (127.0.0.1:18789 / localhost:18789).
    - Dashboard: only fetch channels/skills when gateway is running
    - Dashboard: guard against non-array channels/skills data
    - Gateway store: use dynamic import() instead of require() for chat
      store to avoid ESM/CJS issues in Vite
  • fix(auth): use correct model config format (object, not string)
    OpenClaw expects agents.defaults.model as { primary: "provider/model" }
    not a plain string. The previous code wrote a string which caused:
    "agents.defaults.model: Invalid input: expected object, received string"
  • fix(auth): configure OpenClaw default model when saving provider
    - Add setOpenClawDefaultModel() to write the correct model to
      ~/.openclaw/openclaw.json based on the selected provider
    - Maps: openrouter -> openrouter/anthropic/claude-sonnet-4,
      anthropic -> anthropic/claude-sonnet-4, etc.
    - Call setOpenClawDefaultModel on provider:save IPC handler
    - Fixes "No API key found for provider anthropic" when user
      configured OpenRouter (wrong default model was being used)
  • feat(chat): write API keys to OpenClaw and embed Control UI for chat
    Part 1: API Key Integration
    - Create electron/utils/openclaw-auth.ts to write keys to
      ~/.openclaw/agents/main/agent/auth-profiles.json
    - Update provider:save and provider:setApiKey IPC handlers to
      persist keys to OpenClaw auth-profiles alongside ClawX storage
    - Save API key to OpenClaw on successful validation in Setup wizard
    - Pass provider API keys as environment variables when starting
      the Gateway process (ANTHROPIC_API_KEY, OPENROUTER_API_KEY, etc.)
    
    Part 2: Embed OpenClaw Control UI for Chat
    - Replace custom Chat UI with <webview> embedding the Gateway's
      built-in Control UI at http://127.0.0.1:{port}/?token={token}
    - Add gateway:getControlUiUrl IPC handler to provide tokenized URL
    - Enable webviewTag in Electron BrowserWindow preferences
    - Override X-Frame-Options/CSP headers to allow webview embedding
    - Suppress noisy control-ui token_mismatch stderr messages
    - Add loading/error states for the embedded webview
    
    This fixes the "No API key found for provider" error and replaces
    the buggy custom chat implementation with OpenClaw's battle-tested
    Control UI.
  • fix(stores): align RPC methods with OpenClaw protocol and fix chat flow
    - Fix channels store: use channels.status instead of channels.list
    - Fix skills store: use skills.status instead of skills.list
    - Fix chat store: correct chat.history response parsing (messages in payload)
    - Fix chat store: handle chat.send async flow (ack + event streaming)
    - Add chat event handling for streaming AI responses (delta/final/error)
    - Wire gateway:chat-message IPC events to chat store
    - Fix health check: use WebSocket status instead of nonexistent /health endpoint
    - Fix waitForReady: probe via WebSocket instead of HTTP
    - Gracefully degrade when methods are unsupported (no white screen)
  • fix(gateway): implement proper OpenClaw WebSocket handshake protocol
    - Send JSON-RPC connect request after WebSocket opens (required by OpenClaw Gateway)
    - Use OpenClaw protocol format: { type: "req" } instead of { jsonrpc: "2.0" }
    - Include proper ConnectParams: client info, auth token, protocol version
    - Handle OpenClaw response format: { type: "res", ok: true/false }
    - Handle OpenClaw event format: { type: "event", event: "..." }
    - Wait for handshake completion before marking connection as running
    - Improve error handling for connection failures
    
    The Gateway was rejecting connections because:
    1. ClawX wasn't sending the required "connect" handshake message
    2. The protocol format was incorrect (standard JSON-RPC vs OpenClaw format)
  • feat(providers): implement real API key validation with OpenRouter support
    - Replace mock API key validation with actual API calls to verify keys
    - Add validateApiKeyWithProvider() with provider-specific implementations
    - Support Anthropic, OpenAI, Google, and OpenRouter validation
    - Add OpenRouter as a new provider option in setup wizard and settings
    - Fix setup page to call real validation instead of mock length check
    - Allow validation during setup before provider is saved
    - Return user-friendly error messages instead of raw API errors
  • fix(gateway): use GitHub URL for OpenClaw submodule and add token auth
    - Change submodule URL from local path to https://github.com/openclaw/openclaw.git
    - Checkout stable version v2026.2.3
    - Add auto-generated gateway token (clawx-xxx) stored in electron-store
    - Pass token via --token argument and OPENCLAW_GATEWAY_TOKEN env var
    - Include token in WebSocket URL for authentication
    - Add --dev and --allow-unconfigured flags for first-time setup
  • feat(gateway): integrate OpenClaw as git submodule
    - Add OpenClaw as git submodule at ./openclaw/
    - Update GatewayManager to start gateway from submodule path
    - Support both production (dist) and development (pnpm dev) modes
    - Add IPC handler for OpenClaw status check
    - Update Setup wizard to check real OpenClaw submodule status
    - Configure electron-builder to include submodule in packaged app
    - Add npm scripts for submodule management:
      - postinstall: auto-init submodule
      - openclaw:init: initialize and install dependencies
      - openclaw:install: install dependencies only
      - openclaw:build: build OpenClaw
      - openclaw:update: update to latest version
  • feat(update): implement auto-update functionality with electron-updater
    - Add AppUpdater module with update lifecycle management
    - Create UpdateSettings UI component with progress display
    - Add Progress UI component based on Radix UI
    - Create update Zustand store for state management
    - Register update IPC handlers in main process
    - Auto-check for updates on production startup
    - Add commit documentation for commits 2-6
  • feat(channels): implement channel connection flows with multi-platform support
    - Add comprehensive Channels page with connection statistics and status display
    - Implement AddChannelDialog with type-specific connection flows:
      - QR code-based connection for WhatsApp/WeChat
      - Token-based connection for Telegram/Discord/Slack
    - Enhance channels store with addChannel, deleteChannel, and requestQrCode actions
    - Update electron-store usage to dynamic imports for ESM compatibility
    - Add channel connection instructions and documentation links
  • feat(providers): implement secure API key storage and provider management
    Add complete provider configuration system with the following features:
    
    - Secure API key storage using Electron's safeStorage encryption
    - Provider CRUD operations with IPC handlers
    - Lazy-loaded electron-store for ESM compatibility
    - Provider settings UI component with add/edit/delete functionality
    - API key masking for display (shows first/last 4 chars)
    - Basic API key format validation per provider type
    - Default provider selection
    - Provider enable/disable toggle
    
    New files:
    - electron/utils/secure-storage.ts: Encrypted key storage and provider config
    - src/stores/providers.ts: Zustand store for provider state
    - src/components/settings/ProvidersSettings.tsx: Provider management UI
  • feat(gateway): enhance gateway process management with auto-reconnection
    Improve Gateway lifecycle management with the following features:
    
    - Add exponential backoff reconnection (1s-30s delay, max 10 attempts)
    - Add health check monitoring every 30 seconds
    - Add proper restart method with graceful shutdown
    - Handle server-initiated notifications (channel status, chat messages)
    - Add 'reconnecting' state for better UI feedback
    - Enhance IPC handlers with isConnected and health check endpoints
    - Update preload script with new event channels
    - Improve type safety and error handling throughout
    
    Also fixes several TypeScript errors and unused variable warnings.
  • feat(core): initialize project skeleton with Electron + React + TypeScript
    Set up the complete project foundation for ClawX, a graphical AI assistant:
    
    - Electron main process with IPC handlers, menu, tray, and gateway management
    - React renderer with routing, layout components, and page scaffolding
    - Zustand state management for gateway, settings, channels, skills, chat, and cron
    - shadcn/ui components with Tailwind CSS and CSS variable theming
    - Build tooling with Vite, electron-builder, and TypeScript configuration
    - Testing setup with Vitest and Playwright
    - Development configurations (ESLint, Prettier, gitignore, env example)