Applies the completion state to an agent-run-step entity: Status, CompletedAt, Success,
ErrorMessage, an optional late TargetLogID, and (when outputData is supplied) an OutputData
envelope carrying { success, durationMs, errorMessage } (duration measured from StartedAt). Pure —
the caller persists. Idempotent: re-applying with the same opts (capture completedAt) is a no-op.
Applies the completion state to an agent-run-step entity:
Status,CompletedAt,Success,ErrorMessage, an optional lateTargetLogID, and (whenoutputDatais supplied) anOutputDataenvelope carrying{ success, durationMs, errorMessage }(duration measured fromStartedAt). Pure — the caller persists. Idempotent: re-applying with the sameopts(capturecompletedAt) is a no-op.