@kici-dev/orchestrator 0.7.0 → 0.9.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 (75) hide show
  1. package/dist/__test-helpers__/test-db.d.ts +21 -0
  2. package/dist/app.d.ts +6 -5
  3. package/dist/artifacts/artifact-store.d.ts +6 -10
  4. package/dist/cache/legacy-prefixes.d.ts +19 -0
  5. package/dist/cache/pending-precursor-db-watcher.d.ts +79 -0
  6. package/dist/cache/pending-tracker.d.ts +10 -0
  7. package/dist/cache/precursor-result.d.ts +68 -0
  8. package/dist/cache/source-cache.d.ts +2 -1
  9. package/dist/cache/user-cache.d.ts +37 -58
  10. package/dist/cli/api-client.d.ts +3 -6
  11. package/dist/cli/commands/cache.d.ts +51 -0
  12. package/dist/cli/commands/cluster-settings.d.ts +0 -11
  13. package/dist/cli/commands/trust-policy.d.ts +12 -42
  14. package/dist/cli/service/privilege.d.ts +27 -6
  15. package/dist/cli.js +1171 -860
  16. package/dist/cluster/cluster-settings-reader.d.ts +1 -3
  17. package/dist/cluster/coordinator.d.ts +2 -3
  18. package/dist/cluster/join-client.d.ts +1 -39
  19. package/dist/config.d.ts +0 -6
  20. package/dist/contexts/context-store.d.ts +3 -3
  21. package/dist/contexts/held-runs.d.ts +6 -6
  22. package/dist/contexts/protection/aggregate.d.ts +5 -5
  23. package/dist/dashboard/handler.d.ts +1 -1
  24. package/dist/db/migrations/142_sweep_deprecated_columns.d.ts +4 -0
  25. package/dist/db/migrations/143_execution_jobs_precursor_result.d.ts +26 -0
  26. package/dist/db/migrations/144_execution_runs_registration_window.d.ts +32 -0
  27. package/dist/db/types.d.ts +27 -13
  28. package/dist/index.js +115 -156
  29. package/dist/metrics/prometheus.d.ts +2 -2
  30. package/dist/oidc/id-token-claims.d.ts +9 -10
  31. package/dist/oidc/local-mint.d.ts +9 -12
  32. package/dist/oidc/oidc-mint-registration.d.ts +15 -28
  33. package/dist/oidc/orchestrator-mint.d.ts +10 -10
  34. package/dist/oidc/resolve-signer.d.ts +40 -0
  35. package/dist/orchestrator-core.d.ts +11 -0
  36. package/dist/pipeline/dispatch-matched-workflow.d.ts +1 -2
  37. package/dist/pipeline/job-contexts.d.ts +2 -2
  38. package/dist/provenance/attestation-retrier.d.ts +11 -1
  39. package/dist/provenance/retrier-mint.d.ts +35 -0
  40. package/dist/providers/github/normalizer.d.ts +1 -28
  41. package/dist/providers/local/lock-file-fetcher.d.ts +8 -0
  42. package/dist/providers/local/normalizer.d.ts +1 -15
  43. package/dist/queue/job-queue.d.ts +2 -6
  44. package/dist/queue/terminalize-unroutable.d.ts +1 -1
  45. package/dist/reporting/execution-tracker.d.ts +107 -0
  46. package/dist/scaler/claim-store.d.ts +0 -2
  47. package/dist/scaler/event-backend.d.ts +7 -6
  48. package/dist/scaler/label-matcher.d.ts +0 -1
  49. package/dist/scaler/manager.d.ts +20 -26
  50. package/dist/scaler/scaler-state-store.d.ts +9 -2
  51. package/dist/scaler/types.d.ts +10 -0
  52. package/dist/scaler/warm-pool.d.ts +6 -4
  53. package/dist/security/global-workflow-policy.d.ts +3 -28
  54. package/dist/security/identity-link.d.ts +1 -1
  55. package/dist/security/lock-source.d.ts +1 -1
  56. package/dist/security/trust-directory-store.d.ts +1 -1
  57. package/dist/security/trust-policy-gate.d.ts +0 -14
  58. package/dist/security/trust-policy-store.d.ts +2 -3
  59. package/dist/security/trust-resolver.d.ts +1 -2
  60. package/dist/server.js +2810 -2524
  61. package/dist/stale-detector/all-terminal-runs.d.ts +31 -0
  62. package/dist/stale-detector/stale-run-detector.d.ts +20 -0
  63. package/dist/standalone.js +2956 -2610
  64. package/dist/webhook/ingest-overflow-replayer.d.ts +1 -1
  65. package/dist/webhook/relay-reinject.d.ts +1 -1
  66. package/dist/worker/in-memory-job-queue.d.ts +9 -0
  67. package/dist/ws/dashboard-global-workflows-handler.d.ts +3 -4
  68. package/dist/ws/fleet-agent-collector.d.ts +7 -0
  69. package/dist/ws/platform-client.d.ts +0 -15
  70. package/dist/ws/test-relay-handlers.d.ts +2 -0
  71. package/installer-image-digests.json +3 -3
  72. package/package.json +18 -17
  73. package/sbom.spdx.json +1178 -1352
  74. package/dist/ws/oidc-token-relay.d.ts +0 -79
  75. package/dist/ws/orch-rpc.d.ts +0 -9
