/**
 * This file was generated by kysely-codegen.
 * Please do not edit it manually.
 */

import type { ColumnType } from "kysely";

export type Generated<T> =
  T extends ColumnType<infer S, infer I, infer U>
    ? ColumnType<S, I | undefined, U>
    : ColumnType<T, T | undefined, T>;

export interface AcpReplayEvents {
  at: number;
  run_id: string | null;
  seq: number;
  session_id: string;
  session_key: string;
  update_json: string;
}

export interface AcpReplaySessions {
  complete: number;
  created_at: number;
  cwd: string;
  next_seq: number;
  session_id: string;
  session_key: string;
  updated_at: number;
}

export interface AcpSessions {
  agent: string;
  backend: string;
  cwd: string | null;
  identity_json: string | null;
  last_activity_at: number;
  last_error: string | null;
  mode: string;
  runtime_options_json: string | null;
  runtime_session_name: string;
  session_id: string | null;
  session_key: string;
  state: string;
  updated_at: number;
}

export interface AgentDatabases {
  agent_id: string;
  last_seen_at: number;
  path: string;
  schema_version: number;
  size_bytes: number | null;
}

export interface AgentModelCatalogs {
  agent_dir: string;
  catalog_key: string;
  raw_json: string;
  updated_at: number;
}

export interface AndroidNotificationRecentPackages {
  package_name: string;
  sort_order: number;
  updated_at_ms: number;
}

export interface ApnsRegistrations {
  distribution: string | null;
  environment: string;
  installation_id: string | null;
  node_id: string;
  relay_handle: string | null;
  send_grant: string | null;
  token: string | null;
  token_debug_suffix: string | null;
  topic: string;
  transport: string;
  updated_at_ms: number;
}

export interface AuthProfileState {
  state_json: string;
  store_key: string;
  updated_at: number;
}

export interface AuthProfileStores {
  store_json: string;
  store_key: string;
  updated_at: number;
}

export interface BackupRuns {
  archive_path: string;
  created_at: number;
  id: string;
  manifest_json: string;
  status: string;
}

export interface CaptureBlobs {
  blob_id: string;
  content_type: string | null;
  created_at: number;
  data: Uint8Array;
  encoding: string;
  sha256: string;
  size_bytes: number;
}

export interface CaptureEvents {
  close_code: number | null;
  content_type: string | null;
  data_blob_id: string | null;
  data_sha256: string | null;
  data_text: string | null;
  direction: string;
  error_text: string | null;
  flow_id: string;
  headers_json: string | null;
  host: string | null;
  id: Generated<number>;
  kind: string;
  meta_json: string | null;
  method: string | null;
  path: string | null;
  protocol: string;
  session_id: string;
  source_process: string;
  source_scope: string;
  status: number | null;
  ts: number;
}

export interface CaptureSessions {
  ended_at: number | null;
  id: string;
  mode: string;
  proxy_url: string | null;
  source_process: string;
  source_scope: string;
  started_at: number;
}

export interface ChannelIngressEvents {
  account_id: string;
  attempts: Generated<number>;
  channel_id: string;
  claim_owner: string | null;
  claim_token: string | null;
  claimed_at: number | null;
  completed_at: number | null;
  completed_metadata_json: string | null;
  event_id: string;
  failed_at: number | null;
  failed_reason: string | null;
  lane_key: string | null;
  last_attempt_at: number | null;
  last_error: string | null;
  metadata_json: string | null;
  payload_json: string;
  queue_name: string;
  received_at: number;
  status: string;
  updated_at: number;
}

export interface ChannelPairingAllowEntries {
  account_id: string;
  channel_key: string;
  entry: string;
  sort_order: number;
  updated_at: number;
}

export interface ChannelPairingRequests {
  account_id: string;
  channel_key: string;
  code: string;
  created_at: string;
  last_seen_at: string;
  meta_json: string | null;
  request_id: string;
}

export interface CommandLogEntries {
  action: string;
  entry_json: string;
  id: string;
  sender_id: string;
  session_key: string;
  source: string;
  timestamp_ms: number;
}

