mirror of
https://github.com/openai/codex.git
synced 2026-11-22 23:00:42 +00:00
## Why The memories extension has several distinct responsibilities: registering its prompt and tool contributors, enforcing local-memory filesystem boundaries, implementing list/read/search behavior, and wrapping that backend as extension tools. Those responsibilities were concentrated in `lib.rs`, `local.rs`, and the tool modules, which made follow-up work harder to review and risked growing files through unrelated edits. This PR reorganizes the crate so each responsibility has a narrower owner while preserving the same extension entrypoint and memory tool behavior. ## What Changed - Moved extension lifecycle, prompt, and tool registration into `src/extension.rs`, leaving `src/lib.rs` as the small crate entrypoint. - Split `LocalMemoriesBackend` helpers into `local/list.rs`, `local/path.rs`, `local/read.rs`, and `local/search.rs`. - Centralized tool names and limits at the crate level, and kept the backend and extension implementation crate-private. - Made `memory_list`, `memory_read`, and `memory_search` tool executors generic over `MemoriesBackend`, so tests can exercise the full executor path without depending on tool internals. - Consolidated and expanded memory extension tests in `src/tests.rs`, including read/search tool output coverage, multi-query search, windowed `all_within_lines`, and legacy `query` rejection. ## Testing - Not run locally.
21 lines
561 B
Rust
21 lines
561 B
Rust
mod backend;
|
|
mod extension;
|
|
mod local;
|
|
mod schema;
|
|
mod tools;
|
|
|
|
pub use extension::install;
|
|
|
|
pub(crate) const DEFAULT_LIST_MAX_RESULTS: usize = 2_000;
|
|
pub(crate) const MAX_LIST_RESULTS: usize = 2_000;
|
|
pub(crate) const DEFAULT_SEARCH_MAX_RESULTS: usize = 200;
|
|
pub(crate) const MAX_SEARCH_RESULTS: usize = 200;
|
|
pub(crate) const DEFAULT_READ_MAX_TOKENS: usize = 20_000;
|
|
|
|
pub(crate) const LIST_TOOL_NAME: &str = "memory_list";
|
|
pub(crate) const READ_TOOL_NAME: &str = "memory_read";
|
|
pub(crate) const SEARCH_TOOL_NAME: &str = "memory_search";
|
|
|
|
#[cfg(test)]
|
|
mod tests;
|