@kici-dev/orchestrator 0.1.26 → 0.2.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 (310) hide show
  1. package/dist/__test-helpers__/mock-db.d.ts +2 -0
  2. package/dist/agent/dispatcher.d.ts +52 -2
  3. package/dist/agent/host-roster-reaper.d.ts +1 -2
  4. package/dist/agent/host-roster.d.ts +34 -0
  5. package/dist/agent/ownership-refusal.d.ts +12 -0
  6. package/dist/agent/ownership-tracker.d.ts +64 -16
  7. package/dist/agent/token-store.d.ts +13 -0
  8. package/dist/agent-packaging/availability.d.ts +27 -0
  9. package/dist/agent-packaging/build-package.d.ts +16 -0
  10. package/dist/agent-packaging/download.d.ts +30 -0
  11. package/dist/agent-packaging/index.d.ts +9 -0
  12. package/dist/agent-packaging/install-closure.d.ts +30 -0
  13. package/dist/agent-packaging/node-binary.d.ts +26 -0
  14. package/dist/agent-packaging/refresh.d.ts +50 -0
  15. package/dist/agent-packaging/store.d.ts +15 -0
  16. package/dist/agent-packaging/upload.d.ts +24 -0
  17. package/dist/app-on-error.d.ts +29 -0
  18. package/dist/app.d.ts +69 -8
  19. package/dist/approvals/apply-decision.d.ts +1 -1
  20. package/dist/approvals/step-approval-bridge.d.ts +1 -1
  21. package/dist/artifacts/artifact-store.d.ts +233 -0
  22. package/dist/artifacts/failure-messages.d.ts +46 -0
  23. package/dist/audit/access-log.d.ts +18 -1
  24. package/dist/cache/dep-cache.d.ts +15 -0
  25. package/dist/cache/pending-inits.d.ts +4 -4
  26. package/dist/cache/user-cache.d.ts +37 -0
  27. package/dist/cancel/cancel-run.d.ts +10 -3
  28. package/dist/cancel/dashboard-cancel-handler.d.ts +19 -0
  29. package/dist/cli/api-client.d.ts +51 -5
  30. package/dist/cli/commands/agent-package.d.ts +34 -0
  31. package/dist/cli/commands/check-run.d.ts +26 -0
  32. package/dist/cli/commands/cluster-settings.d.ts +55 -0
  33. package/dist/cli/commands/context.d.ts +25 -0
  34. package/dist/cli/commands/dashboard-encryption-key.d.ts +3 -0
  35. package/dist/cli/commands/db-backup.d.ts +71 -0
  36. package/dist/cli/commands/debug-bundle.d.ts +1 -1
  37. package/dist/cli/commands/orchestrator-service/drain.d.ts +31 -0
  38. package/dist/cli/commands/orchestrator-service/index.d.ts +7 -4
  39. package/dist/cli/commands/orchestrator-service/install-env.d.ts +58 -0
  40. package/dist/cli/commands/secret.d.ts +45 -1
  41. package/dist/cli/commands/shared/admin-cli-access-log.d.ts +46 -0
  42. package/dist/cli/commands/shared/versioned-upgrade.d.ts +65 -2
  43. package/dist/cli/commands/signing-key.d.ts +3 -0
  44. package/dist/cli/commands/source.d.ts +12 -0
  45. package/dist/cli/commands/token.d.ts +9 -0
  46. package/dist/cli/commands/trust-policy.d.ts +48 -0
  47. package/dist/cli/commands/variable.d.ts +6 -6
  48. package/dist/cli/join.d.ts +1 -1
  49. package/dist/cli/service/index.d.ts +2 -2
  50. package/dist/cli/service/instance/manifest.d.ts +17 -0
  51. package/dist/cli/service/instance/resolve.d.ts +11 -0
  52. package/dist/cli/service/windows.d.ts +6 -0
  53. package/dist/cli/wizard/orchestrator-wizard.d.ts +39 -11
  54. package/dist/cli.js +10263 -3667
  55. package/dist/cluster/cluster-settings-reader.d.ts +78 -0
  56. package/dist/cluster/coordinator.d.ts +81 -9
  57. package/dist/cluster/join-client.d.ts +1 -1
  58. package/dist/cluster/leader-gated-scheduler.d.ts +50 -0
  59. package/dist/cluster/orphan-recovery.d.ts +14 -0
  60. package/dist/cluster/peer-client.d.ts +12 -2
  61. package/dist/cluster/peer-handler.d.ts +15 -4
  62. package/dist/cluster/peer-registry.d.ts +12 -0
  63. package/dist/cluster/verified-issuer-poller.d.ts +11 -0
  64. package/dist/cluster/verified-issuer.d.ts +63 -0
  65. package/dist/cold-store/tables/access-log.d.ts +1 -1
  66. package/dist/cold-store/tables/event-log.d.ts +1 -1
  67. package/dist/cold-store/tables/execution-jobs.d.ts +1 -1
  68. package/dist/cold-store/tables/execution-runs.d.ts +1 -1
  69. package/dist/cold-store/tables/execution-steps.d.ts +1 -1
  70. package/dist/cold-store/tables/secret-audit-log.d.ts +1 -1
  71. package/dist/config/loader.d.ts +1 -1
  72. package/dist/config/resolver.d.ts +2 -1
  73. package/dist/config/schema.d.ts +8 -6
  74. package/dist/config/types.d.ts +3 -2
  75. package/dist/config.d.ts +372 -46
  76. package/dist/contexts/binding-store.d.ts +36 -0
  77. package/dist/contexts/context-store.d.ts +100 -0
  78. package/dist/contexts/glob-specificity.d.ts +30 -0
  79. package/dist/{environments → contexts}/held-runs.d.ts +64 -32
  80. package/dist/{environments → contexts}/index.d.ts +1 -1
  81. package/dist/contexts/protection/aggregate.d.ts +43 -0
  82. package/dist/contexts/protection/branch-gate.d.ts +5 -0
  83. package/dist/contexts/protection/concurrency-gate.d.ts +4 -0
  84. package/dist/{environments → contexts}/protection/pipeline.d.ts +3 -3
  85. package/dist/contexts/protection/reviewer-gate.d.ts +4 -0
  86. package/dist/{environments → contexts}/protection/satisfiability.d.ts +22 -22
  87. package/dist/contexts/protection/trust-gate.d.ts +4 -0
  88. package/dist/contexts/protection/wait-timer-gate.d.ts +4 -0
  89. package/dist/contexts/variable-store.d.ts +39 -0
  90. package/dist/cron/cron-scheduler.d.ts +24 -4
  91. package/dist/cron/cron-store.d.ts +21 -7
  92. package/dist/dashboard/attestation-filters.d.ts +94 -74
  93. package/dist/dashboard/handler.d.ts +63 -3
  94. package/dist/db/migration-test-harness.d.ts +41 -0
  95. package/dist/db/migrations/067_environments_to_contexts.d.ts +36 -0
  96. package/dist/db/migrations/068_request_idempotency.d.ts +17 -0
  97. package/dist/db/migrations/069_reroute_tunables.d.ts +21 -0
  98. package/dist/db/migrations/070_execution_runs_failure_class.d.ts +4 -0
  99. package/dist/db/migrations/071_batch_accumulation.d.ts +26 -0
  100. package/dist/db/migrations/072_dispatch_queue_run_id_index.d.ts +15 -0
  101. package/dist/db/migrations/073_org_settings_ingest_concurrency.d.ts +13 -0
  102. package/dist/db/migrations/074_normalize_zero_concurrency_limit.d.ts +13 -0
  103. package/dist/db/migrations/075_ingest_overflow_buffer.d.ts +16 -0
  104. package/dist/db/migrations/076_artifacts.d.ts +19 -0
  105. package/dist/db/migrations/077_backup_runs.d.ts +13 -0
  106. package/dist/db/migrations/078_org_settings_backup_staleness.d.ts +12 -0
  107. package/dist/db/migrations/079_org_settings_scaler_spawn_timeout.d.ts +14 -0
  108. package/dist/db/migrations/080_cluster_settings.d.ts +17 -0
  109. package/dist/db/migrations/081_org_settings_queue_timeout.d.ts +19 -0
  110. package/dist/db/migrations/082_host_s3_reachable.d.ts +16 -0
  111. package/dist/db/migrations/083_org_settings_artifact_caps.d.ts +18 -0
  112. package/dist/db/migrations/084_orchestrator_signing_keys.d.ts +20 -0
  113. package/dist/db/migrations/085_cluster_settings_reroute_flap_grace_ms.d.ts +12 -0
  114. package/dist/db/migrations/086_cluster_settings_max_fanout_hosts.d.ts +12 -0
  115. package/dist/db/migrations/087_cluster_settings_event_router_rate_limit.d.ts +12 -0
  116. package/dist/db/migrations/088_cluster_settings_cache_max_tarball_bytes.d.ts +12 -0
  117. package/dist/db/migrations/089_cluster_settings_cache_ttl_days.d.ts +12 -0
  118. package/dist/db/migrations/090_cluster_settings_concurrency_wait_timeout_ms.d.ts +12 -0
  119. package/dist/db/migrations/091_cluster_settings_agent_token_ttl_ms.d.ts +12 -0
  120. package/dist/db/migrations/092_cluster_settings_version.d.ts +16 -0
  121. package/dist/db/migrations/093_org_settings_sandbox_allowlist.d.ts +4 -0
  122. package/dist/db/migrations/094_dashboard_encryption_keys.d.ts +21 -0
  123. package/dist/db/migrations/095_dashboard_write_policy_tristate.d.ts +20 -0
  124. package/dist/db/migrations/096_multi_schedule_cron_last_fired.d.ts +4 -0
  125. package/dist/db/migrations/097_execution_runs_pr_number.d.ts +4 -0
  126. package/dist/db/migrations/098_execution_runs_customer_id.d.ts +4 -0
  127. package/dist/db/migrations/099_cluster_settings_dashboard_verified_issuer.d.ts +21 -0
  128. package/dist/db/migrations/100_held_runs_hold_type_vocabulary.d.ts +31 -0
  129. package/dist/db/migrations/101_contexts_hold_expiry_drop_default.d.ts +31 -0
  130. package/dist/db/migrations/102_dispatch_queue_agent_id.d.ts +20 -0
  131. package/dist/db/migrations/103_cluster_settings_ownership_db_check_timeout_ms.d.ts +20 -0
  132. package/dist/db/migrations/104_check_run_terminal_sent.d.ts +22 -0
  133. package/dist/db/migrations/105_org_trust_policy.d.ts +19 -0
  134. package/dist/db/migrations/106_cluster_settings_check_run_tracking_ttl_days.d.ts +18 -0
  135. package/dist/db/migrations/107_check_run_tracking_updated_at_index.d.ts +23 -0
  136. package/dist/db/repos/dashboard-encryption-keys-repo.d.ts +48 -0
  137. package/dist/db/repos/signing-keys-repo.d.ts +34 -0
  138. package/dist/db/types.d.ts +499 -66
  139. package/dist/deployment/deployment-identity.d.ts +87 -2
  140. package/dist/diagnostics/checks/backup.d.ts +18 -0
  141. package/dist/diagnostics/checks/index.d.ts +2 -1
  142. package/dist/diagnostics/fleet-collector.d.ts +1 -1
  143. package/dist/drain/drain-controller.d.ts +52 -0
  144. package/dist/events/batch-accumulator.d.ts +63 -0
  145. package/dist/events/circuit-breaker.d.ts +9 -3
  146. package/dist/events/event-emitter.d.ts +31 -0
  147. package/dist/events/event-retry-scanner.d.ts +12 -2
  148. package/dist/events/event-router.d.ts +29 -0
  149. package/dist/firecracker/host-network.d.ts +2 -0
  150. package/dist/firecracker/net-interfaces.d.ts +14 -0
  151. package/dist/github-app-name-refresher/github-app-name-refresher.d.ts +19 -9
  152. package/dist/index.d.ts +2 -0
  153. package/dist/index.js +625 -22
  154. package/dist/lockfile-cache.d.ts +4 -0
  155. package/dist/lockfile-validate.d.ts +16 -9
  156. package/dist/metrics/prometheus.d.ts +114 -15
  157. package/dist/oidc/aws-kms-signer.d.ts +37 -0
  158. package/dist/oidc/command-signer.d.ts +23 -0
  159. package/dist/oidc/db-signer.d.ts +48 -0
  160. package/dist/oidc/id-token-claims.d.ts +76 -0
  161. package/dist/oidc/jwt.d.ts +18 -0
  162. package/dist/oidc/local-dev-signer.d.ts +31 -0
  163. package/dist/oidc/local-mint.d.ts +77 -0
  164. package/dist/oidc/oidc-mint-registration.d.ts +65 -0
  165. package/dist/oidc/orchestrator-mint.d.ts +97 -0
  166. package/dist/oidc/orchestrator-signer-factory.d.ts +33 -0
  167. package/dist/oidc/reconcile-signing-key.d.ts +21 -0
  168. package/dist/oidc/signer.d.ts +25 -0
  169. package/dist/oidc/signing-key-status.d.ts +23 -0
  170. package/dist/orchestrator-core.d.ts +42 -2
  171. package/dist/pipeline/decorating-secret-resolver.d.ts +5 -4
  172. package/dist/pipeline/dispatch-matched-workflow.d.ts +44 -3
  173. package/dist/pipeline/inline-eval.d.ts +2 -2
  174. package/dist/pipeline/install-secrets-resolver.d.ts +25 -14
  175. package/dist/pipeline/{job-environments.d.ts → job-contexts.d.ts} +23 -23
  176. package/dist/pipeline/manual-schedule.d.ts +28 -14
  177. package/dist/pipeline/pending-workflow-context.d.ts +1 -1
  178. package/dist/pipeline/process-webhook.d.ts +57 -2
  179. package/dist/pipeline/processor.d.ts +49 -13
  180. package/dist/pipeline/request-idempotency.d.ts +28 -0
  181. package/dist/pipeline/rerun.d.ts +20 -13
  182. package/dist/pipeline/resolve-sandbox-grant.d.ts +28 -0
  183. package/dist/pipeline/resume-workflow.d.ts +1 -1
  184. package/dist/pipeline/route-or-dispatch-jobs.d.ts +71 -0
  185. package/dist/pipeline/sandbox-allowlist-reader.d.ts +33 -0
  186. package/dist/pipeline/test-pipeline.d.ts +2 -2
  187. package/dist/policy/dashboard-write-policy.d.ts +9 -4
  188. package/dist/provenance/backfill-run.d.ts +1 -0
  189. package/dist/provenance/trust-root.d.ts +20 -0
  190. package/dist/provider-registry.d.ts +8 -0
  191. package/dist/providers/generic/normalizer.d.ts +1 -1
  192. package/dist/providers/github/auth.d.ts +1 -1
  193. package/dist/providers/github/changed-files.d.ts +14 -6
  194. package/dist/providers/github/check-status-poster.d.ts +19 -3
  195. package/dist/providers/github/contributor-resolver.d.ts +1 -1
  196. package/dist/providers/github/lock-file.d.ts +1 -1
  197. package/dist/providers/github/normalizer.d.ts +1 -1
  198. package/dist/providers/github/repo-url.d.ts +1 -1
  199. package/dist/providers/local/index.d.ts +1 -0
  200. package/dist/providers/local/local-source-config.d.ts +1 -0
  201. package/dist/providers/local/lock-file-fetcher.d.ts +1 -1
  202. package/dist/providers/local/normalizer.d.ts +1 -1
  203. package/dist/providers/local/repo-url-builder.d.ts +1 -1
  204. package/dist/providers/universal-git/changed-files.d.ts +8 -7
  205. package/dist/providers/universal-git/clone-token.d.ts +1 -1
  206. package/dist/providers/universal-git/config.d.ts +4 -4
  207. package/dist/providers/universal-git/index.d.ts +5 -1
  208. package/dist/providers/universal-git/lock-file.d.ts +6 -1
  209. package/dist/providers/universal-git/normalizer.d.ts +1 -1
  210. package/dist/providers/universal-git/repo-url.d.ts +1 -1
  211. package/dist/queue/cleanup.d.ts +69 -8
  212. package/dist/queue/job-queue.d.ts +94 -14
  213. package/dist/queue/scheduled-job.d.ts +2 -2
  214. package/dist/registration/registration-index.d.ts +1 -1
  215. package/dist/reporting/agent-failure-category.d.ts +4 -1
  216. package/dist/reporting/check-run-reporter.d.ts +34 -14
  217. package/dist/reporting/check-run-tracking-store.d.ts +70 -8
  218. package/dist/reporting/execution-tracker.d.ts +173 -17
  219. package/dist/reporting/fs-log-storage.d.ts +31 -2
  220. package/dist/reporting/job-check-run-completion.d.ts +50 -0
  221. package/dist/reporting/log-chunk-sink.d.ts +47 -0
  222. package/dist/reporting/log-retention.d.ts +16 -0
  223. package/dist/reporting/log-storage.d.ts +64 -4
  224. package/dist/reporting/log-writer.d.ts +22 -7
  225. package/dist/reporting/peer-log-normalize.d.ts +14 -0
  226. package/dist/reporting/run-aggregator.d.ts +36 -36
  227. package/dist/reporting/s3-log-storage.d.ts +102 -8
  228. package/dist/routes/admin-auth.d.ts +90 -0
  229. package/dist/routes/admin-cluster-settings.d.ts +31 -0
  230. package/dist/routes/admin-contexts.d.ts +47 -0
  231. package/dist/routes/admin-events.d.ts +3 -0
  232. package/dist/routes/admin-orchestrator-drain.d.ts +35 -0
  233. package/dist/routes/admin-registrations.d.ts +2 -2
  234. package/dist/routes/admin-runs.d.ts +9 -0
  235. package/dist/routes/admin-sources.d.ts +7 -0
  236. package/dist/routes/admin-trust-policy.d.ts +49 -0
  237. package/dist/routes/admin.d.ts +15 -1
  238. package/dist/routes/github-webhook.d.ts +9 -3
  239. package/dist/routes/provenance-oidc.d.ts +38 -0
  240. package/dist/routes/verify-attestation.d.ts +21 -0
  241. package/dist/scaler/bare-metal-backend.d.ts +9 -2
  242. package/dist/scaler/config.d.ts +25 -4
  243. package/dist/scaler/container-backend.d.ts +9 -1
  244. package/dist/scaler/firecracker-backend.d.ts +29 -2
  245. package/dist/scaler/index.d.ts +1 -1
  246. package/dist/scaler/manager.d.ts +166 -8
  247. package/dist/scaler/pending-scale-sweeper.d.ts +35 -0
  248. package/dist/scaler/types.d.ts +75 -6
  249. package/dist/secrets/backend-registry.d.ts +32 -1
  250. package/dist/secrets/context-secret-resolver.d.ts +30 -0
  251. package/dist/secrets/dashboard-encryption-key.d.ts +48 -0
  252. package/dist/secrets/ephemeral-keys.d.ts +16 -0
  253. package/dist/secrets/index.d.ts +1 -1
  254. package/dist/secrets/pg-secret-store.d.ts +13 -3
  255. package/dist/secrets/rbac.d.ts +5 -1
  256. package/dist/secrets/routing-key-scope.d.ts +6 -0
  257. package/dist/secrets/scope-routing.d.ts +126 -0
  258. package/dist/secrets/secret-resolver.d.ts +19 -32
  259. package/dist/secrets/token-manager.d.ts +5 -1
  260. package/dist/security/comment-handler.d.ts +1 -1
  261. package/dist/security/contributor-cache.d.ts +9 -1
  262. package/dist/security/trust-policy-gate.d.ts +117 -0
  263. package/dist/security/trust-policy-store.d.ts +78 -0
  264. package/dist/server.js +44012 -32721
  265. package/dist/sources/source-manager.d.ts +24 -0
  266. package/dist/stale-detector/stale-run-detector.d.ts +8 -1
  267. package/dist/standalone.js +44106 -33690
  268. package/dist/storage/blob-routes.d.ts +16 -0
  269. package/dist/storage/filesystem.d.ts +17 -0
  270. package/dist/storage/key-discriminator.d.ts +20 -0
  271. package/dist/storage/s3.d.ts +2 -0
  272. package/dist/storage/types.d.ts +16 -0
  273. package/dist/webhook/dedup.d.ts +9 -1
  274. package/dist/webhook/event-log.d.ts +13 -2
  275. package/dist/webhook/generic-sources-listener.d.ts +4 -0
  276. package/dist/webhook/ingest-admission.d.ts +140 -0
  277. package/dist/webhook/ingest-overflow-buffer.d.ts +27 -0
  278. package/dist/webhook/ingest-overflow-replayer.d.ts +49 -0
  279. package/dist/webhook/ingest-overflow-types.d.ts +73 -0
  280. package/dist/webhook/loop-lag-source.d.ts +40 -0
  281. package/dist/webhook/observed-relay-guard.d.ts +40 -0
  282. package/dist/webhook/org-ingest-cap-reader.d.ts +24 -0
  283. package/dist/webhook/register-source-bundle.d.ts +3 -0
  284. package/dist/webhook/relay-reinject.d.ts +43 -0
  285. package/dist/worker/in-memory-job-queue.d.ts +8 -3
  286. package/dist/worker-core.d.ts +10 -0
  287. package/dist/ws/agent-api-registry.d.ts +20 -0
  288. package/dist/ws/agent-handler.d.ts +63 -7
  289. package/dist/ws/bringup-api.d.ts +99 -0
  290. package/dist/ws/{dashboard-env-handler.d.ts → dashboard-context-handler.d.ts} +43 -25
  291. package/dist/ws/dashboard-run-state-handler.d.ts +31 -0
  292. package/dist/ws/failure-messages.d.ts +29 -0
  293. package/dist/ws/oidc-token-relay.d.ts +15 -0
  294. package/dist/ws/ownership-gate.d.ts +22 -0
  295. package/dist/ws/platform-client.d.ts +96 -1
  296. package/dist/ws/replay-chunker.d.ts +37 -0
  297. package/installer-image-digests.json +3 -3
  298. package/package.json +22 -21
  299. package/sbom.spdx.json +1245 -1793
  300. package/dist/cli/commands/environment.d.ts +0 -25
  301. package/dist/environments/binding-store.d.ts +0 -36
  302. package/dist/environments/environment-store.d.ts +0 -87
  303. package/dist/environments/protection/aggregate.d.ts +0 -43
  304. package/dist/environments/protection/branch-gate.d.ts +0 -5
  305. package/dist/environments/protection/concurrency-gate.d.ts +0 -7
  306. package/dist/environments/protection/reviewer-gate.d.ts +0 -7
  307. package/dist/environments/protection/trust-gate.d.ts +0 -7
  308. package/dist/environments/protection/wait-timer-gate.d.ts +0 -7
  309. package/dist/environments/variable-store.d.ts +0 -39
  310. package/dist/routes/admin-environments.d.ts +0 -47
