@kici-dev/orchestrator 0.17.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 (589) 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 +35 -52
  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 +25 -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 +5 -12
  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 +4568 -6571
  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 +240 -482
  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 +20 -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 +16 -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 +17 -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 +5 -12
  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/uploads.d.ts +5 -11
  473. package/dist/routes/webhooks.d.ts +2 -24
  474. package/dist/scaler/agent-binary-location.d.ts +77 -0
  475. package/dist/scaler/agent-fit.d.ts +2 -2
  476. package/dist/scaler/backend-factory.d.ts +10 -18
  477. package/dist/scaler/bare-metal-backend.d.ts +28 -45
  478. package/dist/scaler/claim-store.d.ts +20 -43
  479. package/dist/scaler/config.d.ts +10 -37
  480. package/dist/scaler/container-backend.d.ts +22 -35
  481. package/dist/scaler/container-hostconfig.d.ts +10 -16
  482. package/dist/scaler/container-routing.d.ts +10 -13
  483. package/dist/scaler/disk-guard.d.ts +2 -3
  484. package/dist/scaler/event-backend.d.ts +33 -58
  485. package/dist/scaler/event-provision-reaper.d.ts +61 -84
  486. package/dist/scaler/failure-tracker.d.ts +6 -13
  487. package/dist/scaler/file-tail.d.ts +6 -19
  488. package/dist/scaler/firecracker-api.d.ts +19 -63
  489. package/dist/scaler/firecracker-backend.d.ts +142 -258
  490. package/dist/scaler/host-access.d.ts +7 -10
  491. package/dist/scaler/index.d.ts +3 -6
  492. package/dist/scaler/ip-allocator.d.ts +30 -82
  493. package/dist/scaler/label-matcher.d.ts +14 -35
  494. package/dist/scaler/log-forwarder.d.ts +6 -25
  495. package/dist/scaler/machine-ledger.d.ts +39 -86
  496. package/dist/scaler/manager.d.ts +517 -787
  497. package/dist/scaler/pending-scale-sweeper.d.ts +8 -11
  498. package/dist/scaler/reap-orphans.d.ts +8 -12
  499. package/dist/scaler/resolve-container-auth.d.ts +12 -21
  500. package/dist/scaler/scaler-events.d.ts +2 -5
  501. package/dist/scaler/scaler-state-store.d.ts +127 -189
  502. package/dist/scaler/spawn-errors.d.ts +1 -4
  503. package/dist/scaler/startup-orphan-sweep.d.ts +3 -4
  504. package/dist/scaler/startup-tools-check.d.ts +21 -0
  505. package/dist/scaler/types.d.ts +142 -255
  506. package/dist/scaler/vm-job-bindings.d.ts +5 -9
  507. package/dist/scaler/warm-pool.d.ts +46 -93
  508. package/dist/secrets/audit-logger.d.ts +0 -3
  509. package/dist/secrets/backend-health.d.ts +0 -9
  510. package/dist/secrets/backend-registry.d.ts +0 -9
  511. package/dist/secrets/cleanup.d.ts +0 -1
  512. package/dist/secrets/config.d.ts +0 -3
  513. package/dist/secrets/ephemeral-keys.d.ts +0 -3
  514. package/dist/secrets/pg-secret-store.d.ts +0 -3
  515. package/dist/secrets/rbac.d.ts +0 -6
  516. package/dist/secrets/secret-output-store.d.ts +0 -6
  517. package/dist/secrets/secret-resolver.d.ts +2 -6
  518. package/dist/secrets/token-manager.d.ts +0 -4
  519. package/dist/secrets/vault-secret-store.d.ts +0 -13
  520. package/dist/security/comment-handler.d.ts +0 -2
  521. package/dist/security/workflow-diff.d.ts +1 -1
  522. package/dist/server.js +7500 -12629
  523. package/dist/sources/source-manager.d.ts +0 -3
  524. package/dist/sources/source-store.d.ts +0 -9
  525. package/dist/sources/source-validator.d.ts +0 -3
  526. package/dist/stale-detector/all-terminal-runs.d.ts +8 -11
  527. package/dist/stale-detector/gate-deadline-detector.d.ts +14 -19
  528. package/dist/stale-detector/reboot-deadline-sweep.d.ts +7 -11
  529. package/dist/stale-detector/stale-dispatch-candidates.d.ts +13 -20
  530. package/dist/stale-detector/stale-run-detector.d.ts +74 -121
  531. package/dist/stale-detector/workflow-deadline-detector.d.ts +15 -43
  532. package/dist/standalone.js +7141 -11957
  533. package/dist/storage/blob-routes.d.ts +10 -19
  534. package/dist/storage/filesystem.d.ts +19 -29
  535. package/dist/storage/index.d.ts +2 -10
  536. package/dist/storage/key-discriminator.d.ts +8 -10
  537. package/dist/storage/loopback-guard.d.ts +27 -45
  538. package/dist/storage/s3.d.ts +25 -52
  539. package/dist/storage/sign-url.d.ts +7 -22
  540. package/dist/storage/types.d.ts +44 -70
  541. package/dist/webhook/event-log.d.ts +0 -2
  542. package/dist/webhook/generic-sources.d.ts +0 -21
  543. package/dist/webhook/ingest-admission.d.ts +0 -1
  544. package/dist/webhook/relay-buffer.d.ts +2 -2
  545. package/dist/webhook/verify-inbound.d.ts +0 -1
  546. package/dist/worker/in-memory-execution-tracker.d.ts +9 -31
  547. package/dist/worker/in-memory-job-queue.d.ts +32 -72
  548. package/dist/worker/peer-outbox.d.ts +5 -8
  549. package/dist/worker/reroute-dispatch.d.ts +4 -6
  550. package/dist/worker/static-agent-token-store.d.ts +6 -27
  551. package/dist/worker/worker-outbox-relay.d.ts +2 -2
  552. package/dist/worker/worker-status.d.ts +3 -20
  553. package/dist/ws/agent-api-registry.d.ts +8 -27
  554. package/dist/ws/agent-handler.d.ts +63 -110
  555. package/dist/ws/agent-heartbeat.d.ts +5 -12
  556. package/dist/ws/bringup-api.d.ts +31 -38
  557. package/dist/ws/dashboard-backends-handler.d.ts +12 -22
  558. package/dist/ws/dashboard-context-handler.d.ts +37 -80
  559. package/dist/ws/dashboard-diagnostics-handler.d.ts +8 -25
  560. package/dist/ws/dashboard-dispatch-guard.d.ts +3 -4
  561. package/dist/ws/dashboard-fleet-handler.d.ts +9 -13
  562. package/dist/ws/dashboard-fleet-write-handler.d.ts +7 -21
  563. package/dist/ws/dashboard-global-workflows-handler.d.ts +22 -44
  564. package/dist/ws/dashboard-registrations-handler.d.ts +10 -27
  565. package/dist/ws/dashboard-run-state-handler.d.ts +10 -13
  566. package/dist/ws/event-buffer.d.ts +3 -6
  567. package/dist/ws/execution-status-frame.d.ts +7 -10
  568. package/dist/ws/failure-messages.d.ts +9 -14
  569. package/dist/ws/fleet-agent-collector.d.ts +6 -12
  570. package/dist/ws/fleet-runs-on-all.d.ts +1 -6
  571. package/dist/ws/git-credential-relay.d.ts +12 -20
  572. package/dist/ws/inventory-api.d.ts +4 -5
  573. package/dist/ws/observer-registry.d.ts +14 -59
  574. package/dist/ws/ownership-gate.d.ts +1 -1
  575. package/dist/ws/platform-client.d.ts +21 -30
  576. package/dist/ws/replay-chunker.d.ts +7 -10
  577. package/dist/ws/server-options.d.ts +5 -9
  578. package/dist/ws/test-relay-handlers.d.ts +36 -60
  579. package/installer-image-digests.json +3 -3
  580. package/package.json +6 -5
  581. package/sbom.spdx.json +53 -53
  582. package/dist/__test-helpers__/fake-scaler-state-store.d.ts +0 -24
  583. package/dist/__test-helpers__/mock-db-query.d.ts +0 -129
  584. package/dist/__test-helpers__/mock-db.d.ts +0 -134
  585. package/dist/__test-helpers__/mock-ws.d.ts +0 -13
  586. package/dist/__test-helpers__/peer-mutual-auth.d.ts +0 -42
  587. package/dist/__test-helpers__/scratch-db.d.ts +0 -16
  588. package/dist/__test-helpers__/test-db.d.ts +0 -34
  589. package/dist/pipeline/dispatch-matched-workflow.test-helpers.d.ts +0 -121
