mirror of
https://github.com/openai/codex.git
synced 2026-10-28 18:58:46 +00:00
Define exec-server protocol types for streamed file writes (#49778)
## What changed - Add `read` and `replace` modes to `fs/open`, defaulting omitted modes to `read` for existing callers. - Define `fs/writeBlock` request and response types for offset-based writes, with a maximum decoded chunk size of 1 MiB. - Add the `fileWriteStreaming` capability, defaulting to `false`. Keep writable streams unsupported in the server and explicitly reject replacement opens. ## Testing Add a protocol test verifying that legacy `fs/open` requests without a mode deserialize as read-only opens. GitOrigin-RevId: 4d3997717e821cd1f62df12a03c8eec36332a66d
This commit is contained in:
committed by
copyberry
parent
60947e2341
commit
875bf9209b
@@ -28,6 +28,7 @@ use crate::protocol::FsCreateDirectoryParams;
|
||||
use crate::protocol::FsCreateDirectoryResponse;
|
||||
use crate::protocol::FsGetMetadataParams;
|
||||
use crate::protocol::FsGetMetadataResponse;
|
||||
use crate::protocol::FsOpenMode;
|
||||
use crate::protocol::FsOpenParams;
|
||||
use crate::protocol::FsOpenResponse;
|
||||
use crate::protocol::FsReadBlockParams;
|
||||
@@ -122,6 +123,12 @@ impl FileSystemHandler {
|
||||
params: FsOpenParams,
|
||||
) -> Result<FsOpenResponse, JSONRPCErrorError> {
|
||||
validate_file_handle_id(¶ms.handle_id)?;
|
||||
// TODO(anp): Enable replacement opens when writable file streams are implemented.
|
||||
if params.mode == FsOpenMode::Replace {
|
||||
return Err(invalid_request(
|
||||
"exec-server does not support writable file streams".to_string(),
|
||||
));
|
||||
}
|
||||
let file = self
|
||||
.file_system
|
||||
.open_file_for_read(¶ms.path, params.sandbox.as_ref())
|
||||
|
||||
Reference in New Issue
Block a user