@kici-dev/orchestrator 0.1.27 → 0.3.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 (274) 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 +56 -4
  19. package/dist/artifacts/artifact-store.d.ts +233 -0
  20. package/dist/artifacts/failure-messages.d.ts +46 -0
  21. package/dist/audit/access-log.d.ts +18 -1
  22. package/dist/cache/dep-cache.d.ts +15 -0
  23. package/dist/cache/user-cache.d.ts +37 -0
  24. package/dist/cancel/cancel-run.d.ts +10 -3
  25. package/dist/cancel/dashboard-cancel-handler.d.ts +19 -0
  26. package/dist/cli/api-client.d.ts +44 -1
  27. package/dist/cli/commands/agent-package.d.ts +34 -0
  28. package/dist/cli/commands/check-run.d.ts +26 -0
  29. package/dist/cli/commands/cluster-settings.d.ts +55 -0
  30. package/dist/cli/commands/dashboard-encryption-key.d.ts +3 -0
  31. package/dist/cli/commands/db-backup.d.ts +71 -0
  32. package/dist/cli/commands/orchestrator-service/drain.d.ts +31 -0
  33. package/dist/cli/commands/orchestrator-service/index.d.ts +7 -4
  34. package/dist/cli/commands/orchestrator-service/install-env.d.ts +58 -0
  35. package/dist/cli/commands/secret.d.ts +45 -1
  36. package/dist/cli/commands/shared/admin-cli-access-log.d.ts +46 -0
  37. package/dist/cli/commands/shared/versioned-upgrade.d.ts +65 -2
  38. package/dist/cli/commands/signing-key.d.ts +3 -0
  39. package/dist/cli/commands/source.d.ts +12 -0
  40. package/dist/cli/commands/token.d.ts +9 -0
  41. package/dist/cli/commands/trust-policy.d.ts +48 -0
  42. package/dist/cli/join.d.ts +1 -1
  43. package/dist/cli/service/index.d.ts +2 -2
  44. package/dist/cli/service/instance/manifest.d.ts +17 -0
  45. package/dist/cli/service/instance/resolve.d.ts +11 -0
  46. package/dist/cli/wizard/orchestrator-wizard.d.ts +39 -11
  47. package/dist/cli.js +9921 -3409
  48. package/dist/cluster/cluster-settings-reader.d.ts +78 -0
  49. package/dist/cluster/coordinator.d.ts +81 -9
  50. package/dist/cluster/join-client.d.ts +1 -1
  51. package/dist/cluster/leader-gated-scheduler.d.ts +50 -0
  52. package/dist/cluster/orphan-recovery.d.ts +14 -0
  53. package/dist/cluster/peer-client.d.ts +12 -2
  54. package/dist/cluster/peer-handler.d.ts +15 -4
  55. package/dist/cluster/peer-registry.d.ts +12 -0
  56. package/dist/cluster/verified-issuer-poller.d.ts +11 -0
  57. package/dist/cluster/verified-issuer.d.ts +63 -0
  58. package/dist/cold-store/tables/access-log.d.ts +1 -1
  59. package/dist/cold-store/tables/event-log.d.ts +1 -1
  60. package/dist/cold-store/tables/execution-jobs.d.ts +1 -1
  61. package/dist/cold-store/tables/execution-runs.d.ts +1 -1
  62. package/dist/cold-store/tables/execution-steps.d.ts +1 -1
  63. package/dist/cold-store/tables/secret-audit-log.d.ts +1 -1
  64. package/dist/config/loader.d.ts +1 -1
  65. package/dist/config/resolver.d.ts +2 -1
  66. package/dist/config/schema.d.ts +9 -6
  67. package/dist/config/types.d.ts +5 -2
  68. package/dist/config.d.ts +366 -53
  69. package/dist/contexts/context-store.d.ts +21 -8
  70. package/dist/contexts/glob-specificity.d.ts +30 -0
  71. package/dist/contexts/held-runs.d.ts +51 -19
  72. package/dist/contexts/protection/aggregate.d.ts +2 -2
  73. package/dist/contexts/protection/concurrency-gate.d.ts +0 -3
  74. package/dist/contexts/protection/reviewer-gate.d.ts +0 -3
  75. package/dist/contexts/protection/satisfiability.d.ts +1 -1
  76. package/dist/contexts/protection/trust-gate.d.ts +0 -3
  77. package/dist/contexts/protection/wait-timer-gate.d.ts +0 -3
  78. package/dist/cron/cron-scheduler.d.ts +24 -4
  79. package/dist/cron/cron-store.d.ts +21 -7
  80. package/dist/dashboard/attestation-filters.d.ts +92 -74
  81. package/dist/dashboard/handler.d.ts +35 -1
  82. package/dist/db/migration-test-harness.d.ts +41 -0
  83. package/dist/db/migrations/069_reroute_tunables.d.ts +21 -0
  84. package/dist/db/migrations/070_execution_runs_failure_class.d.ts +4 -0
  85. package/dist/db/migrations/071_batch_accumulation.d.ts +26 -0
  86. package/dist/db/migrations/072_dispatch_queue_run_id_index.d.ts +15 -0
  87. package/dist/db/migrations/073_org_settings_ingest_concurrency.d.ts +13 -0
  88. package/dist/db/migrations/074_normalize_zero_concurrency_limit.d.ts +13 -0
  89. package/dist/db/migrations/075_ingest_overflow_buffer.d.ts +16 -0
  90. package/dist/db/migrations/076_artifacts.d.ts +19 -0
  91. package/dist/db/migrations/077_backup_runs.d.ts +13 -0
  92. package/dist/db/migrations/078_org_settings_backup_staleness.d.ts +12 -0
  93. package/dist/db/migrations/079_org_settings_scaler_spawn_timeout.d.ts +14 -0
  94. package/dist/db/migrations/080_cluster_settings.d.ts +17 -0
  95. package/dist/db/migrations/081_org_settings_queue_timeout.d.ts +19 -0
  96. package/dist/db/migrations/082_host_s3_reachable.d.ts +16 -0
  97. package/dist/db/migrations/083_org_settings_artifact_caps.d.ts +18 -0
  98. package/dist/db/migrations/084_orchestrator_signing_keys.d.ts +20 -0
  99. package/dist/db/migrations/085_cluster_settings_reroute_flap_grace_ms.d.ts +12 -0
  100. package/dist/db/migrations/086_cluster_settings_max_fanout_hosts.d.ts +12 -0
  101. package/dist/db/migrations/087_cluster_settings_event_router_rate_limit.d.ts +12 -0
  102. package/dist/db/migrations/088_cluster_settings_cache_max_tarball_bytes.d.ts +12 -0
  103. package/dist/db/migrations/089_cluster_settings_cache_ttl_days.d.ts +12 -0
  104. package/dist/db/migrations/090_cluster_settings_concurrency_wait_timeout_ms.d.ts +12 -0
  105. package/dist/db/migrations/091_cluster_settings_agent_token_ttl_ms.d.ts +12 -0
  106. package/dist/db/migrations/092_cluster_settings_version.d.ts +16 -0
  107. package/dist/db/migrations/093_org_settings_sandbox_allowlist.d.ts +4 -0
  108. package/dist/db/migrations/094_dashboard_encryption_keys.d.ts +21 -0
  109. package/dist/db/migrations/095_dashboard_write_policy_tristate.d.ts +20 -0
  110. package/dist/db/migrations/096_multi_schedule_cron_last_fired.d.ts +4 -0
  111. package/dist/db/migrations/097_execution_runs_pr_number.d.ts +4 -0
  112. package/dist/db/migrations/098_execution_runs_customer_id.d.ts +4 -0
  113. package/dist/db/migrations/099_cluster_settings_dashboard_verified_issuer.d.ts +21 -0
  114. package/dist/db/migrations/100_held_runs_hold_type_vocabulary.d.ts +31 -0
  115. package/dist/db/migrations/101_contexts_hold_expiry_drop_default.d.ts +31 -0
  116. package/dist/db/migrations/102_dispatch_queue_agent_id.d.ts +20 -0
  117. package/dist/db/migrations/103_cluster_settings_ownership_db_check_timeout_ms.d.ts +20 -0
  118. package/dist/db/migrations/104_check_run_terminal_sent.d.ts +22 -0
  119. package/dist/db/migrations/105_org_trust_policy.d.ts +19 -0
  120. package/dist/db/migrations/106_cluster_settings_check_run_tracking_ttl_days.d.ts +18 -0
  121. package/dist/db/migrations/107_check_run_tracking_updated_at_index.d.ts +23 -0
  122. package/dist/db/migrations/108_unroutable_fast_fail.d.ts +4 -0
  123. package/dist/db/repos/dashboard-encryption-keys-repo.d.ts +48 -0
  124. package/dist/db/repos/signing-keys-repo.d.ts +34 -0
  125. package/dist/db/types.d.ts +441 -7
  126. package/dist/deployment/deployment-identity.d.ts +87 -2
  127. package/dist/diagnostics/checks/backup.d.ts +18 -0
  128. package/dist/diagnostics/checks/index.d.ts +2 -1
  129. package/dist/diagnostics/fleet-collector.d.ts +1 -1
  130. package/dist/drain/drain-controller.d.ts +52 -0
  131. package/dist/events/batch-accumulator.d.ts +63 -0
  132. package/dist/events/circuit-breaker.d.ts +9 -3
  133. package/dist/events/event-emitter.d.ts +31 -0
  134. package/dist/events/event-retry-scanner.d.ts +12 -2
  135. package/dist/events/event-router.d.ts +29 -0
  136. package/dist/firecracker/host-network.d.ts +2 -0
  137. package/dist/firecracker/net-interfaces.d.ts +14 -0
  138. package/dist/github-app-name-refresher/github-app-name-refresher.d.ts +18 -8
  139. package/dist/index.d.ts +2 -0
  140. package/dist/index.js +654 -29
  141. package/dist/lockfile-cache.d.ts +4 -0
  142. package/dist/lockfile-validate.d.ts +16 -9
  143. package/dist/metrics/prometheus.d.ts +113 -15
  144. package/dist/oidc/aws-kms-signer.d.ts +37 -0
  145. package/dist/oidc/command-signer.d.ts +23 -0
  146. package/dist/oidc/db-signer.d.ts +48 -0
  147. package/dist/oidc/id-token-claims.d.ts +22 -9
  148. package/dist/oidc/jwt.d.ts +5 -2
  149. package/dist/oidc/local-dev-signer.d.ts +1 -1
  150. package/dist/oidc/oidc-mint-registration.d.ts +27 -11
  151. package/dist/oidc/orchestrator-mint.d.ts +97 -0
  152. package/dist/oidc/orchestrator-signer-factory.d.ts +33 -0
  153. package/dist/oidc/reconcile-signing-key.d.ts +21 -0
  154. package/dist/oidc/signer.d.ts +25 -0
  155. package/dist/oidc/signing-key-status.d.ts +23 -0
  156. package/dist/orchestrator-core.d.ts +42 -2
  157. package/dist/pipeline/decorating-secret-resolver.d.ts +3 -2
  158. package/dist/pipeline/dispatch-matched-workflow.d.ts +41 -0
  159. package/dist/pipeline/install-secrets-resolver.d.ts +12 -1
  160. package/dist/pipeline/manual-schedule.d.ts +20 -13
  161. package/dist/pipeline/pending-workflow-context.d.ts +1 -1
  162. package/dist/pipeline/process-webhook.d.ts +57 -2
  163. package/dist/pipeline/processor.d.ts +44 -8
  164. package/dist/pipeline/rerun.d.ts +12 -13
  165. package/dist/pipeline/resolve-sandbox-grant.d.ts +28 -0
  166. package/dist/pipeline/route-or-dispatch-jobs.d.ts +71 -0
  167. package/dist/pipeline/sandbox-allowlist-reader.d.ts +33 -0
  168. package/dist/policy/dashboard-write-policy.d.ts +9 -4
  169. package/dist/provenance/backfill-run.d.ts +1 -0
  170. package/dist/provenance/trust-root.d.ts +13 -0
  171. package/dist/providers/generic/normalizer.d.ts +1 -1
  172. package/dist/providers/github/auth.d.ts +1 -1
  173. package/dist/providers/github/changed-files.d.ts +14 -6
  174. package/dist/providers/github/check-status-poster.d.ts +19 -3
  175. package/dist/providers/github/contributor-resolver.d.ts +1 -1
  176. package/dist/providers/github/lock-file.d.ts +1 -1
  177. package/dist/providers/github/normalizer.d.ts +1 -1
  178. package/dist/providers/github/repo-url.d.ts +1 -1
  179. package/dist/providers/local/lock-file-fetcher.d.ts +1 -1
  180. package/dist/providers/local/normalizer.d.ts +1 -1
  181. package/dist/providers/local/repo-url-builder.d.ts +1 -1
  182. package/dist/providers/universal-git/changed-files.d.ts +8 -7
  183. package/dist/providers/universal-git/clone-token.d.ts +1 -1
  184. package/dist/providers/universal-git/config.d.ts +4 -4
  185. package/dist/providers/universal-git/index.d.ts +5 -1
  186. package/dist/providers/universal-git/lock-file.d.ts +6 -1
  187. package/dist/providers/universal-git/normalizer.d.ts +1 -1
  188. package/dist/providers/universal-git/repo-url.d.ts +1 -1
  189. package/dist/queue/bootstrap.d.ts +5 -0
  190. package/dist/queue/cleanup.d.ts +72 -9
  191. package/dist/queue/job-queue.d.ts +141 -14
  192. package/dist/queue/scheduled-job.d.ts +3 -2
  193. package/dist/queue/terminalize-unroutable.d.ts +53 -0
  194. package/dist/queue/unroutable-probe.d.ts +52 -0
  195. package/dist/registration/registration-index.d.ts +1 -1
  196. package/dist/reporting/agent-failure-category.d.ts +4 -1
  197. package/dist/reporting/check-run-reporter.d.ts +34 -14
  198. package/dist/reporting/check-run-tracking-store.d.ts +70 -8
  199. package/dist/reporting/execution-tracker.d.ts +156 -10
  200. package/dist/reporting/fs-log-storage.d.ts +31 -2
  201. package/dist/reporting/job-check-run-completion.d.ts +50 -0
  202. package/dist/reporting/log-chunk-sink.d.ts +47 -0
  203. package/dist/reporting/log-retention.d.ts +16 -0
  204. package/dist/reporting/log-storage.d.ts +64 -4
  205. package/dist/reporting/log-writer.d.ts +22 -7
  206. package/dist/reporting/peer-log-normalize.d.ts +14 -0
  207. package/dist/reporting/run-aggregator.d.ts +50 -33
  208. package/dist/reporting/s3-log-storage.d.ts +102 -8
  209. package/dist/routes/admin-auth.d.ts +90 -0
  210. package/dist/routes/admin-cluster-settings.d.ts +31 -0
  211. package/dist/routes/admin-events.d.ts +3 -0
  212. package/dist/routes/admin-orchestrator-drain.d.ts +35 -0
  213. package/dist/routes/admin-runs.d.ts +9 -0
  214. package/dist/routes/admin-sources.d.ts +7 -0
  215. package/dist/routes/admin-trust-policy.d.ts +49 -0
  216. package/dist/routes/admin.d.ts +15 -1
  217. package/dist/routes/github-webhook.d.ts +9 -3
  218. package/dist/routes/provenance-oidc.d.ts +38 -0
  219. package/dist/routes/verify-attestation.d.ts +21 -0
  220. package/dist/scaler/bare-metal-backend.d.ts +9 -2
  221. package/dist/scaler/config.d.ts +25 -4
  222. package/dist/scaler/container-backend.d.ts +9 -1
  223. package/dist/scaler/firecracker-backend.d.ts +29 -2
  224. package/dist/scaler/index.d.ts +1 -1
  225. package/dist/scaler/manager.d.ts +166 -8
  226. package/dist/scaler/pending-scale-sweeper.d.ts +35 -0
  227. package/dist/scaler/types.d.ts +75 -6
  228. package/dist/secrets/backend-registry.d.ts +32 -1
  229. package/dist/secrets/dashboard-encryption-key.d.ts +48 -0
  230. package/dist/secrets/ephemeral-keys.d.ts +16 -0
  231. package/dist/secrets/pg-secret-store.d.ts +10 -0
  232. package/dist/secrets/rbac.d.ts +5 -1
  233. package/dist/secrets/routing-key-scope.d.ts +6 -0
  234. package/dist/secrets/scope-routing.d.ts +126 -0
  235. package/dist/secrets/secret-resolver.d.ts +1 -14
  236. package/dist/secrets/token-manager.d.ts +5 -1
  237. package/dist/security/contributor-cache.d.ts +9 -1
  238. package/dist/security/trust-policy-gate.d.ts +117 -0
  239. package/dist/security/trust-policy-store.d.ts +78 -0
  240. package/dist/server.js +36074 -25052
  241. package/dist/sources/source-manager.d.ts +24 -0
  242. package/dist/stale-detector/stale-run-detector.d.ts +7 -0
  243. package/dist/standalone.js +35203 -25387
  244. package/dist/storage/filesystem.d.ts +17 -0
  245. package/dist/storage/key-discriminator.d.ts +20 -0
  246. package/dist/storage/s3.d.ts +2 -0
  247. package/dist/storage/types.d.ts +16 -0
  248. package/dist/webhook/dedup.d.ts +9 -1
  249. package/dist/webhook/event-log.d.ts +13 -2
  250. package/dist/webhook/generic-sources-listener.d.ts +4 -0
  251. package/dist/webhook/ingest-admission.d.ts +140 -0
  252. package/dist/webhook/ingest-overflow-buffer.d.ts +27 -0
  253. package/dist/webhook/ingest-overflow-replayer.d.ts +49 -0
  254. package/dist/webhook/ingest-overflow-types.d.ts +73 -0
  255. package/dist/webhook/loop-lag-source.d.ts +40 -0
  256. package/dist/webhook/observed-relay-guard.d.ts +40 -0
  257. package/dist/webhook/org-ingest-cap-reader.d.ts +24 -0
  258. package/dist/webhook/register-source-bundle.d.ts +3 -0
  259. package/dist/webhook/relay-reinject.d.ts +43 -0
  260. package/dist/worker/in-memory-job-queue.d.ts +8 -3
  261. package/dist/worker-core.d.ts +10 -0
  262. package/dist/ws/agent-api-registry.d.ts +20 -0
  263. package/dist/ws/agent-handler.d.ts +63 -7
  264. package/dist/ws/bringup-api.d.ts +99 -0
  265. package/dist/ws/dashboard-context-handler.d.ts +28 -10
  266. package/dist/ws/dashboard-run-state-handler.d.ts +31 -0
  267. package/dist/ws/failure-messages.d.ts +29 -0
  268. package/dist/ws/oidc-token-relay.d.ts +9 -0
  269. package/dist/ws/ownership-gate.d.ts +22 -0
  270. package/dist/ws/platform-client.d.ts +96 -1
  271. package/dist/ws/replay-chunker.d.ts +37 -0
  272. package/installer-image-digests.json +3 -3
  273. package/package.json +22 -21
  274. package/sbom.spdx.json +1240 -1788
