Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions codex-rs/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions codex-rs/apply-patch/src/invocation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ pub async fn maybe_parse_apply_patch_verified(
argv: &[String],
cwd: &AbsolutePathBuf,
fs: &dyn ExecutorFileSystem,
sandbox: Option<&codex_exec_server::FileSystemSandboxContext>,
sandbox: Option<&codex_exec_server::ExecFileSystemSandboxContext>,
) -> MaybeApplyPatchVerified {
// Detect a raw patch body passed directly as the command or as the body of a shell
// script. In these cases, report an explicit error rather than applying the patch.
Expand All @@ -163,7 +163,7 @@ pub async fn verify_apply_patch_args(
args: ApplyPatchArgs,
cwd: &AbsolutePathBuf,
fs: &dyn ExecutorFileSystem,
sandbox: Option<&codex_exec_server::FileSystemSandboxContext>,
sandbox: Option<&codex_exec_server::ExecFileSystemSandboxContext>,
) -> MaybeApplyPatchVerified {
let ApplyPatchArgs {
patch,
Expand Down
24 changes: 12 additions & 12 deletions codex-rs/apply-patch/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ use std::path::PathBuf;
use anyhow::Context;
use anyhow::Result;
use codex_exec_server::CreateDirectoryOptions;
use codex_exec_server::ExecFileSystemSandboxContext;
use codex_exec_server::ExecutorFileSystem;
use codex_exec_server::FileSystemSandboxContext;
use codex_exec_server::RemoveOptions;
use codex_utils_absolute_path::AbsolutePathBuf;
use codex_utils_path_uri::PathUri;
Expand Down Expand Up @@ -280,7 +280,7 @@ pub async fn apply_patch(
stdout: &mut impl std::io::Write,
stderr: &mut impl std::io::Write,
fs: &dyn ExecutorFileSystem,
sandbox: Option<&FileSystemSandboxContext>,
sandbox: Option<&ExecFileSystemSandboxContext>,
) -> Result<AppliedPatchDelta, ApplyPatchFailure> {
let hunks = match parse_patch(patch) {
Ok(source) => source.hunks,
Expand Down Expand Up @@ -319,7 +319,7 @@ pub async fn apply_hunks(
stdout: &mut impl std::io::Write,
stderr: &mut impl std::io::Write,
fs: &dyn ExecutorFileSystem,
sandbox: Option<&FileSystemSandboxContext>,
sandbox: Option<&ExecFileSystemSandboxContext>,
) -> Result<AppliedPatchDelta, ApplyPatchFailure> {
let mut delta = AppliedPatchDelta::empty();
match apply_hunks_to_files(hunks, cwd, fs, sandbox, &mut delta).await {
Expand Down Expand Up @@ -363,7 +363,7 @@ async fn apply_hunks_to_files(
hunks: &[Hunk],
cwd: &AbsolutePathBuf,
fs: &dyn ExecutorFileSystem,
sandbox: Option<&FileSystemSandboxContext>,
sandbox: Option<&ExecFileSystemSandboxContext>,
delta: &mut AppliedPatchDelta,
) -> anyhow::Result<AffectedPaths> {
if hunks.is_empty() {
Expand Down Expand Up @@ -554,7 +554,7 @@ async fn apply_hunks_to_files(
async fn ensure_not_directory(
path: &AbsolutePathBuf,
fs: &dyn ExecutorFileSystem,
sandbox: Option<&FileSystemSandboxContext>,
sandbox: Option<&ExecFileSystemSandboxContext>,
) -> io::Result<()> {
let path_uri = PathUri::from_abs_path(path);
let metadata = fs.get_metadata(&path_uri, sandbox).await?;
Expand All @@ -571,7 +571,7 @@ async fn remove_failure_was_side_effect_free(
path: &AbsolutePathBuf,
expected_content: Option<&str>,
fs: &dyn ExecutorFileSystem,
sandbox: Option<&FileSystemSandboxContext>,
sandbox: Option<&ExecFileSystemSandboxContext>,
) -> bool {
let path_uri = PathUri::from_abs_path(path);
match expected_content {
Expand All @@ -586,7 +586,7 @@ async fn remove_failure_was_side_effect_free(
async fn read_optional_file_text_for_delta(
path: &AbsolutePathBuf,
fs: &dyn ExecutorFileSystem,
sandbox: Option<&FileSystemSandboxContext>,
sandbox: Option<&ExecFileSystemSandboxContext>,
exact: &mut bool,
) -> Option<String> {
note_existing_path_delta_support(path, fs, sandbox, exact).await;
Expand All @@ -604,7 +604,7 @@ async fn read_optional_file_text_for_delta(
async fn note_existing_path_delta_support(
path: &AbsolutePathBuf,
fs: &dyn ExecutorFileSystem,
sandbox: Option<&FileSystemSandboxContext>,
sandbox: Option<&ExecFileSystemSandboxContext>,
exact: &mut bool,
) {
let path_uri = PathUri::from_abs_path(path);
Expand All @@ -620,7 +620,7 @@ async fn write_file_with_missing_parent_retry(
fs: &dyn ExecutorFileSystem,
path_abs: &AbsolutePathBuf,
contents: Vec<u8>,
sandbox: Option<&FileSystemSandboxContext>,
sandbox: Option<&ExecFileSystemSandboxContext>,
) -> anyhow::Result<()> {
let path_uri = PathUri::from_abs_path(path_abs);
match fs.write_file(&path_uri, contents.clone(), sandbox).await {
Expand Down Expand Up @@ -663,7 +663,7 @@ async fn derive_new_contents_from_chunks(
path_abs: &AbsolutePathBuf,
chunks: &[UpdateFileChunk],
fs: &dyn ExecutorFileSystem,
sandbox: Option<&FileSystemSandboxContext>,
sandbox: Option<&ExecFileSystemSandboxContext>,
) -> std::result::Result<AppliedPatch, ApplyPatchError> {
let path_uri = PathUri::from_abs_path(path_abs);
let original_contents = fs.read_file_text(&path_uri, sandbox).await.map_err(|err| {
Expand Down Expand Up @@ -827,7 +827,7 @@ pub async fn unified_diff_from_chunks(
path_abs: &AbsolutePathBuf,
chunks: &[UpdateFileChunk],
fs: &dyn ExecutorFileSystem,
sandbox: Option<&FileSystemSandboxContext>,
sandbox: Option<&ExecFileSystemSandboxContext>,
) -> std::result::Result<ApplyPatchFileUpdate, ApplyPatchError> {
unified_diff_from_chunks_with_context(path_abs, chunks, /*context*/ 1, fs, sandbox).await
}
Expand All @@ -837,7 +837,7 @@ pub async fn unified_diff_from_chunks_with_context(
chunks: &[UpdateFileChunk],
context: usize,
fs: &dyn ExecutorFileSystem,
sandbox: Option<&FileSystemSandboxContext>,
sandbox: Option<&ExecFileSystemSandboxContext>,
) -> std::result::Result<ApplyPatchFileUpdate, ApplyPatchError> {
let AppliedPatch {
original_contents,
Expand Down
18 changes: 9 additions & 9 deletions codex-rs/config/src/loader/tests.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use super::*;
use codex_file_system::CopyOptions;
use codex_file_system::CreateDirectoryOptions;
use codex_file_system::ExecFileSystemSandboxContext;
use codex_file_system::ExecutorFileSystemFuture;
use codex_file_system::FileMetadata;
use codex_file_system::FileSystemSandboxContext;
use codex_file_system::ReadDirectoryEntry;
use codex_file_system::RemoveOptions;
use codex_utils_path_uri::PathUri;
Expand All @@ -16,7 +16,7 @@ impl ExecutorFileSystem for TestFileSystem {
fn canonicalize<'a>(
&'a self,
path: &'a PathUri,
_sandbox: Option<&'a FileSystemSandboxContext>,
_sandbox: Option<&'a ExecFileSystemSandboxContext>,
) -> ExecutorFileSystemFuture<'a, PathUri> {
Box::pin(async move {
let path = path.to_abs_path()?;
Expand All @@ -28,7 +28,7 @@ impl ExecutorFileSystem for TestFileSystem {
fn read_file<'a>(
&'a self,
path: &'a PathUri,
_sandbox: Option<&'a FileSystemSandboxContext>,
_sandbox: Option<&'a ExecFileSystemSandboxContext>,
) -> ExecutorFileSystemFuture<'a, Vec<u8>> {
Box::pin(async move {
let path = path.to_abs_path()?;
Expand All @@ -40,7 +40,7 @@ impl ExecutorFileSystem for TestFileSystem {
&'a self,
_path: &'a PathUri,
_contents: Vec<u8>,
_sandbox: Option<&'a FileSystemSandboxContext>,
_sandbox: Option<&'a ExecFileSystemSandboxContext>,
) -> ExecutorFileSystemFuture<'a, ()> {
Box::pin(async move { unimplemented!("test filesystem only supports reads") })
}
Expand All @@ -49,23 +49,23 @@ impl ExecutorFileSystem for TestFileSystem {
&'a self,
_path: &'a PathUri,
_create_directory_options: CreateDirectoryOptions,
_sandbox: Option<&'a FileSystemSandboxContext>,
_sandbox: Option<&'a ExecFileSystemSandboxContext>,
) -> ExecutorFileSystemFuture<'a, ()> {
Box::pin(async move { unimplemented!("test filesystem only supports reads") })
}

fn get_metadata<'a>(
&'a self,
_path: &'a PathUri,
_sandbox: Option<&'a FileSystemSandboxContext>,
_sandbox: Option<&'a ExecFileSystemSandboxContext>,
) -> ExecutorFileSystemFuture<'a, FileMetadata> {
Box::pin(async move { unimplemented!("test filesystem only supports reads") })
}

fn read_directory<'a>(
&'a self,
_path: &'a PathUri,
_sandbox: Option<&'a FileSystemSandboxContext>,
_sandbox: Option<&'a ExecFileSystemSandboxContext>,
) -> ExecutorFileSystemFuture<'a, Vec<ReadDirectoryEntry>> {
Box::pin(async move { unimplemented!("test filesystem only supports reads") })
}
Expand All @@ -74,7 +74,7 @@ impl ExecutorFileSystem for TestFileSystem {
&'a self,
_path: &'a PathUri,
_remove_options: RemoveOptions,
_sandbox: Option<&'a FileSystemSandboxContext>,
_sandbox: Option<&'a ExecFileSystemSandboxContext>,
) -> ExecutorFileSystemFuture<'a, ()> {
Box::pin(async move { unimplemented!("test filesystem only supports reads") })
}
Expand All @@ -84,7 +84,7 @@ impl ExecutorFileSystem for TestFileSystem {
_source_path: &'a PathUri,
_destination_path: &'a PathUri,
_copy_options: CopyOptions,
_sandbox: Option<&'a FileSystemSandboxContext>,
_sandbox: Option<&'a ExecFileSystemSandboxContext>,
) -> ExecutorFileSystemFuture<'a, ()> {
Box::pin(async move { unimplemented!("test filesystem only supports reads") })
}
Expand Down
18 changes: 9 additions & 9 deletions codex-rs/core-plugins/src/provider_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ use crate::manifest::parse_plugin_manifest;
use codex_exec_server::CopyOptions;
use codex_exec_server::CreateDirectoryOptions;
use codex_exec_server::EnvironmentManager;
use codex_exec_server::ExecFileSystemSandboxContext;
use codex_exec_server::ExecutorFileSystem;
use codex_exec_server::ExecutorFileSystemFuture;
use codex_exec_server::FileMetadata;
use codex_exec_server::FileSystemResult;
use codex_exec_server::FileSystemSandboxContext;
use codex_exec_server::LOCAL_ENVIRONMENT_ID;
use codex_exec_server::ReadDirectoryEntry;
use codex_exec_server::RemoveOptions;
Expand Down Expand Up @@ -65,15 +65,15 @@ impl ExecutorFileSystem for SyntheticPluginFileSystem {
fn canonicalize<'a>(
&'a self,
_path: &'a PathUri,
_sandbox: Option<&'a FileSystemSandboxContext>,
_sandbox: Option<&'a ExecFileSystemSandboxContext>,
) -> ExecutorFileSystemFuture<'a, PathUri> {
Box::pin(async { Self::unsupported() })
}

fn read_file<'a>(
&'a self,
path: &'a PathUri,
_sandbox: Option<&'a FileSystemSandboxContext>,
_sandbox: Option<&'a ExecFileSystemSandboxContext>,
) -> ExecutorFileSystemFuture<'a, Vec<u8>> {
Box::pin(async move {
let path = path.to_abs_path()?;
Expand All @@ -93,7 +93,7 @@ impl ExecutorFileSystem for SyntheticPluginFileSystem {
&'a self,
_path: &'a PathUri,
_contents: Vec<u8>,
_sandbox: Option<&'a FileSystemSandboxContext>,
_sandbox: Option<&'a ExecFileSystemSandboxContext>,
) -> ExecutorFileSystemFuture<'a, ()> {
Box::pin(async { Self::unsupported() })
}
Expand All @@ -102,15 +102,15 @@ impl ExecutorFileSystem for SyntheticPluginFileSystem {
&'a self,
_path: &'a PathUri,
_options: CreateDirectoryOptions,
_sandbox: Option<&'a FileSystemSandboxContext>,
_sandbox: Option<&'a ExecFileSystemSandboxContext>,
) -> ExecutorFileSystemFuture<'a, ()> {
Box::pin(async { Self::unsupported() })
}

fn get_metadata<'a>(
&'a self,
path: &'a PathUri,
_sandbox: Option<&'a FileSystemSandboxContext>,
_sandbox: Option<&'a ExecFileSystemSandboxContext>,
) -> ExecutorFileSystemFuture<'a, FileMetadata> {
Box::pin(async move {
let path = path.to_abs_path()?;
Expand Down Expand Up @@ -139,7 +139,7 @@ impl ExecutorFileSystem for SyntheticPluginFileSystem {
fn read_directory<'a>(
&'a self,
_path: &'a PathUri,
_sandbox: Option<&'a FileSystemSandboxContext>,
_sandbox: Option<&'a ExecFileSystemSandboxContext>,
) -> ExecutorFileSystemFuture<'a, Vec<ReadDirectoryEntry>> {
Box::pin(async { Self::unsupported() })
}
Expand All @@ -148,7 +148,7 @@ impl ExecutorFileSystem for SyntheticPluginFileSystem {
&'a self,
_path: &'a PathUri,
_options: RemoveOptions,
_sandbox: Option<&'a FileSystemSandboxContext>,
_sandbox: Option<&'a ExecFileSystemSandboxContext>,
) -> ExecutorFileSystemFuture<'a, ()> {
Box::pin(async { Self::unsupported() })
}
Expand All @@ -158,7 +158,7 @@ impl ExecutorFileSystem for SyntheticPluginFileSystem {
_source_path: &'a PathUri,
_destination_path: &'a PathUri,
_options: CopyOptions,
_sandbox: Option<&'a FileSystemSandboxContext>,
_sandbox: Option<&'a ExecFileSystemSandboxContext>,
) -> ExecutorFileSystemFuture<'a, ()> {
Box::pin(async { Self::unsupported() })
}
Expand Down
1 change: 1 addition & 0 deletions codex-rs/core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ codex-exec-server = { workspace = true }
codex-extension-api = { workspace = true }
codex-features = { workspace = true }
codex-feedback = { workspace = true }
codex-file-system = { workspace = true }
codex-login = { workspace = true }
codex-memories-read = { workspace = true }
codex-mcp = { workspace = true }
Expand Down
Loading
Loading