Expand description
Patch tool facade that exposes Codex-compatible patch parsing and application.
Actual patch parsing logic lives in tools::editing::patch so future edit
features can reuse the same primitives without depending on this facade.
Re-exports§
pub use crate::tools::editing::Patch;pub use crate::tools::editing::PatchError;pub use crate::tools::editing::PatchHunk;pub use crate::tools::editing::PatchLine;pub use crate::tools::editing::PatchOperation;
Structs§
- Apply
Patch Input - Input structure for the apply_patch tool
- Decoded
Apply Patch Input
Constants§
- APPLY_
PATCH_ ALIAS_ DESCRIPTION - Model-visible description of the
patchalias field. The old value (“Alias for input”) gave the model no format guidance, so it often placed a standard unified diff (---/+++) there — whichapply_patchrejects (checkpoint turn_615). The full envelope and path rules live on the tool description and theinputfield; this alias keeps only the turn_615-critical rejection signal plus the alias relationship, so the same guidance is not sent three times per request. - APPLY_
PATCH_ ARGUMENT_ CORRECTION - APPLY_
PATCH_ TOOL_ DESCRIPTION - Model-visible description of the
apply_patchtool. It leads with the accepted envelope so the model writes the right format on the first try, and states the unified-diff rejection and path rules as plain facts instead of shouted warnings. Registration sites appendSEMANTIC_ANCHOR_GUIDANCEviawith_semantic_anchor_guidance. - DEFAULT_
APPLY_ PATCH_ INPUT_ DESCRIPTION - MAX_
DECODED_ PATCH_ BYTES - Maximum allowed decoded patch size — same as
UNIFIED_FILE_MAX_PAYLOAD_BYTESbut exposed with a more specific name to clarify that it is enforced at decode time, not preflight time. - SEMANTIC_
ANCHOR_ GUIDANCE - UNIFIED_
FILE_ MAX_ PAYLOAD_ BYTES - Hard upper bound for any single
apply_patchpayload after base64 decoding. The preflight cap mirrors this same value; both share the same env-var override. - UNIFIED_
FILE_ MAX_ PAYLOAD_ BYTES_ ENV - Env var name that overrides both the preflight cap and the post-decode cap.
Functions§
- decode_
apply_ patch_ input - effective_
max_ payload_ bytes - Resolve the effective cap, honoring the env-var override. A 1 KiB safety
floor is enforced so a sub-floor override can never silently disable the
post-decode cap; values below the floor fall back to the default. The same
floor is applied by the preflight resolver in
execution_kernelso both stages agree on the effective cap. - mutation_
target_ paths - Extract filesystem paths affected by a mutating tool call.
- parameter_
schema - patch_
mutation_ target_ paths - Return every path mutated by an already-parsed patch.
- patch_
source_ from_ args - with_
semantic_ anchor_ guidance