export interface Commitments {
  account_id: string | null;
  agent_id: string;
  attempts: number;
  channel: string;
  confidence: number;
  created_at_ms: number;
  dedupe_key: string;
  dismissed_at_ms: number | null;
  due_earliest_ms: number;
  due_latest_ms: number;
  due_timezone: string;
  expired_at_ms: number | null;
  id: string;
  kind: string;
  last_attempt_at_ms: number | null;
  reason: string;
  recipient_id: string | null;
  record_json: string;
  sender_id: string | null;
  sensitivity: string;
  sent_at_ms: number | null;
  session_key: string;
  snoozed_until_ms: number | null;
  source: string;
  source_message_id: string | null;
  source_run_id: string | null;
  status: string;
  suggested_text: string;
  thread_id: string | null;
  updated_at_ms: number;
}

export interface ConfigHealthEntries {
  config_path: string;
  last_known_good_json: string | null;
  last_observed_suspicious_signature: string | null;
  last_promoted_good_json: string | null;
  updated_at_ms: number;
}

export interface CronJobs {
  agent_id: string | null;
  anchor_ms: number | null;
  at: string | null;
  consecutive_errors: number | null;
  consecutive_skipped: number | null;
  created_at_ms: number;
  delete_after_run: number | null;
  delivery_account_id: string | null;
  delivery_best_effort: number | null;
  delivery_channel: string | null;
  delivery_completion_mode: string | null;
  delivery_completion_to: string | null;
  delivery_mode: string | null;
  delivery_thread_id: string | null;
  delivery_to: string | null;
  description: string | null;
  enabled: number;
  every_ms: number | null;
  failure_alert_account_id: string | null;
  failure_alert_after: number | null;
  failure_alert_channel: string | null;
  failure_alert_cooldown_ms: number | null;
  failure_alert_disabled: number | null;
  failure_alert_include_skipped: number | null;
  failure_alert_mode: string | null;
  failure_alert_to: string | null;
  failure_delivery_account_id: string | null;
  failure_delivery_channel: string | null;
  failure_delivery_mode: string | null;
  failure_delivery_to: string | null;
  job_id: string;
  job_json: string;
  last_delivered: number | null;
  last_delivery_error: string | null;
  last_delivery_status: string | null;
  last_duration_ms: number | null;
  last_error: string | null;
  last_failure_alert_at_ms: number | null;
  last_run_at_ms: number | null;
  last_run_status: string | null;
  name: string;
  next_run_at_ms: number | null;
  payload_allow_unsafe_external_content: number | null;
  payload_external_content_source_json: string | null;
  payload_fallbacks_json: string | null;
  payload_kind: string;
  payload_light_context: number | null;
  payload_message: string | null;
  payload_model: string | null;
  payload_thinking: string | null;
  payload_timeout_seconds: number | null;
  payload_tools_allow_json: string | null;
  running_at_ms: number | null;
  runtime_updated_at_ms: number | null;
  schedule_error_count: number | null;
  schedule_expr: string | null;
  schedule_identity: string | null;
  schedule_kind: string;
  schedule_tz: string | null;
  session_key: string | null;
  session_target: string;
  sort_order: Generated<number>;
  stagger_ms: number | null;
  state_json: Generated<string>;
  store_key: string;
  updated_at: number;
  wake_mode: string;
}

export interface CronRunLogs {
  created_at: number;
  delivered: number | null;
  delivery_error: string | null;
  delivery_status: string | null;
  diagnostics_summary: string | null;
  duration_ms: number | null;
  entry_json: string;
  error: string | null;
  job_id: string;
  model: string | null;
  next_run_at_ms: number | null;
  provider: string | null;
  run_at_ms: number | null;
  run_id: string | null;
  seq: number;
  session_id: string | null;
  session_key: string | null;
  status: string | null;
  store_key: string;
  summary: string | null;
  total_tokens: number | null;
  ts: number;
}

export interface CurrentConversationBindings {
  account_id: string;
  binding_id: string;
  binding_key: string;
  bound_at: number;
  channel: string;
  conversation_id: string;
  conversation_kind: string;
  expires_at: number | null;
  metadata_json: string | null;
  parent_conversation_id: string | null;
  record_json: string;
  status: string;
  target_agent_id: string;
  target_kind: string;
  target_session_id: string | null;
  target_session_key: string;
  updated_at: number;
}

