(input: StartRunInput)
| 53 | * automations can react (e.g. pinning the row in a UI tray). |
| 54 | */ |
| 55 | export async function startRun(input: StartRunInput): Promise<AgentRun> { |
| 56 | const run = await insertRun({ |
| 57 | ...input, |
| 58 | title: truncate(input.title, MAX_TITLE_LEN), |
| 59 | step: truncate(input.step, MAX_STEP_LEN), |
| 60 | }); |
| 61 | try { |
| 62 | emitBusEvent( |
| 63 | "run.progress.started", |
| 64 | { |
| 65 | runId: run.id, |
| 66 | title: run.title, |
| 67 | step: run.step, |
| 68 | }, |
| 69 | { owner: run.owner }, |
| 70 | ); |
| 71 | } catch { |
| 72 | // best-effort |
| 73 | } |
| 74 | return run; |
| 75 | } |
| 76 | |
| 77 | /** |
| 78 | * Update a run in-flight. Emits `run.progress.updated`. Caller supplies |
no test coverage detected