@kici-dev/orchestrator 0.1.22 → 0.1.24
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/agent/host-roster.d.ts +39 -3
- package/dist/agent/token-store.d.ts +33 -0
- package/dist/app.d.ts +3 -0
- package/dist/cache/pending-inits.d.ts +3 -2
- package/dist/cli/api-client.d.ts +8 -0
- package/dist/cli/commands/attestations-reverify.d.ts +18 -0
- package/dist/cli/commands/attestations.d.ts +3 -0
- package/dist/cli/commands/shared/versioned-upgrade.d.ts +52 -0
- package/dist/cli.js +2284 -442
- package/dist/config.d.ts +2 -0
- package/dist/dashboard/attestation-filters.d.ts +70 -0
- package/dist/dashboard/handler.d.ts +33 -1
- package/dist/db/migrations/051_binding_host_pattern.d.ts +18 -0
- package/dist/db/migrations/052_host_reach_metadata.d.ts +19 -0
- package/dist/db/migrations/053_agent_token_single_use.d.ts +17 -0
- package/dist/db/migrations/054_local_working_tree.d.ts +15 -0
- package/dist/db/migrations/055_agent_token_mandatory_labels.d.ts +18 -0
- package/dist/db/migrations/056_execution_jobs_environments.d.ts +17 -0
- package/dist/db/migrations/057_step_concurrency.d.ts +4 -0
- package/dist/db/migrations/058_access_log_agent_label.d.ts +4 -0
- package/dist/db/migrations/059_attestation_verdict.d.ts +4 -0
- package/dist/db/migrations/060_run_trigger_actor.d.ts +4 -0
- package/dist/db/types.d.ts +78 -0
- package/dist/environments/binding-store.d.ts +12 -3
- package/dist/environments/held-runs.d.ts +24 -0
- package/dist/environments/protection/aggregate.d.ts +43 -0
- package/dist/environments/protection/satisfiability.d.ts +64 -0
- package/dist/index.js +9 -0
- package/dist/metrics/prometheus.d.ts +2 -0
- package/dist/orchestrator-core.d.ts +8 -0
- package/dist/pipeline/dispatch-matched-workflow.d.ts +60 -3
- package/dist/pipeline/flatten-lock-steps.d.ts +11 -0
- package/dist/pipeline/inline-eval.d.ts +2 -1
- package/dist/pipeline/job-environments.d.ts +71 -0
- package/dist/pipeline/manual-schedule.d.ts +22 -0
- package/dist/pipeline/test-pipeline.d.ts +15 -0
- package/dist/provenance/trust-root.d.ts +24 -0
- package/dist/provenance/verify-at-ingest.d.ts +24 -0
- package/dist/reporting/agent-failure-category.d.ts +27 -0
- package/dist/reporting/agent-run-result-mapper.d.ts +13 -0
- package/dist/reporting/execution-tracker.d.ts +22 -2
- package/dist/reporting/log-writer.d.ts +19 -0
- package/dist/reporting/run-aggregator.d.ts +161 -0
- package/dist/reporting/step-log-reader.d.ts +39 -0
- package/dist/routes/admin-registrations.d.ts +8 -0
- package/dist/routes/admin-runs.d.ts +7 -0
- package/dist/scaler/manager.d.ts +17 -0
- package/dist/secrets/index.d.ts +1 -1
- package/dist/secrets/secret-resolver.d.ts +19 -6
- package/dist/server.js +21535 -19131
- package/dist/standalone.js +26544 -24580
- package/dist/storage/loopback-guard.d.ts +49 -0
- package/dist/ws/agent-handler.d.ts +15 -1
- package/dist/ws/bringup-api.d.ts +76 -0
- package/dist/ws/dashboard-fleet-handler.d.ts +11 -1
- package/dist/ws/fleet-runs-on-all.d.ts +3 -0
- package/dist/ws/platform-client.d.ts +39 -1
- package/dist/ws/test-relay-handlers.d.ts +9 -0
- package/installer-image-digests.json +3 -3
- package/package.json +6 -8
- package/sbom.spdx.json +57 -57
- package/dist/secrets/crypto.d.ts +0 -49
|
@@ -3,6 +3,19 @@ import { type HostInventoryEntry, type InventorySelector, type LabelMatcher } fr
|
|
|
3
3
|
import type { Database, HostRosterRow } from '../db/types.js';
|
|
4
4
|
/** Typed host-vars bag carried by roster rows (`string | number | boolean`). */
|
|
5
5
|
export type HostProperties = Record<string, string | number | boolean>;
|
|
6
|
+
/**
|
|
7
|
+
* Pre-agent reach metadata for a declared host — how to SSH to it for bootstrap
|
|
8
|
+
* bring-up before it has a KiCI agent. All fields nullable: a host with no reach
|
|
9
|
+
* metadata cannot be bootstrapped. `sshKeySecret` is a scoped-secret ref
|
|
10
|
+
* (`scope/key`) the orchestrator resolves server-side; the key never lives here.
|
|
11
|
+
*/
|
|
12
|
+
export interface HostReach {
|
|
13
|
+
agentId: string;
|
|
14
|
+
address: string | null;
|
|
15
|
+
sshUser: string | null;
|
|
16
|
+
sshPort: number | null;
|
|
17
|
+
sshKeySecret: string | null;
|
|
18
|
+
}
|
|
6
19
|
/**
|
|
7
20
|
* Derived (read-time) status of a roster host. Never a stored mutable column:
|
|
8
21
|
* status is computed from the shared `last_seen` + `connected_instance_id` so
|
|
@@ -96,13 +109,36 @@ export declare class HostRosterStore {
|
|
|
96
109
|
markDisconnected(agentId: string, instanceId: string): Promise<void>;
|
|
97
110
|
/** Coarse heartbeat stamp — same owner-guard as markDisconnected. */
|
|
98
111
|
stampLastSeen(agentId: string, instanceId: string): Promise<void>;
|
|
99
|
-
/**
|
|
112
|
+
/**
|
|
113
|
+
* Operator pre-declare of a static host. A re-declare of an existing agent_id
|
|
114
|
+
* converges the operator-owned columns (labels, hostname, reach,
|
|
115
|
+
* host_properties) to the newly-declared values while preserving the
|
|
116
|
+
* agent-reported liveness/identity columns (connected_instance_id, last_seen,
|
|
117
|
+
* platform, arch, lifecycle_class, token_id, reboot_pending_until). The
|
|
118
|
+
* optional reach fields (`address`/`sshUser`/`sshPort`/`sshKeySecret`) carry
|
|
119
|
+
* how to SSH to the host for bootstrap bring-up. Each operator field is
|
|
120
|
+
* preserve-on-omit: an omitted field keeps the existing column value.
|
|
121
|
+
*
|
|
122
|
+
* Returns `{ created: true }` when the declare inserted a new row,
|
|
123
|
+
* `{ created: false }` when it converged an existing one.
|
|
124
|
+
*/
|
|
100
125
|
declareStatic(input: {
|
|
101
126
|
agentId: string;
|
|
102
|
-
labels
|
|
127
|
+
labels?: string[];
|
|
103
128
|
hostname?: string;
|
|
104
129
|
properties?: HostProperties;
|
|
105
|
-
|
|
130
|
+
address?: string;
|
|
131
|
+
sshUser?: string;
|
|
132
|
+
sshPort?: number;
|
|
133
|
+
sshKeySecret?: string;
|
|
134
|
+
}): Promise<{
|
|
135
|
+
created: boolean;
|
|
136
|
+
}>;
|
|
137
|
+
/**
|
|
138
|
+
* Read a host's pre-agent reach metadata. Returns null when the host is not
|
|
139
|
+
* in the roster; a host declared without reach fields reads back with nulls.
|
|
140
|
+
*/
|
|
141
|
+
getReach(agentId: string): Promise<HostReach | null>;
|
|
106
142
|
get(agentId: string): Promise<HostRosterRow | null>;
|
|
107
143
|
listAll(): Promise<HostRosterRow[]>;
|
|
108
144
|
/**
|
|
@@ -19,11 +19,15 @@ export declare class AgentTokenStore {
|
|
|
19
19
|
* Static tokens have no expiry and are intended for manually-registered agents.
|
|
20
20
|
*
|
|
21
21
|
* @param opts.labels - Optional agent labels this token is authorized for.
|
|
22
|
+
* @param opts.mandatoryLabels - Optional taint labels (a Kubernetes-taint-style
|
|
23
|
+
* gate): a static agent registering with this token only accepts a job when
|
|
24
|
+
* every label here appears in the job's required labels. Undefined = no taint.
|
|
22
25
|
* @param opts.createdBy - Optional creator identifier (e.g. "cli:admin").
|
|
23
26
|
* @returns The plaintext token (shown once) and the DB row ID.
|
|
24
27
|
*/
|
|
25
28
|
createStatic(opts: {
|
|
26
29
|
labels?: string[];
|
|
30
|
+
mandatoryLabels?: string[];
|
|
27
31
|
createdBy?: string;
|
|
28
32
|
}): Promise<{
|
|
29
33
|
token: string;
|
|
@@ -41,6 +45,35 @@ export declare class AgentTokenStore {
|
|
|
41
45
|
* @returns The plaintext token (shown once).
|
|
42
46
|
*/
|
|
43
47
|
createEphemeral(agentId: string, labels: string[], ttlMs: number): Promise<string>;
|
|
48
|
+
/**
|
|
49
|
+
* Mint a single-use, short-TTL bootstrap token for an init-runner bring-up.
|
|
50
|
+
*
|
|
51
|
+
* The token is stored as `agent_type: 'ephemeral'` (so the existing expiry
|
|
52
|
+
* cleanup reaps it) and is bound to exactly the init-runner label set. It is
|
|
53
|
+
* single-use: `consumeBootstrapToken` sets `consumed_at` on first
|
|
54
|
+
* `agent.register`, and a second register is rejected. A leaked token is
|
|
55
|
+
* therefore inert after enrollment AND after its short TTL elapses.
|
|
56
|
+
*
|
|
57
|
+
* @param targetAgentId - The agent id the init-runner will register as.
|
|
58
|
+
* @param ttlMs - Time-to-live in milliseconds (short, ~10 min).
|
|
59
|
+
* @param labels - The init-runner labels the token authorizes.
|
|
60
|
+
* @returns The plaintext token (shown once) and the DB row ID.
|
|
61
|
+
*/
|
|
62
|
+
mintBootstrapToken(opts: {
|
|
63
|
+
targetAgentId: string;
|
|
64
|
+
ttlMs: number;
|
|
65
|
+
labels: string[];
|
|
66
|
+
}): Promise<{
|
|
67
|
+
token: string;
|
|
68
|
+
id: string;
|
|
69
|
+
}>;
|
|
70
|
+
/**
|
|
71
|
+
* Consume a single-use bootstrap token by id. Sets `consumed_at` only when it
|
|
72
|
+
* is currently null, so the first register wins and any subsequent attempt
|
|
73
|
+
* with the same token returns false (already consumed). Returns true when
|
|
74
|
+
* this call performed the consumption.
|
|
75
|
+
*/
|
|
76
|
+
consumeBootstrapToken(id: string): Promise<boolean>;
|
|
44
77
|
/**
|
|
45
78
|
* Validate a plaintext token against stored hashes.
|
|
46
79
|
*
|
package/dist/app.d.ts
CHANGED
|
@@ -37,6 +37,7 @@ import type { PendingBuildTracker } from './cache/index.js';
|
|
|
37
37
|
import type { PendingInitTracker } from './cache/index.js';
|
|
38
38
|
import type { PendingDynamicTracker } from './cache/index.js';
|
|
39
39
|
import type { CacheStorage } from './storage/types.js';
|
|
40
|
+
import type { ProvenanceTrustRoot } from './provenance/trust-root.js';
|
|
40
41
|
import { type CheckRunReporter } from './reporting/check-run-reporter.js';
|
|
41
42
|
import type { ExecutionTracker } from './reporting/execution-tracker.js';
|
|
42
43
|
import type { LogWriter } from './reporting/log-writer.js';
|
|
@@ -108,6 +109,8 @@ export interface AppDependencies {
|
|
|
108
109
|
dispatchCacheRefs?: DispatchCacheRefTracker;
|
|
109
110
|
/** Cache storage backend (S3) for metadata operations on upload completion. */
|
|
110
111
|
cacheStorage?: CacheStorage;
|
|
112
|
+
/** Provenance trust root used to verify build-provenance bundles at ingest. */
|
|
113
|
+
provenanceTrustRoot?: ProvenanceTrustRoot;
|
|
111
114
|
/**
|
|
112
115
|
* Filesystem cache backend handle. Only set when KICI_STORAGE_TYPE is
|
|
113
116
|
* `filesystem`. Drives the /api/v1/cache/blob/* HTTP route that serves and
|
|
@@ -3,13 +3,14 @@
|
|
|
3
3
|
*
|
|
4
4
|
* The orchestrator dispatches an init job for dynamic environment resolution
|
|
5
5
|
* and waits for the agent to return the resolved field values
|
|
6
|
-
* (
|
|
6
|
+
* (environmentNames, env, concurrencyGroup). The underlying tracker logic lives
|
|
7
7
|
* in `PendingTracker<InitResult>`; this subclass wires the init-specific
|
|
8
8
|
* logger prefix and disconnect error.
|
|
9
9
|
*/
|
|
10
10
|
import { PendingTracker } from './pending-tracker.js';
|
|
11
11
|
export interface InitResult {
|
|
12
|
-
|
|
12
|
+
/** Resolved bound-environment names, in merge order (one per `environments` element). */
|
|
13
|
+
environmentNames?: string[];
|
|
13
14
|
env?: Record<string, string>;
|
|
14
15
|
concurrencyGroup?: string;
|
|
15
16
|
/**
|
package/dist/cli/api-client.d.ts
CHANGED
|
@@ -206,6 +206,7 @@ export declare class AdminApiClient {
|
|
|
206
206
|
revokeToken(id: string): Promise<void>;
|
|
207
207
|
createAgentToken(opts: {
|
|
208
208
|
labels?: string[];
|
|
209
|
+
mandatoryLabels?: string[];
|
|
209
210
|
}): Promise<{
|
|
210
211
|
id: string;
|
|
211
212
|
token: string;
|
|
@@ -373,6 +374,13 @@ export declare class AdminApiClient {
|
|
|
373
374
|
}): Promise<{
|
|
374
375
|
jobs: Array<Record<string, unknown>>;
|
|
375
376
|
}>;
|
|
377
|
+
/**
|
|
378
|
+
* Fetch the machine-first, provenance-tagged structured run result: typed
|
|
379
|
+
* job DAG, per-step exit codes / durations / statuses, derived failure
|
|
380
|
+
* category. Untrusted fields are envelope-tagged; secret values are never
|
|
381
|
+
* returned (only secret-output key names).
|
|
382
|
+
*/
|
|
383
|
+
getRunStructured(runId: string): Promise<Record<string, unknown>>;
|
|
376
384
|
/**
|
|
377
385
|
* Fetch the scrub status of the run's ephemeral key. Never returns the
|
|
378
386
|
* key material itself — only `{ exists, createdAt }`.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Kysely } from 'kysely';
|
|
2
|
+
import type { Database } from '../../db/types.js';
|
|
3
|
+
import type { CacheStorage } from '../../storage/types.js';
|
|
4
|
+
import type { ProvenanceTrustRoot } from '../../provenance/trust-root.js';
|
|
5
|
+
/**
|
|
6
|
+
* Backfill / refresh attestation verdicts. By default it re-evaluates only rows
|
|
7
|
+
* that have no usable verdict yet (`pending` / `unverifiable`) — the rollout
|
|
8
|
+
* path for rows recorded before verify-at-ingest, or before an org configured
|
|
9
|
+
* provenance. With `--all` it re-evaluates every row. Idempotent: re-running
|
|
10
|
+
* over already-verified rows (when `--all`) recomputes the same verdict.
|
|
11
|
+
*/
|
|
12
|
+
export declare function reverifyAttestations(db: Kysely<Database>, trustRoot: ProvenanceTrustRoot, storage: CacheStorage | undefined, opts: {
|
|
13
|
+
all: boolean;
|
|
14
|
+
}): Promise<{
|
|
15
|
+
updated: number;
|
|
16
|
+
scanned: number;
|
|
17
|
+
}>;
|
|
18
|
+
//# sourceMappingURL=attestations-reverify.d.ts.map
|
|
@@ -27,6 +27,7 @@ interface VersionedUpgradeOptions {
|
|
|
27
27
|
yes?: boolean;
|
|
28
28
|
cleanup?: boolean;
|
|
29
29
|
rollback?: boolean;
|
|
30
|
+
pick?: boolean;
|
|
30
31
|
force?: boolean;
|
|
31
32
|
}
|
|
32
33
|
/**
|
|
@@ -74,6 +75,40 @@ export declare function resolveUpgradeTarget(args: {
|
|
|
74
75
|
* - windows: C:\Program Files\KiCI\<name>\
|
|
75
76
|
*/
|
|
76
77
|
export declare function getInstallBase(platform: ServicePlatform, name: string): string;
|
|
78
|
+
/** A choice row for the `--pick` interactive select. */
|
|
79
|
+
export interface PickChoice {
|
|
80
|
+
value: string;
|
|
81
|
+
name: string;
|
|
82
|
+
/** `false` when selectable; a reason string when disabled (inquirer renders it). */
|
|
83
|
+
disabled: boolean | string;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Build the interactive `--pick` choices, newest-first (lexicographic, matching
|
|
87
|
+
* the rest of the versioned-directory handling). The currently-active version is
|
|
88
|
+
* labeled `(current)` and disabled so it cannot be selected — picking it would be
|
|
89
|
+
* a no-op restart.
|
|
90
|
+
*/
|
|
91
|
+
export declare function buildPickChoices(versions: string[], current: string | null): PickChoice[];
|
|
92
|
+
/**
|
|
93
|
+
* The versions a `--pick` switch may target: every installed version except the
|
|
94
|
+
* currently-active one. Empty when only the current version (or nothing) is
|
|
95
|
+
* installed — the caller turns that into a "nothing to pick" error.
|
|
96
|
+
*/
|
|
97
|
+
export declare function selectablePickTargets(versions: string[], current: string | null): string[];
|
|
98
|
+
/**
|
|
99
|
+
* Validate that `--pick` is not combined with a source/mode flag it conflicts
|
|
100
|
+
* with. `--pick` activates an already-installed version, so it never downloads
|
|
101
|
+
* (`--from`/`--url`), never takes an explicit `--version`, and is its own mode
|
|
102
|
+
* (not `--rollback`/`--cleanup`). Returns an error message, or null when OK.
|
|
103
|
+
*/
|
|
104
|
+
export declare function checkPickFlagConflicts(opts: {
|
|
105
|
+
pick?: boolean;
|
|
106
|
+
from?: string;
|
|
107
|
+
url?: string;
|
|
108
|
+
version?: string;
|
|
109
|
+
rollback?: boolean;
|
|
110
|
+
cleanup?: boolean;
|
|
111
|
+
}): string | null;
|
|
77
112
|
/**
|
|
78
113
|
* Perform a versioned directory upgrade for a KiCI component.
|
|
79
114
|
*
|
|
@@ -123,5 +158,22 @@ export declare function verifyNpmSourceLaunch(opts: {
|
|
|
123
158
|
force: boolean;
|
|
124
159
|
}): NpmSourceLaunchVerdict;
|
|
125
160
|
export declare function performVersionedUpgrade(component: UpgradeComponent, opts: VersionedUpgradeOptions): Promise<void>;
|
|
161
|
+
/**
|
|
162
|
+
* Stop the service, switch the active version pointer to an already-installed
|
|
163
|
+
* versioned directory (atomic symlink on Unix; uninstall→install + version file
|
|
164
|
+
* on Windows), restart, and persist the new `kiciVersion` into the manifest.
|
|
165
|
+
*
|
|
166
|
+
* Shared by `--rollback` (switch to the previous version) and `--pick` (switch
|
|
167
|
+
* to any chosen installed version).
|
|
168
|
+
*/
|
|
169
|
+
export declare function switchToInstalledVersion(args: {
|
|
170
|
+
component: UpgradeComponent;
|
|
171
|
+
platform: ServicePlatform;
|
|
172
|
+
installBase: string;
|
|
173
|
+
config: ServiceConfig;
|
|
174
|
+
manager: ServiceManager;
|
|
175
|
+
resolvedInstance: ResolvedInstance;
|
|
176
|
+
targetVersion: string;
|
|
177
|
+
}): Promise<void>;
|
|
126
178
|
export {};
|
|
127
179
|
//# sourceMappingURL=versioned-upgrade.d.ts.map
|