export interface DeliveryQueueEntries {
  account_id: string | null;
  channel: string | null;
  enqueued_at: number;
  entry_json: string;
  entry_kind: string | null;
  failed_at: number | null;
  id: string;
  last_attempt_at: number | null;
  last_error: string | null;
  platform_send_started_at: number | null;
  queue_name: string;
  recovery_state: string | null;
  retry_count: Generated<number>;
  session_key: string | null;
  status: string;
  target: string | null;
  updated_at: number;
}

export interface DeviceAuthTokens {
  device_id: string;
  role: string;
  scopes_json: string;
  token: string;
  updated_at_ms: number;
}

export interface DeviceBootstrapTokens {
  device_id: string | null;
  issued_at_ms: number;
  last_used_at_ms: number | null;
  pending_profile_json: string | null;
  profile_json: string | null;
  public_key: string | null;
  redeemed_profile_json: string | null;
  token: string;
  token_key: string;
  ts: number;
}

export interface DeviceIdentities {
  created_at_ms: number;
  device_id: string;
  identity_key: string;
  private_key_pem: string;
  public_key_pem: string;
  updated_at_ms: number;
}

export interface DevicePairingPaired {
  approved_at_ms: number;
  approved_scopes_json: string | null;
  client_id: string | null;
  client_mode: string | null;
  created_at_ms: number;
  device_family: string | null;
  device_id: string;
  display_name: string | null;
  last_seen_at_ms: number | null;
  last_seen_reason: string | null;
  platform: string | null;
  public_key: string;
  remote_ip: string | null;
  role: string | null;
  roles_json: string | null;
  scopes_json: string | null;
  tokens_json: string | null;
}

export interface DevicePairingPending {
  client_id: string | null;
  client_mode: string | null;
  device_family: string | null;
  device_id: string;
  display_name: string | null;
  is_repair: number | null;
  platform: string | null;
  public_key: string;
  remote_ip: string | null;
  request_id: string;
  role: string | null;
  roles_json: string | null;
  scopes_json: string | null;
  silent: number | null;
  ts: number;
}

export interface DiagnosticEvents {
  created_at: number;
  event_key: string;
  payload_json: string;
  scope: string;
}

export interface DiagnosticStabilityBundles {
  bundle_json: string;
  bundle_key: string;
  created_at: number;
  generated_at: string;
  reason: string;
}

export interface ExecApprovalsConfig {
  agent_count: number;
  allowlist_count: number;
  auto_allow_skills: number | null;
  config_key: string;
  default_ask: string | null;
  default_ask_fallback: string | null;
  default_security: string | null;
  has_socket_token: number;
  raw_json: string;
  socket_path: string | null;
  updated_at_ms: number;
}

export interface FlowRuns {
  blocked_summary: string | null;
  blocked_task_id: string | null;
  cancel_requested_at: number | null;
  controller_id: string | null;
  created_at: number;
  current_step: string | null;
  ended_at: number | null;
  flow_id: string;
  goal: string;
  notify_policy: string;
  owner_key: string;
  requester_origin_json: string | null;
  revision: Generated<number>;
  shape: string | null;
  state_json: string | null;
  status: string;
  sync_mode: Generated<string>;
  updated_at: number;
  wait_json: string | null;
}

export interface GatewayRestartHandoff {
  created_at: number;
  expires_at: number;
  handoff_key: string;
  intent_id: string;
  kind: string;
  pid: number;
  process_instance_id: string | null;
  reason: string | null;
  restart_kind: string;
  restart_trace_last_at: number | null;
  restart_trace_started_at: number | null;
  source: string;
  supervisor_mode: string;
  updated_at_ms: number;
  version: number;
}

export interface GatewayRestartIntent {
  created_at: number;
  force: number | null;
  intent_key: string;
  kind: string;
  pid: number;
  reason: string | null;
  updated_at_ms: number;
  wait_ms: number | null;
}

export interface GatewayRestartSentinel {
  continuation_json: string | null;
  delivery_account_id: string | null;
  delivery_channel: string | null;
  delivery_to: string | null;
  doctor_hint: string | null;
  kind: string;
  message: string | null;
  payload_json: string;
  sentinel_key: string;
  session_key: string | null;
  stats_json: string | null;
  status: string;
  thread_id: string | null;
  ts: number;
  updated_at_ms: number;
  version: number;
}

