Skip to content

jobs.runs

The stored runs of a declared job, newest first (PRT-203).

/** `jobs.runs` params (PRT-203). */
export type JobRunsParams = {
/** Only runs started before this run id. */
before?: string | null;
/** The declared job's name. */
job: string;
/** Defaults to 20, capped at 50. */
limit?: number | null;
workspaceId: string;
};
/** `jobs.runs` result (PRT-203): newest first. */
export type JobRuns = {
/** Older runs exist. */
more: boolean;
runs: RunInfo[];
};
/** One run of a job (DMN-330); its id is a job id (`job/<id>`, `jobs.kill`). */
export type RunInfo = {
/** The command a command run ran (its output is `job/<id>`); `null` for a prompt run. */
command?: string | null;
endedAt?: number | null;
exitCode?: number | null;
id: string;
/** The declared job; `null` for a transient run. */
job?: string | null;
/** Why it was skipped or could not start. */
reason?: string | null;
signal?: number | null;
startedAt: number;
/** Who asked; `null` for the scheduler and the supervisor. */
startedBy?: CreatedBy | null;
status: JobRunStatus;
/** A prompt run's thread. */
threadId?: string | null;
trigger: RunTrigger;
workspaceId: string;
};
/**
* The principal behind a created entity: the user, the agent of a thread, or an MCP client outside omfp,
* named by the provenance's `client`.
*/
export type CreatedBy =
| {
kind: "user";
}
| {
kind: "thread";
threadId: string;
}
| {
kind: "mcp";
}
/** A run of the declared job `job` of the entity's workspace (PRT-209). */
| {
job: string;
kind: "job";
};
/** How a run ended, or that it still runs (DMN-330). */
export type JobRunStatus =
| "running" | "succeeded" | "failed" | "killed"
/** Not started: the job still ran, or its reused thread was busy (`reason`). */
| "skipped"
/** Still running when the daemon stopped. */
| "interrupted";
/** What started a run (DMN-330). */
export type RunTrigger =
| "manual" | "schedule" | "service"
/** A catch-up run for missed times (DMN-325). */
| "missed"
/** A transient run of `jobs.start`. */
| "start";