@@ -1,15 +1,11 @@
1
1
  /**
2
- * Core webhook processing pipeline.
2
+ * Core webhook processing pipeline: dedup -> normalize event -> fetch lock file ->
3
+ * get changed files -> match triggers -> cache check -> dispatch jobs.
3
4
  *
4
- * Connects all orchestrator modules into a complete processing flow:
5
- * dedup -> normalize event -> fetch lock file -> get changed files ->
6
- * match triggers -> cache check -> dispatch jobs
5
+ * Provider-agnostic: every provider-specific operation goes through the ProviderRegistry.
7
6
  *
8
- * Uses the ProviderRegistry for all provider-specific operations.
9
- * No direct GitHub/Octokit references -- fully provider-agnostic.
10
- *
11
- * Decision traces are forwarded to Platform via platformClient.send() (which buffers
12
- * internally when disconnected -- the caller does NOT check connection state).
7
+ * Decision traces go to the Platform via platformClient.send(), which buffers while
8
+ * disconnected, so the caller does NOT check connection state.
13
9
  */
14
10
  import { type Kysely } from 'kysely';
15
11
  import type { Database } from '../db/types.js';
@@ -63,12 +59,10 @@ import type { TrustPolicyStore } from '../security/trust-policy-store.js';
63
59
  import type { TrustDirectoryStore } from '../security/trust-directory-store.js';
64
60
  import { type ContextDataDeps, type DeferredContextResolution } from './held-context-data.js';
65
61
  /**
66
- * Pending dispatch context for jobs gated by the needs scheduler.
67
- * Keyed by `${runId}:${jobName}`. Populated at processWebhook time for all
68
- * non-root static jobs. Consumed by the onJobReady callback when the scheduler
69
- * determines a job's upstreams are all satisfied.
70
- *
71
- * Entries are cleaned up after dispatch or when the run completes.
62
+ * Pending dispatch context for a job gated by the needs scheduler, keyed by
63
+ * `${runId}:${jobName}`. Stored at processWebhook time for every non-root static
64
+ * job; consumed by onJobReady once its upstreams are satisfied; cleaned up after
65
+ * dispatch or on run completion.
72
66
  */
