feat(contracts,db): scheduled_job registry tables and schedules API contracts
- 0028_scheduled_jobs: scheduled_job (stable key, group, kind task|agent_check, enabled/schedule with defaults + customized flag, config, last_* / next_run_at / run_requested_at / running_since, counters) and scheduled_job_run history - contracts/schedules.ts: ScheduleSpec (interval | 5-field cron), AgentCheckConfig (goal template, capability allowlist, budget, trigger condition, allowRecover, reportAsDecision), board / run views - Api.schedules: list, create (agent_check only), update, remove, run-now, skip, runs; all admin + console session only Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
f0386af319
commit
f8f70d8e09
5 files changed
+373
No files matched your search
@@ -202,6 +202,11 @@ export type ResolutionAttemptOutcome =
|
||||
| "manual"
|
||||
| "skipped_locked";
|
||||
export type ResolutionAttemptActorType = "user" | "agent" | "system" | "api_key";
|
||||
export type ScheduledJobBoardGroup = "collect" | "download" | "organize" | "maintain" | "agent";
|
||||
export type ScheduledJobKind = "task" | "agent_check";
|
||||
export type ScheduledJobLastStatus = "ok" | "failed" | "skipped" | "running";
|
||||
export type ScheduledJobRunTrigger = "schedule" | "manual" | "skip";
|
||||
export type ScheduledJobRunStatus = "ok" | "failed" | "skipped" | "running";
|
||||
export type SecretPurpose =
|
||||
| "site_cookie"
|
||||
| "site_passkey"
|
||||
@@ -1097,6 +1102,48 @@ export interface ResolutionAttemptTable {
|
||||
updated_at: GeneratedTimestamptz;
|
||||
}
|
||||
|
||||
export interface ScheduledJobTable {
|
||||
id: string;
|
||||
name: string;
|
||||
description: string | null;
|
||||
board_group: ScheduledJobBoardGroup;
|
||||
kind: ScheduledJobKind;
|
||||
builtin: Generated<boolean>;
|
||||
available: Generated<boolean>;
|
||||
enabled: boolean;
|
||||
default_enabled: boolean;
|
||||
schedule: Json;
|
||||
default_schedule: Json;
|
||||
customized: Generated<boolean>;
|
||||
config: Generated<Json>;
|
||||
last_run_at: Timestamptz | null;
|
||||
last_status: ScheduledJobLastStatus | null;
|
||||
last_duration_ms: number | null;
|
||||
last_error: string | null;
|
||||
next_run_at: Timestamptz | null;
|
||||
run_requested_at: Timestamptz | null;
|
||||
running_since: Timestamptz | null;
|
||||
run_count: Generated<number>;
|
||||
fail_count: Generated<number>;
|
||||
created_at: GeneratedTimestamptz;
|
||||
updated_at: GeneratedTimestamptz;
|
||||
}
|
||||
|
||||
export interface ScheduledJobRunTable {
|
||||
id: Generated<string>;
|
||||
job_id: string;
|
||||
trigger: ScheduledJobRunTrigger;
|
||||
status: ScheduledJobRunStatus;
|
||||
started_at: GeneratedTimestamptz;
|
||||
finished_at: Timestamptz | null;
|
||||
duration_ms: number | null;
|
||||
error: string | null;
|
||||
summary: string | null;
|
||||
agent_run_id: string | null;
|
||||
agent_status: string | null;
|
||||
created_at: GeneratedTimestamptz;
|
||||
}
|
||||
|
||||
export interface SecretTable {
|
||||
id: Generated<string>;
|
||||
name: string;
|
||||
@@ -1427,6 +1474,8 @@ export interface DB {
|
||||
preference_tag: PreferenceTagTable;
|
||||
reconcile_run: ReconcileRunTable;
|
||||
resolution_attempt: ResolutionAttemptTable;
|
||||
scheduled_job: ScheduledJobTable;
|
||||
scheduled_job_run: ScheduledJobRunTable;
|
||||
secret: SecretTable;
|
||||
server_mapping: ServerMappingTable;
|
||||
settings: SettingsTable;
|
||||
@@ -1589,6 +1638,12 @@ export type ReconcileRunUpdate = Updateable<ReconcileRunTable>;
|
||||
export type ResolutionAttemptRow = Selectable<ResolutionAttemptTable>;
|
||||
export type NewResolutionAttempt = Insertable<ResolutionAttemptTable>;
|
||||
export type ResolutionAttemptUpdate = Updateable<ResolutionAttemptTable>;
|
||||
export type ScheduledJobRow = Selectable<ScheduledJobTable>;
|
||||
export type NewScheduledJob = Insertable<ScheduledJobTable>;
|
||||
export type ScheduledJobUpdate = Updateable<ScheduledJobTable>;
|
||||
export type ScheduledJobRunRow = Selectable<ScheduledJobRunTable>;
|
||||
export type NewScheduledJobRun = Insertable<ScheduledJobRunTable>;
|
||||
export type ScheduledJobRunUpdate = Updateable<ScheduledJobRunTable>;
|
||||
export type SecretRow = Selectable<SecretTable>;
|
||||
export type NewSecret = Insertable<SecretTable>;
|
||||
export type SecretUpdate = Updateable<SecretTable>;
|
||||
|
||||
Reference in new issue
Block a user