export interface InstalledPluginIndex {
  compat_registry_version: string;
  diagnostics_json: string;
  generated_at_ms: number;
  host_contract_version: string;
  index_key: string;
  install_records_json: string;
  migration_version: number;
  plugins_json: string;
  policy_hash: string;
  refresh_reason: string | null;
  updated_at_ms: number;
  version: number;
  warning: string | null;
}

export interface MacosPortGuardianRecords {
  command: string;
  mode: string;
  pid: Generated<number>;
  port: number;
  timestamp: number;
}

export interface ManagedOutgoingImageRecords {
  alt: string;
  attachment_id: string;
  created_at: string;
  message_id: string | null;
  original_content_type: string;
  original_filename: string | null;
  original_height: number | null;
  original_media_id: string;
  original_media_subdir: string;
  original_size_bytes: number | null;
  original_width: number | null;
  record_json: string;
  retention_class: string | null;
  session_key: string;
  updated_at: string | null;
}

export interface MediaBlobs {
  blob: Uint8Array;
  content_type: string | null;
  created_at: number;
  id: string;
  size_bytes: number;
  subdir: string;
  updated_at: number;
}

export interface MigrationRuns {
  finished_at: number | null;
  id: string;
  report_json: string;
  started_at: number;
  status: string;
}

export interface MigrationSources {
  imported_at: number;
  last_run_id: string;
  migration_kind: string;
  removed_source: Generated<number>;
  report_json: string;
  source_key: string;
  source_path: string;
  source_record_count: number | null;
  source_sha256: string | null;
  source_size_bytes: number | null;
  status: string;
  target_table: string;
}

export interface ModelCapabilityCache {
  context_window: number;
  cost_cache_read: number;
  cost_cache_write: number;
  cost_input: number;
  cost_output: number;
  input_image: number;
  input_text: number;
  max_tokens: number;
  model_id: string;
  name: string;
  provider_id: string;
  reasoning: number;
  supports_tools: number | null;
  updated_at_ms: number;
}

export interface NativeHookRelayBridges {
  expires_at_ms: number;
  hostname: string;
  pid: number;
  port: number;
  relay_id: string;
  token: string;
  updated_at_ms: number;
}

export interface NodeHostConfig {
  config_key: string;
  display_name: string | null;
  gateway_host: string | null;
  gateway_port: number | null;
  gateway_tls: number | null;
  gateway_tls_fingerprint: string | null;
  node_id: string;
  token: string | null;
  updated_at_ms: number;
  version: number;
}

export interface NodePairingPaired {
  approved_at_ms: number;
  bins_json: string | null;
  caps_json: string | null;
  client_id: string | null;
  client_mode: string | null;
  commands_json: string | null;
  core_version: string | null;
  created_at_ms: number;
  device_family: string | null;
  display_name: string | null;
  last_connected_at_ms: number | null;
  last_seen_at_ms: number | null;
  last_seen_reason: string | null;
  model_identifier: string | null;
  node_id: string;
  permissions_json: string | null;
  platform: string | null;
  remote_ip: string | null;
  token: string;
  ui_version: string | null;
  version: string | null;
}

export interface NodePairingPending {
  caps_json: string | null;
  client_id: string | null;
  client_mode: string | null;
  commands_json: string | null;
  core_version: string | null;
  device_family: string | null;
  display_name: string | null;
  model_identifier: string | null;
  node_id: string;
  permissions_json: string | null;
  platform: string | null;
  remote_ip: string | null;
  request_id: string;
  silent: number | null;
  ts: number;
  ui_version: string | null;
  version: string | null;
}

export interface PluginBindingApprovals {
  account_id: string;
  approved_at: number;
  channel: string;
  plugin_id: string;
  plugin_name: string | null;
  plugin_root: string;
}

export interface PluginBlobEntries {
  blob: Uint8Array;
  created_at: number;
  entry_key: string;
  expires_at: number | null;
  metadata_json: string;
  namespace: string;
  plugin_id: string;
}

export interface PluginStateEntries {
  created_at: number;
  entry_key: string;
  expires_at: number | null;
  namespace: string;
  plugin_id: string;
  value_json: string;
}

export interface SandboxRegistryEntries {
  backend_id: string | null;
  cdp_port: number | null;
  config_hash: string | null;
  config_label_kind: string | null;
  container_name: string;
  created_at_ms: number | null;
  entry_json: string;
  image: string | null;
  last_used_at_ms: number | null;
  no_vnc_port: number | null;
  registry_kind: string;
  runtime_label: string | null;
  session_key: string | null;
  updated_at: number;
}

