runPatchingAgent
Reads, searches, and edits code in cwd to fix the vulnerability you describe. It then checks the fix by running the project’s lint, type-check, and tests. The changes are left in the working tree, so you decide how to commit and open the pull request.
If you don’t pass an eventBus, the agent’s text and tool calls are printed to stdout.
The agent edits files and runs commands in cwd. Point it at a disposable clone or a sandbox, not a working copy with uncommitted changes.
Parameters
Root of the repository to patch.
The vulnerability to fix.
Vulnerability title.
Severity, for example HIGH.
What’s wrong and why.
File path of the vulnerable code.
First vulnerable line.
Last vulnerable line.
CWE IDs, for example ["CWE-89"].
Proof of concept the agent can use to confirm the fix.
Session for logs and artifacts. See sessions.create().
Model ID. See Models.
AI provider credentials.
Streaming events. When omitted, output is printed to stdout.
Cancels the run.
Returns
Promise<PatchResult>
Every file the agent modified, with a description of each change.
Suggested pull request title.
Suggested pull request description.