@kici-dev/orchestrator 0.16.0 → 0.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (592) hide show
  1. package/dist/agent/agent-version.d.ts +12 -21
  2. package/dist/agent/dispatcher.d.ts +283 -437
  3. package/dist/agent/host-roster-reaper.d.ts +8 -10
  4. package/dist/agent/host-roster.d.ts +77 -100
  5. package/dist/agent/ownership-refusal.d.ts +3 -5
  6. package/dist/agent/ownership-tracker.d.ts +42 -76
  7. package/dist/agent/registry.d.ts +121 -233
  8. package/dist/agent/token-store.d.ts +34 -77
  9. package/dist/agent-packaging/availability.d.ts +6 -9
  10. package/dist/agent-packaging/download.d.ts +6 -9
  11. package/dist/agent-packaging/install-closure.d.ts +9 -12
  12. package/dist/agent-packaging/node-binary.d.ts +6 -10
  13. package/dist/agent-packaging/node-runtime-members.d.ts +3 -5
  14. package/dist/agent-packaging/refresh.d.ts +12 -16
  15. package/dist/agent-packaging/store.d.ts +5 -6
  16. package/dist/agent-packaging/upload.d.ts +3 -4
  17. package/dist/app.d.ts +0 -3
  18. package/dist/approvals/apply-decision.d.ts +39 -45
  19. package/dist/approvals/approval-resolver.d.ts +11 -23
  20. package/dist/approvals/held-run-release-wiring.d.ts +14 -21
  21. package/dist/approvals/independent-wiring.d.ts +13 -20
  22. package/dist/approvals/resume-router.d.ts +1 -1
  23. package/dist/approvals/step-approval-bridge.d.ts +11 -21
  24. package/dist/approvals/triggerer-subject.d.ts +8 -10
  25. package/dist/artifacts/artifact-store.d.ts +55 -95
  26. package/dist/artifacts/failure-messages.d.ts +15 -20
  27. package/dist/audit/access-log.d.ts +27 -45
  28. package/dist/audit/sampling-rate-limiter.d.ts +11 -23
  29. package/dist/cache/agent-job-failed-error.d.ts +2 -3
  30. package/dist/cache/build-coordinator.d.ts +5 -28
  31. package/dist/cache/cache-upload-settle.d.ts +11 -11
  32. package/dist/cache/dep-cache.d.ts +32 -60
  33. package/dist/cache/dispatch-cache-ref-tracker.d.ts +15 -23
  34. package/dist/cache/global-eval-round-cache.d.ts +33 -41
  35. package/dist/cache/pending-builds.d.ts +2 -6
  36. package/dist/cache/pending-dynamics.d.ts +2 -7
  37. package/dist/cache/pending-global-evals.d.ts +9 -12
  38. package/dist/cache/pending-inits.d.ts +11 -22
  39. package/dist/cache/pending-precursor-db-watcher.d.ts +24 -32
  40. package/dist/cache/pending-tracker.d.ts +17 -45
  41. package/dist/cache/precursor-result.d.ts +17 -30
  42. package/dist/cache/source-cache.d.ts +36 -65
  43. package/dist/cache/user-cache.d.ts +21 -25
  44. package/dist/cancel/cancel-held-run.d.ts +13 -16
  45. package/dist/cancel/cancel-route-answer.d.ts +1 -2
  46. package/dist/cancel/cancel-run.d.ts +26 -50
  47. package/dist/cancel/dashboard-cancel-handler.d.ts +2 -2
  48. package/dist/cancel/peer-job-cancel.d.ts +11 -14
  49. package/dist/cancel/sweep-stuck-cancelling.d.ts +9 -13
  50. package/dist/cli/api-client.d.ts +33 -76
  51. package/dist/cli/commands/access-log.d.ts +4 -24
  52. package/dist/cli/commands/agent-package.d.ts +7 -15
  53. package/dist/cli/commands/agent-service/agent-env.d.ts +3 -6
  54. package/dist/cli/commands/agent-service/index.d.ts +4 -10
  55. package/dist/cli/commands/agent-service/install.d.ts +4 -11
  56. package/dist/cli/commands/agent-service/status.d.ts +4 -9
  57. package/dist/cli/commands/agent-service/upgrade.d.ts +4 -16
  58. package/dist/cli/commands/agent.d.ts +12 -25
  59. package/dist/cli/commands/api-key.d.ts +7 -7
  60. package/dist/cli/commands/attestations-list.d.ts +7 -17
  61. package/dist/cli/commands/attestations-retry.d.ts +5 -11
  62. package/dist/cli/commands/attestations-reverify.d.ts +4 -5
  63. package/dist/cli/commands/attestations.d.ts +3 -8
  64. package/dist/cli/commands/audit.d.ts +1 -5
  65. package/dist/cli/commands/backend.d.ts +2 -11
  66. package/dist/cli/commands/check-run.d.ts +7 -18
  67. package/dist/cli/commands/cluster-name.d.ts +5 -12
  68. package/dist/cli/commands/cluster-settings.d.ts +28 -53
  69. package/dist/cli/commands/cold-store.d.ts +7 -15
  70. package/dist/cli/commands/config.d.ts +9 -20
  71. package/dist/cli/commands/context.d.ts +8 -20
  72. package/dist/cli/commands/dashboard-encryption-key.d.ts +9 -14
  73. package/dist/cli/commands/db-backup.d.ts +17 -32
  74. package/dist/cli/commands/db.d.ts +3 -4
  75. package/dist/cli/commands/debug-bundle.d.ts +3 -10
  76. package/dist/cli/commands/diagnose.d.ts +3 -14
  77. package/dist/cli/commands/event-dlq.d.ts +4 -12
  78. package/dist/cli/commands/event-log.d.ts +2 -20
  79. package/dist/cli/commands/execution.d.ts +3 -9
  80. package/dist/cli/commands/firecracker/index.d.ts +3 -6
  81. package/dist/cli/commands/held-run.d.ts +23 -37
  82. package/dist/cli/commands/host.d.ts +4 -11
  83. package/dist/cli/commands/inspect-bundle.d.ts +3 -11
  84. package/dist/cli/commands/local-hook.d.ts +2 -10
  85. package/dist/cli/commands/local-trigger.d.ts +2 -2
  86. package/dist/cli/commands/orchestrator-service/drain.d.ts +3 -6
  87. package/dist/cli/commands/orchestrator-service/index.d.ts +6 -14
  88. package/dist/cli/commands/orchestrator-service/install-env.d.ts +25 -49
  89. package/dist/cli/commands/orchestrator-service/install.d.ts +2 -5
  90. package/dist/cli/commands/orchestrator-service/status.d.ts +10 -22
  91. package/dist/cli/commands/orchestrator-service/upgrade.d.ts +6 -15
  92. package/dist/cli/commands/org-settings.d.ts +5 -11
  93. package/dist/cli/commands/peer.d.ts +5 -10
  94. package/dist/cli/commands/queue.d.ts +3 -9
  95. package/dist/cli/commands/registration.d.ts +4 -8
  96. package/dist/cli/commands/remote-source.d.ts +6 -12
  97. package/dist/cli/commands/rotate.d.ts +1 -5
  98. package/dist/cli/commands/runs.d.ts +1 -30
  99. package/dist/cli/commands/scaler.d.ts +5 -12
  100. package/dist/cli/commands/secret.d.ts +1 -9
  101. package/dist/cli/commands/service-health.d.ts +5 -10
  102. package/dist/cli/commands/shared/admin-cli-access-log.d.ts +10 -19
  103. package/dist/cli/commands/shared/bare-metal-binary-check.d.ts +86 -0
  104. package/dist/cli/commands/shared/cli-action.d.ts +1 -4
  105. package/dist/cli/commands/shared/confirm.d.ts +5 -10
  106. package/dist/cli/commands/shared/db.d.ts +1 -12
  107. package/dist/cli/commands/shared/env-file-mode.d.ts +6 -9
  108. package/dist/cli/commands/shared/secret-input.d.ts +7 -21
  109. package/dist/cli/commands/shared/service-verbs.d.ts +6 -12
  110. package/dist/cli/commands/shared/unbound-context-warning.d.ts +2 -4
  111. package/dist/cli/commands/shared/upgrade-hooks.d.ts +7 -16
  112. package/dist/cli/commands/shared/upgrade-safety.d.ts +20 -31
  113. package/dist/cli/commands/shared/versioned-upgrade.d.ts +83 -161
  114. package/dist/cli/commands/signing-key.d.ts +4 -9
  115. package/dist/cli/commands/source-manifest.d.ts +11 -14
  116. package/dist/cli/commands/source.d.ts +7 -32
  117. package/dist/cli/commands/token.d.ts +4 -15
  118. package/dist/cli/commands/trust-policy.d.ts +35 -88
  119. package/dist/cli/commands/variable.d.ts +3 -5
  120. package/dist/cli/commands/workflow.d.ts +3 -24
  121. package/dist/cli/join.d.ts +3 -6
  122. package/dist/cli/kici-admin.d.ts +11 -29
  123. package/dist/cli/lazy-deps/cache.d.ts +1 -14
  124. package/dist/cli/lazy-deps/downloader.d.ts +4 -27
  125. package/dist/cli/lazy-deps/registry.d.ts +5 -25
  126. package/dist/cli/local-github-ingress-url.d.ts +5 -7
  127. package/dist/cli/loopback-callback.d.ts +6 -7
  128. package/dist/cli/open-browser.d.ts +4 -8
  129. package/dist/cli/root-option-routing.d.ts +17 -29
  130. package/dist/cli/service/backup-timer.d.ts +16 -39
  131. package/dist/cli/service/compose-path.d.ts +3 -7
  132. package/dist/cli/service/compose.d.ts +12 -30
  133. package/dist/cli/service/deploy-env.d.ts +6 -18
  134. package/dist/cli/service/entrypoint.d.ts +14 -25
  135. package/dist/cli/service/env-assignment.d.ts +6 -17
  136. package/dist/cli/service/image-digests.d.ts +6 -15
  137. package/dist/cli/service/index.d.ts +2 -18
  138. package/dist/cli/service/instance/index-file.d.ts +9 -16
  139. package/dist/cli/service/instance/manifest.d.ts +33 -59
  140. package/dist/cli/service/instance/resolve.d.ts +32 -68
  141. package/dist/cli/service/instance/types.d.ts +12 -29
  142. package/dist/cli/service/launchd.d.ts +29 -60
  143. package/dist/cli/service/platform-detect.d.ts +13 -68
  144. package/dist/cli/service/privilege.d.ts +12 -25
  145. package/dist/cli/service/shutdown-grace.d.ts +11 -20
  146. package/dist/cli/service/systemd.d.ts +7 -20
  147. package/dist/cli/service/types.d.ts +63 -114
  148. package/dist/cli/service/windows-acl.d.ts +14 -21
  149. package/dist/cli/service/windows-env-file.d.ts +10 -28
  150. package/dist/cli/service/windows.d.ts +15 -31
  151. package/dist/cli/webhook-url-notes.d.ts +4 -6
  152. package/dist/cli/wizard/agent-wizard.d.ts +3 -14
  153. package/dist/cli/wizard/orchestrator-wizard.d.ts +12 -37
  154. package/dist/cli/wizard/prompts.d.ts +6 -16
  155. package/dist/cli.js +4553 -6556
  156. package/dist/cluster/cluster-identity.d.ts +20 -32
  157. package/dist/cluster/cluster-settings-reader.d.ts +50 -77
  158. package/dist/cluster/coordinator-credential.d.ts +4 -5
  159. package/dist/cluster/coordinator.d.ts +76 -148
  160. package/dist/cluster/health-api.d.ts +2 -10
  161. package/dist/cluster/index.d.ts +1 -6
  162. package/dist/cluster/instance-heartbeat.d.ts +26 -42
  163. package/dist/cluster/join-client.d.ts +4 -7
  164. package/dist/cluster/join-handler.d.ts +3 -7
  165. package/dist/cluster/join-token.d.ts +13 -27
  166. package/dist/cluster/leader-gated-scheduler.d.ts +8 -17
  167. package/dist/cluster/orphan-recovery.d.ts +13 -35
  168. package/dist/cluster/peer-auth-coordinator.d.ts +2 -8
  169. package/dist/cluster/peer-client.d.ts +46 -76
  170. package/dist/cluster/peer-credentials.d.ts +24 -70
  171. package/dist/cluster/peer-crypto.d.ts +5 -26
  172. package/dist/cluster/peer-forget.d.ts +3 -3
  173. package/dist/cluster/peer-handler.d.ts +47 -71
  174. package/dist/cluster/peer-registry.d.ts +37 -106
  175. package/dist/cluster/plan-headroom-store.d.ts +4 -6
  176. package/dist/cluster/raft-state.d.ts +4 -13
  177. package/dist/cluster/raft.d.ts +18 -53
  178. package/dist/cluster/reconcile-identity.d.ts +8 -11
  179. package/dist/cluster/rerouted-job-guard.d.ts +7 -11
  180. package/dist/cluster/verified-issuer.d.ts +2 -3
  181. package/dist/cluster/worker-cluster-settings.d.ts +7 -10
  182. package/dist/cluster/worker-eviction.d.ts +16 -26
  183. package/dist/cold-store/load-access-log-range.d.ts +15 -31
  184. package/dist/cold-store/load-event-log-range.d.ts +13 -27
  185. package/dist/cold-store/load-secret-audit-log-range.d.ts +8 -12
  186. package/dist/cold-store/orchestrator-cold-store.d.ts +8 -28
  187. package/dist/cold-store/tables/access-log.d.ts +12 -14
  188. package/dist/cold-store/tables/event-log.d.ts +4 -8
  189. package/dist/cold-store/tables/execution-runs.d.ts +6 -11
  190. package/dist/cold-store/tables/secret-audit-log.d.ts +5 -12
  191. package/dist/concurrency/dispatch-next-queued.d.ts +13 -25
  192. package/dist/concurrency/queue-manager.d.ts +22 -54
  193. package/dist/concurrency/waiters.d.ts +15 -31
  194. package/dist/config/encryption.d.ts +0 -2
  195. package/dist/config/loader.d.ts +0 -1
  196. package/dist/config/reload.d.ts +0 -6
  197. package/dist/config/resolver.d.ts +0 -4
  198. package/dist/config/shared-store.d.ts +0 -2
  199. package/dist/config/types.d.ts +0 -3
  200. package/dist/content-requirements-cache.d.ts +0 -1
  201. package/dist/contexts/context-store.d.ts +0 -2
  202. package/dist/contexts/held-runs.d.ts +0 -2
  203. package/dist/contexts/variable-store.d.ts +0 -2
  204. package/dist/dashboard/attestation-filters.d.ts +13 -18
  205. package/dist/dashboard/handler.d.ts +143 -307
  206. package/dist/db/client.d.ts +2 -6
  207. package/dist/db/deferred-index-build.d.ts +8 -10
  208. package/dist/db/deferred-indexes.d.ts +15 -22
  209. package/dist/db/migration-provider.d.ts +2 -4
  210. package/dist/db/migration-test-harness.d.ts +26 -44
  211. package/dist/db/migrations/001_initial.d.ts +1 -4
  212. package/dist/db/migrations/002_config_versions_key_version.d.ts +5 -8
  213. package/dist/db/migrations/003_access_log.d.ts +10 -15
  214. package/dist/db/migrations/004_rename_bundle_to_source.d.ts +7 -9
  215. package/dist/db/migrations/005_cold_store_chunk_counter.d.ts +4 -10
  216. package/dist/db/migrations/006_runs_jobs_steps_archived_at.d.ts +9 -29
  217. package/dist/db/migrations/007_audit_logs_archived_at.d.ts +11 -30
  218. package/dist/db/migrations/008_event_log_archived_at.d.ts +14 -29
  219. package/dist/db/migrations/009_access_log_trigram.d.ts +4 -8
  220. package/dist/db/migrations/010_cold_store_chunks.d.ts +16 -26
  221. package/dist/db/migrations/011_drop_source_secrets_notify.d.ts +6 -14
  222. package/dist/db/migrations/012_peer_credentials_active_uniq.d.ts +9 -14
  223. package/dist/db/migrations/013_execution_log_bytes.d.ts +5 -13
  224. package/dist/db/migrations/014_kici_events_lease_retry.d.ts +14 -27
  225. package/dist/db/migrations/015_org_settings_customer_scoped.d.ts +12 -17
  226. package/dist/db/migrations/016_org_settings_allow_http_npm.d.ts +4 -6
  227. package/dist/db/migrations/019_generic_sources_change_notify.d.ts +13 -17
  228. package/dist/db/migrations/020_org_settings_dashboard_write_policy.d.ts +5 -8
  229. package/dist/db/migrations/021_check_run_tracking.d.ts +5 -17
  230. package/dist/db/migrations/022_scaler_manager_state.d.ts +10 -20
  231. package/dist/db/migrations/023_dispatch_queue_recovery_deadline.d.ts +7 -18
  232. package/dist/db/migrations/024_dispatch_queue_provisioning_error.d.ts +5 -11
  233. package/dist/db/migrations/025_init_failure.d.ts +5 -9
  234. package/dist/db/migrations/027_workflow_timeout.d.ts +5 -13
  235. package/dist/db/migrations/029_dispatch_queue_attempts.d.ts +4 -10
  236. package/dist/db/migrations/030_held_runs_env_set_null.d.ts +5 -6
  237. package/dist/db/migrations/031_dispatch_queue_ack_deadline.d.ts +6 -12
  238. package/dist/db/migrations/033_org_settings_approval.d.ts +7 -10
  239. package/dist/db/migrations/034_held_runs_generalize.d.ts +10 -18
  240. package/dist/db/migrations/035_pending_workflow_contexts.d.ts +4 -5
  241. package/dist/db/migrations/037_generic_sources_provider_type_local.d.ts +5 -6
  242. package/dist/db/migrations/038_remote_sources.d.ts +5 -7
  243. package/dist/db/migrations/045_host_properties.d.ts +5 -9
  244. package/dist/db/migrations/046_join_token_consumed_by_instance.d.ts +5 -10
  245. package/dist/db/migrations/048_host_reboot_pending.d.ts +6 -12
  246. package/dist/db/migrations/049_held_runs_payload.d.ts +3 -8
  247. package/dist/db/migrations/050_sources_slug.d.ts +4 -5
  248. package/dist/db/migrations/051_binding_host_pattern.d.ts +7 -10
  249. package/dist/db/migrations/052_host_reach_metadata.d.ts +8 -11
  250. package/dist/db/migrations/053_agent_token_single_use.d.ts +6 -10
  251. package/dist/db/migrations/054_local_working_tree.d.ts +4 -6
  252. package/dist/db/migrations/055_agent_token_mandatory_labels.d.ts +6 -11
  253. package/dist/db/migrations/056_execution_jobs_environments.d.ts +4 -11
  254. package/dist/db/migrations/064_execution_jobs_skipped_environments.d.ts +6 -9
  255. package/dist/db/migrations/065_pending_attestations.d.ts +9 -12
  256. package/dist/db/migrations/066_pending_attestations_rejected.d.ts +4 -7
  257. package/dist/db/migrations/068_request_idempotency.d.ts +7 -9
  258. package/dist/db/migrations/069_reroute_tunables.d.ts +6 -14
  259. package/dist/db/migrations/071_batch_accumulation.d.ts +8 -16
  260. package/dist/db/migrations/072_dispatch_queue_run_id_index.d.ts +3 -9
  261. package/dist/db/migrations/074_normalize_zero_concurrency_limit.d.ts +4 -7
  262. package/dist/db/migrations/076_artifacts.d.ts +7 -8
  263. package/dist/db/migrations/078_org_settings_backup_staleness.d.ts +3 -6
  264. package/dist/db/migrations/079_org_settings_scaler_spawn_timeout.d.ts +4 -8
  265. package/dist/db/migrations/080_cluster_settings.d.ts +6 -10
  266. package/dist/db/migrations/081_org_settings_queue_timeout.d.ts +7 -11
  267. package/dist/db/migrations/082_host_s3_reachable.d.ts +5 -10
  268. package/dist/db/migrations/083_org_settings_artifact_caps.d.ts +6 -8
  269. package/dist/db/migrations/084_orchestrator_signing_keys.d.ts +8 -13
  270. package/dist/db/migrations/085_cluster_settings_reroute_flap_grace_ms.d.ts +4 -5
  271. package/dist/db/migrations/086_cluster_settings_max_fanout_hosts.d.ts +3 -3
  272. package/dist/db/migrations/087_cluster_settings_event_router_rate_limit.d.ts +5 -3
  273. package/dist/db/migrations/088_cluster_settings_cache_max_tarball_bytes.d.ts +3 -3
  274. package/dist/db/migrations/089_cluster_settings_cache_ttl_days.d.ts +3 -5
  275. package/dist/db/migrations/090_cluster_settings_concurrency_wait_timeout_ms.d.ts +3 -6
  276. package/dist/db/migrations/091_cluster_settings_agent_token_ttl_ms.d.ts +3 -6
  277. package/dist/db/migrations/092_cluster_settings_version.d.ts +5 -9
  278. package/dist/db/migrations/094_dashboard_encryption_keys.d.ts +9 -14
  279. package/dist/db/migrations/095_dashboard_write_policy_tristate.d.ts +2 -6
  280. package/dist/db/migrations/099_cluster_settings_dashboard_verified_issuer.d.ts +8 -11
  281. package/dist/db/migrations/101_contexts_hold_expiry_drop_default.d.ts +9 -15
  282. package/dist/db/migrations/102_dispatch_queue_agent_id.d.ts +6 -11
  283. package/dist/db/migrations/103_cluster_settings_ownership_db_check_timeout_ms.d.ts +6 -12
  284. package/dist/db/migrations/104_check_run_terminal_sent.d.ts +8 -14
  285. package/dist/db/migrations/105_org_trust_policy.d.ts +5 -7
  286. package/dist/db/migrations/106_cluster_settings_check_run_tracking_ttl_days.d.ts +4 -12
  287. package/dist/db/migrations/107_check_run_tracking_updated_at_index.d.ts +8 -14
  288. package/dist/db/migrations/113_execution_runs_workflow_repo_index.d.ts +10 -19
  289. package/dist/db/migrations/115_global_workflows_cluster_switch.d.ts +2 -3
  290. package/dist/db/migrations/121_org_settings_allow_untrusted_dockerfile_builds.d.ts +7 -8
  291. package/dist/db/migrations/122_host_roster_scaler_managed.d.ts +9 -16
  292. package/dist/db/migrations/123_workflow_registrations_default_branch.d.ts +8 -16
  293. package/dist/db/migrations/125_org_trust_directory.d.ts +13 -21
  294. package/dist/db/migrations/126_held_runs_posted_pending_check.d.ts +10 -16
  295. package/dist/db/migrations/127_org_trust_policy_approval_expiry_seconds.d.ts +8 -16
  296. package/dist/db/migrations/128_execution_runs_global_eval_round.d.ts +6 -11
  297. package/dist/db/migrations/129_execution_runs_dispatch_routing_key.d.ts +8 -11
  298. package/dist/db/migrations/130_scaler_provision_outcomes.d.ts +13 -20
  299. package/dist/db/migrations/131_execution_jobs_git_credentials.d.ts +12 -22
  300. package/dist/db/migrations/132_execution_runs_trigger_event.d.ts +6 -16
  301. package/dist/db/migrations/133_dispatch_queue_source_tar_digest.d.ts +6 -9
  302. package/dist/db/migrations/140_dispatch_queue_canonical_labels.d.ts +22 -40
  303. package/dist/db/migrations/143_execution_jobs_precursor_result.d.ts +9 -18
  304. package/dist/db/migrations/144_execution_runs_registration_window.d.ts +12 -20
  305. package/dist/db/migrations/147_sealed_job_secrets.d.ts +5 -9
  306. package/dist/db/migrations/148_cluster_settings_sealed_secrets_retry_backoff_ms.d.ts +7 -13
  307. package/dist/db/migrations/150_execution_runs_status_epoch.d.ts +6 -11
  308. package/dist/db/migrations/152_org_settings_cache_upload_settle_timeout.d.ts +5 -8
  309. package/dist/db/migrations/157_host_roster_identity_source.d.ts +9 -13
  310. package/dist/db/migrations/159_org_id_widen_to_source_width.d.ts +5 -0
  311. package/dist/db/migrator.d.ts +17 -25
  312. package/dist/db/notify-listener.d.ts +8 -11
  313. package/dist/db/repos/dashboard-encryption-keys-repo.d.ts +9 -10
  314. package/dist/db/synthetic-job-ids.d.ts +6 -8
  315. package/dist/db/types.d.ts +531 -1058
  316. package/dist/deployment/deployment-identity.d.ts +42 -60
  317. package/dist/diagnostics/bundle-reader.d.ts +3 -15
  318. package/dist/diagnostics/bundle-writer.d.ts +5 -12
  319. package/dist/diagnostics/checks/agents.d.ts +1 -7
  320. package/dist/diagnostics/checks/backup.d.ts +7 -10
  321. package/dist/diagnostics/checks/certs.d.ts +1 -6
  322. package/dist/diagnostics/checks/config.d.ts +2 -5
  323. package/dist/diagnostics/checks/db.d.ts +1 -1
  324. package/dist/diagnostics/checks/disk.d.ts +1 -6
  325. package/dist/diagnostics/checks/firecracker-network.d.ts +3 -3
  326. package/dist/diagnostics/checks/index.d.ts +0 -6
  327. package/dist/diagnostics/checks/retention.d.ts +3 -6
  328. package/dist/diagnostics/checks/scaler.d.ts +3 -7
  329. package/dist/diagnostics/checks/ws.d.ts +1 -6
  330. package/dist/diagnostics/fleet-collector.d.ts +11 -14
  331. package/dist/diagnostics/fleet-constants.d.ts +1 -3
  332. package/dist/diagnostics/fleet-selection.d.ts +3 -7
  333. package/dist/diagnostics/fleet-topology.d.ts +2 -6
  334. package/dist/diagnostics/fleet-wiring.d.ts +6 -12
  335. package/dist/diagnostics/index.d.ts +0 -5
  336. package/dist/diagnostics/runner.d.ts +4 -8
  337. package/dist/diagnostics/types.d.ts +10 -21
  338. package/dist/drain/drain-controller.d.ts +16 -22
  339. package/dist/entry-helpers.d.ts +0 -2
  340. package/dist/events/circuit-breaker.d.ts +0 -3
  341. package/dist/events/event-router.d.ts +1 -2
  342. package/dist/events/event-store.d.ts +0 -9
  343. package/dist/events/trust-store.d.ts +0 -3
  344. package/dist/events/types.d.ts +0 -9
  345. package/dist/firecracker/host-network.d.ts +24 -30
  346. package/dist/firecracker/net-interfaces.d.ts +4 -7
  347. package/dist/helpers/rate-limiter.d.ts +0 -1
  348. package/dist/index.js +251 -486
  349. package/dist/metrics/agent-metrics-aggregator.d.ts +24 -67
  350. package/dist/metrics/metrics-reporter.d.ts +4 -13
  351. package/dist/metrics/prometheus.d.ts +47 -81
  352. package/dist/orchestrator-core.d.ts +3 -7
  353. package/dist/pipeline/content-filter.d.ts +20 -30
  354. package/dist/pipeline/cross-source-tally.d.ts +7 -8
  355. package/dist/pipeline/decorating-secret-resolver.d.ts +4 -8
  356. package/dist/pipeline/degraded-reason.d.ts +3 -4
  357. package/dist/pipeline/direct-ingress-deps.d.ts +15 -24
  358. package/dist/pipeline/dispatch-matched-workflow.d.ts +289 -525
  359. package/dist/pipeline/flatten-lock-steps.d.ts +4 -6
  360. package/dist/pipeline/global-dispatch-identity.d.ts +5 -10
  361. package/dist/pipeline/global-eval-round.d.ts +65 -151
  362. package/dist/pipeline/global-round-hold.d.ts +5 -7
  363. package/dist/pipeline/held-context-data.d.ts +5 -8
  364. package/dist/pipeline/held-round-registrations.d.ts +8 -11
  365. package/dist/pipeline/install-gate.d.ts +15 -25
  366. package/dist/pipeline/install-secrets-resolver.d.ts +24 -34
  367. package/dist/pipeline/internal-event-pipeline.d.ts +45 -62
  368. package/dist/pipeline/invoke-gate.d.ts +27 -40
  369. package/dist/pipeline/job-contexts.d.ts +19 -36
  370. package/dist/pipeline/manual-schedule.d.ts +7 -13
  371. package/dist/pipeline/needs-scheduler.d.ts +29 -46
  372. package/dist/pipeline/pending-workflow-context.d.ts +14 -28
  373. package/dist/pipeline/process-webhook.d.ts +88 -123
  374. package/dist/pipeline/processor.d.ts +209 -355
  375. package/dist/pipeline/remote-source-store.d.ts +5 -8
  376. package/dist/pipeline/request-idempotency.d.ts +10 -13
  377. package/dist/pipeline/rerun-global.d.ts +6 -7
  378. package/dist/pipeline/rerun-inputs.d.ts +23 -37
  379. package/dist/pipeline/rerun.d.ts +34 -57
  380. package/dist/pipeline/resolve-sandbox-grant.d.ts +5 -10
  381. package/dist/pipeline/resume-workflow.d.ts +28 -34
  382. package/dist/pipeline/route-or-dispatch-jobs.d.ts +19 -30
  383. package/dist/pipeline/run-event-context.d.ts +16 -21
  384. package/dist/pipeline/sandbox-allowlist-reader.d.ts +7 -11
  385. package/dist/pipeline/security-hold-check.d.ts +56 -80
  386. package/dist/pipeline/test-pipeline.d.ts +21 -46
  387. package/dist/pipeline/unbound-job-context.d.ts +6 -9
  388. package/dist/pipeline/undispatched-hold-checks.d.ts +4 -6
  389. package/dist/pipeline/wave-scheduler.d.ts +15 -22
  390. package/dist/pipeline/webhook-payload-store.d.ts +3 -10
  391. package/dist/pipeline/workflow-lock-at-sha.d.ts +14 -20
  392. package/dist/policy/dashboard-write-policy.d.ts +1 -1
  393. package/dist/provider-registry.d.ts +0 -19
  394. package/dist/providers/generic/index.d.ts +0 -2
  395. package/dist/providers/generic/normalizer.d.ts +0 -1
  396. package/dist/providers/generic/verification.d.ts +0 -8
  397. package/dist/providers/github/auth.d.ts +0 -1
  398. package/dist/providers/github/changed-files.d.ts +2 -1
  399. package/dist/providers/github/file-contents.d.ts +0 -4
  400. package/dist/providers/github/lock-file.d.ts +0 -4
  401. package/dist/providers/github/normalizer.d.ts +1 -9
  402. package/dist/providers/local/index.d.ts +1 -2
  403. package/dist/providers/local/lock-file-fetcher.d.ts +0 -4
  404. package/dist/providers/local/normalizer.d.ts +0 -10
  405. package/dist/providers/local/repo-url-builder.d.ts +0 -2
  406. package/dist/providers/universal-git/clone-token.d.ts +0 -2
  407. package/dist/providers/universal-git/lock-file.d.ts +0 -2
  408. package/dist/providers/universal-git/normalizer.d.ts +0 -2
  409. package/dist/queue/bootstrap.d.ts +3 -15
  410. package/dist/queue/cleanup.d.ts +29 -50
  411. package/dist/queue/depth-refresher.d.ts +21 -39
  412. package/dist/queue/job-queue.d.ts +112 -163
  413. package/dist/queue/retention.d.ts +23 -36
  414. package/dist/queue/scheduled-job.d.ts +17 -39
  415. package/dist/queue/terminalize-unroutable.d.ts +21 -18
  416. package/dist/queue/unroutable-probe.d.ts +15 -22
  417. package/dist/registration/extractor.d.ts +0 -6
  418. package/dist/registration/registration-index.d.ts +0 -6
  419. package/dist/registration/registration-store.d.ts +0 -9
  420. package/dist/reporting/agent-failure-category.d.ts +3 -5
  421. package/dist/reporting/check-run-reporter.d.ts +142 -316
  422. package/dist/reporting/check-run-summary.d.ts +16 -35
  423. package/dist/reporting/check-run-tracking-store.d.ts +54 -107
  424. package/dist/reporting/execution-tracker.d.ts +356 -526
  425. package/dist/reporting/fs-log-storage.d.ts +31 -33
  426. package/dist/reporting/job-check-run-completion.d.ts +14 -22
  427. package/dist/reporting/log-chunk-sink.d.ts +11 -16
  428. package/dist/reporting/log-pull-handler.d.ts +4 -13
  429. package/dist/reporting/log-retention.d.ts +3 -4
  430. package/dist/reporting/log-storage.d.ts +24 -52
  431. package/dist/reporting/log-writer.d.ts +28 -56
  432. package/dist/reporting/peer-log-normalize.d.ts +4 -8
  433. package/dist/reporting/run-aggregator.d.ts +6 -11
  434. package/dist/reporting/run-summary-fields.d.ts +5 -8
  435. package/dist/reporting/s3-log-storage.d.ts +31 -50
  436. package/dist/reporting/step-display-order.d.ts +11 -21
  437. package/dist/reporting/step-log-buffer.d.ts +7 -28
  438. package/dist/reporting/step-log-reader.d.ts +11 -19
  439. package/dist/routes/admin-access-log.d.ts +4 -6
  440. package/dist/routes/admin-auth.d.ts +19 -38
  441. package/dist/routes/admin-backends.d.ts +3 -14
  442. package/dist/routes/admin-cluster-name.d.ts +13 -21
  443. package/dist/routes/admin-cluster-settings.d.ts +6 -9
  444. package/dist/routes/admin-config.d.ts +7 -19
  445. package/dist/routes/admin-contexts.d.ts +6 -13
  446. package/dist/routes/admin-db.d.ts +5 -10
  447. package/dist/routes/admin-event-dlq.d.ts +3 -5
  448. package/dist/routes/admin-event-inspect.d.ts +3 -4
  449. package/dist/routes/admin-event-log.d.ts +3 -7
  450. package/dist/routes/admin-events.d.ts +16 -30
  451. package/dist/routes/admin-held-runs.d.ts +52 -76
  452. package/dist/routes/admin-maintenance.d.ts +3 -6
  453. package/dist/routes/admin-orchestrator-drain.d.ts +0 -2
  454. package/dist/routes/admin-org-settings.d.ts +8 -14
  455. package/dist/routes/admin-peer-forget.d.ts +0 -1
  456. package/dist/routes/admin-queue-execution.d.ts +3 -3
  457. package/dist/routes/admin-registrations.d.ts +3 -12
  458. package/dist/routes/admin-runs.d.ts +16 -29
  459. package/dist/routes/admin-scaler-orphans.d.ts +4 -4
  460. package/dist/routes/admin-scaler-reload.d.ts +5 -8
  461. package/dist/routes/admin-scheduled-jobs.d.ts +3 -4
  462. package/dist/routes/admin-sources.d.ts +20 -29
  463. package/dist/routes/admin-trust-policy.d.ts +31 -48
  464. package/dist/routes/admin.d.ts +67 -94
  465. package/dist/routes/caller-identity.d.ts +45 -0
  466. package/dist/routes/capabilities.d.ts +8 -13
  467. package/dist/routes/diagnostics.d.ts +2 -10
  468. package/dist/routes/fleet.d.ts +1 -2
  469. package/dist/routes/github-webhook.d.ts +2 -5
  470. package/dist/routes/health.d.ts +6 -19
  471. package/dist/routes/provenance-oidc.d.ts +3 -3
  472. package/dist/routes/test-direct.d.ts +46 -0
  473. package/dist/routes/uploads.d.ts +14 -19
  474. package/dist/routes/webhooks.d.ts +2 -24
  475. package/dist/scaler/agent-binary-location.d.ts +77 -0
  476. package/dist/scaler/agent-fit.d.ts +2 -2
  477. package/dist/scaler/backend-factory.d.ts +10 -18
  478. package/dist/scaler/bare-metal-backend.d.ts +28 -45
  479. package/dist/scaler/claim-store.d.ts +20 -43
  480. package/dist/scaler/config.d.ts +10 -37
  481. package/dist/scaler/container-backend.d.ts +22 -35
  482. package/dist/scaler/container-hostconfig.d.ts +10 -16
  483. package/dist/scaler/container-routing.d.ts +10 -13
  484. package/dist/scaler/disk-guard.d.ts +2 -3
  485. package/dist/scaler/event-backend.d.ts +33 -58
  486. package/dist/scaler/event-provision-reaper.d.ts +61 -84
  487. package/dist/scaler/failure-tracker.d.ts +6 -13
  488. package/dist/scaler/file-tail.d.ts +6 -19
  489. package/dist/scaler/firecracker-api.d.ts +19 -63
  490. package/dist/scaler/firecracker-backend.d.ts +142 -258
  491. package/dist/scaler/host-access.d.ts +7 -10
  492. package/dist/scaler/index.d.ts +3 -6
  493. package/dist/scaler/ip-allocator.d.ts +30 -82
  494. package/dist/scaler/label-matcher.d.ts +14 -35
  495. package/dist/scaler/log-forwarder.d.ts +6 -25
  496. package/dist/scaler/machine-ledger.d.ts +39 -86
  497. package/dist/scaler/manager.d.ts +517 -787
  498. package/dist/scaler/pending-scale-sweeper.d.ts +8 -11
  499. package/dist/scaler/reap-orphans.d.ts +8 -12
  500. package/dist/scaler/resolve-container-auth.d.ts +12 -21
  501. package/dist/scaler/scaler-events.d.ts +2 -5
  502. package/dist/scaler/scaler-state-store.d.ts +127 -189
  503. package/dist/scaler/spawn-errors.d.ts +1 -4
  504. package/dist/scaler/startup-orphan-sweep.d.ts +3 -4
  505. package/dist/scaler/startup-tools-check.d.ts +21 -0
  506. package/dist/scaler/types.d.ts +142 -255
  507. package/dist/scaler/vm-job-bindings.d.ts +5 -9
  508. package/dist/scaler/warm-pool.d.ts +46 -93
  509. package/dist/secrets/audit-logger.d.ts +0 -3
  510. package/dist/secrets/backend-health.d.ts +0 -9
  511. package/dist/secrets/backend-registry.d.ts +0 -9
  512. package/dist/secrets/cleanup.d.ts +0 -1
  513. package/dist/secrets/config.d.ts +0 -3
  514. package/dist/secrets/ephemeral-keys.d.ts +0 -3
  515. package/dist/secrets/pg-secret-store.d.ts +0 -3
  516. package/dist/secrets/rbac.d.ts +5 -7
  517. package/dist/secrets/routing-key-scope.d.ts +1 -0
  518. package/dist/secrets/secret-output-store.d.ts +0 -6
  519. package/dist/secrets/secret-resolver.d.ts +2 -6
  520. package/dist/secrets/token-manager.d.ts +1 -4
  521. package/dist/secrets/vault-secret-store.d.ts +0 -13
  522. package/dist/security/comment-handler.d.ts +0 -2
  523. package/dist/security/workflow-diff.d.ts +1 -1
  524. package/dist/server.js +49004 -53782
  525. package/dist/sources/source-manager.d.ts +0 -3
  526. package/dist/sources/source-store.d.ts +0 -9
  527. package/dist/sources/source-validator.d.ts +0 -3
  528. package/dist/stale-detector/all-terminal-runs.d.ts +8 -11
  529. package/dist/stale-detector/gate-deadline-detector.d.ts +14 -19
  530. package/dist/stale-detector/reboot-deadline-sweep.d.ts +7 -11
  531. package/dist/stale-detector/stale-dispatch-candidates.d.ts +13 -20
  532. package/dist/stale-detector/stale-run-detector.d.ts +74 -121
  533. package/dist/stale-detector/workflow-deadline-detector.d.ts +15 -43
  534. package/dist/standalone.js +9342 -13077
  535. package/dist/storage/blob-routes.d.ts +10 -19
  536. package/dist/storage/filesystem.d.ts +19 -29
  537. package/dist/storage/index.d.ts +2 -10
  538. package/dist/storage/key-discriminator.d.ts +8 -10
  539. package/dist/storage/loopback-guard.d.ts +27 -45
  540. package/dist/storage/s3.d.ts +26 -53
  541. package/dist/storage/sign-url.d.ts +7 -22
  542. package/dist/storage/types.d.ts +46 -72
  543. package/dist/webhook/event-log.d.ts +0 -2
  544. package/dist/webhook/generic-sources.d.ts +0 -21
  545. package/dist/webhook/ingest-admission.d.ts +0 -1
  546. package/dist/webhook/relay-buffer.d.ts +2 -2
  547. package/dist/webhook/verify-inbound.d.ts +0 -1
  548. package/dist/worker/in-memory-execution-tracker.d.ts +9 -31
  549. package/dist/worker/in-memory-job-queue.d.ts +32 -72
  550. package/dist/worker/peer-outbox.d.ts +5 -8
  551. package/dist/worker/reroute-dispatch.d.ts +4 -6
  552. package/dist/worker/static-agent-token-store.d.ts +6 -27
  553. package/dist/worker/worker-outbox-relay.d.ts +2 -2
  554. package/dist/worker/worker-status.d.ts +3 -20
  555. package/dist/ws/agent-api-registry.d.ts +8 -27
  556. package/dist/ws/agent-handler.d.ts +63 -110
  557. package/dist/ws/agent-heartbeat.d.ts +5 -12
  558. package/dist/ws/bringup-api.d.ts +31 -38
  559. package/dist/ws/dashboard-backends-handler.d.ts +12 -22
  560. package/dist/ws/dashboard-context-handler.d.ts +37 -80
  561. package/dist/ws/dashboard-diagnostics-handler.d.ts +8 -25
  562. package/dist/ws/dashboard-dispatch-guard.d.ts +3 -4
  563. package/dist/ws/dashboard-fleet-handler.d.ts +9 -13
  564. package/dist/ws/dashboard-fleet-write-handler.d.ts +7 -21
  565. package/dist/ws/dashboard-global-workflows-handler.d.ts +22 -44
  566. package/dist/ws/dashboard-registrations-handler.d.ts +10 -27
  567. package/dist/ws/dashboard-run-state-handler.d.ts +10 -13
  568. package/dist/ws/event-buffer.d.ts +3 -6
  569. package/dist/ws/execution-status-frame.d.ts +7 -10
  570. package/dist/ws/failure-messages.d.ts +9 -14
  571. package/dist/ws/fleet-agent-collector.d.ts +6 -12
  572. package/dist/ws/fleet-runs-on-all.d.ts +1 -6
  573. package/dist/ws/git-credential-relay.d.ts +12 -20
  574. package/dist/ws/inventory-api.d.ts +4 -5
  575. package/dist/ws/observer-registry.d.ts +14 -59
  576. package/dist/ws/ownership-gate.d.ts +1 -1
  577. package/dist/ws/platform-client.d.ts +21 -30
  578. package/dist/ws/replay-chunker.d.ts +7 -10
  579. package/dist/ws/server-options.d.ts +5 -9
  580. package/dist/ws/test-relay-handlers.d.ts +46 -63
  581. package/installer-image-digests.json +3 -3
  582. package/package.json +6 -5
  583. package/sbom.spdx.json +53 -53
  584. package/dist/__test-helpers__/fake-scaler-state-store.d.ts +0 -24
  585. package/dist/__test-helpers__/mock-db-query.d.ts +0 -129
  586. package/dist/__test-helpers__/mock-db.d.ts +0 -134
  587. package/dist/__test-helpers__/mock-ws.d.ts +0 -13
  588. package/dist/__test-helpers__/peer-mutual-auth.d.ts +0 -42
  589. package/dist/__test-helpers__/scratch-db.d.ts +0 -16
  590. package/dist/__test-helpers__/test-db.d.ts +0 -34
  591. package/dist/pipeline/dispatch-matched-workflow.test-helpers.d.ts +0 -121
  592. package/dist/scaler/container-spawn.d.ts +0 -28
