@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.
- package/dist/__test-helpers__/mock-db.d.ts +2 -0
- package/dist/agent/dispatcher.d.ts +52 -2
- package/dist/agent/host-roster-reaper.d.ts +1 -2
- package/dist/agent/host-roster.d.ts +34 -0
- package/dist/agent/ownership-refusal.d.ts +12 -0
- package/dist/agent/ownership-tracker.d.ts +64 -16
- package/dist/agent/token-store.d.ts +13 -0
- package/dist/agent-packaging/availability.d.ts +27 -0
- package/dist/agent-packaging/build-package.d.ts +16 -0
- package/dist/agent-packaging/download.d.ts +30 -0
- package/dist/agent-packaging/index.d.ts +9 -0
- package/dist/agent-packaging/install-closure.d.ts +30 -0
- package/dist/agent-packaging/node-binary.d.ts +26 -0
- package/dist/agent-packaging/refresh.d.ts +50 -0
- package/dist/agent-packaging/store.d.ts +15 -0
- package/dist/agent-packaging/upload.d.ts +24 -0
- package/dist/app-on-error.d.ts +29 -0
- package/dist/app.d.ts +56 -4
- package/dist/artifacts/artifact-store.d.ts +233 -0
- package/dist/artifacts/failure-messages.d.ts +46 -0
- package/dist/audit/access-log.d.ts +18 -1
- package/dist/cache/dep-cache.d.ts +15 -0
- package/dist/cache/user-cache.d.ts +37 -0
- package/dist/cancel/cancel-run.d.ts +10 -3
- package/dist/cancel/dashboard-cancel-handler.d.ts +19 -0
- package/dist/cli/api-client.d.ts +22 -1
- package/dist/cli/commands/agent-package.d.ts +34 -0
- package/dist/cli/commands/check-run.d.ts +26 -0
- package/dist/cli/commands/cluster-settings.d.ts +55 -0
- package/dist/cli/commands/dashboard-encryption-key.d.ts +3 -0
- package/dist/cli/commands/db-backup.d.ts +71 -0
- package/dist/cli/commands/orchestrator-service/drain.d.ts +31 -0
- package/dist/cli/commands/orchestrator-service/index.d.ts +7 -4
- package/dist/cli/commands/orchestrator-service/install-env.d.ts +58 -0
- package/dist/cli/commands/secret.d.ts +45 -1
- package/dist/cli/commands/shared/admin-cli-access-log.d.ts +46 -0
- package/dist/cli/commands/shared/versioned-upgrade.d.ts +65 -2
- package/dist/cli/commands/signing-key.d.ts +3 -0
- package/dist/cli/commands/source.d.ts +12 -0
- package/dist/cli/commands/token.d.ts +9 -0
- package/dist/cli/commands/trust-policy.d.ts +48 -0
- package/dist/cli/join.d.ts +1 -1
- package/dist/cli/service/index.d.ts +2 -2
- package/dist/cli/service/instance/manifest.d.ts +17 -0
- package/dist/cli/service/instance/resolve.d.ts +11 -0
- package/dist/cli/wizard/orchestrator-wizard.d.ts +39 -11
- package/dist/cli.js +9818 -3408
- package/dist/cluster/cluster-settings-reader.d.ts +78 -0
- package/dist/cluster/coordinator.d.ts +81 -9
- package/dist/cluster/join-client.d.ts +1 -1
- package/dist/cluster/leader-gated-scheduler.d.ts +50 -0
- package/dist/cluster/orphan-recovery.d.ts +14 -0
- package/dist/cluster/peer-client.d.ts +12 -2
- package/dist/cluster/peer-handler.d.ts +15 -4
- package/dist/cluster/peer-registry.d.ts +12 -0
- package/dist/cluster/verified-issuer-poller.d.ts +11 -0
- package/dist/cluster/verified-issuer.d.ts +63 -0
- package/dist/cold-store/tables/access-log.d.ts +1 -1
- package/dist/cold-store/tables/event-log.d.ts +1 -1
- package/dist/cold-store/tables/execution-jobs.d.ts +1 -1
- package/dist/cold-store/tables/execution-runs.d.ts +1 -1
- package/dist/cold-store/tables/execution-steps.d.ts +1 -1
- package/dist/cold-store/tables/secret-audit-log.d.ts +1 -1
- package/dist/config/loader.d.ts +1 -1
- package/dist/config/resolver.d.ts +2 -1
- package/dist/config/schema.d.ts +8 -6
- package/dist/config/types.d.ts +3 -2
- package/dist/config.d.ts +363 -53
- package/dist/contexts/context-store.d.ts +21 -8
- package/dist/contexts/glob-specificity.d.ts +30 -0
- package/dist/contexts/held-runs.d.ts +51 -19
- package/dist/contexts/protection/aggregate.d.ts +2 -2
- package/dist/contexts/protection/concurrency-gate.d.ts +0 -3
- package/dist/contexts/protection/reviewer-gate.d.ts +0 -3
- package/dist/contexts/protection/satisfiability.d.ts +1 -1
- package/dist/contexts/protection/trust-gate.d.ts +0 -3
- package/dist/contexts/protection/wait-timer-gate.d.ts +0 -3
- package/dist/cron/cron-scheduler.d.ts +24 -4
- package/dist/cron/cron-store.d.ts +21 -7
- package/dist/dashboard/attestation-filters.d.ts +92 -74
- package/dist/dashboard/handler.d.ts +35 -1
- package/dist/db/migration-test-harness.d.ts +41 -0
- package/dist/db/migrations/069_reroute_tunables.d.ts +21 -0
- package/dist/db/migrations/070_execution_runs_failure_class.d.ts +4 -0
- package/dist/db/migrations/071_batch_accumulation.d.ts +26 -0
- package/dist/db/migrations/072_dispatch_queue_run_id_index.d.ts +15 -0
- package/dist/db/migrations/073_org_settings_ingest_concurrency.d.ts +13 -0
- package/dist/db/migrations/074_normalize_zero_concurrency_limit.d.ts +13 -0
- package/dist/db/migrations/075_ingest_overflow_buffer.d.ts +16 -0
- package/dist/db/migrations/076_artifacts.d.ts +19 -0
- package/dist/db/migrations/077_backup_runs.d.ts +13 -0
- package/dist/db/migrations/078_org_settings_backup_staleness.d.ts +12 -0
- package/dist/db/migrations/079_org_settings_scaler_spawn_timeout.d.ts +14 -0
- package/dist/db/migrations/080_cluster_settings.d.ts +17 -0
- package/dist/db/migrations/081_org_settings_queue_timeout.d.ts +19 -0
- package/dist/db/migrations/082_host_s3_reachable.d.ts +16 -0
- package/dist/db/migrations/083_org_settings_artifact_caps.d.ts +18 -0
- package/dist/db/migrations/084_orchestrator_signing_keys.d.ts +20 -0
- package/dist/db/migrations/085_cluster_settings_reroute_flap_grace_ms.d.ts +12 -0
- package/dist/db/migrations/086_cluster_settings_max_fanout_hosts.d.ts +12 -0
- package/dist/db/migrations/087_cluster_settings_event_router_rate_limit.d.ts +12 -0
- package/dist/db/migrations/088_cluster_settings_cache_max_tarball_bytes.d.ts +12 -0
- package/dist/db/migrations/089_cluster_settings_cache_ttl_days.d.ts +12 -0
- package/dist/db/migrations/090_cluster_settings_concurrency_wait_timeout_ms.d.ts +12 -0
- package/dist/db/migrations/091_cluster_settings_agent_token_ttl_ms.d.ts +12 -0
- package/dist/db/migrations/092_cluster_settings_version.d.ts +16 -0
- package/dist/db/migrations/093_org_settings_sandbox_allowlist.d.ts +4 -0
- package/dist/db/migrations/094_dashboard_encryption_keys.d.ts +21 -0
- package/dist/db/migrations/095_dashboard_write_policy_tristate.d.ts +20 -0
- package/dist/db/migrations/096_multi_schedule_cron_last_fired.d.ts +4 -0
- package/dist/db/migrations/097_execution_runs_pr_number.d.ts +4 -0
- package/dist/db/migrations/098_execution_runs_customer_id.d.ts +4 -0
- package/dist/db/migrations/099_cluster_settings_dashboard_verified_issuer.d.ts +21 -0
- package/dist/db/migrations/100_held_runs_hold_type_vocabulary.d.ts +31 -0
- package/dist/db/migrations/101_contexts_hold_expiry_drop_default.d.ts +31 -0
- package/dist/db/migrations/102_dispatch_queue_agent_id.d.ts +20 -0
- package/dist/db/migrations/103_cluster_settings_ownership_db_check_timeout_ms.d.ts +20 -0
- package/dist/db/migrations/104_check_run_terminal_sent.d.ts +22 -0
- package/dist/db/migrations/105_org_trust_policy.d.ts +19 -0
- package/dist/db/migrations/106_cluster_settings_check_run_tracking_ttl_days.d.ts +18 -0
- package/dist/db/migrations/107_check_run_tracking_updated_at_index.d.ts +23 -0
- package/dist/db/repos/dashboard-encryption-keys-repo.d.ts +48 -0
- package/dist/db/repos/signing-keys-repo.d.ts +34 -0
- package/dist/db/types.d.ts +421 -7
- package/dist/deployment/deployment-identity.d.ts +87 -2
- package/dist/diagnostics/checks/backup.d.ts +18 -0
- package/dist/diagnostics/checks/index.d.ts +2 -1
- package/dist/diagnostics/fleet-collector.d.ts +1 -1
- package/dist/drain/drain-controller.d.ts +52 -0
- package/dist/events/batch-accumulator.d.ts +63 -0
- package/dist/events/circuit-breaker.d.ts +9 -3
- package/dist/events/event-emitter.d.ts +31 -0
- package/dist/events/event-retry-scanner.d.ts +12 -2
- package/dist/events/event-router.d.ts +29 -0
- package/dist/firecracker/host-network.d.ts +2 -0
- package/dist/firecracker/net-interfaces.d.ts +14 -0
- package/dist/github-app-name-refresher/github-app-name-refresher.d.ts +18 -8
- package/dist/index.d.ts +2 -0
- package/dist/index.js +604 -16
- package/dist/lockfile-cache.d.ts +4 -0
- package/dist/lockfile-validate.d.ts +16 -9
- package/dist/metrics/prometheus.d.ts +112 -15
- package/dist/oidc/aws-kms-signer.d.ts +37 -0
- package/dist/oidc/command-signer.d.ts +23 -0
- package/dist/oidc/db-signer.d.ts +48 -0
- package/dist/oidc/id-token-claims.d.ts +22 -9
- package/dist/oidc/jwt.d.ts +5 -2
- package/dist/oidc/local-dev-signer.d.ts +1 -1
- package/dist/oidc/oidc-mint-registration.d.ts +27 -11
- package/dist/oidc/orchestrator-mint.d.ts +97 -0
- package/dist/oidc/orchestrator-signer-factory.d.ts +33 -0
- package/dist/oidc/reconcile-signing-key.d.ts +21 -0
- package/dist/oidc/signer.d.ts +25 -0
- package/dist/oidc/signing-key-status.d.ts +23 -0
- package/dist/orchestrator-core.d.ts +42 -2
- package/dist/pipeline/decorating-secret-resolver.d.ts +3 -2
- package/dist/pipeline/dispatch-matched-workflow.d.ts +41 -0
- package/dist/pipeline/install-secrets-resolver.d.ts +12 -1
- package/dist/pipeline/manual-schedule.d.ts +20 -13
- package/dist/pipeline/pending-workflow-context.d.ts +1 -1
- package/dist/pipeline/process-webhook.d.ts +57 -2
- package/dist/pipeline/processor.d.ts +44 -8
- package/dist/pipeline/rerun.d.ts +12 -13
- package/dist/pipeline/resolve-sandbox-grant.d.ts +28 -0
- package/dist/pipeline/route-or-dispatch-jobs.d.ts +71 -0
- package/dist/pipeline/sandbox-allowlist-reader.d.ts +33 -0
- package/dist/policy/dashboard-write-policy.d.ts +9 -4
- package/dist/provenance/backfill-run.d.ts +1 -0
- package/dist/provenance/trust-root.d.ts +13 -0
- package/dist/providers/generic/normalizer.d.ts +1 -1
- package/dist/providers/github/auth.d.ts +1 -1
- package/dist/providers/github/changed-files.d.ts +14 -6
- package/dist/providers/github/check-status-poster.d.ts +19 -3
- package/dist/providers/github/contributor-resolver.d.ts +1 -1
- package/dist/providers/github/lock-file.d.ts +1 -1
- package/dist/providers/github/normalizer.d.ts +1 -1
- package/dist/providers/github/repo-url.d.ts +1 -1
- package/dist/providers/local/lock-file-fetcher.d.ts +1 -1
- package/dist/providers/local/normalizer.d.ts +1 -1
- package/dist/providers/local/repo-url-builder.d.ts +1 -1
- package/dist/providers/universal-git/changed-files.d.ts +8 -7
- package/dist/providers/universal-git/clone-token.d.ts +1 -1
- package/dist/providers/universal-git/config.d.ts +4 -4
- package/dist/providers/universal-git/index.d.ts +5 -1
- package/dist/providers/universal-git/lock-file.d.ts +6 -1
- package/dist/providers/universal-git/normalizer.d.ts +1 -1
- package/dist/providers/universal-git/repo-url.d.ts +1 -1
- package/dist/queue/cleanup.d.ts +69 -8
- package/dist/queue/job-queue.d.ts +94 -14
- package/dist/queue/scheduled-job.d.ts +2 -2
- package/dist/registration/registration-index.d.ts +1 -1
- package/dist/reporting/agent-failure-category.d.ts +4 -1
- package/dist/reporting/check-run-reporter.d.ts +34 -14
- package/dist/reporting/check-run-tracking-store.d.ts +70 -8
- package/dist/reporting/execution-tracker.d.ts +156 -10
- package/dist/reporting/fs-log-storage.d.ts +31 -2
- package/dist/reporting/job-check-run-completion.d.ts +50 -0
- package/dist/reporting/log-chunk-sink.d.ts +47 -0
- package/dist/reporting/log-retention.d.ts +16 -0
- package/dist/reporting/log-storage.d.ts +64 -4
- package/dist/reporting/log-writer.d.ts +22 -7
- package/dist/reporting/peer-log-normalize.d.ts +14 -0
- package/dist/reporting/run-aggregator.d.ts +32 -32
- package/dist/reporting/s3-log-storage.d.ts +102 -8
- package/dist/routes/admin-auth.d.ts +90 -0
- package/dist/routes/admin-cluster-settings.d.ts +31 -0
- package/dist/routes/admin-events.d.ts +3 -0
- package/dist/routes/admin-orchestrator-drain.d.ts +35 -0
- package/dist/routes/admin-runs.d.ts +9 -0
- package/dist/routes/admin-sources.d.ts +7 -0
- package/dist/routes/admin-trust-policy.d.ts +49 -0
- package/dist/routes/admin.d.ts +15 -1
- package/dist/routes/github-webhook.d.ts +9 -3
- package/dist/routes/provenance-oidc.d.ts +38 -0
- package/dist/routes/verify-attestation.d.ts +21 -0
- package/dist/scaler/bare-metal-backend.d.ts +9 -2
- package/dist/scaler/config.d.ts +25 -4
- package/dist/scaler/container-backend.d.ts +9 -1
- package/dist/scaler/firecracker-backend.d.ts +29 -2
- package/dist/scaler/index.d.ts +1 -1
- package/dist/scaler/manager.d.ts +166 -8
- package/dist/scaler/pending-scale-sweeper.d.ts +35 -0
- package/dist/scaler/types.d.ts +75 -6
- package/dist/secrets/backend-registry.d.ts +32 -1
- package/dist/secrets/dashboard-encryption-key.d.ts +48 -0
- package/dist/secrets/ephemeral-keys.d.ts +16 -0
- package/dist/secrets/pg-secret-store.d.ts +10 -0
- package/dist/secrets/rbac.d.ts +5 -1
- package/dist/secrets/routing-key-scope.d.ts +6 -0
- package/dist/secrets/scope-routing.d.ts +126 -0
- package/dist/secrets/secret-resolver.d.ts +1 -14
- package/dist/secrets/token-manager.d.ts +5 -1
- package/dist/security/contributor-cache.d.ts +9 -1
- package/dist/security/trust-policy-gate.d.ts +117 -0
- package/dist/security/trust-policy-store.d.ts +78 -0
- package/dist/server.js +35769 -25052
- package/dist/sources/source-manager.d.ts +24 -0
- package/dist/stale-detector/stale-run-detector.d.ts +7 -0
- package/dist/standalone.js +34831 -25317
- package/dist/storage/filesystem.d.ts +17 -0
- package/dist/storage/key-discriminator.d.ts +20 -0
- package/dist/storage/s3.d.ts +2 -0
- package/dist/storage/types.d.ts +16 -0
- package/dist/webhook/dedup.d.ts +9 -1
- package/dist/webhook/event-log.d.ts +13 -2
- package/dist/webhook/generic-sources-listener.d.ts +4 -0
- package/dist/webhook/ingest-admission.d.ts +140 -0
- package/dist/webhook/ingest-overflow-buffer.d.ts +27 -0
- package/dist/webhook/ingest-overflow-replayer.d.ts +49 -0
- package/dist/webhook/ingest-overflow-types.d.ts +73 -0
- package/dist/webhook/loop-lag-source.d.ts +40 -0
- package/dist/webhook/observed-relay-guard.d.ts +40 -0
- package/dist/webhook/org-ingest-cap-reader.d.ts +24 -0
- package/dist/webhook/register-source-bundle.d.ts +3 -0
- package/dist/webhook/relay-reinject.d.ts +43 -0
- package/dist/worker/in-memory-job-queue.d.ts +8 -3
- package/dist/worker-core.d.ts +10 -0
- package/dist/ws/agent-api-registry.d.ts +20 -0
- package/dist/ws/agent-handler.d.ts +63 -7
- package/dist/ws/bringup-api.d.ts +99 -0
- package/dist/ws/dashboard-context-handler.d.ts +28 -10
- package/dist/ws/dashboard-run-state-handler.d.ts +31 -0
- package/dist/ws/failure-messages.d.ts +29 -0
- package/dist/ws/oidc-token-relay.d.ts +9 -0
- package/dist/ws/ownership-gate.d.ts +22 -0
- package/dist/ws/platform-client.d.ts +96 -1
- package/dist/ws/replay-chunker.d.ts +37 -0
- package/installer-image-digests.json +3 -3
- package/package.json +22 -21
- package/sbom.spdx.json +1240 -1788
package/dist/db/types.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ import type { ApprovalRequirement, ApproverClause, InitFailure, StepApprovalPayl
|
|
|
7
7
|
export interface Database {
|
|
8
8
|
dispatch_queue: DispatchQueueTable;
|
|
9
9
|
dedup_cache: DedupCacheTable;
|
|
10
|
+
ingest_overflow_buffer: IngestOverflowBufferTable;
|
|
10
11
|
ip_allocations: IpAllocationTable;
|
|
11
12
|
execution_runs: ExecutionRunTable;
|
|
12
13
|
execution_jobs: ExecutionJobTable;
|
|
@@ -37,6 +38,8 @@ export interface Database {
|
|
|
37
38
|
cluster_meta: ClusterMetaTable;
|
|
38
39
|
join_tokens: JoinTokenTable;
|
|
39
40
|
org_settings: OrgSettingsTable;
|
|
41
|
+
org_trust_policy: OrgTrustPolicyTable;
|
|
42
|
+
cluster_settings: ClusterSettingsTable;
|
|
40
43
|
execution_job_needs: ExecutionJobNeedsTable;
|
|
41
44
|
pending_job_contexts: PendingJobContextsTable;
|
|
42
45
|
pending_workflow_contexts: PendingWorkflowContextsTable;
|
|
@@ -49,11 +52,67 @@ export interface Database {
|
|
|
49
52
|
scaler_agent_jobs: ScalerAgentJobsTable;
|
|
50
53
|
scaler_reservations: ScalerReservationsTable;
|
|
51
54
|
attestations: AttestationsTable;
|
|
55
|
+
orchestrator_signing_keys: OrchestratorSigningKeysTable;
|
|
56
|
+
dashboard_encryption_keys: DashboardEncryptionKeysTable;
|
|
52
57
|
pending_attestations: PendingAttestationsTable;
|
|
58
|
+
artifacts: ArtifactsTable;
|
|
53
59
|
remote_sources: RemoteSourcesTable;
|
|
54
60
|
host_roster: HostRosterTable;
|
|
55
61
|
request_idempotency: RequestIdempotencyTable;
|
|
62
|
+
batch_accumulation_windows: BatchAccumulationWindowsTable;
|
|
63
|
+
batch_accumulation_items: BatchAccumulationItemsTable;
|
|
64
|
+
backup_runs: BackupRunsTable;
|
|
56
65
|
}
|
|
66
|
+
/**
|
|
67
|
+
* Open accumulation window for a `workflowsFailedBatch` registration.
|
|
68
|
+
* One live window per subscribing workflow (`registration_id` is unique);
|
|
69
|
+
* the first matching failure opens it and the leader sweep closes it once
|
|
70
|
+
* `expires_at` passes, emitting a single `__workflows_failed_batch` event.
|
|
71
|
+
*/
|
|
72
|
+
export interface BatchAccumulationWindowsTable {
|
|
73
|
+
/** Window id (primary key). */
|
|
74
|
+
id: string;
|
|
75
|
+
/** Owning customer/org id. */
|
|
76
|
+
customer_id: string;
|
|
77
|
+
/** Subscribing registration id (unique — open-once). */
|
|
78
|
+
registration_id: string;
|
|
79
|
+
/** Routing key captured at open time so the sweep can emit without the index. */
|
|
80
|
+
routing_key: string;
|
|
81
|
+
/** Repo identifier captured at open time. */
|
|
82
|
+
repo_identifier: string;
|
|
83
|
+
/** Accumulation window length in milliseconds. */
|
|
84
|
+
accumulate_for_ms: number;
|
|
85
|
+
/** When the window opened (first failure). */
|
|
86
|
+
opened_at: Generated<Date>;
|
|
87
|
+
/** When the window is due for the leader sweep. */
|
|
88
|
+
expires_at: Date;
|
|
89
|
+
}
|
|
90
|
+
export type BatchAccumulationWindow = Selectable<BatchAccumulationWindowsTable>;
|
|
91
|
+
export type NewBatchAccumulationWindow = Insertable<BatchAccumulationWindowsTable>;
|
|
92
|
+
/**
|
|
93
|
+
* A single failed run buffered into a batch-accumulation window.
|
|
94
|
+
* Deleted with its window via `ON DELETE CASCADE` when the window is swept.
|
|
95
|
+
*/
|
|
96
|
+
export interface BatchAccumulationItemsTable {
|
|
97
|
+
/** Item id (primary key). */
|
|
98
|
+
id: string;
|
|
99
|
+
/** Owning window id (FK, cascade-deleted). */
|
|
100
|
+
window_id: string;
|
|
101
|
+
/** The failed run's id. */
|
|
102
|
+
run_id: string;
|
|
103
|
+
/** Repo identifier of the failed run. */
|
|
104
|
+
repo_identifier: string;
|
|
105
|
+
/** Workflow name of the failed run. */
|
|
106
|
+
workflow_name: string;
|
|
107
|
+
/** Failure class (`RunFailureClass`) when known. */
|
|
108
|
+
failure_class: string | null;
|
|
109
|
+
/** Triggering actor username when known. */
|
|
110
|
+
sender_username: string | null;
|
|
111
|
+
/** When the item was buffered. */
|
|
112
|
+
created_at: Generated<Date>;
|
|
113
|
+
}
|
|
114
|
+
export type BatchAccumulationItem = Selectable<BatchAccumulationItemsTable>;
|
|
115
|
+
export type NewBatchAccumulationItem = Insertable<BatchAccumulationItemsTable>;
|
|
57
116
|
/**
|
|
58
117
|
* Request idempotency claim table.
|
|
59
118
|
* Keyed on the Platform `requestId`; makes run-minting dashboard requests
|
|
@@ -72,6 +131,28 @@ export interface RequestIdempotencyTable {
|
|
|
72
131
|
export type RequestIdempotency = Selectable<RequestIdempotencyTable>;
|
|
73
132
|
export type NewRequestIdempotency = Insertable<RequestIdempotencyTable>;
|
|
74
133
|
export type RequestIdempotencyUpdate = Updateable<RequestIdempotencyTable>;
|
|
134
|
+
/**
|
|
135
|
+
* Backup run log. One row per successful `kici-admin db backup`. Read by the
|
|
136
|
+
* `checkBackupFreshness` diagnostic (`MAX(created_at)`).
|
|
137
|
+
*/
|
|
138
|
+
export interface BackupRunsTable {
|
|
139
|
+
id: Generated<string>;
|
|
140
|
+
created_at: Generated<Date>;
|
|
141
|
+
/** Local path the dump was written to (informational). */
|
|
142
|
+
dump_path: string;
|
|
143
|
+
/** Size of the dump file in bytes. */
|
|
144
|
+
byte_size: string | bigint;
|
|
145
|
+
/** Secret-key generation the DB's encrypted config was under (null when no encrypted config). */
|
|
146
|
+
secret_key_version: number | null;
|
|
147
|
+
/** Server version string the dump was taken from (e.g. "160003"). */
|
|
148
|
+
pg_server_version: string;
|
|
149
|
+
/** Bundled-migrations content hash at backup time. */
|
|
150
|
+
migrations_hash: string;
|
|
151
|
+
/** Host that ran the backup. */
|
|
152
|
+
hostname: string;
|
|
153
|
+
}
|
|
154
|
+
export type BackupRun = Selectable<BackupRunsTable>;
|
|
155
|
+
export type NewBackupRun = Insertable<BackupRunsTable>;
|
|
75
156
|
/**
|
|
76
157
|
* Cluster metadata table
|
|
77
158
|
* Key-value store for cluster-wide configuration (e.g. cluster_id).
|
|
@@ -210,6 +291,15 @@ export interface DispatchQueueTable {
|
|
|
210
291
|
* to another. NULL for normal label-routed jobs.
|
|
211
292
|
*/
|
|
212
293
|
pinned_agent_id: ColumnType<string | null, string | null | undefined, string | null>;
|
|
294
|
+
/**
|
|
295
|
+
* Durable owner of a dispatched job: the agent the job was handed to. Written
|
|
296
|
+
* at dispatch, cleared on requeue. Distinct from `ack_agent_id`, which is
|
|
297
|
+
* cleared as soon as the agent answers the dispatch and so cannot resolve
|
|
298
|
+
* ownership later — this column lets a coordinator that never saw the
|
|
299
|
+
* dispatch answer "does this agent own this job?" from the database alone.
|
|
300
|
+
* NULL for pending rows and for rows dispatched before the column existed.
|
|
301
|
+
*/
|
|
302
|
+
agent_id: ColumnType<string | null, string | null | undefined, string | null>;
|
|
213
303
|
}
|
|
214
304
|
/**
|
|
215
305
|
* Deduplication cache table
|
|
@@ -223,6 +313,39 @@ export interface DedupCacheTable {
|
|
|
223
313
|
/** When this cache entry expires (24h TTL) */
|
|
224
314
|
expires_at: Date;
|
|
225
315
|
}
|
|
316
|
+
/**
|
|
317
|
+
* Durable overflow buffer for shed webhook-ingest deliveries (migration 075).
|
|
318
|
+
* `status` values come from OverflowStatus, `source_kind` from OverflowSourceKind
|
|
319
|
+
* (packages/orchestrator/src/webhook/ingest-overflow-types.ts). `body` is base64.
|
|
320
|
+
*/
|
|
321
|
+
export interface IngestOverflowBufferTable {
|
|
322
|
+
/** Surrogate PK (bigint identity). */
|
|
323
|
+
id: Generated<number>;
|
|
324
|
+
/** Delivery id — the dedup key. */
|
|
325
|
+
delivery_id: string;
|
|
326
|
+
/** Routing key (e.g. "github:42"). */
|
|
327
|
+
routing_key: string;
|
|
328
|
+
/** Ingest boundary: 'direct' (HTTP, verified) | 'relay' (WS, unverified). */
|
|
329
|
+
source_kind: string;
|
|
330
|
+
/** Provider type; null for relay (resolved at replay). */
|
|
331
|
+
provider: string | null;
|
|
332
|
+
/** Provider event type. */
|
|
333
|
+
event: string;
|
|
334
|
+
/** Payload action, or null. */
|
|
335
|
+
action: string | null;
|
|
336
|
+
/** Base64 of the raw delivery bytes. */
|
|
337
|
+
body: string;
|
|
338
|
+
/** Verify-input envelope (relay) or {} (direct). */
|
|
339
|
+
meta: Generated<Record<string, unknown>>;
|
|
340
|
+
/** Capture timestamp (defaults to now()). */
|
|
341
|
+
captured_at: Generated<Date>;
|
|
342
|
+
/** Replay attempt counter. */
|
|
343
|
+
replay_attempts: Generated<number>;
|
|
344
|
+
/** OverflowStatus value. */
|
|
345
|
+
status: Generated<string>;
|
|
346
|
+
/** Last replay error, or null. */
|
|
347
|
+
last_error: string | null;
|
|
348
|
+
}
|
|
226
349
|
export type DispatchQueueItem = Selectable<DispatchQueueTable>;
|
|
227
350
|
export type NewDispatchQueueItem = Insertable<DispatchQueueTable>;
|
|
228
351
|
export type DispatchQueueItemUpdate = Updateable<DispatchQueueTable>;
|
|
@@ -256,6 +379,12 @@ export interface ExecutionRunTable {
|
|
|
256
379
|
run_id: string;
|
|
257
380
|
/** Routing key (e.g. github:appId) for Platform StaleOrchDetector when sharing DB */
|
|
258
381
|
routing_key: string | null;
|
|
382
|
+
/**
|
|
383
|
+
* Owning org (customer_id), denormalized from routing_key at insert time so
|
|
384
|
+
* the concurrency-gate running count can be scoped per tenant. Defaults to
|
|
385
|
+
* '__default__' (the no-source fallback org) via the column DEFAULT.
|
|
386
|
+
*/
|
|
387
|
+
customer_id: Generated<string>;
|
|
259
388
|
/** Workflow name from lock file */
|
|
260
389
|
workflow_name: string;
|
|
261
390
|
/** Run status: running | success | failed | cancelled */
|
|
@@ -317,6 +446,8 @@ export interface ExecutionRunTable {
|
|
|
317
446
|
lock_file_source: string | null;
|
|
318
447
|
/** Username of the contributor (null for non-PR events) */
|
|
319
448
|
contributor_username: string | null;
|
|
449
|
+
/** Pull-request number for PR-triggered runs (null for non-PR events). Scopes `/kici approve|reject` hold selection to the comment's PR. */
|
|
450
|
+
pr_number: number | null;
|
|
320
451
|
/**
|
|
321
452
|
* Origin provider of the triggering actor (`github` today). Provider-generic
|
|
322
453
|
* so GitLab/Bitbucket extend later. Null when no actor was captured.
|
|
@@ -335,6 +466,12 @@ export interface ExecutionRunTable {
|
|
|
335
466
|
trigger_actor_user_id: string | null;
|
|
336
467
|
/** Human-readable reason why the run failed (null for non-failed runs). */
|
|
337
468
|
failure_reason: string | null;
|
|
469
|
+
/**
|
|
470
|
+
* Why the run failed (`RunFailureClass` from `@kici-dev/engine`): never_started
|
|
471
|
+
* / timed_out / dead_orchestrator / step_failure / cancelled. Derived at run
|
|
472
|
+
* completion from the terminal job statuses. NULL for success / not-yet-terminal.
|
|
473
|
+
*/
|
|
474
|
+
failure_class: string | null;
|
|
338
475
|
/**
|
|
339
476
|
* Structured init-phase failure detail (shape: `InitFailure` from
|
|
340
477
|
* `@kici-dev/engine`). Non-null means the run never executed a step
|
|
@@ -603,16 +740,20 @@ export interface ContextsTable {
|
|
|
603
740
|
repo_patterns: Generated<string>;
|
|
604
741
|
/** Max concurrent runs (null = unlimited) */
|
|
605
742
|
concurrency_limit: number | null;
|
|
606
|
-
/**
|
|
607
|
-
|
|
743
|
+
/**
|
|
744
|
+
* Strategy when concurrency exceeded; see `ConcurrencyStrategy` in
|
|
745
|
+
* `@kici-dev/engine` for the vocabulary. Stays a plain `string` so a row
|
|
746
|
+
* written by another orchestrator version always maps (null = unset).
|
|
747
|
+
*/
|
|
748
|
+
concurrency_strategy: Generated<string | null>;
|
|
608
749
|
/** Timeout for queued runs in milliseconds */
|
|
609
750
|
concurrency_timeout_ms: Generated<number>;
|
|
610
751
|
/** JSONB array of required reviewer identities (null = no approval required) */
|
|
611
752
|
required_reviewers: string | null;
|
|
612
753
|
/** Seconds to wait before deploying (null = no wait timer) */
|
|
613
754
|
wait_timer_seconds: number | null;
|
|
614
|
-
/** Seconds before a held run expires */
|
|
615
|
-
hold_expiry_seconds: Generated<number>;
|
|
755
|
+
/** Seconds before a held run expires (null = unset, the default window applies) */
|
|
756
|
+
hold_expiry_seconds: Generated<number | null>;
|
|
616
757
|
/** Minimum trust tier required for CI execution (null = no trust requirement) */
|
|
617
758
|
minimum_trust: string | null;
|
|
618
759
|
/** Whether this context allows local (no-remote) executions. Default false. */
|
|
@@ -745,7 +886,12 @@ export interface HeldRunsTable {
|
|
|
745
886
|
job_id: string;
|
|
746
887
|
/** Context ID (FK to contexts.id); null once the context is deleted */
|
|
747
888
|
context_id: string | null;
|
|
748
|
-
/**
|
|
889
|
+
/**
|
|
890
|
+
* Hold type — an engine `HoldType` member ('reviewer' | 'timer' |
|
|
891
|
+
* 'concurrency' | 'security'). Stays `string` so a row written by a
|
|
892
|
+
* different orchestrator version is never rejected; read it through
|
|
893
|
+
* `normalizePersistedHoldType`.
|
|
894
|
+
*/
|
|
749
895
|
hold_type: string;
|
|
750
896
|
/** Hold status: 'pending' | 'approved' | 'rejected' | 'expired' | 'released' */
|
|
751
897
|
status: Generated<string>;
|
|
@@ -1228,6 +1374,8 @@ export type RegistryVersionUpdate = Updateable<RegistryVersionsTable>;
|
|
|
1228
1374
|
export interface CronLastFiredTable {
|
|
1229
1375
|
/** References workflow_registrations.id (cascade delete) */
|
|
1230
1376
|
registration_id: string;
|
|
1377
|
+
/** Per-schedule identity: `${cronExpression}\n${timezone}` (see scheduleTriggerKey) */
|
|
1378
|
+
schedule_key: string;
|
|
1231
1379
|
/** When this cron trigger last fired */
|
|
1232
1380
|
last_fired_at: Date;
|
|
1233
1381
|
/** When this record was last updated */
|
|
@@ -1390,12 +1538,80 @@ export interface OrgSettingsTable {
|
|
|
1390
1538
|
* pg returns a string on select; accept a number on insert/update.
|
|
1391
1539
|
*/
|
|
1392
1540
|
user_cache_ttl_ms: ColumnType<string | null, number | null | undefined, number | null>;
|
|
1541
|
+
/**
|
|
1542
|
+
* Per-org byte quota for user-facing artifacts (ArtifactStore). NULL = use the
|
|
1543
|
+
* cluster-wide default (`KICI_ARTIFACT_QUOTA_BYTES`, 20 GiB). Postgres BIGINT —
|
|
1544
|
+
* pg returns a string on select; accept a number on insert/update.
|
|
1545
|
+
*/
|
|
1546
|
+
artifact_quota_bytes: ColumnType<string | null, number | null | undefined, number | null>;
|
|
1547
|
+
/**
|
|
1548
|
+
* Per-artifact TTL (ms) for user-facing artifacts (ArtifactStore). NULL = use
|
|
1549
|
+
* the cluster-wide default (`KICI_ARTIFACT_TTL_MS`, 30 days). Postgres BIGINT —
|
|
1550
|
+
* pg returns a string on select; accept a number on insert/update.
|
|
1551
|
+
*/
|
|
1552
|
+
artifact_ttl_ms: ColumnType<string | null, number | null | undefined, number | null>;
|
|
1553
|
+
/**
|
|
1554
|
+
* Per-org per-artifact size cap (bytes) for user-facing artifacts
|
|
1555
|
+
* (ArtifactStore). NULL = use the cluster-wide default
|
|
1556
|
+
* (`KICI_ARTIFACT_MAX_BYTES`, 1 GiB). Postgres BIGINT — pg returns a string on
|
|
1557
|
+
* select; accept a number on insert/update.
|
|
1558
|
+
*/
|
|
1559
|
+
artifact_max_bytes: ColumnType<string | null, number | null | undefined, number | null>;
|
|
1560
|
+
/**
|
|
1561
|
+
* Per-org per-run artifact count cap for user-facing artifacts
|
|
1562
|
+
* (ArtifactStore). NULL = use the cluster-wide default
|
|
1563
|
+
* (`KICI_ARTIFACT_MAX_PER_RUN`, 50). Postgres BIGINT — pg returns a string on
|
|
1564
|
+
* select; accept a number on insert/update.
|
|
1565
|
+
*/
|
|
1566
|
+
artifact_max_per_run: ColumnType<string | null, number | null | undefined, number | null>;
|
|
1393
1567
|
/**
|
|
1394
1568
|
* Per-org dispatch-acknowledgment deadline (ms); null = cluster default
|
|
1395
1569
|
* (config.dispatchAckTimeoutMs / KICI_DISPATCH_ACK_TIMEOUT_MS). Postgres
|
|
1396
1570
|
* BIGINT — pg returns a string on select; accept a number on insert/update.
|
|
1397
1571
|
*/
|
|
1398
1572
|
dispatch_ack_timeout_ms: ColumnType<string | null, number | null | undefined, number | null>;
|
|
1573
|
+
/**
|
|
1574
|
+
* Per-org webhook-ingest concurrency cap; null = cluster default
|
|
1575
|
+
* (config.ingestOrgMaxConcurrency / KICI_INGEST_ORG_MAX_CONCURRENCY). Postgres
|
|
1576
|
+
* BIGINT — pg returns a string on select; accept a number on insert/update.
|
|
1577
|
+
*/
|
|
1578
|
+
ingest_max_concurrency: ColumnType<string | null, number | null | undefined, number | null>;
|
|
1579
|
+
/**
|
|
1580
|
+
* Per-org scaler spawn deadline (ms) for a single `backend.spawn` (image pull
|
|
1581
|
+
* + container create + start); null = cluster default
|
|
1582
|
+
* (config.scalerSpawnTimeoutMs / KICI_SCALER_SPAWN_TIMEOUT_MS). Postgres
|
|
1583
|
+
* BIGINT — pg returns a string on select; accept a number on insert/update.
|
|
1584
|
+
*/
|
|
1585
|
+
scaler_spawn_timeout_ms: ColumnType<string | null, number | null | undefined, number | null>;
|
|
1586
|
+
/**
|
|
1587
|
+
* Per-org reroute spawn window (ms): how long the coordinator waits after a
|
|
1588
|
+
* peer ACKs a reroute before treating "accepted but no progress" as a spawn
|
|
1589
|
+
* failure and re-dispatching. Null = cluster default (config.rerouteSpawnWindowMs).
|
|
1590
|
+
* BIGINT — pg returns a string on select; accept a number on insert/update.
|
|
1591
|
+
*/
|
|
1592
|
+
reroute_spawn_window_ms: ColumnType<string | null, number | null | undefined, number | null>;
|
|
1593
|
+
/**
|
|
1594
|
+
* Per-org reroute ACK timeout (ms) for the reroute sendAndWaitAck deadline.
|
|
1595
|
+
* Null = cluster default (config.rerouteAckTimeoutMs). BIGINT.
|
|
1596
|
+
*/
|
|
1597
|
+
reroute_ack_timeout_ms: ColumnType<string | null, number | null | undefined, number | null>;
|
|
1598
|
+
/**
|
|
1599
|
+
* Per-org maximum peer hops for a rerouted job. Null = cluster default
|
|
1600
|
+
* (config.rerouteMaxHops). Plain INTEGER — pg returns a number on select.
|
|
1601
|
+
*/
|
|
1602
|
+
reroute_max_hops: ColumnType<number | null, number | null | undefined, number | null>;
|
|
1603
|
+
/**
|
|
1604
|
+
* Per-org staleness threshold (hours) for the DB-backup freshness diagnostic.
|
|
1605
|
+
* Null = cluster default (config.backupStalenessWarnHours). Plain INTEGER.
|
|
1606
|
+
*/
|
|
1607
|
+
backup_staleness_warn_hours: ColumnType<number | null, number | null | undefined, number | null>;
|
|
1608
|
+
/**
|
|
1609
|
+
* Per-org dispatch-queue job timeout (ms). A queued job's deadline is
|
|
1610
|
+
* `job.timeoutMs ?? <this> ?? config.queueTimeoutMs`. Null = cluster default
|
|
1611
|
+
* (config.queueTimeoutMs / KICI_QUEUE_TIMEOUT_MS). Postgres BIGINT — pg
|
|
1612
|
+
* returns a string on select; accept a number on insert/update.
|
|
1613
|
+
*/
|
|
1614
|
+
queue_timeout_ms: ColumnType<string | null, number | null | undefined, number | null>;
|
|
1399
1615
|
/**
|
|
1400
1616
|
* Per-org expiry (seconds) for a held approval element before it is rejected
|
|
1401
1617
|
* and its run/job/step fails. NOT NULL, default 86400 (one day). An SDK
|
|
@@ -1407,6 +1623,18 @@ export interface OrgSettingsTable {
|
|
|
1407
1623
|
* NOT NULL, default true. Operators turn it off to enforce four-eyes review.
|
|
1408
1624
|
*/
|
|
1409
1625
|
allow_self_approval: ColumnType<boolean, boolean | undefined, boolean>;
|
|
1626
|
+
/**
|
|
1627
|
+
* Container-sandbox escape-hatch allow-list: the Linux capabilities a workflow
|
|
1628
|
+
* may request via the SDK `sandbox: { capabilities }` field. NULL / absent
|
|
1629
|
+
* reads as `[]` (deny every capability request). Postgres TEXT[].
|
|
1630
|
+
*/
|
|
1631
|
+
sandbox_allowed_capabilities: ColumnType<string[] | null, string[] | null | undefined, string[] | null>;
|
|
1632
|
+
/**
|
|
1633
|
+
* Container-sandbox escape-hatch allow-list: whether a workflow may request
|
|
1634
|
+
* `sandbox: { network: 'host' }`. NULL / absent reads as `false` (deny host
|
|
1635
|
+
* networking). Postgres BOOLEAN.
|
|
1636
|
+
*/
|
|
1637
|
+
sandbox_allow_host_network: ColumnType<boolean | null, boolean | null | undefined, boolean | null>;
|
|
1410
1638
|
/** When this setting was created */
|
|
1411
1639
|
created_at: Generated<Date>;
|
|
1412
1640
|
/** When this setting was last updated */
|
|
@@ -1415,6 +1643,88 @@ export interface OrgSettingsTable {
|
|
|
1415
1643
|
export type OrgSettings = Selectable<OrgSettingsTable>;
|
|
1416
1644
|
export type NewOrgSettings = Insertable<OrgSettingsTable>;
|
|
1417
1645
|
export type OrgSettingsUpdate = Updateable<OrgSettingsTable>;
|
|
1646
|
+
/**
|
|
1647
|
+
* Org trust policy (org_trust_policy) — the orchestrator's cache of the
|
|
1648
|
+
* Platform-owned per-org trust policy delivered on `trust_policy.update`.
|
|
1649
|
+
* Distinct from `org_settings`, which holds operator-owned config: the operator
|
|
1650
|
+
* tunes org_settings, the Platform owns this. `source` records which of the two
|
|
1651
|
+
* wrote the row.
|
|
1652
|
+
*
|
|
1653
|
+
* The three policy columns are plain `string`, not the Zod enums that name the
|
|
1654
|
+
* known vocabulary — same reasoning as `held_runs.hold_type`: a value written by
|
|
1655
|
+
* a newer Platform must still be readable rather than failing the row.
|
|
1656
|
+
*/
|
|
1657
|
+
export interface OrgTrustPolicyTable {
|
|
1658
|
+
/** Customer/org identifier (primary key) */
|
|
1659
|
+
customer_id: string;
|
|
1660
|
+
/** How to treat a pull request opened from a fork: hold | reject | allow */
|
|
1661
|
+
fork_policy: string;
|
|
1662
|
+
/** How to treat a PR from a contributor with no resolved identity: hold | reject */
|
|
1663
|
+
unknown_contributor_policy: string;
|
|
1664
|
+
/** How to treat a PR that modifies workflow files: hold | reject | allow */
|
|
1665
|
+
workflow_change_policy: string;
|
|
1666
|
+
/** How long a security hold stays approvable before it expires */
|
|
1667
|
+
approval_expiry_hours: number;
|
|
1668
|
+
/** Which side last wrote this row: platform | local */
|
|
1669
|
+
source: string;
|
|
1670
|
+
/** When this policy was last written */
|
|
1671
|
+
updated_at: ColumnType<Date, Date | undefined, Date>;
|
|
1672
|
+
}
|
|
1673
|
+
export type OrgTrustPolicy = Selectable<OrgTrustPolicyTable>;
|
|
1674
|
+
export type NewOrgTrustPolicy = Insertable<OrgTrustPolicyTable>;
|
|
1675
|
+
export type OrgTrustPolicyUpdate = Updateable<OrgTrustPolicyTable>;
|
|
1676
|
+
/**
|
|
1677
|
+
* Cluster-global settings (cluster_settings) — a single row (id='default') of
|
|
1678
|
+
* fleet-wide operator tunables. Each knob is nullable; NULL = use the cluster
|
|
1679
|
+
* default from config.ts. Read via ClusterSettingsReader. Distinct from
|
|
1680
|
+
* org_settings (per customer_id) — these knobs have no per-tenant meaning.
|
|
1681
|
+
* Byte-valued knobs are Postgres BIGINT (pg returns a string on select); count
|
|
1682
|
+
* / seconds knobs are INTEGER (pg returns a number).
|
|
1683
|
+
*/
|
|
1684
|
+
export interface ClusterSettingsTable {
|
|
1685
|
+
id: ColumnType<string, string | undefined, never>;
|
|
1686
|
+
max_github_payload_bytes: ColumnType<string | null, number | null | undefined, number | null>;
|
|
1687
|
+
event_log_max_payload_bytes: ColumnType<string | null, number | null | undefined, number | null>;
|
|
1688
|
+
lock_file_max_bytes: ColumnType<string | null, number | null | undefined, number | null>;
|
|
1689
|
+
webhook_dedup_ttl_ms: ColumnType<string | null, number | null | undefined, number | null>;
|
|
1690
|
+
contributor_cache_ttl_ms: ColumnType<string | null, number | null | undefined, number | null>;
|
|
1691
|
+
event_router_event_ttl_seconds: ColumnType<number | null, number | null | undefined, number | null>;
|
|
1692
|
+
event_router_max_dispatch_attempts: ColumnType<number | null, number | null | undefined, number | null>;
|
|
1693
|
+
queue_max_depth: ColumnType<number | null, number | null | undefined, number | null>;
|
|
1694
|
+
reroute_flap_grace_ms: ColumnType<string | null, number | null | undefined, number | null>;
|
|
1695
|
+
max_fanout_hosts: ColumnType<number | null, number | null | undefined, number | null>;
|
|
1696
|
+
event_router_rate_limit_per_workflow_per_minute: ColumnType<number | null, number | null | undefined, number | null>;
|
|
1697
|
+
cache_max_tarball_bytes: ColumnType<string | null, number | null | undefined, number | null>;
|
|
1698
|
+
cache_ttl_days: ColumnType<number | null, number | null | undefined, number | null>;
|
|
1699
|
+
/**
|
|
1700
|
+
* Retention window in days for `check_run_tracking` rows. The hourly cleanup
|
|
1701
|
+
* sweep deletes rows untouched for longer than this; 0 disables the sweep.
|
|
1702
|
+
* NULL ⇒ the orchestrator's configured default.
|
|
1703
|
+
*/
|
|
1704
|
+
check_run_tracking_ttl_days: ColumnType<number | null, number | null | undefined, number | null>;
|
|
1705
|
+
concurrency_wait_timeout_ms: ColumnType<string | null, number | null | undefined, number | null>;
|
|
1706
|
+
agent_token_ttl_ms: ColumnType<string | null, number | null | undefined, number | null>;
|
|
1707
|
+
/**
|
|
1708
|
+
* Deadline for one database-backed agent-ownership lookup. Past it the lookup
|
|
1709
|
+
* resolves as undecided and the frame is refused without counting a
|
|
1710
|
+
* violation. NULL ⇒ the orchestrator's configured default.
|
|
1711
|
+
*/
|
|
1712
|
+
ownership_db_check_timeout_ms: ColumnType<string | null, number | null | undefined, number | null>;
|
|
1713
|
+
/**
|
|
1714
|
+
* Verified-tier origin the dashboard fetches the orchestrator's X25519
|
|
1715
|
+
* dashboard-encryption public key from (and always displays) under the
|
|
1716
|
+
* `encrypted` dashboard-write posture. The tier is explicit opt-in: NULL ⇒ it
|
|
1717
|
+
* is not offered and the convenient tier is used.
|
|
1718
|
+
*/
|
|
1719
|
+
dashboard_verified_issuer: ColumnType<string | null, string | null | undefined, string | null>;
|
|
1720
|
+
/** Monotonic settings version; bumped on each real settings change, advertised to workers. */
|
|
1721
|
+
version: ColumnType<string | number, number | undefined, number>;
|
|
1722
|
+
created_at: Generated<Date>;
|
|
1723
|
+
updated_at: Generated<Date>;
|
|
1724
|
+
}
|
|
1725
|
+
export type ClusterSettings = Selectable<ClusterSettingsTable>;
|
|
1726
|
+
export type NewClusterSettings = Insertable<ClusterSettingsTable>;
|
|
1727
|
+
export type ClusterSettingsUpdate = Updateable<ClusterSettingsTable>;
|
|
1418
1728
|
/**
|
|
1419
1729
|
* Pending job contexts table
|
|
1420
1730
|
* Persists PendingJobContext for crash-recovery of needs-gated jobs.
|
|
@@ -1626,8 +1936,21 @@ export interface CheckRunTrackingTable {
|
|
|
1626
1936
|
*/
|
|
1627
1937
|
in_progress_sent_at: ColumnType<Date | null, Date | null | undefined, Date | null>;
|
|
1628
1938
|
/**
|
|
1629
|
-
*
|
|
1630
|
-
* NULL
|
|
1939
|
+
* When the terminal (`completed`) check-run update was accepted by the
|
|
1940
|
+
* provider. NULL means we have no record of sending it — either it never
|
|
1941
|
+
* happened, or the best-effort write failed. Never treat NULL as proof the
|
|
1942
|
+
* update failed.
|
|
1943
|
+
*
|
|
1944
|
+
* `check_run_id` is written at create time, while the check run is still
|
|
1945
|
+
* `queued`, so it proves creation and never completion. This column is the
|
|
1946
|
+
* completion signal.
|
|
1947
|
+
*/
|
|
1948
|
+
terminal_sent_at: ColumnType<Date | null, Date | null | undefined, Date | null>;
|
|
1949
|
+
/**
|
|
1950
|
+
* KiCI run identifier this check-run belongs to, written at create time.
|
|
1951
|
+
* Indexed (partial, NOT NULL) so a per-run lookup never scans the table.
|
|
1952
|
+
* It is an attribution key, not a retention key — rows are reclaimed by
|
|
1953
|
+
* the `updated_at`-age sweep, which deliberately ignores this column.
|
|
1631
1954
|
*/
|
|
1632
1955
|
run_id: ColumnType<string | null, string | null | undefined, string | null>;
|
|
1633
1956
|
/** When this row was first inserted. */
|
|
@@ -1676,6 +1999,91 @@ export interface AttestationsTable {
|
|
|
1676
1999
|
}
|
|
1677
2000
|
export type AttestationRow = Selectable<AttestationsTable>;
|
|
1678
2001
|
export type NewAttestationRow = Insertable<AttestationsTable>;
|
|
2002
|
+
/**
|
|
2003
|
+
* Cluster-scoped ES256 provenance signing keys. The orchestrator signs its own
|
|
2004
|
+
* build attestations with the one `active` key and serves the public halves of
|
|
2005
|
+
* every non-`revoked` key at `/.well-known/jwks.json`.
|
|
2006
|
+
*/
|
|
2007
|
+
export interface OrchestratorSigningKeysTable {
|
|
2008
|
+
/** RFC 7638 thumbprint of the public JWK (primary key, also the token `kid`). */
|
|
2009
|
+
kid: string;
|
|
2010
|
+
/** The non-secret public JWK (JSONB) served in the JWKS. */
|
|
2011
|
+
public_jwk: unknown;
|
|
2012
|
+
/**
|
|
2013
|
+
* AES-256-GCM-wrapped private JWK for `db` custody (master-key wrapped). NULL
|
|
2014
|
+
* for `aws-kms` / `command` custody where the private key never lives here.
|
|
2015
|
+
*/
|
|
2016
|
+
encrypted_private_jwk: string | null;
|
|
2017
|
+
key_version: Generated<number>;
|
|
2018
|
+
/** JOSE alg (always `ES256`). */
|
|
2019
|
+
alg: string;
|
|
2020
|
+
/** Custody backend discriminator (`db` | `aws-kms` | `command`). */
|
|
2021
|
+
signer_kind: string;
|
|
2022
|
+
/** External key locator (KMS ARN / signer command) for non-`db` custody; NULL for `db`. */
|
|
2023
|
+
key_ref: string | null;
|
|
2024
|
+
/** Lifecycle status (`SigningKeyStatus`: active | retiring | retired | revoked). */
|
|
2025
|
+
status: Generated<string>;
|
|
2026
|
+
revocation_reason: string | null;
|
|
2027
|
+
created_at: Generated<Date>;
|
|
2028
|
+
activated_at: Date | null;
|
|
2029
|
+
retired_at: Date | null;
|
|
2030
|
+
revoked_at: Date | null;
|
|
2031
|
+
}
|
|
2032
|
+
export type OrchestratorSigningKeyRow = Selectable<OrchestratorSigningKeysTable>;
|
|
2033
|
+
export type NewOrchestratorSigningKeyRow = Insertable<OrchestratorSigningKeysTable>;
|
|
2034
|
+
/**
|
|
2035
|
+
* The orchestrator's X25519 dashboard-encryption keys — the trust root for
|
|
2036
|
+
* browser-sealed dashboard writes under the `encrypted` posture. One `active`
|
|
2037
|
+
* key seals; rotated-out keys go `revoked` and leave the published JWKS, while
|
|
2038
|
+
* their rows stay so envelopes already sealed to the old `kid` still decrypt.
|
|
2039
|
+
*/
|
|
2040
|
+
export interface DashboardEncryptionKeysTable {
|
|
2041
|
+
/** RFC 7638 thumbprint of the public JWK (primary key, also the `kid`). */
|
|
2042
|
+
kid: string;
|
|
2043
|
+
/** The non-secret OKP/X25519 public JWK (`use:'enc'`) served in the JWKS. */
|
|
2044
|
+
public_jwk: unknown;
|
|
2045
|
+
/** AES-256-GCM-wrapped DER private key (master-key wrapped under KICI_SECRET_KEY). */
|
|
2046
|
+
encrypted_private_key: string;
|
|
2047
|
+
/** Lifecycle status (`active` | `revoked`). */
|
|
2048
|
+
status: Generated<string>;
|
|
2049
|
+
revocation_reason: string | null;
|
|
2050
|
+
created_at: Generated<Date>;
|
|
2051
|
+
activated_at: Date | null;
|
|
2052
|
+
revoked_at: Date | null;
|
|
2053
|
+
}
|
|
2054
|
+
export type DashboardEncryptionKeyRow = Selectable<DashboardEncryptionKeysTable>;
|
|
2055
|
+
export type NewDashboardEncryptionKeyRow = Insertable<DashboardEncryptionKeysTable>;
|
|
2056
|
+
/**
|
|
2057
|
+
* A user-facing build artifact (`ctx.artifacts.upload`). Named + immutable per
|
|
2058
|
+
* run: `UNIQUE (run_id, name)` enforces the first-upload-wins semantics at the
|
|
2059
|
+
* DB layer. `customer_id` scopes the row to an org for quota accounting; the
|
|
2060
|
+
* tarball lives at `storage_key` (`artifacts/{run_id}/{name}-{discriminator}.tar.gz`,
|
|
2061
|
+
* where the discriminator is a hash of the exact name). Reads go through the
|
|
2062
|
+
* stored key rather than re-deriving it, so a row written under an earlier key
|
|
2063
|
+
* format resolves unchanged.
|
|
2064
|
+
*/
|
|
2065
|
+
export interface ArtifactsTable {
|
|
2066
|
+
/** Random id (primary key). */
|
|
2067
|
+
id: string;
|
|
2068
|
+
/** Owning customer/org id (quota-accounting scope). */
|
|
2069
|
+
customer_id: string;
|
|
2070
|
+
/** KiCI run this artifact belongs to. */
|
|
2071
|
+
run_id: string;
|
|
2072
|
+
/** KiCI job that produced this artifact. */
|
|
2073
|
+
job_id: string;
|
|
2074
|
+
/** Caller-supplied artifact name (unique within the run). */
|
|
2075
|
+
name: string;
|
|
2076
|
+
/** Packed tarball size in bytes. Postgres BIGINT — pg returns a string on select. */
|
|
2077
|
+
size_bytes: ColumnType<string, number, number>;
|
|
2078
|
+
/** SHA-256 (hex) of the tarball bytes. */
|
|
2079
|
+
sha256: string;
|
|
2080
|
+
/** Object-storage key the tarball was written to. */
|
|
2081
|
+
storage_key: string;
|
|
2082
|
+
/** When this row was inserted. */
|
|
2083
|
+
created_at: Generated<Date>;
|
|
2084
|
+
}
|
|
2085
|
+
export type ArtifactRow = Selectable<ArtifactsTable>;
|
|
2086
|
+
export type NewArtifactRow = Insertable<ArtifactsTable>;
|
|
1679
2087
|
/**
|
|
1680
2088
|
* Deferred-attestation outbox: a build whose provenance mint failed transiently
|
|
1681
2089
|
* freezes its DSSE-signed statement here; a leader-only retrier mints the token
|
|
@@ -1794,6 +2202,12 @@ export interface HostRosterTable {
|
|
|
1794
2202
|
ssh_port: ColumnType<number | null, number | null | undefined, number | null>;
|
|
1795
2203
|
/** Scoped-secret ref (`scope/key`) holding the bring-up private key. */
|
|
1796
2204
|
ssh_key_secret: ColumnType<string | null, string | null | undefined, string | null>;
|
|
2205
|
+
/**
|
|
2206
|
+
* Delivery hint: when true, the box can reach the orchestrator's object
|
|
2207
|
+
* storage, so bring-up picks `s3-direct` (the box pulls the payload via a
|
|
2208
|
+
* presigned URL). NULL / false ⇒ the conservative `ssh-push` fallback.
|
|
2209
|
+
*/
|
|
2210
|
+
s3_reachable: ColumnType<boolean | null, boolean | null | undefined, boolean | null>;
|
|
1797
2211
|
created_at: Generated<Date>;
|
|
1798
2212
|
updated_at: ColumnType<Date, Date | string | undefined, Date | string>;
|
|
1799
2213
|
}
|
|
@@ -1,9 +1,94 @@
|
|
|
1
1
|
import { type DeploymentIdentity } from '@kici-dev/engine';
|
|
2
|
+
/**
|
|
3
|
+
* The pinned `<node> <kici-admin>` invocation for a posix bare-metal unit, or
|
|
4
|
+
* `undefined` when the shim cannot be located.
|
|
5
|
+
*
|
|
6
|
+
* Two candidates are tried in order:
|
|
7
|
+
*
|
|
8
|
+
* 1. `<npm global bin>/kici-admin`, derived from where this module itself
|
|
9
|
+
* lives. This is the correct answer when npm's global prefix differs from
|
|
10
|
+
* the node install prefix — e.g. an operator who set
|
|
11
|
+
* `npm config set prefix ~/.npm-global` while running a system node.
|
|
12
|
+
* 2. `<dirname(execPath)>/kici-admin`, correct for version-manager layouts
|
|
13
|
+
* (mise / nvm / fnm) where the two prefixes coincide.
|
|
14
|
+
*
|
|
15
|
+
* Candidate 1 wins a tie because it is the shim belonging to the install this
|
|
16
|
+
* process is actually running from; a stale shim elsewhere on the system must
|
|
17
|
+
* not be pinned in preference to it.
|
|
18
|
+
*
|
|
19
|
+
* Global installs only, matching `resolveNpmInstallTarget`'s scope: an
|
|
20
|
+
* orchestrator installed locally into a project's own `node_modules` keeps its
|
|
21
|
+
* shim in `node_modules/.bin`, which is never a candidate, so it resolves to
|
|
22
|
+
* `undefined` and gets the bare form.
|
|
23
|
+
*
|
|
24
|
+
* Returning `undefined` is deliberate: the dashboard falls back to a
|
|
25
|
+
* PATH-resolved bare `kici-admin`, which beats naming a path that is not there.
|
|
26
|
+
*
|
|
27
|
+
* Both halves are rendered as POSIX shell words, so the pair survives a path
|
|
28
|
+
* that holds whitespace when the operator pastes it.
|
|
29
|
+
*/
|
|
30
|
+
export declare function resolveAdminInvocation(execPath: string, entryPath: string | undefined, fileExists: (p: string) => boolean): string | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* The absolute path of the Windows `kici-admin.cmd` launcher, or `undefined`
|
|
33
|
+
* when it cannot be located.
|
|
34
|
+
*
|
|
35
|
+
* Deliberately NOT built on {@link globalBinDirFrom}: npm lays a Windows global
|
|
36
|
+
* install out as `<prefix>\node_modules\<pkg>` with no `lib` folder, and links
|
|
37
|
+
* the shims directly into `<prefix>` rather than `<prefix>\bin`. The posix
|
|
38
|
+
* helper requires a `lib` segment, so it returns `undefined` for every real
|
|
39
|
+
* Windows install — reusing it would ship a resolver that can never fire.
|
|
40
|
+
*
|
|
41
|
+
* Three candidate directories are tried in order:
|
|
42
|
+
*
|
|
43
|
+
* 1. The npm global prefix implied by this module's own location, split on the
|
|
44
|
+
* FIRST `node_modules` segment (matching the posix helper's convention, so
|
|
45
|
+
* the nested-under-kici-admin install shape resolves too). A prefix holding
|
|
46
|
+
* a `package.json` is REJECTED: that is a local project install, whose shim
|
|
47
|
+
* lives in `node_modules\.bin`, and a same-named launcher sitting in the
|
|
48
|
+
* project root must not be pinned. npm's own global prefix carries no
|
|
49
|
+
* `package.json`, which is what distinguishes the two.
|
|
50
|
+
* 2. The light-package deploy directory, which lays out
|
|
51
|
+
* `<deployDir>\lib\<target>.cjs` beside `<deployDir>\kici-admin.cmd`. Gated
|
|
52
|
+
* on the entry's parent directory actually being named `lib` so an
|
|
53
|
+
* unrelated bundle layout cannot derive a directory and pin whatever
|
|
54
|
+
* happens to sit there.
|
|
55
|
+
* 3. `dirname(execPath)`, for the case where node and the launcher are
|
|
56
|
+
* co-located.
|
|
57
|
+
*
|
|
58
|
+
* Every path is built with `path.win32`, so the derivation is deterministic
|
|
59
|
+
* when this runs on a posix test host rather than depending on the ambient
|
|
60
|
+
* separator.
|
|
61
|
+
*
|
|
62
|
+
* A candidate directory that is not absolute is skipped. The check has to be on
|
|
63
|
+
* the DIRECTORY, not on the joined result: `path.win32.dirname('C:node.exe')`
|
|
64
|
+
* is the drive-relative `'C:'` (meaning "the current directory of drive C:"),
|
|
65
|
+
* and `path.win32.join('C:', 'kici-admin.cmd')` silently yields the ABSOLUTE
|
|
66
|
+
* `'C:\kici-admin.cmd'` — a different location. Testing the join result would
|
|
67
|
+
* therefore pass, having already lost the distinction.
|
|
68
|
+
*
|
|
69
|
+
* The returned path is RAW — never quoted or escaped. cmd.exe runs a
|
|
70
|
+
* double-quoted path in command position while PowerShell only prints it, so
|
|
71
|
+
* the same path must be written two different ways and only the reader knows
|
|
72
|
+
* which shell it is rendering for.
|
|
73
|
+
*/
|
|
74
|
+
export declare function resolveWindowsAdminPath(execPath: string, entryPath: string | undefined, fileExists: (p: string) => boolean): string | undefined;
|
|
2
75
|
/**
|
|
3
76
|
* Read the orchestrator's deployment shape from the env the installer injects
|
|
4
77
|
* (`KICI_DEPLOY_MODE` / `KICI_DEPLOY_CONTAINER` / `KICI_DEPLOY_CONTAINER_RUNTIME`).
|
|
5
78
|
* Hand-run / dev orchestrators carry no `KICI_DEPLOY_*` env and report `unknown`.
|
|
6
|
-
*
|
|
79
|
+
* Surrounding whitespace is stripped from all three before they are read: the
|
|
80
|
+
* values reach the process through an env file, where a hand edit or a writer
|
|
81
|
+
* that leaves the trailing byte on can attach a space or a newline. The shape
|
|
82
|
+
* is known in that case, so degrading the whole identity to `unknown` — and
|
|
83
|
+
* dropping the pinned invocation with it — would discard an answer we have.
|
|
84
|
+
* Container fields are kept only for the `compose` mode. For posix bare-metal
|
|
85
|
+
* (`systemd` / `launchd`) the identity carries a pinned `<node> <kici-admin>`
|
|
86
|
+
* `adminInvocation` when the shim can be located on disk; for `windows` it
|
|
87
|
+
* instead carries a raw, unquoted `adminPath` naming the `kici-admin.cmd`
|
|
88
|
+
* launcher. Each is omitted when its target cannot be located, so the reader
|
|
89
|
+
* falls back to a PATH-resolved `kici-admin`. The two never coexist: they are
|
|
90
|
+
* different kinds of value (a shell command vs a bare path) because the Windows
|
|
91
|
+
* shells cannot share one quoting.
|
|
7
92
|
*/
|
|
8
|
-
export declare function readDeploymentIdentity(env?: NodeJS.ProcessEnv): DeploymentIdentity;
|
|
93
|
+
export declare function readDeploymentIdentity(env?: NodeJS.ProcessEnv, execPath?: string, entryPath?: string | undefined, fileExists?: (p: string) => boolean): DeploymentIdentity;
|
|
9
94
|
//# sourceMappingURL=deployment-identity.d.ts.map
|