@@ -0,0 +1,31 @@
1
+ import { type Kysely } from 'kysely';
2
+ import type { Database } from '../db/types.js';
3
+ /**
4
+ * Runs whose every job row is terminal while the run row is not.
5
+ *
6
+ * Every coordinator finalizes a run from its own in-memory view when the
7
+ * last job it hears about finishes, and defers while a sibling still has a
8
+ * registration window open on the run. So one shape reaches no finalizer at
9
+ * all: the coordinator that saw the last job deferred to a live window holder,
10
+ * and that holder then died before releasing it — its stale id reads as no
11
+ * window, but nothing re-drives the check on the coordinator that deferred.
12
+ * The same shape appears when a coordinator dies between its jobs going
13
+ * terminal and its own finalization.
14
+ *
15
+ * This sweep is the backstop: every job row terminal, the run row still
16
+ * `pending` or `running`, the last completion older than the stale threshold
17
+ * (so a normal completion in flight is not raced), and no LIVE registration
18
+ * window holder. The caller finishes each candidate through the tracker's
19
+ * DB-fallback completion, which is clobber-guarded and computes the status
20
+ * from the rows — so a run a coordinator finishes in the meantime is left as
21
+ * that coordinator wrote it.
22
+ */
23
+ export declare function selectAllTerminalRunCandidates(db: Kysely<Database>, opts: {
24
+ /** Runs whose last job completed before this instant qualify. */
25
+ threshold: Date;
26
+ /** Runs started before this instant are out of scope (ancient history). */
27
+ timeBound: Date;
28
+ /** How stale a `cluster_instances` heartbeat may be and still read as live. */
29
+ livenessGraceMs: number;
30
+ }): Promise<string[]>;
31
+ //# sourceMappingURL=all-terminal-runs.d.ts.map
@@ -12,6 +12,9 @@
12
12
  * - Optimistic concurrency: WHERE status='running' prevents race with agent completion
13
13
  * - Does NOT call executionTracker.onJobStatus() to avoid redundant DB writes
14
14
  * - Updates in-memory state and calls completeRunIfAllJobsTerminal for run completion
15
+ * - Finishes a run whose every job is terminal but whose finalizer never ran
16
+ * (a coordinator that died mid-way, or a registration-window holder that
17
+ * died after a sibling deferred to it)
15
18
  * - Force-terminates stale agents via scaler manager
16
19
  * - Updates GitHub check runs with timed_out conclusion
17
20
  */
@@ -49,6 +52,12 @@ export interface StaleRunDetectorDeps {
49
52
  staleThresholdMs: number;
50
53
  /** How often to scan for stale jobs in ms. Default: 60_000 */
51
54
  scanIntervalMs: number;
55
+ /**
56
+ * How stale a `cluster_instances` heartbeat may be and still read as live,
57
+ * for the all-terminal sweep's registration-window holder check. Defaults to
58
+ * {@link instanceLivenessGraceMs} at the default recovery grace period.
59
+ */
60
+ instanceLivenessGraceMs?: number;
52
61
  /** Held run store for expiring overdue held runs. Optional -- if not set, held run cleanup is skipped. */
53
62
  heldRunStore?: HeldRunStore;
54
63
  /** Step-approval bridge — notified when a step-scoped hold expires so the waiting agent fails the step. Optional. */
@@ -100,6 +109,7 @@ export declare class StaleRunDetector {
100
109
  private readonly rerouteFlapGraceFallbackMs;
101
110
  private readonly staleThresholdMs;
102
111
  private readonly scanIntervalMs;
112
+ private readonly instanceLivenessGraceMs;
103
113
  private readonly heldRunStore?;
104
114
  private readonly stepApprovalBridge?;
105
115
  private readonly failRun?;
@@ -188,6 +198,16 @@ export declare class StaleRunDetector {
188
198
  * so recovering jobs are naturally excluded.
189
199
  */
190
200
  scan(): Promise<void>;
201
+ /**
202
+ * Sub-scan F: runs left non-terminal after every job row went terminal.
203
+ *
204
+ * The coordinator that saw the last job finish defers finalization while a
205
+ * live sibling still has a registration window open on the run; a holder
206
+ * that then dies leaves nothing to re-drive that check. A coordinator that
207
+ * dies between its jobs going terminal and its own finalization leaves the
208
+ * same shape. Both are finished here from the rows.
209
+ */
210
+ private scanAllTerminalRuns;
191
211
  /**
192
212
  * Sub-scan A: Find running jobs with stale heartbeats.
193
213
  */