Documentation
¶
Overview ¶
Package applypatch implements the model-facing apply_patch tool.
The grammar is the Codex-style patch envelope:
*** Begin Patch *** Add File: <path> +<line> *** Update File: <path> *** Move to: <new-path> @@ <context> -<removed> +<added> *** Delete File: <path> *** End Patch
CRLF and CR patch input are normalized to LF for parsing. Text written by add hunks uses LF. Updates preserve the existing file's CRLF line endings when a CRLF file is patched. Patch lines are line-oriented and written with a final newline; no special EOF-no-newline marker is supported in this version.
The containment contract matches the other filesystem tools in this module: callers must serialize filesystem tool calls per workspace root to avoid symlink-swap races between path validation and use.
Index ¶
Constants ¶
const ( ErrCategoryValidation = "validation" ErrCategoryPathEscape = "path_escape" ErrCategoryNotFound = "not_found" ErrCategoryIsDirectory = "is_directory" ErrCategoryTooLarge = "too_large" ErrCategoryUnsupported = "unsupported" ErrCategoryConflict = "conflict" ErrCategoryBinary = "binary" ErrCategoryIO = "io" ErrCategoryCanceled = "canceled" ErrCategoryUnknown = "unknown" )
const (
MaxPatchBytes = 1024 * 1024
)
const Name = "apply_patch"
Name is the model-facing tool name.
Variables ¶
This section is empty.
Functions ¶
func Schema ¶
func Schema() json.RawMessage
Schema returns a fresh JSON Schema copy for apply_patch arguments.
Types ¶
type Args ¶
type Args struct {
PatchText string `json:"patch_text"`
}
Args is the parsed input shape for apply_patch.
type FileResult ¶
type FileResult struct {
Operation string `json:"operation"`
Path string `json:"path"`
NewPath string `json:"new_path,omitempty"`
Status string `json:"status"`
Additions int `json:"additions,omitempty"`
Deletions int `json:"deletions,omitempty"`
}
FileResult summarizes one file operation.
type Result ¶
type Result struct {
Outcome result.Outcome `json:"outcome"`
Files []FileResult `json:"files"`
Partial bool `json:"partial,omitempty"`
DiffTruncated bool `json:"diff_truncated,omitempty"`
Error *ResultError `json:"error,omitempty"`
RawJSON json.RawMessage `json:"-"`
}
Result is the model-facing envelope returned by apply_patch.
func (Result) IsRetryable ¶
IsRetryable reports whether the agent loop should retry this call.
func (*Result) UnmarshalJSON ¶
UnmarshalJSON decodes Result and preserves the original object in RawJSON.
type ResultError ¶
ResultError is the structured failure envelope nested inside Result.
type Tool ¶
type Tool struct {
// contains filtered or unexported fields
}
Tool applies structured patches under a configured workspace.
func (*Tool) InvokableRun ¶
InvokableRun is the Eino tool entry point.