Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 1 addition & 8 deletions apps/server/src/jobs/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import {
type JobRunConfig,
type JobRunRecord,
type JobWithLatestRun,
type RunJobResult,
} from "./store.js";
import {
TemplateStore,
Expand Down Expand Up @@ -54,14 +55,6 @@ type RunJobInput = {

export type { AddJobInput } from "./store.js";

export type RunJobResult = {
jobId: string;
runId: string;
agentId: string;
status: JobRunRecord["status"];
report: JobRunRecord["report"];
};

const DEFAULT_TIMEOUT_MS = 30 * 60 * 1000;
const DEFAULT_NEEDS_INPUT_TIMEOUT_MS = 24 * 60 * 60 * 1000;
const TERMINAL_STATUSES = new Set<JobRunRecord["status"]>([
Expand Down
14 changes: 11 additions & 3 deletions apps/server/src/jobs/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ import {
} from "./report.js";

// The job wire types below (JobNotifyConfig, JobRunStatus, JobAgentType,
// JobRecord, JobRunRecord, JobWithLatestRun, AddJobInput) are imported
// type-only by the web client (apps/web/src/hooks/use-jobs.ts) so both sides
// of the API agree on one definition.
// JobRecord, JobRunRecord, RunJobResult, JobWithLatestRun, AddJobInput) are
// imported type-only by the web client (apps/web/src/hooks/use-jobs.ts) so
// both sides of the API agree on one definition.
export type JobNotifyConfig = {
onComplete: string[];
onError: string[];
Expand Down Expand Up @@ -84,6 +84,14 @@ export type JobRunRecord = {
continuationRetries: number;
};

export type RunJobResult = {
jobId: string;
runId: string;
agentId: string;
status: JobRunRecord["status"];
report: JobRunRecord["report"];
};

export type ContinuationStatus = {
action: "default" | "continue" | "pause" | "finish";
phase?: string;
Expand Down
9 changes: 1 addition & 8 deletions apps/web/src/hooks/use-jobs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import type {
JobRunRecord,
JobRunStatus,
JobWithLatestRun,
RunJobResult,
} from "../../../server/src/jobs/store";

export type { JobAgentType, JobNotifyConfig, JobReport, JobRunStatus };
Expand All @@ -19,14 +20,6 @@ export type JobRun = JobRunRecord;

export type AddJobConfig = AddJobInput;

export type RunJobResult = {
jobId: string;
runId: string;
agentId: string;
status: JobRunStatus;
report: JobReport | null;
};

type JobIdentity = Pick<Job, "name" | "directory">;

export function useJobs(enabled = true) {
Expand Down
Loading