( id: string, owner: string, input: UpdateProgressInput, )
| 79 | * partial fields — any omitted field stays unchanged. |
| 80 | */ |
| 81 | export async function updateRunProgress( |
| 82 | id: string, |
| 83 | owner: string, |
| 84 | input: UpdateProgressInput, |
| 85 | ): Promise<AgentRun | null> { |
| 86 | const run = await updateRun(id, owner, { |
| 87 | ...input, |
| 88 | step: truncate(input.step, MAX_STEP_LEN), |
| 89 | }); |
| 90 | if (!run) return null; |
| 91 | try { |
| 92 | emitBusEvent( |
| 93 | "run.progress.updated", |
| 94 | { |
| 95 | runId: run.id, |
| 96 | percent: run.percent, |
| 97 | step: run.step, |
| 98 | status: run.status, |
| 99 | }, |
| 100 | { owner: run.owner }, |
| 101 | ); |
| 102 | } catch { |
| 103 | // best-effort |
| 104 | } |
| 105 | return run; |
| 106 | } |
| 107 | |
| 108 | /** |
| 109 | * Finalize a run with a terminal status. Convenience wrapper around |
no test coverage detected