@kici-dev/orchestrator 0.1.27 → 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 (270) 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 +22 -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 +9818 -3408
  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 +8 -6
  67. package/dist/config/types.d.ts +3 -2
  68. package/dist/config.d.ts +363 -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/repos/dashboard-encryption-keys-repo.d.ts +48 -0
  123. package/dist/db/repos/signing-keys-repo.d.ts +34 -0
  124. package/dist/db/types.d.ts +421 -7
  125. package/dist/deployment/deployment-identity.d.ts +87 -2
  126. package/dist/diagnostics/checks/backup.d.ts +18 -0
  127. package/dist/diagnostics/checks/index.d.ts +2 -1
  128. package/dist/diagnostics/fleet-collector.d.ts +1 -1
  129. package/dist/drain/drain-controller.d.ts +52 -0
  130. package/dist/events/batch-accumulator.d.ts +63 -0
  131. package/dist/events/circuit-breaker.d.ts +9 -3
  132. package/dist/events/event-emitter.d.ts +31 -0
  133. package/dist/events/event-retry-scanner.d.ts +12 -2
  134. package/dist/events/event-router.d.ts +29 -0
  135. package/dist/firecracker/host-network.d.ts +2 -0
  136. package/dist/firecracker/net-interfaces.d.ts +14 -0
  137. package/dist/github-app-name-refresher/github-app-name-refresher.d.ts +18 -8
  138. package/dist/index.d.ts +2 -0
  139. package/dist/index.js +604 -16
  140. package/dist/lockfile-cache.d.ts +4 -0
  141. package/dist/lockfile-validate.d.ts +16 -9
  142. package/dist/metrics/prometheus.d.ts +112 -15
  143. package/dist/oidc/aws-kms-signer.d.ts +37 -0
  144. package/dist/oidc/command-signer.d.ts +23 -0
  145. package/dist/oidc/db-signer.d.ts +48 -0
  146. package/dist/oidc/id-token-claims.d.ts +22 -9
  147. package/dist/oidc/jwt.d.ts +5 -2
  148. package/dist/oidc/local-dev-signer.d.ts +1 -1
  149. package/dist/oidc/oidc-mint-registration.d.ts +27 -11
  150. package/dist/oidc/orchestrator-mint.d.ts +97 -0
  151. package/dist/oidc/orchestrator-signer-factory.d.ts +33 -0
  152. package/dist/oidc/reconcile-signing-key.d.ts +21 -0
  153. package/dist/oidc/signer.d.ts +25 -0
  154. package/dist/oidc/signing-key-status.d.ts +23 -0
  155. package/dist/orchestrator-core.d.ts +42 -2
  156. package/dist/pipeline/decorating-secret-resolver.d.ts +3 -2
  157. package/dist/pipeline/dispatch-matched-workflow.d.ts +41 -0
  158. package/dist/pipeline/install-secrets-resolver.d.ts +12 -1
  159. package/dist/pipeline/manual-schedule.d.ts +20 -13
  160. package/dist/pipeline/pending-workflow-context.d.ts +1 -1
  161. package/dist/pipeline/process-webhook.d.ts +57 -2
  162. package/dist/pipeline/processor.d.ts +44 -8
  163. package/dist/pipeline/rerun.d.ts +12 -13
  164. package/dist/pipeline/resolve-sandbox-grant.d.ts +28 -0
  165. package/dist/pipeline/route-or-dispatch-jobs.d.ts +71 -0
  166. package/dist/pipeline/sandbox-allowlist-reader.d.ts +33 -0
  167. package/dist/policy/dashboard-write-policy.d.ts +9 -4
  168. package/dist/provenance/backfill-run.d.ts +1 -0
  169. package/dist/provenance/trust-root.d.ts +13 -0
  170. package/dist/providers/generic/normalizer.d.ts +1 -1
  171. package/dist/providers/github/auth.d.ts +1 -1
  172. package/dist/providers/github/changed-files.d.ts +14 -6
  173. package/dist/providers/github/check-status-poster.d.ts +19 -3
  174. package/dist/providers/github/contributor-resolver.d.ts +1 -1
  175. package/dist/providers/github/lock-file.d.ts +1 -1
  176. package/dist/providers/github/normalizer.d.ts +1 -1
  177. package/dist/providers/github/repo-url.d.ts +1 -1
  178. package/dist/providers/local/lock-file-fetcher.d.ts +1 -1
  179. package/dist/providers/local/normalizer.d.ts +1 -1
  180. package/dist/providers/local/repo-url-builder.d.ts +1 -1
  181. package/dist/providers/universal-git/changed-files.d.ts +8 -7
  182. package/dist/providers/universal-git/clone-token.d.ts +1 -1
  183. package/dist/providers/universal-git/config.d.ts +4 -4
  184. package/dist/providers/universal-git/index.d.ts +5 -1
  185. package/dist/providers/universal-git/lock-file.d.ts +6 -1
  186. package/dist/providers/universal-git/normalizer.d.ts +1 -1
  187. package/dist/providers/universal-git/repo-url.d.ts +1 -1
  188. package/dist/queue/cleanup.d.ts +69 -8
  189. package/dist/queue/job-queue.d.ts +94 -14
  190. package/dist/queue/scheduled-job.d.ts +2 -2
  191. package/dist/registration/registration-index.d.ts +1 -1
  192. package/dist/reporting/agent-failure-category.d.ts +4 -1
  193. package/dist/reporting/check-run-reporter.d.ts +34 -14
  194. package/dist/reporting/check-run-tracking-store.d.ts +70 -8
  195. package/dist/reporting/execution-tracker.d.ts +156 -10
  196. package/dist/reporting/fs-log-storage.d.ts +31 -2
  197. package/dist/reporting/job-check-run-completion.d.ts +50 -0
  198. package/dist/reporting/log-chunk-sink.d.ts +47 -0
  199. package/dist/reporting/log-retention.d.ts +16 -0
  200. package/dist/reporting/log-storage.d.ts +64 -4
  201. package/dist/reporting/log-writer.d.ts +22 -7
  202. package/dist/reporting/peer-log-normalize.d.ts +14 -0
  203. package/dist/reporting/run-aggregator.d.ts +32 -32
  204. package/dist/reporting/s3-log-storage.d.ts +102 -8
  205. package/dist/routes/admin-auth.d.ts +90 -0
  206. package/dist/routes/admin-cluster-settings.d.ts +31 -0
  207. package/dist/routes/admin-events.d.ts +3 -0
  208. package/dist/routes/admin-orchestrator-drain.d.ts +35 -0
  209. package/dist/routes/admin-runs.d.ts +9 -0
  210. package/dist/routes/admin-sources.d.ts +7 -0
  211. package/dist/routes/admin-trust-policy.d.ts +49 -0
  212. package/dist/routes/admin.d.ts +15 -1
  213. package/dist/routes/github-webhook.d.ts +9 -3
  214. package/dist/routes/provenance-oidc.d.ts +38 -0
  215. package/dist/routes/verify-attestation.d.ts +21 -0
  216. package/dist/scaler/bare-metal-backend.d.ts +9 -2
  217. package/dist/scaler/config.d.ts +25 -4
  218. package/dist/scaler/container-backend.d.ts +9 -1
  219. package/dist/scaler/firecracker-backend.d.ts +29 -2
  220. package/dist/scaler/index.d.ts +1 -1
  221. package/dist/scaler/manager.d.ts +166 -8
  222. package/dist/scaler/pending-scale-sweeper.d.ts +35 -0
  223. package/dist/scaler/types.d.ts +75 -6
  224. package/dist/secrets/backend-registry.d.ts +32 -1
  225. package/dist/secrets/dashboard-encryption-key.d.ts +48 -0
  226. package/dist/secrets/ephemeral-keys.d.ts +16 -0
  227. package/dist/secrets/pg-secret-store.d.ts +10 -0
  228. package/dist/secrets/rbac.d.ts +5 -1
  229. package/dist/secrets/routing-key-scope.d.ts +6 -0
  230. package/dist/secrets/scope-routing.d.ts +126 -0
  231. package/dist/secrets/secret-resolver.d.ts +1 -14
  232. package/dist/secrets/token-manager.d.ts +5 -1
  233. package/dist/security/contributor-cache.d.ts +9 -1
  234. package/dist/security/trust-policy-gate.d.ts +117 -0
  235. package/dist/security/trust-policy-store.d.ts +78 -0
  236. package/dist/server.js +35769 -25052
  237. package/dist/sources/source-manager.d.ts +24 -0
  238. package/dist/stale-detector/stale-run-detector.d.ts +7 -0
  239. package/dist/standalone.js +34831 -25317
  240. package/dist/storage/filesystem.d.ts +17 -0
  241. package/dist/storage/key-discriminator.d.ts +20 -0
  242. package/dist/storage/s3.d.ts +2 -0
  243. package/dist/storage/types.d.ts +16 -0
  244. package/dist/webhook/dedup.d.ts +9 -1
  245. package/dist/webhook/event-log.d.ts +13 -2
  246. package/dist/webhook/generic-sources-listener.d.ts +4 -0
  247. package/dist/webhook/ingest-admission.d.ts +140 -0
  248. package/dist/webhook/ingest-overflow-buffer.d.ts +27 -0
  249. package/dist/webhook/ingest-overflow-replayer.d.ts +49 -0
  250. package/dist/webhook/ingest-overflow-types.d.ts +73 -0
  251. package/dist/webhook/loop-lag-source.d.ts +40 -0
  252. package/dist/webhook/observed-relay-guard.d.ts +40 -0
  253. package/dist/webhook/org-ingest-cap-reader.d.ts +24 -0
  254. package/dist/webhook/register-source-bundle.d.ts +3 -0
  255. package/dist/webhook/relay-reinject.d.ts +43 -0
  256. package/dist/worker/in-memory-job-queue.d.ts +8 -3
  257. package/dist/worker-core.d.ts +10 -0
  258. package/dist/ws/agent-api-registry.d.ts +20 -0
  259. package/dist/ws/agent-handler.d.ts +63 -7
  260. package/dist/ws/bringup-api.d.ts +99 -0
  261. package/dist/ws/dashboard-context-handler.d.ts +28 -10
  262. package/dist/ws/dashboard-run-state-handler.d.ts +31 -0
  263. package/dist/ws/failure-messages.d.ts +29 -0
  264. package/dist/ws/oidc-token-relay.d.ts +9 -0
  265. package/dist/ws/ownership-gate.d.ts +22 -0
  266. package/dist/ws/platform-client.d.ts +96 -1
  267. package/dist/ws/replay-chunker.d.ts +37 -0
  268. package/installer-image-digests.json +3 -3
  269. package/package.json +22 -21
  270. package/sbom.spdx.json +1240 -1788
