diff --git a/codex-rs/core/src/lib.rs b/codex-rs/core/src/lib.rs index fb432c426b2..2056f0dfe0a 100644 --- a/codex-rs/core/src/lib.rs +++ b/codex-rs/core/src/lib.rs @@ -52,6 +52,7 @@ pub mod models_manager; mod network_policy_decision; pub mod network_proxy_loader; mod original_image_detail; +mod packages; pub use mcp_connection_manager::MCP_SANDBOX_STATE_CAPABILITY; pub use mcp_connection_manager::MCP_SANDBOX_STATE_METHOD; pub use mcp_connection_manager::SandboxState; diff --git a/codex-rs/core/src/packages/mod.rs b/codex-rs/core/src/packages/mod.rs new file mode 100644 index 00000000000..f324a25efa0 --- /dev/null +++ b/codex-rs/core/src/packages/mod.rs @@ -0,0 +1 @@ +pub(crate) mod versions; diff --git a/codex-rs/core/src/packages/versions.rs b/codex-rs/core/src/packages/versions.rs new file mode 100644 index 00000000000..d3cc6ca9a29 --- /dev/null +++ b/codex-rs/core/src/packages/versions.rs @@ -0,0 +1,2 @@ +/// Pinned versions for package-manager-backed installs. +pub(crate) const ARTIFACT_RUNTIME: &str = "2.4.0"; diff --git a/codex-rs/core/src/tools/handlers/artifacts.rs b/codex-rs/core/src/tools/handlers/artifacts.rs index b0cf01ccad1..1d77c3f99b1 100644 --- a/codex-rs/core/src/tools/handlers/artifacts.rs +++ b/codex-rs/core/src/tools/handlers/artifacts.rs @@ -15,6 +15,7 @@ use crate::exec::ExecToolCallOutput; use crate::exec::StreamOutput; use crate::features::Feature; use crate::function_tool::FunctionCallError; +use crate::packages::versions; use crate::protocol::ExecCommandSource; use crate::tools::context::FunctionToolOutput; use crate::tools::context::ToolInvocation; @@ -28,7 +29,6 @@ use crate::tools::registry::ToolKind; const ARTIFACTS_TOOL_NAME: &str = "artifacts"; const ARTIFACTS_PRAGMA_PREFIXES: [&str; 2] = ["// codex-artifacts:", "// codex-artifact-tool:"]; -pub(crate) const PINNED_ARTIFACT_RUNTIME_VERSION: &str = "2.4.0"; const DEFAULT_EXECUTION_TIMEOUT: Duration = Duration::from_secs(30); pub struct ArtifactsHandler; @@ -216,7 +216,7 @@ fn parse_pragma_prefix(line: &str) -> Option<&str> { fn default_runtime_manager(codex_home: std::path::PathBuf) -> ArtifactRuntimeManager { ArtifactRuntimeManager::new(ArtifactRuntimeManagerConfig::with_default_release( codex_home, - PINNED_ARTIFACT_RUNTIME_VERSION, + versions::ARTIFACT_RUNTIME, )) } diff --git a/codex-rs/core/src/tools/handlers/artifacts_tests.rs b/codex-rs/core/src/tools/handlers/artifacts_tests.rs index f28636acc6c..00fb20361be 100644 --- a/codex-rs/core/src/tools/handlers/artifacts_tests.rs +++ b/codex-rs/core/src/tools/handlers/artifacts_tests.rs @@ -1,4 +1,5 @@ use super::*; +use crate::packages::versions; use codex_artifacts::RuntimeEntrypoints; use codex_artifacts::RuntimePathEntry; use tempfile::TempDir; @@ -46,7 +47,7 @@ fn default_runtime_manager_uses_openai_codex_release_base() { ); assert_eq!( manager.config().release().runtime_version(), - PINNED_ARTIFACT_RUNTIME_VERSION + versions::ARTIFACT_RUNTIME ); } @@ -59,14 +60,14 @@ fn load_cached_runtime_reads_pinned_cache_path() { .path() .join("packages") .join("artifacts") - .join(PINNED_ARTIFACT_RUNTIME_VERSION) + .join(versions::ARTIFACT_RUNTIME) .join(platform.as_str()); std::fs::create_dir_all(&install_dir).expect("create install dir"); std::fs::write( install_dir.join("manifest.json"), serde_json::json!({ "schema_version": 1, - "runtime_version": PINNED_ARTIFACT_RUNTIME_VERSION, + "runtime_version": versions::ARTIFACT_RUNTIME, "node": { "relative_path": "node/bin/node" }, "entrypoints": { "build_js": { "relative_path": "artifact-tool/dist/artifact_tool.mjs" }, @@ -95,10 +96,10 @@ fn load_cached_runtime_reads_pinned_cache_path() { &codex_home .path() .join(codex_artifacts::DEFAULT_CACHE_ROOT_RELATIVE), - PINNED_ARTIFACT_RUNTIME_VERSION, + versions::ARTIFACT_RUNTIME, ) .expect("resolve runtime"); - assert_eq!(runtime.runtime_version(), PINNED_ARTIFACT_RUNTIME_VERSION); + assert_eq!(runtime.runtime_version(), versions::ARTIFACT_RUNTIME); assert_eq!( runtime.manifest().entrypoints, RuntimeEntrypoints {