diff --git a/apps/server/src/jobs/service.ts b/apps/server/src/jobs/service.ts index ee3f735b..9cbef5dd 100644 --- a/apps/server/src/jobs/service.ts +++ b/apps/server/src/jobs/service.ts @@ -26,6 +26,7 @@ import { type JobRunConfig, type JobRunRecord, type JobWithLatestRun, + type RunJobResult, } from "./store.js"; import { TemplateStore, @@ -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([ diff --git a/apps/server/src/jobs/store.ts b/apps/server/src/jobs/store.ts index b32cea44..1edf0f2a 100644 --- a/apps/server/src/jobs/store.ts +++ b/apps/server/src/jobs/store.ts @@ -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[]; @@ -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; diff --git a/apps/web/src/hooks/use-jobs.ts b/apps/web/src/hooks/use-jobs.ts index a0dd723b..10360ac6 100644 --- a/apps/web/src/hooks/use-jobs.ts +++ b/apps/web/src/hooks/use-jobs.ts @@ -9,6 +9,7 @@ import type { JobRunRecord, JobRunStatus, JobWithLatestRun, + RunJobResult, } from "../../../server/src/jobs/store"; export type { JobAgentType, JobNotifyConfig, JobReport, JobRunStatus }; @@ -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; export function useJobs(enabled = true) {