@@ -1,5 +1,6 @@
1
- import { type OrchestratorToPlatformMessage, type WebhookRelay, type WebhookRelayResult, type TrustPolicyUpdate, type StaleCheckrunCleanup, type DashboardRunDetailRequest, type DashboardRunStructuredRequest, type DashboardRunsListRequest, type DashboardRunsFiltersRequest, type DashboardSourcesListRequest, type DashboardStepLogsRequest, type DashboardAttestationsListRequest, type DashboardAttestationsListAllRequest, type DashboardAttestationGetRequest, type DashboardAttestationRetryRequest, type DashboardOrchLogsRequest, type RunRerunRequest, type ManualScheduleRequest, type RunCancelRequest, type DashboardPayloadRequest, type DashboardPlatformToOrchMessage, type TestRelayRequest, type DashboardDiagnosticsRequest, type DashboardScalerCapacityRequest, type DashboardScalerAgentsRequest, type DashboardFleetHostsRequest, type DashboardFleetHostRequest, type DashboardFleetPreviewRequest, type DashboardFleetWorkflowsForHostRequest, type JoinRequest, type JoinResponse, type DeploymentIdentity, type OrchCapabilities, type OrchRole } from '@kici-dev/engine';
1
+ import { type StateReplayRun, type OrchestratorToPlatformMessage, type WebhookRelay, type WebhookRelayResult, type TrustPolicyUpdate, type StaleCheckrunCleanup, type DashboardRunDetailRequest, type DashboardRunStructuredRequest, type DashboardRunStateRequest, type DashboardRunsListRequest, type DashboardRunsFiltersRequest, type DashboardSourcesListRequest, type DashboardStepLogsRequest, type DashboardAttestationsListRequest, type DashboardAttestationsListAllRequest, type DashboardAttestationGetRequest, type DashboardAttestationRetryRequest, type DashboardArtifactsListRequest, type DashboardOrchLogsRequest, type RunRerunRequest, type ManualScheduleRequest, type RunCancelRequest, type DashboardPayloadRequest, type DashboardPlatformToOrchMessage, type TestRelayRequest, type DashboardDiagnosticsRequest, type DashboardScalerCapacityRequest, type DashboardScalerAgentsRequest, type DashboardFleetHostsRequest, type DashboardFleetHostRequest, type DashboardFleetPreviewRequest, type DashboardFleetWorkflowsForHostRequest, type JoinRequest, type JoinResponse, type DeploymentIdentity, type OrchCapabilities, type OrchRole } from '@kici-dev/engine';
2
2
  import { RelayBufferRegistry, type RelayStartMeta } from '../webhook/relay-buffer.js';