73
67
  interface PendingJobContext {
74
68
  jobInput: QueuedJobInput;
@@ -80,10 +74,9 @@ interface PendingJobContext {
80
74
  */
81
75
  invoke?: InvokeGateParams;
82
76
  /**
83
- * Set for a job bound to a context: what `dispatchReadyJob` resolves the
84
- * job's context variables and secrets from when the job leaves its pending
85
- * context, since `jobInput` is stored without them. Absent for a job with no
86
- * bound context, which dispatches its stored input unchanged.
77
+ * Set for a job bound to a context: `dispatchReadyJob` resolves the context
78
+ * variables and secrets from it, since `jobInput` is stored without them.
79
+ * Absent when no context is bound; the stored input dispatches unchanged.
87
80
  */
88
81
  contextResolution?: DeferredContextResolution;
89
82
  /**
@@ -93,15 +86,11 @@ interface PendingJobContext {
93
86
  */
94
87
  secretsUnavailable?: string;
95
88
  }
96
- /**
97
- * Register an eval gate and return a promise that resolves when the scheduler
98
- * opens it (the eval job's upstream needs are all satisfied).
99
- */
89
+ /** Register an eval gate; resolves when the scheduler opens it. */
100
90
  export declare function trackEvalGate(runId: string, evalJobName: string): Promise<void>;
101
91
  /**
102
- * Open a registered eval gate, unblocking the deferred dispatch task. Returns
103
- * true if a gate was registered for this eval job (so the scheduler knows it
104
- * handled the ready signal itself and must not run the normal dispatch path).
92
+ * Open a registered eval gate. Returns true when one existed, so the scheduler
93
+ * must not also run the normal dispatch path.
105
94
  */
106
95
  export declare function openEvalGate(runId: string, evalJobName: string): boolean;
107
96
  /** True when a job name is a result-aware dynamic eval job awaiting its gate. */
@@ -109,45 +98,35 @@ export declare function isEvalGatePending(runId: string, evalJobName: string): b
109
98
  /** Clear all eval gates for a run (called on run completion / cleanup). */
110
99
  export declare function clearEvalGatesForRun(runId: string): void;
111
100
  /**
112
- * Store a pending dispatch context for a job that will be dispatched later
113
- * by the needs scheduler. The key is `${runId}:${jobName}`.
114
- * Writes to both in-memory Map and DB table for crash recovery.
101
+ * Store a pending dispatch context in memory and in the DB (for crash recovery).
115
102
  * @internal Exported for testing
116
103
  */
117
104
  export declare function storePendingJobContext(db: Kysely<Database> | undefined, runId: string, jobName: string, ctx: PendingJobContext): Promise<void>;
118
105
  /**
119
- * Consume and remove a pending dispatch context for a job.
120
- * Returns undefined if no context is stored (e.g. job was already dispatched).
121
- * Deletes from both in-memory Map and DB table.
106
+ * Consume a pending dispatch context from memory and the DB; undefined when none
107
+ * is stored (e.g. the job already dispatched).
122
108
  *
123
- * Cluster correctness: `storePendingJobContext` writes to both the local
124
- * in-memory Map and the shared DB. In an HA cluster the peer that ingested
125
- * the webhook stores the context, but `onJobReady` fires on whichever peer
126
- * tracked the upstream job's completion — which, for a rerouted upstream,
127
- * is a different peer whose Map is empty. Falling through to an atomic
128
- * `DELETE ... RETURNING` ensures exactly one peer claims the context.
109
+ * Cluster correctness: `onJobReady` fires on whichever peer tracked the upstream's
110
+ * completion, which for a rerouted upstream is not the ingesting peer, so its Map
111
+ * is empty. The atomic `DELETE ... RETURNING` fallback lets exactly one peer claim it.
129
112
  * @internal Exported for testing
130
113
  */
131
114
  export declare function consumePendingJobContext(db: Kysely<Database> | undefined, runId: string, jobName: string): Promise<PendingJobContext | undefined>;
132
- /**
133
- * Clean up all pending dispatch contexts for a run (called on run completion).
134
- * Deletes from both in-memory Map and DB table.
135
- */
115
+ /** Drop a run's pending dispatch contexts from memory and the DB on run completion. */
136
116
  export declare function cleanupPendingJobContexts(db: Kysely<Database> | undefined, runId: string): Promise<void>;
137
117
  /**
138
- * Restore all pending job contexts from DB into the in-memory Map.
139
- * Called on startup before the needs scheduler recovery loop so that
140
- * dispatchReadyJob has context available for recovered jobs.
118
+ * Restore pending job contexts from the DB into memory. Runs on startup before
119
+ * the needs scheduler recovery loop, so dispatchReadyJob has them for recovered jobs.
141
120
  */
142
121
  export declare function restorePendingJobContexts(db: Kysely<Database>): Promise<number>;
143
122
  /**
144
- * Clear all entries from the in-memory pending job contexts Map.
123
+ * Clear the in-memory pending job contexts.
145
124
  * @internal Exported for testing only.
146
125
  */
147
126
  export declare function clearPendingJobContextsMap(): void;
148
127
  /**
149
- * Determine if a lock job is a "root" job (no concrete needs and no dependsOnGroups).
150
- * Root jobs can be dispatched immediately; non-root jobs wait for the scheduler.
128
+ * A root job (no concrete needs, no dependsOnGroups) dispatches immediately;
129
+ * others wait for the scheduler.
151
130
  */
152
131
  export declare function isRootJob(lockJob: LockJob): boolean;
153
132
  /**
@@ -155,44 +134,24 @@ export declare function isRootJob(lockJob: LockJob): boolean;
155
134
  * webhook's provider bundle first, then falling back to other provider bundles
156
135
  * registered against the SAME customer's registrations for the SAME repo.
157
136
  *
158
- * Why this exists
159
- * ----------------
160
- * The webhook pipeline binds `lockFileFetcher` to the inbound webhook's
161
- * provider bundle. When a local-sourced webhook (e.g., a failover-dispatch
162
- * push sent through the internal ingress) arrives for a repo whose lock file
163
- * is only accessible via a different provider (e.g., github), the inbound
164
- * fetcher returns null and trigger matching silently drops the webhook.
165
- * This resolver lets the pipeline consult OTHER bundles whose registrations
166
- * prove they own the repo for the same tenant.
137
+ * Why: `lockFileFetcher` is bound to the inbound provider bundle. A local-sourced
138
+ * webhook (e.g. a failover-dispatch push through the internal ingress) for a repo
139
+ * whose lock file only another provider (e.g. github) can read gets null, and
140
+ * trigger matching silently drops the webhook.
167
141
  *
168
- * Tenant boundary (security-critical)
169
- * -----------------------------------
170
- * The fallback iterates ONLY registrations returned by
171
- * `registrationIndex.getByOrgAndRepo(customerId, repoIdentifier)`. That
172
- * index is keyed by `${customerId}|${repoIdentifier}`, so cross-customer
173
- * leakage is structurally impossible — a customer-B registration for
174
- * `owner/repo` will never be returned when we pass `customerId = 'custA'`.
175
- * The resolver also skips any registration whose `routingKey` matches the
176
- * inbound routing key (no self-recursion) and dedupes by routing key so a
177
- * repo with many workflows registered through the same source only
178
- * triggers one fallback fetch.
142
+ * Tenant boundary (security-critical): the fallback iterates ONLY
143
+ * `registrationIndex.getByOrgAndRepo(customerId, repoIdentifier)`, keyed by
144
+ * `${customerId}|${repoIdentifier}`, so cross-customer leakage is structurally
145
+ * impossible. It skips the inbound routing key (no self-recursion) and dedupes by
146
+ * routing key, so many workflows from one source trigger one fallback fetch.
179
147
  *
180
- * Ordering
181
- * --------
182
- * Registrations are consulted in the order returned by the index (which
183
- * preserves insertion order = createdAt ascending). The first non-null
184
- * lock file wins. If all fallbacks return null the function returns null
185
- * and the caller falls through to the existing `Lock file not found`
148
+ * Ordering: index order (createdAt ascending); the first non-null lock file wins.
149
+ * All null returns null, and the caller falls through to the `Lock file not found`
186
150
  * global-workflow-matching path.
187
151
  *
188
- * Credentials
189
- * -----------
190
- * Each fallback fetcher is invoked with the REGISTRATION'S
191
- * `providerContext`, NOT the inbound normalizer's credentials. This is
192
- * load-bearing: the LocalWebhookNormalizer returns `{}` as
193
- * credentials, which would never satisfy a github fetcher that requires
194
- * `installationId`. The registration carries the correct credentials
195
- * because it was created via the owning provider's source.
152
+ * Credentials: each fallback fetcher gets the REGISTRATION'S `providerContext`,
153
+ * NOT the inbound credentials. Load-bearing: LocalWebhookNormalizer returns `{}`,
154
+ * which never satisfies a github fetcher needing `installationId`.
196
155
  */
197
156
  export declare function resolveLockFileWithFallback(args: {
198
157
  inboundBundle: ProviderBundle;
@@ -207,105 +166,78 @@ export declare function resolveLockFileWithFallback(args: {
207
166
  deliveryId: string;
208
167
  /**
209
168
  * False when cross-source repo mode already evaluated this delivery's
210
- * other-source registrations for the same repository: the fallback would
211
- * re-read exactly those registrations. Defaults to true.
169
+ * other-source registrations for the repo, which the fallback would re-read.
170
+ * Defaults to true.
212
171
  */
213
172
  allowRegistrationFallback?: boolean;
214
173
  }): Promise<{
215
174
  lockFile: FullLockFile | null;
216
175
  resolvedVia: 'inbound' | 'fallback' | 'miss' | 'corrupt';
217
176
  fallbackRoutingKey?: string;
218
- /** The winning provider bundle when resolvedVia='fallback'. Used by the dispatch
219
- * site to swap repoUrlBuilder and cloneTokenProvider (Layer 4 cross-provider fix). */
177
+ /** Set on 'fallback': the dispatch site swaps in its repoUrlBuilder and cloneTokenProvider. */
220
178
  fallbackBundle?: ProviderBundle;
221
- /** The winning registration's providerContext when resolvedVia='fallback'.
222
- * Carries installationId etc. for clone token issuance. */
179
+ /** Set on 'fallback': the registration's providerContext (installationId etc.) for clone tokens. */
223
180
  fallbackCredentials?: Record<string, unknown>;
224
- /** Set when resolvedVia='corrupt': the parse error seen while attempting to
225
- * resolve a lock file. A valid fallback always wins over a corrupt inbound,
226
- * so this is only surfaced when NOTHING resolved. */
181
+ /** Set on 'corrupt': the parse error. A valid fallback beats a corrupt inbound,
182
+ * so this surfaces only when NOTHING resolved. */
227
183
  corruptError?: LockFileParseError;
228
184
  }>;
229
185
  /**
230
- * Resolve the customer/org ID for a routing key.
231
- *
232
- * Checks the `sources` table first (GitHub App sources), then
233
- * `generic_webhook_sources` (generic webhook sources), then `remote_sources`
234
- * (the auto-provisioned anchor for Platform-relayed `kici run remote`, routing
235
- * key `remote:<orgId>`). Falls back to '__default__' if none of the three
236
- * tables has the routing key.
186
+ * Resolve the customer/org ID for a routing key from `sources` (GitHub App), then
187
+ * `generic_webhook_sources`, then `remote_sources` (the auto-provisioned anchor for
188
+ * Platform-relayed `kici run remote`, routing key `remote:<orgId>`); '__default__'
189
+ * when none has it.
237
190
  */
238
191
  export declare function resolveOrgId(db: Kysely<Database>, routingKey: string): Promise<string>;
239
- /**
240
- * Map GitHub webhook event types to lock file trigger type strings.
241
- * Used for global workflow matching via RegistrationIndex.getGlobalByTriggerType().
242
- */
192
+ /** Map a GitHub event type to its lock file trigger type, for RegistrationIndex.getGlobalByTriggerType(). */
243
193
  export declare function eventTypeToTriggerType(eventType: string): string;
244
- /**
245
- * Extract a human-readable trigger event string from webhook info.
246
- * Combines event type with action (e.g. "push", "pull_request:opened").
247
- */
194
+ /** Trigger event string: event plus action, e.g. "push", "pull_request:opened". */
248
195
  export declare function buildTriggerEvent(event: string, action: string | null | undefined): string;
249
196
  /**
250
- * Best-effort extraction of a repository identifier from a generic webhook
251
- * payload for cross-source dispatch. Generic webhooks have no
252
- * canonical repo shape, so we probe the conventions a sender is most likely
253
- * to use:
197
+ * Best-effort repo identifier from a generic webhook payload, for cross-source
198
+ * dispatch. Generic webhooks have no canonical repo shape, so this probes:
254
199
  *
255
200
  * 1. GitHub-style `repository.full_name` (`owner/repo`)
256
201
  * 2. GitHub-style `repository.owner.login` + `repository.name`
257
202
  * 3. Flat `repository` string (e.g. `{"repository": "owner/repo"}`)
258
203
  *
259
- * Returns null when no recognisable repo field is present, in which case the
260
- * cross-source repo lookup is skipped (event-name fan-out still runs).
204
+ * Null skips the cross-source repo lookup; event-name fan-out still runs.
261
205
  */
262
206
  export declare function extractInboundRepoIdentifier(payload: unknown): string | null;
263
207
  /**
264
- * Extract the first line of the commit message from a webhook payload, for run
265
- * display. Handles push (head_commit.message), PR (pull_request.title) and
266
- * issue_comment (issue.title) events.
208
+ * First line of the commit message for run display: push (head_commit.message),
209
+ * PR (pull_request.title), issue_comment (issue.title).
267
210
  *
268
211
  * The Tier-0 `commitMessage` trigger filter deliberately reads a DIFFERENT text
269
212
  * (the full message, and PR title + body) — see `githubFilterText`.
270
213
  */
271
214
  export declare function extractCommitMessage(event: string, payload: unknown): string | undefined;
272
215
  /**
273
- * Build a human-readable summary for a security hold check.
216
+ * Summary for a security hold check.
274
217
  *
275
- * `tier` is the resolved trust tier, or undefined when trust never resolved;
276
- * the summary displays `unknown` for the latter. The caller passes the resolved
277
- * value rather than forging `unknown` for an absent one, so this summary and
278
- * `buildReducedPrivilegeNote` (`../security/reduced-privilege-note.ts`) cannot
279
- * disagree about which case a run is in.
218
+ * `tier` is undefined when trust never resolved (displayed as `unknown`). The
219
+ * caller never forges `unknown`, so this and `buildReducedPrivilegeNote`
220
+ * (`../security/reduced-privilege-note.ts`) cannot disagree about a run's case.
280
221
  *
281
- * Carries no reduced-privilege note of its own: the note is appended by the
282
- * call site, because the two summaries this builds are read on checks with
283
- * different fates. The trust-policy HOLD stores a resume context, so
284
- * `/kici approve` replays its dispatch and its call site
285
- * (`holdRunForSecurityPolicy`) appends the note; the trust-policy REJECTION
286
- * never runs, so `buildSecurityRejectionSummary`'s call site appends nothing.
222
+ * The reduced-privilege note is the call site's job: a trust-policy HOLD stores a
223
+ * resume context that `/kici approve` replays, so `holdRunForSecurityPolicy`
224
+ * appends it; a trust-policy REJECTION never runs, so its call site appends nothing.
287
225
  */
288
226
  export declare function buildSecurityHoldSummary(reason: string, tier: string | undefined, contributorUsername?: string): string;
289
227
  /**
290
- * Build the failure check-run description for a run the org trust policy
291
- * REJECTED.
292
- *
293
- * Deliberately not `buildSecurityHoldSummary`: a rejected run creates no
294
- * `held_runs` row, so telling the contributor to seek "approval from a user
295
- * with ci_trust:write or higher" points at a queue the run will never appear
296
- * in. Only an org policy change can unblock it.
228
+ * Failure check-run description for a run the org trust policy REJECTED.
297
229
  *
298
- * Carries no reduced-privilege note for the same reason: the summary's own next
299
- * line says the run cannot be approved, so a posture note beside it would read
300
- * as "it ran with reduced privileges and that is why it failed" for a run that
301
- * never dispatched at all.
230
+ * Not `buildSecurityHoldSummary`: a rejected run has no `held_runs` row, so
231
+ * "approval from a user with ci_trust:write" points at a queue it never joins;
232
+ * only an org policy change unblocks it. No reduced-privilege note either: beside
233
+ * "cannot be approved" it would read as the cause of failure for a run that never
234
+ * dispatched.
302
235
  */
303
236
  export declare function buildSecurityRejectionSummary(reason: string, message: string, tier: string | undefined, contributorUsername?: string): string;
304
237
  /**
305
- * Build the pending check-run description for a job/workflow approval hold,
306
- * naming the clauses an approver must satisfy. `{team:X}` renders as
307
- * "team X", `{user:Y}` as "user Y". An empty clause list (any eligible
308
- * reviewer satisfies the hold) falls back to a generic message.
238
+ * Pending check-run description for a job/workflow approval hold, naming the
239
+ * clauses ("team X", "user Y"). An empty list (any eligible reviewer) gets a
240
+ * generic message.
309
241
  */
310
242
  export declare function summarizeApprovalClauses(clauses: ReadonlyArray<{
311
243
  team: string;
@@ -313,202 +245,168 @@ export declare function summarizeApprovalClauses(clauses: ReadonlyArray<{
313
245
  user: string;
314
246
  }>): string;
315
247
  /**
316
- * The line appended to an approval hold's check description when a security
317
- * trust hold gates the SAME job.
318
- *
319
- * Both holds must be answered before the job runs, and the check run carries one
320
- * description. Without this line the check names only the approval clauses — so
321
- * the named approver approves, nothing runs, and the text does not change: a
322
- * contributor is left with a satisfied requirement, no statement of what is
323
- * still outstanding, and no idea that a different permission clears it. Naming
324
- * the second gate and how it is released is the minimum that makes the check
325
- * honest.
248
+ * Appended to an approval hold's check description when a security trust hold
249
+ * gates the SAME job. Both holds must clear and the check carries one description;
250
+ * without this line the named approver approves, nothing runs, and nothing says
251
+ * what is outstanding or that a different permission clears it.
326
252
  */
327
253
  export declare const SECURITY_HOLD_ALSO_GATES_NOTE: string;
328
254
  /**
329
- * Dependencies for the processing pipeline.
330
- * All injected for testability. Fully provider-agnostic.
331
- *
332
- * sourceCache and buildCoordinator are optional for backward compatibility --
333
- * existing tests and deployments without cache configured still work.
255
+ * Dependencies for the processing pipeline, all injected for testability.
256
+ * Optional caches keep tests and cache-less deployments working.
334
257
  */
335
258
  export interface ProcessingDeps {
336
259
  dedup: DedupCache;
337
260
  providerRegistry: ProviderRegistry;
338
261
  /**
339
262
  * Re-register the provider bundle for a generic routing key from server
340
- * truth, returning true when a bundle is now present.
263
+ * truth; true when a bundle is now present.
341
264
  *
342
- * The registry is an in-memory CACHE of `generic_webhook_sources`, populated
343
- * by three independent paths (startup enumeration, the admin write handler,
344
- * and the LISTEN/NOTIFY drain). None of them can guarantee the entry is
345
- * present for a delivery that arrives at an arbitrary moment, and a miss is
346
- * not benign: `getByRoutingKey` used to substitute an unrelated `generic:`
347
- * bundle whose normalizer reports "this payload has no repository", so the
348
- * delivery was discarded with nothing above `debug` to say why.
265
+ * The registry is an in-memory CACHE of `generic_webhook_sources`, filled by
266
+ * startup enumeration, the admin write handler and the LISTEN/NOTIFY drain;
267
+ * none guarantees the entry exists when a delivery arrives. A miss is not
268
+ * benign: an unrelated `generic:` bundle would report "no repository" and the
269
+ * delivery would be discarded with nothing above `debug`.
349
270
  *
350
- * Optional — hand-built test deps and wirings with no generic-source manager
351
- * keep the previous behaviour (a miss stays a miss, reported loudly).
271
+ * Optional: without it a miss stays a miss, reported loudly.
352
272
  */
353
273
  ensureProviderBundle?: (routingKey: string) => Promise<boolean>;
354
274
  lockFileCache: LockFileCache;
355
275
  /**
356
- * Cache for the Tier-1 `requires` static content filter (source-file bytes at
357
- * a ref, keyed by (repo, sha, path)). Optional so hand-built test deps and
358
- * independent deployments that never use `requires` keep working; when absent,
359
- * a candidate carrying `requires` is dropped fail-visible rather than
360
- * dispatched unfiltered (see content-filter.ts).
276
+ * Cache for the Tier-1 `requires` static content filter (file bytes keyed by
277
+ * (repo, sha, path)). When absent, a candidate carrying `requires` is dropped
278
+ * fail-visible rather than dispatched unfiltered (see content-filter.ts).
361
279
  */
362
280
  contentRequirementsCache?: ContentRequirementsCache;
363
281
  dispatcher: Dispatcher;
364
282
  /** Null/undefined in Independent mode. send() buffers when disconnected. */
365
283
  platformClient?: PlatformClient;
366
- /** Directory for writing raw webhook payloads. If set, writes {dir}/{repo}/{deliveryId}/payload.json. */
284
+ /** If set, raw payloads go to {dir}/{repo}/{deliveryId}/payload.json. */
367
285
  webhookPayloadDir?: string;
368
- /** Bundle cache for compiled workflow bundles. Optional -- if not set, cache is bypassed. */
286
+ /** Compiled workflow bundle cache; absent bypasses the cache. */
369
287
  sourceCache?: SourceCache;
370
- /** Build coordinator for deduplicating concurrent builds. Optional -- if not set, cache is bypassed. */
288
+ /** Deduplicates concurrent builds; absent bypasses the cache. */
371
289
  buildCoordinator?: BuildCoordinator;
372
- /** Dep cache for dependency tarballs. Optional -- if not set, dep caching is bypassed. */
290
+ /** Dependency tarball cache; absent bypasses dep caching. */
373
291
  depCache?: DepCache;
374
- /** Pending build tracker -- waits for build agents to finish before dispatching execution jobs. */
292
+ /** Waits for build agents before dispatching execution jobs. */
375
293
  pendingBuilds?: PendingBuildTracker;
376
- /** Pending init tracker -- waits for init agents to resolve dynamic fields before static dispatch. */
294
+ /** Waits for init agents to resolve dynamic fields before static dispatch. */
377
295
  pendingInits?: PendingInitTracker;
378
- /** Pending dynamic tracker -- waits for agents to evaluate DynamicJobFn and return generated LockJob[]. */
296
+ /** Waits for agents to evaluate DynamicJobFn into generated LockJob[]. */
379
297
  pendingDynamics?: PendingDynamicTracker;
380
- /** Pending global-eval tracker -- waits for the pre-run round that decides which global workflows apply. */
298
+ /** Waits for the pre-run round that decides which global workflows apply. */
381
299
  pendingGlobalEvals?: PendingGlobalEvalTracker;
382
- /** Round-result cache for the pre-run global eval round. Optional -- if not set, every round re-runs. */
300
+ /** Pre-run global eval round result cache; absent re-runs every round. */
383
301
  globalEvalCache?: GlobalEvalRoundCache;
384
- /** Cluster default for the whole-round budget handed to the eval agent (ms).
385
- * The live per-cluster override is `cluster_settings.global_eval_round_timeout_ms`. */
302
+ /** Cluster default whole-round eval-agent budget (ms); live override
303
+ * `cluster_settings.global_eval_round_timeout_ms`. */
386
304
  globalEvalRoundTimeoutMs?: number;
387
- /** Cluster default for the per-candidate budget handed to the eval agent (ms).
388
- * The live per-cluster override is `cluster_settings.global_eval_candidate_timeout_ms`. */
305
+ /** Cluster default per-candidate eval-agent budget (ms); live override
306
+ * `cluster_settings.global_eval_candidate_timeout_ms`. */
389
307
  globalEvalCandidateTimeoutMs?: number;
390
- /** Cluster default for the orchestrator's own ceiling on awaiting a round (ms).
391
- * Unlike the two budgets above, this one is enforced here rather than by the
392
- * agent, so it also bounds a round no agent ever picked up. The live
393
- * per-cluster override is `cluster_settings.global_eval_wait_timeout_ms`. */
308
+ /** Cluster default orchestrator-side ceiling on awaiting a round (ms). Enforced
309
+ * here, not by the agent, so it also bounds a round no agent picked up. Live
310
+ * override `cluster_settings.global_eval_wait_timeout_ms`. */
394
311
  globalEvalWaitTimeoutMs?: number;
395
- /** Commit status reporter for setting pending/success/failure/error on commits. Optional. */
312
+ /** Sets pending/success/failure/error commit statuses. */
396
313
  checkRunReporter?: CheckRunReporter;
397
- /** Execution tracker for DB persistence. Optional -- if not set, execution tracking is skipped. */
314
+ /** DB persistence of executions; absent skips tracking. */
398
315
  executionTracker?: ExecutionTracker;
399
- /** Agent registry for determining execution target platform/arch. Optional -- if not set, defaults to linux/x64. */
316
+ /** Picks the execution target platform/arch; absent defaults to linux/x64. */
400
317
  agentRegistry?: AgentRegistry;
401
- /** Run coordinator for multi-orchestrator job routing. Optional -- if not set, all jobs dispatch locally (single-orchestrator mode). */
318
+ /** Multi-orchestrator job routing; absent dispatches every job locally. */
402
319
  coordinator?: RunCoordinator;
403
- /** Secret resolver for dispatch-time secret resolution. Optional -- if not set, secrets are not resolved. */
320
+ /** Dispatch-time secret resolution; absent leaves secrets unresolved. */
404
321
  secretResolver?: SecretResolverApi;
405
322
  /**
406
- * Cached per-org container-sandbox escape-hatch allow-list reader. Optional --
407
- * when absent, dispatch defaults to the safe deny-all allow-list, so no
408
- * workflow can escalate capabilities / host networking.
323
+ * Cached per-org container-sandbox escape-hatch allow-list. When absent, dispatch
324
+ * uses the deny-all allow-list, so no workflow can escalate capabilities / host
325
+ * networking.
409
326
  */
410
327
  sandboxAllowListReader?: SandboxAllowListReader;
411
- /** Optional callback when source locations are extracted from a lock file workflow. */
412
328
  onSourceLocationsExtracted?: (workflowName: string, jobName: string, sourceLocations: Array<{
413
329
  file: string;
414
330
  line: number;
415
331
  column: number;
416
332
  } | undefined>) => void;
417
- /** Event router for registering lock file event subscriptions. Optional -- if not set, event routing is inactive. */
333
+ /** Lock file event subscriptions; absent leaves event routing inactive. */
418
334
  eventRouter?: EventRouter;
419
335
  /**
420
- * Invoke-gate dependencies (summon callback + chain-depth bound). Optional --
421
- * when absent an invoke gate cannot summon (it fails loudly rather than
422
- * silently reaching an agent). Built at the composition root.
336
+ * Summon callback + chain-depth bound, built at the composition root. When
337
+ * absent an invoke gate fails loudly rather than silently reaching an agent.
423
338
  */
424
339
  invokeGateDeps?: InvokeGateDeps;
425
- /** Registration store for persisting workflow registrations. Optional -- if not set, registration is skipped. */
340
+ /** Absent skips registration. */
426
341
  registrationStore?: RegistrationStore;
427
- /** Registration index for in-memory lookup. Optional -- if not set, registration is skipped. */
342
+ /** In-memory registration lookup; absent skips registration. */
428
343
  registrationIndex?: RegistrationIndex;
429
- /** Cron scheduler for cache refresh after registration changes. Optional -- if not set, cron cache refresh is skipped. */
344
+ /** Refreshes the cron cache after registration changes; absent skips it. */
430
345
  cronScheduler?: CronScheduler;
431
- /** Database connection for ephemeral key storage. Optional -- if not set, cross-job secret output support is inactive. */
346
+ /** Ephemeral key storage; absent disables cross-job secret outputs. */
432
347
  db?: Kysely<Database>;
433
- /** Secret key (KICI_SECRET_KEY) for encrypting ephemeral private keys. Required when db is set. */
348
+ /** KICI_SECRET_KEY, encrypts ephemeral private keys. Required when db is set. */
434
349
  secretKey?: string;
435
- /** Log storage backend for persisting webhook payloads. Optional -- if not set, payload storage is skipped. */
350
+ /** Persists webhook payloads; absent skips payload storage. */
436
351
  logStorage?: LogStorage;
437
352
  /**
438
- * Durable step-log writer. Optional -- when present, the deferred-init path
439
- * uses it to surface a post-init env warning on the run's log stream so a
440
- * blocking `kici run remote` test run prints it (the accept response has
441
- * already been returned by the time the init round resolves).
353
+ * Durable step-log writer. The deferred-init path writes a post-init env
354
+ * warning to the run's log stream, so a blocking `kici run remote` prints it
355
+ * (the accept response has already returned when the init round resolves).
442
356
  */
443
357
  logWriter?: Pick<LogWriter, 'appendChunk' | 'drain'>;
444
- /** Context store for looking up deployment contexts. Optional -- if not set, context features are inactive. */
358
+ /** Deployment contexts; absent disables context features. */
445
359
  contextStore?: ContextStore;
446
- /** Variable store for resolving context variables. Optional -- if not set, context vars are not merged. */
360
+ /** Context variables; absent merges none. */
447
361
  variableStore?: VariableStore;
448
- /** Held run store for persisting protection rule holds. Optional -- if not set, holds are not persisted. */
362
+ /** Persists protection rule holds; absent persists none. */
449
363
  heldRunStore?: HeldRunStore;
450
- /**
451
- * Cache of the Platform-owned org trust policy. Read per PR event by the
452
- * trust-policy gate. Optional so existing tests and independent deployments
453
- * that construct deps by hand keep working.
454
- */
364
+ /** Cache of the Platform-owned org trust policy, read per PR event by the trust-policy gate. */
455
365
  trustPolicyStore?: TrustPolicyStore;
456
366
  /**
457
- * This orchestrator's mode. The trust-policy gate needs it to decide what an
458
- * absent policy means: Platform-attached modes fail closed (a push is
459
- * imminent), independent mode has no upstream authority and keeps legacy
460
- * behavior. Defaults to `'platform'` at the read site — the fail-closed side —
461
- * so a hand-built deps object never accidentally opens the gate.
367
+ * Decides what an absent trust policy means: Platform-attached modes fail closed
368
+ * (a push is imminent); independent mode has no upstream authority and keeps
369
+ * legacy behavior. The read site defaults to `'platform'` (fail-closed), so a
370
+ * hand-built deps object never opens the gate.
462
371
  */
463
372
  orchestratorMode?: OrchestratorMode;
464
- /** Identity links pushed from Platform, read by the comment-approval path. Optional -- defaults to empty. */
373
+ /** Platform-pushed identity links for the comment-approval path; defaults to empty. */
465
374
  identityLinks?: IdentityLink[];
466
- /** ci_trust permission levels per user ID from Platform push. Optional -- defaults to empty. */
375
+ /** Platform-pushed ci_trust levels per user ID; defaults to empty. */
467
376
  orgMemberPermissions?: Map<string, PermissionLevel>;
468
377
  /**
469
378
  * Persisted approval directory, read at `/kici approve` time when neither
470
379
  * `identityLinks` nor `orgMemberPermissions` was supplied.
471
380
  *
472
- * The two fields above are the Platform-push path: `server.ts` keeps them in
473
- * memory and refreshes them on every `trust_policy.update`, so it always
474
- * supplies both and this store is never consulted there. Every other
475
- * assembly of these deps — the direct-ingress pipeline in `app.ts`, which is
476
- * the ONLY one an independent orchestrator has — supplies neither, and
477
- * without this store its approval path would resolve an empty directory and
478
- * refuse every commenter forever.
479
- *
480
- * Optional so a hand-built deps object keeps working; the read is skipped
481
- * when it is absent.
381
+ * `server.ts` (the Platform-push path) always supplies both, so it never reads
382
+ * this. The direct-ingress pipeline in `app.ts` — the ONLY one an independent
383
+ * orchestrator has — supplies neither; without this store it would resolve an
384
+ * empty directory and refuse every commenter forever. Absent skips the read.
482
385
  */
483
386
  trustDirectoryStore?: TrustDirectoryStore;
484
- /** Global workflow policy for org-level permission enforcement. Optional -- if not set, global workflows are unrestricted. */
387
+ /** Org-level global workflow permissions; absent leaves global workflows unrestricted. */
485
388
  globalWorkflowPolicy?: GlobalWorkflowPolicy;
486
- /** Inbound webhook delivery log writer. Optional -- if not set, deliveries are not persisted to event_log. */
389
+ /** Delivery log; absent persists nothing to event_log. */
487
390
  eventLog?: EventLogRecorder;
488
- /** Where this delivery arrived: 'relay' (Platform WS) or 'direct' (HTTP).
489
- * Used by the eventLog writer to populate the source column. Defaults to
490
- * 'direct' when omitted (independent / direct paths). */
391
+ /** event_log source column: 'relay' (Platform WS) or 'direct' (HTTP, the default). */
491
392
  eventLogSource?: EventLogSource;
492
- /** Access-log writer for the orchestrator audit stream. Optional -- if not
493
- * set, hold-creation audit rows (`held_run.request`) are skipped. */
393
+ /** Audit stream; absent skips hold-creation rows (`held_run.request`). */
494
394
  accessLogWriter?: AccessLogWriter;
495
- /** Host roster store for runsOnAll fan-out resolution. Optional -- if not set,
496
- * runsOnAll jobs cannot be resolved and fail at materialize. */
395
+ /** runsOnAll fan-out resolution; absent makes runsOnAll jobs fail at materialize. */
497
396
  hostRosterStore?: HostRosterStore;
498
- /** This orchestrator instance id (for the cross-cluster host-fanout pin reroute). */
397
+ /** For the cross-cluster host-fanout pin reroute. */
499
398
  instanceId?: string;
500
- /** Static-host grace before a disconnected static host reads unreachable (ms). */
399
+ /** Grace before a disconnected static host reads unreachable (ms). */
501
400
  rosterGraceMs?: number;
502
- /** Cap on runsOnAll per-host children (default 1024). Cluster default; the
503
- * live per-cluster override is read from `cluster_settings.max_fanout_hosts`. */
401
+ /** Cap on runsOnAll per-host children (default 1024). Cluster default; live
402
+ * override `cluster_settings.max_fanout_hosts`. */
504
403
  maxFanoutHosts?: number;
505
- /** Reader for fleet-wide cluster tunables (max_fanout_hosts live override). */
404
+ /** Fleet-wide cluster tunables (max_fanout_hosts live override). */
506
405
  clusterSettings?: ClusterSettingsReader;
507
406
  }
508
407
  /**
509
- * Check if any trigger in the lock file workflows uses path filters.
510
- * Used to skip the changedFilesFetcher call when no path patterns are configured,
511
- * saving one provider API call per webhook.
408
+ * Does any trigger use path filters? When none does, the changedFilesFetcher call
409
+ * is skipped, saving one provider API call per webhook.
512
410
  */
513
411
  export declare function anyTriggerHasPathPatterns(workflows: LockWorkflow[]): boolean;
514
412
  export { processWebhook } from './process-webhook.js';
@@ -519,31 +417,23 @@ export declare const PENDING_HOLD_RETRY_BASE_MS = 25;
519
417
  /**
520
418
  * Is there a still-pending hold for this (run, job)?
521
419
  *
522
- * `held_runs.job_id` carries the expanded job NAME for job-scoped holds, which
523
- * is the same key the pending dispatch context uses. A missing row, or any
524
- * non-pending status, means nothing is gating the job.
420
+ * `held_runs.job_id` carries the expanded job NAME for job-scoped holds, the
421
+ * pending dispatch context's key. A missing row or non-pending status means
422
+ * nothing gates the job.
525
423
  *
526
- * **Fails CLOSED** once the read has genuinely failed: a job whose hold state
527
- * cannot be read is treated as held and left for the release path. This gate is
528
- * the enforcement point for "every requirement answered" on a job carrying two
529
- * holds — the reviewer row and the security row are written together and BOTH
530
- * must leave `pending` before dispatch — so answering `false` on a read error
531
- * dispatched a job with neither hold released and the approval boundary
532
- * bypassed entirely. That is unrecoverable; the failure in the other direction
533
- * is not.
424
+ * **Fails CLOSED** on a genuine read failure: the job is treated as held. This is
425
+ * the enforcement point for a job carrying two holds (reviewer and security rows,
426
+ * written together, BOTH must leave `pending`); answering `false` on error would
427
+ * dispatch with neither released, bypassing approval unrecoverably.
534
428
  *
535
- * A refusal leaves the job pending rather than losing it: the context is not
536
- * consumed (the check runs before the consume), every release path re-drives
537
- * `dispatchReadyJob`, and the needs-scheduler recovery loop on the next start
538
- * recomputes `needs_satisfied` for every non-terminal run and re-fires the
539
- * ready jobs. So the worst case of a closed failure is a delay, against a
540
- * silently bypassed approval for an open one.
429
+ * A refusal only delays: the context is not consumed (the check precedes the
430
+ * consume), every release path re-drives `dispatchReadyJob`, and the
431
+ * needs-scheduler recovery loop on the next start re-fires ready jobs of every
432
+ * non-terminal run.
541
433
  *
542
- * The retries are what keep that trade cheap. The realistic error here is a
543
- * transient one — a deadlock, a statement timeout, a lost connection — and a
544
- * single blip must not park a job until the next restart, so the read is
545
- * attempted {@link PENDING_HOLD_READ_ATTEMPTS} times with a short linear
546
- * backoff before the refusal stands.
434
+ * Transient errors (deadlock, statement timeout, lost connection) must not park a
435
+ * job until restart, so the read is tried {@link PENDING_HOLD_READ_ATTEMPTS} times
436
+ * with a short linear backoff first.
547
437
  */
548
438
  export declare function hasPendingHold(db: Kysely<Database>, runId: string, jobName: string, opts?: {
549
439
  attempts?: number;
@@ -554,14 +444,11 @@ export declare const NEEDS_READ_ATTEMPTS = 3;
554
444
  /** Linear backoff base between needs-verdict read attempts. */
555
445
  export declare const NEEDS_RETRY_BASE_MS = 25;
556
446
  /**
557
- * Read whether a job's `needs` upstreams are satisfied, for the dispatch guard.
447
+ * Are a job's `needs` upstreams satisfied? For the dispatch guard.
558
448
  *
559
- * Fails CLOSED, exactly as {@link hasPendingHold} does and for the same reason:
560
- * an unreadable verdict must never be read as permission to dispatch. A closed
561
- * failure returns `{ satisfied: false }`, which the guard treats as "upstream
562
- * still pending" — the recoverable branch, since the start-up recovery loop
563
- * recomputes `needs_satisfied` for every non-terminal run and re-fires its ready
564
- * jobs, and the stale-run expiry sweep is the backstop.
449
+ * Fails CLOSED like {@link hasPendingHold}: `{ satisfied: false }` reads as
450
+ * "upstream still pending", the recoverable branch (the start-up recovery loop
451
+ * re-fires ready jobs; the stale-run expiry sweep is the backstop).
565
452
  *
566
453
  * Reads only. It never writes `needs_satisfied` — the scheduler owns that claim.
567
454
  */
@@ -574,14 +461,12 @@ export declare function readNeedsVerdict(db: Kysely<Database>, runId: string, jo
574
461
  reason?: string;
575
462
  }>;
576
463
  /**
577
- * The subset of a context row the ready-dispatch re-gate reads.
464
+ * The raw (snake_case) `contexts` row subset the ready-dispatch re-gate reads.
578
465
  *
579
- * `ContextStore.matchContext` returns the raw `contexts` row, so the field names
580
- * are snake_case. `concurrency_strategy` and `hold_expiry_seconds` are optional
581
- * because the release-path callers already in the tree narrow their closure to
582
- * `concurrency_limit` alone; an absent strategy resolves to
583
- * {@link DEFAULT_CONCURRENCY_STRATEGY} and an absent hold window to
584
- * {@link DEFAULT_HOLD_EXPIRY_SECONDS}, which are also the columns' own defaults.
466
+ * `concurrency_strategy` and `hold_expiry_seconds` are optional because some
467
+ * release-path callers narrow their closure to `concurrency_limit`; absent values
468
+ * resolve to {@link DEFAULT_CONCURRENCY_STRATEGY} and
469
+ * {@link DEFAULT_HOLD_EXPIRY_SECONDS}, the columns' own defaults.
585
470
  */
586
471
  export interface ReadyDispatchContextRow {
587
472
  id: string;
@@ -594,18 +479,15 @@ export interface ReadyDispatchGateDeps {
594
479
  matchContext: (orgId: string, name: string) => Promise<ReadyDispatchContextRow | null>;
595
480
  heldRunStore: Pick<HeldRunStore, 'create'>;
596
481
  /**
597
- * Audits each re-hold, mirroring the `held_run.request` row the dispatch-pass
598
- * path writes for every hold it mints. Optional: a call site with no writer
599
- * still gates, exactly as the dispatch path's own `accessLogWriter?.record`
600
- * degrades.
482
+ * Audits each re-hold with the `held_run.request` row the dispatch pass writes.
483
+ * Without a writer the gate still gates.
601
484
  */
602
485
  accessLogWriter?: Pick<AccessLogWriter, 'record'>;
603
- /** The routing key the audit row is attributed to, when the call site knows it. */
486
+ /** Audit row attribution, when the call site knows it. */
604
487
  routingKey?: string | null;
605
488
  /**
606
- * The stores a released held job's context variables and secrets resolve
607
- * against. Called at release time, so a call site whose stores are built after
608
- * it is wired can still supply them.
489
+ * Stores for a released job's context variables and secrets. Called at release
490
+ * time, so stores built after wiring can still be supplied.
609
491
  */
610
492
  contextData?: () => ContextDataDeps;
611
493
  }
@@ -617,87 +499,59 @@ export interface RunConcurrency {
617
499
  limit: number | null;
618
500
  strategy: EngineContext['concurrencyStrategy'];
619
501
  /**
620
- * The context's own hold window, seconds. A queued hold this gate mints must
621
- * expire on the same schedule as one the dispatch pass mints for the same
622
- * context, or an operator's configured queue timeout applies to one path and
623
- * not the other.
502
+ * The context's hold window, seconds, so this gate's queued holds expire on the
503
+ * dispatch pass's schedule and the configured queue timeout applies to both.
624
504
  */
625
505
  holdExpirySeconds: number;
626
506
  }
627
507
  /**
628
- * Resolve a run's bound context to the inputs the concurrency gate needs.
629
- *
630
- * `null` means no concurrency constraint applies — the run has no bound context,
631
- * or the context it names no longer exists. That is the common case, so the cost
632
- * on the ready-dispatch path is one indexed lookup by `run_id`.
508
+ * Resolve a run's bound context to concurrency gate inputs. `null` (no bound
509
+ * context, or it no longer exists) is the common case, costing one indexed
510
+ * lookup by `run_id`.
633
511
  */
634
512
  export declare function resolveRunConcurrency(db: Kysely<Database>, matchContext: ReadyDispatchGateDeps['matchContext'], runId: string): Promise<RunConcurrency | null>;
635
513
  /**
636
- * Dispatch a job that has become ready via the needs scheduler.
637
- *
638
- * Called by the onJobReady callback registered on the execution tracker.
639
- * Consumes the pending dispatch context stored at processWebhook time,
640
- * dispatches the job through the normal dispatcher path, and updates the
641
- * execution tracker with the real job ID.
514
+ * Dispatch a job the needs scheduler made ready (the tracker's onJobReady
515
+ * callback): consume its pending context, dispatch normally, and record the real
516
+ * job ID.
642
517
  */
643
518
  export declare function dispatchReadyJob(runId: string, jobName: string, dispatcher: Dispatcher, executionTracker?: ExecutionTracker, coordinator?: RunCoordinator, db?: Kysely<Database>, invokeGateDeps?: InvokeGateDeps, gateDeps?: ReadyDispatchGateDeps): Promise<void>;
644
519
  /**
645
- * Read the repository's default branch out of a webhook payload.
646
- *
647
- * Resolution order:
648
- * 1. `normalizer.extractDefaultBranch?(payload)` — provider-specific hook
649
- * (universal-git reads a JSONPath from the source's `payloadPaths.defaultBranch`).
650
- * 2. Fallback to `payload.repository.default_branch` — the GitHub-shaped
651
- * default that most forges mirror.
652
- *
653
- * `null` when neither source names one. Shared by `isDefaultBranchPush` (which
654
- * compares it against the pushed branch) and the registration write path (which
655
- * persists it, so a scheduled run can present it as its own branch).
520
+ * The repository's default branch from a webhook payload:
521
+ * 1. `normalizer.extractDefaultBranch?(payload)` — provider hook (universal-git
522
+ * reads the source's `payloadPaths.defaultBranch` JSONPath);
523
+ * 2. `payload.repository.default_branch` — the GitHub shape most forges mirror;
524
+ * else `null`. The registration write path persists it, so a scheduled run can
525
+ * present it as its own branch.
656
526
  */
657
527
  export declare function extractDefaultBranch(payload: Record<string, unknown>, normalizer: WebhookNormalizer): string | null;
658
- /**
659
- * Check whether a webhook event is a push to the repository's default branch.
660
- * Used to trigger registration extraction for workflow event subscriptions.
661
- */
528
+ /** A push to the default branch triggers registration extraction for event subscriptions. */
662
529
  export declare function isDefaultBranchPush(info: WebhookInfo, event: SimulatedEvent, payload: Record<string, unknown>, normalizer: WebhookNormalizer): boolean;
663
530
  /**
664
- * Cap on the per-decision trace forwarded to the Platform.
665
- *
666
- * A fixed bound on a debug payload, not a behavior an operator tunes: the
667
- * summary rides an `execution.event` and lands in a stored row, so an
668
- * essay-length trace from a workflow with hundreds of triggers must not be able
669
- * to grow either without limit.
531
+ * Cap on the per-decision trace forwarded to the Platform. Fixed, not tunable: the
532
+ * summary rides an `execution.event` into a stored row, and hundreds of triggers
533
+ * must not grow either without limit.
670
534
  */
671
535
  export declare const DECISION_TRACE_MAX_CHECKS = 50;
672
536
  /**
673
- * Create a serializable summary of a workflow decision for Platform forwarding.
674
- *
675
- * Carries the individual checks, capped, so the dashboard can answer "why did
676
- * this workflow not fire" from the delivery alone. `checksCount` stays the
677
- * untruncated total, and `checksTruncated` marks a trace the cap shortened.
537
+ * Serializable workflow decision summary for the Platform. Carries the capped
538
+ * checks, so the dashboard answers "why did this not fire" from the delivery
539
+ * alone; `checksCount` is the untruncated total, `checksTruncated` marks a cut.
678
540
  */
679
541
  export declare function summarizeDecision(decision: WorkflowDecision): Record<string, unknown>;
680
542
  /**
681
- * Byte budget for the whole forwarded trace, across every workflow on the
682
- * delivery.
543
+ * Byte budget for the whole forwarded trace, across every workflow on the delivery.
683
544
  *
684
- * The per-decision check cap and the per-field text clamp bound one entry; this
685
- * bounds the frame. One event is evaluated against every workflow in the lock
686
- * file plus every organization-wide registration, so a repository with a
687
- * hundred comment-triggered workflows multiplies a bounded entry into an
688
- * unbounded message. A frame past the Platform's WebSocket payload ceiling
689
- * closes the orchestrator's connection, stalling every delivery for that
690
- * organization until it reconnects — so the budget sits well under the
691
- * Platform's own storage guard, which is then a backstop rather than the only
692
- * limit.
545
+ * The check cap and per-field clamp bound one entry; this bounds the frame, since
546
+ * one event is evaluated against every lock file workflow plus every org-wide
547
+ * registration. A frame past the Platform's WebSocket payload ceiling closes the
548
+ * connection, stalling every delivery for the org until reconnect, so the budget
549
+ * sits well under the Platform's storage guard, which stays a backstop.
693
550
  */
694
551
  export declare const DECISION_TRACE_MAX_BYTES = 131072;
695
552
  /**
696
- * Bound the serialized trace, replacing whatever did not fit with a marker.
697
- *
698
- * Truncating rather than dropping keeps the delivery's answer to "why did my
699
- * workflow not fire" partially readable, and says out loud that the rest was
700
- * dropped.
553
+ * Bound the serialized trace, replacing what did not fit with a marker: the answer
554
+ * stays partially readable and says the rest was dropped.
701
555
  */
702
556
  export declare function capDecisionSummaries(summaries: readonly Record<string, unknown>[], maxBytes?: number): Record<string, unknown>[];
703
557
  //# sourceMappingURL=processor.d.ts.map