export interface SchemaMeta {
  agent_id: string | null;
  app_version: string | null;
  created_at: number;
  meta_key: string;
  role: string;
  schema_version: number;
  updated_at: number;
}

export interface SkillUploads {
  actual_sha256: string | null;
  archive_blob: Uint8Array;
  committed: number;
  committed_at: number | null;
  created_at: number;
  expires_at: number;
  force: number;
  idempotency_key_hash: string | null;
  kind: string;
  received_bytes: number;
  sha256: string | null;
  size_bytes: number;
  slug: string;
  upload_id: string;
}

export interface StateLeases {
  created_at: number;
  expires_at: number | null;
  heartbeat_at: number | null;
  lease_key: string;
  owner: string;
  payload_json: string | null;
  scope: string;
  updated_at: number;
}

export interface SubagentRuns {
  accumulated_runtime_ms: number | null;
  agent_dir: string | null;
  announce_retry_count: number | null;
  archive_at_ms: number | null;
  child_session_key: string;
  cleanup: string;
  cleanup_completed_at: number | null;
  cleanup_handled: number | null;
  completion_announced_at: number | null;
  controller_session_key: string | null;
  created_at: number;
  ended_at: number | null;
  ended_hook_emitted_at: number | null;
  ended_reason: string | null;
  expects_completion_message: number | null;
  fallback_frozen_result_captured_at: number | null;
  fallback_frozen_result_text: string | null;
  frozen_result_captured_at: number | null;
  frozen_result_text: string | null;
  label: string | null;
  last_announce_delivery_error: string | null;
  last_announce_retry_at: number | null;
  model: string | null;
  outcome_json: string | null;
  pause_reason: string | null;
  payload_json: Generated<string>;
  pending_final_delivery: number | null;
  pending_final_delivery_attempt_count: number | null;
  pending_final_delivery_created_at: number | null;
  pending_final_delivery_last_attempt_at: number | null;
  pending_final_delivery_last_error: string | null;
  pending_final_delivery_payload_json: string | null;
  requester_display_key: string;
  requester_origin_json: string | null;
  requester_session_key: string;
  run_id: string;
  run_timeout_seconds: number | null;
  session_started_at: number | null;
  spawn_mode: string | null;
  started_at: number | null;
  suppress_announce_reason: string | null;
  task: string;
  task_name: string | null;
  wake_on_descendant_settle: number | null;
  workspace_dir: string | null;
}

export interface TaskDeliveryState {
  last_notified_event_at: number | null;
  requester_origin_json: string | null;
  task_id: string;
}

export interface TaskRuns {
  agent_id: string | null;
  child_session_key: string | null;
  cleanup_after: number | null;
  created_at: number;
  delivery_status: string;
  ended_at: number | null;
  error: string | null;
  label: string | null;
  last_event_at: number | null;
  notify_policy: string;
  owner_key: string;
  parent_flow_id: string | null;
  parent_task_id: string | null;
  progress_summary: string | null;
  requester_session_key: string | null;
  run_id: string | null;
  runtime: string;
  scope_kind: string;
  source_id: string | null;
  started_at: number | null;
  status: string;
  task: string;
  task_id: string;
  task_kind: string | null;
  terminal_outcome: string | null;
  terminal_summary: string | null;
}

export interface TuiLastSessions {
  scope_key: string;
  session_key: string;
  updated_at: number;
}

export interface UpdateCheckState {
  auto_first_seen_at: string | null;
  auto_first_seen_tag: string | null;
  auto_first_seen_version: string | null;
  auto_install_id: string | null;
  auto_last_attempt_at: string | null;
  auto_last_attempt_version: string | null;
  auto_last_success_at: string | null;
  auto_last_success_version: string | null;
  last_available_tag: string | null;
  last_available_version: string | null;
  last_checked_at: string | null;
  last_notified_tag: string | null;
  last_notified_version: string | null;
  state_key: string;
  updated_at_ms: number;
}

export interface VoicewakeRoutingConfig {
  config_key: string;
  default_target_agent_id: string | null;
  default_target_mode: string;
  default_target_session_key: string | null;
  updated_at_ms: number;
  version: number;
}

