@kici-dev/orchestrator 0.1.24 → 0.1.26

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 (61) hide show
  1. package/dist/app.d.ts +24 -0
  2. package/dist/audit/access-log.d.ts +4 -0
  3. package/dist/cancel/cancel-run.d.ts +2 -0
  4. package/dist/cli/api-client.d.ts +2 -0
  5. package/dist/cli/commands/attestations-list.d.ts +49 -0
  6. package/dist/cli/commands/attestations-retry.d.ts +28 -0
  7. package/dist/cli/commands/attestations.d.ts +2 -1
  8. package/dist/cli/commands/cluster.d.ts +3 -0
  9. package/dist/cli/local-github-ingress-url.d.ts +8 -0
  10. package/dist/cli.js +1021 -404
  11. package/dist/cluster/cluster-identity.d.ts +11 -0
  12. package/dist/cluster/reconcile-identity.d.ts +50 -0
  13. package/dist/cold-store/load-access-log-range.d.ts +4 -0
  14. package/dist/config.d.ts +2 -0
  15. package/dist/dashboard/attestation-filters.d.ts +62 -1
  16. package/dist/dashboard/handler.d.ts +24 -4
  17. package/dist/db/migrations/061_execution_runs_environment_id.d.ts +4 -0
  18. package/dist/db/migrations/062_execution_runs_agent_label.d.ts +4 -0
  19. package/dist/db/migrations/063_access_log_agent_label_index.d.ts +10 -0
  20. package/dist/db/migrations/064_execution_jobs_skipped_environments.d.ts +17 -0
  21. package/dist/db/migrations/065_pending_attestations.d.ts +22 -0
  22. package/dist/db/migrations/066_pending_attestations_rejected.d.ts +13 -0
  23. package/dist/db/types.d.ts +58 -0
  24. package/dist/environments/protection/satisfiability.d.ts +14 -9
  25. package/dist/events/circuit-breaker.d.ts +8 -5
  26. package/dist/events/event-router.d.ts +12 -4
  27. package/dist/events/event-store.d.ts +21 -3
  28. package/dist/events/trust-store.d.ts +6 -1
  29. package/dist/events/types.d.ts +6 -1
  30. package/dist/helpers/rate-limiter.d.ts +17 -2
  31. package/dist/index.js +2 -1
  32. package/dist/metrics/prometheus.d.ts +6 -0
  33. package/dist/pipeline/dispatch-matched-workflow.d.ts +6 -0
  34. package/dist/pipeline/manual-schedule.d.ts +1 -1
  35. package/dist/pipeline/process-webhook.d.ts +14 -1
  36. package/dist/pipeline/rerun.d.ts +1 -1
  37. package/dist/pipeline/test-pipeline.d.ts +6 -0
  38. package/dist/provenance/attestation-retrier.d.ts +92 -0
  39. package/dist/provenance/backfill-run.d.ts +41 -0
  40. package/dist/provenance/pending-attestations-repo.d.ts +64 -0
  41. package/dist/provenance/verify-at-ingest.d.ts +10 -3
  42. package/dist/reporting/execution-tracker.d.ts +15 -3
  43. package/dist/reporting/run-aggregator.d.ts +5 -1
  44. package/dist/routes/admin-access-log.d.ts +2 -1
  45. package/dist/routes/admin.d.ts +14 -0
  46. package/dist/routes/github-webhook.d.ts +37 -0
  47. package/dist/routes/health.d.ts +9 -0
  48. package/dist/routes/webhooks.d.ts +2 -4
  49. package/dist/server.js +3462 -1886
  50. package/dist/sources/source-store.d.ts +6 -0
  51. package/dist/stale-detector/workflow-deadline-detector.d.ts +25 -0
  52. package/dist/standalone.js +19335 -18258
  53. package/dist/webhook/dedup.d.ts +14 -0
  54. package/dist/ws/agent-handler.d.ts +23 -0
  55. package/dist/ws/oidc-token-relay.d.ts +31 -21
  56. package/dist/ws/orch-rpc.d.ts +9 -0
  57. package/dist/ws/platform-client.d.ts +18 -1
  58. package/dist/ws/test-relay-handlers.d.ts +2 -0
  59. package/installer-image-digests.json +3 -3
  60. package/package.json +5 -5
  61. package/sbom.spdx.json +55 -50
package/dist/app.d.ts CHANGED
@@ -54,6 +54,8 @@ import type { FleetAgentCollector } from './ws/fleet-agent-collector.js';
54
54
  import type { FleetTopology } from './diagnostics/fleet-topology.js';
55
55
  import type { TokenManager } from './secrets/token-manager.js';
