@kici-dev/orchestrator 0.0.0 → 0.1.2

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 (342) hide show
  1. package/LICENSE +661 -0
  2. package/README.md +1 -6
  3. package/dist/__test-helpers__/mock-db.d.ts +103 -0
  4. package/dist/__test-helpers__/mock-ws.d.ts +13 -0
  5. package/dist/agent/dispatcher.d.ts +231 -0
  6. package/dist/agent/ownership-tracker.d.ts +46 -0
  7. package/dist/agent/registry.d.ts +255 -0
  8. package/dist/agent/token-store.d.ts +96 -0
  9. package/dist/app.d.ts +234 -0
  10. package/dist/audit/access-log.d.ts +92 -0
  11. package/dist/audit/sampling-rate-limiter.d.ts +41 -0
  12. package/dist/cache/build-coordinator.d.ts +42 -0
  13. package/dist/cache/dep-cache.d.ts +51 -0
  14. package/dist/cache/index.d.ts +16 -0
  15. package/dist/cache/pending-builds.d.ts +14 -0
  16. package/dist/cache/pending-dynamics.d.ts +15 -0
  17. package/dist/cache/pending-inits.d.ts +19 -0
  18. package/dist/cache/pending-tracker.d.ts +65 -0
  19. package/dist/cache/source-cache.d.ts +30 -0
  20. package/dist/cli/api-client.d.ts +411 -0
  21. package/dist/cli/commands/access-log.d.ts +30 -0
  22. package/dist/cli/commands/agent-service/index.d.ts +15 -0
  23. package/dist/cli/commands/agent-service/install.d.ts +9 -0
  24. package/dist/cli/commands/agent-service/logs.d.ts +9 -0
  25. package/dist/cli/commands/agent-service/restart.d.ts +8 -0
  26. package/dist/cli/commands/agent-service/start.d.ts +8 -0
  27. package/dist/cli/commands/agent-service/status.d.ts +10 -0
  28. package/dist/cli/commands/agent-service/stop.d.ts +8 -0
  29. package/dist/cli/commands/agent-service/uninstall.d.ts +9 -0
  30. package/dist/cli/commands/agent-service/upgrade.d.ts +11 -0
  31. package/dist/cli/commands/agent.d.ts +10 -0
  32. package/dist/cli/commands/api-key.d.ts +12 -0
  33. package/dist/cli/commands/audit.d.ts +9 -0
  34. package/dist/cli/commands/backend.d.ts +17 -0
  35. package/dist/cli/commands/cold-store-impl.d.ts +101 -0
  36. package/dist/cli/commands/cold-store.d.ts +30 -0
  37. package/dist/cli/commands/config.d.ts +16 -0
  38. package/dist/cli/commands/db.d.ts +19 -0
  39. package/dist/cli/commands/debug-bundle.d.ts +16 -0
  40. package/dist/cli/commands/diagnose.d.ts +15 -0
  41. package/dist/cli/commands/environment.d.ts +24 -0
  42. package/dist/cli/commands/event-dlq.d.ts +19 -0
  43. package/dist/cli/commands/event-log.d.ts +27 -0
  44. package/dist/cli/commands/event.d.ts +4 -0
  45. package/dist/cli/commands/execution.d.ts +17 -0
  46. package/dist/cli/commands/inspect-bundle.d.ts +16 -0
  47. package/dist/cli/commands/maintenance.d.ts +4 -0
  48. package/dist/cli/commands/orchestrator-service/index.d.ts +12 -0
  49. package/dist/cli/commands/orchestrator-service/install.d.ts +10 -0
  50. package/dist/cli/commands/orchestrator-service/logs.d.ts +10 -0
  51. package/dist/cli/commands/orchestrator-service/restart.d.ts +8 -0
  52. package/dist/cli/commands/orchestrator-service/start.d.ts +8 -0
  53. package/dist/cli/commands/orchestrator-service/status.d.ts +10 -0
  54. package/dist/cli/commands/orchestrator-service/stop.d.ts +8 -0
  55. package/dist/cli/commands/orchestrator-service/uninstall.d.ts +9 -0
  56. package/dist/cli/commands/orchestrator-service/upgrade.d.ts +12 -0
  57. package/dist/cli/commands/org-settings.d.ts +17 -0
  58. package/dist/cli/commands/peer.d.ts +13 -0
  59. package/dist/cli/commands/queue.d.ts +16 -0
  60. package/dist/cli/commands/registration.d.ts +18 -0
  61. package/dist/cli/commands/rotate.d.ts +9 -0
  62. package/dist/cli/commands/runs.d.ts +34 -0
  63. package/dist/cli/commands/secret.d.ts +12 -0
  64. package/dist/cli/commands/shared/db.d.ts +16 -0
  65. package/dist/cli/commands/shared/versioned-upgrade.d.ts +38 -0
  66. package/dist/cli/commands/source.d.ts +24 -0
  67. package/dist/cli/commands/token.d.ts +10 -0
  68. package/dist/cli/commands/workflow.d.ts +31 -0
  69. package/dist/cli/join.d.ts +14 -0
  70. package/dist/cli/kici-admin.d.ts +13 -0
  71. package/dist/cli/lazy-deps/cache.d.ts +17 -0
  72. package/dist/cli/lazy-deps/downloader.d.ts +33 -0
  73. package/dist/cli/lazy-deps/registry.d.ts +43 -0
  74. package/dist/cli/service/compose.d.ts +25 -0
  75. package/dist/cli/service/index.d.ts +24 -0
  76. package/dist/cli/service/launchd.d.ts +34 -0
  77. package/dist/cli/service/platform-detect.d.ts +59 -0
  78. package/dist/cli/service/systemd.d.ts +41 -0
  79. package/dist/cli/service/types.d.ts +91 -0
  80. package/dist/cli/service/windows.d.ts +20 -0
  81. package/dist/cli/wizard/agent-wizard.d.ts +24 -0
  82. package/dist/cli/wizard/orchestrator-wizard.d.ts +38 -0
  83. package/dist/cli/wizard/prompts.d.ts +23 -0
  84. package/dist/cli.js +11435 -0
  85. package/dist/cluster/cluster-identity.d.ts +59 -0
  86. package/dist/cluster/coordinator.d.ts +204 -0
  87. package/dist/cluster/health-api.d.ts +30 -0
  88. package/dist/cluster/index.d.ts +24 -0
  89. package/dist/cluster/join-client.d.ts +75 -0
  90. package/dist/cluster/join-handler.d.ts +58 -0
  91. package/dist/cluster/join-token.d.ts +94 -0
  92. package/dist/cluster/orphan-recovery.d.ts +67 -0
  93. package/dist/cluster/peer-client.d.ts +190 -0
  94. package/dist/cluster/peer-credentials.d.ts +108 -0
  95. package/dist/cluster/peer-crypto.d.ts +57 -0
  96. package/dist/cluster/peer-handler.d.ts +97 -0
  97. package/dist/cluster/peer-registry.d.ts +186 -0
  98. package/dist/cluster/raft-state.d.ts +36 -0
  99. package/dist/cluster/raft.d.ts +140 -0
  100. package/dist/cold-store/load-access-log-range.d.ts +73 -0
  101. package/dist/cold-store/load-event-log-range.d.ts +62 -0
  102. package/dist/cold-store/load-secret-audit-log-range.d.ts +38 -0
  103. package/dist/cold-store/orchestrator-cold-store.d.ts +58 -0
  104. package/dist/cold-store/tables/access-log.d.ts +80 -0
  105. package/dist/cold-store/tables/event-log.d.ts +70 -0
  106. package/dist/cold-store/tables/execution-jobs.d.ts +63 -0
  107. package/dist/cold-store/tables/execution-runs.d.ts +81 -0
  108. package/dist/cold-store/tables/execution-steps.d.ts +65 -0
  109. package/dist/cold-store/tables/secret-audit-log.d.ts +77 -0
  110. package/dist/concurrency/dispatch-next-queued.d.ts +63 -0
  111. package/dist/concurrency/group-tracker.d.ts +51 -0
  112. package/dist/concurrency/index.d.ts +3 -0
  113. package/dist/concurrency/queue-manager.d.ts +68 -0
  114. package/dist/concurrency/waiters.d.ts +58 -0
  115. package/dist/config/encryption.d.ts +82 -0
  116. package/dist/config/env-overlay.d.ts +45 -0
  117. package/dist/config/index.d.ts +16 -0
  118. package/dist/config/loader.d.ts +26 -0
  119. package/dist/config/reload.d.ts +113 -0
  120. package/dist/config/resolver.d.ts +47 -0
  121. package/dist/config/schema.d.ts +210 -0
  122. package/dist/config/shared-store.d.ts +142 -0
  123. package/dist/config/types.d.ts +218 -0
  124. package/dist/config.d.ts +249 -0
  125. package/dist/cron/cron-scheduler.d.ts +78 -0
  126. package/dist/cron/cron-store.d.ts +38 -0
  127. package/dist/dashboard/handler.d.ts +243 -0
  128. package/dist/db/client.d.ts +13 -0
  129. package/dist/db/migration-provider.d.ts +9 -0
  130. package/dist/db/migrations/001_initial.d.ts +8 -0
  131. package/dist/db/migrations/002_config_versions_key_version.d.ts +16 -0
  132. package/dist/db/migrations/003_access_log.d.ts +26 -0
  133. package/dist/db/migrations/004_rename_bundle_to_source.d.ts +19 -0
  134. package/dist/db/migrations/005_cold_store_chunk_counter.d.ts +19 -0
  135. package/dist/db/migrations/006_runs_jobs_steps_archived_at.d.ts +38 -0
  136. package/dist/db/migrations/007_audit_logs_archived_at.d.ts +42 -0
  137. package/dist/db/migrations/008_event_log_archived_at.d.ts +40 -0
  138. package/dist/db/migrations/009_access_log_trigram.d.ts +15 -0
  139. package/dist/db/migrations/010_cold_store_chunks.d.ts +34 -0
  140. package/dist/db/migrations/011_drop_source_secrets_notify.d.ts +21 -0
  141. package/dist/db/migrations/012_peer_credentials_active_uniq.d.ts +28 -0
  142. package/dist/db/migrations/013_execution_log_bytes.d.ts +21 -0
  143. package/dist/db/migrations/014_kici_events_lease_retry.d.ts +36 -0
  144. package/dist/db/migrations/015_org_settings_customer_scoped.d.ts +30 -0
  145. package/dist/db/migrations/016_org_settings_allow_http_npm.d.ts +15 -0
  146. package/dist/db/migrations/017_org_id_widen.d.ts +4 -0
  147. package/dist/db/migrations/018_org_id_prefix_backfill.d.ts +4 -0
  148. package/dist/db/migrator.d.ts +32 -0
  149. package/dist/db/types.d.ts +1266 -0
  150. package/dist/diagnostics/bundle-reader.d.ts +48 -0
  151. package/dist/diagnostics/bundle-writer.d.ts +57 -0
  152. package/dist/diagnostics/checks/agents.d.ts +10 -0
  153. package/dist/diagnostics/checks/certs.d.ts +9 -0
  154. package/dist/diagnostics/checks/config.d.ts +10 -0
  155. package/dist/diagnostics/checks/db.d.ts +9 -0
  156. package/dist/diagnostics/checks/disk.d.ts +9 -0
  157. package/dist/diagnostics/checks/index.d.ts +17 -0
  158. package/dist/diagnostics/checks/ws.d.ts +9 -0
  159. package/dist/diagnostics/index.d.ts +13 -0
  160. package/dist/diagnostics/runner.d.ts +23 -0
  161. package/dist/diagnostics/types.d.ts +38 -0
  162. package/dist/entry-helpers.d.ts +93 -0
  163. package/dist/environments/binding-store.d.ts +27 -0
  164. package/dist/environments/environment-store.d.ts +74 -0
  165. package/dist/environments/held-runs.d.ts +64 -0
  166. package/dist/environments/index.d.ts +10 -0
  167. package/dist/environments/protection/branch-gate.d.ts +5 -0
  168. package/dist/environments/protection/concurrency-gate.d.ts +7 -0
  169. package/dist/environments/protection/pipeline.d.ts +18 -0
  170. package/dist/environments/protection/reviewer-gate.d.ts +7 -0
  171. package/dist/environments/protection/trust-gate.d.ts +7 -0
  172. package/dist/environments/protection/wait-timer-gate.d.ts +7 -0
  173. package/dist/environments/variable-store.d.ts +39 -0
  174. package/dist/events/circuit-breaker.d.ts +33 -0
  175. package/dist/events/event-emitter.d.ts +55 -0
  176. package/dist/events/event-retry-scanner.d.ts +52 -0
  177. package/dist/events/event-router.d.ts +183 -0
  178. package/dist/events/event-store.d.ts +157 -0
  179. package/dist/events/trust-store.d.ts +54 -0
  180. package/dist/events/types.d.ts +61 -0
  181. package/dist/helpers/ip-extraction.d.ts +29 -0
  182. package/dist/helpers/rate-limiter.d.ts +23 -0
  183. package/dist/index.d.ts +7 -0
  184. package/dist/index.js +772 -0
  185. package/dist/lockfile-cache.d.ts +39 -0
  186. package/dist/metrics/agent-metrics-aggregator.d.ts +116 -0
  187. package/dist/metrics/metrics-reporter.d.ts +40 -0
  188. package/dist/metrics/prometheus.d.ts +261 -0
  189. package/dist/metrics/scheduled-jobs.d.ts +20 -0
  190. package/dist/orchestrator-core.d.ts +193 -0
  191. package/dist/pipeline/dispatch-matched-workflow.d.ts +102 -0
  192. package/dist/pipeline/inline-eval.d.ts +28 -0
  193. package/dist/pipeline/install-secrets-resolver.d.ts +73 -0
  194. package/dist/pipeline/manual-schedule.d.ts +21 -0
  195. package/dist/pipeline/needs-scheduler.d.ts +85 -0
  196. package/dist/pipeline/process-webhook.d.ts +38 -0
  197. package/dist/pipeline/processor.d.ts +326 -0
  198. package/dist/pipeline/rerun.d.ts +79 -0
  199. package/dist/pipeline/test-pipeline.d.ts +110 -0
  200. package/dist/provider-registry.d.ts +122 -0
  201. package/dist/providers/generic/index.d.ts +23 -0
  202. package/dist/providers/generic/normalizer.d.ts +112 -0
  203. package/dist/providers/generic/verification.d.ts +47 -0
  204. package/dist/providers/github/auth.d.ts +60 -0
  205. package/dist/providers/github/changed-files.d.ts +51 -0
  206. package/dist/providers/github/check-status-poster.d.ts +35 -0
  207. package/dist/providers/github/contributor-resolver.d.ts +30 -0
  208. package/dist/providers/github/index.d.ts +20 -0
  209. package/dist/providers/github/lock-file.d.ts +32 -0
  210. package/dist/providers/github/normalizer.d.ts +103 -0
  211. package/dist/providers/github/repo-url.d.ts +35 -0
  212. package/dist/providers/internal/index.d.ts +32 -0
  213. package/dist/providers/internal/lock-file-fetcher.d.ts +34 -0
  214. package/dist/providers/internal/normalizer.d.ts +89 -0
  215. package/dist/providers/internal/repo-url-builder.d.ts +42 -0
  216. package/dist/providers/universal-git/changed-files.d.ts +42 -0
  217. package/dist/providers/universal-git/clone-token.d.ts +83 -0
  218. package/dist/providers/universal-git/config.d.ts +192 -0
  219. package/dist/providers/universal-git/index.d.ts +55 -0
  220. package/dist/providers/universal-git/lock-file.d.ts +71 -0
  221. package/dist/providers/universal-git/normalizer.d.ts +90 -0
  222. package/dist/providers/universal-git/repo-url.d.ts +50 -0
  223. package/dist/providers/universal-git/ssh-auth.d.ts +94 -0
  224. package/dist/queue/bootstrap.d.ts +50 -0
  225. package/dist/queue/cleanup.d.ts +41 -0
  226. package/dist/queue/depth-refresher.d.ts +65 -0
  227. package/dist/queue/job-queue.d.ts +343 -0
  228. package/dist/queue/scheduled-job.d.ts +91 -0
  229. package/dist/registration/extractor.d.ts +44 -0
  230. package/dist/registration/registration-index.d.ts +162 -0
  231. package/dist/registration/registration-store.d.ts +111 -0
  232. package/dist/reporting/check-run-summary.d.ts +102 -0
  233. package/dist/reporting/commit-status.d.ts +382 -0
  234. package/dist/reporting/execution-tracker.d.ts +538 -0
  235. package/dist/reporting/fs-log-storage.d.ts +41 -0
  236. package/dist/reporting/log-pull-handler.d.ts +35 -0
  237. package/dist/reporting/log-storage.d.ts +70 -0
  238. package/dist/reporting/log-writer.d.ts +45 -0
  239. package/dist/reporting/s3-log-storage.d.ts +42 -0
  240. package/dist/reporting/step-log-buffer.d.ts +57 -0
  241. package/dist/routes/admin-access-log.d.ts +34 -0
  242. package/dist/routes/admin-backends.d.ts +28 -0
  243. package/dist/routes/admin-config.d.ts +57 -0
  244. package/dist/routes/admin-db.d.ts +20 -0
  245. package/dist/routes/admin-environments.d.ts +42 -0
  246. package/dist/routes/admin-errors.d.ts +4 -0
  247. package/dist/routes/admin-event-dlq.d.ts +39 -0
  248. package/dist/routes/admin-event-log.d.ts +42 -0
  249. package/dist/routes/admin-events.d.ts +46 -0
  250. package/dist/routes/admin-maintenance.d.ts +22 -0
  251. package/dist/routes/admin-org-settings.d.ts +29 -0
  252. package/dist/routes/admin-queue-execution.d.ts +27 -0
  253. package/dist/routes/admin-registrations.d.ts +37 -0
  254. package/dist/routes/admin-runs.d.ts +57 -0
  255. package/dist/routes/admin-scheduled-jobs.d.ts +36 -0
  256. package/dist/routes/admin-sources.d.ts +18 -0
  257. package/dist/routes/admin.d.ts +103 -0
  258. package/dist/routes/capabilities.d.ts +24 -0
  259. package/dist/routes/diagnostics.d.ts +16 -0
  260. package/dist/routes/health.d.ts +20 -0
  261. package/dist/routes/test-trigger.d.ts +41 -0
  262. package/dist/routes/uploads.d.ts +38 -0
  263. package/dist/routes/webhooks.d.ts +36 -0
  264. package/dist/scaler/bare-metal-backend.d.ts +107 -0
  265. package/dist/scaler/config.d.ts +303 -0
  266. package/dist/scaler/container-backend.d.ts +125 -0
  267. package/dist/scaler/file-tail.d.ts +23 -0
  268. package/dist/scaler/firecracker-api.d.ts +100 -0
  269. package/dist/scaler/firecracker-backend.d.ts +263 -0
  270. package/dist/scaler/index.d.ts +24 -0
  271. package/dist/scaler/ip-allocator.d.ts +177 -0
  272. package/dist/scaler/label-matcher.d.ts +73 -0
  273. package/dist/scaler/log-forwarder.d.ts +54 -0
  274. package/dist/scaler/machine-ledger.d.ts +160 -0
  275. package/dist/scaler/manager.d.ts +338 -0
  276. package/dist/scaler/nftables.d.ts +85 -0
  277. package/dist/scaler/types.d.ts +388 -0
  278. package/dist/scaler/warm-pool.d.ts +81 -0
  279. package/dist/secrets/audit-logger.d.ts +65 -0
  280. package/dist/secrets/backend-health.d.ts +60 -0
  281. package/dist/secrets/backend-registry.d.ts +68 -0
  282. package/dist/secrets/backend-sync.d.ts +40 -0
  283. package/dist/secrets/cleanup.d.ts +40 -0
  284. package/dist/secrets/config.d.ts +51 -0
  285. package/dist/secrets/crypto.d.ts +49 -0
  286. package/dist/secrets/ephemeral-keys.d.ts +49 -0
  287. package/dist/secrets/index.d.ts +17 -0
  288. package/dist/secrets/pg-secret-store.d.ts +105 -0
  289. package/dist/secrets/rbac.d.ts +47 -0
  290. package/dist/secrets/secret-output-store.d.ts +46 -0
  291. package/dist/secrets/secret-resolver.d.ts +137 -0
  292. package/dist/secrets/source-credentials.d.ts +61 -0
  293. package/dist/secrets/token-manager.d.ts +63 -0
  294. package/dist/secrets/vault-secret-store.d.ts +85 -0
  295. package/dist/security/comment-handler.d.ts +67 -0
  296. package/dist/security/contributor-cache.d.ts +75 -0
  297. package/dist/security/global-workflow-policy.d.ts +72 -0
  298. package/dist/security/lock-source.d.ts +34 -0
  299. package/dist/security/trust-resolver.d.ts +108 -0
  300. package/dist/security/workflow-diff.d.ts +26 -0
  301. package/dist/server.d.ts +17 -0
  302. package/dist/server.js +48055 -0
  303. package/dist/sources/index.d.ts +10 -0
  304. package/dist/sources/source-manager.d.ts +63 -0
  305. package/dist/sources/source-store.d.ts +79 -0
  306. package/dist/sources/source-validator.d.ts +16 -0
  307. package/dist/stale-detector/stale-run-detector.d.ts +109 -0
  308. package/dist/standalone.d.ts +20 -0
  309. package/dist/standalone.js +41546 -0
  310. package/dist/storage/blob-routes.d.ts +20 -0
  311. package/dist/storage/filesystem.d.ts +60 -0
  312. package/dist/storage/index.d.ts +20 -0
  313. package/dist/storage/s3.d.ts +68 -0
  314. package/dist/storage/sign-url.d.ts +45 -0
  315. package/dist/storage/types.d.ts +98 -0
  316. package/dist/webhook/dedup.d.ts +44 -0
  317. package/dist/webhook/event-log.d.ts +83 -0
  318. package/dist/webhook/generic-sources.d.ts +169 -0
  319. package/dist/webhook/handler.d.ts +23 -0
  320. package/dist/webhook/relay-buffer.d.ts +96 -0
  321. package/dist/webhook/verify-inbound.d.ts +78 -0
  322. package/dist/worker/in-memory-execution-tracker.d.ts +94 -0
  323. package/dist/worker/in-memory-job-queue.d.ts +74 -0
  324. package/dist/worker/static-agent-token-store.d.ts +58 -0
  325. package/dist/worker/worker-status.d.ts +36 -0
  326. package/dist/worker-core.d.ts +74 -0
  327. package/dist/ws/agent-api-registry.d.ts +49 -0
  328. package/dist/ws/agent-handler.d.ts +176 -0
  329. package/dist/ws/agent-heartbeat.d.ts +45 -0
  330. package/dist/ws/dashboard-backends-handler.d.ts +51 -0
  331. package/dist/ws/dashboard-diagnostics-handler.d.ts +56 -0
  332. package/dist/ws/dashboard-env-handler.d.ts +107 -0
  333. package/dist/ws/dashboard-global-workflows-handler.d.ts +72 -0
  334. package/dist/ws/dashboard-registrations-handler.d.ts +84 -0
  335. package/dist/ws/event-buffer.d.ts +16 -0
  336. package/dist/ws/observer-handler.d.ts +42 -0
  337. package/dist/ws/observer-registry.d.ts +88 -0
  338. package/dist/ws/platform-client.d.ts +270 -0
  339. package/dist/ws/server-options.d.ts +15 -0
  340. package/package.json +87 -7
  341. package/sbom.spdx.json +14370 -0
  342. package/index.js +0 -3
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Debug bundle reader.
3
+ *
4
+ * Parses a diagnostic ZIP bundle and returns a structured summary
5
+ * for the inspect-bundle CLI command. Works offline -- no network
6
+ * access or running orchestrator needed.
7
+ */
8
+ export interface BundleManifest {
9
+ version: string;
10
+ generated_at: string;
11
+ orchestrator_id?: string;
12
+ source?: string;
13
+ node_version: string;
14
+ platform: string;
15
+ }
16
+ export interface BundleSummary {
17
+ /** Bundle metadata. */
18
+ manifest: BundleManifest;
19
+ /** Diagnostic check results from the bundle. */
20
+ checkResults: Array<{
21
+ name: string;
22
+ status: 'pass' | 'warn' | 'fail';
23
+ message: string;
24
+ durationMs: number;
25
+ }>;
26
+ /** Number of checks that failed. */
27
+ errorCount: number;
28
+ /** Number of checks that warned. */
29
+ warningCount: number;
30
+ /** System information from the bundle. */
31
+ systemInfo: Record<string, unknown>;
32
+ /** Detected config issues (missing required fields, etc.). */
33
+ configIssues: string[];
34
+ /** Log file statistics (if logs were included). */
35
+ logSummary?: {
36
+ totalLines: number;
37
+ errors: number;
38
+ warnings: number;
39
+ };
40
+ }
41
+ /**
42
+ * Read and parse a debug bundle ZIP file.
43
+ *
44
+ * @param zipPath - Path to the ZIP file to parse
45
+ * @returns Structured summary of the bundle contents
46
+ */
47
+ export declare function readDebugBundle(zipPath: string): Promise<BundleSummary>;
48
+ //# sourceMappingURL=bundle-reader.d.ts.map
@@ -0,0 +1,57 @@
1
+ /**
2
+ * Debug bundle writer.
3
+ *
4
+ * Creates a sanitized ZIP diagnostic bundle containing config (secrets redacted),
5
+ * recent logs, system info, metrics, cluster state, and execution data.
6
+ * This is the primary support tool -- operators run debug-bundle and share
7
+ * the ZIP for troubleshooting.
8
+ */
9
+ import archiver from 'archiver';
10
+ import type { DiagnosticDeps } from './types.js';
11
+ export interface BundleOptions {
12
+ /** Where to write the ZIP. */
13
+ outputPath: string;
14
+ /** Orchestrator instance identifier. */
15
+ orchestratorId: string;
16
+ /** Raw orchestrator config (will be redacted). */
17
+ config: Record<string, unknown>;
18
+ /** Path to log files directory. */
19
+ logDir?: string;
20
+ /** Hours of logs to include (default: 4). */
21
+ logWindow?: number;
22
+ /** Dependencies for running diagnostic checks. */
23
+ diagnosticDeps: DiagnosticDeps;
24
+ /** URL for cluster health endpoint. */
25
+ clusterHealthUrl?: string;
26
+ /** URL for recent runs endpoint. */
27
+ recentRunsUrl?: string;
28
+ }
29
+ /**
30
+ * Redact config values using allowlist approach.
31
+ * Only known-safe fields are preserved; everything else becomes "****".
32
+ */
33
+ export declare function redactConfig(obj: unknown, parentKey?: string): unknown;
34
+ /**
35
+ * Create a debug bundle ZIP file.
36
+ *
37
+ * The bundle contains:
38
+ * - manifest.json: version, timestamp, orchestrator ID
39
+ * - config/config.json: redacted configuration
40
+ * - system/info.json: OS, Node, CPU, memory info
41
+ * - diagnostics/results.json: health check results
42
+ * - logs/: recent log files (if logDir provided)
43
+ * - logs/summary.json: log statistics
44
+ */
45
+ export declare function createDebugBundle(options: BundleOptions): Promise<string>;
46
+ /**
47
+ * Add log files from logDir to the archive, respecting MAX_LOG_BYTES cap
48
+ * and the logWindow time filter. Matches any `*.log` file in the directory,
49
+ * so the per-instance filename pattern produced by
50
+ * `buildLogFilename()` is picked up without additional configuration.
51
+ *
52
+ * Exported for reuse by the `kici-admin debug-bundle` CLI command, which
53
+ * runs outside the orchestrator process but still needs to include the
54
+ * same log files in its locally-assembled bundle.
55
+ */
56
+ export declare function addLogsToArchive(archive: archiver.Archiver, logDir: string, logWindowHours: number): Promise<void>;
57
+ //# sourceMappingURL=bundle-writer.d.ts.map
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Agent connectivity diagnostic check.
3
+ *
4
+ * Reads the agent registry count and reports whether any agents
5
+ * are connected. Zero agents is a warning (not failure) since
6
+ * agents may be scaling up.
7
+ */
8
+ import type { DiagnosticDeps, DiagnosticResult } from '../types.js';
9
+ export declare function checkAgentConnectivity(deps: DiagnosticDeps): Promise<DiagnosticResult>;
10
+ //# sourceMappingURL=agents.d.ts.map
@@ -0,0 +1,9 @@
1
+ /**
2
+ * TLS certificate expiry diagnostic check.
3
+ *
4
+ * Reads a TLS certificate from the configured path and checks
5
+ * the not-after date. Warns if expiring within 30 days, fails if expired.
6
+ */
7
+ import type { DiagnosticDeps, DiagnosticResult } from '../types.js';
8
+ export declare function checkCertificateExpiry(deps: DiagnosticDeps): Promise<DiagnosticResult>;
9
+ //# sourceMappingURL=certs.d.ts.map
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Config validity diagnostic check.
3
+ *
4
+ * Validates the current orchestrator config against key required fields.
5
+ * Uses a lightweight validation (not the full Zod schema) to avoid
6
+ * importing the entire config module.
7
+ */
8
+ import type { DiagnosticDeps, DiagnosticResult } from '../types.js';
9
+ export declare function checkConfigValidity(deps: DiagnosticDeps): Promise<DiagnosticResult>;
10
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Database connectivity diagnostic check.
3
+ *
4
+ * Runs a simple SELECT 1 query to verify the database is reachable
5
+ * and reports latency.
6
+ */
7
+ import type { DiagnosticDeps, DiagnosticResult } from '../types.js';
8
+ export declare function checkDbConnectivity(deps: DiagnosticDeps): Promise<DiagnosticResult>;
9
+ //# sourceMappingURL=db.d.ts.map
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Disk space diagnostic check.
3
+ *
4
+ * Uses `df` command to check available disk space on the root partition.
5
+ * Thresholds: warn < 1GB, fail < 100MB.
6
+ */
7
+ import type { DiagnosticDeps, DiagnosticResult } from '../types.js';
8
+ export declare function checkDiskSpace(_deps: DiagnosticDeps): Promise<DiagnosticResult>;
9
+ //# sourceMappingURL=disk.d.ts.map
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Diagnostic check registry.
3
+ *
4
+ * Exports the array of all diagnostic check functions
5
+ * in the order they should be displayed.
6
+ */
7
+ import type { DiagnosticCheck } from '../types.js';
8
+ import { checkDbConnectivity } from './db.js';
9
+ import { checkWsToPlatform } from './ws.js';
10
+ import { checkAgentConnectivity } from './agents.js';
11
+ import { checkDiskSpace } from './disk.js';
12
+ import { checkConfigValidity } from './config.js';
13
+ import { checkCertificateExpiry } from './certs.js';
14
+ /** All diagnostic checks in display order. */
15
+ export declare const defaultChecks: DiagnosticCheck[];
16
+ export { checkDbConnectivity, checkWsToPlatform, checkAgentConnectivity, checkDiskSpace, checkConfigValidity, checkCertificateExpiry, };
17
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Platform WebSocket connectivity diagnostic check.
3
+ *
4
+ * Attempts an HTTP(S) request to the Platform URL health endpoint
5
+ * to verify the relay is reachable.
6
+ */
7
+ import type { DiagnosticDeps, DiagnosticResult } from '../types.js';
8
+ export declare function checkWsToPlatform(deps: DiagnosticDeps): Promise<DiagnosticResult>;
9
+ //# sourceMappingURL=ws.d.ts.map
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Diagnostics module.
3
+ *
4
+ * Re-exports all diagnostic types, runner, checks, bundle writer, and bundle reader.
5
+ */
6
+ export type { DiagnosticResult, DiagnosticDeps, DiagnosticCheck } from './types.js';
7
+ export { runDiagnostics } from './runner.js';
8
+ export type { RunDiagnosticsOptions } from './runner.js';
9
+ export { createDebugBundle, redactConfig } from './bundle-writer.js';
10
+ export type { BundleOptions } from './bundle-writer.js';
11
+ export { readDebugBundle } from './bundle-reader.js';
12
+ export type { BundleSummary, BundleManifest } from './bundle-reader.js';
13
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Diagnostic check runner.
3
+ *
4
+ * Executes all diagnostic checks in parallel with timeout safety.
5
+ * Each check runs independently -- a failing or timing out check
6
+ * does not prevent other checks from completing.
7
+ */
8
+ import type { DiagnosticCheck, DiagnosticDeps, DiagnosticResult } from './types.js';
9
+ /** Options for the diagnostic runner. */
10
+ export interface RunDiagnosticsOptions {
11
+ /** Timeout per check in milliseconds. Default: 5000. */
12
+ timeoutMs?: number;
13
+ }
14
+ /**
15
+ * Run all diagnostic checks and return results.
16
+ *
17
+ * @param deps - Dependencies available to checks
18
+ * @param checks - Array of check functions (defaults to all 6 checks)
19
+ * @param options - Runner options (timeout, etc.)
20
+ * @returns Array of diagnostic results, one per check
21
+ */
22
+ export declare function runDiagnostics(deps: DiagnosticDeps, checks?: DiagnosticCheck[], options?: RunDiagnosticsOptions): Promise<DiagnosticResult[]>;
23
+ //# sourceMappingURL=runner.d.ts.map
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Diagnostic health check types.
3
+ *
4
+ * Defines the shape of diagnostic results and check functions
5
+ * used by the diagnostic runner and CLI/HTTP interfaces.
6
+ */
7
+ import type { Kysely } from 'kysely';
8
+ import type { Database } from '../db/types.js';
9
+ import type { AgentRegistry } from '../agent/registry.js';
10
+ /** Result of a single diagnostic check. */
11
+ export interface DiagnosticResult {
12
+ /** Human-readable check name (e.g., "Database connectivity"). */
13
+ name: string;
14
+ /** Check outcome: pass, warn, or fail. */
15
+ status: 'pass' | 'warn' | 'fail';
16
+ /** Short description of the result. */
17
+ message: string;
18
+ /** Optional structured details for debugging. */
19
+ details?: Record<string, unknown>;
20
+ /** How long the check took to run in milliseconds. */
21
+ durationMs: number;
22
+ }
23
+ /** Dependencies available to diagnostic checks. */
24
+ export interface DiagnosticDeps {
25
+ /** DB connection (optional -- standalone mode may not have DB). */
26
+ db?: Kysely<Database>;
27
+ /** Platform WS URL (for connectivity check). */
28
+ platformUrl?: string;
29
+ /** Agent registry for checking connected agents. */
30
+ agentRegistry?: AgentRegistry;
31
+ /** Orchestrator config (for config validity check). */
32
+ config: Record<string, unknown>;
33
+ /** TLS cert path (for expiry check). */
34
+ tlsCertPath?: string;
35
+ }
36
+ /** A diagnostic check function. */
37
+ export type DiagnosticCheck = (deps: DiagnosticDeps) => Promise<DiagnosticResult>;
38
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1,93 @@
1
+ /**
2
+ * Shared helpers for orchestrator entry points (server.ts and standalone.ts).
3
+ *
4
+ * Extracted to eliminate code duplication between the two entry points.
5
+ * Both entry points import these helpers instead of maintaining separate copies.
6
+ */
7
+ import { type SourceProvider, SourceSubtype } from '@kici-dev/engine';
8
+ import { ProviderRegistry } from './provider-registry.js';
9
+ /**
10
+ * A provider source for Platform registration.
11
+ *
12
+ * `provider` is the coarse-grained Platform-routing family (`github` /
13
+ * `gitlab` / `bitbucket` / `generic`). `subtype` is the fine-grained
14
+ * source kind that survives all the way to the dashboard so universal-git,
15
+ * generic_webhook, and internal sources stay distinguishable. `name` is
16
+ * the human-readable label shown in the runs view + sources tab.
17
+ */
18
+ export interface ProviderSource {
19
+ provider: SourceProvider;
20
+ routingKey: string;
21
+ name: string;
22
+ subtype: SourceSubtype;
23
+ }
24
+ /**
25
+ * Map a generic_webhook_sources `provider_type` (plus optional `git_config`
26
+ * presence) to the canonical {@link SourceSubtype}.
27
+ *
28
+ * Single source of truth for the orchestrator-side mapping — both the
29
+ * boot-time bulk registration (`server.ts`) and any future per-source
30
+ * register/update path (`platform-client.ts`) go through here so the
31
+ * subtype emitted to Platform stays consistent with what the dashboard
32
+ * eventually renders.
33
+ */
34
+ export declare function genericProviderTypeToSubtype(providerType: string, options: {
35
+ hasGitConfig: boolean;
36
+ }): SourceSubtype;
37
+ /**
38
+ * Extract repo identifier (owner/repo) from a git clone URL.
39
+ * e.g., "https://github.com/myorg/myrepo.git" -> "myorg/myrepo"
40
+ */
41
+ export declare function extractRepoIdentifier(repoUrl: string): string;
42
+ /**
43
+ * Diff two provider source arrays by routingKey.
44
+ * Returns which sources were added and which were removed.
45
+ *
46
+ * Used during config reload to determine which source.register and
47
+ * source.deregister messages to send.
48
+ */
49
+ export declare function diffProviderSources(oldSources: ProviderSource[], newSources: ProviderSource[]): {
50
+ added: ProviderSource[];
51
+ removed: ProviderSource[];
52
+ };
53
+ /**
54
+ * Register the internal provider bundle for E2E testing when the
55
+ * `internalProviderRepoPath` config field (KICI_INTERNAL_PROVIDER_REPO_PATH)
56
+ * is set.
57
+ *
58
+ * When the field is present, this overwrites the previously-registered
59
+ * `generic:default` bundle with one that has a lockFileFetcher and
60
+ * repoUrlBuilder (needed for the webhook pipeline to match triggers and
61
+ * dispatch jobs).
62
+ *
63
+ * When the field is not set, does nothing (leaves `generic:default` as-is).
64
+ *
65
+ * @returns true if the internal provider was registered, false otherwise
66
+ */
67
+ export declare function registerInternalProviderIfConfigured(registry: ProviderRegistry, config: {
68
+ internalProviderRepoPath?: string;
69
+ internalProviderCloneUrl?: string;
70
+ }): boolean;
71
+ /**
72
+ * Decide whether the local orchestrator can serve a `generic_webhook_sources`
73
+ * row with the given `provider_type`. Used at boot (and any future reload) to
74
+ * filter the source.register payload sent to Platform — if a peer can't serve
75
+ * the row, advertising it would invite Platform's least-loaded relay to pick
76
+ * this peer and drop the webhook silently in a pipeline whose lock-file
77
+ * fetcher returns null.
78
+ *
79
+ * - `'generic'` / `'universal-git'` → always servable (the bundles register
80
+ * without filesystem dependencies; per-row failures during universal-git
81
+ * bundle registration are already isolated in orchestrator-core.ts).
82
+ * - `'internal'` → only servable when `internalProviderRepoPath` is set, the
83
+ * path exists on disk, and is a directory. This mirrors the fail-fast
84
+ * guard in `registerInternalProviderIfConfigured`. The check is binary
85
+ * per peer: a single `KICI_INTERNAL_PROVIDER_REPO_PATH` backs every
86
+ * internal source on that peer (per-source `repoIdentifier`s nest under
87
+ * the same base dir).
88
+ * - Any unknown provider_type returns false to fail closed.
89
+ */
90
+ export declare function canServeGenericProviderType(providerType: string, config: {
91
+ internalProviderRepoPath?: string;
92
+ }): boolean;
93
+ //# sourceMappingURL=entry-helpers.d.ts.map
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Binding store -- scope-to-environment binding CRUD.
3
+ *
4
+ * Bindings map scope patterns (e.g. 'aws/prod/**') to environments,
5
+ * controlling which scoped secrets are available in each environment.
6
+ */
7
+ import type { Kysely } from 'kysely';
8
+ import type { Database, EnvironmentBinding } from '../db/types.js';
9
+ /**
10
+ * Data access layer for environment bindings.
11
+ */
12
+ export declare class BindingStore {
13
+ private readonly db;
14
+ constructor(db: Kysely<Database>);
15
+ /** List all bindings for an environment. */
16
+ list(orgId: string, environmentId: string): Promise<EnvironmentBinding[]>;
17
+ /**
18
+ * Replace all bindings for an environment in a transaction.
19
+ *
20
+ * Deletes existing bindings and inserts the new set atomically.
21
+ * Pass an empty array to clear all bindings.
22
+ */
23
+ set(orgId: string, environmentId: string, scopePatterns: string[]): Promise<void>;
24
+ /** Find bindings for an environment (alias for list, used by secret resolver). */
25
+ findBindingsForEnvironment(orgId: string, environmentId: string): Promise<EnvironmentBinding[]>;
26
+ }
27
+ //# sourceMappingURL=binding-store.d.ts.map
@@ -0,0 +1,74 @@
1
+ import { type Kysely } from 'kysely';
2
+ import type { Environment as EngineEnvironment } from '@kici-dev/engine';
3
+ import type { Database, Environment } from '../db/types.js';
4
+ /**
5
+ * Map a DB environment row (snake_case) to the engine Environment type (camelCase).
6
+ *
7
+ * Kysely returns JSONB columns as strings; this function parses them into arrays.
8
+ */
9
+ export declare function toEnvironment(row: Environment): EngineEnvironment;
10
+ /** Fields accepted when creating an environment. */
11
+ export interface EnvironmentCreateInput {
12
+ name: string;
13
+ type?: 'fixed' | 'glob';
14
+ globPattern?: string | null;
15
+ branchRestrictions?: string[];
16
+ triggerTypeFilters?: string[];
17
+ repoPatterns?: string[];
18
+ concurrencyLimit?: number | null;
19
+ concurrencyStrategy?: 'queue' | 'cancel-pending';
20
+ concurrencyTimeoutMs?: number;
21
+ requiredReviewers?: string[] | null;
22
+ waitTimerSeconds?: number | null;
23
+ holdExpirySeconds?: number;
24
+ minimumTrust?: 'known' | 'trusted' | null;
25
+ allowLocalExecution?: boolean;
26
+ enabled?: boolean;
27
+ createdBy?: string | null;
28
+ }
29
+ /** Fields accepted when updating an environment. */
30
+ export interface EnvironmentUpdateInput {
31
+ name?: string;
32
+ type?: 'fixed' | 'glob';
33
+ globPattern?: string | null;
34
+ branchRestrictions?: string[];
35
+ triggerTypeFilters?: string[];
36
+ repoPatterns?: string[];
37
+ concurrencyLimit?: number | null;
38
+ concurrencyStrategy?: 'queue' | 'cancel-pending';
39
+ concurrencyTimeoutMs?: number;
40
+ requiredReviewers?: string[] | null;
41
+ waitTimerSeconds?: number | null;
42
+ holdExpirySeconds?: number;
43
+ minimumTrust?: 'known' | 'trusted' | null;
44
+ allowLocalExecution?: boolean;
45
+ enabled?: boolean;
46
+ }
47
+ /**
48
+ * Data access layer for environments.
49
+ */
50
+ export declare class EnvironmentStore {
51
+ private readonly db;
52
+ constructor(db: Kysely<Database>);
53
+ /** List all environments for an org, ordered by name. */
54
+ list(orgId: string): Promise<Environment[]>;
55
+ /** Get a single environment by org + id. Returns null if not found. */
56
+ get(orgId: string, id: string): Promise<Environment | null>;
57
+ /** Get a single environment by org + name. Returns null if not found. */
58
+ getByName(orgId: string, name: string): Promise<Environment | null>;
59
+ /** Create a new environment. Returns the created row. */
60
+ create(orgId: string, data: EnvironmentCreateInput): Promise<Environment>;
61
+ /** Update an environment. Returns the updated row, or null if not found. */
62
+ update(orgId: string, id: string, updates: EnvironmentUpdateInput): Promise<Environment | null>;
63
+ /** Delete an environment. Cascade deletes bindings, variables, and overrides. */
64
+ delete(orgId: string, id: string): Promise<boolean>;
65
+ /**
66
+ * Match an environment name against org environments.
67
+ *
68
+ * First tries exact name match (for fixed environments).
69
+ * If no exact match, scans glob-type environments and uses picomatch.
70
+ * Returns the first matching environment or null.
71
+ */
72
+ matchEnvironment(orgId: string, name: string): Promise<Environment | null>;
73
+ }
74
+ //# sourceMappingURL=environment-store.d.ts.map
@@ -0,0 +1,64 @@
1
+ /**
2
+ * Held run store -- lifecycle management for runs held by protection gates.
3
+ *
4
+ * Manages the lifecycle: pending -> approved/rejected/expired.
5
+ */
6
+ import { type Kysely } from 'kysely';
7
+ import type { Database, HeldRun } from '../db/types.js';
8
+ /** Status values for held runs (held_runs table). */
9
+ export declare enum HeldRunStatus {
10
+ Pending = "pending",
11
+ Approved = "approved",
12
+ Rejected = "rejected",
13
+ Expired = "expired",
14
+ Released = "released"
15
+ }
16
+ /** Data required to create a held run. */
17
+ export interface CreateHeldRunData {
18
+ runId: string;
19
+ jobId: string;
20
+ environmentId: string;
21
+ holdType: string;
22
+ reason: string;
23
+ expiresAt: Date;
24
+ /** Queue type: 'environment' (default) or 'security'. */
25
+ queueType?: 'environment' | 'security';
26
+ }
27
+ /** Options for listing held runs. */
28
+ export interface ListHeldRunsOptions {
29
+ status?: string;
30
+ limit?: number;
31
+ }
32
+ /** Manages held run lifecycle (pending -> approved/rejected/expired). */
33
+ export declare class HeldRunStore {
34
+ private readonly db;
35
+ constructor(db: Kysely<Database>);
36
+ /** Create a new held run with pending status. */
37
+ create(orgId: string, data: CreateHeldRunData): Promise<HeldRun>;
38
+ /** Approve a pending held run. Throws if not found or not pending. */
39
+ approve(orgId: string, heldRunId: string, approvedBy: string): Promise<HeldRun>;
40
+ /** Reject a pending held run. Throws if not found or not pending. */
41
+ reject(orgId: string, heldRunId: string, reason?: string): Promise<HeldRun>;
42
+ /** List pending held runs for an org, ordered by creation time. */
43
+ listPending(orgId: string): Promise<HeldRun[]>;
44
+ /** List held runs for an org with optional filters. */
45
+ listAll(orgId: string, options?: ListHeldRunsOptions): Promise<HeldRun[]>;
46
+ /** List held runs for an org filtered by queue type with optional filters. */
47
+ listByQueueType(orgId: string, queueType: 'environment' | 'security', options?: ListHeldRunsOptions): Promise<HeldRun[]>;
48
+ /**
49
+ * Approve a pending held run, enforcing queue_type boundary.
50
+ * Prevents environment approvals from approving security holds and vice versa.
51
+ * Throws if not found, not pending, or queue_type mismatch.
52
+ */
53
+ approveByQueueType(orgId: string, heldRunId: string, approvedBy: string, queueType: 'environment' | 'security'): Promise<HeldRun>;
54
+ /** Get a held run by run ID and job ID. Returns null if not found. */
55
+ getByRunAndJob(orgId: string, runId: string, jobId: string): Promise<HeldRun | null>;
56
+ /**
57
+ * Expire overdue pending runs. Called by the stale detector.
58
+ * Sets status to 'expired' and resolved_at to now() for all
59
+ * pending runs past their expires_at.
60
+ * Returns the number of expired runs.
61
+ */
62
+ expireOverdue(): Promise<number>;
63
+ }
64
+ //# sourceMappingURL=held-runs.d.ts.map
@@ -0,0 +1,10 @@
1
+ export { EnvironmentStore, type EnvironmentCreateInput, type EnvironmentUpdateInput, } from './environment-store.js';
2
+ export { BindingStore } from './binding-store.js';
3
+ export { VariableStore } from './variable-store.js';
4
+ export { HeldRunStore, type CreateHeldRunData, type ListHeldRunsOptions } from './held-runs.js';
5
+ export { evaluateProtectionRules, type JobDispatchContext } from './protection/pipeline.js';
6
+ export { evaluateBranchGate } from './protection/branch-gate.js';
7
+ export { evaluateConcurrencyGate } from './protection/concurrency-gate.js';
8
+ export { evaluateReviewerGate } from './protection/reviewer-gate.js';
9
+ export { evaluateWaitTimerGate } from './protection/wait-timer-gate.js';
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,5 @@
1
+ import type { Environment, ProtectionGateResult } from '@kici-dev/engine';
2
+ import type { JobDispatchContext } from './pipeline.js';
3
+ /** Evaluate branch restrictions, trigger type filters, and repo patterns. */
4
+ export declare function evaluateBranchGate(env: Environment, ctx: JobDispatchContext): ProtectionGateResult;
5
+ //# sourceMappingURL=branch-gate.d.ts.map
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Concurrency gate -- checks concurrency limits.
3
+ */
4
+ import type { Environment, ProtectionGateResult } from '@kici-dev/engine';
5
+ /** Evaluate concurrency limits for the environment. */
6
+ export declare function evaluateConcurrencyGate(env: Environment, currentRunningCount: number, _concurrencyGroup: string): ProtectionGateResult;
7
+ //# sourceMappingURL=concurrency-gate.d.ts.map
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Protection gate pipeline -- evaluates gates sequentially.
3
+ *
4
+ * Gates evaluated in order: branch -> trust -> concurrency -> reviewer -> timer.
5
+ * First non-pass result stops evaluation.
6
+ */
7
+ import type { Environment, ProtectionGateResult, TrustTier } from '@kici-dev/engine';
8
+ /** Context needed for protection gate evaluation. */
9
+ export interface JobDispatchContext {
10
+ branch: string;
11
+ triggerType: string;
12
+ repository: string;
13
+ runId: string;
14
+ jobId: string;
15
+ }
16
+ /** Evaluate all protection rules for an environment. */
17
+ export declare function evaluateProtectionRules(env: Environment, ctx: JobDispatchContext, currentRunningCount: number, concurrencyGroup: string, trustTier?: TrustTier): Promise<ProtectionGateResult>;
18
+ //# sourceMappingURL=pipeline.d.ts.map
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Reviewer gate -- checks required reviewers.
3
+ */
4
+ import type { Environment, ProtectionGateResult } from '@kici-dev/engine';
5
+ /** Evaluate reviewer requirements for the environment. */
6
+ export declare function evaluateReviewerGate(env: Environment): ProtectionGateResult;
7
+ //# sourceMappingURL=reviewer-gate.d.ts.map
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Trust gate -- checks contributor trust tier against environment minimumTrust.
3
+ */
4
+ import type { Environment, ProtectionGateResult, TrustTier } from '@kici-dev/engine';
5
+ /** Evaluate minimumTrust requirements for the environment. */
6
+ export declare function evaluateTrustGate(env: Environment, trustTier: TrustTier | undefined): ProtectionGateResult;
7
+ //# sourceMappingURL=trust-gate.d.ts.map
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Wait timer gate -- checks wait timer configuration.
3
+ */
4
+ import type { Environment, ProtectionGateResult } from '@kici-dev/engine';
5
+ /** Evaluate wait timer for the environment. */
6
+ export declare function evaluateWaitTimerGate(env: Environment): ProtectionGateResult;
7
+ //# sourceMappingURL=wait-timer-gate.d.ts.map
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Variable store -- environment variable CRUD with lock enforcement.
3
+ *
4
+ * Manages org-level environment variables and per-source overrides.
5
+ * Lock enforcement: locked org vars cannot be overridden by source overrides.
6
+ */
7
+ import { type Kysely } from 'kysely';
8
+ import type { Database, EnvironmentVariable, EnvironmentSourceOverride } from '../db/types.js';
9
+ /**
10
+ * Data access layer for environment variables and source overrides.
11
+ */
12
+ export declare class VariableStore {
13
+ private readonly db;
14
+ constructor(db: Kysely<Database>);
15
+ /** List all org-level variables for an environment. */
16
+ listVars(orgId: string, environmentId: string): Promise<EnvironmentVariable[]>;
17
+ /** Upsert an org-level variable. */
18
+ setVar(orgId: string, environmentId: string, key: string, value: string, locked?: boolean): Promise<void>;
19
+ /** Delete an org-level variable. */
20
+ deleteVar(orgId: string, environmentId: string, key: string): Promise<void>;
21
+ /** List source overrides for a specific source (routing key). */
22
+ listSourceOverrides(orgId: string, environmentId: string, routingKey: string): Promise<EnvironmentSourceOverride[]>;
23
+ /** Upsert a source override. */
24
+ setSourceOverride(orgId: string, environmentId: string, routingKey: string, key: string, value: string): Promise<void>;
25
+ /** Delete a source override. */
26
+ deleteSourceOverride(orgId: string, environmentId: string, routingKey: string, key: string): Promise<void>;
27
+ /**
28
+ * Get resolved variables for an environment, optionally merged with source overrides.
29
+ *
30
+ * Merge rules:
31
+ * - Org-level vars form the base
32
+ * - Source overrides can add new keys and override unlocked org vars
33
+ * - Locked org vars are NOT overridden by source overrides
34
+ *
35
+ * @param routingKey - If provided, source overrides are merged in
36
+ */
37
+ getResolvedVars(orgId: string, environmentId: string, routingKey?: string): Promise<Record<string, string>>;
38
+ }
39
+ //# sourceMappingURL=variable-store.d.ts.map