export interface VoicewakeRoutingRoutes {
  config_key: string;
  position: number;
  target_agent_id: string | null;
  target_mode: string;
  target_session_key: string | null;
  trigger: string;
  updated_at_ms: number;
}

export interface VoicewakeTriggers {
  config_key: string;
  position: number;
  trigger: string;
  updated_at_ms: number;
}

export interface WebPushSubscriptions {
  auth: string;
  created_at_ms: number;
  endpoint: string;
  endpoint_hash: string;
  p256dh: string;
  subscription_id: string;
  updated_at_ms: number;
}

export interface WebPushVapidKeys {
  key_id: string;
  private_key: string;
  public_key: string;
  subject: string;
  updated_at_ms: number;
}

export interface WorkspaceSetupState {
  bootstrap_seeded_at: string | null;
  setup_completed_at: string | null;
  updated_at: number;
  version: number;
  workspace_key: string;
  workspace_path: string;
}

export interface DB {
  acp_replay_events: AcpReplayEvents;
  acp_replay_sessions: AcpReplaySessions;
  acp_sessions: AcpSessions;
  agent_databases: AgentDatabases;
  agent_model_catalogs: AgentModelCatalogs;
  android_notification_recent_packages: AndroidNotificationRecentPackages;
  apns_registrations: ApnsRegistrations;
  auth_profile_state: AuthProfileState;
  auth_profile_stores: AuthProfileStores;
  backup_runs: BackupRuns;
  capture_blobs: CaptureBlobs;
  capture_events: CaptureEvents;
  capture_sessions: CaptureSessions;
  channel_ingress_events: ChannelIngressEvents;
  channel_pairing_allow_entries: ChannelPairingAllowEntries;
  channel_pairing_requests: ChannelPairingRequests;
  command_log_entries: CommandLogEntries;
  commitments: Commitments;
  config_health_entries: ConfigHealthEntries;
  cron_jobs: CronJobs;
  cron_run_logs: CronRunLogs;
  current_conversation_bindings: CurrentConversationBindings;
  delivery_queue_entries: DeliveryQueueEntries;
  device_auth_tokens: DeviceAuthTokens;
  device_bootstrap_tokens: DeviceBootstrapTokens;
  device_identities: DeviceIdentities;
  device_pairing_paired: DevicePairingPaired;
  device_pairing_pending: DevicePairingPending;
  diagnostic_events: DiagnosticEvents;
  diagnostic_stability_bundles: DiagnosticStabilityBundles;
  exec_approvals_config: ExecApprovalsConfig;
  flow_runs: FlowRuns;
  gateway_restart_handoff: GatewayRestartHandoff;
  gateway_restart_intent: GatewayRestartIntent;
  gateway_restart_sentinel: GatewayRestartSentinel;
  installed_plugin_index: InstalledPluginIndex;
  macos_port_guardian_records: MacosPortGuardianRecords;
  managed_outgoing_image_records: ManagedOutgoingImageRecords;
  media_blobs: MediaBlobs;
  migration_runs: MigrationRuns;
  migration_sources: MigrationSources;
  model_capability_cache: ModelCapabilityCache;
  native_hook_relay_bridges: NativeHookRelayBridges;
  node_host_config: NodeHostConfig;
  node_pairing_paired: NodePairingPaired;
  node_pairing_pending: NodePairingPending;
  plugin_binding_approvals: PluginBindingApprovals;
  plugin_blob_entries: PluginBlobEntries;
  plugin_state_entries: PluginStateEntries;
  sandbox_registry_entries: SandboxRegistryEntries;
  schema_meta: SchemaMeta;
  skill_uploads: SkillUploads;
  state_leases: StateLeases;
  subagent_runs: SubagentRuns;
  task_delivery_state: TaskDeliveryState;
  task_runs: TaskRuns;
  tui_last_sessions: TuiLastSessions;
  update_check_state: UpdateCheckState;
  voicewake_routing_config: VoicewakeRoutingConfig;
  voicewake_routing_routes: VoicewakeRoutingRoutes;
  voicewake_triggers: VoicewakeTriggers;
  web_push_subscriptions: WebPushSubscriptions;
  web_push_vapid_keys: WebPushVapidKeys;
  workspace_setup_state: WorkspaceSetupState;
}
