@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
@@ -80,7 +80,7 @@ export interface IngestOverflowReplayerDeps {
80
80
  * Refusal is per fairness key: a saturated org's rows are skipped for the rest
81
81
  * of the pass while other orgs' rows keep draining, mirroring the fair skip the
82
82
  * controller's own queue does. Reclaiming is not gated on load at all: a
83
- * stranded claim is stranded regardless, and the row it frees simply waits in
83
+ * stranded claim is stranded regardless, and the row it frees waits in
84
84
  * `buffered` until a reservation succeeds.
85
85
  */
86
86
  export declare class IngestOverflowReplayer {
@@ -36,7 +36,7 @@ export declare function parseRelayPayload(body: Buffer, headers: Record<string,
36
36
  * would be a second, redundant gate — and a refusal from it would be charged to
37
37
  * the delivery as a failed replay attempt, which is the defect this ordering
38
38
  * exists to remove. The slot is genuinely held: nothing here bypasses the
39
- * controller, the decision was simply made one step earlier.
39
+ * controller, the decision was made one step earlier.
40
40
  */
41
41
  export declare function buildRelayReinject(seams: RelayReinjectSeams): ReinjectFn;
42
42
  //# sourceMappingURL=relay-reinject.d.ts.map
@@ -104,6 +104,15 @@ export declare class InMemoryJobQueue {
104
104
  getFullJobById(jobId: string): Promise<QueuedJob | null>;
105
105
  /** Return all pending jobs. */
106
106
  getPendingJobs(): Promise<QueuedJob[]>;
107
+ /**
108
+ * Oldest-first listing of pending jobs, capped at `limit` — the worker-side
109
+ * twin of `JobQueue.listPending`. The dispatcher's capacity-freed re-drive
110
+ * (`retryPendingScaleRequests`) reads it on every worker whose scaler frees
111
+ * a slot; `worker-core` wires that hook exactly as the coordinator does.
112
+ * Insertion order is the enqueue order, which is what `created_at ASC` gives
113
+ * the DB queue.
114
+ */
115
+ listPending(limit: number): Promise<QueuedJob[]>;
107
116
  /** Always returns empty array. */
108
117
  getDispatchedJobIdsByRunId(_runId: string): Promise<string[]>;
109
118
  /** Lookup across pending and dispatched jobs (id / runId / status). */
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * Responds to `dashboard.global-workflows.*` WS messages from Platform by
5
5
  * reading or upserting the `org_settings` row keyed by `customer_id`. The row
6
- * holds the three per-org repo-pattern lists (allow / deny / elevate); each
6
+ * holds the per-org repo-pattern lists (allow / deny); each
7
7
  * entry is a `{routingKey?, pattern}` object that may optionally pin to one
8
8
  * source. The master enable switch is fleet-wide
9
9
  * (`cluster_settings.global_workflows_enabled`) and read-only here — projected
@@ -86,7 +86,6 @@ export declare class DashboardGlobalWorkflowsHandler {
86
86
  interface NormalizedPatch {
87
87
  allowedRepos: RepoPatternEntry[] | null;
88
88
  deniedRepos: RepoPatternEntry[] | null;
89
- elevatedRepos: RepoPatternEntry[] | null;
90
89
  }
91
90
  /**
92
91
  * Derive the effective storage state from an existing row (may be undefined)
@@ -97,8 +96,8 @@ export declare function buildPatch(existing: OrgSettings | undefined, msg: Globa
97
96
  /**
98
97
  * Project a row into the public settings shape. `enabled` is the effective
99
98
  * fleet-wide master switch, supplied by the caller (read-only here). When the
100
- * row does not yet exist, the three per-org lists project as null so callers
101
- * always get a renderable state.
99
+ * row does not yet exist, the per-org lists project as null so callers always
100
+ * get a renderable state.
102
101
  */
103
102
  export declare function rowToSettings(customerId: string, row: OrgSettings | undefined, enabled: boolean): GlobalWorkflowSettings;
104
103
  export {};
@@ -14,6 +14,13 @@ export declare class FleetAgentCollector {
14
14
  */
15
15
  request(requestId: string, agentId: string, send: () => void): Promise<Buffer>;
16
16
  onChunk(requestId: string, seq: number, dataB64: string, isLast: boolean): void;
17
+ /**
18
+ * Whether `requestId` is a collection this orchestrator asked `agentId` for
19
+ * and is still waiting on. The agent handler consults this before rate
20
+ * limiting a `fleet.bundle.chunk`: a solicited transfer is exempt, an
21
+ * unsolicited one is not.
22
+ */
23
+ isPendingFor(requestId: string, agentId: string): boolean;
17
24
  onError(requestId: string, message: string): void;
18
25
  /** Reject every pending request owned by `agentId` (called on its disconnect). */
19
26
  rejectAgent(agentId: string, reason: string): void;
@@ -315,12 +315,6 @@ export declare class PlatformClient {
315
315
  * `source.register.ack` arrives, or rejected on timeout / disconnect.
316
316
  */
317
317
  private readonly pendingSourceRegistrations;
318
- /**
319
- * Generic orchestrator-initiated RPC correlation (e.g. the provenance OIDC
320
- * mint). The orchestrator sends a `requestId`-keyed request over the WS and
321
- * awaits the Platform's matching `.response`; rejected on timeout or close.
322
- */
323
- private readonly orchRpc;
324
318
  /**
325
319
  * Platform capabilities advertised on this connection (Platform → orchestrator
326
320
  * `platform.capabilities` frame). `undefined` means nothing advertised yet —
@@ -493,15 +487,6 @@ export declare class PlatformClient {
493
487
  * NOT in the OrchestratorToPlatformMessage union (they are in the separate log pull schema).
494
488
  */
495
489
  sendRaw(data: unknown): void;
496
- /**
497
- * Send an orchestrator-initiated request over the Platform WS and await its
498
- * typed `.response`. The reverse of the Platform's dashboard-RPC pattern: we
499
- * hold the pending map and resolve on the echoed requestId. Rejects on timeout
500
- * or connection close; protocol-level errors arrive inside the response body.
501
- * The request type is a member of the typed orch->Platform union, so it rides
502
- * the validated `send()` path.
503
- */
504
- sendRequestAndAwait<Res>(type: OrchestratorToPlatformMessage['type'], payload: Record<string, unknown>, timeoutMs?: number): Promise<Res>;
505
490
  /**
506
491
  * Register a new source at runtime (e.g., after config reload adds a new GitHub app).
507
492
  * Separate from the post-auth registration which sends all sources at once.
@@ -67,6 +67,8 @@ export interface TestRunStatusPayload {
67
67
  jobName: string;
68
68
  status: string;
69
69
  errorMessage?: string | null;
70
+ /** Wall-clock job duration once the job has finished; null while it runs. */
71
+ durationMs?: number | null;
70
72
  }>;
71
73
  done: boolean;
72
74
  }
@@ -1,7 +1,7 @@
1
1
  {
2
- "version": "0.7.0",
2
+ "version": "0.9.0",
3
3
  "images": {
4
- "kici-agent": "sha256:ad6028feb1eda81eb8c1b53490fad8530a0b9137650d436250a8cfd2ec699eed",
5
- "kici-orchestrator": "sha256:f2706520bf3b8b196e2613deb8d0530ce4b50cc376261304b6eecee7f433385f"
4
+ "kici-agent": "sha256:371b518421c505041bc8b52eae3ce92e888f25b2cc2d4914f32420dbbf11df55",
5
+ "kici-orchestrator": "sha256:58c36d0222832fcb82b0af33cdb46d474b97654b0051cb6c54fa96fca9a13af2"
6
6
  }
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kici-dev/orchestrator",
3
- "version": "0.7.0",
3
+ "version": "0.9.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",
@@ -30,6 +30,7 @@
30
30
  "files": [
31
31
  "dist",
32
32
  "!dist/**/*.map",
33
+ "!dist/server-test.js",
33
34
  "!dist/server-test.d.ts",
34
35
  "!dist/testing",
35
36
  "sbom.spdx.json",
@@ -62,23 +63,23 @@
62
63
  }
63
64
  },
64
65
  "dependencies": {
65
- "@aws-sdk/client-kms": "^3.1121.0",
66
- "@aws-sdk/client-s3": "^3.1121.0",
67
- "@aws-sdk/lib-storage": "^3.1121.0",
68
- "@aws-sdk/s3-request-presigner": "^3.1121.0",
66
+ "@aws-sdk/client-kms": "^3.1135.0",
67
+ "@aws-sdk/client-s3": "^3.1135.0",
68
+ "@aws-sdk/lib-storage": "^3.1135.0",
69
+ "@aws-sdk/s3-request-presigner": "^3.1135.0",
69
70
  "@hono/node-server": "^2.1.1",
70
- "@inquirer/prompts": "^8.7.0",
71
- "@octokit/auth-app": "^8.3.0",
71
+ "@inquirer/prompts": "^8.7.2",
72
+ "@octokit/auth-app": "^8.3.1",
72
73
  "@octokit/rest": "^22.0.1",
73
74
  "archiver": "^8.0.0",
74
75
  "commander": "^15.0.0",
75
76
  "croner": "^10.0.1",
76
77
  "dockerode": "^5.0.1",
77
78
  "hashi-vault-js": "^0.5.3",
78
- "hono": "^4.13.2",
79
- "jose": "^6.2.10",
79
+ "hono": "^4.13.7",
80
+ "jose": "^6.2.12",
80
81
  "jsonpath-plus": "^10.4.0",
81
- "jszip": "^3.10.1",
82
+ "jszip": "^3.10.2",
82
83
  "kysely": "^0.29.4",
83
84
  "lru-cache": "^11.5.2",
84
85
  "nanoid": "^6.0.1",
@@ -87,10 +88,10 @@
87
88
  "strip-ansi": "^7.2.0",
88
89
  "tar": "^7.5.22",
89
90
  "ws": "^8.21.3",
90
- "yaml": "^2.9.0",
91
- "zod": "^4.4.3",
92
- "@kici-dev/shared": "0.7.0",
93
- "@kici-dev/engine": "0.7.0"
91
+ "yaml": "^2.9.1",
92
+ "zod": "^4.6.5",
93
+ "@kici-dev/engine": "0.9.0",
94
+ "@kici-dev/shared": "0.9.0"
94
95
  },
95
96
  "kici": {
96
97
  "metrics": {
@@ -105,11 +106,11 @@
105
106
  "@types/dockerode": "^4.0.1",
106
107
  "@types/ws": "^8.18.1",
107
108
  "kysely-ctl": "^0.21.0",
108
- "@kici-dev/agent": "0.7.0"
109
+ "@kici-dev/agent": "0.9.0"
109
110
  },
110
111
  "scripts": {
111
- "build": "node ../../scripts/build-service.mjs && tsgo --emitDeclarationOnly",
112
- "typecheck": "tsgo --noEmit",
112
+ "build": "node ../../scripts/build-service.mjs && tsc --emitDeclarationOnly",
113
+ "typecheck": "tsc --noEmit",
113
114
  "test": "vitest run",
114
115
  "db:migrate": "kysely migrate:latest"
115
116
  }