@@ -24,10 +24,7 @@ export declare enum HostIdentitySource {
24
24
  operator = "operator",
25
25
  platform = "platform"
26
26
  }
27
- /**
28
- * PostgreSQL-only database types.
29
- * Column names use snake_case matching the actual database column names.
30
- */
27
+ /** PostgreSQL schema; every key and column name is the snake_case database name. */
31
28
  export interface Database {
32
29
  dispatch_queue: DispatchQueueTable;
33
30
  dedup_cache: DedupCacheTable;
@@ -93,13 +90,12 @@ export interface Database {
93
90
  backup_runs: BackupRunsTable;
94
91
  }
95
92
  /**
96
- * Open accumulation window for a `workflowsFailedBatch` registration.
97
- * One live window per subscribing workflow (`registration_id` is unique);
98
- * the first matching failure opens it and the leader sweep closes it once
99
- * `expires_at` passes, emitting a single `__workflows_failed_batch` event.
93
+ * Open accumulation window for a `workflowsFailedBatch` registration, one per subscribing
94
+ * workflow. The first matching failure opens it; the leader sweep closes it once `expires_at`
95
+ * passes, emitting a single `__workflows_failed_batch` event.
100
96
  */
101
97
  export interface BatchAccumulationWindowsTable {
102
- /** Window id (primary key). */
98
+ /** Primary key. */
103
99
  id: string;
104
100
  /** Owning customer/org id. */
105
101
  customer_id: string;
@@ -107,7 +103,7 @@ export interface BatchAccumulationWindowsTable {
107
103
  registration_id: string;
108
104
  /** Routing key captured at open time so the sweep can emit without the index. */
109
105
  routing_key: string;
110
- /** Repo identifier captured at open time. */
106
+ /** Captured at open time. */
111
107
  repo_identifier: string;
112
108
  /** Accumulation window length in milliseconds. */
113
109
  accumulate_for_ms: number;
@@ -118,43 +114,32 @@ export interface BatchAccumulationWindowsTable {
118
114
  }
119
115
  export type BatchAccumulationWindow = Selectable<BatchAccumulationWindowsTable>;
120
116
  export type NewBatchAccumulationWindow = Insertable<BatchAccumulationWindowsTable>;
121
- /**
122
- * A single failed run buffered into a batch-accumulation window.
123
- * Deleted with its window via `ON DELETE CASCADE` when the window is swept.
124
- */
117
+ /** A failed run buffered into a batch-accumulation window; cascade-deleted with its window. */
125
118
  export interface BatchAccumulationItemsTable {
126
- /** Item id (primary key). */
119
+ /** Primary key. */
127
120
  id: string;
128
- /** Owning window id (FK, cascade-deleted). */
129
121
  window_id: string;
130
- /** The failed run's id. */
131
122
  run_id: string;
132
- /** Repo identifier of the failed run. */
133
123
  repo_identifier: string;
134
- /** Workflow name of the failed run. */
135
124
  workflow_name: string;
136
125
  /** Failure class (`RunFailureClass`) when known. */
137
126
  failure_class: string | null;
138
127
  /** Triggering actor username when known. */
139
128
  sender_username: string | null;
140
- /** When the item was buffered. */
141
129
  created_at: Generated<Date>;
142
130
  }
143
131
  export type BatchAccumulationItem = Selectable<BatchAccumulationItemsTable>;
144
132
  export type NewBatchAccumulationItem = Insertable<BatchAccumulationItemsTable>;
145
133
  /**
146
- * Request idempotency claim table.
147
- * Keyed on the Platform `requestId`; makes run-minting dashboard requests
148
- * (`run.rerun.request`, `run.manual_schedule.request`) idempotent across an HA
149
- * relay failover so a re-sent request returns the first coordinator's
150
- * `new_run_id` instead of creating a second run. Pruned after 1h.
134
+ * Makes run-minting dashboard requests (`run.rerun.request`, `run.manual_schedule.request`)
135
+ * idempotent across an HA relay failover: a re-sent Platform `requestId` returns the first
136
+ * coordinator's `new_run_id` instead of a second run. Pruned after 1h.
151
137
  */
152
138
  export interface RequestIdempotencyTable {
153
- /** Platform-minted requestId for the run-minting request (primary key / idempotency key). */
139
+ /** Platform-minted requestId (primary key). */
154
140
  request_id: string;
155
- /** The run id the winning coordinator created for this requestId. */
141
+ /** The run the winning coordinator created. */
156
142
  new_run_id: string;
157
- /** When the claim was recorded. */
158
143
  created_at: Generated<Date>;
159
144
  }
160
145
  export type RequestIdempotency = Selectable<RequestIdempotencyTable>;
@@ -169,9 +154,9 @@ export interface BackupRunsTable {
169
154
  created_at: Generated<Date>;
170
155
  /** Local path the dump was written to (informational). */
171
156
  dump_path: string;
172
- /** Size of the dump file in bytes. */
157
+ /** Dump size in bytes. */
173
158
  byte_size: string | bigint;
174
- /** Secret-key generation the DB's encrypted config was under (null when no encrypted config). */
159
+ /** Secret-key generation of the DB's encrypted config (null when it has none). */
175
160
  secret_key_version: number | null;
176
161
  /** Server version string the dump was taken from (e.g. "160003"). */
177
162
  pg_server_version: string;
@@ -182,22 +167,16 @@ export interface BackupRunsTable {
182
167
  }
183
168
  export type BackupRun = Selectable<BackupRunsTable>;
184
169
  export type NewBackupRun = Insertable<BackupRunsTable>;
185
- /**
186
- * Cluster metadata table
187
- * Key-value store for cluster-wide configuration (e.g. cluster_id).
188
- */
170
+ /** Key-value store for cluster-wide configuration (e.g. cluster_id). */
189
171
  export interface ClusterMetaTable {
190
- /** Key identifier (primary key) */
172
+ /** Primary key. */
191
173
  key: string;
192
- /** Value */
193
174
  value: string;
194
- /** When this entry was created */
195
175
  created_at: Generated<Date>;
196
176
  }
197
177
  export type ClusterMeta = Selectable<ClusterMetaTable>;
198
178
  export type NewClusterMeta = Insertable<ClusterMetaTable>;
199
179
  /**
200
- * Join tokens table
201
180
  * Stores hashed join tokens. `kici-admin join` and peer token mode find a row by
202
181
  * its hash; a token is consumed on first use and re-usable by the instance that
203
182
  * consumed it until it expires.
@@ -209,40 +188,30 @@ export interface JoinTokenTable {
209
188
  token_hash: string;
210
189
  /** Routing info embedded in the token (orgId, routingKey, expiry) */
211
190
  routing_info: string;
212
- /** Who created this token */
213
191
  created_by: string;
214
- /** When this token was created */
215
192
  created_at: Generated<Date>;
216
- /** When this token expires */
217
193
  expires_at: Date;
218
- /** When this token was consumed (null = unused) */
194
+ /** null = unused */
219
195
  consumed_at: Date | null;
220
- /** Who consumed this token (null = unused) — the coordinator that processed the claim */
196
+ /** The coordinator that processed the claim (null = unused) */
221
197
  consumed_by: string | null;
222
198
  /**
223
- * The instanceId of the joining peer that consumed this token (null = unused).
224
- * Distinct from `consumed_by` (the coordinator). Lets the same peer instance
225
- * reuse the token until `expires_at` to self-heal after a transient outage.
199
+ * The joining peer that consumed the token (null = unused); `consumed_by` is the coordinator.
200
+ * The same peer may reuse the token until `expires_at` to self-heal after a transient outage.
226
201
  */
227
202
  consumed_by_instance: string | null;
228
203
  }
229
204
  export type JoinToken = Selectable<JoinTokenTable>;
230
205
  export type NewJoinToken = Insertable<JoinTokenTable>;
231
- /**
232
- * Dispatch queue table
233
- * Holds jobs waiting to be dispatched to agents.
234
- */
206
+ /** Holds jobs waiting to be dispatched to agents. */
235
207
  export interface DispatchQueueTable {
236
208
  /** UUID primary key */
237
209
  id: Generated<string>;
238
- /** Unique run identifier for this execution */
239
210
  run_id: string;
240
211
  /** Workflow name from lock file */
241
212
  workflow_name: string;
242
- /** Job name within the workflow */
243
213
  job_name: string;
244
- /** JSONB array of runs-on labels for agent matching.
245
- * Insert: JSON.stringify(labels), Select: auto-parsed by pg driver. */
214
+ /** JSONB label array: insert `JSON.stringify(labels)`; the pg driver parses it on select. */
246
215
  runs_on_labels: string;
247
216
  /** JSON-encoded Record of the job configuration, without the fields in `sealed_secrets` */
248
217
  job_config: string;
@@ -253,13 +222,11 @@ export interface DispatchQueueTable {
253
222
  * before the column existed: those rows keep the fields in the plain column.
254
223
  */
255
224
  sealed_secrets: ColumnType<string | null, string | null | undefined, string | null>;
256
- /** Repository clone URL */
257
225
  repo_url: string;
258
226
  /** Git ref (branch/tag) */
259
227
  ref: string;
260
- /** Git commit SHA */
261
228
  sha: string;
262
- /** Job status: pending | dispatched | expired | failed */
229
+ /** Job status: a `DispatchQueueStatus` value (`queue/job-queue.ts`). */
263
230
  status: Generated<string>;
264
231
  /** When this job was queued */
265
232
  created_at: Generated<Date>;
@@ -267,7 +234,7 @@ export interface DispatchQueueTable {
267
234
  expires_at: Date | null;
268
235
  /** Webhook delivery ID for tracing */
269
236
  delivery_id: string;
270
- /** Provider type (e.g., "github", "gitlab") */
237
+ /** e.g. "github", "gitlab" */
271
238
  provider: Generated<string>;
272
239
  /** JSON-encoded provider-specific context (e.g., {"installationId": 42}) */
273
240
  provider_context: Generated<string>;
@@ -282,48 +249,41 @@ export interface DispatchQueueTable {
282
249
  request_id: string | null;
283
250
  /** JSONB array of exclusion labels. Default '[]'. */
284
251
  exclude_labels: Generated<string>;
285
- /** Regex matchers (LabelMatcher[]) the job requires; JS post-filter on top of runs_on_labels. Default '[]'. */
252
+ /** Required LabelMatcher[] regexes; JS post-filter over runs_on_labels. Default '[]'. */
286
253
  runs_on_patterns: Generated<string>;
287
254
  /** Regex matchers (LabelMatcher[]) that disqualify an agent; JS post-filter. Default '[]'. */
288
255
  exclude_patterns: Generated<string>;
289
- /** Routing key (e.g. "github:12345") so dispatch can pick the right
290
- * per-app provider bundle in multi-app setups. Required (NOT NULL). */
256
+ /** NOT NULL; e.g. "github:12345". Picks the per-app provider bundle in multi-app setups. */
291
257
  routing_key: string;
292
258
  /**
293
- * For jobs in `status='recovering'`, the moment the recovery grace
294
- * period elapses. Populated when an agent disconnects with this job
295
- * in-flight; cleared when the agent reconnects + claims the job, OR
296
- * when the leader-gated sweep transitions the row to `failed`.
297
- * NULL for all other statuses.
259
+ * For `status='recovering'` jobs, when the recovery grace period elapses. Set when an agent
260
+ * disconnects with the job in flight; cleared when the agent reconnects and claims it, or when
261
+ * the leader-gated sweep fails the row. NULL for all other statuses.
298
262
  */
299
263
  recovery_deadline: ColumnType<Date | null, Date | null | undefined, Date | null>;
300
264
  /**
301
- * Companion to `recovery_deadline`: the agent id that owned the job
302
- * before disconnect. Used to validate that a reconnecting agent is
303
- * the rightful claimant. NULL for non-recovering rows.
265
+ * The agent that owned the job before disconnect; a reconnecting agent must match it.
266
+ * NULL for non-recovering rows.
304
267
  */
305
268
  recovery_agent_id: ColumnType<string | null, string | null | undefined, string | null>;
306
269
  /**
307
- * Most recent scaler spawn-failure detail for this queued job (e.g.
308
- * "agent process error: spawn node ENOENT"). Written on a `scaler.failed`
309
- * event bound to the job; read by the queue-timeout reaper to surface the
310
- * real provisioning cause; cleared on dispatch. NULL when none recorded.
270
+ * Latest scaler spawn-failure detail (e.g. "agent process error: spawn node ENOENT"). Written
271
+ * on a `scaler.failed` event bound to the job, surfaced by the queue-timeout reaper as the
272
+ * provisioning cause, cleared on dispatch. NULL when none recorded.
311
273
  */
312
274
  last_provisioning_error: ColumnType<string | null, string | null | undefined, string | null>;
313
275
  /**
314
- * When this job first read unroutable — no registered agent and no scaler
315
- * backend matched its selectors. NULL once it reads routable again, so the
316
- * grace clock only ever measures a CONTINUOUS unroutable window. Persisted
317
- * rather than in-memory so a restart mid-grace resumes the same clock.
276
+ * When the job first read unroutable (no agent and no scaler backend matched its selectors).
277
+ * NULL once routable again, so the grace clock measures only a CONTINUOUS unroutable window.
278
+ * Persisted so a restart mid-grace resumes the same clock.
318
279
  */
319
280
  unroutable_since: ColumnType<Date | null, Date | string | null | undefined, Date | string | null>;
320
281
  /** Times this job was returned to pending for re-dispatch (job.reject / pre-start agent loss). */
321
282
  dispatch_attempts: Generated<number>;
322
283
  /**
323
- * Deadline by which the dispatched job's agent must answer the
324
- * job.dispatch (job.ack / job.reject / job.status running). Stamped when
325
- * the dispatch is sent, cleared on any answer; `dispatched` rows past the
326
- * deadline are requeued by the owning coord's timer or the leader sweep.
284
+ * Deadline for the agent to answer job.dispatch (job.ack / job.reject / job.status running).
285
+ * Stamped on send, cleared on any answer; a `dispatched` row past it is requeued by the owning
286
+ * coord's timer or the leader sweep.
327
287
  */
328
288
  ack_deadline: ColumnType<Date | null, Date | null | undefined, Date | null>;
329
289
  /** Agent the dispatch was sent to (for ack-timeout disconnect + logging). */
@@ -335,46 +295,34 @@ export interface DispatchQueueTable {
335
295
  */
336
296
  pinned_agent_id: ColumnType<string | null, string | null | undefined, string | null>;
337
297
  /**
338
- * Durable owner of a dispatched job: the agent the job was handed to. Written
339
- * at dispatch, cleared on requeue. Distinct from `ack_agent_id`, which is
340
- * cleared as soon as the agent answers the dispatch and so cannot resolve
341
- * ownership later — this column lets a coordinator that never saw the
342
- * dispatch answer "does this agent own this job?" from the database alone.
343
- * NULL for pending rows and for rows dispatched before the column existed.
298
+ * Durable owner: the agent the job was handed to. Written at dispatch, cleared on requeue.
299
+ * Unlike `ack_agent_id` (cleared once the agent answers), it lets a coordinator that never saw
300
+ * the dispatch resolve ownership from the database alone. NULL for pending rows and for rows
301
+ * dispatched before the column existed.
344
302
  */
345
303
  agent_id: ColumnType<string | null, string | null | undefined, string | null>;
346
304
  /**
347
- * The coordinator watching this dispatch. Written at claim/dispatch from
348
- * `config.instanceId`, cleared on requeue.
349
- *
350
- * `agent_id` above says which agent holds the job; this says which
351
- * coordinator armed the timers for it, which is the question every
352
- * cluster-wide sweep has to answer before it acts. A NULL reads as "unknown
353
- * owner", never as "not mine" — the convention migration 119 established for
354
- * the scaler plane — so an unknown-owner row is spared by recovery selection
355
- * and reaped, if genuinely dead, by the stale detector's dispatch-time scan.
305
+ * The coordinator that armed this dispatch's timers, which every cluster-wide sweep must know
306
+ * before it acts. Written at claim/dispatch from `config.instanceId`, cleared on requeue.
307
+ * NULL reads as "unknown owner", never "not mine" (the migration 119 scaler-plane convention):
308
+ * recovery selection spares the row, and the stale detector's dispatch-time scan reaps it if
309
+ * genuinely dead.
356
310
  */
357
311
  owner_instance_id: ColumnType<string | null, string | null | undefined, string | null>;
358
312
  /**
359
- * When the row was handed to an agent, as distinct from `created_at`, which
360
- * is when it was enqueued. A job that waited behind a busy fleet has an old
361
- * `created_at` and a fresh `dispatched_at`, and only the second one measures
362
- * "this dispatch has gone unacknowledged". NULL for pending rows and for rows
363
- * dispatched before the column existed; readers fall back to `created_at`.
313
+ * When the row was handed to an agent; `created_at` is when it was enqueued. Only this one
314
+ * measures "this dispatch has gone unacknowledged" for a job that waited behind a busy fleet.
315
+ * NULL for pending rows and for rows dispatched before the column existed; readers fall back
316
+ * to `created_at`.
364
317
  */
365
318
  dispatched_at: ColumnType<Date | null, Date | null | undefined, Date | null>;
366
319
  }
367
320
  /**
368
- * Coordinator heartbeat table (cluster_instances)
369
- *
370
- * The liveness source every ownership predicate reads: an orchestrator upserts
371
- * its own row on a fixed tick, and a row whose `last_heartbeat_at` is inside the
372
- * grace window means that coordinator is alive. It is a DB heartbeat rather than
373
- * the in-memory peer registry because the peer registry is empty at exactly the
374
- * moment startup recovery runs — a freshly booted process has handshaken with
375
- * nobody — and because it needs no peer connectivity, so it works the same in
376
- * non-Raft multi-coordinator and standalone deployments. `host_roster` does the
377
- * same job for agents.
321
+ * Coordinator heartbeats: the liveness source every ownership predicate reads. Each
322
+ * orchestrator upserts its row on a fixed tick; a `last_heartbeat_at` inside the grace window
323
+ * means alive. A DB heartbeat, not the in-memory peer registry, because that registry is empty
324
+ * when startup recovery runs and because it needs no peer connectivity (non-Raft and standalone
325
+ * deployments work the same). `host_roster` does the same job for agents.
378
326
  */
379
327
  export interface ClusterInstancesTable {
380
328
  /** The coordinator's instance id (`config.instanceId`). */
@@ -390,10 +338,7 @@ export interface ClusterInstancesTable {
390
338
  }
391
339
  export type ClusterInstance = Selectable<ClusterInstancesTable>;
392
340
  export type NewClusterInstance = Insertable<ClusterInstancesTable>;
393
- /**
394
- * Deduplication cache table
395
- * Tracks recently processed webhook delivery IDs to prevent reprocessing.
396
- */
341
+ /** Tracks recently processed webhook delivery IDs to prevent reprocessing. */
397
342
  export interface DedupCacheTable {
398
343
  /** Webhook delivery ID (primary key) */
399
344
  delivery_id: string;
@@ -435,19 +380,15 @@ export interface IngestOverflowBufferTable {
435
380
  /** Last replay error, or null. */
436
381
  last_error: string | null;
437
382
  /**
438
- * When the row moved `buffered` → `replaying`; null while it is buffered.
439
- * Separate from `captured_at` (which orders the FIFO drain) so a long-buffered
440
- * row is not reclaimed the instant a worker picks it up.
383
+ * When the row moved `buffered` → `replaying`; null while buffered. Separate from
384
+ * `captured_at` (the FIFO drain order) so a long-buffered row is not reclaimed on pickup.
441
385
  */
442
386
  claimed_at: ColumnType<Date | null, Date | null | undefined, Date | null>;
443
387
  }
444
388
  export type DispatchQueueItem = Selectable<DispatchQueueTable>;
445
389
  export type NewDispatchQueueItem = Insertable<DispatchQueueTable>;
446
390
  export type DispatchQueueItemUpdate = Updateable<DispatchQueueTable>;
447
- /**
448
- * IP allocation table for Firecracker VM networking.
449
- * Tracks assigned IPs from the CIDR pool. DB-backed to survive restarts.
450
- */
391
+ /** Firecracker VM IPs assigned from the CIDR pool; DB-backed to survive restarts. */
451
392
  export interface IpAllocationTable {
452
393
  /** Allocated IP address (primary key), e.g. "10.0.0.5" */
453
394
  ip: string;
@@ -459,14 +400,9 @@ export interface IpAllocationTable {
459
400
  tap_device: string;
460
401
  /** Guest MAC address */
461
402
  mac_address: string;
462
- /** When this IP was allocated */
463
403
  allocated_at: Generated<Date>;
464
404
  }
465
- /**
466
- * Execution run table
467
- * Top-level workflow runs (one per webhook trigger).
468
- * Stores status, timing, and trigger decision metadata.
469
- */
405
+ /** Top-level workflow runs, one per webhook trigger. */
470
406
  export interface ExecutionRunTable {
471
407
  /** UUID primary key */
472
408
  id: Generated<string>;
@@ -475,80 +411,64 @@ export interface ExecutionRunTable {
475
411
  /** Routing key (e.g. github:appId) for Platform StaleOrchDetector when sharing DB */
476
412
  routing_key: string | null;
477
413
  /**
478
- * Owning org (customer_id), denormalized from routing_key at insert time so
479
- * the concurrency-gate running count can be scoped per tenant. Defaults to
480
- * '__default__' (the no-source fallback org) via the column DEFAULT.
414
+ * Owning org, denormalized from routing_key at insert so the concurrency-gate running count
415
+ * is per tenant. Column DEFAULT '__default__' (the no-source fallback org).
481
416
  */
482
417
  customer_id: Generated<string>;
483
418
  /** Workflow name from lock file */
484
419
  workflow_name: string;
485
- /** Run status: running | success | failed | cancelled */
420
+ /** Run status: an `ExecutionRunStatus` value (engine). */
486
421
  status: Generated<string>;
487
422
  /** Provider type (e.g. "github", "gitlab") */
488
423
  provider: string;
489
424
  /** Repository identifier (e.g. "owner/repo") */
490
425
  repo_identifier: string;
491
426
  /**
492
- * The branch (or tag) the run PRESENTS — `event.targetBranch`: the branch a
493
- * push landed on, the base branch of a pull request, the default branch a
494
- * schedule fire executes, the branch an internal trigger inherited.
427
+ * The branch (or tag) the run PRESENTS — `event.targetBranch`: where a push landed, a PR's
428
+ * base branch, the default branch a schedule fire executes, or an internal trigger's
429
+ * inherited branch.
495
430
  *
496
- * It is NOT a job's checkout ref. A pull-request job checks out the PR HEAD
497
- * branch, and every `QueuedJobInput.ref` carries that value instead — the two
498
- * are different facts and only one of them belongs here. The distinction is
499
- * load-bearing: this column is what an internally-triggered run inherits as
500
- * its branch claim before the context branch gate matches it against a
501
- * context's `branchRestrictions`, and a fork contributor names the head
502
- * branch freely. Every writer that CREATES the row uses the presented branch.
503
- * The two reroute projections (`cluster/coordinator.ts`, `worker-core.ts`)
504
- * are the exception: they insert from a `job.reroute` message, which carries
505
- * only the job's ref. Their row is fail-safe by conflicting — the run is
506
- * registered before the first job is handed to an agent
507
- * (`startRunBeforeDispatch`), so a reroute is only possible once the
508
- * authoritative row exists, and their insert is
509
- * `ON CONFLICT (run_id) DO NOTHING`.
431
+ * NOT a job's checkout ref: a PR job checks out the HEAD branch, carried in
432
+ * `QueuedJobInput.ref`. Load-bearing: an internally-triggered run inherits this column as its
433
+ * branch claim before the context branch gate matches `branchRestrictions`, and a fork
434
+ * contributor names the head branch freely. Every writer that CREATES the row uses the
435
+ * presented branch. The two reroute projections (`cluster/coordinator.ts`, `worker-core.ts`)
436
+ * insert from a `job.reroute` message carrying only the job's ref; they are fail-safe because
437
+ * the run is registered before the first job reaches an agent (`startRunBeforeDispatch`) and
438
+ * their insert is `ON CONFLICT (run_id) DO NOTHING`.
510
439
  */
511
440
  ref: string;
512
- /** Git commit SHA */
513
441
  sha: string;
514
442
  /** Webhook delivery ID for tracing */
515
443
  delivery_id: string | null;
516
444
  /** Serialized WorkflowDecision (trigger decision trace) */
517
445
  trigger_decision: string | null;
518
- /** When the run started */
519
446
  started_at: Generated<Date>;
520
- /** When the run completed */
521
447
  completed_at: Date | null;
522
448
  /**
523
- * When the run entered `cancelling`. Stamped once, on the transition, and
524
- * never cleared: it is the clock the stuck-cancelling re-drive reads, and no
525
- * other column records when the cancel started. NULL for a run that never
526
- * cancelled and for one that entered `cancelling` before the column existed.
449
+ * When the run entered `cancelling`. Stamped once on the transition and never cleared: the
450
+ * only record of when the cancel started, read by the stuck-cancelling re-drive. NULL for a
451
+ * run that never cancelled and for one that entered `cancelling` before the column existed.
527
452
  */
528
453
  cancelling_at: ColumnType<Date | null, Date | null | undefined, Date | null>;
529
454
  /**
530
- * TRUE once a forced cancel reached the run (migration 153). The
531
- * stuck-cancelling re-drive reads it so a cancel that did not complete is
532
- * re-sent with `force`. Never reset to FALSE: a later graceful cancel does
533
- * not undo a forced one. NULL re-drives gracefully.
455
+ * TRUE once a forced cancel reached the run (migration 153); the stuck-cancelling re-drive
456
+ * re-sends an incomplete cancel with `force`. Never reset to FALSE: a later graceful cancel
457
+ * does not undo a forced one. NULL re-drives gracefully.
534
458
  */
535
459
  cancel_force: ColumnType<boolean | null, boolean | null | undefined, boolean | null>;
536
460
  /**
537
- * The run's status generation (migration 150). Starts at 0 and rises by one
538
- * each time the run leaves a terminal status to continue. Forwarded on every
539
- * `execution.status` frame as `statusEpoch`, so the Platform can tell a
540
- * reopen from a frame that arrives late after the run finished.
461
+ * Status generation (migration 150): starts at 0, +1 each time the run leaves a terminal
462
+ * status to continue. Sent on every `execution.status` frame as `statusEpoch` so the Platform
463
+ * tells a reopen from a late frame.
541
464
  */
542
465
  status_epoch: Generated<number>;
543
466
  /** Total execution duration in milliseconds */
544
467
  duration_ms: number | null;
545
468
  /**
546
- * Total raw log bytes accumulated across all jobs of this run. Sum of the
547
- * agent-side `LogStreamer.getTotalBytes()` reported on terminal
548
- * `step.status` for every step in every job. Default 0 for pre-migration
549
- * rows. Powers the operator-side `kici_org_log_bytes` capacity-planning
550
- * gauge on the Platform. Postgres BIGINT — pg returns string; cast at
551
- * read sites.
469
+ * Raw log bytes across all jobs: the sum of the agent's `LogStreamer.getTotalBytes()` on each
470
+ * terminal `step.status`. Default 0 for pre-migration rows. Feeds the Platform's
471
+ * `kici_org_log_bytes` capacity gauge. Postgres BIGINT — pg returns string; cast at read sites.
552
472
  */
553
473
  log_bytes: Generated<number>;
554
474
  /** Provider-specific context (e.g. {"installationId": 42}) */
@@ -561,66 +481,50 @@ export interface ExecutionRunTable {
561
481
  fixture_id: string | null;
562
482
  /** Parent run ID for re-run lineage (null for original runs). */
563
483
  parent_run_id: string | null;
564
- /** Root ancestor run ID for re-run lineage (null for original runs). Always points to the first run in the chain. */
484
+ /** First run in the re-run chain (null for original runs). */
565
485
  original_run_id: string | null;
566
- /** User identity that triggered this re-run (null for webhook-triggered). Format: "user:email" or "key:name". */
486
+ /** Who triggered this re-run: "user:email" or "key:name" (null for webhook-triggered). */
567
487
  triggered_by: string | null;
568
- /** Agent provenance label when the run was triggered through an agent credential (null otherwise). */
488
+ /** Agent provenance label when triggered through an agent credential (null otherwise). */
569
489
  triggered_by_agent_label: string | null;
570
490
  /** User identity that cancelled this run (null for non-cancelled). */
571
491
  cancelled_by: string | null;
572
- /** Agent provenance label when the run was cancelled through an agent credential (null otherwise). */
492
+ /** Agent provenance label when cancelled through an agent credential (null otherwise). */
573
493
  cancelled_by_agent_label: string | null;
574
494
  /** Context name for this run (null if no context applies) */
575
495
  context: string | null;
576
496
  /** Matched context id for this run (null if no/unresolved context). */
577
497
  context_id: string | null;
578
498
  /**
579
- * The event type that started this run (`push`, `pr:open`, `schedule`, …).
580
- *
581
- * Persisted because the git credential relay evaluates a named context's
582
- * protection rules against the run, and a context may restrict which trigger
583
- * types may use it. NULL means the trigger was never recorded, which fails a
584
- * `triggerTypeFilters` rule closed — a credential is withheld rather than
585
- * granted on a rule nobody could check.
499
+ * The event type that started this run (`push`, `pr:open`, `schedule`, …). The git credential
500
+ * relay checks a context's `triggerTypeFilters` against it; NULL (never recorded) fails that
501
+ * rule closed, withholding the credential.
586
502
  */
587
503
  trigger_event: string | null;
588
504
  /**
589
- * The event the OIDC token's SUBJECT is derived from, when that is not
590
- * {@link ExecutionRunTable.trigger_event}.
591
- *
592
- * A re-run records `trigger_event: 'rerun'`, which is what the dashboard's
593
- * trigger filter and the credential relay's `triggerTypeFilters` need to
594
- * read, but it carries no pull-request dimension — so a re-run of a pull
595
- * request presented the branch-shaped subject a push to the same base branch
596
- * presents. A re-run copies the original run's event here so the subject
597
- * survives the hop.
598
- *
599
- * `buildIdTokenSubject` is the ONLY reader. NULL means "use `trigger_event`",
600
- * which is what every row written before this column existed says, so a
601
- * legacy row keeps the subject it already mints.
505
+ * The event the OIDC token's SUBJECT derives from, when it differs from
506
+ * {@link ExecutionRunTable.trigger_event}. A re-run records `trigger_event: 'rerun'` (which the
507
+ * dashboard filter and `triggerTypeFilters` read) and copies the original event here, so a
508
+ * re-run of a PR keeps the PR-shaped subject instead of a push's branch-shaped one.
509
+ * `buildIdTokenSubject` is the ONLY reader. NULL means "use `trigger_event`", so a legacy row
510
+ * keeps the subject it already mints.
602
511
  */
603
512
  subject_trigger_event: string | null;
604
513
  /**
605
- * The pull-request HEAD branch — where a contributor's code actually lives.
606
- * Distinct from {@link ExecutionRunTable.ref}, which is the base branch a PR
607
- * targets. NULL for a non-PR run and for a row written before this column
608
- * existed.
514
+ * The PR HEAD branch, where a contributor's code lives; {@link ExecutionRunTable.ref} is the
515
+ * base branch. NULL for a non-PR run and for a row written before this column existed.
609
516
  */
610
517
  head_ref: string | null;
611
518
  /**
612
- * `owner/repo` of the pull-request HEAD. Equals `repo_identifier` for a
613
- * same-repo PR and names the contributor's fork for a fork PR. NULL for a
614
- * non-PR run and for a legacy row.
519
+ * `owner/repo` of the PR HEAD: `repo_identifier` for a same-repo PR, the contributor's fork
520
+ * for a fork PR. NULL for a non-PR run and for a legacy row.
615
521
  */
616
522
  head_repository: string | null;
617
523
  /**
618
- * True when the pull request came from a fork (head repo != base repo).
619
- * NULL means NOT RESOLVED — a legacy row, or one of the two reroute
620
- * projections, which insert from a `job.reroute` message carrying no event
621
- * context. Every claim derived from this column renders NULL as
622
- * `'unresolved'` rather than `'false'`, so a trust policy that pins it fails
623
- * closed.
524
+ * True when the PR came from a fork (head repo != base repo). NULL means NOT RESOLVED: a
525
+ * legacy row, or a reroute projection (its `job.reroute` message carries no event context).
526
+ * Derived claims render NULL as `'unresolved'`, never `'false'`, so a trust policy pinning it
527
+ * fails closed.
624
528
  */
625
529
  is_fork: boolean | null;
626
530
  /** Trust tier of the contributor for PR runs (null for non-PR events) */
@@ -629,151 +533,115 @@ export interface ExecutionRunTable {
629
533
  lock_file_source: string | null;
630
534
  /** Username of the contributor (null for non-PR events) */
631
535
  contributor_username: string | null;
632
- /** Pull-request number for PR-triggered runs (null for non-PR events). Scopes `/kici approve|reject` hold selection to the comment's PR. */
536
+ /**
537
+ * PR number for PR-triggered runs (null for non-PR events). Scopes `/kici approve|reject`
538
+ * hold selection to the comment's PR.
539
+ */
633
540
  pr_number: number | null;
634
541
  /**
635
- * Origin provider of the triggering actor (`github` today). Provider-generic
636
- * so GitLab/Bitbucket extend later. Null when no actor was captured.
542
+ * Origin provider of the triggering actor (`github` today; provider-generic for later
543
+ * GitLab/Bitbucket). Null when no actor was captured.
637
544
  */
638
545
  trigger_actor_provider: string | null;
639
546
  /**
640
- * Provider login of the person who triggered the run (pusher / PR author).
641
- * Captured for ALL event types, unlike the PR-only `contributor_username`.
547
+ * Provider login of whoever triggered the run (pusher / PR author), for ALL event types,
548
+ * unlike the PR-only `contributor_username`.
642
549
  */
643
550
  trigger_actor_username: string | null;
644
551
  /**
645
552
  * Immutable provider user id of the triggering actor (mirrors
646
- * `identity_links.provider_user_id`). Preferred over the mutable username
647
- * when resolving the actor to a KiCI user.
553
+ * `identity_links.provider_user_id`); preferred over the mutable username when resolving
554
+ * the actor to a KiCI user.
648
555
  */
649
556
  trigger_actor_user_id: string | null;
650
557
  /**
651
- * The repository that DEFINES this run's workflow, when that is not the
652
- * repository the run acted on.
653
- *
654
- * `repo_identifier` is the repository the run acted on and whose code its
655
- * jobs check out. For an organization-wide workflow dispatched against
656
- * another repository, the workflow was authored somewhere else, and that
657
- * authoring repository is recorded here. NULL means the two are the same —
658
- * true of every per-repository run.
659
- *
660
- * Read by the rerun path, which must resolve the workflow from the
661
- * repository that defines it rather than from the one it ran against.
558
+ * The repository that DEFINES this run's workflow, when it differs from `repo_identifier`
559
+ * (the repository acted on and checked out), as for an organization-wide workflow. NULL means
560
+ * the same — every per-repository run. The rerun path resolves the workflow from here.
662
561
  */
663
562
  workflow_repo_identifier: string | null;
664
563
  /**
665
- * Commit of the workflow repository the run dispatched, when the workflow is
666
- * defined in another repository (`workflow_repo_identifier` set). A re-run
564
+ * Workflow-repository commit dispatched when `workflow_repo_identifier` is set; a re-run
667
565
  * dispatches this exact commit. NULL on every per-repository run.
668
566
  */
669
567
  workflow_sha: string | null;
670
568
  /**
671
- * The workflow repository's registered branch, when the workflow is defined
672
- * in another repository. The git-credential relay checks context branch rules
673
- * against it. NULL on every per-repository run.
569
+ * The workflow repository's registered branch when the workflow lives elsewhere; the
570
+ * git-credential relay checks context branch rules against it. NULL on every per-repository
571
+ * run.
674
572
  */
675
573
  workflow_branch: string | null;
676
574
  /**
677
- * True when this row records a global evaluation round rather than a
678
- * workflow.
679
- *
680
- * A round decides which organization-wide workflows apply to an event; a
681
- * round that fails is recorded as one errored run so the suppression is
682
- * visible. Re-running such a run re-executes the evaluation, not a workflow,
683
- * so the re-run path branches on this column. It is structural on purpose:
684
- * the round job's `__globaleval__` name prefix is a string a customer
685
- * workflow may also carry, and a name a customer chooses must not decide
686
- * which code path a re-run takes.
575
+ * True when the row records a global evaluation round (which decides the org-wide workflows
576
+ * for an event; a failed round is one errored run so the suppression is visible). The re-run
577
+ * path branches on it to re-execute the evaluation. Structural on purpose: the round job's
578
+ * `__globaleval__` name prefix is a string a customer workflow may also carry.
687
579
  */
688
580
  is_global_eval_round: Generated<boolean>;
689
581
  /**
690
- * The source whose credentials `provider_context` holds, when that is not the
691
- * source the event arrived on.
692
- *
693
- * `routing_key` records the INBOUND source. For a cross-provider global
694
- * workflow the lock file resolves through another source's bundle, and the
695
- * context is written from that source's credentials — so anything pairing
696
- * `routing_key` with `provider_context` hands one source's credentials to
697
- * another source's API client. NULL means the two are the same, which is true
698
- * of every ordinary run.
699
- *
700
- * Read by the rerun path of a failed evaluation round, which re-drives the
701
- * organization-wide pass and has to hand it the same dispatch pair the
702
- * delivery used.
582
+ * The source whose credentials `provider_context` holds, when not the INBOUND source in
583
+ * `routing_key` (a cross-provider global workflow resolves through another source's bundle).
584
+ * Pairing `routing_key` with `provider_context` there would hand one source's credentials to
585
+ * another's API client. NULL means the same — every ordinary run. The rerun path of a failed
586
+ * evaluation round reads it to re-drive the org-wide pass with the delivery's dispatch pair.
703
587
  */
704
588
  dispatch_routing_key: string | null;
705
589
  /** Human-readable reason why the run failed (null for non-failed runs). */
706
590
  failure_reason: string | null;
707
591
  /**
708
- * Why the run failed (`RunFailureClass` from `@kici-dev/engine`): never_started
709
- * / timed_out / dead_orchestrator / step_failure / cancelled. Derived at run
710
- * completion from the terminal job statuses. NULL for success / not-yet-terminal.
592
+ * `RunFailureClass` (`@kici-dev/engine`): never_started / timed_out / dead_orchestrator /
593
+ * step_failure / cancelled, derived at completion from the terminal job statuses. NULL for
594
+ * success / not-yet-terminal.
711
595
  */
712
596
  failure_class: string | null;
713
597
  /**
714
- * Structured init-phase failure detail (shape: `InitFailure` from
715
- * `@kici-dev/engine`). Non-null means the run never executed a step
716
- * because something failed during the init phase (lock-file fetch,
717
- * provider context, agent spawn). NULL for normal runs.
598
+ * `InitFailure` (`@kici-dev/engine`) detail. Non-null means the run never executed a step
599
+ * because the init phase failed (lock-file fetch, provider context, agent spawn). NULL for
600
+ * normal runs.
718
601
  */
719
602
  init_failure: ColumnType<InitFailure | null, unknown, unknown>;
720
603
  /**
721
- * Whole-run wall-clock timeout in ms from the workflow lock; null when
722
- * unset. Read by the WorkflowDeadlineDetector. INTEGER in Postgres, matching
723
- * the other `*_ms` columns, so pg returns a plain number.
604
+ * Whole-run wall-clock timeout in ms from the workflow lock (null = unset), read by the
605
+ * WorkflowDeadlineDetector. INTEGER like the other `*_ms` columns, so pg returns a number.
724
606
  */
725
607
  workflow_timeout_ms: ColumnType<number | null, number | null | undefined, number | null>;
726
- /** When this record was created */
727
608
  created_at: Generated<Date>;
728
609
  /**
729
- * Run mode for idempotent steps (`apply` | `check` | `check-fail-on-drift`,
730
- * the `CheckMode` enum). NULL means a legacy/apply run. A non-apply value
731
- * labels the run a check-mode preview in the dashboard.
610
+ * Idempotent-step mode (`CheckMode`: `apply` | `check` | `check-fail-on-drift`). NULL means a
611
+ * legacy/apply run; a non-apply value labels the run a check-mode preview in the dashboard.
732
612
  */
733
613
  check_mode: string | null;
734
614
  /**
735
- * Set inside the cold-store archive transaction before the row is
736
- * DELETEd. Survivors carry NULL. Exists so the
737
- * "promote-chunk-back-into-PG" path can restore rows with
738
- * their original archive pointer.
615
+ * Set inside the cold-store archive transaction before the row is DELETEd; survivors carry
616
+ * NULL. Lets the promote-chunk-back-into-PG path restore rows with their archive pointer.
739
617
  */
740
618
  archived_at: Date | null;
741
619
  /** S3 object key of the chunk that carried this row; see `archived_at`. */
742
620
  archive_object_key: string | null;
743
- /**
744
- * For a run summoned by an invoke gate, the summoning (global) run's id. NULL
745
- * for every run not summoned by a gate.
746
- */
621
+ /** The summoning (global) run's id for a gate-summoned run; NULL otherwise. */
747
622
  summoned_by_run_id: string | null;
748
623
  /**
749
- * For a summoned run, the proxy job name in the summoning run to update when
750
- * this run completes. NULL for every run not summoned by a gate.
624
+ * The summoning run's proxy job to update when this run completes; NULL for every run not
625
+ * summoned by a gate.
751
626
  */
752
627
  summoned_by_proxy_job: string | null;
753
628
  /**
754
- * How deep this run sits in an invoke chain. A webhook-triggered run is depth
755
- * 0; a run summoned by an invoke gate carries its summoner's depth + 1. Read
756
- * back when this run fires its own invoke gate so the chain-depth circuit
757
- * breaker bounds recursion. Defaults to 0.
629
+ * Invoke-chain depth: 0 for a webhook-triggered run, the summoner's depth + 1 for a summoned
630
+ * one. Read when this run fires its own invoke gate so the chain-depth circuit breaker bounds
631
+ * recursion. Defaults to 0.
758
632
  */
759
633
  chain_depth: Generated<number>;
760
634
  /**
761
- * The coordinator whose dispatch pipeline still has jobs to register for
762
- * this run — the durable form of the in-memory pending-jobs token
763
- * (`ExecutionTracker.holdRunForPendingJobs`). The owner writes its instance
764
- * id when it takes its first token and clears it when it drops its last;
765
- * every finalization path defers while the column names a LIVE sibling
766
- * (liveness from `cluster_instances`, the same read the dispatch queue's
767
- * `owner_instance_id` predicates use). A dead holder's id reads as no
768
- * window. NULL for every run with no window open and every row written
769
- * before the column existed.
635
+ * The coordinator whose dispatch pipeline still has jobs to register for this run: the
636
+ * durable form of the pending-jobs token (`ExecutionTracker.holdRunForPendingJobs`). Written
637
+ * on its first token, cleared on its last; every finalization path defers while it names a
638
+ * LIVE sibling (liveness from `cluster_instances`, as the dispatch queue's
639
+ * `owner_instance_id` predicates read it). A dead holder reads as no window. NULL with no
640
+ * window open and on rows written before the column existed.
770
641
  */
771
642
  registration_window_instance_id: string | null;
772
643
  }
773
- /**
774
- * Execution job table
775
- * Individual jobs within a run (including matrix expansions).
776
- */
644
+ /** Individual jobs within a run, including matrix expansions. */
777
645
  export interface ExecutionJobTable {
778
646
  /** UUID primary key */
779
647
  id: Generated<string>;
@@ -783,48 +651,38 @@ export interface ExecutionJobTable {
783
651
  job_id: string;
784
652
  /** Job name (e.g. "test", "test[node-18]") */
785
653
  job_name: string;
786
- /** Job status: pending | running | success | failed | cancelled | skipped */
654
+ /** Job status: an `ExecutionJobStatus` value (engine). */
787
655
  status: Generated<string>;
788
656
  /**
789
- * Operator-facing reason this job cannot currently be routed to any agent.
790
- * Written by the unroutable probe while the job is still queued, so the cause
791
- * is visible long before the job terminalizes; cleared when a matching agent
792
- * or scaler backend appears. NULL whenever the job is routable.
657
+ * Operator-facing reason the job cannot be routed to any agent. Written by the unroutable
658
+ * probe while queued, so the cause shows before the job terminalizes; cleared when a matching
659
+ * agent or scaler backend appears. NULL whenever the job is routable.
793
660
  */
794
661
  routing_reason: ColumnType<string | null, string | null | undefined, string | null>;
795
- /**
796
- * Matrix values JSON (e.g. {"node": "18"}). JSONB: the driver returns a parsed
797
- * object on SELECT, while writers pass a `JSON.stringify` string.
798
- */
662
+ /** Matrix values JSONB (e.g. {"node": "18"}); writers pass a `JSON.stringify` string. */
799
663
  matrix_values: ColumnType<Record<string, unknown> | null, string | null, string | null>;
800
664
  /** Agent ID that ran this job */
801
665
  agent_id: string | null;
802
- /** When the job started */
803
666
  started_at: Date | null;
804
- /** When the job completed */
805
667
  completed_at: Date | null;
806
668
  /** Job execution duration in milliseconds */
807
669
  duration_ms: number | null;
808
670
  /**
809
- * Total raw log bytes accumulated across all steps of this job. Sum of the
810
- * agent-side `LogStreamer.getTotalBytes()` reported on terminal
811
- * `step.status` for every step. Default 0 for pre-migration rows.
812
- * Postgres BIGINT — pg returns string; cast at read sites.
671
+ * Raw log bytes across the job's steps (agent `LogStreamer.getTotalBytes()` on each terminal
672
+ * `step.status`). Default 0 for pre-migration rows. Postgres BIGINT — pg returns string; cast
673
+ * at read sites.
813
674
  */
814
675
  log_bytes: Generated<number>;
815
- /** Error info if failed */
816
676
  error_message: string | null;
817
677
  /**
818
- * Structured init-phase failure detail (shape: `InitFailure` from
819
- * `@kici-dev/engine`). Non-null means the job never executed a step
820
- * because something failed during init (lock-file fetch, provider
821
- * context, agent spawn). NULL for normal runs.
678
+ * `InitFailure` (`@kici-dev/engine`) detail. Non-null means the job never executed a step
679
+ * because init failed (lock-file fetch, provider context, agent spawn). NULL for normal runs.
822
680
  */
823
681
  init_failure: ColumnType<InitFailure | null, unknown, unknown>;
824
682
  /**
825
- * Labels used for agent routing (e.g. ["kici:os:linux", "kici:arch:x64"]). JSONB:
826
- * the driver returns a parsed array on SELECT, while writers pass a
827
- * `JSON.stringify` string. Re-parsing it as a string yields null for every job.
683
+ * Agent-routing labels JSONB (e.g. ["kici:os:linux", "kici:arch:x64"]); writers pass a
684
+ * `JSON.stringify` string. The driver returns a parsed array: re-parsing it as a string
685
+ * yields null for every job.
828
686
  */
829
687
  runs_on_labels: ColumnType<string[] | null, string | null, string | null>;
830
688
  /** Last heartbeat received from agent (for stale run detection) */
@@ -834,27 +692,19 @@ export interface ExecutionJobTable {
834
692
  /** Aggregated step outputs JSONB (step-keyed map of outputs). Populated on job success. */
835
693
  outputs: string | null;
836
694
  /**
837
- * Ordered bound deployment-context names for this job, JSON-encoded
838
- * `string[]` (null when the job binds none). Written at dispatch and
839
- * overwritten with the agent-resolved list for dynamic contexts.
695
+ * Ordered bound deployment-context names, JSON `string[]` (null when none). Written at
696
+ * dispatch; overwritten with the agent-resolved list for dynamic contexts.
840
697
  */
841
698
  contexts: string | null;
842
699
  /**
843
- * The `gitCredentials` map this job's lock entry declared, as server truth
844
- * the credential relay reads on every git network operation. JSONB: the
845
- * driver returns a parsed object on SELECT, while writers pass a
846
- * `JSON.stringify` string.
700
+ * The lock entry's `gitCredentials` map: server truth the credential relay reads on every git
701
+ * network operation. JSONB; writers pass a `JSON.stringify` string. Copied verbatim because
702
+ * the relay compares byte for byte: `<name>Secret` is a qualified `<context>:<key>` secret
703
+ * NAME, and `<name>Value` is material for a credential with no store entry.
847
704
  *
848
- * Copied verbatim from the lock, because the relay compares a request against
849
- * it byte for byte: a `<name>Secret` field is a secret NAME in qualified
850
- * `<context>:<key>` form, and its `<name>Value` sibling is material for a
851
- * credential with no store entry to name.
852
- *
853
- * This row is written after the dispatch loop, so NULL means either "the job
854
- * declared none" or "the row has not caught up with the dispatch yet". The
855
- * relay does not guess between them — `git/job-context.ts` reads the job's
856
- * dispatch record, which carries the same declaration and is written before
857
- * the agent is told about the job.
705
+ * Written after the dispatch loop, so NULL means "declared none" or "not caught up yet"; the
706
+ * relay does not guess — `git/job-context.ts` reads the dispatch record, which carries the
707
+ * same declaration and is written before the agent learns of the job.
858
708
  */
859
709
  git_credentials: ColumnType<Record<string, Record<string, string>> | null, string | null, string | null>;
860
710
  /**
@@ -877,93 +727,72 @@ export interface ExecutionJobTable {
877
727
  /** Fan-out label for a child: matrix suffix or hostname. NULL for non-fanned jobs. */
878
728
  variant_label: string | null;
879
729
  /**
880
- * Wave gate: a fan-out child beyond the job's `maxParallel` window is held
881
- * (`true`) instead of dispatched. Cleared by the wave-scheduler when a sibling
882
- * reaches terminal and an in-flight slot frees up. NULL/false for any job not
883
- * held by a rolling wave.
730
+ * Wave gate: `true` holds a fan-out child beyond the `maxParallel` window instead of
731
+ * dispatching it; the wave-scheduler clears it when a sibling terminates and frees a slot.
732
+ * NULL/false for any job not held by a rolling wave.
884
733
  */
885
734
  wave_gated: Generated<boolean>;
886
- /** The fan-out base's `maxParallel` wave width, stamped on every child. NULL = no bounded wave. */
735
+ /** The fan-out base's `maxParallel`, stamped on every child. NULL = no bounded wave. */
887
736
  wave_max_parallel: number | null;
888
737
  /** The fan-out base's `failFast` policy, stamped on every child. NULL = no bounded wave. */
889
738
  wave_fail_fast: boolean | null;
890
739
  /** Instance id of the worker peer this job was rerouted to, or null if local. */
891
740
  rerouted_to_peer: string | null;
892
- /** When this record was created */
893
741
  created_at: Generated<Date>;
894
742
  /**
895
- * Denormalized routing_key copied from execution_runs at insert time.
896
- * Used by cold-store as the partition tenant. NULLable for safety —
897
- * if an insert site doesn't populate it, the cold-store adapter
898
- * skips the row.
743
+ * Copied from execution_runs at insert; the cold-store partition tenant. NULLable for safety:
744
+ * the cold-store adapter skips a row an insert site left without it.
899
745
  */
900
746
  routing_key: string | null;
901
747
  /** Cold-store archive marker — see ExecutionRunTable.archived_at. */
902
748
  archived_at: Date | null;
903
749
  /** S3 object key of the chunk that carried this row. */
904
750
  archive_object_key: string | null;
905
- /**
906
- * Job kind (`JobKind`): `standard` runs steps on an agent, `gate` is an
907
- * invoke gate, `proxy` mirrors a summoned run. Defaults to `standard`.
908
- */
751
+ /** `JobKind`; defaults to `standard`. */
909
752
  job_kind: Generated<string>;
910
753
  /** For a `proxy` job, the summoned run it mirrors. NULL for every other kind. */
911
754
  summoned_run_id: string | null;
912
755
  /**
913
- * For a `gate` job, its own wall-clock timeout in milliseconds (copied from the
914
- * lock job). A gate runs no steps on an agent, so the agent-side job timeout
915
- * cannot fire for it; the orchestrator sweeps this column and fails a gate whose
916
- * proxies have not all terminalized in time. NULL = no gate timeout.
756
+ * A `gate` job's wall-clock timeout in ms, copied from the lock job. A gate runs no agent
757
+ * steps, so no agent-side timeout fires; the orchestrator sweeps this column and fails a gate
758
+ * whose proxies have not all terminalized in time. NULL = no gate timeout.
917
759
  */
918
760
  timeout_ms: number | null;
919
761
  /**
920
- * The precursor payload a build / init / dynamic-eval job reported on its
921
- * terminal `job.status` (shape: `PrecursorResult`), persisted so a
922
- * coordinator other than the one whose agent ran the job can settle its
923
- * pending tracker from the shared row. JSONB: the driver returns a parsed
924
- * object on SELECT, while writers pass a `JSON.stringify` string. NULL for
925
- * every ordinary job and for a precursor job that has not reached a
926
- * terminal state.
762
+ * The `PrecursorResult` a build / init / dynamic-eval job reported on its terminal
763
+ * `job.status`, persisted so any coordinator can settle its pending tracker from the shared
764
+ * row. JSONB; writers pass a `JSON.stringify` string. NULL for ordinary jobs and for a
765
+ * precursor job not yet terminal.
927
766
  */
928
767
  precursor_result: ColumnType<PrecursorResult | null, string | null | undefined, string | null>;
929
768
  }
930
- /**
931
- * Execution step table
932
- * Individual steps within a job.
933
- */
769
+ /** Individual steps within a job. */
934
770
  export interface ExecutionStepTable {
935
771
  /** UUID primary key */
936
772
  id: Generated<string>;
937
773
  /** References execution_runs.run_id */
938
774
  run_id: string;
939
- /** Job identifier */
940
775
  job_id: string;
941
776
  /** Step index within the job (0-based) */
942
777
  step_index: number;
943
- /** Step name */
944
778
  step_name: string;
945
- /** Step status: pending | running | success | failed | skipped */
779
+ /** Step status: an `ExecutionStepStatus` value (engine). */
946
780
  status: Generated<string>;
947
- /** When the step started */
948
781
  started_at: Date | null;
949
- /** When the step completed */
950
782
  completed_at: Date | null;
951
783
  /** Step execution duration in milliseconds */
952
784
  duration_ms: number | null;
953
- /** Process exit code */
954
785
  exit_code: number | null;
955
- /** Error info if failed */
956
786
  error_message: string | null;
957
787
  /** Path in storage backend (e.g. "executions/{runId}/job-test/step-0.log") */
958
788
  log_path: string | null;
959
789
  /** Step type: 'step' for regular steps, 'hook:onCancel', 'hook:cleanup', etc. for hooks */
960
790
  step_type: Generated<string>;
961
- /** JSON array of secret context names accessed by this step. NULL = tracking not available (old runs). */
791
+ /** JSON array of secret context names the step accessed. NULL = not tracked (old runs). */
962
792
  secrets_accessed: string | null;
963
793
  /**
964
- * Idempotent per-step outcome (`CheckStepOutcome`: skipped | applied |
965
- * declined | dry-run | no_check). NULL when the step ran without a check
966
- * mode. Orthogonal to `status`.
794
+ * `CheckStepOutcome`: skipped | applied | declined | dry-run | no_check. NULL when the step
795
+ * ran without a check mode. Orthogonal to `status`.
967
796
  */
968
797
  check_outcome: string | null;
969
798
  /** Human-readable drift summary (`summarize(drift)`). NULL when no drift. */
@@ -977,12 +806,8 @@ export interface ExecutionStepTable {
977
806
  concurrency_kind: string | null;
978
807
  /** Parallel-group correlation id shared by a group's children. NULL for sequential steps. */
979
808
  group_id: string | null;
980
- /** When this record was created */
981
809
  created_at: Generated<Date>;
982
- /**
983
- * Denormalized routing_key copied from execution_runs at insert time.
984
- * Used by cold-store as the partition tenant. NULLable for safety.
985
- */
810
+ /** Copied from execution_runs at insert; the cold-store partition tenant. NULLable for safety. */
986
811
  routing_key: string | null;
987
812
  /** Cold-store archive marker — see ExecutionRunTable.archived_at. */
988
813
  archived_at: Date | null;
@@ -999,9 +824,8 @@ export type ExecutionStep = Selectable<ExecutionStepTable>;
999
824
  export type NewExecutionStep = Insertable<ExecutionStepTable>;
1000
825
  export type ExecutionStepUpdate = Updateable<ExecutionStepTable>;
1001
826
  /**
1002
- * Execution job needs edge table.
1003
- * One row per concrete dependency edge within a run.
1004
- * Static-to-static edges inserted at run start; group edges after resolution.
827
+ * One row per concrete dependency edge in a run: static-to-static edges at run start, group
828
+ * edges after resolution.
1005
829
  */
1006
830
  export interface ExecutionJobNeedsTable {
1007
831
  /** References execution_runs.run_id */
@@ -1011,43 +835,32 @@ export interface ExecutionJobNeedsTable {
1011
835
  /** Upstream job name (the job that must complete first) */
1012
836
  upstream_name: string;
1013
837
  /**
1014
- * Per-edge run-on status-set: a JSON-encoded array of upstream terminal
1015
- * statuses (ExecutionJobStatus[]) that satisfy the edge. Default
1016
- * `'["success"]'`. The downstream dispatches when the upstream's terminal
1017
- * status is a member of this set.
838
+ * JSON `ExecutionJobStatus[]` of upstream terminal statuses that satisfy the edge (default
839
+ * `'["success"]'`); the downstream dispatches when the upstream ends in one of them.
1018
840
  */
1019
841
  run_on: Generated<string>;
1020
842
  }
1021
843
  export type ExecutionJobNeeds = Selectable<ExecutionJobNeedsTable>;
1022
844
  export type NewExecutionJobNeeds = Insertable<ExecutionJobNeedsTable>;
1023
- /**
1024
- * Raft consensus state table
1025
- * Persistent state for Raft leader election across orchestrator cluster.
1026
- * Single row per cluster (default cluster_id = 'default').
1027
- */
845
+ /** Raft leader-election state, one row per cluster (default cluster_id = 'default'). */
1028
846
  export interface RaftStateTable {
1029
847
  /** Cluster identifier (primary key). Default 'default'. */
1030
848
  cluster_id: Generated<string>;
1031
- /** Current Raft term */
1032
849
  current_term: Generated<number>;
1033
850
  /** Instance ID this node voted for in the current term */
1034
851
  voted_for: string | null;
1035
852
  /** Current known leader instance ID */
1036
853
  leader_id: string | null;
1037
- /** When this state was last updated */
1038
854
  updated_at: Generated<Date>;
1039
855
  }
1040
856
  export type RaftState = Selectable<RaftStateTable>;
1041
857
  export type RaftStateUpdate = Updateable<RaftStateTable>;
1042
858
  /**
1043
- * Contexts table
1044
- * Named deployment contexts with concurrency, branch restrictions, and approval rules.
1045
- * Scoped to an organization.
859
+ * Org-scoped named deployment contexts with concurrency, branch restrictions and approval rules.
1046
860
  */
1047
861
  export interface ContextsTable {
1048
862
  /** UUID primary key */
1049
863
  id: Generated<string>;
1050
- /** Organization ID */
1051
864
  org_id: string;
1052
865
  /** Context name (unique within org) */
1053
866
  name: string;
@@ -1064,9 +877,8 @@ export interface ContextsTable {
1064
877
  /** Max concurrent runs (null = unlimited) */
1065
878
  concurrency_limit: number | null;
1066
879
  /**
1067
- * Strategy when concurrency exceeded; see `ConcurrencyStrategy` in
1068
- * `@kici-dev/engine` for the vocabulary. Stays a plain `string` so a row
1069
- * written by another orchestrator version always maps (null = unset).
880
+ * `ConcurrencyStrategy` (`@kici-dev/engine`) applied when concurrency is exceeded; a plain
881
+ * `string` so a row from another orchestrator version always maps (null = unset).
1070
882
  */
1071
883
  concurrency_strategy: Generated<string | null>;
1072
884
  /** Timeout for queued runs in milliseconds */
@@ -1081,30 +893,21 @@ export interface ContextsTable {
1081
893
  minimum_trust: string | null;
1082
894
  /** Whether this context allows local (no-remote) executions. Default false. */
1083
895
  allow_local_execution: Generated<boolean>;
1084
- /** Whether this context is active */
1085
896
  enabled: Generated<boolean>;
1086
- /** When this context was created */
1087
897
  created_at: Generated<Date>;
1088
- /** When this context was last updated */
1089
898
  updated_at: Generated<Date>;
1090
- /** Who created this context */
1091
899
  created_by: string | null;
1092
900
  }
1093
901
  export type Context = Selectable<ContextsTable>;
1094
902
  export type NewContext = Insertable<ContextsTable>;
1095
903
  export type ContextUpdate = Updateable<ContextsTable>;
1096
- /**
1097
- * Scoped secrets table
1098
- * Encrypted key-value pairs scoped to org + scope (e.g. context name, repo pattern).
1099
- */
904
+ /** Encrypted key-value pairs scoped to org + scope (e.g. context name, repo pattern). */
1100
905
  export interface ScopedSecretsTable {
1101
906
  /** UUID primary key */
1102
907
  id: Generated<string>;
1103
- /** Organization ID */
1104
908
  org_id: string;
1105
909
  /** Scope identifier (e.g. context name, repo pattern) */
1106
910
  scope: string;
1107
- /** Secret key name */
1108
911
  key: string;
1109
912
  /** Encrypted secret value */
1110
913
  encrypted_value: string;
@@ -1112,22 +915,16 @@ export interface ScopedSecretsTable {
1112
915
  backend_type: Generated<string>;
1113
916
  /** Version of the encryption key used */
1114
917
  key_version: Generated<number>;
1115
- /** When this secret was created */
1116
918
  created_at: Generated<Date>;
1117
- /** When this secret was last updated */
1118
919
  updated_at: Generated<Date>;
1119
920
  }
1120
921
  export type ScopedSecret = Selectable<ScopedSecretsTable>;
1121
922
  export type NewScopedSecret = Insertable<ScopedSecretsTable>;
1122
923
  export type ScopedSecretUpdate = Updateable<ScopedSecretsTable>;
1123
- /**
1124
- * Context bindings table
1125
- * Links contexts to scope patterns (e.g. workflow names, repo identifiers).
1126
- */
924
+ /** Links contexts to scope patterns (e.g. workflow names, repo identifiers). */
1127
925
  export interface ContextBindingsTable {
1128
926
  /** UUID primary key */
1129
927
  id: Generated<string>;
1130
- /** Organization ID */
1131
928
  org_id: string;
1132
929
  /** Context ID (FK to contexts.id, cascade delete) */
1133
930
  context_id: string;
@@ -1139,80 +936,56 @@ export interface ContextBindingsTable {
1139
936
  * host.
1140
937
  */
1141
938
  host_pattern: Generated<string>;
1142
- /** When this binding was created */
1143
939
  created_at: Generated<Date>;
1144
940
  }
1145
941
  export type ContextBinding = Selectable<ContextBindingsTable>;
1146
942
  export type NewContextBinding = Insertable<ContextBindingsTable>;
1147
- /**
1148
- * Context variables table
1149
- * Non-secret key-value pairs attached to a context.
1150
- */
943
+ /** Non-secret key-value pairs attached to a context. */
1151
944
  export interface ContextVariablesTable {
1152
945
  /** UUID primary key */
1153
946
  id: Generated<string>;
1154
- /** Organization ID */
1155
947
  org_id: string;
1156
948
  /** Context ID (FK to contexts.id, cascade delete) */
1157
949
  context_id: string;
1158
- /** Variable key name */
1159
950
  key: string;
1160
- /** Variable value */
1161
951
  value: string;
1162
952
  /** Whether this variable is locked (cannot be overridden by workflow) */
1163
953
  locked: Generated<boolean>;
1164
- /** When this variable was created */
1165
954
  created_at: Generated<Date>;
1166
- /** When this variable was last updated */
1167
955
  updated_at: Generated<Date>;
1168
956
  }
1169
957
  export type ContextVariable = Selectable<ContextVariablesTable>;
1170
958
  export type NewContextVariable = Insertable<ContextVariablesTable>;
1171
959
  export type ContextVariableUpdate = Updateable<ContextVariablesTable>;
1172
- /**
1173
- * Context source overrides table
1174
- * Per-source (routing key) variable overrides within a context.
1175
- */
960
+ /** Per-source (routing key) variable overrides within a context. */
1176
961
  export interface ContextSourceOverridesTable {
1177
962
  /** UUID primary key */
1178
963
  id: Generated<string>;
1179
- /** Organization ID */
1180
964
  org_id: string;
1181
965
  /** Context ID (FK to contexts.id, cascade delete) */
1182
966
  context_id: string;
1183
- /** Routing key for the source */
1184
967
  routing_key: string;
1185
- /** Override key name */
1186
968
  key: string;
1187
- /** Override value */
1188
969
  value: string;
1189
- /** When this override was created */
1190
970
  created_at: Generated<Date>;
1191
- /** When this override was last updated */
1192
971
  updated_at: Generated<Date>;
1193
972
  }
1194
973
  export type ContextSourceOverride = Selectable<ContextSourceOverridesTable>;
1195
974
  export type NewContextSourceOverride = Insertable<ContextSourceOverridesTable>;
1196
975
  export type ContextSourceOverrideUpdate = Updateable<ContextSourceOverridesTable>;
1197
- /**
1198
- * Held runs table
1199
- * Tracks runs waiting for approval, wait timer, or concurrency slot.
1200
- */
976
+ /** Tracks runs waiting for approval, wait timer, or concurrency slot. */
1201
977
  export interface HeldRunsTable {
1202
978
  /** UUID primary key */
1203
979
  id: Generated<string>;
1204
- /** Organization ID */
1205
980
  org_id: string;
1206
981
  /** Run ID (references execution_runs) */
1207
982
  run_id: string;
1208
- /** Job ID within the run */
1209
983
  job_id: string;
1210
984
  /** Context ID (FK to contexts.id); null once the context is deleted */
1211
985
  context_id: string | null;
1212
986
  /**
1213
- * Hold type — an engine `HoldType` member ('reviewer' | 'timer' |
1214
- * 'concurrency' | 'security'). Stays `string` so a row written by a
1215
- * different orchestrator version is never rejected.
987
+ * Engine `HoldType` ('reviewer' | 'timer' | 'concurrency' | 'security'). A plain `string`
988
+ * so a row from a different orchestrator version is never rejected.
1216
989
  */
1217
990
  hold_type: string;
1218
991
  /** Hold status: 'pending' | 'approved' | 'rejected' | 'expired' | 'released' */
@@ -1223,11 +996,8 @@ export interface HeldRunsTable {
1223
996
  reason: string | null;
1224
997
  /** Who approved/rejected this hold */
1225
998
  approved_by: string | null;
1226
- /** When this hold was created */
1227
999
  created_at: Generated<Date>;
1228
- /** When this hold expires */
1229
1000
  expires_at: Date;
1230
- /** When this hold was resolved */
1231
1001
  resolved_at: Date | null;
1232
1002
  /**
1233
1003
  * Hold granularity: 'workflow' | 'job' | 'step' (engine `HoldScope`).
@@ -1253,13 +1023,10 @@ export interface HeldRunsTable {
1253
1023
  */
1254
1024
  payload: ColumnType<StepApprovalPayload | null, StepApprovalPayload | string | null | undefined, StepApprovalPayload | string | null>;
1255
1025
  /**
1256
- * Whether this hold's pending `KiCI Security` check actually reached the
1257
- * provider. `true` after a post returned; `false` when none was attempted or
1258
- * one failed; `null` on a row written before the column existed, for which
1259
- * the hold's shape is still the only available answer.
1260
- *
1261
- * Read through `postedPendingSecurityCheck`. It decides whether a hold has a
1262
- * check to terminalize — and terminalizing one it never posted CREATES a
1026
+ * Whether the hold's pending `KiCI Security` check reached the provider: `true` after a post
1027
+ * returned, `false` when none was attempted or one failed, `null` on a pre-column row (the
1028
+ * hold's shape is then the only answer). Read through `postedPendingSecurityCheck` to decide
1029
+ * whether a hold has a check to terminalize — terminalizing one never posted CREATES a
1263
1030
  * `KiCI Security` run on a commit that had none.
1264
1031
  */
1265
1032
  posted_pending_check: Generated<boolean | null>;
@@ -1283,24 +1050,18 @@ export interface HeldRunApprovalsTable {
1283
1050
  decision: string;
1284
1051
  /** Which requirement clauses this decision satisfied (for attribution). */
1285
1052
  clauses_satisfied: ColumnType<ApproverClause[] | null, ApproverClause[] | string | null | undefined, ApproverClause[] | string | null>;
1286
- /** When the decision was recorded */
1287
1053
  created_at: Generated<Date>;
1288
1054
  }
1289
1055
  export type HeldRunApproval = Selectable<HeldRunApprovalsTable>;
1290
1056
  export type NewHeldRunApproval = Insertable<HeldRunApprovalsTable>;
1291
1057
  export type HeldRunApprovalUpdate = Updateable<HeldRunApprovalsTable>;
1292
- /**
1293
- * Secret audit log table
1294
- * Immutable log of secret access and denial events.
1295
- */
1058
+ /** Immutable log of secret access and denial events. */
1296
1059
  export interface SecretAuditLogTable {
1297
1060
  /** UUID primary key */
1298
1061
  id: Generated<string>;
1299
- /** When the event occurred */
1300
1062
  timestamp: Generated<Date>;
1301
1063
  /** The action performed (e.g., 'getSecrets', 'setSecret') */
1302
1064
  action: string;
1303
- /** The context name involved */
1304
1065
  context_name: string;
1305
1066
  /** Routing key scope */
1306
1067
  routing_key: string | null;
@@ -1318,10 +1079,7 @@ export interface SecretAuditLogTable {
1318
1079
  role: string | null;
1319
1080
  /** Additional metadata (JSON) */
1320
1081
  metadata: string | null;
1321
- /**
1322
- * Set inside the archive transaction before the row is DELETEd.
1323
- * Survivors carry NULL.
1324
- */
1082
+ /** Set inside the archive transaction before the row is DELETEd; survivors carry NULL. */
1325
1083
  archived_at: Date | null;
1326
1084
  /** S3 object key of the chunk that carried this row; see `archived_at`. */
1327
1085
  archive_object_key: string | null;
@@ -1329,10 +1087,9 @@ export interface SecretAuditLogTable {
1329
1087
  export type SecretAuditLogRow = Selectable<SecretAuditLogTable>;
1330
1088
  export type NewSecretAuditLogRow = Insertable<SecretAuditLogTable>;
1331
1089
  /**
1332
- * Access log table.
1333
1090
  * One row per read or orchestrator-admin mutation attributable to an
1334
1091
  * ActorPrincipal (user / api_key / service_account / platform_operator /
1335
- * system). TTL-pruned via expires_at by the cleanup job.
1092
+ * system). Retention: see `archived_at`.
1336
1093
  */
1337
1094
  export interface AccessLogTable {
1338
1095
  id: Generated<string>;
@@ -1349,16 +1106,16 @@ export interface AccessLogTable {
1349
1106
  outcome: string;
1350
1107
  error_message: string | null;
1351
1108
  /**
1352
- * Human-set agent name, when the actor authenticated with an agent-kind PAT.
1353
- * NULL for ordinary human / API-key / system actors. Queryable so the access
1354
- * log can be filtered by agent.
1109
+ * Human-set agent name when the actor used an agent-kind PAT; NULL for human / API-key /
1110
+ * system actors. Queryable so the access log filters by agent.
1355
1111
  */
1356
1112
  agent_label: string | null;
1357
1113
  created_at: Generated<Date>;
1358
1114
  /**
1359
- * Set inside the archive transaction before the row is DELETEd.
1360
- * Survivors carry NULL. The table has no `expires_at`-based TTL — rows
1361
- * older than 30 days are archived to S3 instead of hard-deleted.
1115
+ * Set inside the archive transaction before the row is DELETEd; survivors carry NULL. No
1116
+ * `expires_at`-based TTL. With the cold store on, rows past their per-action warm TTL
1117
+ * (`accessLogWarmSqlCase`) are archived to S3; with it off, the database retention sweep
1118
+ * (`audit_retention_days`) prunes them.
1362
1119
  */
1363
1120
  archived_at: Date | null;
1364
1121
  /** S3 object key of the chunk that carried this row; see `archived_at`. */
@@ -1366,44 +1123,34 @@ export interface AccessLogTable {
1366
1123
  }
1367
1124
  export type AccessLogRow = Selectable<AccessLogTable>;
1368
1125
  export type NewAccessLogRow = Insertable<AccessLogTable>;
1369
- /**
1370
- * Admin tokens table
1371
- * Hashed tokens for admin API authentication with role-based access.
1372
- */
1126
+ /** Hashed tokens for admin API authentication with role-based access. */
1373
1127
  export interface AdminTokenTable {
1374
1128
  /** UUID primary key */
1375
1129
  id: Generated<string>;
1376
1130
  /** SHA-256 hash of the token */
1377
1131
  token_hash: string;
1378
- /** Human-readable label */
1379
1132
  label: string;
1380
1133
  /** Role (e.g. 'admin', 'reader') */
1381
1134
  role: string;
1382
1135
  /** Routing key scope (null = all) */
1383
1136
  routing_key: string | null;
1384
1137
  /**
1385
- * The intended holder, as the operator stated it at `token create --subject`
1386
- * (an OIDC `sub` or an email). Advisory metadata only: the orchestrator
1387
- * cannot verify it and never reads it when authorizing a request. It is the
1388
- * join key the Platform's RBAC drift report compares against org membership.
1389
- * NULL means nobody recorded a holder — the report's `unlinked` finding.
1138
+ * The intended holder from `token create --subject` (an OIDC `sub` or an email). Advisory
1139
+ * only: never verified and never read when authorizing. The join key the Platform's RBAC
1140
+ * drift report compares against org membership; NULL is the report's `unlinked` finding.
1390
1141
  */
1391
1142
  subject: string | null;
1392
- /** When this token was created */
1393
1143
  created_at: Generated<Date>;
1394
1144
  /** When this token expires (null = never) */
1395
1145
  expires_at: Date | null;
1396
- /** When this token was last used */
1397
1146
  last_used_at: Date | null;
1398
- /** Whether this token has been revoked */
1399
1147
  revoked: Generated<boolean>;
1400
1148
  }
1401
1149
  export type AdminTokenRow = Selectable<AdminTokenTable>;
1402
1150
  export type NewAdminTokenRow = Insertable<AdminTokenTable>;
1403
1151
  /**
1404
- * Agent tokens table
1405
- * Hashed tokens for agent authentication (PSK-based).
1406
- * Supports static (long-lived, CLI-created) and ephemeral (scaler-issued, TTL-bound) tokens.
1152
+ * Hashed PSK tokens for agent authentication: static (long-lived, CLI-created) or ephemeral
1153
+ * (scaler-issued, TTL-bound).
1407
1154
  */
1408
1155
  export interface AgentTokenTable {
1409
1156
  /** UUID primary key */
@@ -1415,16 +1162,13 @@ export interface AgentTokenTable {
1415
1162
  /** JSON-encoded string[] of agent labels (null = any) */
1416
1163
  labels: string | null;
1417
1164
  /**
1418
- * JSON-encoded string[] of mandatory labels (a Kubernetes-taint-style gate):
1419
- * a static agent registering with this token only accepts a job when every
1420
- * label here appears in the job's required labels. null = no taint (the
1421
- * default; the agent accepts any job its advertised labels match).
1422
- * Authorized at mint time alongside `labels`.
1165
+ * JSON `string[]` of mandatory labels (a Kubernetes-taint-style gate): a static agent on this
1166
+ * token accepts a job only when every label here is among the job's required labels. null =
1167
+ * no taint (the default). Authorized at mint time alongside `labels`.
1423
1168
  */
1424
1169
  mandatory_labels: string | null;
1425
1170
  /** Token type: 'ephemeral' (scaler-issued) or 'static' (CLI-created) */
1426
1171
  agent_type: string;
1427
- /** When this token was created */
1428
1172
  created_at: Generated<Date>;
1429
1173
  /** When this token was last used for authentication */
1430
1174
  last_seen_at: Date | null;
@@ -1435,20 +1179,17 @@ export interface AgentTokenTable {
1435
1179
  /** When this token expires (null = never, static tokens) */
1436
1180
  expires_at: Date | null;
1437
1181
  /**
1438
- * Single-use marker for bootstrap (init-runner) tokens. Set the first time
1439
- * the token is consumed at `agent.register`; a second register is rejected.
1440
- * NULL = never consumed (every static / ephemeral token stays reusable until
1441
- * expiry).
1182
+ * Single-use marker for bootstrap (init-runner) tokens, set on first `agent.register`; a
1183
+ * second register is rejected. NULL = never consumed (static / ephemeral tokens stay
1184
+ * reusable until expiry).
1442
1185
  */
1443
1186
  consumed_at: ColumnType<Date | null, Date | string | null | undefined, Date | string | null>;
1444
1187
  }
1445
1188
  export type AgentTokenRow = Selectable<AgentTokenTable>;
1446
1189
  export type NewAgentTokenRow = Insertable<AgentTokenTable>;
1447
1190
  /**
1448
- * Config versions table
1449
- * Stores versioned JSONB config snapshots with audit trail.
1450
- * Each config change creates a new version with auto-incrementing version number.
1451
- * Sensitive fields are encrypted and tracked via encrypted_paths array.
1191
+ * Versioned JSONB config snapshots with audit trail; each change adds a version. Sensitive
1192
+ * fields are encrypted and listed in `encrypted_paths`.
1452
1193
  */
1453
1194
  export interface ConfigVersionTable {
1454
1195
  /** UUID primary key */
@@ -1457,7 +1198,6 @@ export interface ConfigVersionTable {
1457
1198
  version: Generated<number>;
1458
1199
  /** Full config snapshot as JSONB */
1459
1200
  config: string;
1460
- /** When this version was created */
1461
1201
  created_at: Generated<Date>;
1462
1202
  /** Who created this version (e.g. "cli:seed", "api:set", "api:rollback") */
1463
1203
  created_by: string;
@@ -1466,19 +1206,14 @@ export interface ConfigVersionTable {
1466
1206
  /** JSONB paths that contain encrypted values */
1467
1207
  encrypted_paths: Generated<string[]>;
1468
1208
  /**
1469
- * Master-key generation used to encrypt this row's sensitive fields.
1470
- * Bumped atomically by `kici-admin rotate-key`; decrypt path accepts
1471
- * both the current and the previous generation during a grace window.
1209
+ * Master-key generation of this row's sensitive fields, bumped atomically by
1210
+ * `kici-admin rotate-key`; decrypt accepts current and previous during a grace window.
1472
1211
  */
1473
1212
  key_version: Generated<number>;
1474
1213
  }
1475
1214
  export type ConfigVersionRow = Selectable<ConfigVersionTable>;
1476
1215
  export type NewConfigVersionRow = Insertable<ConfigVersionTable>;
1477
- /**
1478
- * Internal events table (kici_events)
1479
- * Persists internal events (system + custom) for routing, circuit-breaking, and audit.
1480
- * Events have a TTL-based expiry for automatic cleanup.
1481
- */
1216
+ /** Internal events (system + custom) for routing, circuit-breaking and audit; TTL-expired. */
1482
1217
  export interface KiciEventTable {
1483
1218
  /** UUID primary key */
1484
1219
  id: Generated<string>;
@@ -1488,7 +1223,6 @@ export interface KiciEventTable {
1488
1223
  payload: string;
1489
1224
  /** Source repo identifier (null for non-repo events) */
1490
1225
  source_repo: string | null;
1491
- /** Source routing key */
1492
1226
  source_routing_key: string | null;
1493
1227
  /** Run ID that emitted this event */
1494
1228
  source_run_id: string | null;
@@ -1498,9 +1232,7 @@ export interface KiciEventTable {
1498
1232
  chain_depth: Generated<number>;
1499
1233
  /** Whether all subscribers have processed this event */
1500
1234
  processed: Generated<boolean>;
1501
- /** When this event was created */
1502
1235
  created_at: Generated<Date>;
1503
- /** When this event expires (TTL-based cleanup) */
1504
1236
  expires_at: Date;
1505
1237
  /** Optional target repos for cross-repo event targeting (JSONB string[] or null) */
1506
1238
  target_repos: string | null;
@@ -1508,7 +1240,7 @@ export interface KiciEventTable {
1508
1240
  claimed_at: Date | null;
1509
1241
  /** Node id holding the current lease (for diagnostics; not part of the lease check) */
1510
1242
  claimed_by: string | null;
1511
- /** Number of times this event has been leased for processing */
1243
+ /** Times the event has been leased for processing */
1512
1244
  attempts: Generated<number>;
1513
1245
  /** Most recent dispatch failure message (truncated to 4 KB by application code) */
1514
1246
  last_error: string | null;
@@ -1526,15 +1258,10 @@ export interface KiciEventTable {
1526
1258
  export type KiciEvent = Selectable<KiciEventTable>;
1527
1259
  export type NewKiciEvent = Insertable<KiciEventTable>;
1528
1260
  export type KiciEventUpdate = Updateable<KiciEventTable>;
1529
- /**
1530
- * Generic webhook sources table (generic_webhook_sources)
1531
- * Stores per-source verification config, event extraction rules, and rate limits
1532
- * for non-GitHub webhook sources.
1533
- */
1261
+ /** Non-GitHub webhook sources: verification config, event extraction rules and rate limits. */
1534
1262
  export interface GenericWebhookSourceTable {
1535
1263
  /** UUID primary key */
1536
1264
  id: Generated<string>;
1537
- /** Customer/tenant identifier */
1538
1265
  customer_id: string;
1539
1266
  /** Human-readable source name (unique within customer when not deleted) */
1540
1267
  name: string;
@@ -1548,7 +1275,6 @@ export interface GenericWebhookSourceTable {
1548
1275
  event_type_header: string | null;
1549
1276
  /** JSONPath expression to extract event type from payload body */
1550
1277
  event_type_path: string | null;
1551
- /** Header name for idempotency key */
1552
1278
  idempotency_key_header: string | null;
1553
1279
  /** JSONPath expression for idempotency key from body */
1554
1280
  idempotency_key_path: string | null;
@@ -1560,71 +1286,55 @@ export interface GenericWebhookSourceTable {
1560
1286
  allowed_events: string | null;
1561
1287
  /** JSON array of sensitive headers to strip (default: auth-related headers) */
1562
1288
  strip_headers: Generated<string>;
1563
- /** Whether this source is active */
1564
1289
  enabled: Generated<boolean>;
1565
1290
  /** Token bucket rate limit: requests per minute */
1566
1291
  rate_limit_rpm: Generated<number>;
1567
- /** When this source was created */
1568
1292
  created_at: Generated<Date>;
1569
- /** When this source was last updated */
1570
1293
  updated_at: Generated<Date>;
1571
1294
  /** Soft-delete marker (null = active) */
1572
1295
  deleted_at: Date | null;
1573
- /** Provider implementation to route this source through.
1574
- * 'generic' (default) → GenericWebhookNormalizer (Stripe-shaped payloads).
1575
- * 'local' → LocalWebhookNormalizer (github-shaped push/PR payloads for a
1576
- * git repository present on the agent filesystem, cloned via file://). */
1296
+ /**
1297
+ * Normalizer: 'generic' (default) → GenericWebhookNormalizer (Stripe-shaped payloads);
1298
+ * 'local' → LocalWebhookNormalizer (github-shaped push/PR payloads for a repository on the
1299
+ * agent filesystem, cloned via file://).
1300
+ */
1577
1301
  provider_type: Generated<string>;
1578
- /** Git config (JSONB), dual-purpose discriminated by `provider_type`:
1579
- * - universal-git sources ('generic' with git_config) store a
1580
- * `UniversalGitConfig` (clone URLs, lock-file fetch, clone credentials
1581
- * against Forgejo / Gitea / Gogs / GitLab repo-webhook / GitHub repo).
1582
- * - local sources ('local') store a `LocalSourceConfig`
1583
- * (`{ repoBasePath, cloneUrlBase? }`).
1584
- * null for plain generic sources that don't drive git operations. Shape
1585
- * validated by the matching Zod schema at the application layer. */
1302
+ /**
1303
+ * Git config JSONB, discriminated by `provider_type`: a universal-git source ('generic' with
1304
+ * git_config) stores a `UniversalGitConfig` (clone URLs, lock-file fetch, clone credentials
1305
+ * against Forgejo / Gitea / Gogs / GitLab repo-webhook / GitHub repo); a 'local' source a
1306
+ * `LocalSourceConfig` (`{ repoBasePath, cloneUrlBase? }`). null for plain generic sources
1307
+ * with no git operations. Validated by the matching Zod schema in the application layer.
1308
+ */
1586
1309
  git_config: ColumnType<string | Record<string, unknown> | null, string | null, string | null>;
1587
1310
  }
1588
1311
  export type GenericWebhookSource = Selectable<GenericWebhookSourceTable>;
1589
1312
  export type NewGenericWebhookSource = Insertable<GenericWebhookSourceTable>;
1590
1313
  export type GenericWebhookSourceUpdate = Updateable<GenericWebhookSourceTable>;
1591
- /**
1592
- * Cross-repo trust table (cross_repo_trust)
1593
- * Bidirectional trust relationships for cross-repo event delivery.
1594
- * Both source and target must declare trust for delivery to proceed.
1595
- */
1314
+ /** Cross-repo event-delivery trust; delivery needs both source and target to declare it. */
1596
1315
  export interface CrossRepoTrustTable {
1597
1316
  /** UUID primary key */
1598
1317
  id: Generated<string>;
1599
1318
  /** Source repo that is trusted to emit events */
1600
1319
  source_repo: string;
1601
- /** Source routing key */
1602
1320
  source_routing_key: string;
1603
1321
  /** Target repo that accepts events from source */
1604
1322
  target_repo: string;
1605
- /** Target routing key */
1606
1323
  target_routing_key: string;
1607
1324
  /** JSON array of event name glob patterns allowed (null = all) */
1608
1325
  allowed_events: string | null;
1609
- /** Whether this trust relationship is active */
1610
1326
  enabled: Generated<boolean>;
1611
- /** When this trust relationship was created */
1612
1327
  created_at: Generated<Date>;
1613
1328
  }
1614
1329
  export type CrossRepoTrust = Selectable<CrossRepoTrustTable>;
1615
1330
  export type NewCrossRepoTrust = Insertable<CrossRepoTrustTable>;
1616
1331
  export type CrossRepoTrustUpdate = Updateable<CrossRepoTrustTable>;
1617
- /**
1618
- * Test uploads table (test_uploads)
1619
- * Tracks CLI code uploads for remote test runs.
1620
- * Uploads are temporary (24h TTL) and cleaned up by a periodic job.
1621
- */
1332
+ /** CLI code uploads for remote test runs; a periodic job removes them after a 24h TTL. */
1622
1333
  export interface TestUploadsTable {
1623
1334
  /** UUID primary key */
1624
1335
  id: Generated<string>;
1625
1336
  /** Client-facing upload ID */
1626
1337
  upload_id: string;
1627
- /** Routing key for this upload */
1628
1338
  routing_key: string;
1629
1339
  /** Git SHA from the upload */
1630
1340
  sha: string | null;
@@ -1638,7 +1348,6 @@ export interface TestUploadsTable {
1638
1348
  encryption_private_key: string | null;
1639
1349
  /** Upload status: pending | uploaded | dispatched | expired */
1640
1350
  status: Generated<string>;
1641
- /** When this upload was created */
1642
1351
  created_at: Generated<Date>;
1643
1352
  /** When this upload expires (24h from creation) */
1644
1353
  expires_at: Date;
@@ -1648,11 +1357,7 @@ export interface TestUploadsTable {
1648
1357
  export type TestUpload = Selectable<TestUploadsTable>;
1649
1358
  export type NewTestUpload = Insertable<TestUploadsTable>;
1650
1359
  export type TestUploadUpdate = Updateable<TestUploadsTable>;
1651
- /**
1652
- * Workflow registrations table
1653
- * Per-workflow rows with full lock entry and trigger type index.
1654
- * Each registration is unique per (routing_key, repo, workflow).
1655
- */
1360
+ /** One row per (routing_key, repo, workflow): the full lock entry plus a trigger-type index. */
1656
1361
  export interface WorkflowRegistrationsTable {
1657
1362
  /** UUID primary key */
1658
1363
  id: Generated<string>;
@@ -1673,27 +1378,19 @@ export interface WorkflowRegistrationsTable {
1673
1378
  /** Git commit SHA from the push that last updated this registration */
1674
1379
  commit_sha: ColumnType<string | null, string | null | undefined, string | null>;
1675
1380
  /**
1676
- * The repository's default branch, captured from the push that last updated
1677
- * this registration. A `__schedule_fire` run executes this branch's lock
1678
- * file, so this IS that run's branch when a context evaluates branch
1679
- * restrictions.
1680
- *
1681
- * NULL when the registration predates migration 123, or when the webhook
1682
- * payload named no default branch. There is no backfill: the value is only
1683
- * knowable from a payload, so a NULL row heals on its repo's next
1684
- * default-branch push. NULL presents no branch, which keeps the honest
1685
- * branch-gate rejection rather than inventing a branch.
1381
+ * The repo's default branch from the push that last updated this registration. A
1382
+ * `__schedule_fire` run executes this branch's lock file, so this IS that run's branch for
1383
+ * context branch restrictions. NULL when the row predates migration 123 or the payload named
1384
+ * no default branch; no backfill is possible, so a NULL row heals on the next default-branch
1385
+ * push. NULL presents no branch, keeping the honest branch-gate rejection.
1686
1386
  */
1687
1387
  default_branch: ColumnType<string | null, string | null | undefined, string | null>;
1688
1388
  /** Source file path for this workflow (e.g. ".kici/workflows/deploy.ts") */
1689
1389
  source_file: ColumnType<string | null, string | null | undefined, string | null>;
1690
1390
  /**
1691
- * `lockfileHash` of the lock file that last registered this workflow: the
1692
- * package-manager lockfile hash that keys the dependency cache. A run dispatched
1693
- * from the registration probes the dependency cache with it.
1694
- *
1695
- * NULL when that lock file records none, and on rows written before migration
1696
- * 149. NULL means the run installs its dependencies on the agent.
1391
+ * `lockfileHash` of the lock file that last registered this workflow: the package-manager
1392
+ * lockfile hash a dispatched run probes the dependency cache with. NULL when that lock file
1393
+ * records none and on rows before migration 149; the run then installs deps on the agent.
1697
1394
  */
1698
1395
  lockfile_hash: ColumnType<string | null, string | null | undefined, string | null>;
1699
1396
  /**
@@ -1703,74 +1400,55 @@ export interface WorkflowRegistrationsTable {
1703
1400
  */
1704
1401
  siblings_digest: ColumnType<string | null, string | null | undefined, string | null>;
1705
1402
  /**
1706
- * The `commit_sha` written together with `lockfile_hash` and `siblings_digest`.
1707
- * The key is used only while this equals `commit_sha`: a writer that does not
1708
- * know the key columns moves `commit_sha` without them, and the key it leaves
1709
- * behind belongs to an older lock file.
1710
- *
1711
- * NULL on rows written before migration 151 and on rows registered with no
1712
- * commit; such a row uses no key.
1403
+ * The `commit_sha` written with `lockfile_hash` and `siblings_digest`; the key is used only
1404
+ * while this equals `commit_sha`, since a writer unaware of the key columns moves
1405
+ * `commit_sha` alone and leaves an older lock file's key. NULL (rows before migration 151 or
1406
+ * registered with no commit) uses no key.
1713
1407
  */
1714
1408
  dep_cache_key_sha: ColumnType<string | null, string | null | undefined, string | null>;
1715
1409
  /** Whether this is a global workflow (triggers across all repos under same routing key) */
1716
1410
  is_global: ColumnType<boolean, boolean | undefined, boolean>;
1717
1411
  /**
1718
- * Customer/org ID that owns this registration. Backfilled from the source row
1719
- * (sources or generic_webhook_sources joined on routing_key) by migration 020,
1720
- * NOT NULL after backfill. Used by the cross-source webhook lookup index
1721
- * (RegistrationIndex.byOrgAndEvent) to enforce org isolation.
1722
- *
1723
- * Required on insert (no DB default — migration 020 enforces NOT NULL);
1724
- * Updateable type allows omission so the existing replaceAll UPDATE branch
1725
- * (which preserves the existing customer_id alongside the rest of the row)
1726
- * can keep its current shape.
1412
+ * Owning org, backfilled by migration 020 from sources / generic_webhook_sources on
1413
+ * routing_key and NOT NULL since. The cross-source lookup index
1414
+ * (RegistrationIndex.byOrgAndEvent) enforces org isolation with it. Required on insert (no DB
1415
+ * default); optional on update because the replaceAll UPDATE branch preserves it.
1727
1416
  */
1728
1417
  customer_id: ColumnType<string, string, string | undefined>;
1729
- /** When this registration was created */
1730
1418
  created_at: Generated<Date>;
1731
- /** When this registration was last updated */
1732
1419
  updated_at: Generated<Date>;
1733
1420
  }
1734
1421
  export type WorkflowRegistration = Selectable<WorkflowRegistrationsTable>;
1735
1422
  export type NewWorkflowRegistration = Insertable<WorkflowRegistrationsTable>;
1736
1423
  export type WorkflowRegistrationUpdate = Updateable<WorkflowRegistrationsTable>;
1737
1424
  /**
1738
- * Registry versions table
1739
- * Cluster sync version counter. Incremented on registration changes.
1740
- * Default row with id='default' inserted by migration.
1425
+ * Cluster sync version counter, bumped on registration changes. A migration inserts the
1426
+ * id='default' row.
1741
1427
  */
1742
1428
  export interface RegistryVersionsTable {
1743
1429
  /** Version identifier (default: 'default') */
1744
1430
  id: Generated<string>;
1745
1431
  /** Monotonically increasing version counter */
1746
1432
  version: Generated<number>;
1747
- /** When the version was last bumped */
1748
1433
  updated_at: Generated<Date>;
1749
1434
  }
1750
1435
  export type RegistryVersion = Selectable<RegistryVersionsTable>;
1751
1436
  export type RegistryVersionUpdate = Updateable<RegistryVersionsTable>;
1752
- /**
1753
- * Cron last-fired table
1754
- * Tracks the last time each cron-triggered workflow registration fired.
1755
- * Used for fire-once-on-recovery after orchestrator restart.
1756
- */
1437
+ /** Last fire time per cron registration, for fire-once-on-recovery after a restart. */
1757
1438
  export interface CronLastFiredTable {
1758
1439
  /** References workflow_registrations.id (cascade delete) */
1759
1440
  registration_id: string;
1760
1441
  /** Per-schedule identity: `${cronExpression}\n${timezone}` (see scheduleTriggerKey) */
1761
1442
  schedule_key: string;
1762
- /** When this cron trigger last fired */
1763
1443
  last_fired_at: Date;
1764
- /** When this record was last updated */
1765
1444
  updated_at: Generated<Date>;
1766
1445
  }
1767
1446
  export type CronLastFired = Selectable<CronLastFiredTable>;
1768
1447
  export type NewCronLastFired = Insertable<CronLastFiredTable>;
1769
1448
  export type CronLastFiredUpdate = Updateable<CronLastFiredTable>;
1770
1449
  /**
1771
- * Run ephemeral keys table (run_ephemeral_keys)
1772
- * Stores per-run X25519 key pairs for cross-job secret output encryption.
1773
- * Private keys are encrypted with the orchestrator PSK (AES-256-GCM).
1450
+ * Per-run X25519 key pairs for cross-job secret output encryption. Private keys are encrypted
1451
+ * with the orchestrator master key (`KICI_SECRET_KEY`, AES-256-GCM).
1774
1452
  */
1775
1453
  export interface RunEphemeralKeysTable {
1776
1454
  /** Run ID (primary key, references execution_runs.run_id) */
@@ -1781,20 +1459,15 @@ export interface RunEphemeralKeysTable {
1781
1459
  public_key: string;
1782
1460
  /** Master-key generation this row is sealed under. Bumped by `rotate-key`. */
1783
1461
  key_version: Generated<number>;
1784
- /** When this key pair was created */
1785
1462
  created_at: Generated<Date>;
1786
1463
  }
1787
1464
  export type RunEphemeralKey = Selectable<RunEphemeralKeysTable>;
1788
1465
  export type NewRunEphemeralKey = Insertable<RunEphemeralKeysTable>;
1789
1466
  /**
1790
- * Run secret outputs table (run_secret_outputs)
1791
- * Stores encrypted secret output values produced by jobs for cross-job consumption.
1792
- *
1793
- * The agent seals a value to the run's ephemeral public key (ECDH + AES-256-GCM),
1794
- * but that envelope is not what lands here: the orchestrator opens it with the
1795
- * run private key and RE-ENCRYPTS the plaintext under the master key
1796
- * (`KICI_SECRET_KEY`) before storing. So this is one of the master-key-wrapped
1797
- * stores and moves with every key rotation.
1467
+ * Encrypted job secret outputs for cross-job consumption. The agent seals each value to the
1468
+ * run's ephemeral public key (ECDH + AES-256-GCM); the orchestrator opens it with the run
1469
+ * private key and RE-ENCRYPTS it under the master key (`KICI_SECRET_KEY`) before storing, so
1470
+ * this store moves with every key rotation.
1798
1471
  */
1799
1472
  export interface RunSecretOutputsTable {
1800
1473
  /** UUID primary key */
@@ -1803,31 +1476,23 @@ export interface RunSecretOutputsTable {
1803
1476
  run_id: string;
1804
1477
  /** Job ID that produced this output */
1805
1478
  job_id: string;
1806
- /** Output key name */
1807
1479
  output_key: string;
1808
1480
  /**
1809
- * Base64-encoded value, AES-256-GCM sealed under the master key with AAD
1810
- * `secret-output:<run_id>`. Read through `unsealSecretOutput`, which carries
1811
- * the rotation grace window's old-key fallback.
1481
+ * Base64 value, AES-256-GCM sealed under the master key with AAD `secret-output:<run_id>`.
1482
+ * Read through `unsealSecretOutput`, which carries the rotation grace window's old-key fallback.
1812
1483
  */
1813
1484
  encrypted_value: string;
1814
1485
  /** Master-key generation this row is sealed under. Bumped by `rotate-key`. */
1815
1486
  key_version: Generated<number>;
1816
- /** When this output was stored */
1817
1487
  created_at: Generated<Date>;
1818
1488
  }
1819
1489
  export type RunSecretOutput = Selectable<RunSecretOutputsTable>;
1820
1490
  export type NewRunSecretOutput = Insertable<RunSecretOutputsTable>;
1821
1491
  /**
1822
- * Concurrency groups table (concurrency_groups)
1823
- *
1824
- * The arbiter of `concurrency: { group, max }`, not a record of a decision made
1825
- * elsewhere: a slot is acquired by an advisory-locked transaction that counts
1826
- * `status='active'` rows for the scope and inserts only when the count is below
1827
- * `max`. That is what makes the cap hold across a restart and across every
1828
- * coordinator in a cluster, which a per-process map cannot. A partial unique
1829
- * index on `(routing_key, group_key, run_id) WHERE status='active'` makes a
1830
- * re-acquire idempotent.
1492
+ * The arbiter of `concurrency: { group, max }`: an advisory-locked transaction counts
1493
+ * `status='active'` rows for the scope and inserts only below `max`, so the cap holds across
1494
+ * restarts and every coordinator (a per-process map cannot). A partial unique index on
1495
+ * `(routing_key, group_key, run_id) WHERE status='active'` makes a re-acquire idempotent.
1831
1496
  */
1832
1497
  export interface ConcurrencyGroupsTable {
1833
1498
  /** UUID primary key */
@@ -1836,13 +1501,11 @@ export interface ConcurrencyGroupsTable {
1836
1501
  group_key: string;
1837
1502
  /** Run ID that owns this slot or is queued */
1838
1503
  run_id: string;
1839
- /** Job ID within the run */
1840
1504
  job_id: string;
1841
1505
  /** Routing key for scoping (e.g. "github:42") */
1842
1506
  routing_key: string;
1843
1507
  /** Status: 'active' | 'queued' | 'completed' | 'cancelled' */
1844
1508
  status: Generated<string>;
1845
- /** When this entry was created */
1846
1509
  created_at: Generated<Date>;
1847
1510
  /** When this entry was completed/cancelled */
1848
1511
  completed_at: Date | null;
@@ -1851,39 +1514,34 @@ export type ConcurrencyGroup = Selectable<ConcurrencyGroupsTable>;
1851
1514
  export type NewConcurrencyGroup = Insertable<ConcurrencyGroupsTable>;
1852
1515
  export type ConcurrencyGroupUpdate = Updateable<ConcurrencyGroupsTable>;
1853
1516
  /**
1854
- * Sources table
1855
- * Stores webhook source configurations (e.g. GitHub Apps) with routing keys.
1856
- * Secrets (private key, webhook secret) are stored separately in PgSecretStore.
1517
+ * Webhook source configs (e.g. GitHub Apps) with routing keys. Secrets (private key, webhook
1518
+ * secret) live separately in PgSecretStore.
1857
1519
  */
1858
1520
  export interface SourcesTable {
1859
1521
  /** UUID primary key */
1860
1522
  id: Generated<string>;
1861
1523
  /** Provider type (e.g. 'github') */
1862
1524
  provider: string;
1863
- /** Human-readable source name */
1864
1525
  name: string;
1865
1526
  /** Routing key (e.g. 'github:12345') */
1866
1527
  routing_key: string;
1867
1528
  /** JSONB config (non-sensitive, e.g. { appId: '12345' }) */
1868
1529
  config: string;
1869
1530
  /**
1870
- * GitHub App slug (the URL-safe identifier GitHub assigns, e.g.
1871
- * `my-kici-app`). NULL until the GitHub identity fetch populates it. GitHub
1872
- * is the source of truth for both `name` and `slug` on GitHub-App sources.
1531
+ * GitHub App slug (e.g. `my-kici-app`); NULL until the GitHub identity fetch populates it.
1532
+ * GitHub is the source of truth for `name` and `slug` on GitHub-App sources.
1873
1533
  */
1874
1534
  slug: string | null;
1875
1535
  /** Customer/org identifier for secret and context scoping */
1876
1536
  customer_id: Generated<string>;
1877
- /** When this source was created */
1878
1537
  created_at: Generated<Date>;
1879
- /** When this source was last updated */
1880
1538
  updated_at: Generated<Date>;
1881
1539
  }
1882
1540
  export type Source = Selectable<SourcesTable>;
1883
1541
  export type NewSource = Insertable<SourcesTable>;
1884
1542
  export type SourceUpdate = Updateable<SourcesTable>;
1885
1543
  /**
1886
- * Repo-pattern entry stored inside the three jsonb list columns of
1544
+ * Repo-pattern entry stored inside the jsonb repo-list columns of
1887
1545
  * `org_settings`. `routingKey` is optional — when undefined the entry
1888
1546
  * applies to any source in the org; when set, it qualifies the entry to
1889
1547
  * one specific webhook source.
@@ -1893,11 +1551,9 @@ export interface OrgSettingsRepoPatternEntry {
1893
1551
  pattern: string;
1894
1552
  }
1895
1553
  /**
1896
- * Org settings table (org_settings)
1897
- * Per-org (customer_id) global workflow permissions. Each list column
1898
- * holds a jsonb array of {routingKey?, pattern} entries — entries without
1899
- * a `routingKey` apply to any source in the org, entries with a routing
1900
- * key are scoped to that source only.
1554
+ * Per-org (customer_id) global workflow permissions and overrides of cluster defaults. Repo
1555
+ * list columns hold `OrgSettingsRepoPatternEntry[]` jsonb. A BIGINT column reads back from pg
1556
+ * as a string and takes a number on write.
1901
1557
  */
1902
1558
  export interface OrgSettingsTable {
1903
1559
  /** Customer/org identifier (primary key) */
@@ -1905,177 +1561,141 @@ export interface OrgSettingsTable {
1905
1561
  /** Repos allowed to author global workflows (null = any repo can author) */
1906
1562
  global_workflow_allowed_repos: ColumnType<OrgSettingsRepoPatternEntry[] | null, OrgSettingsRepoPatternEntry[] | null | undefined | string, OrgSettingsRepoPatternEntry[] | null | string>;
1907
1563
  /**
1908
- * Repos explicitly denied as event sources for global workflows.
1909
- * Deny takes precedence over the allow-list (null = no deny patterns).
1564
+ * Repos denied as event sources for global workflows; deny beats the allow-list (null = none).
1910
1565
  */
1911
1566
  global_workflow_denied_repos: ColumnType<OrgSettingsRepoPatternEntry[] | null, OrgSettingsRepoPatternEntry[] | null | undefined | string, OrgSettingsRepoPatternEntry[] | null | string>;
1912
1567
  /**
1913
- * When true, workflow `registries:` URLs may use plain `http://` to any host.
1914
- * When false (default), only `https://` and loopback / `*.local` `http://`
1915
- * URLs are accepted; arbitrary `http://` registries are rejected at dispatch.
1568
+ * True lets workflow `registries:` URLs use plain `http://` to any host. False (default)
1569
+ * accepts only `https://` and loopback / `*.local` `http://`; others are rejected at dispatch.
1916
1570
  */
1917
1571
  allow_http_npm_registries: ColumnType<boolean, boolean | undefined, boolean>;
1918
1572
  /**
1919
- * May an UNTRUSTED ref build its job's container image from a Dockerfile?
1920
- *
1921
- * Default false. The build runs outside the job's hardened sandbox, so this
1922
- * is an opt-in, never inherited.
1573
+ * May an UNTRUSTED ref build its job's container image from a Dockerfile? Default false: the
1574
+ * build runs outside the job's hardened sandbox, so this is opt-in, never inherited.
1923
1575
  */
1924
1576
  allow_untrusted_dockerfile_builds: ColumnType<boolean, boolean | undefined, boolean>;
1925
1577
  /**
1926
- * Per-operation policy controlling which dashboard.* writes the orch
1927
- * accepts when routed through Platform. JSONB shape:
1928
- * `{ [operation]: boolean }` where operation matches the engine enum
1929
- * `DashboardWriteOperation`. Empty object = all enabled (permissive).
1930
- * Resolver in `@kici-dev/engine/protocol/dashboard-write-operations`
1931
- * treats missing keys as `true`.
1578
+ * Which Platform-routed dashboard.* writes the orch accepts: JSONB
1579
+ * `{ [operation]: boolean }` keyed by engine `DashboardWriteOperation`. The resolver in
1580
+ * `@kici-dev/engine/protocol/dashboard-write-operations` treats missing keys as `true`, so
1581
+ * `{}` enables all.
1932
1582
  */
1933
1583
  dashboard_write_policy: ColumnType<Record<string, boolean>, Record<string, boolean> | string | undefined, Record<string, boolean> | string>;
1934
1584
  /**
1935
- * Per-org byte quota for the user-facing cache (UserCache). NULL = use the
1936
- * cluster-wide default (`KICI_USER_CACHE_QUOTA_BYTES`, 5 GiB). Postgres
1937
- * BIGINT — pg returns a string on select; accept a number on insert/update.
1585
+ * UserCache byte quota. NULL = cluster default (`KICI_USER_CACHE_QUOTA_BYTES`, 5 GiB). BIGINT.
1938
1586
  */
1939
1587
  user_cache_quota_bytes: ColumnType<string | null, number | null | undefined, number | null>;
1940
1588
  /**
1941
- * Per-entry TTL (ms) for the user-facing cache (UserCache). NULL = use the
1942
- * cluster-wide default (`KICI_USER_CACHE_TTL_MS`, 7 days). Postgres BIGINT —
1943
- * pg returns a string on select; accept a number on insert/update.
1589
+ * UserCache per-entry TTL (ms). NULL = cluster default (`KICI_USER_CACHE_TTL_MS`, 7 days).
1590
+ * BIGINT.
1944
1591
  */
1945
1592
  user_cache_ttl_ms: ColumnType<string | null, number | null | undefined, number | null>;
1946
1593
  /**
1947
- * Per-org byte quota for user-facing artifacts (ArtifactStore). NULL = use the
1948
- * cluster-wide default (`KICI_ARTIFACT_QUOTA_BYTES`, 20 GiB). Postgres BIGINT —
1949
- * pg returns a string on select; accept a number on insert/update.
1594
+ * ArtifactStore byte quota. NULL = cluster default (`KICI_ARTIFACT_QUOTA_BYTES`, 20 GiB).
1595
+ * BIGINT.
1950
1596
  */
1951
1597
  artifact_quota_bytes: ColumnType<string | null, number | null | undefined, number | null>;
1952
1598
  /**
1953
- * Per-artifact TTL (ms) for user-facing artifacts (ArtifactStore). NULL = use
1954
- * the cluster-wide default (`KICI_ARTIFACT_TTL_MS`, 30 days). Postgres BIGINT —
1955
- * pg returns a string on select; accept a number on insert/update.
1599
+ * ArtifactStore per-artifact TTL (ms). NULL = cluster default (`KICI_ARTIFACT_TTL_MS`,
1600
+ * 30 days). BIGINT.
1956
1601
  */
1957
1602
  artifact_ttl_ms: ColumnType<string | null, number | null | undefined, number | null>;
1958
1603
  /**
1959
- * Per-org per-artifact size cap (bytes) for user-facing artifacts
1960
- * (ArtifactStore). NULL = use the cluster-wide default
1961
- * (`KICI_ARTIFACT_MAX_BYTES`, 1 GiB). Postgres BIGINT — pg returns a string on
1962
- * select; accept a number on insert/update.
1604
+ * ArtifactStore per-artifact size cap (bytes). NULL = cluster default
1605
+ * (`KICI_ARTIFACT_MAX_BYTES`, 1 GiB). BIGINT.
1963
1606
  */
1964
1607
  artifact_max_bytes: ColumnType<string | null, number | null | undefined, number | null>;
1965
1608
  /**
1966
- * Per-org per-run artifact count cap for user-facing artifacts
1967
- * (ArtifactStore). NULL = use the cluster-wide default
1968
- * (`KICI_ARTIFACT_MAX_PER_RUN`, 50). Postgres BIGINT — pg returns a string on
1969
- * select; accept a number on insert/update.
1609
+ * ArtifactStore per-run artifact count cap. NULL = cluster default
1610
+ * (`KICI_ARTIFACT_MAX_PER_RUN`, 50). BIGINT.
1970
1611
  */
1971
1612
  artifact_max_per_run: ColumnType<string | null, number | null | undefined, number | null>;
1972
1613
  /**
1973
- * Per-org dispatch-acknowledgment deadline (ms); null = cluster default
1974
- * (config.dispatchAckTimeoutMs / KICI_DISPATCH_ACK_TIMEOUT_MS). Postgres
1975
- * BIGINT — pg returns a string on select; accept a number on insert/update.
1614
+ * Dispatch-acknowledgment deadline (ms); null = cluster default
1615
+ * (config.dispatchAckTimeoutMs / KICI_DISPATCH_ACK_TIMEOUT_MS). BIGINT.
1976
1616
  */
1977
1617
  dispatch_ack_timeout_ms: ColumnType<string | null, number | null | undefined, number | null>;
1978
1618
  /**
1979
- * Per-org webhook-ingest concurrency cap; null = cluster default
1980
- * (config.ingestOrgMaxConcurrency / KICI_INGEST_ORG_MAX_CONCURRENCY). Postgres
1981
- * BIGINT — pg returns a string on select; accept a number on insert/update.
1619
+ * Webhook-ingest concurrency cap; null = cluster default
1620
+ * (config.ingestOrgMaxConcurrency / KICI_INGEST_ORG_MAX_CONCURRENCY). BIGINT.
1982
1621
  */
1983
1622
  ingest_max_concurrency: ColumnType<string | null, number | null | undefined, number | null>;
1984
1623
  /**
1985
- * Per-org scaler spawn deadline (ms) for a single `backend.spawn` (image pull
1986
- * + container create + start); null = cluster default
1987
- * (config.scalerSpawnTimeoutMs / KICI_SCALER_SPAWN_TIMEOUT_MS). Postgres
1988
- * BIGINT — pg returns a string on select; accept a number on insert/update.
1624
+ * Deadline (ms) for one `backend.spawn` (image pull + container create + start); null =
1625
+ * cluster default (config.scalerSpawnTimeoutMs / KICI_SCALER_SPAWN_TIMEOUT_MS). BIGINT.
1989
1626
  */
1990
1627
  scaler_spawn_timeout_ms: ColumnType<string | null, number | null | undefined, number | null>;
1991
1628
  /**
1992
- * Per-org reroute spawn window (ms): how long the coordinator waits after a
1993
- * peer ACKs a reroute before treating "accepted but no progress" as a spawn
1994
- * failure and re-dispatching. Null = cluster default (config.rerouteSpawnWindowMs).
1995
- * BIGINT — pg returns a string on select; accept a number on insert/update.
1629
+ * Reroute spawn window (ms): how long after a peer ACKs a reroute the coordinator waits
1630
+ * before treating "accepted but no progress" as a spawn failure and re-dispatching. Null =
1631
+ * cluster default (config.rerouteSpawnWindowMs). BIGINT.
1996
1632
  */
1997
1633
  reroute_spawn_window_ms: ColumnType<string | null, number | null | undefined, number | null>;
1998
1634
  /**
1999
- * Per-org reroute ACK timeout (ms) for the reroute sendAndWaitAck deadline.
2000
- * Null = cluster default (config.rerouteAckTimeoutMs). BIGINT.
1635
+ * Reroute sendAndWaitAck deadline (ms). Null = cluster default (config.rerouteAckTimeoutMs).
1636
+ * BIGINT.
2001
1637
  */
2002
1638
  reroute_ack_timeout_ms: ColumnType<string | null, number | null | undefined, number | null>;
2003
- /**
2004
- * Per-org maximum peer hops for a rerouted job. Null = cluster default
2005
- * (config.rerouteMaxHops). Plain INTEGER — pg returns a number on select.
2006
- */
1639
+ /** Max peer hops for a rerouted job. Null = cluster default (config.rerouteMaxHops). INTEGER. */
2007
1640
  reroute_max_hops: ColumnType<number | null, number | null | undefined, number | null>;
2008
1641
  /**
2009
- * Per-org agent spawns a worker attempts for one rerouted job. Null = cluster
2010
- * default (config.rerouteSpawnMaxAttempts). Plain INTEGER.
1642
+ * Agent spawns a worker attempts for one rerouted job. Null = cluster default
1643
+ * (config.rerouteSpawnMaxAttempts). INTEGER.
2011
1644
  */
2012
1645
  reroute_spawn_max_attempts: ColumnType<number | null, number | null | undefined, number | null>;
2013
1646
  /**
2014
- * Per-org wait (ms) after a failed spawn of a rerouted job. Null = cluster
2015
- * default (config.rerouteSpawnRetryBackoffMs). BIGINT.
1647
+ * Wait (ms) after a failed spawn of a rerouted job. Null = cluster default
1648
+ * (config.rerouteSpawnRetryBackoffMs). BIGINT.
2016
1649
  */
2017
1650
  reroute_spawn_retry_backoff_ms: ColumnType<string | null, number | null | undefined, number | null>;
2018
1651
  /**
2019
- * Per-org staleness threshold (hours) for the DB-backup freshness diagnostic.
2020
- * Null = cluster default (config.backupStalenessWarnHours). Plain INTEGER.
1652
+ * DB-backup freshness diagnostic threshold (hours). Null = cluster default
1653
+ * (config.backupStalenessWarnHours). INTEGER.
2021
1654
  */
2022
1655
  backup_staleness_warn_hours: ColumnType<number | null, number | null | undefined, number | null>;
2023
1656
  /**
2024
- * Per-org dispatch-queue job timeout (ms). A queued job's deadline is
1657
+ * Dispatch-queue job timeout (ms): a queued job's deadline is
2025
1658
  * `job.timeoutMs ?? <this> ?? config.queueTimeoutMs`. Null = cluster default
2026
- * (config.queueTimeoutMs / KICI_QUEUE_TIMEOUT_MS). Postgres BIGINT — pg
2027
- * returns a string on select; accept a number on insert/update.
1659
+ * (config.queueTimeoutMs / KICI_QUEUE_TIMEOUT_MS). BIGINT.
2028
1660
  */
2029
1661
  queue_timeout_ms: ColumnType<string | null, number | null | undefined, number | null>;
2030
1662
  /**
2031
- * Per-org bound (ms) on how long a build job's success waits for the cache
2032
- * publish its agent reported just before it. 0 turns the wait off. Null =
2033
- * cluster default (config.cacheUploadSettleTimeoutMs /
2034
- * KICI_CACHE_UPLOAD_SETTLE_TIMEOUT_MS). Postgres BIGINT — pg returns a string
2035
- * on select; accept a number on insert/update.
1663
+ * Bound (ms) on how long a build job's success waits for the cache publish its agent
1664
+ * reported just before; 0 turns the wait off. Null = cluster default
1665
+ * (config.cacheUploadSettleTimeoutMs / KICI_CACHE_UPLOAD_SETTLE_TIMEOUT_MS). BIGINT.
2036
1666
  */
2037
1667
  cache_upload_settle_timeout_ms: ColumnType<string | null, number | null | undefined, number | null>;
2038
1668
  /**
2039
- * Per-org expiry (seconds) for a held approval element before it is rejected
2040
- * and its run/job/step fails. NOT NULL, default 86400 (one day). An SDK
2041
- * `requireApproval` `timeout` overrides this per element.
1669
+ * Seconds before a held approval element is rejected and its run/job/step fails. NOT NULL,
1670
+ * default 86400 (one day); an SDK `requireApproval` `timeout` overrides it per element.
2042
1671
  */
2043
1672
  approval_expiry_seconds: ColumnType<number, number | undefined, number>;
2044
1673
  /**
2045
- * Whether the user who triggered a run may also approve its held elements.
2046
- * NOT NULL, default true. Operators turn it off to enforce four-eyes review.
1674
+ * Whether a run's triggering user may approve its held elements. NOT NULL, default true;
1675
+ * turn it off to enforce four-eyes review.
2047
1676
  */
2048
1677
  allow_self_approval: ColumnType<boolean, boolean | undefined, boolean>;
2049
1678
  /**
2050
- * Container-sandbox escape-hatch allow-list: the Linux capabilities a workflow
2051
- * may request via the SDK `sandbox: { capabilities }` field. NULL / absent
2052
- * reads as `[]` (deny every capability request). Postgres TEXT[].
1679
+ * Sandbox escape-hatch allow-list: Linux capabilities a workflow may request via SDK
1680
+ * `sandbox: { capabilities }`. NULL reads as `[]` (deny every request). TEXT[].
2053
1681
  */
2054
1682
  sandbox_allowed_capabilities: ColumnType<string[] | null, string[] | null | undefined, string[] | null>;
2055
1683
  /**
2056
- * Container-sandbox escape-hatch allow-list: whether a workflow may request
2057
- * `sandbox: { network: 'host' }`. NULL / absent reads as `false` (deny host
2058
- * networking). Postgres BOOLEAN.
1684
+ * Sandbox escape-hatch: whether a workflow may request `sandbox: { network: 'host' }`. NULL
1685
+ * reads as `false` (deny host networking).
2059
1686
  */
2060
1687
  sandbox_allow_host_network: ColumnType<boolean | null, boolean | null | undefined, boolean | null>;
2061
- /** When this setting was created */
2062
1688
  created_at: Generated<Date>;
2063
- /** When this setting was last updated */
2064
1689
  updated_at: Generated<Date>;
2065
1690
  }
2066
1691
  export type OrgSettings = Selectable<OrgSettingsTable>;
2067
1692
  export type NewOrgSettings = Insertable<OrgSettingsTable>;
2068
1693
  export type OrgSettingsUpdate = Updateable<OrgSettingsTable>;
2069
1694
  /**
2070
- * Org trust policy (org_trust_policy) — the orchestrator's cache of the
2071
- * Platform-owned per-org trust policy delivered on `trust_policy.update`.
2072
- * Distinct from `org_settings`, which holds operator-owned config: the operator
2073
- * tunes org_settings, the Platform owns this. `source` records which of the two
2074
- * wrote the row.
2075
- *
2076
- * The policy column is plain `string`, not the Zod enum that names the known
2077
- * vocabulary — same reasoning as `held_runs.hold_type`: a value written by a
2078
- * newer Platform must still be readable rather than failing the row.
1695
+ * The orchestrator's cache of the Platform-owned per-org trust policy from
1696
+ * `trust_policy.update`; `org_settings` is the operator-owned counterpart. The policy column is
1697
+ * a plain `string`, not the Zod enum, so a value from a newer Platform stays readable (as with
1698
+ * `held_runs.hold_type`).
2079
1699
  */
2080
1700
  export interface OrgTrustPolicyTable {
2081
1701
  /** Customer/org identifier (primary key) */
@@ -2086,26 +1706,19 @@ export interface OrgTrustPolicyTable {
2086
1706
  approval_expiry_seconds: number;
2087
1707
  /** Which side last wrote this row: platform | local */
2088
1708
  source: string;
2089
- /** When this policy was last written */
2090
1709
  updated_at: ColumnType<Date, Date | undefined, Date>;
2091
1710
  }
2092
1711
  export type OrgTrustPolicy = Selectable<OrgTrustPolicyTable>;
2093
1712
  export type NewOrgTrustPolicy = Insertable<OrgTrustPolicyTable>;
2094
1713
  export type OrgTrustPolicyUpdate = Updateable<OrgTrustPolicyTable>;
2095
1714
  /**
2096
- * Org trust directory (org_trust_directory) — the approval directory
2097
- * `/kici approve` resolves a commenter against: identity links, per-member CI
2098
- * trust levels, and team memberships. Sibling of `org_trust_policy`, same
2099
- * ownership shape: wherever a Platform is attached it pushes this next to the
2100
- * policy on `trust_policy.update` and the orchestrator only reads it back, so
2101
- * approvals survive a restart. On an independent orchestrator there is no
2102
- * Platform, so the operator writes it through
2103
- * `kici-admin trust-policy directory-set` instead.
2104
- *
2105
- * The three JSONB columns are `unknown` on the select side because the pg
2106
- * driver hands back whatever JSON the column holds; `TrustDirectoryStore`
2107
- * validates each one against the wire schema before returning it. Inserts are
2108
- * `JSON.stringify`d strings, matching every other JSONB column here.
1715
+ * The approval directory `/kici approve` resolves a commenter against: identity links, per-member
1716
+ * CI trust levels and team memberships. With a Platform attached, it pushes this beside the
1717
+ * policy on `trust_policy.update` and the orchestrator only reads it back, so approvals survive
1718
+ * a restart; an independent orchestrator's operator writes it with
1719
+ * `kici-admin trust-policy directory-set`. JSONB columns select as `unknown` because pg returns
1720
+ * whatever JSON is stored; `TrustDirectoryStore` validates each against the wire schema.
1721
+ * Inserts are `JSON.stringify`d strings.
2109
1722
  */
2110
1723
  export interface OrgTrustDirectoryTable {
2111
1724
  /** Customer/org identifier (primary key) */
@@ -2116,21 +1729,17 @@ export interface OrgTrustDirectoryTable {
2116
1729
  member_ci_trust: ColumnType<unknown, string, string>;
2117
1730
  /** JSONB array of `{ teamName, memberUserIds }` entries */
2118
1731
  team_memberships: ColumnType<unknown, string, string>;
2119
- /** When this directory was last written */
2120
1732
  updated_at: ColumnType<Date, Date | undefined, Date>;
2121
1733
  }
2122
1734
  export type OrgTrustDirectory = Selectable<OrgTrustDirectoryTable>;
2123
1735
  export type NewOrgTrustDirectory = Insertable<OrgTrustDirectoryTable>;
2124
1736
  export type OrgTrustDirectoryUpdate = Updateable<OrgTrustDirectoryTable>;
2125
1737
  /**
2126
- * Org plan headroom (org_plan_headroom) — the orchestrator's cache of the
2127
- * Platform-owned worker ceiling pushed on `plan.headroom`. Single row
2128
- * (id='default'), because the orchestrator serves exactly one org. Same
2129
- * ownership shape as org_trust_policy: the Platform writes it, the orchestrator
2130
- * only reads it back, so it survives a Platform outage + a coordinator restart.
1738
+ * Cache of the Platform-owned worker ceiling pushed on `plan.headroom`. Single row
1739
+ * (id='default'): the orchestrator serves exactly one org. The Platform writes it and the
1740
+ * orchestrator only reads it back, so it survives a Platform outage plus a coordinator restart.
2131
1741
  */
2132
1742
  export interface OrgPlanHeadroomTable {
2133
- /** Single-row sentinel id, always 'default'. */
2134
1743
  id: string;
2135
1744
  /** Absolute ceiling on this coordinator's connected worker peers. */
2136
1745
  max_worker_peers: number;
@@ -2140,23 +1749,18 @@ export interface OrgPlanHeadroomTable {
2140
1749
  org_total: number;
2141
1750
  /** Whether the Platform asked the coordinator to drain its excess workers. */
2142
1751
  evict_excess: boolean;
2143
- /** When this ceiling was last written. */
2144
1752
  updated_at: ColumnType<Date, Date, Date>;
2145
1753
  }
2146
1754
  /**
2147
- * Cluster-global settings (cluster_settings) — a single row (id='default') of
2148
- * fleet-wide operator tunables. Each knob is nullable; NULL = use the cluster
2149
- * default from config.ts. Read via ClusterSettingsReader. Distinct from
2150
- * org_settings (per customer_id) — these knobs have no per-tenant meaning.
2151
- * Byte-valued knobs are Postgres BIGINT (pg returns a string on select); count
2152
- * / seconds knobs are INTEGER (pg returns a number).
1755
+ * Single row (id='default') of fleet-wide operator tunables with no per-tenant meaning, read via
1756
+ * ClusterSettingsReader. Each knob is nullable; NULL = the config.ts default. A BIGINT knob (every
1757
+ * byte-valued knob, and some counts) reads back as a string; an INTEGER knob as a number.
2153
1758
  */
2154
1759
  export interface ClusterSettingsTable {
2155
1760
  /**
2156
- * Database-side retention windows, in days. NULL means the orchestrator's
2157
- * configured default; 0 disables that window. These prune the warm tables
2158
- * directly, for the installs that run no object store — with the cold store
2159
- * on, the archivers keep sole ownership of the tables they register.
1761
+ * Database-side retention windows in days; 0 disables one. They prune the warm tables for
1762
+ * installs with no object store; with the cold store on, the archivers keep sole ownership
1763
+ * of the tables they register.
2160
1764
  */
2161
1765
  run_retention_days: number | null;
2162
1766
  audit_retention_days: number | null;
@@ -2180,125 +1784,107 @@ export interface ClusterSettingsTable {
2180
1784
  event_router_rate_limit_per_workflow_per_minute: ColumnType<number | null, number | null | undefined, number | null>;
2181
1785
  cache_max_tarball_bytes: ColumnType<string | null, number | null | undefined, number | null>;
2182
1786
  cache_ttl_days: ColumnType<number | null, number | null | undefined, number | null>;
2183
- /** LRU entry ceiling for the lock-file cache. NULL ⇒ the configured default. Applies at next restart. */
1787
+ /** LRU entry ceiling for the lock-file cache. Applies at next restart. */
2184
1788
  lockfile_cache_max: ColumnType<string | null, number | null | undefined, number | null>;
2185
- /** Byte ceiling for the lock-file cache. NULL ⇒ the configured default. Applies at next restart. */
1789
+ /** Byte ceiling for the lock-file cache. Applies at next restart. */
2186
1790
  lockfile_cache_max_bytes: ColumnType<string | null, number | null | undefined, number | null>;
2187
- /** Entry TTL (ms) for the lock-file cache. NULL ⇒ the configured default. Applies at next restart. */
1791
+ /** Entry TTL (ms) for the lock-file cache. Applies at next restart. */
2188
1792
  lockfile_cache_ttl_ms: ColumnType<string | null, number | null | undefined, number | null>;
2189
- /** LRU entry ceiling for the Tier-1 content cache. NULL ⇒ the configured default. Applies at next restart. */
1793
+ /** LRU entry ceiling for the Tier-1 content cache. Applies at next restart. */
2190
1794
  content_cache_max: ColumnType<string | null, number | null | undefined, number | null>;
2191
- /** Byte ceiling for the Tier-1 content cache. NULL ⇒ the configured default. Applies at next restart. */
1795
+ /** Byte ceiling for the Tier-1 content cache. Applies at next restart. */
2192
1796
  content_cache_max_bytes: ColumnType<string | null, number | null | undefined, number | null>;
2193
- /** Entry TTL (ms) for the Tier-1 content cache. NULL ⇒ the configured default. Applies at next restart. */
1797
+ /** Entry TTL (ms) for the Tier-1 content cache. Applies at next restart. */
2194
1798
  content_cache_ttl_ms: ColumnType<string | null, number | null | undefined, number | null>;
2195
- /** Wall-clock budget (ms) for a whole Tier-2 global eval round. NULL ⇒ the configured default. Read per round. */
1799
+ /** Wall-clock budget (ms) for a whole Tier-2 global eval round. Read per round. */
2196
1800
  global_eval_round_timeout_ms: ColumnType<string | null, number | null | undefined, number | null>;
2197
- /** Wall-clock budget (ms) for one candidate inside a round. NULL ⇒ the configured default. Read per round. */
1801
+ /** Wall-clock budget (ms) for one candidate inside a round. Read per round. */
2198
1802
  global_eval_candidate_timeout_ms: ColumnType<string | null, number | null | undefined, number | null>;
2199
- /** LRU entry ceiling for the round-result cache. NULL ⇒ the configured default. Applies at next restart. */
1803
+ /** LRU entry ceiling for the round-result cache. Applies at next restart. */
2200
1804
  global_eval_cache_max: ColumnType<string | null, number | null | undefined, number | null>;
2201
1805
  /**
2202
- * Orchestrator-side ceiling (ms) on waiting for one eval round to settle.
2203
- * Distinct from the two budgets above, which the agent enforces on itself: a
2204
- * round that never reaches an agent — or an agent that wedges before its own
2205
- * budget starts — is only bounded here. NULL ⇒ the configured default. Read
2206
- * per round.
1806
+ * Orchestrator-side ceiling (ms) on waiting for one eval round to settle. The round and
1807
+ * candidate budgets are agent-enforced, so a round that never reaches an agent, or an agent
1808
+ * that wedges before its budget starts, is bounded only here. Read per round.
2207
1809
  */
2208
1810
  global_eval_wait_timeout_ms: ColumnType<string | null, number | null | undefined, number | null>;
2209
- /** How long a Firecracker spawn waits for the VM's API socket. NULL: config default. */
1811
+ /** How long a Firecracker spawn waits for the VM's API socket. */
2210
1812
  firecracker_api_socket_wait_ms: ColumnType<string | null, number | null | undefined, number | null>;
2211
1813
  /**
2212
- * Retention window in days for `check_run_tracking` rows. The hourly cleanup
2213
- * sweep deletes rows untouched for longer than this; 0 disables the sweep.
2214
- * NULL ⇒ the orchestrator's configured default.
1814
+ * Retention in days for `check_run_tracking`: the hourly cleanup deletes rows untouched for
1815
+ * longer; 0 disables the sweep.
2215
1816
  */
2216
1817
  check_run_tracking_ttl_days: ColumnType<number | null, number | null | undefined, number | null>;
2217
1818
  /**
2218
- * Grace window (ms) a job may stay continuously unroutable before it is
2219
- * terminalized as `unroutable`. NULL = the orchestrator's configured default;
1819
+ * Grace (ms) a job may stay continuously unroutable before it terminalizes as `unroutable`;
2220
1820
  * 0 disables fast-fail, leaving `queue_timeout_ms` as the only backstop.
2221
1821
  */
2222
1822
  unroutable_grace_ms: ColumnType<number | null, number | null | undefined, number | null>;
2223
1823
  /**
2224
- * Fleet-wide master switch for global workflows. NULL ⇒ the orchestrator's
2225
- * configured default (`KICI_GLOBAL_WORKFLOWS_ENABLED`, default false). Read
2226
- * per policy decision through `ClusterSettingsReader.tryGetBoolean`, which
2227
- * reports an unreadable row separately so the gate can fail closed.
1824
+ * Fleet-wide master switch for global workflows (default `KICI_GLOBAL_WORKFLOWS_ENABLED`,
1825
+ * false). Read per policy decision via `ClusterSettingsReader.tryGetBoolean`, which reports
1826
+ * an unreadable row separately so the gate fails closed.
2228
1827
  */
2229
1828
  global_workflows_enabled: ColumnType<boolean | null, boolean | null | undefined, boolean | null>;
2230
1829
  /**
2231
- * How long a `replaying` claim on `ingest_overflow_buffer` may stand before
2232
- * the drain pass reclaims the row for another worker. NULL ⇒ the
2233
- * orchestrator's configured default. Must exceed the longest a single
2234
- * delivery's pipeline can legitimately run.
1830
+ * How long a `replaying` claim on `ingest_overflow_buffer` stands before the drain pass
1831
+ * reclaims the row. Must exceed the longest legitimate single-delivery pipeline run.
2235
1832
  */
2236
1833
  ingest_overflow_claim_timeout_ms: ColumnType<number | null, number | null | undefined, number | null>;
2237
1834
  concurrency_wait_timeout_ms: ColumnType<string | null, number | null | undefined, number | null>;
2238
1835
  agent_token_ttl_ms: ColumnType<string | null, number | null | undefined, number | null>;
2239
1836
  /**
2240
- * How often the leader sweeps for stranded event-scaler provisions. Re-read
2241
- * at the end of every sweep, so a change reschedules the timer on the next
2242
- * tick rather than waiting for a leadership transition. NULL ⇒ the
2243
- * orchestrator's configured default.
1837
+ * How often the leader sweeps for stranded event-scaler provisions. Re-read after every
1838
+ * sweep, so a change reschedules on the next tick, not at a leadership transition.
2244
1839
  */
2245
1840
  scaler_reap_interval_ms: ColumnType<string | null, number | null | undefined, number | null>;
2246
1841
  /**
2247
- * How long an adopted event-scaler provision whose agent is registered on no
2248
- * coordinator may sit before it is torn down. Set it well above the peer
2249
- * heartbeat period: the "registered nowhere" signal is partly heartbeat
2250
- * derived. NULL ⇒ the orchestrator's configured default. Read per sweep.
1842
+ * How long an adopted event-scaler provision whose agent is registered nowhere may sit
1843
+ * before teardown. Keep it well above the peer heartbeat period: "registered nowhere" is
1844
+ * partly heartbeat-derived. Read per sweep.
2251
1845
  */
2252
1846
  scaler_reap_stranded_timeout_ms: ColumnType<string | null, number | null | undefined, number | null>;
2253
1847
  /**
2254
- * How long before the reaper retries a provision whose previous teardown left
2255
- * the row in place. NULL ⇒ the orchestrator's configured default. Read per
2256
- * sweep.
1848
+ * How long before the reaper retries a provision whose last teardown left the row in place.
1849
+ * Read per sweep.
2257
1850
  */
2258
1851
  scaler_reap_reattempt_interval_ms: ColumnType<string | null, number | null | undefined, number | null>;
2259
1852
  /**
2260
- * How long an expired scaler provisioning claim is kept before the reaper's
2261
- * sweep deletes it. An expired claim can never be redeemed, so this only
2262
- * controls how long a late redeemer is told "expired" rather than "unknown
2263
- * code". NULL ⇒ the orchestrator's configured default. Read per sweep.
1853
+ * How long the reaper keeps an expired provisioning claim. It is never redeemable, so this
1854
+ * only sets how long a late redeemer hears "expired" instead of "unknown code". Read per
1855
+ * sweep.
2264
1856
  */
2265
1857
  scaler_claim_retention_ms: ColumnType<string | null, number | null | undefined, number | null>;
2266
1858
  /**
2267
- * First deferral applied to an external (event) scaler after one consecutive
2268
- * provisioning failure. Each further consecutive failure doubles it, up to
2269
- * `scaler_provision_backoff_max_ms`. NULL ⇒ the orchestrator's configured
2270
- * default. Read per spawn request.
1859
+ * First deferral for an external (event) scaler after one provisioning failure; each further
1860
+ * consecutive failure doubles it, up to `scaler_provision_backoff_max_ms`. Read per spawn
1861
+ * request.
2271
1862
  */
2272
1863
  scaler_provision_backoff_base_ms: ColumnType<string | null, number | null | undefined, number | null>;
2273
1864
  /**
2274
- * Ceiling on the doubling above, so a long provider outage settles into a
2275
- * steady retry cadence instead of growing without bound. NULL ⇒ the
2276
- * orchestrator's configured default. Read per spawn request.
1865
+ * Ceiling on that doubling, so a long provider outage settles into a steady retry cadence.
1866
+ * Read per spawn request.
2277
1867
  */
2278
1868
  scaler_provision_backoff_max_ms: ColumnType<string | null, number | null | undefined, number | null>;
2279
1869
  /**
2280
- * How many consecutive provisioning failures a scaler may record before its
2281
- * refusals name repeated failure as the cause rather than a single timeout.
2282
- * NULL ⇒ the orchestrator's configured default. Read per spawn request.
1870
+ * Consecutive provisioning failures before a scaler's refusals name repeated failure, not a
1871
+ * single timeout, as the cause. Read per spawn request.
2283
1872
  */
2284
1873
  scaler_provision_max_consecutive_failures: ColumnType<string | null, number | null | undefined, number | null>;
2285
1874
  /**
2286
- * Deadline for one database-backed agent-ownership lookup. Past it the lookup
2287
- * resolves as undecided and the frame is refused without counting a
2288
- * violation. NULL ⇒ the orchestrator's configured default.
1875
+ * Deadline for one DB-backed agent-ownership lookup; past it the lookup is undecided and the
1876
+ * frame is refused without counting a violation.
2289
1877
  */
2290
1878
  ownership_db_check_timeout_ms: ColumnType<string | null, number | null | undefined, number | null>;
2291
1879
  /**
2292
- * How long a coordinator leaves a queued job alone after it could not open the
2293
- * job's sealed secrets, before claiming it again. NULL ⇒ the orchestrator's
2294
- * configured default.
1880
+ * How long a coordinator leaves a queued job alone after failing to open its sealed secrets
1881
+ * before claiming it again.
2295
1882
  */
2296
1883
  sealed_secrets_retry_backoff_ms: ColumnType<string | null, number | null | undefined, number | null>;
2297
1884
  /**
2298
- * Verified-tier origin the dashboard fetches the orchestrator's X25519
2299
- * dashboard-encryption public key from (and always displays) under the
2300
- * `encrypted` dashboard-write posture. The tier is explicit opt-in: NULL ⇒ it
2301
- * is not offered and the convenient tier is used.
1885
+ * Verified-tier origin the dashboard fetches (and always displays) the orchestrator's X25519
1886
+ * dashboard-encryption public key from, under the `encrypted` write posture. Explicit opt-in:
1887
+ * NULL means the tier is not offered and the convenient tier is used.
2302
1888
  */
2303
1889
  dashboard_verified_issuer: ColumnType<string | null, string | null | undefined, string | null>;
2304
1890
  /** Monotonic settings version; bumped on each real settings change, advertised to workers. */
@@ -2310,81 +1896,55 @@ export type ClusterSettings = Selectable<ClusterSettingsTable>;
2310
1896
  export type NewClusterSettings = Insertable<ClusterSettingsTable>;
2311
1897
  export type ClusterSettingsUpdate = Updateable<ClusterSettingsTable>;
2312
1898
  /**
2313
- * Pending job contexts table
2314
- * Persists PendingJobContext for crash-recovery of needs-gated jobs.
2315
- * Keyed by (run_id, job_name) matching the in-memory Map key format.
2316
- * Rows are created at storePendingJobContext time, deleted on consume or run completion.
1899
+ * Persisted PendingJobContext for crash recovery of needs-gated jobs, keyed by (run_id,
1900
+ * job_name) like the in-memory Map. Created by storePendingJobContext, deleted on consume or
1901
+ * run completion.
2317
1902
  */
2318
1903
  export interface PendingJobContextsTable {
2319
- /** Run identifier */
2320
1904
  run_id: string;
2321
- /** Job name within the workflow */
2322
1905
  job_name: string;
2323
1906
  /** Full QueuedJobInput serialized as JSONB */
2324
1907
  job_input: ColumnType<Record<string, unknown>, string, string>;
2325
1908
  /** string[] of labels serialized as JSONB */
2326
1909
  runs_on_labels: ColumnType<string[], string, string>;
2327
1910
  /**
2328
- * For an invoke-gate job, its invoke parameters (event, payload, optional,
2329
- * maxParallel, failFast) serialized as JSON. Non-null marks this pending
2330
- * context as a gate: when released it summons the source repo's subscribers
2331
- * instead of dispatching to an agent. NULL for every ordinary job.
1911
+ * An invoke-gate job's parameters (event, payload, optional, maxParallel, failFast) as JSON.
1912
+ * Non-null marks a gate: on release it summons the source repo's subscribers instead of
1913
+ * dispatching to an agent. NULL for every ordinary job.
2332
1914
  */
2333
1915
  invoke_config: ColumnType<string | null, string | null | undefined, string | null>;
2334
1916
  /**
2335
- * For a job bound to a context, what the dispatch of the stored job resolves
2336
- * the job's context variables and secrets from (context names, org, routing
2337
- * key, host facts, registry-auth inputs) as JSONB. Never a secret value. NULL
2338
- * for a job with no bound context, and for a row stored before the column
2339
- * existed, whose `job_input` still carries its resolved context data.
1917
+ * JSONB inputs the stored job's dispatch resolves context variables and secrets from (context
1918
+ * names, org, routing key, host facts, registry-auth inputs); never a secret value. NULL for a
1919
+ * job with no bound context and for a pre-column row, whose `job_input` carries the resolved
1920
+ * context data.
2340
1921
  */
2341
1922
  context_resolution: ColumnType<DeferredContextResolution | null, string | null | undefined, string | null>;
2342
- /**
2343
- * The secret fields of the stored job, AES-256-GCM encrypted under the
2344
- * orchestrator master key (`secrets/job-secret-seal.ts`). NULL when there is
2345
- * nothing to seal, when no master key is configured, and on a row written
2346
- * before the column existed: those rows keep the fields in the plain column.
2347
- */
1923
+ /** Sealed secret fields; same contract as `dispatch_queue.sealed_secrets`. */
2348
1924
  sealed_secrets: ColumnType<string | null, string | null | undefined, string | null>;
2349
- /** When this context was stored */
2350
1925
  created_at: Generated<Date>;
2351
1926
  }
2352
1927
  export type PendingJobContextRow = Selectable<PendingJobContextsTable>;
2353
1928
  export type NewPendingJobContext = Insertable<PendingJobContextsTable>;
2354
1929
  /**
2355
- * Pending workflow dispatch contexts table.
2356
- * Persists the serializable WorkflowDispatchContext inputs needed to resume a
2357
- * workflow whose install gate held. One row per held run (keyed by run_id).
2358
- * Created at hold time, deleted once the resume dispatch is kicked off.
1930
+ * Serializable WorkflowDispatchContext inputs to resume a workflow whose install gate held. One
1931
+ * row per held run, created at hold time and deleted once the resume dispatch starts.
2359
1932
  */
2360
1933
  export interface PendingWorkflowContextsTable {
2361
- /** Run identifier (one pending dispatch per run) */
2362
1934
  run_id: string;
2363
- /** Organization id */
2364
1935
  org_id: string;
2365
1936
  /** Serializable WorkflowDispatchContext inputs as JSONB */
2366
1937
  context: ColumnType<Record<string, unknown>, string, string>;
2367
- /**
2368
- * The secret fields of the stored job, AES-256-GCM encrypted under the
2369
- * orchestrator master key (`secrets/job-secret-seal.ts`). NULL when there is
2370
- * nothing to seal, when no master key is configured, and on a row written
2371
- * before the column existed: those rows keep the fields in the plain column.
2372
- */
1938
+ /** Sealed secret fields; same contract as `dispatch_queue.sealed_secrets`. */
2373
1939
  sealed_secrets: ColumnType<string | null, string | null | undefined, string | null>;
2374
- /** When this context was stored */
2375
1940
  created_at: Generated<Date>;
2376
1941
  }
2377
1942
  export type PendingWorkflowContextRow = Selectable<PendingWorkflowContextsTable>;
2378
1943
  export type NewPendingWorkflowContext = Insertable<PendingWorkflowContextsTable>;
2379
1944
  /**
2380
- * Inbound webhook delivery event log table.
2381
- * One row per inbound webhook delivery (relay or direct), regardless of
2382
- * outcome. Joins with the Platform-side `event_log` on `(org_id, delivery_id)`.
2383
- *
2384
- * Payload bytes live in object storage (LogStorage) at `payload_key`. When
2385
- * `payload_omitted=true`, the payload was not stored (size cap or upload
2386
- * failure) -- the metadata + hash + size are still durable for correlation.
2387
- *
1945
+ * One row per inbound webhook delivery (relay or direct), whatever the outcome; joins the
1946
+ * Platform-side `event_log` on `(org_id, delivery_id)`. Payload bytes live in LogStorage at
1947
+ * `payload_key`; an omitted payload still keeps metadata, hash and size for correlation.
2388
1948
  * Retention: 30 days, cleaned by queue/cleanup.ts.
2389
1949
  */
2390
1950
  export interface EventLogTable {
@@ -2426,7 +1986,6 @@ export interface EventLogTable {
2426
1986
  run_id: string | null;
2427
1987
  /** Failure reason when status='failed' */
2428
1988
  error_message: string | null;
2429
- /** When the delivery was received */
2430
1989
  received_at: Generated<Date>;
2431
1990
  /** Cold-store: set inside the archive transaction; NULL for hot rows. */
2432
1991
  archived_at: Date | null;
@@ -2437,11 +1996,9 @@ export type EventLogRow = Selectable<EventLogTable>;
2437
1996
  export type NewEventLogRow = Insertable<EventLogTable>;
2438
1997
  export type EventLogRowUpdate = Updateable<EventLogTable>;
2439
1998
  /**
2440
- * Cold-store chunk counts table (cold_store_chunk_counts).
2441
- * Tracks per-(db, table, tenant) archived-chunk metadata so the
2442
- * `cold_store_chunks_total` gauge and the `kici-admin cold-store list-chunks`
2443
- * CLI can report totals without S3 LIST calls. The cold-store archiver
2444
- * populates it transactionally on each chunk write.
1999
+ * Per-(db, table, tenant) archived-chunk totals, so the `cold_store_chunks_total` gauge and
2000
+ * `kici-admin cold-store list-chunks` need no S3 LIST. The archiver updates it transactionally
2001
+ * on each chunk write.
2445
2002
  */
2446
2003
  export interface ColdStoreChunkCountsTable {
2447
2004
  /** DbKind identifier ('orchestrator' on this side). */
@@ -2463,13 +2020,9 @@ export type ColdStoreChunkCountsRow = Selectable<ColdStoreChunkCountsTable>;
2463
2020
  export type NewColdStoreChunkCountsRow = Insertable<ColdStoreChunkCountsTable>;
2464
2021
  export type ColdStoreChunkCountsUpdate = Updateable<ColdStoreChunkCountsTable>;
2465
2022
  /**
2466
- * Cold-store chunk index (cold_store_chunks).
2467
- *
2468
- * One row per archived chunk that the GC sweep can later purge from S3.
2469
- * Inserted inside `markArchivedAndDelete`'s transaction by adapters that
2470
- * opt into the per-bucket layout via `coldTtlDays(row)`. V1
2471
- * chunks are NOT in this table — they're treated as
2472
- * `'forever'` and never purged.
2023
+ * One row per archived chunk the GC sweep can later purge from S3, inserted in
2024
+ * `markArchivedAndDelete`'s transaction by adapters that opt into the per-bucket layout via
2025
+ * `coldTtlDays(row)`. V1 chunks are NOT here: they count as `'forever'` and are never purged.
2473
2026
  */
2474
2027
  export interface ColdStoreChunksTable {
2475
2028
  /** DbKind identifier ('orchestrator' on this side). */
@@ -2488,13 +2041,11 @@ export interface ColdStoreChunksTable {
2488
2041
  archived_at: Generated<Date>;
2489
2042
  /** Compressed size of the data chunk (bytes). */
2490
2043
  gzip_bytes: ColumnType<string, string | number, string | number>;
2491
- /** Number of rows in the chunk. */
2492
2044
  row_count: ColumnType<string, string | number, string | number>;
2493
2045
  /**
2494
- * Row-level cold-retention horizon — TEXT to accommodate both numeric
2495
- * day-counts and the literal `'forever'`. The GC sweep checks
2496
- * `max_cold_days != 'forever' AND now() > archived_at + max_cold_days
2497
- * * INTERVAL '1 day'`.
2046
+ * Row-level cold-retention horizon: TEXT holding a day count or the literal `'forever'`. The
2047
+ * GC sweep checks
2048
+ * `max_cold_days != 'forever' AND now() > archived_at + max_cold_days * INTERVAL '1 day'`.
2498
2049
  */
2499
2050
  max_cold_days: string;
2500
2051
  /** Full S3 key of the data chunk (used by the GC sweep's DeleteObject). */
@@ -2504,88 +2055,66 @@ export type ColdStoreChunksRow = Selectable<ColdStoreChunksTable>;
2504
2055
  export type NewColdStoreChunksRow = Insertable<ColdStoreChunksTable>;
2505
2056
  export type ColdStoreChunksUpdate = Updateable<ColdStoreChunksTable>;
2506
2057
  /**
2507
- * Check-run tracking table (check_run_tracking).
2508
- *
2509
- * HA-safe persistence for the per-coord state previously held in
2510
- * `CheckRunReporter`'s six in-memory `Map`s. Replacement coord on a
2511
- * Raft leader switch reads this table to recover check-run IDs, build
2512
- * creation state, step-progress entries, in-progress-sent timestamps, and
2513
- * the run-id reverse index used for cleanup. A coord crash mid-check-run
2514
- * no longer leaves a GitHub check stuck in `queued` forever.
2058
+ * HA-safe `CheckRunReporter` state: a replacement coord after a Raft leader switch recovers
2059
+ * check-run IDs, build creation state, step progress, in-progress-sent timestamps and the run-id
2060
+ * cleanup index from here, so a coord crash mid-check-run cannot leave a GitHub check stuck in
2061
+ * `queued`.
2515
2062
  */
2516
2063
  export interface CheckRunTrackingTable {
2517
2064
  /** Provider type (e.g. 'github'). */
2518
2065
  provider: string;
2519
2066
  /** Repo owner / namespace. */
2520
2067
  owner: string;
2521
- /** Repo name. */
2522
2068
  repo: string;
2523
2069
  /** Git commit SHA the check run is anchored to. */
2524
2070
  sha: string;
2525
2071
  /** Check-run name (e.g. 'kici/build', 'kici/build/job/test', 'kici/build/setup'). */
2526
2072
  check_name: string;
2527
2073
  /**
2528
- * GitHub Checks API check-run ID. Populated by `checks.create()`; nullable
2529
- * during the in-flight build-creation window (`build_creation_state =
2530
- * 'pending'` before the create finishes).
2074
+ * GitHub Checks API check-run ID from `checks.create()`; null while the build create is in
2075
+ * flight (`build_creation_state = 'pending'`).
2531
2076
  */
2532
2077
  check_run_id: ColumnType<number | null, number | null | undefined, number | null>;
2533
2078
  /**
2534
- * Build check-run creation state: 'pending' while a `setBuildPending`
2535
- * create is in flight, 'completed' once `setBuildComplete` has reconciled.
2536
- * Replaces the in-memory `pendingBuildCreations` Promise map.
2079
+ * Build check-run creation state: 'pending' while a `setBuildPending` create is in flight,
2080
+ * 'completed' once `setBuildComplete` has reconciled.
2537
2081
  */
2538
2082
  build_creation_state: ColumnType<string | null, string | null | undefined, string | null>;
2539
2083
  /**
2540
- * Step-progress entries as JSONB array. Each entry shape is
2541
- * `{ name: string, status: string, durationMs?: number }`. Replaces the
2542
- * in-memory `stepProgress` map.
2084
+ * JSONB array of `{ name: string, status: string, durationMs?: number }` step-progress entries.
2543
2085
  */
2544
2086
  step_progress_json: ColumnType<unknown, string | unknown, string | unknown>;
2545
2087
  /**
2546
- * Timestamp the first in-progress transition was sent to GitHub. NULL
2547
- * before the first running step. Replaces the in-memory `inProgressSent`
2548
- * boolean map (presence-as-truth).
2088
+ * When the first in-progress transition was sent to GitHub; NULL before the first running
2089
+ * step. Presence is the truth value.
2549
2090
  */
2550
2091
  in_progress_sent_at: ColumnType<Date | null, Date | null | undefined, Date | null>;
2551
2092
  /**
2552
- * When the terminal (`completed`) check-run update was accepted by the
2553
- * provider. NULL means we have no record of sending it — either it never
2554
- * happened, or the best-effort write failed. Never treat NULL as proof the
2555
- * update failed.
2556
- *
2557
- * `check_run_id` is written at create time, while the check run is still
2558
- * `queued`, so it proves creation and never completion. This column is the
2559
- * completion signal.
2093
+ * When the provider accepted the terminal (`completed`) update: the completion signal, since
2094
+ * `check_run_id` is written while still `queued` and proves only creation. NULL means no
2095
+ * record of sending (never sent, or the best-effort write failed), never proof it failed.
2560
2096
  */
2561
2097
  terminal_sent_at: ColumnType<Date | null, Date | null | undefined, Date | null>;
2562
2098
  /**
2563
- * KiCI run identifier this check-run belongs to, written at create time.
2564
- * Indexed (partial, NOT NULL) so a per-run lookup never scans the table.
2565
- * It is an attribution key, not a retention key — rows are reclaimed by
2566
- * the `updated_at`-age sweep, which deliberately ignores this column.
2099
+ * Owning KiCI run, written at create time; partial NOT NULL index so a per-run lookup never
2100
+ * scans. An attribution key, not a retention key: the `updated_at`-age sweep reclaims rows and
2101
+ * deliberately ignores it.
2567
2102
  */
2568
2103
  run_id: ColumnType<string | null, string | null | undefined, string | null>;
2569
- /** When this row was first inserted. */
2570
2104
  created_at: Generated<Date>;
2571
- /** When this row was last updated. */
2572
2105
  updated_at: Generated<Date>;
2573
2106
  }
2574
2107
  export type CheckRunTrackingRow = Selectable<CheckRunTrackingTable>;
2575
2108
  export type NewCheckRunTrackingRow = Insertable<CheckRunTrackingTable>;
2576
2109
  export type CheckRunTrackingUpdate = Updateable<CheckRunTrackingTable>;
2577
2110
  /**
2578
- * Build-provenance attestation table.
2579
- *
2580
- * One row per `ctx.attestProvenance` bundle uploaded to object storage. The
2581
- * dashboard lists/fetches attestations by `(run_id, job_id)`.
2111
+ * One row per `ctx.attestProvenance` bundle in object storage; the dashboard lists and fetches
2112
+ * them by `(run_id, job_id)`.
2582
2113
  */
2583
2114
  export interface AttestationsTable {
2584
2115
  /** Random id (primary key). */
2585
2116
  id: string;
2586
- /** KiCI run this attestation belongs to. */
2587
2117
  run_id: string;
2588
- /** KiCI job this attestation was produced by. */
2589
2118
  job_id: string;
2590
2119
  /** Caller-supplied artifact name (e.g. an npm package coordinate). */
2591
2120
  subject_name: string;
@@ -2595,14 +2124,11 @@ export interface AttestationsTable {
2595
2124
  storage_key: string;
2596
2125
  /** Signing mode ('kici' for Mode A). */
2597
2126
  mode: string;
2598
- /** Bundle media type. */
2599
2127
  media_type: string;
2600
- /** When this row was inserted. */
2601
2128
  created_at: Generated<Date>;
2602
2129
  /**
2603
- * Server-side verification verdict computed at ingest. One of
2604
- * `verified` / `failed` / `unverifiable` / `pending`
2605
- * (`attestationVerifyStatusSchema.enum.*`). DB default is `pending`.
2130
+ * Ingest-time server-side verdict: `verified` / `failed` / `unverifiable` / `pending`
2131
+ * (`attestationVerifyStatusSchema.enum.*`); DB default `pending`.
2606
2132
  */
2607
2133
  verify_status: Generated<string>;
2608
2134
  /** First failure code from `verifyKiciBundle`, or NULL when verified/pending. */
@@ -2645,10 +2171,9 @@ export interface OrchestratorSigningKeysTable {
2645
2171
  export type OrchestratorSigningKeyRow = Selectable<OrchestratorSigningKeysTable>;
2646
2172
  export type NewOrchestratorSigningKeyRow = Insertable<OrchestratorSigningKeysTable>;
2647
2173
  /**
2648
- * The orchestrator's X25519 dashboard-encryption keys — the trust root for
2649
- * browser-sealed dashboard writes under the `encrypted` posture. One `active`
2650
- * key seals; rotated-out keys go `revoked` and leave the published JWKS, while
2651
- * their rows stay so envelopes already sealed to the old `kid` still decrypt.
2174
+ * X25519 dashboard-encryption keys: the trust root for browser-sealed dashboard writes under
2175
+ * the `encrypted` posture. One `active` key seals; rotated-out keys go `revoked` and leave the
2176
+ * published JWKS, but their rows stay so envelopes sealed to an old `kid` still decrypt.
2652
2177
  */
2653
2178
  export interface DashboardEncryptionKeysTable {
2654
2179
  /** RFC 7638 thumbprint of the public JWK (primary key, also the `kid`). */
@@ -2669,22 +2194,17 @@ export interface DashboardEncryptionKeysTable {
2669
2194
  export type DashboardEncryptionKeyRow = Selectable<DashboardEncryptionKeysTable>;
2670
2195
  export type NewDashboardEncryptionKeyRow = Insertable<DashboardEncryptionKeysTable>;
2671
2196
  /**
2672
- * A user-facing build artifact (`ctx.artifacts.upload`). Named + immutable per
2673
- * run: `UNIQUE (run_id, name)` enforces the first-upload-wins semantics at the
2674
- * DB layer. `customer_id` scopes the row to an org for quota accounting; the
2675
- * tarball lives at `storage_key` (`artifacts/{run_id}/{name}-{discriminator}.tar.gz`,
2676
- * where the discriminator is a hash of the exact name). Reads go through the
2677
- * stored key rather than re-deriving it, so a row written under an earlier key
2678
- * format resolves unchanged.
2197
+ * A user-facing build artifact (`ctx.artifacts.upload`), named and immutable per run:
2198
+ * `UNIQUE (run_id, name)` enforces first-upload-wins. The tarball lives at `storage_key`
2199
+ * (`artifacts/{run_id}/{name}-{discriminator}.tar.gz`, discriminator = a hash of the exact
2200
+ * name); reads use the stored key, never re-derive it, so older key formats resolve unchanged.
2679
2201
  */
2680
2202
  export interface ArtifactsTable {
2681
2203
  /** Random id (primary key). */
2682
2204
  id: string;
2683
2205
  /** Owning customer/org id (quota-accounting scope). */
2684
2206
  customer_id: string;
2685
- /** KiCI run this artifact belongs to. */
2686
2207
  run_id: string;
2687
- /** KiCI job that produced this artifact. */
2688
2208
  job_id: string;
2689
2209
  /** Caller-supplied artifact name (unique within the run). */
2690
2210
  name: string;
@@ -2694,7 +2214,6 @@ export interface ArtifactsTable {
2694
2214
  sha256: string;
2695
2215
  /** Object-storage key the tarball was written to. */
2696
2216
  storage_key: string;
2697
- /** When this row was inserted. */
2698
2217
  created_at: Generated<Date>;
2699
2218
  }
2700
2219
  export type ArtifactRow = Selectable<ArtifactsTable>;
@@ -2707,9 +2226,7 @@ export type NewArtifactRow = Insertable<ArtifactsTable>;
2707
2226
  export interface PendingAttestationsTable {
2708
2227
  /** Random id (primary key). */
2709
2228
  id: string;
2710
- /** KiCI run this deferred attestation belongs to. */
2711
2229
  run_id: string;
2712
- /** KiCI job this deferred attestation was produced by. */
2713
2230
  job_id: string;
2714
2231
  /** Caller-supplied artifact name. */
2715
2232
  subject_name: string;
@@ -2721,19 +2238,15 @@ export interface PendingAttestationsTable {
2721
2238
  dsse_envelope: unknown;
2722
2239
  /** The ephemeral public-key JWK (JSONB). */
2723
2240
  public_key: unknown;
2724
- /** Bundle media type. */
2725
2241
  media_type: string;
2726
2242
  /** SHA-256 of the frozen statement payload — the later-mint binding. */
2727
2243
  statement_hash: string;
2728
2244
  /** Non-`live` AttestationOrigin: `deferred` | `offline-backfill`. */
2729
2245
  origin_kind: string;
2730
- /** Retry attempts so far. */
2731
2246
  attempt_count: Generated<number>;
2732
2247
  /** First-capture time = the true build-time anchor. */
2733
2248
  created_at: Generated<Date>;
2734
- /** When fulfilment was last attempted. */
2735
2249
  last_attempt_at: Date | null;
2736
- /** Last fulfilment error, or NULL. */
2737
2250
  last_error: string | null;
2738
2251
  /**
2739
2252
  * Terminal-rejection time: the Platform definitively rejected the mint
@@ -2744,12 +2257,9 @@ export interface PendingAttestationsTable {
2744
2257
  export type PendingAttestationRow = Selectable<PendingAttestationsTable>;
2745
2258
  export type NewPendingAttestationRow = Insertable<PendingAttestationsTable>;
2746
2259
  /**
2747
- * Remote-source table (remote_sources).
2748
- *
2749
- * Anchors a Platform-relayed `kici run remote` to its real org: routing key
2750
- * `remote:<orgId>` maps to the canonical org id so `resolveOrgId` resolves the
2751
- * real tenant through the same local-source path a webhook takes. One row per
2752
- * org served by this orchestrator, auto-provisioned on Platform auth.
2260
+ * Anchors a Platform-relayed `kici run remote` to its org: routing key `remote:<orgId>` maps to
2261
+ * the canonical org id, so `resolveOrgId` takes the same local-source path as a webhook. One
2262
+ * row per served org, auto-provisioned on Platform auth.
2753
2263
  */
2754
2264
  export interface RemoteSourcesTable {
2755
2265
  /** Canonical org id (`org_<…>`) this anchor resolves to. */
@@ -2758,22 +2268,15 @@ export interface RemoteSourcesTable {
2758
2268
  routing_key: string;
2759
2269
  /** Cluster id this orchestrator deployment reports, or null. */
2760
2270
  cluster_id: string | null;
2761
- /** When this row was first provisioned. */
2762
2271
  created_at: Generated<Date>;
2763
- /** When this row was last upserted. */
2764
2272
  updated_at: Generated<Date>;
2765
2273
  }
2766
2274
  export type RemoteSourceRow = Selectable<RemoteSourcesTable>;
2767
2275
  export type NewRemoteSourceRow = Insertable<RemoteSourcesTable>;
2768
2276
  /**
2769
- * Host roster table (host_roster).
2770
- *
2771
- * KiCI's declared inventory: one durable row per agent the cluster has ever
2772
- * enrolled, reconciled from the in-memory AgentRegistry on register/unregister.
2773
- * `lifecycle_class` (snapshot of the auth token's `agent_type`) drives reaping;
2774
- * `connected_instance_id` records which orchestrator holds the live WS (cluster
2775
- * liveness + the host-fanout reroute target), null when disconnected. Status is
2776
- * derived at read from the shared `last_seen` + `connected_instance_id`.
2277
+ * KiCI's declared inventory: one durable row per agent ever enrolled, reconciled from the
2278
+ * AgentRegistry on register/unregister. `lifecycle_class` drives reaping; status is derived at
2279
+ * read from the shared `last_seen` + `connected_instance_id`.
2777
2280
  */
2778
2281
  export interface HostRosterTable {
2779
2282
  /** UUID primary key */
@@ -2785,14 +2288,10 @@ export interface HostRosterTable {
2785
2288
  /** Snapshot of the token's agent_type: 'static' | 'ephemeral'. */
2786
2289
  lifecycle_class: string;
2787
2290
  /**
2788
- * True when an auto-scaler backend spawned this agent. Written from the
2789
- * scaler manager's registration lookup (a spawn record exists for the agent
2790
- * id), NOT from `lifecycle_class` — that column snapshots the auth TOKEN's
2791
- * type and reads `ephemeral` for every agent when the auth mode is `none`.
2792
- *
2793
- * `runsOnAll` fan-out targets declared fleet members, so a true here keeps
2794
- * the host out of the fan-out set. Defaults false, so a row predating the
2795
- * column stays a fan-out target without re-registering.
2291
+ * True when an auto-scaler backend spawned this agent, per the scaler manager's spawn record;
2292
+ * NOT from `lifecycle_class`, which reads `ephemeral` for every agent under auth mode `none`.
2293
+ * True keeps the host out of `runsOnAll` fan-out (declared fleet members only). Default false
2294
+ * keeps pre-column rows fan-out targets without re-registering.
2796
2295
  */
2797
2296
  scaler_managed: ColumnType<boolean, boolean | undefined, boolean>;
2798
2297
  /** JSON-encoded string[] of the post-Gate-1 validated labels. */
@@ -2800,28 +2299,27 @@ export interface HostRosterTable {
2800
2299
  hostname: string | null;
2801
2300
  platform: string | null;
2802
2301
  arch: string | null;
2803
- /** Which orchestrator instance holds the live WS; null = disconnected. */
2302
+ /**
2303
+ * Which orchestrator holds the live WS (cluster liveness and the host-fanout reroute target);
2304
+ * null = disconnected.
2305
+ */
2804
2306
  connected_instance_id: string | null;
2805
2307
  /**
2806
- * Typed host-vars dimension (jsonb). A `{ [key]: string | number | boolean }`
2807
- * bag reported by the agent at registration and/or declared by the operator
2808
- * (`kici-admin host declare --prop`), shallow-merged on upsert. NOT NULL,
2809
- * defaults to `{}`. pg returns the parsed object on select; accept a
2810
- * JSON-stringified value on insert/update.
2308
+ * Typed host-vars jsonb bag, reported by the agent at registration and/or declared by the
2309
+ * operator (`kici-admin host declare --prop`), shallow-merged on upsert. NOT NULL, default
2310
+ * `{}`.
2811
2311
  */
2812
2312
  host_properties: ColumnType<Record<string, string | number | boolean>, Record<string, string | number | boolean> | string | undefined, Record<string, string | number | boolean> | string>;
2813
2313
  last_seen: ColumnType<Date, Date | string | undefined, Date | string>;
2814
2314
  /**
2815
- * Reboot-pending flag for workflow-level host restart. When set to a future
2816
- * timestamp, the host's imminent disconnect is an expected reboot (not a
2817
- * recovery-fail) and its pinned post-restart job is held until the host
2315
+ * Workflow-level host restart: a future timestamp marks the imminent disconnect as an
2316
+ * expected reboot (not a recovery-fail) and holds the pinned post-restart job until the host
2818
2317
  * reconnects (down-then-up). NULL = no reboot pending.
2819
2318
  */
2820
2319
  reboot_pending_until: ColumnType<Date | null, Date | string | null, Date | string | null>;
2821
2320
  /**
2822
- * Pre-agent reach metadata: how to SSH to a declared host before it has a
2823
- * KiCI agent, for bootstrap bring-up. All nullable — a host with no reach
2824
- * metadata cannot be bootstrapped and behaves exactly as before.
2321
+ * Pre-agent SSH reach metadata for bootstrap bring-up of a declared host. All nullable: a
2322
+ * host without it cannot be bootstrapped and is otherwise unaffected.
2825
2323
  */
2826
2324
  address: ColumnType<string | null, string | null | undefined, string | null>;
2827
2325
  ssh_user: ColumnType<string | null, string | null | undefined, string | null>;
@@ -2829,9 +2327,8 @@ export interface HostRosterTable {
2829
2327
  /** Scoped-secret ref (`scope/key`) holding the bring-up private key. */
2830
2328
  ssh_key_secret: ColumnType<string | null, string | null | undefined, string | null>;
2831
2329
  /**
2832
- * Delivery hint: when true, the box can reach the orchestrator's object
2833
- * storage, so bring-up picks `s3-direct` (the box pulls the payload via a
2834
- * presigned URL). NULL / false ⇒ the conservative `ssh-push` fallback.
2330
+ * True when the box reaches the orchestrator's object storage, so bring-up picks `s3-direct`
2331
+ * (the box pulls the payload via a presigned URL). NULL / false ⇒ the `ssh-push` fallback.
2835
2332
  */
2836
2333
  s3_reachable: ColumnType<boolean | null, boolean | null | undefined, boolean | null>;
2837
2334
  /** Who last set the host's identity. See {@link HostIdentitySource}. */
@@ -2843,19 +2340,13 @@ export type HostRosterRow = Selectable<HostRosterTable>;
2843
2340
  export type NewHostRosterRow = Insertable<HostRosterTable>;
2844
2341
  export type HostRosterUpdate = Updateable<HostRosterTable>;
2845
2342
  /**
2846
- * Scaler spawning-agents table (scaler_spawning_agents).
2847
- *
2848
- * One row per agent that has been spawned via a scaler backend
2849
- * (container / bare-metal / firecracker / event) but has not yet registered
2850
- * via WS. Persists `bound_job_id` so a replacement coord still issues the
2851
- * eager-dispatch hop when the agent eventually registers, and `run_id`
2852
- * alongside it so a coordinator that never spawned the agent — the
2853
- * leader-gated reaper routinely is not the spawner — can still attribute a
2854
- * provisioning failure back to the job waiting on it. Reaped per
2855
- * instance and adoption-aware: `listReapCandidates` narrows to event rows that
2856
- * are either adopted or past their spawn deadline, and the reaper tears each
2857
- * one down with `deleteSpawningAgent` — an adopted event agent legitimately
2858
- * outlives the spawn timeout, so no blanket age-based sweep may drop it.
2343
+ * One row per agent spawned via a scaler backend but not yet registered via WS. `bound_job_id`
2344
+ * lets a replacement coord still issue the eager-dispatch hop on registration; `run_id` lets a
2345
+ * non-spawning coordinator (the leader-gated reaper usually is one) attribute a provisioning
2346
+ * failure to the waiting job. Reaping is per instance and adoption-aware:
2347
+ * `listReapCandidates` narrows to event rows that are adopted or past their spawn deadline,
2348
+ * torn down via `deleteSpawningAgent`. An adopted event agent legitimately outlives the spawn
2349
+ * timeout, so no blanket age-based sweep may drop it.
2859
2350
  */
2860
2351
  export interface ScalerSpawningAgentsTable {
2861
2352
  agent_id: string;
@@ -2866,8 +2357,8 @@ export interface ScalerSpawningAgentsTable {
2866
2357
  bound_job_id: ColumnType<string | null, string | null | undefined, string | null>;
2867
2358
  spawned_at: Generated<Date>;
2868
2359
  /**
2869
- * The coordinator instance that spawned this agent. Scopes recovery and the
2870
- * per-instance reaper. NULL reads as "unknown owner" — never as "not mine".
2360
+ * The spawning coordinator; scopes recovery and the per-instance reaper. NULL reads as
2361
+ * "unknown owner", never "not mine".
2871
2362
  */
2872
2363
  owner_instance_id: ColumnType<string | null, string | null | undefined, string | null>;
2873
2364
  /** The coordinator the agent actually reached when it registered. */
@@ -2875,8 +2366,8 @@ export interface ScalerSpawningAgentsTable {
2875
2366
  /** When the adopting coordinator claimed the agent. */
2876
2367
  adopted_at: ColumnType<Date | null, Date | null | undefined, Date | null>;
2877
2368
  /**
2878
- * The scaler's mandatory labels, copied onto the row so a coordinator with no
2879
- * matching scaler entry can still stamp the taint and emit the teardown.
2369
+ * The scaler's mandatory labels, copied so a coordinator with no matching scaler entry can
2370
+ * still stamp the taint and emit the teardown.
2880
2371
  */
2881
2372
  mandatory_labels: ColumnType<string[] | null, string | string[] | null | undefined, string | string[] | null>;
2882
2373
  /** The scaler's provisioning targets, copied onto the row for the same reason. */
@@ -2884,27 +2375,20 @@ export interface ScalerSpawningAgentsTable {
2884
2375
  /** The scaler's roles, copied onto the row for the same reason. */
2885
2376
  roles: ColumnType<string[] | null, string | string[] | null | undefined, string | string[] | null>;
2886
2377
  /**
2887
- * The scaler backend that spawned the agent: `container`, `bare-metal`,
2888
- * `firecracker`, or `event`. `event` is the value every adoption and reap
2889
- * predicate matches on, so a row missing it can be adopted and reaped by
2890
- * nobody. NULL means the row predates the column.
2378
+ * Spawning backend: `container`, `bare-metal`, `firecracker` or `event`. Every adoption and
2379
+ * reap predicate matches `event`, so a row missing it is adopted and reaped by nobody. NULL
2380
+ * means the row predates the column.
2891
2381
  */
2892
2382
  backend_type: ColumnType<string | null, string | null | undefined, string | null>;
2893
2383
  }
2894
2384
  export type ScalerSpawningAgentRow = Selectable<ScalerSpawningAgentsTable>;
2895
2385
  export type NewScalerSpawningAgentRow = Insertable<ScalerSpawningAgentsTable>;
2896
2386
  /**
2897
- * Scaler provision-outcomes table (scaler_provision_outcomes).
2898
- *
2899
- * One row per provisioned agent id, recording what became of the provision.
2900
- * Outlives `scaler_spawning_agents`, whose row is deleted on teardown — so the
2901
- * stale-spawn prune can tell an adopted provision from one that was never
2902
- * adopted, which the spawn row's absence cannot.
2903
- *
2904
- * `adopted_by` is written in the same transaction as
2905
- * `scaler_spawning_agents.adopted_by`, inside `adoptSpawningAgent`, which is
2906
- * the single writer of that column. Any future writer of `adopted_by` MUST
2907
- * write this row too, or the prune loses the signal again.
2387
+ * What became of each provisioned agent id. Outlives the `scaler_spawning_agents` row (deleted
2388
+ * on teardown), so the stale-spawn prune can tell an adopted provision from a never-adopted one.
2389
+ * `adopted_by` is written in the same transaction as `scaler_spawning_agents.adopted_by`, in
2390
+ * `adoptSpawningAgent`, its single writer. Any future writer of `adopted_by` MUST write this row
2391
+ * too, or the prune loses the signal.
2908
2392
  */
2909
2393
  export interface ScalerProvisionOutcomesTable {
2910
2394
  agent_id: string;
@@ -2914,13 +2398,11 @@ export interface ScalerProvisionOutcomesTable {
2914
2398
  /** When it was first adopted. Never refreshed by a re-adopt. */
2915
2399
  adopted_at: ColumnType<Date | null, Date | null | undefined, Date | null>;
2916
2400
  /**
2917
- * The reaper's teardown reason (`spawn-timeout` / `heartbeat-timeout`), set
2918
- * only once the teardown was actually delivered. Independent of `adopted_by`:
2919
- * a `heartbeat-timeout` condemns a provision that WAS adopted, and clearing
2920
- * the adoption here would restore the misattribution this table removes.
2401
+ * The reaper's teardown reason (`spawn-timeout` / `heartbeat-timeout`), set only once the
2402
+ * teardown was delivered. Independent of `adopted_by`: a `heartbeat-timeout` condemns an
2403
+ * adopted provision, and clearing the adoption would restore the misattribution.
2921
2404
  */
2922
2405
  condemned_reason: ColumnType<string | null, string | null | undefined, string | null>;
2923
- /** When the reaper condemned it. */
2924
2406
  condemned_at: ColumnType<Date | null, Date | null | undefined, Date | null>;
2925
2407
  recorded_at: Generated<Date>;
2926
2408
  updated_at: ColumnType<Date, Date | string | undefined, Date | string>;
@@ -2928,12 +2410,9 @@ export interface ScalerProvisionOutcomesTable {
2928
2410
  export type ScalerProvisionOutcomeRow = Selectable<ScalerProvisionOutcomesTable>;
2929
2411
  export type NewScalerProvisionOutcomeRow = Insertable<ScalerProvisionOutcomesTable>;
2930
2412
  /**
2931
- * Scaler agent-jobs table (scaler_agent_jobs).
2932
- *
2933
- * agentId → (runId, jobId) correlation used to route scaler-lifecycle
2934
- * events (spawn / boot / ready / kill) to the execution tracker. Row
2935
- * inserted in `correlateAgentToJob`, deleted on agent disconnect / job
2936
- * completion.
2413
+ * agentId → (runId, jobId) correlation routing scaler-lifecycle events (spawn / boot / ready /
2414
+ * kill) to the execution tracker. Inserted in `correlateAgentToJob`, deleted on agent
2415
+ * disconnect / job completion.
2937
2416
  */
2938
2417
  export interface ScalerAgentJobsTable {
2939
2418
  agent_id: string;
@@ -2944,11 +2423,8 @@ export interface ScalerAgentJobsTable {
2944
2423
  export type ScalerAgentJobRow = Selectable<ScalerAgentJobsTable>;
2945
2424
  export type NewScalerAgentJobRow = Insertable<ScalerAgentJobsTable>;
2946
2425
  /**
2947
- * Scaler reservations table (scaler_reservations).
2948
- *
2949
- * One row per outstanding resource reservation. `perScalerUsage` /
2950
- * `globalUsage` are derived state — recomputed from `SUM(...)` on coord
2951
- * boot so the cap-check critical section is correct under HA.
2426
+ * One row per outstanding resource reservation. `perScalerUsage` / `globalUsage` are derived:
2427
+ * recomputed from `SUM(...)` on coord boot so the cap-check critical section holds under HA.
2952
2428
  */
2953
2429
  export interface ScalerReservationsTable {
2954
2430
  agent_id: string;
@@ -2957,21 +2433,18 @@ export interface ScalerReservationsTable {
2957
2433
  mem_bytes: ColumnType<string, string | number, string | number>;
2958
2434
  reserved_at: Generated<Date>;
2959
2435
  /**
2960
- * The coordinator instance holding the reservation. Scopes recovery and the
2961
- * per-instance reaper. NULL reads as "unknown owner" — never as "not mine".
2436
+ * The holding coordinator; scopes recovery and the per-instance reaper. NULL reads as
2437
+ * "unknown owner", never "not mine".
2962
2438
  */
2963
2439
  owner_instance_id: ColumnType<string | null, string | null | undefined, string | null>;
2964
2440
  }
2965
2441
  export type ScalerReservationRow = Selectable<ScalerReservationsTable>;
2966
2442
  export type NewScalerReservationRow = Insertable<ScalerReservationsTable>;
2967
2443
  /**
2968
- * Pending provisioning claims (scaler_pending_claims).
2969
- *
2970
- * One row per outstanding event-scaler claim code, so any coordinator behind the
2971
- * shared endpoint can redeem a code rather than only the process that minted it.
2972
- * The code itself is never stored — only its sha256 — so a DB read cannot hand
2973
- * back a redeemable secret. Single use is enforced by a conditional UPDATE on
2974
- * `consumed_at`.
2444
+ * One row per outstanding event-scaler claim code, so any coordinator behind the shared
2445
+ * endpoint can redeem it, not only the minting process. Only the code's sha256 is stored, so a
2446
+ * DB read never yields a redeemable secret. A conditional UPDATE on `consumed_at` enforces
2447
+ * single use.
2975
2448
  */
2976
2449
  export interface ScalerPendingClaimsTable {
2977
2450
  claim_hash: string;