Creates the patcher.
The REST client (bound to the run by the caller, 07 SR9).
The run.
The version of the Run that startRun or resumeRun answered.
Settings, clock and the onEnded callback.
The version the next patch builds on.
ReadonlyclientThe REST client (bound to the run by the caller, 07 SR9).
ReadonlyclockThe time source of the throttle.
true once the server said the run has ended; nothing is sent after that.
The number of patches the server accepted (or the gateway took).
ReadonlyrunThe run.
Readonlysettingsagent.run_update_min_interval and sdk.retry_max_attempts.
Stops the throttle timer without sending; a patch already on its way completes.
A promise that resolves when the timer has stopped.
Adds a step; its ID is a UUIDv7 of the adapter, the server assigns ordinal.
tool_call, subagent, background_job, workflow or status.
The step name.
title, status, parentStepId and detail.
The step ID.
Removes /metrics/last_api_retry.
Removes /plan.
Removes /status_line.
Sends the pending changes now (one patch), rebasing after a version conflict.
A patch that finds the run ended stops the patcher and returns. After a transient refusal
(5xx, 429, a conflict that outlasted the rebases) or a transport error the changes stay
pending, values set meanwhile win; a permanent refusal (for example 400 validation_failed) drops the patch, so one bad value never blocks the later updates.
A promise that resolves when the patch was sent (or there was nothing to send).
ProblemError for a refusal other than the end of the run, or the version
conflict after sdk.retry_max_attempts rounds; TransportError when no answer
arrived.
Handles an error frame of a run.update of this run.
base_version_conflict loads getRun and sends the last ops again on its version;
conflict (run_not_active) ends the patcher.
The error of the frame.
A promise that resolves when the reaction is done.
ProblemError when getRun fails.
Sends raw RFC 6902 operations at once, after checking them against PATCH_PATHS.
The operations.
The new version.
PatchPathError when an operation names a path or op outside 09 5.3 (before any request); ProblemError when the server refused.
Sets /cost; always an estimate (is_estimate: true).
The amount in millionths of the currency unit.
The ISO 4217 code.
Sets /metrics/last_api_retry.
The attempt number.
maxRetries, retryDelayMs and error, each if known.
Sets /last_text_excerpt (the server keeps its last run.excerpt_max_chars).
The draft text so far.
Sets /metrics/<name>.
One of METRIC_FIELDS (MetricField); a plain string is checked at run time.
The number.
Sets /model.
The model name of the runtime.
Sets /status_line.
The status line.
Changes a step; an unsent add absorbs the change.
The step.
status, title, detail and finishedAt; absent members stay.
Sends patches with the gateway op run.update instead of REST.
The gateway has no success reply, so the next base is assumed as baseVersion + 1; route
an error frame of a run.update of this run to RunPatcher.onGatewayError, which
loads getRun after base_version_conflict and sends again.
The gateway consumer.
Collects live-box changes of one run and sends them throttled.
Every setter only records the change and schedules a send; the throttle timer sends the pending changes as one patch once
agent.run_update_min_intervalpassed since the last sent patch. RunPatcher.flush sends at once. After the end of the run every setter is a no-op.