Skip to content

feat: add xAI Grok integration with its current features#29

Open
wubin1989 wants to merge 10 commits intomainfrom
upstream-open-pr-307
Open

feat: add xAI Grok integration with its current features#29
wubin1989 wants to merge 10 commits intomainfrom
upstream-open-pr-307

Conversation

@wubin1989
Copy link
Copy Markdown
Owner

Migrated open PR from upstream for local review.

Upstream: opencode-ai#307
Upstream head: askiiRobotics:main @ cebdf6a

Alex Belets and others added 10 commits July 11, 2025 17:26
  - Complete xAI provider with 8 Grok models (2/3/4 series)
  - Deferred completion support for long-running requests
  - Concurrent request handling for improved performance
  - Web search tool integration for real-time information
  - Image generation and vision capabilities
  - Advanced reasoning support with model-specific validation

  Core provider features:
  - Full streaming support with proper error handling
  - Intelligent model selection and configuration
  - Robust caching and retry mechanisms
  - Provider-specific option handling (reasoning, deferred, concurrent)
  - Comprehensive test coverage for all capabilities

  Configuration enhancements:
  - Runtime options support via CLI flags (--deferred, --deferred-timeout)
  - Provider-level deferred completion configuration
  - Auto-enable rules for smart feature activation
  - Model-specific reasoning effort validation (xAI: low/high only)
  - Enhanced agent configuration with override capabilities

  Tool ecosystem expansion:
  - Web search tool for real-time information retrieval
  - Enhanced coder agent toolset with web capabilities
  - Improved tool validation and error handling
  - Better integration with existing LSP and file tools

  Documentation and schema updates:
  - Comprehensive README updates with xAI model details
  - Updated configuration schema with new provider options
  - Enhanced CLI help text and examples
  - Added feature capability documentation
.claude/settings.local.json - deleted
- Fix EventThinkingDelta to use event.Thinking field instead of event.Content
- Add ReasoningContent field to ProviderResponse for XAI reasoning models
- Fix tool schema double-wrapping issue causing "Invalid function schema" errors
- Add reasoning_effort validation: convert "medium" to "high" for Grok-3-mini models
- Add XAIHTTPClient for proper request handling with reasoning support
- Add ReasoningHandler to process reasoning content and emit thinking deltas
- Fix ls tool to handle uninitialized config in test environments
- Fix message rendering to properly display reasoning content
- Add content truncation for very long messages to prevent UI issues
- Fix platform-specific help key bindings (macOS vs Linux)
  - Updated ShouldUseReasoning() to properly handle Grok 4's automatic reasoning
- Grok 4 now uses the reasoning handler path without requiring reasoning_effort parameter
- This ensures proper tool schema handling for Grok 4 models
  - Implement FilterToolsByProvider to restrict tools based on provider
  capabilities
  - Add Providers field to ToolInfo struct for specifying tool availability
  - Integrate filtering across all provider clients (OpenAI, Gemini, xAI,
  Copilot)
  - Add comprehensive tests for tool filtering logic with case-insensitive
  matching
  - Update web search tool to be xAI-only as it requires live search
  capabilities
  - Clarify Grok 4 reasoning behavior in docs and comments (internal
  reasoning only)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants