Publish harness and TUI open-source

initial sync from the monorepo
This commit is contained in:
grokkybara[bot] 2026-07-16 06:46:02 +01:00
commit c68e39f604
2734 changed files with 1437016 additions and 0 deletions

View file

@ -0,0 +1,13 @@
[package]
license = "Apache-2.0"
name = "xai-grok-models"
version = "0.1.0"
edition.workspace = true
description = "Default model IDs for the grok CLI, loaded from the embedded default_models.json."
[dependencies]
serde = { workspace = true, features = ["derive"] }
serde_json = { workspace = true }
[lints]
workspace = true

View file

@ -0,0 +1,18 @@
{
"default": "grok-build",
"web_search": "grok-4.20-multi-agent",
"image_description": "grok-build",
"session_summary": "grok-build",
"models": [
{
"model": "grok-build",
"name": "Grok Build",
"description": "Best for advanced coding tasks",
"context_window": 500000,
"temperature": 0.7,
"top_p": 0.95,
"api_backend": "responses",
"supported_in_api": false
}
]
}

View file

@ -0,0 +1,70 @@
//! Default model IDs loaded from `default_models.json` at runtime.
//! Edit that JSON file to change them.
//!
//! At runtime each model is resolved via:
//! CLI flag > ENV var > config.toml > remote settings > these defaults
use std::sync::LazyLock;
/// The raw JSON, embedded at compile time. Re-exported through the
/// `xai_grok_shell::models` facade and consumed by `agent::config`, so it must
/// be `pub` (was `pub(crate)` when this lived inside the shell crate).
pub const DEFAULT_MODELS_JSON: &str = include_str!("../default_models.json");
#[derive(serde::Deserialize)]
struct DefaultModels {
default: String,
/// Falls back to `default` if not specified in JSON.
web_search: Option<String>,
/// Falls back to `default` if not specified in JSON.
image_description: Option<String>,
/// Falls back to `default` if not specified in JSON.
session_summary: Option<String>,
models: Vec<DefaultModelEntry>,
}
#[derive(serde::Deserialize)]
struct DefaultModelEntry {
model: String,
}
static DEFAULTS: LazyLock<DefaultModels> = LazyLock::new(|| {
let defaults: DefaultModels = serde_json::from_str(DEFAULT_MODELS_JSON)
.expect("default_models.json: invalid JSON or missing 'default' field");
// Baked-in JSON — a mismatch here is a developer error, not a runtime condition.
let model_ids: Vec<&str> = defaults.models.iter().map(|m| m.model.as_str()).collect();
assert!(
model_ids.contains(&defaults.default.as_str()),
"default_models.json: 'default' is '{}' but 'models' array only has {model_ids:?}",
defaults.default,
);
defaults
});
/// Primary model for coding tasks and general fallback.
pub fn default_model() -> &'static str {
&DEFAULTS.default
}
/// Model for web search tool synthesis. Falls back to default model.
pub fn default_web_search_model() -> &'static str {
DEFAULTS.web_search.as_deref().unwrap_or(&DEFAULTS.default)
}
/// Model for image describe. Falls back to default model.
pub fn default_image_description_model() -> &'static str {
DEFAULTS
.image_description
.as_deref()
.unwrap_or(&DEFAULTS.default)
}
/// Model for session title generation. Falls back to default model.
pub fn default_session_summary_model() -> &'static str {
DEFAULTS
.session_summary
.as_deref()
.unwrap_or(&DEFAULTS.default)
}