feat(ai): add Grok CLI as a Desktop no-API-key provider
* feat(ai): add Grok CLI as a Desktop no-API-key provider Add grok-cli alongside Codex/Claude Code/Pi, with path/env settings, isolated MCP-scoped headless runs, model listing, and connection test. * feat(ai): expose Grok CLI reasoning effort like Codex Attach low/medium/high effort capabilities to Grok models for the assistant effort menu, wire resolve_model_effort for grok-cli, and use the monochrome Grok mark icon. * i18n: add Grok CLI error messages for remaining locales Fill grokCli* cliErrors strings in es, it, ja, ko, pt-BR, and zh-TW to match en/zh-CN and satisfy i18n autofill CI. * fix(ai): align Grok CLI headless with official Build flags Address review feedback on PR #5494: - Use streaming-json + CliAgentJsonlDialect::GrokStreamingJson - Switch permission to --always-approve and MCPTool(dbx__*) rules - Prefer --effort over --reasoning-effort; keep --prompt-file Verified with unit tests and a local headless e2e against grok 1.0. * style(ai): fix rustfmt for Grok CLI provider files * test(ai): fix Grok CLI entry in provider ordering spec * fix(ai): harden grok CLI error wording and config schema Add 'not signed in' to classify_grok_run_error and test_grok_connection auth detection — real @xai-official/grok 1.0.0 emits this exact wording on headless auth failure (verified against the shipped binary). Remove invalid config.toml fields: permission_mode='always-approve' (not a valid enum; auto-approve is driven by --always-approve flag) and startup_timeout_sec/tool_timeout_sec/enabled_tools (not mcp_servers schema fields per 'grok mcp add'). --------- Co-authored-by: t8y2 <1156263951@qq.com>
This commit is contained in:
1 parent
fff07ada83
commit
d08189ba7d
34 files changed
+1156
-14
No files matched your search
@@ -24,7 +24,7 @@ describe("isAiConfigModelCandidate", () => {
|
||||
expect(isAiConfigModelCandidate(config({ apiKey: "" }), true)).toBe(false);
|
||||
});
|
||||
|
||||
it.each(["codex-cli", "claude-code-cli", "opencode-cli", "pi-agent-cli", "cursor-cli"] as const)("keeps %s configs eligible without endpoint, API key, or model metadata", (provider) => {
|
||||
it.each(["codex-cli", "claude-code-cli", "opencode-cli", "pi-agent-cli", "cursor-cli", "grok-cli"] as const)("keeps %s configs eligible without endpoint, API key, or model metadata", (provider) => {
|
||||
expect(
|
||||
isAiConfigModelCandidate(
|
||||
config({
|
||||
|
||||
@@ -23,11 +23,12 @@ describe("orderAiConfigsForDisplay", () => {
|
||||
{ id: "codex", provider: "codex-cli" },
|
||||
{ id: "opencode", provider: "opencode-cli" },
|
||||
{ id: "cursor", provider: "cursor-cli" },
|
||||
{ id: "grok", provider: "grok-cli" },
|
||||
{ id: "pi", provider: "pi-agent-cli" },
|
||||
{ id: "custom", provider: "custom" },
|
||||
];
|
||||
|
||||
expect(orderAiConfigsForDisplay(configs).map((config) => config.id)).toEqual(["claude", "openai", "gemini", "deepseek", "qwen", "minimax", "ollama", "anthropic-compatible", "openai-compatible", "claude-code-1", "codex", "opencode", "cursor", "pi", "custom"]);
|
||||
expect(orderAiConfigsForDisplay(configs).map((config) => config.id)).toEqual(["claude", "openai", "gemini", "deepseek", "qwen", "minimax", "ollama", "anthropic-compatible", "openai-compatible", "claude-code-1", "codex", "opencode", "cursor", "grok", "pi", "custom"]);
|
||||
});
|
||||
|
||||
it("preserves creation order for configs from the same provider", () => {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { AiConfig } from "@/types/ai";
|
||||
|
||||
const CLI_PROVIDERS = new Set<AiConfig["provider"]>(["codex-cli", "claude-code-cli", "opencode-cli", "pi-agent-cli", "cursor-cli"]);
|
||||
const CLI_PROVIDERS = new Set<AiConfig["provider"]>(["codex-cli", "claude-code-cli", "opencode-cli", "pi-agent-cli", "cursor-cli", "grok-cli"]);
|
||||
|
||||
export function isAiConfigModelCandidate(config: AiConfig, requiresApiKey: boolean): boolean {
|
||||
// CLI providers resolve their model and credentials externally, so keep the existing eligibility bypass.
|
||||
|
||||
Reference in new issue
Block a user