apply_patch
Copy a binary file and insert base64-encoded bytes at a specified offset, returning SHA-256 hashes of both original and patched versions for audit.
Instructions
Copy src to dst, then splice new_bytes_b64 at offset.
This is the on-disk patch primitive. The original bytes at src are never modified; the patch is written to a copy at dst. The function returns both the pre-patch and post-patch SHA-256 so the analyst can record the patch's net effect in the report.
Args: src: source file (the original; never modified) dst: destination file (created or overwritten with the patched copy) offset: byte offset into dst at which to write (0-based) new_bytes_b64: base64-encoded bytes to splice in confirm_legal: free-text justification (the audit trail; the server does not enforce policy)
Returns::
{
"src": "...",
"dst": "...",
"src_sha256": "<original>",
"dst_sha256": "<patched>",
"src_size": N,
"dst_size": N,
"offset": N,
"patched_bytes": M,
"confirm_legal": "...",
}Override-scope contract: this tool is gated behind
the run's policy override (see override-scope.md of
the active run). The override authorizes on-disk patches
only inside Output/<run-id>/patches/; the
confirm_legal text must reference the override file
and the rationale.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| src | Yes | ||
| dst | Yes | ||
| offset | Yes | ||
| new_bytes_b64 | Yes | ||
| confirm_legal | No |