/** * ⚡🦀 OverClawck — Core Types & Schema * The data model for autonomous AI agent job orchestration. */ export type JobStatus = 'queued' | 'scheduled' | 'running' | 'completed' | 'failed' | 'retrying' | 'diagnosing' | 'paused' | 'cancelled'; export type JobPriority = 'critical' | 'high' | 'medium' | 'low'; export type RuntimeType = 'openclaw' | 'claude-code' | 'gemini-cli' | 'codex-cli' | 'shell' | 'http'; export interface Job { /** Globally unique job ID (UUID v4) */ id: string; /** Human-readable job name */ name: string; /** The prompt or command to execute */ prompt: string; /** Priority level */ priority: JobPriority; /** Which runtime to execute this job with */ runtime: RuntimeType; /** Runtime-specific configuration (JSON) */ runtime_config: Record; /** ISO 8601 — when the job was created */ created_at: string; /** ISO 8601 — earliest time this job should run (null = run immediately) */ scheduled_at: string | null; /** ISO 8601 — when the job started executing */ started_at: string | null; /** ISO 8601 — when the job finished */ completed_at: string | null; /** Current status */ status: JobStatus; /** Job output / result text */ result: string; /** Error message if failed */ error: string; /** Standard retry count (phase 1) */ retry_count: number; /** Max standard retries before diagnosis phase */ max_retries: number; /** Diagnosis retry count (phase 2 — "try differently") */ diagnose_count: number; /** Max diagnosis retries */ max_diagnose_retries: number; /** Continue processing queue if this job fails */ continue_on_failure: boolean; /** Comma-separated job IDs this job depends on */ depends_on: string; /** Tags for filtering and categorization */ tags: string[]; /** Client name (for multi-client boxes) */ client: string; /** Project name */ project: string; /** Who/what created this job */ source: string; /** Clawck entry ID if integration is enabled */ clawck_entry_id: string; /** Estimated cost from the run */ cost_usd: number; /** Tokens consumed */ tokens_in: number; /** Tokens generated */ tokens_out: number; /** Cron expression for recurring jobs (null = one-shot) */ cron: string | null; /** Spec version */ spec_version: string; /** Full captured output (for `log` command) */ output: string; } export interface QueueJobInput { name: string; prompt: string; priority?: JobPriority; runtime?: RuntimeType; runtime_config?: Record; scheduled_at?: string; max_retries?: number; max_diagnose_retries?: number; continue_on_failure?: boolean; depends_on?: string[]; tags?: string[]; client?: string; project?: string; cron?: string; /** Per-job working directory override */ cwd?: string; } export interface CompleteJobInput { id: string; status?: 'completed' | 'failed'; result?: string; error?: string; cost_usd?: number; tokens_in?: number; tokens_out?: number; } export interface RuntimeConfig { /** Path to the runtime binary */ command: string; /** Default arguments */ args: string[]; /** Environment variables */ env: Record; /** Working directory */ cwd?: string; /** Timeout in seconds (0 = no timeout) */ timeout: number; /** Base retry delay in ms (runtime-specific override) */ retry_base_delay?: number; } export interface ClawckIntegration { enabled: boolean; /** URL of the Clawck API */ url: string; /** Default category for Clawck entries */ default_category: string; /** Auto-log task completion to Clawck */ auto_log: boolean; } export interface SpendLimits { enabled: boolean; /** Max USD spend per individual job */ max_per_job: number; /** Max USD spend per day across all jobs */ max_per_day: number; } export interface NotificationConfig { /** Webhook URLs to POST results to */ webhooks: string[]; /** Notify on these statuses */ notify_on: JobStatus[]; } export interface OverClawckConfig { /** Port for the server */ port: number; /** Path to data directory */ data_dir: string; /** Poll interval in seconds */ poll_interval: number; /** Max concurrent jobs */ max_concurrent: number; /** Default runtime for new jobs */ default_runtime: RuntimeType; /** Default client name */ default_client: string; /** Default project name */ default_project: string; /** Runtime configurations */ runtimes: Partial>; /** Clawck integration settings */ clawck: ClawckIntegration; /** API spend limits */ spend_limits: SpendLimits; /** Notification settings */ notifications: NotificationConfig; /** Channel notification callback (for OpenClaw etc) */ channel_notify_url: string; /** Shared working directory for all jobs ('' = use process.cwd()) */ workspace: string; /** Session ID passed to OpenClaw so all jobs share one agent session ('' = none) */ session_id: string; /** Base retry delay in ms (default 5000) */ retry_base_delay: number; } export interface QueueStats { total_jobs: number; queued: number; scheduled: number; running: number; completed: number; failed: number; paused: number; total_cost_usd: number; total_tokens: number; jobs_today: number; cost_today: number; } export interface JobHistoryRow { date: string; jobs_completed: number; jobs_failed: number; total_cost: number; total_tokens: number; avg_duration_minutes: number; } export type PlanStatus = 'draft' | 'approved' | 'running' | 'completed' | 'failed' | 'cancelled'; export type PhaseStatus = 'pending' | 'running' | 'reviewing' | 'replanning' | 'completed' | 'failed' | 'skipped'; export interface Plan { id: string; name: string; description: string; status: PlanStatus; created_at: string; approved_at: string | null; started_at: string | null; completed_at: string | null; client: string; project: string; runtime: RuntimeType; runtime_config: Record; max_phase_retries: number; continue_on_phase_failure: boolean; total_cost_usd: number; total_tokens_in: number; total_tokens_out: number; spec_version: string; postcomp_report: string; } export interface Phase { id: string; plan_id: string; name: string; description: string; order_index: number; status: PhaseStatus; created_at: string; started_at: string | null; completed_at: string | null; retry_count: number; max_retries: number; review_prompt: string; review_result: string; continue_on_task_failure: boolean; } export interface PlanTask { id: string; phase_id: string; plan_id: string; job_id: string; name: string; prompt: string; order_index: number; depends_on_tasks: string; status: 'pending' | 'queued' | 'running' | 'completed' | 'failed' | 'skipped'; task_type: 'research' | 'execute' | 'review' | 'custom'; runtime: RuntimeType | ''; runtime_config: Record; created_at: string; started_at: string | null; completed_at: string | null; summary: string; } export interface PlanInput { name: string; description?: string; phases: PhaseInput[]; client?: string; project?: string; runtime?: RuntimeType; runtime_config?: Record; max_phase_retries?: number; continue_on_phase_failure?: boolean; } export interface PhaseInput { name: string; description?: string; tasks: TaskInput[]; review_prompt?: string; continue_on_task_failure?: boolean; } export interface TaskInput { name: string; prompt: string; depends_on_index?: number[]; task_type?: 'research' | 'execute' | 'review' | 'custom'; runtime?: RuntimeType; runtime_config?: Record; priority?: JobPriority; } export interface ProgressEvent { plan_id: string; phase_id?: string; task_id?: string; job_id?: string; event: string; message: string; timestamp: string; metadata?: Record; } export interface PlanTemplate { name: string; description: string; created_from_plan: string; created_at: string; phases: PhaseInput[]; client: string; project: string; runtime: RuntimeType; runtime_config: Record; } export interface PostcompReport { plan_id: string; plan_name: string; completed_at: string; summary: string; total_duration_minutes: number; tasks_completed: number; tasks_failed: number; tasks_skipped: number; total_tasks: number; time_per_task: Array<{ task_id: string; name: string; duration_minutes: number; status: string; }>; total_cost_usd: number; } export interface PlanSnapshot { plan_id: string; plan_name: string; status: PlanStatus; completion_pct: number; elapsed_minutes: number; phases: Array<{ name: string; status: string; tasks_done: number; tasks_total: number; tasks: Array<{ name: string; status: string; duration_minutes: number | null; }>; }>; formatted: string; } export declare const SPEC_VERSION = "0.2.2"; export declare const DEFAULT_RUNTIME_CONFIGS: Partial>; export declare const DEFAULT_CONFIG: OverClawckConfig; export declare const JOB_PRIORITIES: JobPriority[]; export declare const RUNTIME_TYPES: RuntimeType[]; //# sourceMappingURL=types.d.ts.map