3
+ import type { AdmitResult } from '../webhook/ingest-admission.js';
3
4
  /**
4
5
  * Verification + processing outcome returned by the chunked relay path's
5
6
  * `onVerifyInbound` callback. Mirrors the shape exported by
@@ -11,6 +12,16 @@ export interface InboundVerifyOutcome {
11
12
  reason?: string;
12
13
  }
13
14
  export type ConnectionState = 'disconnected' | 'connecting' | 'authenticating' | 'authenticated';
15
+ /**
16
+ * Outcome of a chunked `state.replay` send. `skipped` names why the replay did
17
+ * not complete: an empty payload, a frame that failed wire validation locally,
18
+ * a socket that closed mid-send, or the circuit breaker being open.
19
+ */
20
+ export type ReplaySendResult = {
21
+ sent: number;
22
+ chunks: number;
23
+ skipped?: 'empty' | 'invalid' | 'disconnected' | 'breaker';
24
+ };
14
25
  /**
15
26
  * A webhook source that this orchestrator manages.
16
27
  * Sent to Platform after auth.success so the Platform knows which
@@ -110,6 +121,8 @@ export interface PlatformClientOptions {
110
121
  onDashboardRunDetail?: (msg: DashboardRunDetailRequest) => void;
111
122
  /** Optional callback for dashboard structured run-result requests from Platform. */
