Skip to content

jobs.run

Starts a run of a declared job (PRT-204).

/** `jobs.run` params (PRT-204): one declared job of a workspace. */
export type JobNameParams = {
job: string;
workspaceId: string;
};
/** 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";