This release represents a comprehensive transformation of the codebase from Codex to LLMX, enhanced with LiteLLM integration to support 100+ LLM providers through a unified API. ## Major Changes ### Phase 1: Repository & Infrastructure Setup - Established new repository structure and branching strategy - Created comprehensive project documentation (CLAUDE.md, LITELLM-SETUP.md) - Set up development environment and tooling configuration ### Phase 2: Rust Workspace Transformation - Renamed all Rust crates from `codex-*` to `llmx-*` (30+ crates) - Updated package names, binary names, and workspace members - Renamed core modules: codex.rs → llmx.rs, codex_delegate.rs → llmx_delegate.rs - Updated all internal references, imports, and type names - Renamed directories: codex-rs/ → llmx-rs/, codex-backend-openapi-models/ → llmx-backend-openapi-models/ - Fixed all Rust compilation errors after mass rename ### Phase 3: LiteLLM Integration - Integrated LiteLLM for multi-provider LLM support (Anthropic, OpenAI, Azure, Google AI, AWS Bedrock, etc.) - Implemented OpenAI-compatible Chat Completions API support - Added model family detection and provider-specific handling - Updated authentication to support LiteLLM API keys - Renamed environment variables: OPENAI_BASE_URL → LLMX_BASE_URL - Added LLMX_API_KEY for unified authentication - Enhanced error handling for Chat Completions API responses - Implemented fallback mechanisms between Responses API and Chat Completions API ### Phase 4: TypeScript/Node.js Components - Renamed npm package: @codex/codex-cli → @valknar/llmx - Updated TypeScript SDK to use new LLMX APIs and endpoints - Fixed all TypeScript compilation and linting errors - Updated SDK tests to support both API backends - Enhanced mock server to handle multiple API formats - Updated build scripts for cross-platform packaging ### Phase 5: Configuration & Documentation - Updated all configuration files to use LLMX naming - Rewrote README and documentation for LLMX branding - Updated config paths: ~/.codex/ → ~/.llmx/ - Added comprehensive LiteLLM setup guide - Updated all user-facing strings and help text - Created release plan and migration documentation ### Phase 6: Testing & Validation - Fixed all Rust tests for new naming scheme - Updated snapshot tests in TUI (36 frame files) - Fixed authentication storage tests - Updated Chat Completions payload and SSE tests - Fixed SDK tests for new API endpoints - Ensured compatibility with Claude Sonnet 4.5 model - Fixed test environment variables (LLMX_API_KEY, LLMX_BASE_URL) ### Phase 7: Build & Release Pipeline - Updated GitHub Actions workflows for LLMX binary names - Fixed rust-release.yml to reference llmx-rs/ instead of codex-rs/ - Updated CI/CD pipelines for new package names - Made Apple code signing optional in release workflow - Enhanced npm packaging resilience for partial platform builds - Added Windows sandbox support to workspace - Updated dotslash configuration for new binary names ### Phase 8: Final Polish - Renamed all assets (.github images, labels, templates) - Updated VSCode and DevContainer configurations - Fixed all clippy warnings and formatting issues - Applied cargo fmt and prettier formatting across codebase - Updated issue templates and pull request templates - Fixed all remaining UI text references ## Technical Details **Breaking Changes:** - Binary name changed from `codex` to `llmx` - Config directory changed from `~/.codex/` to `~/.llmx/` - Environment variables renamed (CODEX_* → LLMX_*) - npm package renamed to `@valknar/llmx` **New Features:** - Support for 100+ LLM providers via LiteLLM - Unified authentication with LLMX_API_KEY - Enhanced model provider detection and handling - Improved error handling and fallback mechanisms **Files Changed:** - 578 files modified across Rust, TypeScript, and documentation - 30+ Rust crates renamed and updated - Complete rebrand of UI, CLI, and documentation - All tests updated and passing **Dependencies:** - Updated Cargo.lock with new package names - Updated npm dependencies in llmx-cli - Enhanced OpenAPI models for LLMX backend This release establishes LLMX as a standalone project with comprehensive LiteLLM integration, maintaining full backward compatibility with existing functionality while opening support for a wide ecosystem of LLM providers. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> Co-Authored-By: Sebastian Krüger <support@pivoine.art>
159 lines
5.1 KiB
Rust
159 lines
5.1 KiB
Rust
use std::path::PathBuf;
|
|
use std::sync::Arc;
|
|
|
|
use llmx_core::LlmxConversation;
|
|
use llmx_core::protocol::Op;
|
|
use llmx_core::protocol::ReviewDecision;
|
|
use llmx_core::protocol::SandboxCommandAssessment;
|
|
use llmx_protocol::parse_command::ParsedCommand;
|
|
use mcp_types::ElicitRequest;
|
|
use mcp_types::ElicitRequestParamsRequestedSchema;
|
|
use mcp_types::JSONRPCErrorError;
|
|
use mcp_types::ModelContextProtocolRequest;
|
|
use mcp_types::RequestId;
|
|
use serde::Deserialize;
|
|
use serde::Serialize;
|
|
use serde_json::json;
|
|
use tracing::error;
|
|
|
|
use crate::llmx_tool_runner::INVALID_PARAMS_ERROR_CODE;
|
|
|
|
/// Conforms to [`mcp_types::ElicitRequestParams`] so that it can be used as the
|
|
/// `params` field of an [`ElicitRequest`].
|
|
#[derive(Debug, Deserialize, Serialize)]
|
|
pub struct ExecApprovalElicitRequestParams {
|
|
// These fields are required so that `params`
|
|
// conforms to ElicitRequestParams.
|
|
pub message: String,
|
|
|
|
#[serde(rename = "requestedSchema")]
|
|
pub requested_schema: ElicitRequestParamsRequestedSchema,
|
|
|
|
// These are additional fields the client can use to
|
|
// correlate the request with the llmx tool call.
|
|
pub llmx_elicitation: String,
|
|
pub llmx_mcp_tool_call_id: String,
|
|
pub llmx_event_id: String,
|
|
pub llmx_call_id: String,
|
|
pub llmx_command: Vec<String>,
|
|
pub llmx_cwd: PathBuf,
|
|
pub llmx_parsed_cmd: Vec<ParsedCommand>,
|
|
#[serde(skip_serializing_if = "Option::is_none")]
|
|
pub llmx_risk: Option<SandboxCommandAssessment>,
|
|
}
|
|
|
|
// TODO(mbolin): ExecApprovalResponse does not conform to ElicitResult. See:
|
|
// - https://github.com/modelcontextprotocol/modelcontextprotocol/blob/f962dc1780fa5eed7fb7c8a0232f1fc83ef220cd/schema/2025-06-18/schema.json#L617-L636
|
|
// - https://modelcontextprotocol.io/specification/draft/client/elicitation#protocol-messages
|
|
// It should have "action" and "content" fields.
|
|
#[derive(Debug, Serialize, Deserialize)]
|
|
pub struct ExecApprovalResponse {
|
|
pub decision: ReviewDecision,
|
|
}
|
|
|
|
#[allow(clippy::too_many_arguments)]
|
|
pub(crate) async fn handle_exec_approval_request(
|
|
command: Vec<String>,
|
|
cwd: PathBuf,
|
|
outgoing: Arc<crate::outgoing_message::OutgoingMessageSender>,
|
|
llmx: Arc<LlmxConversation>,
|
|
request_id: RequestId,
|
|
tool_call_id: String,
|
|
event_id: String,
|
|
call_id: String,
|
|
llmx_parsed_cmd: Vec<ParsedCommand>,
|
|
llmx_risk: Option<SandboxCommandAssessment>,
|
|
) {
|
|
let escaped_command =
|
|
shlex::try_join(command.iter().map(String::as_str)).unwrap_or_else(|_| command.join(" "));
|
|
let message = format!(
|
|
"Allow LLMX to run `{escaped_command}` in `{cwd}`?",
|
|
cwd = cwd.to_string_lossy()
|
|
);
|
|
|
|
let params = ExecApprovalElicitRequestParams {
|
|
message,
|
|
requested_schema: ElicitRequestParamsRequestedSchema {
|
|
r#type: "object".to_string(),
|
|
properties: json!({}),
|
|
required: None,
|
|
},
|
|
llmx_elicitation: "exec-approval".to_string(),
|
|
llmx_mcp_tool_call_id: tool_call_id.clone(),
|
|
llmx_event_id: event_id.clone(),
|
|
llmx_call_id: call_id,
|
|
llmx_command: command,
|
|
llmx_cwd: cwd,
|
|
llmx_parsed_cmd,
|
|
llmx_risk,
|
|
};
|
|
let params_json = match serde_json::to_value(¶ms) {
|
|
Ok(value) => value,
|
|
Err(err) => {
|
|
let message = format!("Failed to serialize ExecApprovalElicitRequestParams: {err}");
|
|
error!("{message}");
|
|
|
|
outgoing
|
|
.send_error(
|
|
request_id.clone(),
|
|
JSONRPCErrorError {
|
|
code: INVALID_PARAMS_ERROR_CODE,
|
|
message,
|
|
data: None,
|
|
},
|
|
)
|
|
.await;
|
|
|
|
return;
|
|
}
|
|
};
|
|
|
|
let on_response = outgoing
|
|
.send_request(ElicitRequest::METHOD, Some(params_json))
|
|
.await;
|
|
|
|
// Listen for the response on a separate task so we don't block the main agent loop.
|
|
{
|
|
let llmx = llmx.clone();
|
|
let event_id = event_id.clone();
|
|
tokio::spawn(async move {
|
|
on_exec_approval_response(event_id, on_response, llmx).await;
|
|
});
|
|
}
|
|
}
|
|
|
|
async fn on_exec_approval_response(
|
|
event_id: String,
|
|
receiver: tokio::sync::oneshot::Receiver<mcp_types::Result>,
|
|
llmx: Arc<LlmxConversation>,
|
|
) {
|
|
let response = receiver.await;
|
|
let value = match response {
|
|
Ok(value) => value,
|
|
Err(err) => {
|
|
error!("request failed: {err:?}");
|
|
return;
|
|
}
|
|
};
|
|
|
|
// Try to deserialize `value` and then make the appropriate call to `llmx`.
|
|
let response = serde_json::from_value::<ExecApprovalResponse>(value).unwrap_or_else(|err| {
|
|
error!("failed to deserialize ExecApprovalResponse: {err}");
|
|
// If we cannot deserialize the response, we deny the request to be
|
|
// conservative.
|
|
ExecApprovalResponse {
|
|
decision: ReviewDecision::Denied,
|
|
}
|
|
});
|
|
|
|
if let Err(err) = llmx
|
|
.submit(Op::ExecApproval {
|
|
id: event_id,
|
|
decision: response.decision,
|
|
})
|
|
.await
|
|
{
|
|
error!("failed to submit ExecApproval: {err}");
|
|
}
|
|
}
|