112
123
  onDashboardRunStructured?: (msg: DashboardRunStructuredRequest) => void;
124
+ /** Optional callback for the run-state system reconciliation read from Platform. */
125
+ onDashboardRunState?: (msg: DashboardRunStateRequest) => void;
113
126
  /** Optional callback for dashboard runs.list (operator console) requests from Platform. */
114
127
  onDashboardRunsList?: (msg: DashboardRunsListRequest) => void;
115
128
  /** Optional callback for dashboard runs.filters (operator console) requests from Platform. */
@@ -125,6 +138,8 @@ export interface PlatformClientOptions {
125
138
  /** Optional callback for single-attestation detail requests from Platform. */
126
139
  onDashboardAttestationGet?: (msg: DashboardAttestationGetRequest) => void;
127
140
  onDashboardAttestationRetry?: (msg: DashboardAttestationRetryRequest) => void;
141
+ /** Optional callback for dashboard artifacts-list requests from Platform. */
142
+ onDashboardArtifactsList?: (msg: DashboardArtifactsListRequest) => void;
128
143
  /** Optional callback for run re-run requests from Platform (dashboard action). */
129
144
  onRunRerun?: (msg: RunRerunRequest) => void;
130
145
  /** Optional callback for manual schedule trigger requests from Platform (dashboard action). */
@@ -165,6 +180,17 @@ export interface PlatformClientOptions {
165
180
  onJoinRequest?: (msg: JoinRequest) => Promise<JoinResponse>;
166
181
  /** Custom orchestrator capabilities to merge with ORCH_CAPABILITIES in auth.request. */
167
182
  orchCapabilities?: Partial<OrchCapabilities>;
183
+ /**
184
+ * Test-only. Whether the orchestrator runs in test mode (config
185
+ * `KICI_TEST_MODE=1`). Gates `testOmitDashboardRequestTypes`.
186
+ */
187
+ testMode?: boolean;
188
+ /**
189
+ * Test-only. Comma-separated `dashboard.*` request types to drop from the
190
+ * advertised capability manifest (config `KICI_TEST_OMIT_DASHBOARD_REQUEST_TYPES`).
191
+ * Only honored when `testMode` is true; production leaves both unset.
192
+ */
193
+ testOmitDashboardRequestTypes?: string;
168
194
  /**
169
195
  * Verify a reassembled inbound webhook from the chunked relay path.
170
196
  *
@@ -179,6 +205,21 @@ export interface PlatformClientOptions {
179
205
  * TTL; production constructs a default one per PlatformClient.
180
206
  */
181
207
  relayBuffer?: RelayBufferRegistry;
208
+ /**
209
+ * Webhook-ingest admission hook. Called with the relay's routing key BEFORE
210
+ * signature verification (so an unverified flood is throttled too — a verify
211
+ * does a DB read). When it sheds, the relay acks `shed_retry_later` (429) and
212
+ * no pipeline work runs. When it admits, the returned slot is held for the
213
+ * fire-and-forget pipeline's lifetime and released on completion / error /
214
+ * timeout. Absent → no admission gate (tests, minimal wirings).
215
+ */
216
+ onAdmit?: (routingKey: string) => Promise<AdmitResult>;
217
+ /**
218
+ * Optional durable-overflow capture seam. Invoked with the pre-verify relay
219
+ * meta + assembled body on a shed, before the shed_retry_later ack. Best-effort
220
+ * — the client wraps it so a capture failure never blocks the ack.
221
+ */
222
+ onShedCapture?: (meta: RelayStartMeta, body: Buffer) => Promise<void>;
182
223
  }
183
224
  /** Error `*.response` frame shape for a dashboard request that failed validation. */
184
225
  export interface DashboardRequestErrorFrame {
@@ -216,6 +257,14 @@ export declare class PlatformClient {
216
257
  private heartbeatTimer;
217
258
  private reconnectTimer;
218
259
  private reconnectAttempts;
260
+ /** Armed on auth; resets the backoff only if the connection survives it. */
261
+ private stabilityTimer;
262
+ /** True once the current connection has survived CONNECTION_STABLE_MS. */
263
+ private connectionProvenStable;
264
+ /** True once a state replay has been sent on the current connection. */
265
+ private replaySentOnConnection;
266
+ private replayConsecutiveFailures;
267
+ private replayBreakerOpen;
219
268
  private intentionalDisconnect;
220
269
  private readonly url;
221
270
  private readonly token;
@@ -233,6 +282,16 @@ export declare class PlatformClient {
233
282
  * awaits the Platform's matching `.response`; rejected on timeout or close.
234
283
  */
235
284
  private readonly orchRpc;
285
+ /**
286
+ * Platform capabilities advertised on this connection (Platform → orchestrator
287
+ * `platform.capabilities` frame). `undefined` means nothing advertised yet —
288
+ * either a pre-capability Platform (which never advertises) or the frame has
289
+ * not arrived. Feature-gated sends treat "undefined" as optimistic (send
290
+ * anyway, backward-safe); only an advertised-but-absent flag suppresses a send.
291
+ * Reset to `undefined` on every (re)connect so a stale advertisement can't
292
+ * leak across connections.
293
+ */
294
+ private platformCapabilities;
236
295
  private readonly instanceId?;
237
296
  private readonly clusterName?;
238
297
  private readonly clusterId?;
@@ -252,6 +311,7 @@ export declare class PlatformClient {
252
311
  private readonly onProvenanceIssuer?;
253
312
  private readonly onDashboardRunDetail?;
254
313
  private readonly onDashboardRunStructured?;
314
+ private readonly onDashboardRunState?;
255
315
  private readonly onDashboardRunsList?;
256
316
  private readonly onDashboardRunsFilters?;
257
317
  private readonly onDashboardSourcesList?;
@@ -260,6 +320,7 @@ export declare class PlatformClient {
260
320
  private readonly onDashboardAttestationsListAll?;
261
321
  private readonly onDashboardAttestationGet?;
262
322
  private readonly onDashboardAttestationRetry?;
323
+ private readonly onDashboardArtifactsList?;
263
324
  private readonly onRunRerun?;
264
325
  private readonly onManualSchedule?;
265
326
  private readonly onRunCancel?;
@@ -279,6 +340,8 @@ export declare class PlatformClient {
279
340
  private readonly onJoinRequest?;
280
341
  private orchCapabilities;
281
342
  private readonly onVerifyInbound?;
343
+ private readonly onAdmit?;
344
+ private readonly onShedCapture?;
282
345
  private readonly relayBuffer;
283
346
  /**
284
347
  * Public alias of the orchestrator's owning org as supplied by
@@ -334,6 +397,37 @@ export declare class PlatformClient {
334
397
  * If not authenticated, buffers the message for later delivery.
335
398
  */
336
399
  send(message: OrchestratorToPlatformMessage): void;
400
+ /**
401
+ * Send the reconnect state replay as N paced frames.
402
+ *
403
+ * The payload is bounded by BOTH the wire schema's run cap and the Platform
404
+ * limiter's byte budget, and paced under its refill rate, because a frame
405
+ * breaching either one is rejected with a 4003 close — and since reconnecting
406
+ * does not reduce the run count, an oversized frame is resent forever rather
407
+ * than failing once.
408
+ *
409
+ * Uses `this.ws.send` directly rather than `this.send()` on purpose: `send()`
410
+ * falls back to `this.eventBuffer` when the socket is not open, which for a
411
+ * multi-frame replay would queue the remaining frames for the NEXT connection
412
+ * instead of abandoning a replay whose connection has already gone. The
413
+ * Platform's replay handler upserts per run, so abandoning is safe — the next
414
+ * reconnect replays from scratch.
415
+ */
416
+ sendStateReplay(runs: StateReplayRun[]): Promise<ReplaySendResult>;
417
+ /**
418
+ * Send a feature-gated message only if the Platform is known to support the
419
+ * named capability — the orchestrator-side pre-flight for a self-hosted
420
+ * orchestrator running ahead of the hosted Platform.
421
+ *
422
+ * Backward-safe: a Platform that never advertised capabilities (a
423
+ * pre-capability build, or the advertisement hasn't arrived yet) is treated as
424
+ * "unknown → send optimistically", exactly like the Platform's dashboard
425
+ * pre-flight treats an absent `supportedDashboardRequests` as "unknown", never
426
+ * "supports nothing". Only an *advertised* capability set that explicitly lacks
427
+ * the flag suppresses the send — surfacing a diagnosable capability gap instead
428
+ * of firing a frame the Platform would silently drop.
429
+ */
430
+ sendIfPlatformSupports(capability: string, message: OrchestratorToPlatformMessage): void;
337
431
  /**
338
432
  * Send a raw message directly on the WebSocket, bypassing typed validation.
339
433
  * Used for log pull response messages (log.response) which are
@@ -425,6 +519,7 @@ export declare class PlatformClient {
425
519
  private startHeartbeat;
426
520
  private stopHeartbeat;
427
521
  private scheduleReconnect;
522
+ private clearStabilityTimer;
428
523
  private cancelReconnect;
429
524
  }
430
525
  //# sourceMappingURL=platform-client.d.ts.map
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Chunking for the reconnect `state.replay` payload.
3
+ *
4
+ * The wire schema caps `runs` at `STATE_REPLAY_MAX_RUNS` (500) and the
5
+ * Platform's WS limiter caps a single message at 4 MB with a 2 MB burst
6
+ * refilling at 500 KB/s, so a replay must be split on BOTH axes: a frame that
7
+ * breaches either one is dropped by the Platform, which closes the connection
8
+ * with 4003. Since nothing about reconnecting reduces the run count, an
9
+ * oversized frame is not a transient failure — the orchestrator rebuilds and
10
+ * resends it forever.
11
+ *
12
+ * Pure and I/O-free so the bounds can be shrunk in tests without building 500
13
+ * real runs.
14
+ */
15
+ /**
16
+ * Runs per frame. Deliberately below the schema's hard cap of 500 so growth in
17
+ * a run's `jobs` array cannot silently re-break the link.
18
+ */
19
+ export declare const REPLAY_CHUNK_MAX_RUNS = 200;
20
+ /** Serialized bytes per frame. A quarter of the limiter's 2 MB burst. */
21
+ export declare const REPLAY_CHUNK_MAX_BYTES: number;
22
+ /** Mirrors the Platform limiter's byte refill rate; the pacing divisor. */
23
+ export declare const REPLAY_BYTE_REFILL_BYTES_PER_SEC: number;
24
+ export interface ChunkBounds {
25
+ maxRuns: number;
26
+ maxBytes: number;
27
+ }
28
+ /**
29
+ * Split `runs` into frames obeying both bounds, preserving order.
30
+ *
31
+ * A single run larger than `maxBytes` cannot be split — it is emitted alone.
32
+ * That is why the byte test is guarded on a non-empty current chunk: without
33
+ * the guard an oversized run would either loop forever or emit an empty chunk,
34
+ * and an empty `runs` array is not a frame worth sending.
35
+ */
36
+ export declare function chunkReplayRuns<T>(runs: readonly T[], bounds?: ChunkBounds): T[][];
37
+ //# sourceMappingURL=replay-chunker.d.ts.map
@@ -1,7 +1,7 @@
1
1
  {
2
- "version": "0.1.27",
2
+ "version": "0.2.0",
3
3
  "images": {
4
- "kici-agent": "sha256:301120d679c7f199df1836bedde1ef896c9742f5212cd70753b84e89df195995",
5
- "kici-orchestrator": "sha256:03af091cc946da7b037ce048867684d8fcc3528fd1320fa7a408627ad2a55f76"
4
+ "kici-agent": "sha256:720a94642479888c0b1c5fbcfca6760f800b32977cea9cda0c9bfff1fc70875d",
5
+ "kici-orchestrator": "sha256:674cc72d66556eefbd4eeac6b45550b1a12bdda5d517542d24483f28348ecd04"
6
6
  }
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kici-dev/orchestrator",
3
- "version": "0.1.27",
3
+ "version": "0.2.0",
4
4
  "description": "Customer-deployable orchestrator for the KiCI CI/CD stack. Receives webhook events (direct or via Platform relay), matches triggers against the lock file, and dispatches jobs to connected agents.",
5
5
  "keywords": [
6
6
  "ci",
@@ -57,35 +57,35 @@
57
57
  }
58
58
  },
59
59
  "dependencies": {
60
- "@aws-sdk/client-s3": "^3.1064.0",
61
- "@aws-sdk/lib-storage": "^3.1064.0",
62
- "@aws-sdk/s3-request-presigner": "^3.1064.0",
63
- "@hono/node-server": "^1.19.14",
64
- "@hono/node-ws": "^1.3.1",
60
+ "@aws-sdk/client-kms": "^3.1089.0",
61
+ "@aws-sdk/client-s3": "^3.1089.0",
62
+ "@aws-sdk/lib-storage": "^3.1089.0",
63
+ "@aws-sdk/s3-request-presigner": "^3.1089.0",
64
+ "@hono/node-server": "^2.0.10",
65
65
  "@inquirer/prompts": "^8.5.2",
66
66
  "@octokit/auth-app": "^8.2.0",
67
67
  "@octokit/rest": "^22.0.1",
68
68
  "archiver": "^8.0.0",
69
69
  "commander": "^15.0.0",
70
70
  "croner": "^10.0.1",
71
- "dockerode": "^5.0.0",
72
- "hashi-vault-js": "^0.5.1",
73
- "hono": "^4.12.25",
71
+ "dockerode": "^5.0.1",
72
+ "hashi-vault-js": "^0.5.2",
73
+ "hono": "^4.12.32",
74
74
  "jose": "^6.1.0",
75
75
  "jsonpath-plus": "^10.4.0",
76
76
  "jszip": "^3.10.1",
77
- "kysely": "^0.29.2",
78
- "lru-cache": "^11.5.1",
79
- "nanoid": "^5.1.11",
80
- "pg": "^8.21.0",
81
- "picomatch": "^4.0.4",
77
+ "kysely": "^0.29.4",
78
+ "lru-cache": "^11.5.2",
79
+ "nanoid": "^6.0.0",
80
+ "pg": "^8.22.0",
81
+ "picomatch": "^4.0.5",
82
82
  "strip-ansi": "^7.2.0",
83
- "tar": "^7.5.16",
84
- "ws": "^8.21.0",
83
+ "tar": "^7.5.20",
84
+ "ws": "^8.21.1",
85
85
  "yaml": "^2.9.0",
86
86
  "zod": "^4.4.3",
87
- "@kici-dev/shared": "0.1.27",
88
- "@kici-dev/engine": "0.1.27"
87
+ "@kici-dev/engine": "0.2.0",
88
+ "@kici-dev/shared": "0.2.0"
89
89
  },
90
90
  "kici": {
91
91
  "metrics": {
@@ -98,12 +98,13 @@
98
98
  "devDependencies": {
99
99
  "@types/archiver": "^8.0.0",
100
100
  "@types/dockerode": "^4.0.1",
101
+ "@types/ws": "^8.18.1",
101
102
  "kysely-ctl": "^0.21.0",
102
- "@kici-dev/agent": "0.1.27"
103
+ "@kici-dev/agent": "0.2.0"
103
104
  },
104
105
  "scripts": {
105
- "build": "node ../../scripts/build-service.mjs && tsc --emitDeclarationOnly",
106
- "typecheck": "tsc --noEmit",
106
+ "build": "node ../../scripts/build-service.mjs && tsgo --emitDeclarationOnly",
107
+ "typecheck": "tsgo --noEmit",
107
108
  "test": "vitest run",
108
109
  "db:migrate": "kysely migrate:latest"
109
110
  }