@@ -0,0 +1,78 @@
1
+ /**
2
+ * Cache of the Platform-owned org trust policy.
3
+ *
4
+ * The Platform is the authority for a Platform-attached org and pushes the
5
+ * policy on `trust_policy.update`; this store persists it so the policy survives
6
+ * a restart instead of being unknown until the next push. In independent mode
7
+ * there is no Platform, so the operator writes the same row via
8
+ * `kici-admin trust-policy set` and `source` records which wrote it.
9
+ */
10
+ import { Kysely, type Transaction } from 'kysely';
11
+ import { z } from 'zod';
12
+ import type { TrustPolicy } from '@kici-dev/engine';
13
+ import type { Database } from '../db/types.js';
14
+ /** Who wrote the cached policy row. */
15
+ export declare const TrustPolicySource: z.ZodEnum<{
16
+ local: "local";
17
+ platform: "platform";
18
+ }>;
19
+ export type TrustPolicySource = z.infer<typeof TrustPolicySource>;
20
+ /**
21
+ * The strictest documented defaults. Used to fill gaps on a local merge; the
22
+ * fail-closed policy an unknown org resolves to lives in `trust-policy-gate.ts`.
23
+ */
24
+ export declare const DEFAULT_TRUST_POLICY: TrustPolicy;
25
+ /** A policy as stored, with its provenance. */
26
+ export interface StoredTrustPolicy extends TrustPolicy {
27
+ source: TrustPolicySource;
28
+ updatedAt: Date;
29
+ }
30
+ export declare class TrustPolicyStore {
31
+ private readonly db;
32
+ constructor(db: Kysely<Database>);
33
+ /** `executor` lets a caller read inside its own transaction. */
34
+ get(orgId: string, executor?: Kysely<Database> | Transaction<Database>): Promise<StoredTrustPolicy | null>;
35
+ /**
36
+ * Needs no lock, unlike `upsertLocal`: a push carries every field, so there
37
+ * is no read-merge to lose and concurrent pushes correctly settle on the
38
+ * last one. The two writers also never overlap — `upsertLocal` is reachable
39
+ * only in independent mode, where no Platform pushes.
40
+ */
41
+ upsertFromPlatform(orgId: string, policy: TrustPolicy): Promise<void>;
42
+ /**
43
+ * Write an operator-supplied policy. Only reachable in independent mode — the
44
+ * admin route refuses on a Platform-attached orchestrator, because the next
45
+ * push would clobber the write.
46
+ *
47
+ * The read-merge-write is serialised per org by a transaction-scoped
48
+ * advisory lock. The transaction alone would NOT give that: under READ
49
+ * COMMITTED two concurrent PATCHes both read the pre-existing row, and the
50
+ * second `ON CONFLICT DO UPDATE` then overwrites every column from its own
51
+ * stale merge — silently dropping the first operator's change (a tightened
52
+ * `unknownContributorPolicy` reverting to whatever the second caller last
53
+ * saw). The lock releases on commit or rollback, so there is no unlock to
54
+ * leak.
55
+ *
56
+ * `onWrite` receives the same transaction and the merged result, so an audit
57
+ * row written there commits or rolls back with the policy itself — a
58
+ * loosened `forkPolicy` can never land unattributed.
59
+ *
60
+ * Returns the merged policy so the caller does not need a second read (which
61
+ * would be outside the transaction and could observe a later write).
62
+ */
63
+ upsertLocal(orgId: string, patch: Partial<TrustPolicy>, onWrite?: (trx: Transaction<Database>, merged: TrustPolicy) => Promise<void>): Promise<TrustPolicy>;
64
+ private write;
65
+ }
66
+ /**
67
+ * Build a TrustPolicyStore backed by its own connection pool to the given
68
+ * orchestrator database URL. Mirrors `createHeldRunStoreFromUrl`; consumed by
69
+ * E2E tests that assert the pushed policy is persisted in the real deployed
70
+ * orchestrator DB rather than held in process memory.
71
+ */
72
+ export declare function createTrustPolicyStoreFromUrl(databaseUrl: string, opts?: {
73
+ maxConnections?: number;
74
+ }): {
75
+ store: TrustPolicyStore;
76
+ dispose: () => Promise<void>;
77
+ };
78
+ //# sourceMappingURL=trust-policy-store.d.ts.map