56
56
  import type { SecretResolver } from './secrets/secret-resolver.js';
57
+ import type { VerifyInboundDeps } from './webhook/verify-inbound.js';
58
+ import type { SourceStore } from './sources/source-store.js';
57
59
  import { type AdminRouteDeps } from './routes/admin.js';
58
60
  import type { RegistrationStore } from './registration/registration-store.js';
59
61
  import type { RegistrationIndex } from './registration/registration-index.js';
@@ -83,6 +85,12 @@ export interface AppDependencies {
83
85
  db: Kysely<Database>;
84
86
  pool: pg.Pool;
85
87
  registry: AgentRegistry;
88
+ /**
89
+ * Warmth latch surfaced on `GET /ready`. Returns `true` only once the
90
+ * orchestrator boot sequence has finished. When provided, `/ready` returns
91
+ * `503` until boot completes. Absent → warm defaults to `true`.
92
+ */
93
+ isWarm?: () => boolean;
86
94
  /** Host roster store for runsOnAll fan-out resolution. */
87
95
  hostRosterStore?: HostRosterStore;
88
96
  dispatcher: Dispatcher;
@@ -91,6 +99,19 @@ export interface AppDependencies {
91
99
  lockFileCache: LockFileCache;
92
100
  providerRegistry: ProviderRegistry;
93
101
  platformClient?: PlatformClient;
102
+ /**
103
+ * Fulfil deferred attestations on demand (mints in this process, which owns
104
+ * the Platform WS). Backs `POST /api/v1/admin/attestations/retry`. Wired only
105
+ * in coordinator mode where the retrier exists.
106
+ */
107
+ retryAttestations?: (opts: {
108
+ runId?: string;
109
+ includeRejected?: boolean;
110
+ }) => Promise<{
111
+ minted: number;
112
+ stillPending: number;
113
+ rejected: number;
114
+ }>;
94
115
  scalerManager?: ScalerManager;
95
116
  /** Bundle cache for compiled workflow bundles. Optional — requires S3 storage. */
96
117
  sourceCache?: SourceCache;
@@ -169,6 +190,9 @@ export interface AppDependencies {
169
190
  eventEmitter?: EventEmitter;
170
191
  /** Generic webhook source manager. Optional -- if not set, generic webhooks are disabled. */
171
192
  genericSourceManager?: GenericSourceManager;
193
+ /** GitHub direct-ingress route deps (hybrid/independent only). Optional -- if not set, the direct GitHub ingress route is not mounted. */
194
+ githubSourceStore?: SourceStore;
195
+ githubVerifyDeps?: VerifyInboundDeps;
172
196
  /** Trust store for cross-repo event trust. Optional -- if not set, trust management admin routes are unavailable. */
173
197
  trustStore?: TrustStore;
174
198
  /** Observer registry for broadcasting status/log updates to CLI observers. Optional -- if not set, observer features are inactive. */
@@ -36,6 +36,10 @@ export interface AccessLogQueryFilter {
36
36
  toTimestamp?: Date | string;
37
37
  /** Full-text search over error_message (trigram-indexed). */
38
38
  q?: string;
39
+ /** Exact-match filter on the agent provenance label (`agent_label` column). */
40
+ agentLabel?: string;
41
+ /** When true, return only agent-attributed rows (`agent_label IS NOT NULL`). */
42
+ agentOnly?: boolean;
39
43
  limit?: number;
40
44
  cursor?: string;
41
45
  }
@@ -33,6 +33,8 @@ export interface CancelRunOptions {
33
33
  force?: boolean;
34
34
  /** Attribution stamped into execution_runs.cancelled_by. */
35
35
  cancelledBy?: string;
36
+ /** Agent provenance label stamped into execution_runs.cancelled_by_agent_label. */
37
+ cancelledByAgentLabel?: string | null;
36
38
  }
37
39
  export interface CancelRunResult {
38
40
  /** Number of `job.cancel` messages dispatched to agents (running jobs). */
@@ -444,6 +444,8 @@ export declare class AdminApiClient {
444
444
  from?: string;
445
445
  to?: string;
446
446
  q?: string;
447
+ agentLabel?: string;
448
+ agentOnly?: boolean;
447
449
  limit?: number;
448
450
  cursor?: string;
449
451
  }): Promise<{
@@ -0,0 +1,49 @@
1
+ /**
2
+ * `kici-admin attestations list` runner — a read-only projection of the
3
+ * orchestrator `attestations` table into a JSON envelope mirroring
4
+ * `runs list --json`'s shape. The DB read is injected so the row→envelope
5
+ * mapping is unit-testable without a Postgres connection (mirrors
6
+ * attestations-retry.ts's injected-transport pattern).
7
+ */
8
+ import type { Kysely } from 'kysely';
9
+ import type { Database } from '../../db/types.js';
10
+ /** One attestation row as read from the orchestrator DB (snake_case columns). */
11
+ export interface AttestationListDbRow {
12
+ id: string;
13
+ run_id: string;
14
+ job_id: string;
15
+ subject_name: string;
16
+ verify_status: string;
17
+ created_at: Date;
18
+ }
19
+ /** One attestation as rendered in the CLI JSON envelope (camelCase). */
20
+ export interface AttestationListItem {
21
+ id: string;
22
+ runId: string;
23
+ jobId: string;
24
+ subjectName: string;
25
+ verifyStatus: string;
26
+ createdAt: string;
27
+ }
28
+ /** Scope + bound for a list read. Filters are applied by the read fn. */
29
+ export interface AttestationListOptions {
30
+ limit: number;
31
+ runId?: string;
32
+ jobId?: string;
33
+ }
34
+ /** The `--json` envelope (mirrors `runs list --json`'s `{ runs: [...] }`). */
35
+ export interface AttestationListResult {
36
+ attestations: AttestationListItem[];
37
+ }
38
+ /**
39
+ * Map the injected DB read into the CLI envelope. `limit` / `runId` / `jobId`
40
+ * are honored by the injected `read` fn (the real one is a Kysely query); this
41
+ * runner owns only the row→envelope projection, so it stays pure and testable.
42
+ */
43
+ export declare function runAttestationList(read: (opts: AttestationListOptions) => Promise<AttestationListDbRow[]>, opts: AttestationListOptions): Promise<AttestationListResult>;
44
+ /**
45
+ * Build the real DB read: a Kysely query over `attestations`, newest first,
46
+ * with optional run/job filters and a row cap.
47
+ */
48
+ export declare function readAttestations(db: Kysely<Database>): (opts: AttestationListOptions) => Promise<AttestationListDbRow[]>;
49
+ //# sourceMappingURL=attestations-list.d.ts.map
@@ -0,0 +1,28 @@
1
+ /**
2
+ * `kici-admin attestations retry` runner. Triggers an immediate drain of the
3
+ * deferred-attestation outbox on the running orchestrator via the admin API —
4
+ * minting happens in the orchestrator process, which owns the authenticated
5
+ * Platform WebSocket. `--run-id` scopes to one run; otherwise the whole outbox
6
+ * drains (the `--all-pending` flag is the explicit form of the default).
7
+ */
8
+ export interface AttestationRetryOptions {
9
+ runId?: string;
10
+ allPending?: boolean;
11
+ includeRejected?: boolean;
12
+ }
13
+ export interface AttestationRetryResult {
14
+ minted: number;
15
+ stillPending: number;
16
+ rejected: number;
17
+ }
18
+ /**
19
+ * Post the retry request through the injected transport (the admin API POST)
20
+ * and return the counts. Validates that the scope is unambiguous. When
21
+ * `includeRejected` is set, previously terminally-rejected rows are re-armed
22
+ * and re-attempted in the same drain.
23
+ */
24
+ export declare function runAttestationRetry(post: (body: {
25
+ runId?: string;
26
+ includeRejected?: boolean;
27
+ }) => Promise<AttestationRetryResult>, opts: AttestationRetryOptions): Promise<AttestationRetryResult>;
28
+ //# sourceMappingURL=attestations-retry.d.ts.map
@@ -1,3 +1,4 @@
1
1
  import type { Command } from 'commander';
2
- export declare function registerAttestationsCommands(program: Command): void;
2
+ import type { AdminApiClient } from '../api-client.js';
3
+ export declare function registerAttestationsCommands(program: Command, getClient: () => AdminApiClient): void;
3
4
  //# sourceMappingURL=attestations.d.ts.map
@@ -0,0 +1,3 @@
1
+ import type { Command } from 'commander';
2
+ export declare function registerClusterCommands(program: Command): void;
3
+ //# sourceMappingURL=cluster.d.ts.map
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Build the orchestrator's OWN direct GitHub ingress URL for a source, from
3
+ * the configured public base (`KICI_WEBHOOK_PUBLIC_URL`). Returns null when no
4
+ * public base is configured (the CLI then prints an honest "set
5
+ * KICI_WEBHOOK_PUBLIC_URL" note instead of a fabricated URL).
6
+ */
7
+ export declare function buildLocalGithubIngressUrl(webhookPublicUrl: string | undefined, orgId: string, sourceId: string): string | null;
8
+ //# sourceMappingURL=local-github-ingress-url.d.ts.map