mirror of
https://github.com/openai/codex.git
synced 2026-04-24 14:45:27 +00:00
feat: centralize package manager version (#14920)
This commit is contained in:
@@ -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;
|
||||
|
||||
1
codex-rs/core/src/packages/mod.rs
Normal file
1
codex-rs/core/src/packages/mod.rs
Normal file
@@ -0,0 +1 @@
|
||||
pub(crate) mod versions;
|
||||
2
codex-rs/core/src/packages/versions.rs
Normal file
2
codex-rs/core/src/packages/versions.rs
Normal file
@@ -0,0 +1,2 @@
|
||||
/// Pinned versions for package-manager-backed installs.
|
||||
pub(crate) const ARTIFACT_RUNTIME: &str = "2.4.0";
|
||||
@@ -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,
|
||||
))
|
||||
}
|
||||
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user