export type TaskStatus = | "queued" | "assigned" | "dispatched" | "done" | "failed" | "cancelled"; export interface TaskListItem { id: string; status: TaskStatus; goal: string | null; workflow_definition_id: string | null; assigned_device_id: string | null; assigned_host_id: string | null; attempt_count: number; failure_reason: string | null; target_host_id: string | null; target_device_id: string | null; created_at: string; progress_step_index?: number | null; progress_step_status?: string | null; progress_summary?: string | null; progress_updated_at?: string | null; } export interface TaskSubmissionPayload { goal?: string; workflow_definition_id?: string; constraints?: { driver_type?: string; capability_tags?: string[]; target_host_id?: string; target_device_id?: string; }; } export interface TaskListResponse { items: TaskListItem[]; total: number; limit: number; offset: number; } export interface TaskCancellationResponse { task_id: string; status: TaskStatus; } export interface TaskAttempt { task_id: string; attempt: number; lease_id: string; host_id: string; device_id: string; status: string; lease_expires_at: string; created_at: string; completed_at: string | null; failure_reason: string | null; terminal_result: Record | null; } export interface DeviceRecord { device_id: string; host_id: string; driver_type: string; status: string; capability_tags: string[]; } export interface HostRecord { host_id: string; address: string | null; last_seen_at: string; planner_transport: "direct" | "cloud"; } export type PluginEntryPointKind = "driver" | "tool" | "skill"; export interface PluginRecord { name: string; version: string; entry_point_kind: string; target: string; wired: boolean; } export interface PluginRegistrationPayload { name: string; version: string; entry_point_kind: PluginEntryPointKind; target: string; } export type UserRole = "viewer" | "operator" | "admin"; export interface CloudUser { id: string; username: string; display_name: string; role: UserRole; enabled: boolean; must_change_password: boolean; scopes: string[]; created_at: string; updated_at: string; last_login_at: string | null; } export interface UserListResponse { items: CloudUser[]; limit: number; offset: number; } export interface DeviceTarget { host_id: string; device_id: string; } export interface UserSubmissionPolicy { user_id: string; revision: number; submission_enabled: boolean; allowed_host_ids: string[] | null; allowed_device_targets: DeviceTarget[] | null; updated_at: string; } export interface HostGovernancePolicy { host_id: string; revision: number; self_submission_enabled: boolean; max_active_tasks: number | null; daily_token_budget: number | null; updated_at: string; } export interface HostTokenUsageSummary { host_id: string; usage_day: string; daily_token_budget: number | null; used_tokens: number; reserved_tokens: number; remaining_tokens: number | null; } export interface TokenUsageEvent { id: string; host_id: string; usage_day: string; task_id: string | null; attempt: number | null; provider: string; model: string; input_tokens: number | null; output_tokens: number | null; total_tokens: number; occurred_at: string; } export type LlmProviderType = "anthropic" | "openai-compatible"; export interface LlmProviderProfile { id: string; name: string; provider_type: LlmProviderType; model: string; base_url: string | null; timeout_seconds: number; enabled: boolean; revision: number; has_api_key: boolean; key_last_rotated_at: string; created_at: string; updated_at: string; active: boolean; } export interface LlmProviderSettings { active_profile_id: string | null; revision: number; updated_at: string | null; } export interface LlmProviderProfileListResponse { settings: LlmProviderSettings; items: LlmProviderProfile[]; } export interface PlannerDecisionItem { step_index: number; attempt: number; system_prompt: string; user_prompt: string; tool_name: string; arguments: Record; rationale?: string | null; thinking?: string | null; purpose?: string | null; expected_outcome?: string | null; created_at: string; } export interface PlannerDecisionListResponse { items: PlannerDecisionItem[]; } export type CloudSkillKind = "knowledge" | "flow_template"; export interface CloudSkill { id: string; name: string; kind: CloudSkillKind; description: string; tags: string[]; revision: number; created_at: string; updated_at: string; content: string; steps: Record[]; parameters: Record>; } export interface CloudSkillListResponse { items: CloudSkill[]; } export interface CloudSkillEntitlementsResponse { skill_id: string; host_ids: string[]; } export interface HostSkillInventoryResponse { host_id: string; payload: Record[]; reported_at: string | null; }