No JSDoc comment in source yet.
API
@Component()
export class Scheduler implements Scheduling {
get files(): ScheduleFileCache & Opaque<"ScheduleFileCache">;
@Use() private readonly paths!: Paths;
@Use() private readonly repo!: Schedules;
@Use() private readonly projects!: Projects;
@Use() private readonly sessions!: SessionIndex;
@Use() private readonly runner!: ScheduleTaskRunner;
@Use() private readonly sessionCreator!: ScheduleSessionCreator;
@Use() private readonly projectConfig!: ProjectConfigStore;
@Use() private readonly errors!: Errors;
@Use() private readonly channels!: Channels;
@Use() private readonly clock!: Clock;
@Use() private readonly drivers?: SessionDrivers;
setup({ effect }: ClassCtx): void;
async start(): Promise<void>;
stop(): void;
async tickOnce(): Promise<void>;
async reconcileAgent(projectId: string, agentId: string): Promise<void>;
async listAgent(projectId: string, agentId: string): Promise<{ entries: ScheduleEntryView[]; invalid: Array<{ name: string; error: string }> }>;
async listProject(projectId: string): Promise<{
entries: Array<ScheduleEntryView & { agentId: string }>;
invalid: Array<{ agentId: string; name: string; error: string }>;
}>;
dropEntry(projectId: string, agentId: string, name: string): void;
}Dependencies & Wiring
Extracted from class decoratorspaths: Paths · repo: Schedules · projects: Projects · sessions: SessionIndex · runner: ScheduleTaskRunner · sessionCreator: ScheduleSessionCreator · projectConfig: ProjectConfigStore · errors: Errors · channels: Channels · clock: Clock · drivers: SessionDriversMethods (8)
start
async start(): Promise<void>Start: the periodic tick, and one reconcile now (startup semantics: no backfill) — the returned promise is that first pass. The tick is armed first, so a stop that comes while the pass runs leaves nothing armed; a tick that comes due meanwhile finds the pass running and does nothing.
Promise<void>stop
stop(): voidvoidtickOnce
async tickOnce(): Promise<void>One reconcile + fire pass (deterministic entry for tests and routes; concurrent calls run only one).
Promise<void>reconcileAgent
async reconcileAgent(projectId: string, agentId: string): Promise<void>Immediate-effect entry after a route write: reconcile just one Agent (bypassing the mtime gate) and drain its queue.
stringstringPromise<void>listAgent
async listAgent(projectId: string, agentId: string): Promise<{ entries: ScheduleEntryView[]; invalid: Array<{ name: string; error: string }> }>For route display: the task list after reconcile (including files that failed to parse).
stringstringPromise<{ entries: ScheduleEntryView[]; invalid: Array<{ name: string; error: string }> }>listProject
async listProject(projectId: string): Promise<{ entries: Array<ScheduleEntryView & { agentId: string }>; invalid: Array<{ agentId: string; name: string; error: string }>; }>For the Project-wide route display: every Agent's tasks in one list, each stamped with the Agent whose schedule directory holds it. It goes through listAgent instead of reading the files itself so both listings reconcile along the same path and can never disagree about a task's state. The ids are sorted because readdir order is not stable across platforms and the order of this list is part of the response.
stringPromise<{ entries: Array<ScheduleEntryView & { agentId: string }>; invalid: Array<{ agentId: string; name: string; error: string }>; }>dropEntry
dropEntry(projectId: string, agentId: string, name: string): voidFor routes: state cleanup after a task is deleted (the unlink moved the dir mtime, but invalidate for immediate effect anyway).
stringstringstringvoid