const DEFAULT_RUNNING_EVENT = "agent-running";
export async function advanceTaskToRunning(tasks, task, options = {}) {
    const list = tasks.list(task.list);
    const events = options.events ?? [DEFAULT_RUNNING_EVENT];
    if (options.requireSupported !== true) {
        return list.fire(task.id, events[0] ?? DEFAULT_RUNNING_EVENT);
    }
    for (const event of events) {
        if (await list.canFire(task.id, event)) {
            return list.fire(task.id, event);
        }
    }
    return task;
}
