ai-consultants 3.0.0 → 3.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env.example +13 -6
- package/CLAUDE.md +21 -2
- package/README.md +11 -5
- package/SKILL.md +5 -4
- package/docs/COST_RATES.md +1 -1
- package/docs/RECIPES.md +6 -3
- package/docs/SETUP.md +6 -2
- package/docs/cost_rates.json +1 -1
- package/docs/releases/v3.1.0.md +95 -0
- package/docs/releases/v3.1.1.md +54 -0
- package/package.json +1 -1
- package/references/configuration.md +12 -3
- package/scripts/config.sh +28 -8
- package/scripts/configure.sh +3 -3
- package/scripts/doctor.sh +17 -13
- package/scripts/lib/common.sh +8 -8
- package/scripts/query_grok.sh +214 -5
- package/scripts/update_clis.sh +3 -1
package/.env.example
CHANGED
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
# =============================================================================
|
|
39
39
|
# API-BASED CONSULTANT KEYS
|
|
40
40
|
# =============================================================================
|
|
41
|
-
# These are required for
|
|
41
|
+
# These are required for API transports and API-only consultants.
|
|
42
42
|
|
|
43
43
|
# Qwen3 (Alibaba DashScope) - The Analyst
|
|
44
44
|
# Get yours at: https://dashscope.console.aliyun.com/
|
|
@@ -48,7 +48,8 @@
|
|
|
48
48
|
# Get yours at: https://open.z.ai/
|
|
49
49
|
# GLM_API_KEY=your_zhipu_api_key
|
|
50
50
|
|
|
51
|
-
# Grok (
|
|
51
|
+
# Grok API fallback (the Grok Build CLI normally uses its own login)
|
|
52
|
+
# Official docs call this XAI_API_KEY; GROK_API_KEY remains the project setting.
|
|
52
53
|
# Get yours at: https://console.x.ai/
|
|
53
54
|
# GROK_API_KEY=your_xai_api_key
|
|
54
55
|
|
|
@@ -73,18 +74,18 @@ ENABLE_MISTRAL=true
|
|
|
73
74
|
ENABLE_CURSOR=true
|
|
74
75
|
ENABLE_KIMI=true
|
|
75
76
|
ENABLE_QWEN3=true
|
|
77
|
+
ENABLE_GROK=true
|
|
76
78
|
ENABLE_MINIMAX=true
|
|
77
79
|
ENABLE_CLAUDE=true
|
|
78
80
|
|
|
79
81
|
# API-only consultants (default: disabled - require API keys)
|
|
80
82
|
ENABLE_GLM=false
|
|
81
|
-
ENABLE_GROK=false
|
|
82
83
|
ENABLE_DEEPSEEK=false
|
|
83
84
|
|
|
84
85
|
# =============================================================================
|
|
85
86
|
# CLI/API MODE SWITCHING (v2.6+)
|
|
86
87
|
# =============================================================================
|
|
87
|
-
#
|
|
88
|
+
# 7 agents support switching: Gemini, Codex, Claude, Mistral, Qwen3, Grok, MiniMax
|
|
88
89
|
# When API mode is enabled, CLI mode is automatically disabled.
|
|
89
90
|
|
|
90
91
|
# GEMINI_USE_API is auto-resolved when left UNSET (v2.15.1): API mode if
|
|
@@ -160,8 +161,13 @@ QWEN3_CMD=qwen
|
|
|
160
161
|
# rejected by the provider with a 400, not silently ignored.
|
|
161
162
|
# QWEN3_REASONING_EFFORT=
|
|
162
163
|
|
|
164
|
+
# GROK_USE_API is auto-resolved CLI-first: Grok Build is used whenever `grok`
|
|
165
|
+
# is installed; the xAI API is selected when the CLI is unavailable and a key
|
|
166
|
+
# exists. A failed CLI launch also falls back to the API at runtime.
|
|
167
|
+
# GROK_USE_API=false
|
|
168
|
+
|
|
163
169
|
# =============================================================================
|
|
164
|
-
# API-
|
|
170
|
+
# API-ONLY AND FALLBACK CONFIGURATION
|
|
165
171
|
# =============================================================================
|
|
166
172
|
|
|
167
173
|
# GLM - The Methodologist
|
|
@@ -169,7 +175,8 @@ GLM_MODEL=glm-5.2
|
|
|
169
175
|
GLM_TIMEOUT=180
|
|
170
176
|
GLM_API_URL=https://api.z.ai/api/coding/paas/v4/chat/completions
|
|
171
177
|
|
|
172
|
-
# Grok - The Provocateur
|
|
178
|
+
# Grok Build CLI + xAI API fallback - The Provocateur
|
|
179
|
+
GROK_CMD=grok
|
|
173
180
|
GROK_MODEL=grok-4.5
|
|
174
181
|
GROK_TIMEOUT=180
|
|
175
182
|
GROK_API_URL=https://api.x.ai/v1/chat/completions
|
package/CLAUDE.md
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
## Project Overview
|
|
4
4
|
|
|
5
|
-
AI Consultants is a multi-model
|
|
5
|
+
AI Consultants is a multi-model coverage system that queries up to 11 AI consultants (Gemini, Codex, Mistral, Cursor, Kimi, Claude, Qwen3, GLM, Grok, DeepSeek, MiniMax) to obtain diverse perspectives on coding problems.
|
|
6
6
|
|
|
7
7
|
**Self-Exclusion**: The invoking agent is automatically excluded from the panel to prevent self-consultation. Claude Code won't query Claude, Codex CLI won't query Codex, etc.
|
|
8
8
|
|
|
9
|
-
**Version**: 3.
|
|
9
|
+
**Version**: 3.1.1
|
|
10
10
|
|
|
11
11
|
## Distribution
|
|
12
12
|
|
|
@@ -419,6 +419,15 @@ All consultants now use premium models by default:
|
|
|
419
419
|
|
|
420
420
|
Override with environment variables: `CLAUDE_MODEL`, `GEMINI_MODEL`, `CODEX_MODEL`, `KIMI_MODEL`, etc.
|
|
421
421
|
|
|
422
|
+
Grok is CLI-first through the official Grok Build `grok` command, with
|
|
423
|
+
`grok-4.5` passed explicitly in headless mode. The prompt is delivered with
|
|
424
|
+
`--prompt-file`; HOME and CWD are isolated, built-in/MCP tools are denied, and
|
|
425
|
+
the strict sandbox prevents user or project extensions from joining the
|
|
426
|
+
consultation. The xAI Chat Completions path is retained only when the CLI is
|
|
427
|
+
missing, cannot launch, or lacks usable authentication and `GROK_API_KEY` is
|
|
428
|
+
available. A timeout, model error, empty response, or other post-launch failure
|
|
429
|
+
is surfaced and never silently rerouted to the API.
|
|
430
|
+
|
|
422
431
|
## v2.4 Features
|
|
423
432
|
|
|
424
433
|
### Budget Enforcement (Opt-in)
|
|
@@ -777,6 +786,16 @@ curl -fsSL https://raw.githubusercontent.com/matteoscurati/ai-consultants/main/s
|
|
|
777
786
|
|
|
778
787
|
## Changelog
|
|
779
788
|
|
|
789
|
+
### v3.1.1
|
|
790
|
+
- **`doctor` no longer aborts at the first missing enabled consultant.** The v3.1.0 tag workflow exposed the pre-existing `set -e` interaction when Grok became CLI-first and the clean Ubuntu runner had no `grok` binary: the main JSON diagnostic exited before emitting output. Missing CLI/API configuration checks now add their issue and continue to the final summary, which still exits unhealthy. `test_doctor.sh` stubs the complete CLI roster, rejects empty JSON output, and includes a dedicated missing-Grok regression. Full gate: 16/16 suites; shellcheck green.
|
|
791
|
+
|
|
792
|
+
### v3.1.0
|
|
793
|
+
- **Grok is now a first-class CLI/API-switchable consultant on `grok-4.5`.** `scripts/query_grok.sh` uses the official Grok Build headless interface, `scripts/config.sh` resolves CLI-first while preserving API-only installations, and configure/doctor/update-clis/docs all classify Grok with the other switchable consultants. `XAI_API_KEY` is accepted as the official alias for the historical `GROK_API_KEY` contract. The route that actually answered is recorded as `metadata.transport = cli|api|api_fallback`.
|
|
794
|
+
- **The CLI boundary is enforced rather than documented.** The first implementation disabled plan/subagents/memory/web but still inherited the current checkout and the maintainer's Grok environment; `grok inspect --json` showed 1 MCP server, 13 plugins, 11 hooks, 79 skills, and 3 project instructions available to an advisory consultation. Each run now creates an ephemeral mode-700 HOME/CWD, copies only a regular non-symlink `auth.json` at mode 600, supplies `--tools ""`, `--permission-mode dontAsk`, `--sandbox strict`, and explicit deny rules, then validates the temp-prefix before recursive cleanup. A live Grok 4.5 smoke succeeded through this isolated path.
|
|
795
|
+
- **Prompts use `--prompt-file`, not argv.** `FULL_QUERY` includes context files; passing it through `-p "$FULL_QUERY"` exposed the prompt in the process list and failed before Grok launched once the combined context crossed `ARG_MAX`. Reproduced locally with a 1.1 MiB context (`timeout: Argument list too long`). The private prompt file removes both failure modes, and the regression suite drives the same 1.1 MiB case.
|
|
796
|
+
- **API fallback means transport unavailable, not "any non-zero".** The initial adapter sent every CLI error to the API when a key existed — including timeouts, model errors, empty responses, and a generic tested `exit 42` — which hid CLI regressions and could add an unexpected API charge. `grok_cli_is_unavailable` now recognizes missing/unexecutable binaries and authentication/startup failures only; post-launch failures remain `transport=cli` and surface as errors. Missing-command and authentication fallback paths are tested separately.
|
|
797
|
+
- **Regression and release coverage.** New `test_query_grok.sh` carries 26 assertions across headless flags/model pinning, HOME/CWD/auth isolation, tool denial, transport metadata, API fallback boundaries, and large contexts. The master runner discovers it automatically, taking `npm test` to 16 suites; the v3.1.0 release gate and shellcheck pass. README, SKILL, setup/recipes/configuration references, changelog, and the showcase roster are synchronized.
|
|
798
|
+
|
|
780
799
|
### v3.0.0
|
|
781
800
|
- **Phase 2 of the panel-premise investigation: the deliberation/consensus machinery is removed and the default is now the coverage union.** Two independent reviews (Codex `gpt-5.6-sol`, then Fable-5) had judged the panel premise weak — voting/consensus measure *agreement*, not correctness, and no held-out comparison against one strong model existed. A held-out A/W/C coverage experiment (maintainer instrumentation on the `experiment/coverage-metric` branch, not shipped) resolved it: **task-dependent.** On convergent single-answer defect-finding a single strong model (Gemini 3.1 Pro) caught **19/19** hard bugs (repo-internal + external CVEs/concurrency incl. the Rust `Arc` bug found by RustBelt formal verification) → the panel has no coverage headroom. On **breadth/enumeration** (deep 60-point rubrics across JWT/webhook/cache), rubric coverage was **A 51% · self-consistency C 70% · panel W 93%, W>C>A on every item** → diversity, not volume, and specifically the raw **union** (deliberation OFF). The durable value is the diverse fan-out + union; the averaging machinery adds nothing measurable. Directional (n=3 breadth, hand-validated; n=19 defect).
|
|
782
801
|
- **Removed end to end** (six test-green commits on `refactor/remove-deliberation`, merged via PR #6): `lib/voting.sh` (voted recommendation, 1-10 score, consensus score, dissenters), `lib/orchestration.sh` (shape planner + convergence loop) + `debate_round.sh`, `lib/stance.sh`, `peer_review.sh`, and the capability-calibration cluster `roster_audit.sh`/`roster_calibrate.sh`/`run_calibration.sh`/`taste_elo.sh` + `references/calibration_benchmark.json` + the `capabilities`/`category_axis` blocks in `affinity.json`. Panic functions cut from `common.sh`; capability functions (`get_capability`/`get_category_axis`) and the `ENABLE_CAPABILITY_ROUTING` branch cut from `routing.sh`. Config: `ENABLE_DEBATE`/`DEBATE_ROUNDS`, `ORCHESTRATION_MODE`/`CONVERGENCE_*`, `ENABLE_DEBATE_OPTIMIZATION`/`DEBATE_*`, `ENABLE_PANIC_MODE`/`PANIC_*`, `ENABLE_ADVERSARIAL_VERIFY`, `ENABLE_PEER_REVIEW`/`PEER_REVIEW_MIN`, `ENABLE_CAPABILITY_*`/`CAPABILITY_*`, `ENABLE_STANCE_CONSENSUS`/`STANCE_*`. Presets no longer force debate/peer-review. The `debate` and `roster-audit` slash commands are gone (installers prune them). 19 files deleted, ~-4600 lines. 6 test suites removed.
|
package/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
# AI Consultants v3.
|
|
1
|
+
# AI Consultants v3.1.1
|
|
2
2
|
|
|
3
3
|
> **Coverage, not a single guess.** A panel of up to 11 frontier models from different vendors fans out on your question in parallel and hands you the *union* of what they collectively see — the risks, edge cases, and approaches a single model misses.
|
|
4
4
|
|
|
5
|
-
[](https://github.com/matteoscurati/ai-consultants)
|
|
6
6
|
[](LICENSE)
|
|
7
7
|
[](https://docs.anthropic.com/en/docs/claude-code/skills)
|
|
8
8
|
[](https://github.com/matteoscurati/ai-consultants)
|
|
@@ -379,17 +379,22 @@ INVOKING_AGENT=codex ./scripts/consult_all.sh "Question" # Codex excluded
|
|
|
379
379
|
| **Kimi K3** | `kimi` | The Eastern Sage | Holistic, balanced perspectives |
|
|
380
380
|
| **Claude** | `claude` | The Synthesizer | Big picture, synthesis, connecting ideas |
|
|
381
381
|
| **Qwen3** | `qwen` | The Analyst | Data-driven analysis |
|
|
382
|
+
| **Grok** | `grok` | The Provocateur | Challenge conventions |
|
|
382
383
|
| **MiniMax** | `mmx` | The Pragmatic Optimizer | Performance, efficiency, pragmatism |
|
|
383
384
|
|
|
384
|
-
|
|
385
|
-
|
|
385
|
+
Grok uses Grok Build with `grok-4.5` in an isolated, tool-free sandbox. Prompts
|
|
386
|
+
are passed through a private file rather than process arguments. It falls back
|
|
387
|
+
to the xAI API only when the CLI is missing, cannot launch, or has no usable
|
|
388
|
+
authentication and `GROK_API_KEY` is configured; post-launch request failures
|
|
389
|
+
are surfaced without a silent API charge. Qwen3 and MiniMax can also switch
|
|
390
|
+
from their CLI to API transport. Gemini, Codex, Claude, and Mistral are
|
|
391
|
+
CLI/API switchable.
|
|
386
392
|
|
|
387
393
|
### API-Only Consultants
|
|
388
394
|
|
|
389
395
|
| Consultant | Default Model | Persona | Focus |
|
|
390
396
|
|------------|---------------|---------|-------|
|
|
391
397
|
| **GLM** | glm-5.2 | The Methodologist | Structured approaches |
|
|
392
|
-
| **Grok** | grok-4.5 | The Provocateur | Challenge conventions |
|
|
393
398
|
| **DeepSeek** | deepseek-v4-pro | The Code Specialist | Algorithms, code generation |
|
|
394
399
|
|
|
395
400
|
### Installing Consultant CLIs
|
|
@@ -405,6 +410,7 @@ curl https://cursor.com/install -fsS | bash # Cursor
|
|
|
405
410
|
# Optional CLI-based consultants
|
|
406
411
|
curl -L code.kimi.com/install.sh | bash # Kimi K3
|
|
407
412
|
npm install -g @qwen-code/qwen-code@latest # Qwen (alternative to API)
|
|
413
|
+
curl -fsSL https://x.ai/cli/install.sh | bash # Grok Build (grok-4.5)
|
|
408
414
|
npm install -g mmx-cli # MiniMax
|
|
409
415
|
|
|
410
416
|
```
|
package/SKILL.md
CHANGED
|
@@ -5,10 +5,10 @@ license: MIT
|
|
|
5
5
|
compatibility: Requires bash, jq, and at least 2 AI CLI tools (agy, codex, vibe, etc.). macOS and Linux.
|
|
6
6
|
metadata:
|
|
7
7
|
author: matteoscurati
|
|
8
|
-
version: 3.
|
|
8
|
+
version: 3.1.1
|
|
9
9
|
---
|
|
10
10
|
|
|
11
|
-
# AI Consultants v3.
|
|
11
|
+
# AI Consultants v3.1.1 - AI Expert Panel
|
|
12
12
|
|
|
13
13
|
**Coverage, not a single guess.** Convene a panel of AI "consultants" from different vendors for coding questions: they fan out in parallel and you get the *union* of what they collectively see — the risks, edge cases, and approaches a single model misses. Each consultant has a **configurable persona** that decorrelates its analysis.
|
|
14
14
|
|
|
@@ -38,11 +38,12 @@ Configuration (presets, strategies, features, personas, API keys) can be managed
|
|
|
38
38
|
| **Kimi K3** | `kimi` | The Eastern Sage | Holistic, balanced perspectives |
|
|
39
39
|
| **Claude** | `claude` | The Synthesizer | Big picture, synthesis |
|
|
40
40
|
| **Qwen** | `qwen` | The Analyst | Data-driven, metrics |
|
|
41
|
+
| **Grok** | `grok` | The Provocateur | Challenge conventions |
|
|
41
42
|
| **MiniMax** | `mmx` | The Pragmatic Optimizer | Performance, efficiency, pragmatism |
|
|
42
43
|
|
|
43
|
-
**API-only consultants**: GLM (The Methodologist),
|
|
44
|
+
**API-only consultants**: GLM (The Methodologist), DeepSeek (The Code Specialist)
|
|
44
45
|
|
|
45
|
-
**CLI/API Mode**: Gemini, Codex, Claude, Mistral, Qwen, and MiniMax can switch between CLI and API mode via `*_USE_API` environment variables. Gemini auto-selects API mode when `GEMINI_API_KEY` is set (no `agy` install needed) and the CLI otherwise.
|
|
46
|
+
**CLI/API Mode**: Gemini, Codex, Claude, Mistral, Qwen, Grok, and MiniMax can switch between CLI and API mode via `*_USE_API` environment variables. Grok is CLI-first on Grok Build with `grok-4.5` and falls back to the xAI API when the CLI cannot run. Gemini auto-selects API mode when `GEMINI_API_KEY` is set (no `agy` install needed) and the CLI otherwise.
|
|
46
47
|
|
|
47
48
|
**Self-Exclusion**: The invoking agent is automatically excluded from the panel. When invoked from Claude Code, Claude is excluded; when invoked from Codex CLI, Codex is excluded, etc.
|
|
48
49
|
|
package/docs/COST_RATES.md
CHANGED
package/docs/RECIPES.md
CHANGED
|
@@ -124,10 +124,10 @@ CLAUDE_USE_API=false
|
|
|
124
124
|
MISTRAL_USE_API=false
|
|
125
125
|
QWEN3_USE_API=false
|
|
126
126
|
MINIMAX_USE_API=false
|
|
127
|
+
GROK_USE_API=false
|
|
127
128
|
KIMI_MODEL=kimi-code/k3
|
|
128
129
|
|
|
129
130
|
ENABLE_GLM=false
|
|
130
|
-
ENABLE_GROK=false
|
|
131
131
|
ENABLE_DEEPSEEK=false
|
|
132
132
|
```
|
|
133
133
|
|
|
@@ -140,8 +140,10 @@ even when `~/.kimi/config.toml` still names an older default model.
|
|
|
140
140
|
|
|
141
141
|
## 8. Hybrid CLI and API panel
|
|
142
142
|
|
|
143
|
-
Enable API transport only where needed.
|
|
144
|
-
|
|
143
|
+
Enable API transport only where needed. Grok normally uses Grok Build and
|
|
144
|
+
automatically falls back to the xAI API if the CLI cannot run. Gemini and
|
|
145
|
+
MiniMax automatically choose API mode when their API key is present unless
|
|
146
|
+
`*_USE_API` is explicitly set.
|
|
145
147
|
|
|
146
148
|
```dotenv
|
|
147
149
|
CODEX_USE_API=false
|
|
@@ -151,6 +153,7 @@ QWEN3_USE_API=true
|
|
|
151
153
|
QWEN3_API_KEY=your-dashscope-key
|
|
152
154
|
|
|
153
155
|
ENABLE_GROK=true
|
|
156
|
+
GROK_USE_API=false
|
|
154
157
|
GROK_API_KEY=your-xai-key
|
|
155
158
|
GROK_MODEL=grok-4.5
|
|
156
159
|
|
package/docs/SETUP.md
CHANGED
|
@@ -394,7 +394,7 @@ INVOKING_AGENT=codex ./scripts/consult_all.sh "Question"
|
|
|
394
394
|
|
|
395
395
|
## CLI/API Mode Switching (v2.6+)
|
|
396
396
|
|
|
397
|
-
|
|
397
|
+
Seven consultants can switch between CLI mode (using local CLI tools) and API mode (direct API calls): **Gemini, Codex, Claude, Mistral, Qwen3, Grok, and MiniMax**. Grok is CLI-first and runs in an isolated, tool-free strict sandbox. It falls back automatically only when Grok Build is missing, cannot launch, or lacks usable authentication and a key is available; request failures after launch are surfaced without an API fallback.
|
|
398
398
|
|
|
399
399
|
### Why Use API Mode?
|
|
400
400
|
|
|
@@ -418,6 +418,9 @@ export ANTHROPIC_API_KEY="sk-ant-..."
|
|
|
418
418
|
export MISTRAL_USE_API=true
|
|
419
419
|
export MISTRAL_API_KEY="your-mistral-key"
|
|
420
420
|
|
|
421
|
+
export GROK_USE_API=true
|
|
422
|
+
export GROK_API_KEY="your-xai-key"
|
|
423
|
+
|
|
421
424
|
export QWEN3_USE_API=true # Enable API mode for Qwen3
|
|
422
425
|
export QWEN3_API_KEY="your-dashscope-key"
|
|
423
426
|
```
|
|
@@ -590,8 +593,8 @@ ENABLE_CLAUDE=false # Auto-excluded when invoked from Claude Code
|
|
|
590
593
|
ENABLE_MISTRAL=false
|
|
591
594
|
ENABLE_CURSOR=false
|
|
592
595
|
ENABLE_QWEN3=false # v2.7: The Analyst (CLI/API)
|
|
596
|
+
ENABLE_GROK=true # Grok Build CLI; API fallback when unavailable
|
|
593
597
|
ENABLE_GLM=false
|
|
594
|
-
ENABLE_GROK=false
|
|
595
598
|
ENABLE_DEEPSEEK=false
|
|
596
599
|
ENABLE_KIMI=true
|
|
597
600
|
ENABLE_MINIMAX=true
|
|
@@ -606,6 +609,7 @@ OPENAI_API_KEY=sk-your-key
|
|
|
606
609
|
MISTRAL_API_KEY=your-key
|
|
607
610
|
ANTHROPIC_API_KEY=sk-ant-your-key
|
|
608
611
|
QWEN3_API_KEY=your-dashscope-key
|
|
612
|
+
GROK_API_KEY=your-xai-key # optional fallback; Grok Build normally uses login
|
|
609
613
|
|
|
610
614
|
# CLI/API Mode Switching (v2.6+)
|
|
611
615
|
# GEMINI_USE_API auto-resolves when unset (v2.15.1): API if GEMINI_API_KEY is
|
package/docs/cost_rates.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "3.
|
|
2
|
+
"version": "3.1.1",
|
|
3
3
|
"updated": "2026-07-16",
|
|
4
4
|
"models": {
|
|
5
5
|
"_comment_units": "All rates are USD per 1,000 tokens (per-1K). lib/costs.sh computes cost as (token_count / 1000) * rate, so every value here MUST be a per-1K rate = (provider $/1M price) / 1000. Do NOT paste $/MTok figures directly.",
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
# Release v3.1.0
|
|
2
|
+
|
|
3
|
+
**Date:** 2026-07-24
|
|
4
|
+
**Type:** Minor — Grok 4.5 becomes a secure CLI-first consultant through Grok Build
|
|
5
|
+
**Previous:** v3.0.0
|
|
6
|
+
|
|
7
|
+
## Highlights
|
|
8
|
+
|
|
9
|
+
- **Grok 4.5 now uses the official Grok Build CLI by default**, including OAuth/subscription authentication already available on the machine.
|
|
10
|
+
- **Each Grok consultation runs in an isolated, tool-free environment** without importing local plugins, hooks, MCP servers, skills, memories, or project instructions.
|
|
11
|
+
- **The xAI API remains available as a focused fallback** when Grok Build is missing, cannot launch, or is not authenticated.
|
|
12
|
+
- **CLI request failures never silently become billable API requests.** Timeouts, model errors, and empty responses are returned as failures on the attempted CLI transport.
|
|
13
|
+
- **Large contexts are safe from shell argument limits** because prompts are delivered through a private file instead of the process command line.
|
|
14
|
+
|
|
15
|
+
## What's New
|
|
16
|
+
|
|
17
|
+
### Grok Build CLI transport
|
|
18
|
+
|
|
19
|
+
Grok joins the CLI-first consultant roster with `grok-4.5` pinned explicitly. Existing installations prefer the `grok` command; API-only installations continue to use the xAI Chat Completions transport when `GROK_API_KEY` or `XAI_API_KEY` is configured.
|
|
20
|
+
|
|
21
|
+
Every response records the route that answered:
|
|
22
|
+
|
|
23
|
+
| `metadata.transport` | Meaning |
|
|
24
|
+
|---|---|
|
|
25
|
+
| `cli` | Grok Build answered |
|
|
26
|
+
| `api` | API mode was explicitly selected |
|
|
27
|
+
| `api_fallback` | The CLI was unavailable and the xAI API answered |
|
|
28
|
+
|
|
29
|
+
### Isolated advisory execution
|
|
30
|
+
|
|
31
|
+
AI Consultants uses Grok as an advisory model, not as an editing agent. The adapter therefore starts Grok Build with:
|
|
32
|
+
|
|
33
|
+
- an ephemeral HOME and empty working directory;
|
|
34
|
+
- no built-in tools, MCP tools, subagents, memory, or web access;
|
|
35
|
+
- fail-closed permissions and the strict sandbox;
|
|
36
|
+
- only the existing Grok authentication material copied into the private runtime;
|
|
37
|
+
- automatic cleanup after the response.
|
|
38
|
+
|
|
39
|
+
The consultation receives only the prompt and context explicitly assembled by AI Consultants.
|
|
40
|
+
|
|
41
|
+
### Narrow API fallback
|
|
42
|
+
|
|
43
|
+
The API fallback is limited to transport availability:
|
|
44
|
+
|
|
45
|
+
- Grok Build is not installed;
|
|
46
|
+
- the command cannot execute or launch;
|
|
47
|
+
- the CLI has no usable authentication.
|
|
48
|
+
|
|
49
|
+
Failures after the CLI request starts—including timeouts, model errors, and empty output—are surfaced directly. This prevents a broken CLI request from silently producing a separate API charge.
|
|
50
|
+
|
|
51
|
+
### Private prompt files
|
|
52
|
+
|
|
53
|
+
The complete prompt is written to a mode-600 temporary file and passed with `--prompt-file`. This keeps prompt content out of process listings and supports contexts larger than the operating system's argument-vector limit.
|
|
54
|
+
|
|
55
|
+
## Breaking Changes
|
|
56
|
+
|
|
57
|
+
None — this release is backwards-compatible. `GROK_USE_API=true` still forces the API transport, and the existing `GROK_API_KEY` configuration remains supported.
|
|
58
|
+
|
|
59
|
+
## Upgrade Guide
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
# If installed via git clone
|
|
63
|
+
cd ~/.claude/skills/ai-consultants && git pull
|
|
64
|
+
|
|
65
|
+
# If installed via curl | bash
|
|
66
|
+
curl -fsSL https://raw.githubusercontent.com/matteoscurati/ai-consultants/main/scripts/install.sh | bash
|
|
67
|
+
|
|
68
|
+
# If used through npx
|
|
69
|
+
npx ai-consultants@latest "your question"
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Install and authenticate Grok Build to use the new default transport:
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
curl -fsSL https://x.ai/cli/install.sh | bash
|
|
76
|
+
grok login
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
No configuration changes are required. Systems without a usable Grok Build CLI continue to use the configured xAI API fallback.
|
|
80
|
+
|
|
81
|
+
## Verification
|
|
82
|
+
|
|
83
|
+
- Live Grok 4.5 smoke through the isolated CLI runtime
|
|
84
|
+
- Grok adapter regression suite: 26 checks
|
|
85
|
+
- Full repository gate: 16/16 suites
|
|
86
|
+
- Core suite: 295/295 checks
|
|
87
|
+
- Shellcheck and release-surface validation
|
|
88
|
+
|
|
89
|
+
## Commits
|
|
90
|
+
|
|
91
|
+
- `ed84c8c` feat: integrate Grok 4.5 through Grok Build CLI
|
|
92
|
+
|
|
93
|
+
## Contributors
|
|
94
|
+
|
|
95
|
+
- Matteo Scurati
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# Release v3.1.1
|
|
2
|
+
|
|
3
|
+
**Date:** 2026-07-24
|
|
4
|
+
**Type:** Patch — complete doctor diagnostics when a consultant is unavailable
|
|
5
|
+
**Previous:** v3.1.0
|
|
6
|
+
|
|
7
|
+
## Highlights
|
|
8
|
+
|
|
9
|
+
- **`doctor` now reaches its final summary when an enabled CLI is missing.**
|
|
10
|
+
- **JSON diagnostics always emit a complete object before returning unhealthy.**
|
|
11
|
+
- **Missing API credentials follow the same accumulate-and-report behavior.**
|
|
12
|
+
|
|
13
|
+
## What Was Fixed
|
|
14
|
+
|
|
15
|
+
The diagnostic checks correctly recognized an enabled but unavailable consultant
|
|
16
|
+
as unhealthy, but returned a non-zero status from inside the pipeline. Because
|
|
17
|
+
`doctor.sh` runs with `set -e`, that return terminated the entire command before
|
|
18
|
+
the human summary or JSON object could be produced.
|
|
19
|
+
|
|
20
|
+
This became visible in the clean Linux release runner after Grok Build became the
|
|
21
|
+
default Grok transport in v3.1.0: the runner had no `grok` executable, so
|
|
22
|
+
`doctor --json` emitted nothing.
|
|
23
|
+
|
|
24
|
+
CLI, switchable API-mode, and API-only checks now record the issue and continue.
|
|
25
|
+
The command still exits 1 after the completed summary when any issue exists.
|
|
26
|
+
|
|
27
|
+
## Verification
|
|
28
|
+
|
|
29
|
+
- Dedicated missing-Grok JSON regression
|
|
30
|
+
- Empty output is no longer accepted as valid JSON
|
|
31
|
+
- Doctor suite: 43/43 checks
|
|
32
|
+
- Full repository gate: 16/16 suites
|
|
33
|
+
- Shellcheck passed
|
|
34
|
+
|
|
35
|
+
## Breaking Changes
|
|
36
|
+
|
|
37
|
+
None.
|
|
38
|
+
|
|
39
|
+
## Upgrade Guide
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
# If installed via git clone
|
|
43
|
+
cd ~/.claude/skills/ai-consultants && git pull
|
|
44
|
+
|
|
45
|
+
# If installed via curl | bash
|
|
46
|
+
curl -fsSL https://raw.githubusercontent.com/matteoscurati/ai-consultants/main/scripts/install.sh | bash
|
|
47
|
+
|
|
48
|
+
# If used through npx
|
|
49
|
+
npx ai-consultants@latest doctor
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Contributors
|
|
53
|
+
|
|
54
|
+
- Matteo Scurati
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ai-consultants",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.1.1",
|
|
4
4
|
"description": "A harness for every question - a panel of up to 11 AI models that picks its own deliberation strategy per question (convergence, adversarial verification, tournament) and checks its work before answering",
|
|
5
5
|
"bin": {
|
|
6
6
|
"ai-consultants": "bin/ai-consultants"
|
|
@@ -182,7 +182,7 @@ override it.
|
|
|
182
182
|
|
|
183
183
|
## CLI/API Mode Switching (v2.6+)
|
|
184
184
|
|
|
185
|
-
|
|
185
|
+
Seven consultants support switching between CLI and API mode. **The default is the CLI** for every consultant that has one. Grok additionally falls back to the xAI API after a failed CLI launch when a key is available. When API mode is explicitly enabled, the CLI is not used.
|
|
186
186
|
|
|
187
187
|
**Gemini auto-resolution (v2.15.1):** leave `GEMINI_USE_API` unset and the mode is chosen for you — API mode when `GEMINI_API_KEY` is present (no `agy` install or OAuth needed; ideal for `npx`), CLI mode (`agy`) otherwise. Set `GEMINI_USE_API` explicitly only to force a mode (an explicit value disables auto-detection).
|
|
188
188
|
|
|
@@ -193,6 +193,7 @@ CODEX_USE_API=false # Use OpenAI API instead of codex CLI
|
|
|
193
193
|
CLAUDE_USE_API=false # Use Anthropic API instead of claude CLI
|
|
194
194
|
MISTRAL_USE_API=false # Use Mistral API instead of vibe CLI
|
|
195
195
|
QWEN3_USE_API=false # Use qwen CLI (default) or DashScope API
|
|
196
|
+
GROK_USE_API=false # Use Grok Build (default); API is fallback
|
|
196
197
|
MINIMAX_USE_API=false # Use mmx CLI (default) or MiniMax API
|
|
197
198
|
```
|
|
198
199
|
|
|
@@ -207,7 +208,7 @@ MINIMAX_USE_API=false # Use mmx CLI (default) or MiniMax API
|
|
|
207
208
|
| Qwen3 | `QWEN3_API_KEY` | DashScope API key |
|
|
208
209
|
| MiniMax | `MINIMAX_API_KEY` | MiniMax API key (API mode only; the mmx CLI uses OAuth) |
|
|
209
210
|
| GLM | `GLM_API_KEY` | Required when `ENABLE_GLM=true` |
|
|
210
|
-
| Grok | `GROK_API_KEY` |
|
|
211
|
+
| Grok | `GROK_API_KEY` | xAI API fallback key; Grok Build CLI uses its own login |
|
|
211
212
|
| DeepSeek | `DEEPSEEK_API_KEY` | Required when `ENABLE_DEEPSEEK=true` |
|
|
212
213
|
|
|
213
214
|
## Consultant Toggles and Models
|
|
@@ -220,12 +221,12 @@ ENABLE_MISTRAL=true
|
|
|
220
221
|
ENABLE_CURSOR=true
|
|
221
222
|
ENABLE_KIMI=true # Kimi CLI - The Eastern Sage
|
|
222
223
|
ENABLE_QWEN3=true # Qwen CLI/API - The Analyst
|
|
224
|
+
ENABLE_GROK=true # Grok Build CLI/API fallback - The Provocateur
|
|
223
225
|
ENABLE_MINIMAX=true # MiniMax CLI/API (mmx) - The Pragmatic Optimizer
|
|
224
226
|
ENABLE_CLAUDE=true # Claude CLI - The Synthesizer (auto-excluded under Claude Code)
|
|
225
227
|
|
|
226
228
|
# API-only consultants (off by default - require API keys)
|
|
227
229
|
ENABLE_GLM=false
|
|
228
|
-
ENABLE_GROK=false
|
|
229
230
|
ENABLE_DEEPSEEK=false
|
|
230
231
|
```
|
|
231
232
|
|
|
@@ -245,6 +246,14 @@ DEEPSEEK_MODEL=deepseek-v4-pro
|
|
|
245
246
|
MINIMAX_MODEL=MiniMax-M2.7
|
|
246
247
|
```
|
|
247
248
|
|
|
249
|
+
`GROK_MODEL` is passed explicitly to `grok -m`. The default transport is the
|
|
250
|
+
headless Grok Build CLI using a private `--prompt-file` inside an isolated,
|
|
251
|
+
tool-free strict sandbox. If the CLI is missing, cannot execute, or has no
|
|
252
|
+
usable authentication, the same query and model fall back to `GROK_API_URL`
|
|
253
|
+
when `GROK_API_KEY` is set. Failures after a request launches (including
|
|
254
|
+
timeouts, model errors, and empty output) are returned without API fallback.
|
|
255
|
+
Set `GROK_USE_API=true` only to force the API path.
|
|
256
|
+
|
|
248
257
|
`KIMI_MODEL` is passed directly to `kimi --model`, so `kimi-code/k3` overrides
|
|
249
258
|
any older default stored in the user's Kimi CLI configuration.
|
|
250
259
|
|
package/scripts/config.sh
CHANGED
|
@@ -64,12 +64,12 @@ DEFAULT_OUTPUT_DIR_BASE="${DEFAULT_OUTPUT_DIR_BASE:-${_AI_CONSULTANTS_XDG_CACHE}
|
|
|
64
64
|
# =============================================================================
|
|
65
65
|
# For agents that support both CLI and API mode, set USE_API=true to use API mode.
|
|
66
66
|
# When API mode is enabled, CLI mode is automatically disabled (mutual exclusivity).
|
|
67
|
-
#
|
|
67
|
+
# 7 agents support switching: Gemini, Codex, Claude, Mistral, Qwen3, Grok, MiniMax
|
|
68
68
|
|
|
69
69
|
# Mode switching (true = API, false = CLI). DEFAULT IS CLI — when a consultant
|
|
70
70
|
# has a CLI, the tool uses it; the CLIs are the primary transport (OAuth /
|
|
71
71
|
# subscription, no API key needed). API mode is opt-in only: for CLI-less models
|
|
72
|
-
# (GLM/
|
|
72
|
+
# (GLM/DeepSeek are API-only) or an explicit per-run user
|
|
73
73
|
# choice. Set a switch to true (with its API key) to force API for that agent.
|
|
74
74
|
# GEMINI_USE_API is intentionally NOT defaulted here: it is auto-resolved in the
|
|
75
75
|
# Gemini configuration section below (needs GEMINI_API_KEY / GEMINI_CMD), so an
|
|
@@ -78,6 +78,8 @@ CODEX_USE_API="${CODEX_USE_API:-false}"
|
|
|
78
78
|
CLAUDE_USE_API="${CLAUDE_USE_API:-false}"
|
|
79
79
|
MISTRAL_USE_API="${MISTRAL_USE_API:-false}"
|
|
80
80
|
QWEN3_USE_API="${QWEN3_USE_API:-false}" # Default false to use qwen CLI
|
|
81
|
+
# GROK_USE_API is intentionally resolved in the Grok section: it is CLI-first,
|
|
82
|
+
# but must preserve an API-only installation when Grok Build is unavailable.
|
|
81
83
|
# MINIMAX_USE_API is intentionally NOT defaulted here: it is auto-resolved in the
|
|
82
84
|
# MiniMax configuration section below (needs MINIMAX_API_KEY), so an explicit
|
|
83
85
|
# unset stays distinguishable from an explicit "false" (back-compat for pre-v2.21
|
|
@@ -186,14 +188,32 @@ GLM_FORMAT="${GLM_FORMAT:-openai}"
|
|
|
186
188
|
# API key: Set GLM_API_KEY environment variable
|
|
187
189
|
|
|
188
190
|
# =============================================================================
|
|
189
|
-
# GROK CONFIGURATION - The Provocateur (API
|
|
191
|
+
# GROK CONFIGURATION - The Provocateur (Grok Build CLI + API fallback)
|
|
190
192
|
# =============================================================================
|
|
191
193
|
|
|
194
|
+
GROK_CMD="${GROK_CMD:-grok}"
|
|
192
195
|
GROK_MODEL="${GROK_MODEL:-grok-4.5}"
|
|
193
196
|
GROK_TIMEOUT_SECONDS="${GROK_TIMEOUT:-180}"
|
|
194
197
|
GROK_API_URL="${GROK_API_URL:-https://api.x.ai/v1/chat/completions}"
|
|
195
198
|
GROK_FORMAT="${GROK_FORMAT:-openai}"
|
|
196
|
-
#
|
|
199
|
+
# Grok Build's official credential name is XAI_API_KEY. Keep the historical
|
|
200
|
+
# GROK_API_KEY public contract and accept XAI_API_KEY as its fallback alias.
|
|
201
|
+
GROK_API_KEY="${GROK_API_KEY:-${XAI_API_KEY:-}}"
|
|
202
|
+
export GROK_API_KEY
|
|
203
|
+
|
|
204
|
+
# CLI-first auto-resolution. Existing users can still pin GROK_USE_API=true,
|
|
205
|
+
# while an unpinned setup uses the CLI whenever it is installed and falls back
|
|
206
|
+
# to the API when only a key is available.
|
|
207
|
+
if [[ -z "${GROK_USE_API+x}" ]]; then
|
|
208
|
+
if command -v "$GROK_CMD" >/dev/null 2>&1; then
|
|
209
|
+
GROK_USE_API=false
|
|
210
|
+
elif [[ -n "$GROK_API_KEY" ]]; then
|
|
211
|
+
GROK_USE_API=true
|
|
212
|
+
else
|
|
213
|
+
GROK_USE_API=false
|
|
214
|
+
fi
|
|
215
|
+
fi
|
|
216
|
+
export GROK_USE_API
|
|
197
217
|
|
|
198
218
|
# =============================================================================
|
|
199
219
|
# DEEPSEEK CONFIGURATION - The Methodologist (API-based)
|
|
@@ -265,10 +285,10 @@ CLAUDE_CMD="${CLAUDE_CMD:-claude}"
|
|
|
265
285
|
ALL_CONSULTANTS=("Gemini" "Codex" "Mistral" "Cursor" "Kimi" "Claude" "Qwen3" "GLM" "Grok" "DeepSeek" "MiniMax")
|
|
266
286
|
|
|
267
287
|
# CLI-based consultants (use CLI tools, some support CLI/API switching)
|
|
268
|
-
CLI_CONSULTANTS=("Gemini" "Codex" "Mistral" "Cursor" "Kimi" "Claude" "Qwen3" "MiniMax")
|
|
288
|
+
CLI_CONSULTANTS=("Gemini" "Codex" "Mistral" "Cursor" "Kimi" "Claude" "Qwen3" "Grok" "MiniMax")
|
|
269
289
|
|
|
270
290
|
# API-only consultants (use HTTP API directly, no CLI available)
|
|
271
|
-
API_CONSULTANTS=("GLM" "
|
|
291
|
+
API_CONSULTANTS=("GLM" "DeepSeek")
|
|
272
292
|
|
|
273
293
|
# =============================================================================
|
|
274
294
|
# ENABLED CONSULTANTS
|
|
@@ -283,11 +303,11 @@ ENABLE_CURSOR="${ENABLE_CURSOR:-true}"
|
|
|
283
303
|
ENABLE_KIMI="${ENABLE_KIMI:-true}" # Kimi Code (v2.9)
|
|
284
304
|
ENABLE_CLAUDE="${ENABLE_CLAUDE:-true}" # Auto-disabled when invoked by Claude Code
|
|
285
305
|
ENABLE_QWEN3="${ENABLE_QWEN3:-true}" # qwen-code CLI (v2.7); API opt-in
|
|
306
|
+
ENABLE_GROK="${ENABLE_GROK:-true}" # Grok Build CLI; API fallback
|
|
286
307
|
ENABLE_MINIMAX="${ENABLE_MINIMAX:-true}" # mmx CLI (v2.21); API opt-in
|
|
287
308
|
|
|
288
309
|
# API-only consultants (disabled by default - require API keys)
|
|
289
310
|
ENABLE_GLM="${ENABLE_GLM:-false}"
|
|
290
|
-
ENABLE_GROK="${ENABLE_GROK:-false}"
|
|
291
311
|
ENABLE_DEEPSEEK="${ENABLE_DEEPSEEK:-false}"
|
|
292
312
|
|
|
293
313
|
# =============================================================================
|
|
@@ -758,4 +778,4 @@ EOF
|
|
|
758
778
|
# VERSION
|
|
759
779
|
# =============================================================================
|
|
760
780
|
|
|
761
|
-
AI_CONSULTANTS_VERSION="3.
|
|
781
|
+
AI_CONSULTANTS_VERSION="3.1.1"
|
package/scripts/configure.sh
CHANGED
|
@@ -307,9 +307,9 @@ run_auto_detection() {
|
|
|
307
307
|
configure_cli_only ENABLE_KIMI KIMI_CMD
|
|
308
308
|
configure_switchable ENABLE_CLAUDE CLAUDE_CMD CLAUDE_USE_API ANTHROPIC_API_KEY
|
|
309
309
|
configure_switchable ENABLE_QWEN3 QWEN3_CMD QWEN3_USE_API QWEN3_API_KEY
|
|
310
|
+
configure_switchable ENABLE_GROK GROK_CMD GROK_USE_API GROK_API_KEY
|
|
310
311
|
configure_switchable ENABLE_MINIMAX MINIMAX_CMD MINIMAX_USE_API MINIMAX_API_KEY
|
|
311
312
|
configure_api_only ENABLE_GLM GLM_API_KEY
|
|
312
|
-
configure_api_only ENABLE_GROK GROK_API_KEY
|
|
313
313
|
configure_api_only ENABLE_DEEPSEEK DEEPSEEK_API_KEY
|
|
314
314
|
}
|
|
315
315
|
|
|
@@ -346,7 +346,7 @@ if [[ "$MODE" == "interactive" ]]; then
|
|
|
346
346
|
for key in ENABLE_GEMINI ENABLE_CODEX ENABLE_MISTRAL ENABLE_CURSOR ENABLE_KIMI ENABLE_CLAUDE ENABLE_QWEN3 ENABLE_GLM ENABLE_GROK ENABLE_DEEPSEEK ENABLE_MINIMAX; do
|
|
347
347
|
prompt_value "$key"
|
|
348
348
|
done
|
|
349
|
-
for key in GEMINI_USE_API CODEX_USE_API MISTRAL_USE_API CLAUDE_USE_API QWEN3_USE_API MINIMAX_USE_API; do
|
|
349
|
+
for key in GEMINI_USE_API CODEX_USE_API MISTRAL_USE_API CLAUDE_USE_API QWEN3_USE_API GROK_USE_API MINIMAX_USE_API; do
|
|
350
350
|
prompt_value "$key"
|
|
351
351
|
done
|
|
352
352
|
|
|
@@ -359,7 +359,7 @@ if [[ "$MODE" == "interactive" ]]; then
|
|
|
359
359
|
# parameter name as the user's answer instead.
|
|
360
360
|
while IFS= read -r key <&3; do
|
|
361
361
|
case "$key" in
|
|
362
|
-
ENABLE_GEMINI|ENABLE_CODEX|ENABLE_MISTRAL|ENABLE_CURSOR|ENABLE_KIMI|ENABLE_CLAUDE|ENABLE_QWEN3|ENABLE_GLM|ENABLE_GROK|ENABLE_DEEPSEEK|ENABLE_MINIMAX|GEMINI_USE_API|CODEX_USE_API|MISTRAL_USE_API|CLAUDE_USE_API|QWEN3_USE_API|MINIMAX_USE_API|GEMINI_API_KEY|OPENAI_API_KEY|MISTRAL_API_KEY|ANTHROPIC_API_KEY|QWEN3_API_KEY|MINIMAX_API_KEY|GLM_API_KEY|GROK_API_KEY|DEEPSEEK_API_KEY) continue ;;
|
|
362
|
+
ENABLE_GEMINI|ENABLE_CODEX|ENABLE_MISTRAL|ENABLE_CURSOR|ENABLE_KIMI|ENABLE_CLAUDE|ENABLE_QWEN3|ENABLE_GLM|ENABLE_GROK|ENABLE_DEEPSEEK|ENABLE_MINIMAX|GEMINI_USE_API|CODEX_USE_API|MISTRAL_USE_API|CLAUDE_USE_API|QWEN3_USE_API|GROK_USE_API|MINIMAX_USE_API|GEMINI_API_KEY|OPENAI_API_KEY|MISTRAL_API_KEY|ANTHROPIC_API_KEY|QWEN3_API_KEY|MINIMAX_API_KEY|GLM_API_KEY|GROK_API_KEY|DEEPSEEK_API_KEY) continue ;;
|
|
363
363
|
esac
|
|
364
364
|
prompt_value "$key"
|
|
365
365
|
done 3< <(list_parameters)
|
package/scripts/doctor.sh
CHANGED
|
@@ -219,10 +219,9 @@ check_cli_consultant() {
|
|
|
219
219
|
return 0
|
|
220
220
|
fi
|
|
221
221
|
|
|
222
|
-
#
|
|
223
|
-
#
|
|
224
|
-
#
|
|
225
|
-
# by check_api_mode. This matters most for Gemini, which auto-resolves to
|
|
222
|
+
# Switchable agents skip the CLI requirement while explicitly in API mode;
|
|
223
|
+
# the API key is validated separately by check_api_mode. This matters most
|
|
224
|
+
# for Gemini, which auto-resolves to
|
|
226
225
|
# API mode whenever GEMINI_API_KEY is set (the npm-friendly path).
|
|
227
226
|
local use_api_var="${env_var}_USE_API"
|
|
228
227
|
if [[ "${!use_api_var:-false}" == "true" ]]; then
|
|
@@ -238,7 +237,9 @@ check_cli_consultant() {
|
|
|
238
237
|
fi
|
|
239
238
|
add_issue "consultant" "$name CLI not found" "$install_cmd"
|
|
240
239
|
check_fail
|
|
241
|
-
|
|
240
|
+
# A failed health check is data for the final diagnosis, not a reason
|
|
241
|
+
# to abort the diagnostic pipeline under `set -e`.
|
|
242
|
+
return 0
|
|
242
243
|
fi
|
|
243
244
|
|
|
244
245
|
# Get version (--version is standard and fast, no timeout needed)
|
|
@@ -265,6 +266,7 @@ check_cli_consultants() {
|
|
|
265
266
|
check_cli_consultant "Kimi" "$KIMI_CMD" "curl -L code.kimi.com/install.sh | bash" "KIMI"
|
|
266
267
|
check_cli_consultant "Claude" "$CLAUDE_CMD" "See https://docs.anthropic.com/claude-code" "CLAUDE"
|
|
267
268
|
check_cli_consultant "Qwen" "$QWEN3_CMD" "npm install -g @qwen-code/qwen-code@latest" "QWEN3"
|
|
269
|
+
check_cli_consultant "Grok Build" "$GROK_CMD" "curl -fsSL https://x.ai/cli/install.sh | bash" "GROK"
|
|
268
270
|
check_cli_consultant "MiniMax" "$MINIMAX_CMD" "npm install -g mmx-cli" "MINIMAX"
|
|
269
271
|
}
|
|
270
272
|
|
|
@@ -291,7 +293,7 @@ check_api_mode() {
|
|
|
291
293
|
_print " ✗ $name: API mode enabled but $api_key_var not set"
|
|
292
294
|
add_issue "api_mode" "$name API mode enabled but API key missing" "export ${api_key_var}='your-api-key'"
|
|
293
295
|
check_fail
|
|
294
|
-
return
|
|
296
|
+
return 0
|
|
295
297
|
else
|
|
296
298
|
local masked_key="${api_key:0:4}...${api_key: -4}"
|
|
297
299
|
_print " ✓ $name: API mode (key: $masked_key)"
|
|
@@ -308,7 +310,7 @@ check_api_mode_switching() {
|
|
|
308
310
|
local has_api_mode=false
|
|
309
311
|
|
|
310
312
|
# Check switchable consultants
|
|
311
|
-
for agent in GEMINI CODEX CLAUDE MISTRAL QWEN3 MINIMAX; do
|
|
313
|
+
for agent in GEMINI CODEX CLAUDE MISTRAL QWEN3 GROK MINIMAX; do
|
|
312
314
|
local enabled_var="ENABLE_${agent}"
|
|
313
315
|
local use_api_var="${agent}_USE_API"
|
|
314
316
|
local is_enabled="${!enabled_var:-false}"
|
|
@@ -326,6 +328,7 @@ check_api_mode_switching() {
|
|
|
326
328
|
check_api_mode "Claude" "CLAUDE_USE_API" "ANTHROPIC_API_KEY" "ENABLE_CLAUDE"
|
|
327
329
|
check_api_mode "Mistral" "MISTRAL_USE_API" "MISTRAL_API_KEY" "ENABLE_MISTRAL"
|
|
328
330
|
check_api_mode "Qwen3" "QWEN3_USE_API" "QWEN3_API_KEY" "ENABLE_QWEN3"
|
|
331
|
+
check_api_mode "Grok" "GROK_USE_API" "GROK_API_KEY" "ENABLE_GROK"
|
|
329
332
|
check_api_mode "MiniMax" "MINIMAX_USE_API" "MINIMAX_API_KEY" "ENABLE_MINIMAX"
|
|
330
333
|
else
|
|
331
334
|
_print " ○ All switchable consultants using CLI mode"
|
|
@@ -357,7 +360,7 @@ check_api_consultant() {
|
|
|
357
360
|
_print " ✗ $name: API key not set"
|
|
358
361
|
add_issue "api" "$name API key not configured" "export ${api_key_var}='your-api-key'"
|
|
359
362
|
check_fail
|
|
360
|
-
return
|
|
363
|
+
return 0
|
|
361
364
|
fi
|
|
362
365
|
|
|
363
366
|
# Mask API key for display
|
|
@@ -383,7 +386,6 @@ check_api_consultants() {
|
|
|
383
386
|
print_section "Checking API-only Consultants"
|
|
384
387
|
|
|
385
388
|
check_api_consultant "GLM" "GLM_API_KEY" "GLM_API_URL" "ENABLE_GLM"
|
|
386
|
-
check_api_consultant "Grok" "GROK_API_KEY" "GROK_API_URL" "ENABLE_GROK"
|
|
387
389
|
check_api_consultant "DeepSeek" "DEEPSEEK_API_KEY" "DEEPSEEK_API_URL" "ENABLE_DEEPSEEK"
|
|
388
390
|
}
|
|
389
391
|
|
|
@@ -773,6 +775,7 @@ suggest_configuration() {
|
|
|
773
775
|
"ENABLE_KIMI:${KIMI_CMD:-kimi}"
|
|
774
776
|
"ENABLE_CLAUDE:${CLAUDE_CMD:-claude}"
|
|
775
777
|
"ENABLE_QWEN3:${QWEN3_CMD:-qwen}"
|
|
778
|
+
"ENABLE_GROK:${GROK_CMD:-grok}"
|
|
776
779
|
"ENABLE_MINIMAX:${MINIMAX_CMD:-mmx}"
|
|
777
780
|
)
|
|
778
781
|
|
|
@@ -781,7 +784,8 @@ suggest_configuration() {
|
|
|
781
784
|
for entry in "${consultant_clis[@]}"; do
|
|
782
785
|
local flag="${entry%%:*}"
|
|
783
786
|
local cmd="${entry##*:}"
|
|
784
|
-
if command -v "$cmd" >/dev/null 2>&1
|
|
787
|
+
if command -v "$cmd" >/dev/null 2>&1 || \
|
|
788
|
+
[[ "$flag" == "ENABLE_GROK" && -n "${GROK_API_KEY:-}" ]]; then
|
|
785
789
|
lines+=("${flag}=true")
|
|
786
790
|
((available_count++)) || true
|
|
787
791
|
else
|
|
@@ -792,7 +796,6 @@ suggest_configuration() {
|
|
|
792
796
|
# API-only consultants: enable if API key is set
|
|
793
797
|
local api_consultants=(
|
|
794
798
|
"ENABLE_GLM:GLM_API_KEY"
|
|
795
|
-
"ENABLE_GROK:GROK_API_KEY"
|
|
796
799
|
"ENABLE_DEEPSEEK:DEEPSEEK_API_KEY"
|
|
797
800
|
)
|
|
798
801
|
for entry in "${api_consultants[@]}"; do
|
|
@@ -856,13 +859,15 @@ _count_available_consultants() {
|
|
|
856
859
|
"KIMI|ENABLE_KIMI|${KIMI_CMD:-kimi}"
|
|
857
860
|
"CLAUDE|ENABLE_CLAUDE|${CLAUDE_CMD:-claude}"
|
|
858
861
|
"QWEN3|ENABLE_QWEN3|${QWEN3_CMD:-qwen}"
|
|
862
|
+
"GROK|ENABLE_GROK|${GROK_CMD:-grok}"
|
|
859
863
|
"MINIMAX|ENABLE_MINIMAX|${MINIMAX_CMD:-mmx}"
|
|
860
864
|
)
|
|
861
865
|
for entry in "${entries[@]}"; do
|
|
862
866
|
IFS='|' read -r name flag cmd <<<"$entry"
|
|
863
867
|
local enabled="${!flag:-false}"
|
|
864
868
|
[[ "$enabled" != "true" ]] && continue
|
|
865
|
-
if command -v "$cmd" >/dev/null 2>&1
|
|
869
|
+
if command -v "$cmd" >/dev/null 2>&1 || \
|
|
870
|
+
[[ "$name" == "GROK" && -n "${GROK_API_KEY:-}" ]]; then
|
|
866
871
|
[[ "$name" == "$invoker_consultant" ]] && continue
|
|
867
872
|
((count++)) || true
|
|
868
873
|
fi
|
|
@@ -871,7 +876,6 @@ _count_available_consultants() {
|
|
|
871
876
|
# API-only consultants: enabled flag + API key both required
|
|
872
877
|
local api_entries=(
|
|
873
878
|
"GLM|ENABLE_GLM|GLM_API_KEY"
|
|
874
|
-
"GROK|ENABLE_GROK|GROK_API_KEY"
|
|
875
879
|
"DEEPSEEK|ENABLE_DEEPSEEK|DEEPSEEK_API_KEY"
|
|
876
880
|
)
|
|
877
881
|
for entry in "${api_entries[@]}"; do
|
package/scripts/lib/common.sh
CHANGED
|
@@ -274,8 +274,8 @@ to_title() {
|
|
|
274
274
|
|
|
275
275
|
# Central list of known/predefined agents (to distinguish from custom ones)
|
|
276
276
|
# This list is used by discovery functions to identify custom agents
|
|
277
|
-
KNOWN_CLI_AGENTS="GEMINI CODEX MISTRAL CURSOR KIMI CLAUDE QWEN3 MINIMAX"
|
|
278
|
-
KNOWN_API_AGENTS="GLM
|
|
277
|
+
KNOWN_CLI_AGENTS="GEMINI CODEX MISTRAL CURSOR KIMI CLAUDE QWEN3 GROK MINIMAX"
|
|
278
|
+
KNOWN_API_AGENTS="GLM DEEPSEEK"
|
|
279
279
|
|
|
280
280
|
# Every non-consultant ENABLE_* flag declared in config.sh. This is a denylist
|
|
281
281
|
# guarding _discover_custom_api_agents (consult_all.sh): that function walks
|
|
@@ -351,6 +351,8 @@ validate_api_mode() {
|
|
|
351
351
|
CLAUDE) api_key_var="ANTHROPIC_API_KEY" ;;
|
|
352
352
|
MISTRAL) api_key_var="MISTRAL_API_KEY" ;;
|
|
353
353
|
QWEN3) api_key_var="QWEN3_API_KEY" ;;
|
|
354
|
+
GROK) api_key_var="GROK_API_KEY" ;;
|
|
355
|
+
MINIMAX) api_key_var="MINIMAX_API_KEY" ;;
|
|
354
356
|
*)
|
|
355
357
|
log_error "Unknown agent for API mode: $agent"
|
|
356
358
|
return 1
|
|
@@ -465,11 +467,9 @@ get_api_format() {
|
|
|
465
467
|
# Warn when a reasoning-effort setting cannot be delivered on the CLI transport.
|
|
466
468
|
# Usage: warn_effort_ignored_in_cli <agent_name>
|
|
467
469
|
#
|
|
468
|
-
# api_query.sh reads ${AGENT}_REASONING_EFFORT generically
|
|
469
|
-
# accept the variable in API mode. CLI
|
|
470
|
-
#
|
|
471
|
-
# it lived in query_qwen3.sh alone, leaving the other five with the silent
|
|
472
|
-
# no-op this feature exists to avoid.
|
|
470
|
+
# api_query.sh reads ${AGENT}_REASONING_EFFORT generically for API transports,
|
|
471
|
+
# accept the variable in API mode. CLI adapters that cannot express the setting
|
|
472
|
+
# use this diagnostic instead of silently ignoring it.
|
|
473
473
|
warn_effort_ignored_in_cli() {
|
|
474
474
|
local agent="$1"
|
|
475
475
|
local agent_upper
|
|
@@ -1210,7 +1210,7 @@ is_consultant_enabled() {
|
|
|
1210
1210
|
# Get default based on consultant type
|
|
1211
1211
|
local default="true"
|
|
1212
1212
|
case "$name_upper" in
|
|
1213
|
-
GLM|
|
|
1213
|
+
GLM|DEEPSEEK)
|
|
1214
1214
|
default="false"
|
|
1215
1215
|
;;
|
|
1216
1216
|
esac
|
package/scripts/query_grok.sh
CHANGED
|
@@ -1,17 +1,226 @@
|
|
|
1
1
|
#!/bin/bash
|
|
2
|
-
# query_grok.sh - Query Grok
|
|
2
|
+
# query_grok.sh - Query Grok Build CLI, with xAI API fallback
|
|
3
3
|
#
|
|
4
4
|
# Usage: ./query_grok.sh "question" [context_file] [output_file]
|
|
5
5
|
#
|
|
6
6
|
# Environment variables:
|
|
7
|
-
#
|
|
8
|
-
# GROK_MODEL - Model to use (default: grok-4.
|
|
7
|
+
# GROK_CMD - Grok Build command (default: grok)
|
|
8
|
+
# GROK_MODEL - Model to use in both transports (default: grok-4.5)
|
|
9
9
|
# GROK_TIMEOUT - Timeout in seconds (default: 180)
|
|
10
|
+
# GROK_USE_API - Force the API path when true (default: CLI-first auto)
|
|
11
|
+
# GROK_API_KEY - xAI API key used by the fallback
|
|
12
|
+
# XAI_API_KEY - Official xAI key name; accepted as a GROK_API_KEY alias
|
|
10
13
|
# ENABLE_PERSONA - Enable "The Provocateur" persona (default: true)
|
|
11
14
|
|
|
12
15
|
set -euo pipefail
|
|
13
16
|
|
|
14
17
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
15
|
-
source "$SCRIPT_DIR/lib/
|
|
18
|
+
source "$SCRIPT_DIR/lib/common.sh"
|
|
19
|
+
source "$SCRIPT_DIR/lib/personas.sh"
|
|
16
20
|
|
|
17
|
-
|
|
21
|
+
QUERY="${1:-}"
|
|
22
|
+
CONTEXT_FILE="${2:-}"
|
|
23
|
+
OUTPUT_FILE="${3:-/tmp/grok_response.json}"
|
|
24
|
+
|
|
25
|
+
ENABLE_PERSONA="${ENABLE_PERSONA:-true}"
|
|
26
|
+
CONSULTANT_NAME="Grok"
|
|
27
|
+
|
|
28
|
+
FULL_QUERY=$(build_full_query "$QUERY" "$CONTEXT_FILE")
|
|
29
|
+
validate_query "$FULL_QUERY" "$CONSULTANT_NAME" || exit 1
|
|
30
|
+
|
|
31
|
+
if [[ "$ENABLE_PERSONA" == "true" ]]; then
|
|
32
|
+
FULL_QUERY=$(build_query_with_persona "$CONSULTANT_NAME" "$FULL_QUERY")
|
|
33
|
+
fi
|
|
34
|
+
|
|
35
|
+
START_TIME=$(get_timestamp_ms)
|
|
36
|
+
TEMP_OUTPUT=$(mktemp)
|
|
37
|
+
GROK_RUNTIME_DIR=""
|
|
38
|
+
TRANSPORT="cli"
|
|
39
|
+
exit_code=1
|
|
40
|
+
|
|
41
|
+
cleanup() {
|
|
42
|
+
rm -f "$TEMP_OUTPUT" "${TEMP_OUTPUT}.err"
|
|
43
|
+
|
|
44
|
+
# GROK_RUNTIME_DIR is always created by this script under the system temp
|
|
45
|
+
# directory. Validate the prefix before recursive cleanup so an unexpected
|
|
46
|
+
# empty or overridden value can never widen the deletion target.
|
|
47
|
+
local temp_prefix="${TMPDIR:-/tmp}"
|
|
48
|
+
temp_prefix="${temp_prefix%/}/ai-consultants-grok."
|
|
49
|
+
if [[ -n "$GROK_RUNTIME_DIR" && "$GROK_RUNTIME_DIR" == "$temp_prefix"* ]]; then
|
|
50
|
+
rm -rf -- "$GROK_RUNTIME_DIR"
|
|
51
|
+
fi
|
|
52
|
+
}
|
|
53
|
+
trap cleanup EXIT
|
|
54
|
+
|
|
55
|
+
run_grok_api() {
|
|
56
|
+
source "$SCRIPT_DIR/lib/api_query.sh"
|
|
57
|
+
: > "$TEMP_OUTPUT"
|
|
58
|
+
if run_api_mode_query \
|
|
59
|
+
"$CONSULTANT_NAME" \
|
|
60
|
+
"$GROK_MODEL" \
|
|
61
|
+
"$FULL_QUERY" \
|
|
62
|
+
"$TEMP_OUTPUT" \
|
|
63
|
+
"$GROK_TIMEOUT_SECONDS"; then
|
|
64
|
+
return 0
|
|
65
|
+
else
|
|
66
|
+
return $?
|
|
67
|
+
fi
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
grok_cli_is_unavailable() {
|
|
71
|
+
local cli_exit_code="$1"
|
|
72
|
+
local error_file="$2"
|
|
73
|
+
|
|
74
|
+
# A missing command is detected before execution. 126/127 cover a binary
|
|
75
|
+
# that was resolved but cannot be executed (bad interpreter, permissions,
|
|
76
|
+
# or a race with an uninstall).
|
|
77
|
+
case "$cli_exit_code" in
|
|
78
|
+
126|127) return 0 ;;
|
|
79
|
+
esac
|
|
80
|
+
|
|
81
|
+
[[ -s "$error_file" ]] || return 1
|
|
82
|
+
|
|
83
|
+
# Authentication is part of CLI availability: without a usable Grok Build
|
|
84
|
+
# login the subscription transport cannot start a request. Do not classify
|
|
85
|
+
# model errors, timeouts, empty output, or other post-launch failures here;
|
|
86
|
+
# those must surface instead of silently creating a billable API request.
|
|
87
|
+
grep -Eiq \
|
|
88
|
+
'not authenticated|authentication( is)? required|authentication failed|unauthorized|run .?grok login|please .*log ?in|no (valid )?(credentials|access token)|missing .*credential|token.*expired|(^|[^0-9])401([^0-9]|$)|permission denied|cannot execute|exec format error|no such file or directory|failed to (start|launch|spawn)|could not (start|launch|spawn)' \
|
|
89
|
+
"$error_file"
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
if is_api_mode "grok"; then
|
|
93
|
+
log_api_mode_status "grok"
|
|
94
|
+
TRANSPORT="api"
|
|
95
|
+
if run_grok_api; then
|
|
96
|
+
exit_code=0
|
|
97
|
+
else
|
|
98
|
+
exit_code=$?
|
|
99
|
+
fi
|
|
100
|
+
else
|
|
101
|
+
log_api_mode_status "grok"
|
|
102
|
+
|
|
103
|
+
if command -v "$GROK_CMD" >/dev/null 2>&1; then
|
|
104
|
+
runtime_base="${TMPDIR:-/tmp}"
|
|
105
|
+
runtime_base="${runtime_base%/}"
|
|
106
|
+
GROK_RUNTIME_DIR=$(mktemp -d "$runtime_base/ai-consultants-grok.XXXXXX")
|
|
107
|
+
chmod 700 "$GROK_RUNTIME_DIR"
|
|
108
|
+
|
|
109
|
+
isolated_home="$GROK_RUNTIME_DIR/home"
|
|
110
|
+
isolated_grok_home="$isolated_home/.grok"
|
|
111
|
+
isolated_workspace="$GROK_RUNTIME_DIR/workspace"
|
|
112
|
+
prompt_file="$GROK_RUNTIME_DIR/prompt.txt"
|
|
113
|
+
mkdir -p "$isolated_grok_home" "$isolated_workspace"
|
|
114
|
+
chmod 700 "$isolated_home" "$isolated_grok_home" "$isolated_workspace"
|
|
115
|
+
printf '%s' "$FULL_QUERY" > "$prompt_file"
|
|
116
|
+
chmod 600 "$prompt_file"
|
|
117
|
+
|
|
118
|
+
# Preserve only the credential needed to use the installed CLI. All
|
|
119
|
+
# config, plugins, hooks, MCP servers, skills, memories, and project
|
|
120
|
+
# instructions stay outside the isolated HOME/CWD.
|
|
121
|
+
source_grok_home=$(printenv GROK_HOME 2>/dev/null || true)
|
|
122
|
+
[[ -n "$source_grok_home" ]] || source_grok_home="${HOME}/.grok"
|
|
123
|
+
if [[ -f "$source_grok_home/auth.json" && ! -L "$source_grok_home/auth.json" ]]; then
|
|
124
|
+
if cp "$source_grok_home/auth.json" "$isolated_grok_home/auth.json"; then
|
|
125
|
+
chmod 600 "$isolated_grok_home/auth.json"
|
|
126
|
+
else
|
|
127
|
+
log_warn "[$CONSULTANT_NAME] Could not copy the Grok CLI credential into the isolated runtime"
|
|
128
|
+
fi
|
|
129
|
+
fi
|
|
130
|
+
|
|
131
|
+
# Official Grok Build headless contract:
|
|
132
|
+
# --prompt-file avoids argv size/process-list exposure, -m pins the
|
|
133
|
+
# model, and plain output contains the final assistant text.
|
|
134
|
+
# dontAsk + strict sandbox make every unapproved tool fail closed.
|
|
135
|
+
GROK_ARGS=(
|
|
136
|
+
env
|
|
137
|
+
HOME="$isolated_home"
|
|
138
|
+
GROK_HOME="$isolated_grok_home"
|
|
139
|
+
"$GROK_CMD"
|
|
140
|
+
--prompt-file "$prompt_file"
|
|
141
|
+
-m "$GROK_MODEL"
|
|
142
|
+
--cwd "$isolated_workspace"
|
|
143
|
+
--output-format plain
|
|
144
|
+
--no-plan
|
|
145
|
+
--no-subagents
|
|
146
|
+
--no-memory
|
|
147
|
+
--disable-web-search
|
|
148
|
+
--max-turns 1
|
|
149
|
+
--permission-mode dontAsk
|
|
150
|
+
--sandbox strict
|
|
151
|
+
--tools ""
|
|
152
|
+
--deny Bash
|
|
153
|
+
--deny Edit
|
|
154
|
+
--deny Read
|
|
155
|
+
--deny Grep
|
|
156
|
+
--deny MCPTool
|
|
157
|
+
--deny WebFetch
|
|
158
|
+
--deny WebSearch
|
|
159
|
+
--verbatim
|
|
160
|
+
)
|
|
161
|
+
|
|
162
|
+
# Newer Grok Build releases document --no-auto-update for automation;
|
|
163
|
+
# keep compatibility with older installed builds that do not expose it.
|
|
164
|
+
if "$GROK_CMD" --help 2>&1 | grep -q -- '--no-auto-update'; then
|
|
165
|
+
GROK_ARGS+=("--no-auto-update")
|
|
166
|
+
fi
|
|
167
|
+
|
|
168
|
+
if run_query \
|
|
169
|
+
"$CONSULTANT_NAME" \
|
|
170
|
+
"$TEMP_OUTPUT" \
|
|
171
|
+
"$GROK_TIMEOUT_SECONDS" \
|
|
172
|
+
"${GROK_ARGS[@]}" </dev/null; then
|
|
173
|
+
exit_code=0
|
|
174
|
+
else
|
|
175
|
+
exit_code=$?
|
|
176
|
+
fi
|
|
177
|
+
else
|
|
178
|
+
log_warn "[$CONSULTANT_NAME] Grok Build CLI not found: $GROK_CMD"
|
|
179
|
+
exit_code=127
|
|
180
|
+
fi
|
|
181
|
+
|
|
182
|
+
# Fall back only when the CLI transport is genuinely unavailable. A timeout,
|
|
183
|
+
# model error, empty reply, or other post-launch failure is returned as-is so
|
|
184
|
+
# it cannot silently turn into a separately billed API request.
|
|
185
|
+
if [[ $exit_code -ne 0 ]] \
|
|
186
|
+
&& grok_cli_is_unavailable "$exit_code" "${TEMP_OUTPUT}.err" \
|
|
187
|
+
&& [[ -n "${GROK_API_KEY:-}" ]]; then
|
|
188
|
+
log_warn "[$CONSULTANT_NAME] Grok Build CLI unavailable (exit $exit_code); falling back to the xAI API"
|
|
189
|
+
TRANSPORT="api_fallback"
|
|
190
|
+
if run_grok_api; then
|
|
191
|
+
exit_code=0
|
|
192
|
+
else
|
|
193
|
+
exit_code=$?
|
|
194
|
+
fi
|
|
195
|
+
elif [[ $exit_code -ne 0 && -n "${GROK_API_KEY:-}" ]]; then
|
|
196
|
+
log_warn "[$CONSULTANT_NAME] Grok Build request failed after launch; API fallback suppressed"
|
|
197
|
+
fi
|
|
198
|
+
fi
|
|
199
|
+
|
|
200
|
+
END_TIME=$(get_timestamp_ms)
|
|
201
|
+
LATENCY_MS=$((END_TIME - START_TIME))
|
|
202
|
+
PERSONA_NAME=$(get_persona_name "$CONSULTANT_NAME")
|
|
203
|
+
|
|
204
|
+
# The response builder intentionally returns the consultant exit code. Keep it
|
|
205
|
+
# inside a conditional so `set -e` cannot skip transport metadata and cleanup
|
|
206
|
+
# on the failure path.
|
|
207
|
+
if process_consultant_response "$CONSULTANT_NAME" "$GROK_MODEL" "$PERSONA_NAME" \
|
|
208
|
+
"$TEMP_OUTPUT" "$OUTPUT_FILE" "$exit_code" "$LATENCY_MS" "" "$FULL_QUERY"; then
|
|
209
|
+
:
|
|
210
|
+
else
|
|
211
|
+
:
|
|
212
|
+
fi
|
|
213
|
+
|
|
214
|
+
# Preserve which route actually answered without changing the shared schema.
|
|
215
|
+
if [[ -s "$OUTPUT_FILE" ]]; then
|
|
216
|
+
response_tmp=$(mktemp)
|
|
217
|
+
if jq --arg transport "$TRANSPORT" '.metadata.transport = $transport' \
|
|
218
|
+
"$OUTPUT_FILE" > "$response_tmp"; then
|
|
219
|
+
mv "$response_tmp" "$OUTPUT_FILE"
|
|
220
|
+
else
|
|
221
|
+
rm -f "$response_tmp"
|
|
222
|
+
fi
|
|
223
|
+
fi
|
|
224
|
+
|
|
225
|
+
cat "$OUTPUT_FILE"
|
|
226
|
+
exit $exit_code
|
package/scripts/update_clis.sh
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
# With no flags it updates every installed supported CLI, best-effort: a failure
|
|
19
19
|
# on one CLI is reported and the rest still run. Some updates run the CLI's
|
|
20
20
|
# official installer (curl | bash) -- use --dry-run first to see what will run.
|
|
21
|
-
# API-only consultants (GLM,
|
|
21
|
+
# API-only consultants (GLM, DeepSeek) have no CLI and are not listed here.
|
|
22
22
|
set -uo pipefail
|
|
23
23
|
|
|
24
24
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
@@ -39,6 +39,7 @@ _CLI_ENTRIES=(
|
|
|
39
39
|
"Kimi|KIMI_CMD|kimi"
|
|
40
40
|
"Claude|CLAUDE_CMD|claude"
|
|
41
41
|
"Qwen3|QWEN3_CMD|qwen"
|
|
42
|
+
"Grok|GROK_CMD|grok"
|
|
42
43
|
"MiniMax|MINIMAX_CMD|mmx"
|
|
43
44
|
)
|
|
44
45
|
|
|
@@ -66,6 +67,7 @@ _cli_meta() {
|
|
|
66
67
|
kimi) SELF_SUB="upgrade"; INSTALLER="curl -fsSL https://code.kimi.com/kimi-code/install.sh | bash" ;;
|
|
67
68
|
claude) BREW_CASK="claude-code@latest"; NPM_PKG="@anthropic-ai/claude-code"; SELF_SUB="update" ;;
|
|
68
69
|
qwen) NPM_PKG="@qwen-code/qwen-code" ;;
|
|
70
|
+
grok) SELF_SUB="update"; INSTALLER="curl -fsSL https://x.ai/cli/install.sh | bash" ;;
|
|
69
71
|
mmx) NPM_PKG="mmx-cli"; SELF_SUB="update" ;;
|
|
70
72
|
esac
|
|
71
73
|
}
|