@@ -1,25 +0,0 @@
1
- /**
2
- * Environment management CLI commands for kici-admin.
3
- *
4
- * environment create — upsert an environment
5
- * environment bind — bind a scope pattern to an environment
6
- * environment set-policy — update policy fields (branch, reviewers, timers, trust)
7
- * environment list — list environments for an org
8
- * environment show — show a single environment with variables + bindings
9
- * environment delete — delete an environment (cascades bindings, variables, overrides; held-run history survives; pending held runs block with a clear error, resolved holds do not)
10
- * environment create-template — create/update an environment template + its seed variables
11
- *
12
- * Each command supports two modes (stage-4 pattern from `maintenance.ts`):
13
- *
14
- * HTTP mode (default): requires `--url` + `--token`, routes through the
15
- * orchestrator admin HTTP API at /api/v1/admin/environments.
16
- *
17
- * Direct-DB mode: activated when `--database-url` is passed (or
18
- * KICI_DATABASE_URL / DATABASE_URL is set). Opens its own pool and runs the
19
- * SQL directly via *Direct helpers in @kici-dev/shared. Used by E2E
20
- * `globalSetup` helpers that need to seed envs before the orchestrator is up.
21
- */
22
- import type { Command } from 'commander';
23
- import type { AdminApiClient } from '../api-client.js';
24
- export declare function registerEnvironmentCommands(program: Command, getClient: () => AdminApiClient): void;
25
- //# sourceMappingURL=environment.d.ts.map
@@ -1,36 +0,0 @@
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
- * A scope→environment binding with its host selector. `hostPattern` defaults to
11
- * `'**'` (all hosts) when omitted.
12
- */
13
- export interface BindingInput {
14
- scopePattern: string;
15
- hostPattern?: string;
16
- }
17
- /**
18
- * Data access layer for environment bindings.
19
- */
20
- export declare class BindingStore {
21
- private readonly db;
22
- constructor(db: Kysely<Database>);
23
- /** List all bindings for an environment. */
24
- list(orgId: string, environmentId: string): Promise<EnvironmentBinding[]>;
25
- /**
26
- * Replace all bindings for an environment in a transaction.
27
- *
28
- * Deletes existing bindings and inserts the new set atomically. Each binding
29
- * carries a `scopePattern` and an optional `hostPattern` (defaulting to
30
- * `'**'`). Pass an empty array to clear all bindings.
31
- */
32
- set(orgId: string, environmentId: string, bindings: BindingInput[]): Promise<void>;
33
- /** Find bindings for an environment (alias for list, used by secret resolver). */
34
- findBindingsForEnvironment(orgId: string, environmentId: string): Promise<EnvironmentBinding[]>;
35
- }
36
- //# sourceMappingURL=binding-store.d.ts.map
@@ -1,87 +0,0 @@
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
- /** Thrown by `delete` when pending held runs reference the environment. */
5
- export declare class EnvironmentDeleteBlockedError extends Error {
6
- readonly pendingCount: number;
7
- constructor(pendingCount: number);
8
- }
9
- /**
10
- * Map a DB environment row (snake_case) to the engine Environment type (camelCase).
11
- *
12
- * Kysely returns JSONB columns as strings; this function parses them into arrays.
13
- */
14
- export declare function toEnvironment(row: Environment): EngineEnvironment;
15
- /** Fields accepted when creating an environment. */
16
- export interface EnvironmentCreateInput {
17
- name: string;
18
- type?: 'fixed' | 'glob';
19
- globPattern?: string | null;
20
- branchRestrictions?: string[];
21
- triggerTypeFilters?: string[];
22
- repoPatterns?: string[];
23
- concurrencyLimit?: number | null;
24
- concurrencyStrategy?: 'queue' | 'cancel-pending';
25
- concurrencyTimeoutMs?: number;
26
- requiredReviewers?: string[] | null;
27
- waitTimerSeconds?: number | null;
28
- holdExpirySeconds?: number;
29
- minimumTrust?: 'known' | 'trusted' | null;
30
- allowLocalExecution?: boolean;
31
- enabled?: boolean;
32
- createdBy?: string | null;
33
- }
34
- /** Fields accepted when updating an environment. */
35
- export interface EnvironmentUpdateInput {
36
- name?: string;
37
- type?: 'fixed' | 'glob';
38
- globPattern?: string | null;
39
- branchRestrictions?: string[];
40
- triggerTypeFilters?: string[];
41
- repoPatterns?: string[];
42
- concurrencyLimit?: number | null;
43
- concurrencyStrategy?: 'queue' | 'cancel-pending';
44
- concurrencyTimeoutMs?: number;
45
- requiredReviewers?: string[] | null;
46
- waitTimerSeconds?: number | null;
47
- holdExpirySeconds?: number;
48
- minimumTrust?: 'known' | 'trusted' | null;
49
- allowLocalExecution?: boolean;
50
- enabled?: boolean;
51
- }
52
- /**
53
- * Data access layer for environments.
54
- */
55
- export declare class EnvironmentStore {
56
- private readonly db;
57
- constructor(db: Kysely<Database>);
58
- /** List all environments for an org, ordered by name. */
59
- list(orgId: string): Promise<Environment[]>;
60
- /** Get a single environment by org + id. Returns null if not found. */
61
- get(orgId: string, id: string): Promise<Environment | null>;
62
- /** Get a single environment by org + name. Returns null if not found. */
63
- getByName(orgId: string, name: string): Promise<Environment | null>;
64
- /** Create a new environment. Returns the created row. */
65
- create(orgId: string, data: EnvironmentCreateInput): Promise<Environment>;
66
- /** Update an environment. Returns the updated row, or null if not found. */
67
- update(orgId: string, id: string, updates: EnvironmentUpdateInput): Promise<Environment | null>;
68
- /**
69
- * Delete an environment.
70
- *
71
- * Bindings, variables, and source overrides cascade away via their FK.
72
- * Terminal held-run history survives with a null `environment_id` (the FK
73
- * uses ON DELETE SET NULL). Pending held runs still reference the
74
- * environment, so deletion is blocked with `EnvironmentDeleteBlockedError`
75
- * until they are approved or rejected.
76
- */
77
- delete(orgId: string, id: string): Promise<boolean>;
78
- /**
79
- * Match an environment name against org environments.
80
- *
81
- * First tries exact name match (for fixed environments).
82
- * If no exact match, scans glob-type environments and uses picomatch.
83
- * Returns the first matching environment or null.
84
- */
85
- matchEnvironment(orgId: string, name: string): Promise<Environment | null>;
86
- }
87
- //# sourceMappingURL=environment-store.d.ts.map
@@ -1,43 +0,0 @@
1
- import { EnvGateRejectReason, type Environment } from '@kici-dev/engine';
2
- import type { JobDispatchContext } from './pipeline.js';
3
- /** A single environment's rejection under all-must-pass aggregation. */
4
- export interface EnvGateRejection {
5
- environment: string;
6
- reason: EnvGateRejectReason;
7
- detail: string;
8
- }
9
- /** Effective protection parameters after most-restrictive aggregation. */
10
- export interface EffectiveProtection {
11
- minimumTrust?: 'known' | 'trusted';
12
- requiredReviewers: string[];
13
- waitTimerSeconds: number | null;
14
- holdExpirySeconds: number;
15
- concurrencyLimit: number | null;
16
- concurrencyStrategy: 'queue' | 'cancel-pending';
17
- }
18
- /**
19
- * Evaluate each environment's hard reject gates against the run context. A name
20
- * with no `Environment` record yields an `env_not_found` rejection. Returns all
21
- * rejections (empty = every environment passed the reject gates).
22
- */
23
- export declare function evaluateMultiEnvGates(envs: ReadonlyArray<{
24
- name: string;
25
- env: Environment | undefined;
26
- }>, ctx: JobDispatchContext): EnvGateRejection[];
27
- /**
28
- * Aggregate hold/wait/queue parameters across all bound environments, most
29
- * restrictive wins: trust = max tier, reviewers = sorted dedup union, wait timer
30
- * = max, hold expiry = min, concurrency limit = min (tightest). The concurrency
31
- * strategy follows the primary (first) environment.
32
- */
33
- export declare function aggregateProtectionParams(envs: ReadonlyArray<Environment>): EffectiveProtection;
34
- /**
35
- * Build a synthetic `Environment` carrying the aggregated protection parameters,
36
- * so the existing per-rule gate functions (trust/concurrency/reviewer/wait) can
37
- * evaluate the all-must-pass holds in one pass. Branch/trigger/repo/enabled are
38
- * already handled by `evaluateMultiEnvGates`, so they are neutralized here.
39
- */
40
- export declare function buildEffectiveEnvironment(primary: Environment, eff: EffectiveProtection): Environment;
41
- /** Format a human-readable rejection reason naming the env(s) and rule(s). */
42
- export declare function formatMultiEnvRejection(rejections: ReadonlyArray<EnvGateRejection>): string;
43
- //# sourceMappingURL=aggregate.d.ts.map
@@ -1,5 +0,0 @@
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
@@ -1,7 +0,0 @@
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
@@ -1,7 +0,0 @@
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
@@ -1,7 +0,0 @@
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
@@ -1,7 +0,0 @@
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
@@ -1,39 +0,0 @@
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
@@ -1,47 +0,0 @@
1
- /**
2
- * Admin API routes for environment management.
3
- *
4
- * POST /api/v1/admin/environments — create (upsert)
5
- * POST /api/v1/admin/environments/:name/bind — bind a scope pattern
6
- * PATCH /api/v1/admin/environments/:name/policy — update policy fields
7
- * GET /api/v1/admin/environments?orgId=<id> — list environments
8
- * GET /api/v1/admin/environments/:name?orgId=<id> — show env + vars + bindings
9
- * DELETE /api/v1/admin/environments/:name?orgId=<id> — delete env (cascades bindings/variables/overrides; pending held runs block with 409)
10
- * POST /api/v1/admin/environments/templates — create/update a template
11
- * GET /api/v1/admin/environments/:name/variables?orgId=<id> — list org-level variables
12
- * PUT /api/v1/admin/environments/:name/variables/:key?orgId=<id> — upsert variable
13
- * DELETE /api/v1/admin/environments/:name/variables/:key?orgId=<id> — delete variable
14
- *
15
- * Backs the `kici-admin environment` dual-mode CLI. Offline (direct-DB) mode
16
- * bypasses this router entirely — the CLI calls `*Direct` helpers from
17
- * @kici-dev/shared. This HTTP surface exists so tooling with only an admin
18
- * token (no DB reach) can do the same operations.
19
- *
20
- * All routes are protected by the admin auth middleware mounted in admin.ts
21
- * (at `/api/v1/admin/*`). That middleware sets `role` + `userId` on the
22
- * context, which we use for RBAC gating here.
23
- */
24
- import { Hono } from 'hono';
25
- import { type Kysely } from 'kysely';
26
- import type { RbacEnforcer, Role } from '../secrets/rbac.js';
27
- export interface AdminEnvironmentRoutesDeps {
28
- db: Kysely<any>;
29
- rbac: RbacEnforcer;
30
- }
31
- /** Hono env type for admin-environments routes with context variables. */
32
- type AdminEnvEnv = {
33
- Variables: {
34
- role: Role;
35
- userId: string;
36
- routingKey: string | null;
37
- };
38
- };
39
- /**
40
- * Create admin API routes for environment management.
41
- *
42
- * @param deps - db (Kysely) + rbac enforcer
43
- * @returns Hono app mounted at /api/v1/admin
44
- */
45
- export declare function createAdminEnvironmentRoutes(deps: AdminEnvironmentRoutesDeps): Hono<AdminEnvEnv>;
46
- export {};
47
- //# sourceMappingURL=admin-environments.d.ts.map