@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
34 lines • 1.7 kB
TypeScript
/**
* The background jobs each turn started (a bash command run with `run_in_background` or one that auto-detached),
* keyed by the turn id (`turn_epoch`) that was running when the job became background. `interrupt { background:
* "stop" }` stops the jobs of the turn it interrupted, so nothing that turn left running wakes the session later.
* A job leaves the registry when it ends on its own (`release`) or once it is stopped.
*/
/** A job the turn started; `stop` ends it without waking the session and rejects with the reason it could not. */
export interface RunBackgroundJob {
readonly kind: "bash";
readonly id: string;
readonly description?: string;
stop(turnId: string): Promise<void>;
}
export interface StoppedRunBackgroundJob {
readonly kind: RunBackgroundJob["kind"];
readonly id: string;
readonly description?: string;
}
export interface FailedRunBackgroundJob extends StoppedRunBackgroundJob {
readonly reason: string;
}
/** What `interrupt { background: "stop" }` stopped, and each job it could not stop with the reason. */
export interface RunBackgroundStopOutcome {
readonly stopped: readonly StoppedRunBackgroundJob[];
readonly failed: readonly FailedRunBackgroundJob[];
}
export declare class RunBackgroundJobs {
#private;
/** Record `job` under `turnId`; the returned release drops it once it ended on its own. */
register(turnId: string, job: RunBackgroundJob): () => void;
/** Stops the turn's jobs all at once, so jobs that ignore TERM cost one grace period, not one each; lists keep start order. */
stop(turnId: string): Promise<RunBackgroundStopOutcome>;
}
//# sourceMappingURL=run-background-jobs.d.ts.map