@kici-dev/orchestrator 0.15.0 → 0.16.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__/scratch-db.d.ts +16 -0
- package/dist/agent/registry.d.ts +1 -8
- package/dist/app-on-error.d.ts +1 -1
- package/dist/artifacts/artifact-store.d.ts +0 -2
- package/dist/audit/access-log.d.ts +1 -1
- package/dist/cache/source-cache.d.ts +1 -1
- package/dist/cache/user-cache.d.ts +0 -28
- package/dist/cli/api-client.d.ts +27 -1
- package/dist/cli/commands/access-log.d.ts +1 -1
- package/dist/cli/commands/cold-store-impl.d.ts +7 -84
- package/dist/cli/commands/db.d.ts +1 -0
- package/dist/cli/commands/orchestrator-service/status.d.ts +2 -0
- package/dist/cli/commands/org.d.ts +12 -0
- package/dist/cli/commands/scaler.d.ts +14 -0
- package/dist/cli/commands/secret.d.ts +1 -45
- package/dist/cli/commands/service-health.d.ts +21 -13
- package/dist/cli/commands/shared/cli-action.d.ts +17 -0
- package/dist/cli/commands/shared/db.d.ts +5 -5
- package/dist/cli/commands/shared/org-id.d.ts +5 -0
- package/dist/cli/commands/shared/service-verbs.d.ts +19 -0
- package/dist/cli/commands/shared/table.d.ts +3 -0
- package/dist/cli/commands/shared/unbound-context-warning.d.ts +2 -22
- package/dist/cli/commands/trust-policy.d.ts +7 -31
- package/dist/cli/kici-admin.d.ts +1 -1
- package/dist/cli.js +9863 -8201
- package/dist/cluster/coordinator.d.ts +2 -2
- package/dist/cluster/peer-client.d.ts +27 -1
- package/dist/cluster/peer-forget.d.ts +4 -9
- package/dist/cluster/peer-handler.d.ts +11 -1
- package/dist/cluster/peer-request-waiters.d.ts +26 -0
- package/dist/cluster/scaler-orphans-peer.d.ts +4 -9
- package/dist/cluster/scaler-reload-fanout.d.ts +29 -0
- package/dist/cluster/scaler-reload-peer.d.ts +16 -0
- package/dist/cluster/worker-cluster-settings.d.ts +1 -0
- package/dist/cold-store/load-access-log-range.d.ts +3 -3
- package/dist/cold-store/tables/access-log.d.ts +4 -12
- package/dist/cold-store/tables/event-log.d.ts +8 -19
- package/dist/cold-store/tables/execution-jobs.d.ts +7 -24
- package/dist/cold-store/tables/execution-runs.d.ts +6 -20
- package/dist/cold-store/tables/execution-steps.d.ts +8 -26
- package/dist/cold-store/tables/secret-audit-log.d.ts +4 -11
- package/dist/config/env-overlay.d.ts +3 -8
- package/dist/config/reload.d.ts +9 -2
- package/dist/config/schema.d.ts +2 -2
- package/dist/config/types.d.ts +2 -2
- package/dist/config.d.ts +13 -17
- package/dist/contexts/held-runs.d.ts +3 -6
- package/dist/dashboard/cursor.d.ts +12 -0
- package/dist/dashboard/handler.d.ts +5 -12
- package/dist/db/deferred-index-build.d.ts +42 -0
- package/dist/db/deferred-indexes.d.ts +3 -37
- package/dist/db/migrations/100_held_runs_hold_type_vocabulary.d.ts +3 -5
- package/dist/db/migrations/158_normalize_legacy_values.d.ts +4 -0
- package/dist/db/repos/org-ids-repo.d.ts +87 -0
- package/dist/db/schema-snapshot.generated.d.ts +3 -0
- package/dist/db/types.d.ts +5 -22
- package/dist/fault-injection-types.d.ts +0 -6
- package/dist/git/dispatch-git-auth.d.ts +6 -12
- package/dist/helpers/json.d.ts +3 -0
- package/dist/index.js +133 -136
- package/dist/metrics/prometheus.d.ts +0 -5
- package/dist/oidc/id-token-claims.d.ts +1 -1
- package/dist/oidc/resolve-signer.d.ts +2 -4
- package/dist/orchestrator-core.d.ts +10 -3
- package/dist/pipeline/global-eval-round.d.ts +2 -26
- package/dist/pipeline/install-secrets-resolver.d.ts +0 -3
- package/dist/pipeline/manual-schedule.d.ts +1 -7
- package/dist/provenance/dispatch-context.d.ts +5 -7
- package/dist/provenance/pending-attestations-repo.d.ts +1 -1
- package/dist/provenance/trust-root.d.ts +4 -5
- package/dist/provenance/verify-deferred-capture.d.ts +3 -3
- package/dist/provider-registry.d.ts +13 -40
- package/dist/providers/universal-git/ssh-auth.d.ts +0 -5
- package/dist/reporting/check-run-reporter.d.ts +8 -21
- package/dist/reporting/check-run-summary.d.ts +2 -2
- package/dist/reporting/execution-tracker.d.ts +1 -1
- package/dist/reporting/log-chunk-sink.d.ts +1 -1
- package/dist/reporting/run-summary-fields.d.ts +25 -0
- package/dist/reporting/s3-log-storage.d.ts +2 -2
- package/dist/routes/admin-access-log.d.ts +2 -9
- package/dist/routes/admin-backends.d.ts +2 -9
- package/dist/routes/admin-cluster-name.d.ts +2 -8
- package/dist/routes/admin-cluster-settings.d.ts +2 -8
- package/dist/routes/admin-config.d.ts +0 -3
- package/dist/routes/admin-contexts.d.ts +3 -11
- package/dist/routes/admin-db.d.ts +2 -9
- package/dist/routes/admin-env.d.ts +33 -0
- package/dist/routes/admin-event-dlq.d.ts +2 -9
- package/dist/routes/admin-event-inspect.d.ts +2 -9
- package/dist/routes/admin-event-log.d.ts +2 -9
- package/dist/routes/admin-events.d.ts +3 -13
- package/dist/routes/admin-held-runs.d.ts +2 -8
- package/dist/routes/admin-list-limit.d.ts +3 -0
- package/dist/routes/admin-maintenance.d.ts +2 -9
- package/dist/routes/admin-orchestrator-drain.d.ts +2 -9
- package/dist/routes/admin-org-settings.d.ts +2 -8
- package/dist/routes/admin-orgs.d.ts +27 -0
- package/dist/routes/admin-peer-forget.d.ts +2 -9
- package/dist/routes/admin-queue-execution.d.ts +3 -10
- package/dist/routes/admin-registrations.d.ts +3 -14
- package/dist/routes/admin-runs.d.ts +3 -14
- package/dist/routes/admin-scaler-orphans.d.ts +2 -9
- package/dist/routes/admin-scaler-reload.d.ts +41 -0
- package/dist/routes/admin-scheduled-jobs.d.ts +2 -9
- package/dist/routes/admin-signing-keys.d.ts +2 -9
- package/dist/routes/admin-sources.d.ts +2 -9
- package/dist/routes/admin-trust-policy.d.ts +2 -8
- package/dist/routes/admin.d.ts +15 -13
- package/dist/scaler/config.d.ts +12 -84
- package/dist/scaler/file-reload.d.ts +48 -0
- package/dist/scaler/manager.d.ts +47 -33
- package/dist/scaler/scaler-state-store.d.ts +5 -0
- package/dist/scaler/types.d.ts +1 -4
- package/dist/secrets/job-secret-gate.d.ts +2 -5
- package/dist/secrets/secret-resolver.d.ts +2 -4
- package/dist/security/trust-policy-gate.d.ts +0 -4
- package/dist/server.d.ts +6 -17
- package/dist/server.js +6693 -8005
- package/dist/standalone.js +5826 -6555
- package/dist/worker/reroute-dispatch.d.ts +1 -0
- package/dist/worker/reroute-spawn-control.d.ts +1 -3
- package/dist/worker-core.d.ts +9 -2
- package/dist/ws/agent-handler.d.ts +3 -3
- package/dist/ws/dashboard-access.d.ts +57 -0
- package/dist/ws/dashboard-backends-handler.d.ts +1 -6
- package/dist/ws/dashboard-context-handler.d.ts +10 -15
- package/dist/ws/dashboard-fleet-write-handler.d.ts +1 -6
- package/dist/ws/dashboard-global-workflows-handler.d.ts +1 -6
- package/dist/ws/dashboard-registrations-handler.d.ts +1 -7
- package/dist/ws/platform-client.d.ts +85 -330
- package/installer-image-digests.json +3 -3
- package/package.json +4 -4
- package/sbom.spdx.json +53 -53
- package/dist/cache/legacy-prefixes.d.ts +0 -19
- package/dist/cli/commands/agent-service/logs.d.ts +0 -14
- package/dist/cli/commands/agent-service/restart.d.ts +0 -12
- package/dist/cli/commands/agent-service/start.d.ts +0 -12
- package/dist/cli/commands/agent-service/stop.d.ts +0 -12
- package/dist/cli/commands/agent-service/uninstall.d.ts +0 -13
- package/dist/cli/commands/cache.d.ts +0 -51
- package/dist/cli/commands/orchestrator-service/logs.d.ts +0 -14
- package/dist/cli/commands/orchestrator-service/restart.d.ts +0 -12
- package/dist/cli/commands/orchestrator-service/start.d.ts +0 -12
- package/dist/cli/commands/orchestrator-service/stop.d.ts +0 -12
- package/dist/cli/commands/orchestrator-service/uninstall.d.ts +0 -13
- package/dist/git/inherited-secret.d.ts +0 -29
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/** Throwaway PostgreSQL databases for DB-gated tests, dropped by `cleanup`. */
|
|
2
|
+
import pg from 'pg';
|
|
3
|
+
import { Kysely } from 'kysely';
|
|
4
|
+
export interface ScratchDb {
|
|
5
|
+
url: string;
|
|
6
|
+
pool: pg.Pool;
|
|
7
|
+
db: Kysely<any>;
|
|
8
|
+
}
|
|
9
|
+
/** Creates databases on `adminUrl`; `cleanup` drops every one of them. */
|
|
10
|
+
export declare function scratchDbFactory(adminUrl: string): {
|
|
11
|
+
freshDb: (tag: string) => Promise<ScratchDb>;
|
|
12
|
+
cleanup: () => Promise<void>;
|
|
13
|
+
};
|
|
14
|
+
/** The applied migration names, sorted. */
|
|
15
|
+
export declare function ledgerNames(db: Kysely<any>): Promise<string[]>;
|
|
16
|
+
//# sourceMappingURL=scratch-db.d.ts.map
|
package/dist/agent/registry.d.ts
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* No persistence needed -- agents re-register on reconnect.
|
|
10
10
|
*/
|
|
11
11
|
import { type CanonicalLabel, type LabelMatcher } from '@kici-dev/engine';
|
|
12
|
-
import type {
|
|
12
|
+
import type { WsLike } from '@kici-dev/engine';
|
|
13
13
|
/**
|
|
14
14
|
* The longest a busy rejection holds an agent out of routing when no evidence
|
|
15
15
|
* of a free slot lifts the hold first: an `agent.status` capacity report, or a
|
|
@@ -108,11 +108,6 @@ export interface AgentEntry {
|
|
|
108
108
|
registeredAt: number;
|
|
109
109
|
/** Self-reported agent version (e.g. "0.0.1"). Null if not reported. */
|
|
110
110
|
version: string | null;
|
|
111
|
-
/**
|
|
112
|
-
* Optional behaviours the agent advertised on `agent.register`. Null for an
|
|
113
|
-
* agent that advertised none, which is read as supporting none.
|
|
114
|
-
*/
|
|
115
|
-
capabilities: AgentCapabilities | null;
|
|
116
111
|
/**
|
|
117
112
|
* The `agent_tokens.id` row used to authenticate this connection, or
|
|
118
113
|
* `null` when auth mode is `none`. Indexed by `tokenIdIndex` so a
|
|
@@ -180,8 +175,6 @@ interface AgentMetadata {
|
|
|
180
175
|
* any operator-declared properties). Undefined ⇒ the agent reported none.
|
|
181
176
|
*/
|
|
182
177
|
properties?: Record<string, string | number | boolean>;
|
|
183
|
-
/** Optional behaviours the agent advertised on `agent.register`. */
|
|
184
|
-
capabilities?: AgentCapabilities;
|
|
185
178
|
}
|
|
186
179
|
/**
|
|
187
180
|
* Subset of `HostRosterStore` the registry reconciles into. Optional — when no
|
package/dist/app-on-error.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Without one, Hono answers an unhandled throw with a bare, unstructured 500:
|
|
5
5
|
* no JSON body, no route context, and nothing written to our own logs. Every
|
|
6
|
-
* admin
|
|
6
|
+
* admin sub-app answers its own errors through its own onError (routes/admin-env.ts),
|
|
7
7
|
* and the auth path catches inside its middleware (routes/admin-auth.ts) -- this
|
|
8
8
|
* covers whatever neither does.
|
|
9
9
|
*
|
|
@@ -207,8 +207,6 @@ export declare class ArtifactStore {
|
|
|
207
207
|
runId: string;
|
|
208
208
|
name: string;
|
|
209
209
|
}): Promise<ArtifactDownloadResult>;
|
|
210
|
-
/** ISO string for a row's created_at (Date or already-string). */
|
|
211
|
-
private createdAtIso;
|
|
212
210
|
/** Load a run's non-expired artifact rows, newest first, given the org TTL. */
|
|
213
211
|
private loadRunRows;
|
|
214
212
|
/**
|
|
@@ -105,7 +105,7 @@ export declare class AccessLogWriter {
|
|
|
105
105
|
* synthetic `__orchestrator__` tenant is scanned (matches the
|
|
106
106
|
* NULL-org_id rows the orchestrator itself emits via
|
|
107
107
|
* `cold-store-archive` / `cold-store-purge`). The CLI exposes this as
|
|
108
|
-
* `kici-admin access-log show <id> --org
|
|
108
|
+
* `kici-admin access-log show <id> --org <orgId>`.
|
|
109
109
|
*
|
|
110
110
|
* Best-effort contract: a cold-store error logs a warn line and
|
|
111
111
|
* returns null, matching `loadAccessLogRange` and
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
* defect this layout closes — so serving it would serve the bug. For a v6 lock
|
|
33
33
|
* the fallback is unreachable anyway, since the schema bump moves every hash.
|
|
34
34
|
* Old objects are orphaned. The cache TTL is enforced lazily on access, so
|
|
35
|
-
* nothing here removes them
|
|
35
|
+
* nothing here removes them.
|
|
36
36
|
*/
|
|
37
37
|
import type { CacheStorage } from '../storage/types.js';
|
|
38
38
|
/**
|
|
@@ -24,26 +24,6 @@ export interface UserCacheOrgLimits {
|
|
|
24
24
|
}
|
|
25
25
|
/** Resolves the per-org cache limits for an org id (e.g. an `org_settings` read). */
|
|
26
26
|
export type UserCacheOrgLimitsReader = (orgId: string) => Promise<UserCacheOrgLimits>;
|
|
27
|
-
/**
|
|
28
|
-
* Stem prefix of an in-flight upload, `.tmp-<uuid>.tar.gz`: the presigned PUT
|
|
29
|
-
* target a save lands on before commit copies it to its final key. Shared with
|
|
30
|
-
* the retired-layout classifier so both agree on what an upload looks like.
|
|
31
|
-
*/
|
|
32
|
-
export declare const TEMP_UPLOAD_STEM = ".tmp-";
|
|
33
|
-
/**
|
|
34
|
-
* Sanitize a path segment so a key can never escape its org/repo/scope
|
|
35
|
-
* namespace. Beyond stripping disallowed characters, a segment consisting
|
|
36
|
-
* only of dots (`.`, `..`, …) is replaced wholesale: such a segment is a
|
|
37
|
-
* dot-segment that HTTP/S3 path canonicalization collapses (`a/./b` → `a/b`,
|
|
38
|
-
* `a/../b` → `b`), which both corrupts the namespace and breaks the SigV4
|
|
39
|
-
* signature on a pre-signed PUT/GET. Repo identifiers like `.` (the internal
|
|
40
|
-
* provider's repo id) hit exactly this case, so the all-dots guard keeps the
|
|
41
|
-
* object key canonical and the namespace boundary intact.
|
|
42
|
-
*
|
|
43
|
-
* Exported so an operator tool that addresses an org's prefix from a raw org id
|
|
44
|
-
* (`kici-admin cache purge-legacy --org`) lands on the segment the writer used.
|
|
45
|
-
*/
|
|
46
|
-
export declare function sanitizeSegment(s: string): string;
|
|
47
27
|
/** Identifies the org + repo + write scope a cache operation targets. */
|
|
48
28
|
export interface UserCacheRef {
|
|
49
29
|
org: string;
|
|
@@ -65,14 +45,6 @@ export interface UserCacheBeginSaveResult {
|
|
|
65
45
|
uploadUrl?: string;
|
|
66
46
|
tempKey?: string;
|
|
67
47
|
}
|
|
68
|
-
/**
|
|
69
|
-
* The object key a committed save under `key` lands on for this ref. This is
|
|
70
|
-
* the writer's own path — `beginSave` and `commitSave` address the entry
|
|
71
|
-
* through it — so anything that must recognise a current-layout key (the
|
|
72
|
-
* legacy-layout classifier tests) takes it from here rather than restating
|
|
73
|
-
* the format.
|
|
74
|
-
*/
|
|
75
|
-
export declare function userCacheEntryKey(ref: UserCacheRef, key: string): string;
|
|
76
48
|
export declare class UserCache {
|
|
77
49
|
private readonly storage;
|
|
78
50
|
/** Cluster-wide default quota (the `KICI_USER_CACHE_QUOTA_BYTES` value). */
|
package/dist/cli/api-client.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* All methods are thin wrappers around fetch() that handle JSON serialization,
|
|
6
6
|
* error formatting, and URL construction.
|
|
7
7
|
*/
|
|
8
|
-
import type { PeerForgetOutcome, ScalerLiveVm, ScalerVmStopResult } from '@kici-dev/engine';
|
|
8
|
+
import type { PeerForgetOutcome, ScalerLiveVm, ScalerReloadAnswer, ScalerReloadInstanceResult, ScalerVmStopResult } from '@kici-dev/engine';
|
|
9
9
|
/** `POST /api/v1/admin/peers/forget`: one result per coordinator, this one first. */
|
|
10
10
|
export interface PeerForgetResponseBody {
|
|
11
11
|
instanceId: string;
|
|
@@ -18,6 +18,11 @@ export interface PeerForgetResponseBody {
|
|
|
18
18
|
acknowledgementRequired?: boolean;
|
|
19
19
|
error?: string;
|
|
20
20
|
}
|
|
21
|
+
/** The answer of `POST /api/v1/admin/scaler/reload`: one result per orchestrator, this one first. */
|
|
22
|
+
export interface ScalerReloadResponseBody {
|
|
23
|
+
scope: 'cluster' | 'single';
|
|
24
|
+
results: ScalerReloadInstanceResult[];
|
|
25
|
+
}
|
|
21
26
|
/** The node a scaler orphans request answered for. */
|
|
22
27
|
export interface ScalerOrphansNode {
|
|
23
28
|
instanceId: string;
|
|
@@ -138,7 +143,11 @@ export declare function firstCauseMessage(err: unknown): string;
|
|
|
138
143
|
* opening a connection.
|
|
139
144
|
*/
|
|
140
145
|
export declare function isTransportFailure(err: unknown): boolean;
|
|
146
|
+
/** The admin API address kici-admin dials when neither --url nor KICI_ADMIN_URL is set. */
|
|
147
|
+
export declare const DEFAULT_ADMIN_URL = "http://localhost:4000";
|
|
141
148
|
export declare function fetchAdminApi(url: string, init: RequestInit, baseUrl: string): Promise<Response>;
|
|
149
|
+
/** Build a `?a=1&b=2` query string, skipping undefined, null and empty-string values. */
|
|
150
|
+
export declare function toQuery(params: Record<string, string | number | boolean | undefined | null>): string;
|
|
142
151
|
export declare class AdminApiClient {
|
|
143
152
|
private readonly baseUrl;
|
|
144
153
|
private readonly token;
|
|
@@ -409,6 +418,7 @@ export declare class AdminApiClient {
|
|
|
409
418
|
success: boolean;
|
|
410
419
|
version?: number;
|
|
411
420
|
errors?: string[];
|
|
421
|
+
scaler?: ScalerReloadAnswer;
|
|
412
422
|
}>;
|
|
413
423
|
/** Flip the coordinator drain flag on ('drain') or off ('resume'). */
|
|
414
424
|
drain(action: 'drain' | 'resume'): Promise<{
|
|
@@ -432,6 +442,22 @@ export declare class AdminApiClient {
|
|
|
432
442
|
timeoutMs?: number;
|
|
433
443
|
acknowledgeBackstop?: boolean;
|
|
434
444
|
}): Promise<PeerForgetResponseBody>;
|
|
445
|
+
/**
|
|
446
|
+
* POST `body` and parse the answer whatever its status, for a route that
|
|
447
|
+
* reports per-instance results on a non-2xx status too. An unparseable body
|
|
448
|
+
* reads as `{}`.
|
|
449
|
+
*/
|
|
450
|
+
private postForBody;
|
|
451
|
+
/**
|
|
452
|
+
* Reload the scaler config on this orchestrator and, unless `single`, on every
|
|
453
|
+
* peer it is connected to. A response where an instance refused its file or
|
|
454
|
+
* was not reached (422) is returned like a success, so the caller can show
|
|
455
|
+
* every instance; a 404 means the orchestrator predates the route.
|
|
456
|
+
*/
|
|
457
|
+
scalerReload(body: {
|
|
458
|
+
single?: boolean;
|
|
459
|
+
timeoutMs?: number;
|
|
460
|
+
}): Promise<ScalerReloadResponseBody>;
|
|
435
461
|
/** List the live Firecracker VMs on this coordinator, or on the `target` peer. */
|
|
436
462
|
listScalerOrphans(opts?: {
|
|
437
463
|
target?: string;
|
|
@@ -1,101 +1,24 @@
|
|
|
1
|
-
export declare
|
|
2
|
-
databaseUrl: string;
|
|
1
|
+
export declare const archiveNow: (opts: import("@kici-dev/shared").ColdStoreAdminStoreOpts & {
|
|
3
2
|
table: string;
|
|
4
|
-
|
|
5
|
-
}): Promise<void>;
|
|
6
|
-
export declare function dryRunArchive(opts: {
|
|
7
|
-
databaseUrl: string;
|
|
3
|
+
}) => Promise<void>, dryRunArchive: (opts: import("@kici-dev/shared").ColdStoreAdminStoreOpts & {
|
|
8
4
|
table: string;
|
|
9
5
|
tenant?: string;
|
|
10
6
|
from?: string;
|
|
11
7
|
to?: string;
|
|
12
|
-
|
|
13
|
-
}): Promise<void>;
|
|
14
|
-
export interface ChunkListing {
|
|
15
|
-
chunkId: string;
|
|
16
|
-
tenantId: string;
|
|
17
|
-
partitionDate: string;
|
|
18
|
-
dataKey: string | null;
|
|
19
|
-
manifestKey: string | null;
|
|
20
|
-
}
|
|
21
|
-
export declare function listChunks(opts: {
|
|
22
|
-
databaseUrl: string;
|
|
8
|
+
}) => Promise<void>, listChunks: (opts: import("@kici-dev/shared").ColdStoreAdminStoreOpts & {
|
|
23
9
|
table: string;
|
|
24
10
|
tenant?: string;
|
|
25
11
|
missingData?: boolean;
|
|
26
12
|
missingManifest?: boolean;
|
|
27
13
|
from?: string;
|
|
28
14
|
to?: string;
|
|
29
|
-
|
|
30
|
-
}): Promise<void>;
|
|
31
|
-
export declare function verifyChunk(opts: {
|
|
32
|
-
databaseUrl: string;
|
|
33
|
-
chunkId: string;
|
|
34
|
-
table: string;
|
|
35
|
-
tenant: string;
|
|
36
|
-
partitionDate: string;
|
|
37
|
-
instanceId?: string;
|
|
38
|
-
}): Promise<'match' | 'mismatch'>;
|
|
39
|
-
export declare function replayChunk(opts: {
|
|
40
|
-
databaseUrl: string;
|
|
41
|
-
chunkId: string;
|
|
42
|
-
table: string;
|
|
43
|
-
tenant: string;
|
|
44
|
-
partitionDate: string;
|
|
45
|
-
instanceId?: string;
|
|
46
|
-
}): Promise<void>;
|
|
47
|
-
/**
|
|
48
|
-
* Promote a chunk's rows back into the orchestrator PG.
|
|
49
|
-
* Mirrors the Platform-side `replayIntoPg`. Adapter must implement
|
|
50
|
-
* `replayInsert` — currently only `execution_runs`.
|
|
51
|
-
*/
|
|
52
|
-
export declare function replayIntoPg(opts: {
|
|
53
|
-
databaseUrl: string;
|
|
54
|
-
chunkId: string;
|
|
55
|
-
table: string;
|
|
56
|
-
tenant: string;
|
|
57
|
-
partitionDate: string;
|
|
58
|
-
instanceId?: string;
|
|
59
|
-
}): Promise<void>;
|
|
60
|
-
export declare function reconcile(opts: {
|
|
61
|
-
databaseUrl: string;
|
|
15
|
+
}) => Promise<void>, verifyChunk: (opts: import("@kici-dev/shared").ColdStoreAdminChunkOpts) => Promise<"match" | "mismatch">, replayChunk: (opts: import("@kici-dev/shared").ColdStoreAdminChunkOpts) => Promise<void>, replayIntoPg: (opts: import("@kici-dev/shared").ColdStoreAdminChunkOpts) => Promise<void>, reconcile: (opts: import("@kici-dev/shared").ColdStoreAdminStoreOpts & {
|
|
62
16
|
table: string;
|
|
63
17
|
tenant?: string;
|
|
64
18
|
confirmCleanup?: boolean;
|
|
65
|
-
|
|
66
|
-
}): Promise<void>;
|
|
67
|
-
/**
|
|
68
|
-
* List chunks past their cold-retention horizon. Read-only;
|
|
69
|
-
* no S3 or PG mutation. Emits one JSON line per row so the output is
|
|
70
|
-
* easy to pipe through `jq` / `column -t` / etc.
|
|
71
|
-
*/
|
|
72
|
-
export declare function listPurgeable(opts: {
|
|
73
|
-
databaseUrl: string;
|
|
74
|
-
table?: string;
|
|
75
|
-
bucket?: string;
|
|
76
|
-
limit?: number;
|
|
77
|
-
instanceId?: string;
|
|
78
|
-
}): Promise<void>;
|
|
79
|
-
/**
|
|
80
|
-
* Delete S3 objects + clean up PG bookkeeping for chunks
|
|
81
|
-
* past their cold-retention horizon. Defaults to dry-run; pass
|
|
82
|
-
* `--apply` to actually delete.
|
|
83
|
-
*/
|
|
84
|
-
export declare function purgeNow(opts: {
|
|
85
|
-
databaseUrl: string;
|
|
86
|
-
table?: string;
|
|
87
|
-
bucket?: string;
|
|
88
|
-
limit?: number;
|
|
19
|
+
}) => Promise<void>, listPurgeable: (opts: import("@kici-dev/shared").ColdStoreAdminPurgeOpts) => Promise<void>, purgeNow: (opts: import("@kici-dev/shared").ColdStoreAdminPurgeOpts & {
|
|
89
20
|
apply?: boolean;
|
|
90
|
-
|
|
91
|
-
}): Promise<void>;
|
|
92
|
-
export declare function peekChunk(opts: {
|
|
93
|
-
databaseUrl: string;
|
|
94
|
-
chunkId: string;
|
|
95
|
-
table: string;
|
|
96
|
-
tenant: string;
|
|
97
|
-
partitionDate: string;
|
|
21
|
+
}) => Promise<void>, peekChunk: (opts: import("@kici-dev/shared").ColdStoreAdminChunkOpts & {
|
|
98
22
|
limit: number;
|
|
99
|
-
|
|
100
|
-
}): Promise<void>;
|
|
23
|
+
}) => Promise<void>;
|
|
101
24
|
//# sourceMappingURL=cold-store-impl.d.ts.map
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
* db create-role CREATE ROLE LOGIN [CREATEDB] (direct DB)
|
|
8
8
|
* db create-readonly-user Read-only role + GRANT SELECT (direct DB)
|
|
9
9
|
* db check-schema Compare bundled migrations vs live schema (direct DB)
|
|
10
|
+
* db schema-diff Compare the live schema with the release snapshot (direct DB)
|
|
10
11
|
* db collation-check Check pg_database.datcollversion vs running libc (direct DB)
|
|
11
12
|
* db reindex REINDEX DATABASE CONCURRENTLY (direct DB)
|
|
12
13
|
* db refresh-collation-version ALTER DATABASE REFRESH COLLATION VERSION (direct DB)
|
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
* Shows OS-level service status (state, PID, uptime) and queries the
|
|
5
5
|
* running orchestrator's `/health` and `/ready` endpoints for its version,
|
|
6
6
|
* build fingerprint, uptime and readiness (database reachable, boot finished).
|
|
7
|
+
* With an admin token (`--token` / KICI_ADMIN_TOKEN) it also asks the
|
|
8
|
+
* instance's admin API which org the Platform attached it to.
|
|
7
9
|
*
|
|
8
10
|
* Target resolution goes through resolveInstanceTarget — the same priority chain
|
|
9
11
|
* every lifecycle command uses (--instance-dir > --name > CWD manifest >
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `kici-admin org list` — every org id this orchestrator holds data for.
|
|
3
|
+
*
|
|
4
|
+
* Reads `GET /api/v1/admin/org-ids` by default. With `--database-url` (or
|
|
5
|
+
* KICI_DATABASE_URL) it runs the same query against the orchestrator database
|
|
6
|
+
* directly; that mode cannot see the live Platform connection, so it lists no
|
|
7
|
+
* `platform` source and says so.
|
|
8
|
+
*/
|
|
9
|
+
import type { Command } from 'commander';
|
|
10
|
+
import type { AdminApiClient } from '../api-client.js';
|
|
11
|
+
export declare function registerOrgCommands(program: Command, getClient: () => AdminApiClient): void;
|
|
12
|
+
//# sourceMappingURL=org.d.ts.map
|
|
@@ -5,6 +5,9 @@
|
|
|
5
5
|
* orchestrator does not track and, with --stop, stop
|
|
6
6
|
* them. Goes through the admin HTTP API; `--target`
|
|
7
7
|
* reaches a worker through the coordinator.
|
|
8
|
+
* scaler reload Re-read the scaler config on this orchestrator and
|
|
9
|
+
* every peer it is connected to (admin HTTP API);
|
|
10
|
+
* each one applies its file completely or not at all.
|
|
8
11
|
* scaler reap-orphans Free leaked Firecracker/container resources WITHOUT a
|
|
9
12
|
* running orchestrator (recovery for a wedged node whose
|
|
10
13
|
* data disk is full).
|
|
@@ -49,6 +52,17 @@ export declare function formatAge(seconds: number): string;
|
|
|
49
52
|
* @returns the process exit code
|
|
50
53
|
*/
|
|
51
54
|
export declare function runScalerOrphans(client: OrphansClient, opts: ScalerOrphansOptions, io: ScalerOrphansIo): Promise<number>;
|
|
55
|
+
export interface ScalerReloadOptions {
|
|
56
|
+
single: boolean;
|
|
57
|
+
timeout: string;
|
|
58
|
+
json: boolean;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* `scaler reload`: reload the scaler config and print one block per instance.
|
|
62
|
+
* Resolves the exit code: 1 when any instance refused its file or was not
|
|
63
|
+
* reached, else 0. A bad `--timeout` throws before any request.
|
|
64
|
+
*/
|
|
65
|
+
export declare function runScalerReload(client: Pick<AdminApiClient, 'scalerReload'>, opts: ScalerReloadOptions, out: (line: string) => void): Promise<number>;
|
|
52
66
|
export declare function registerScalerCommands(program: Command, getClient: () => AdminApiClient): void;
|
|
53
67
|
export {};
|
|
54
68
|
//# sourceMappingURL=scaler.d.ts.map
|
|
@@ -2,56 +2,12 @@
|
|
|
2
2
|
* Secret management commands for kici-admin.
|
|
3
3
|
*
|
|
4
4
|
* Provides scoped secret operations:
|
|
5
|
-
* secret scopes, list, set, delete
|
|
5
|
+
* secret scopes, list, set, delete
|
|
6
6
|
* secret scope create|rename|delete
|
|
7
7
|
*
|
|
8
8
|
* Secret values are write-only -- there is no "get value" command.
|
|
9
9
|
*/
|
|
10
10
|
import type { Command } from 'commander';
|
|
11
11
|
import type { AdminApiClient } from '../api-client.js';
|
|
12
|
-
/** One planned rename from a stored qualified scope to its bare path. */
|
|
13
|
-
export interface PrefixedScopeRename {
|
|
14
|
-
from: string;
|
|
15
|
-
to: string;
|
|
16
|
-
backendName: string;
|
|
17
|
-
}
|
|
18
|
-
/** One stored scope that cannot be repaired automatically. */
|
|
19
|
-
export interface PrefixedScopeSkip {
|
|
20
|
-
scope: string;
|
|
21
|
-
reason: string;
|
|
22
|
-
}
|
|
23
|
-
/** Outcome of planning the repair of legacy qualifier-bearing scopes. */
|
|
24
|
-
export interface PrefixedScopeFixPlan {
|
|
25
|
-
renames: PrefixedScopeRename[];
|
|
26
|
-
skips: PrefixedScopeSkip[];
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Plan the repair of scopes stored with a `<backend>:` qualifier still attached.
|
|
30
|
-
*
|
|
31
|
-
* Before backend-qualified routing landed on the HTTP admin plane, a scope
|
|
32
|
-
* written as `pg:production` was stored verbatim, so the stored name carries a
|
|
33
|
-
* qualifier the resolver now strips before it reaches the store. Such a row is
|
|
34
|
-
* unreachable: every read addresses the bare `production`.
|
|
35
|
-
*
|
|
36
|
-
* Only a `pg:` qualifier is repaired. The scopes handed in come out of the PG
|
|
37
|
-
* store, so a row named `vault:foo` is a PG row wearing another backend's
|
|
38
|
-
* name: renaming it to `foo` would turn it into a genuine PG secret, moving it
|
|
39
|
-
* across a backend boundary and past a `pgCustomerSecrets: false` setting that
|
|
40
|
-
* exists to keep customer secrets out of PG. That is the same cross-backend
|
|
41
|
-
* move the rename route refuses, so it is reported as a skip instead.
|
|
42
|
-
*
|
|
43
|
-
* An unregistered head is left alone entirely -- it is an ordinary (if
|
|
44
|
-
* unusual) scope path, not a stale qualifier.
|
|
45
|
-
*
|
|
46
|
-
* A repair whose bare target already exists is SKIPPED, never merged: merging
|
|
47
|
-
* two scopes would silently overwrite whichever key the two share, and there
|
|
48
|
-
* is no way to tell which value the operator meant to keep.
|
|
49
|
-
*
|
|
50
|
-
* Pure -- no I/O, so the decision table is unit-testable without a database.
|
|
51
|
-
*
|
|
52
|
-
* @param scopes - Scope names as currently stored in the PG backend.
|
|
53
|
-
* @param backendNames - Names of the registered secret backends.
|
|
54
|
-
*/
|
|
55
|
-
export declare function planPrefixedScopeFixes(scopes: string[], backendNames: string[]): PrefixedScopeFixPlan;
|
|
56
12
|
export declare function registerSecretCommands(program: Command, getClient: () => AdminApiClient): void;
|
|
57
13
|
//# sourceMappingURL=secret.d.ts.map
|
|
@@ -30,6 +30,26 @@ export interface LocalEndpoint {
|
|
|
30
30
|
export declare function readLocalEndpoint(envContent: string, defaultPort: number): LocalEndpoint;
|
|
31
31
|
/** The URL of `pathname` on `endpoint`, with an IPv6 host bracketed. */
|
|
32
32
|
export declare function localUrl(endpoint: LocalEndpoint, pathname: string): string;
|
|
33
|
+
/** What a local JSON request got: a body, a refusing status, or no answer at all. */
|
|
34
|
+
export type LocalJsonResult<T> = {
|
|
35
|
+
kind: 'ok';
|
|
36
|
+
status: number;
|
|
37
|
+
body: T;
|
|
38
|
+
} | {
|
|
39
|
+
kind: 'http-error';
|
|
40
|
+
status: number;
|
|
41
|
+
} | {
|
|
42
|
+
kind: 'no-answer';
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* GET a JSON body from a service on this host. `acceptStatuses` names the
|
|
46
|
+
* non-2xx codes whose body is still an answer; `headers` carries credentials.
|
|
47
|
+
*/
|
|
48
|
+
export declare function requestLocalJson<T>(endpoint: LocalEndpoint, pathname: string, opts?: {
|
|
49
|
+
acceptStatuses?: readonly number[];
|
|
50
|
+
timeoutMs?: number;
|
|
51
|
+
headers?: Record<string, string>;
|
|
52
|
+
}): Promise<LocalJsonResult<T>>;
|
|
33
53
|
/**
|
|
34
54
|
* GET a JSON body from a service on this host. `acceptStatuses` names the
|
|
35
55
|
* non-2xx codes whose body is still an answer: `/ready` returns its checks
|
|
@@ -39,22 +59,10 @@ export declare function fetchLocalJson<T>(endpoint: LocalEndpoint, pathname: str
|
|
|
39
59
|
acceptStatuses?: readonly number[];
|
|
40
60
|
timeoutMs?: number;
|
|
41
61
|
}): Promise<T | null>;
|
|
42
|
-
/**
|
|
43
|
-
* A `/health` body with its deprecated `buildCommit` replaced by its version.
|
|
44
|
-
* A service older than this CLI reports a commit ID from KiCI's private
|
|
45
|
-
* repository there, which a reader cannot resolve; `--json` keeps the key, a
|
|
46
|
-
* string as before, and carries the release version in it. A body that reports
|
|
47
|
-
* no `buildCommit` comes back unchanged.
|
|
48
|
-
*/
|
|
49
|
-
export declare function hideBuildCommit<T extends {
|
|
50
|
-
version?: string;
|
|
51
|
-
buildCommit?: string;
|
|
52
|
-
}>(health: T): T;
|
|
53
62
|
/**
|
|
54
63
|
* Rows for the build fingerprint and process uptime of a `/health` body. A
|
|
55
64
|
* field the body lacks is skipped, so a service older than this CLI renders
|
|
56
|
-
* the fields it does report.
|
|
57
|
-
* (see {@link hideBuildCommit}).
|
|
65
|
+
* the fields it does report.
|
|
58
66
|
*/
|
|
59
67
|
export declare function buildInfoRows(health: Partial<LivenessBase & BuildFingerprint & {
|
|
60
68
|
buildDate: string;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** Commander option flag and help text shared by every command that can bypass HTTP. */
|
|
2
|
+
export declare const DIRECT_DB_URL_FLAG = "--database-url <url>";
|
|
3
|
+
export declare const DIRECT_DB_URL_HELP = "Use direct DB access instead of HTTP (offline mode)";
|
|
4
|
+
/** `--database-url`, else `KICI_DATABASE_URL`, else null (null = use the HTTP admin API). */
|
|
5
|
+
export declare function resolveDirectDbUrl(explicit?: string): string | null;
|
|
6
|
+
/** Like {@link resolveDirectDbUrl} but required: throws when neither source is set. */
|
|
7
|
+
export declare function resolveDatabaseUrl(explicit?: string): string;
|
|
8
|
+
/** Parse an optional integer flag; throws naming the flag on a non-integer. */
|
|
9
|
+
export declare function parseIntOption(raw: string | undefined, label: string): number | undefined;
|
|
10
|
+
/**
|
|
11
|
+
* Wrap a Commander action so any thrown error prints `Error: <message>` to
|
|
12
|
+
* stderr and exits 1.
|
|
13
|
+
*/
|
|
14
|
+
export declare function cliAction<A extends unknown[]>(fn: (...args: A) => Promise<void> | void): (...args: A) => Promise<void>;
|
|
15
|
+
/** Print `value` as one JSON line when `json` is set, otherwise hand it to `render`. */
|
|
16
|
+
export declare function printJsonOr<T>(json: boolean | undefined, value: T, render: (v: T) => void): void;
|
|
17
|
+
//# sourceMappingURL=cli-action.d.ts.map
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Shared database helper for CLI commands that need direct DB access.
|
|
3
3
|
*
|
|
4
|
-
* Provides a withDb() wrapper that creates a database connection from
|
|
5
|
-
* KICI_DATABASE_URL, runs a callback,
|
|
4
|
+
* Provides a withDb() wrapper that creates a database connection from the
|
|
5
|
+
* URL it is given (or KICI_DATABASE_URL when none is passed), runs a callback,
|
|
6
|
+
* and ensures cleanup.
|
|
6
7
|
*/
|
|
7
8
|
import pg from 'pg';
|
|
8
9
|
import { Kysely } from 'kysely';
|
|
9
10
|
/**
|
|
10
11
|
* Execute a callback with a database connection, then clean up.
|
|
11
12
|
*
|
|
12
|
-
*
|
|
13
|
-
* Creates a connection pool, runs the callback, and destroys the pool.
|
|
13
|
+
* Connects to `databaseUrl`, or to KICI_DATABASE_URL when none is passed.
|
|
14
14
|
*/
|
|
15
|
-
export declare function withDb<T>(fn: (db: Kysely<any>, pool: pg.Pool) => Promise<T
|
|
15
|
+
export declare function withDb<T>(fn: (db: Kysely<any>, pool: pg.Pool) => Promise<T>, databaseUrl?: string | undefined): Promise<T>;
|
|
16
16
|
//# sourceMappingURL=db.d.ts.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** Where an operator finds an org id: appended to every org-id input's help. */
|
|
2
|
+
export declare const ORG_LIST_HINT = "kici-admin org list prints the org ids";
|
|
3
|
+
/** Help text of an org-id argument or `--org` option. */
|
|
4
|
+
export declare const ORG_ID_HELP = "Org id (kici-admin org list prints the org ids)";
|
|
5
|
+
//# sourceMappingURL=org-id.d.ts.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The service lifecycle verbs shared by `kici-admin agent` and `kici-admin orchestrator`:
|
|
3
|
+
* `uninstall`, `start`, `stop`, `restart` and `logs`.
|
|
4
|
+
*
|
|
5
|
+
* Target resolution goes through resolveInstanceTarget — the priority chain every
|
|
6
|
+
* lifecycle command uses (--instance-dir > --name > CWD manifest > refusal with
|
|
7
|
+
* candidate list). `--name` has no default.
|
|
8
|
+
*/
|
|
9
|
+
import type { Command } from 'commander';
|
|
10
|
+
export type ServiceComponent = 'agent' | 'orchestrator';
|
|
11
|
+
/**
|
|
12
|
+
* Register `uninstall`, `start`, `stop` and `restart` on a component's command group.
|
|
13
|
+
* Commander lists subcommands in registration order, so the caller places this
|
|
14
|
+
* between `install` and `status`.
|
|
15
|
+
*/
|
|
16
|
+
export declare function registerServiceLifecycleVerbs(parent: Command, component: ServiceComponent): void;
|
|
17
|
+
/** Register `logs` on a component's command group (listed after `status`). */
|
|
18
|
+
export declare function registerServiceLogsVerb(parent: Command, component: ServiceComponent): void;
|
|
19
|
+
//# sourceMappingURL=service-verbs.d.ts.map
|
|
@@ -1,23 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The warning `kici-admin context create` and `kici-admin secret set` print
|
|
3
|
-
* when a context's secrets cannot reach any job.
|
|
4
|
-
*
|
|
5
|
-
* A job that lists a context in its `contexts:` receives the context's
|
|
6
|
-
* secrets only through the context's scope bindings: the secret resolver reads
|
|
7
|
-
* the bindings of the context row the job's declared name matched — a fixed
|
|
8
|
-
* context by its exact name, a glob context by its pattern — and returns
|
|
9
|
-
* nothing when there are none. So such a context with no binding delivers no
|
|
10
|
-
* secret to those jobs, whatever its scopes hold, and nothing fails loudly — a
|
|
11
|
-
* workflow's `ctx.secrets.get()` throws at run time instead. A
|
|
12
|
-
* `<context>:<key>` git-credential or registry reference to a fixed context
|
|
13
|
-
* still reads the scope named after it, through a deprecated fallback; a glob
|
|
14
|
-
* context has no such fallback. The warning names the context, that fallback
|
|
15
|
-
* where it applies, and the `context bind` command that fixes it.
|
|
16
|
-
*
|
|
17
|
-
* Advisory only: the lookup runs after the command's own write succeeded, and
|
|
18
|
-
* a failed lookup prints nothing, so the command's exit code never changes.
|
|
19
|
-
*/
|
|
20
|
-
import { ContextType } from '@kici-dev/engine';
|
|
21
1
|
/** The one admin API call the lookup needs, so any client shape satisfies it. */
|
|
22
2
|
export interface ContextLookupClient {
|
|
23
3
|
get<T>(path: string): Promise<T>;
|
|
@@ -32,8 +12,8 @@ export interface WarnIfContextUnboundArgs {
|
|
|
32
12
|
/** Where the warning goes; stderr by default. */
|
|
33
13
|
warn?: (line: string) => void;
|
|
34
14
|
}
|
|
35
|
-
/** The warning line for a context
|
|
36
|
-
export declare function unboundContextWarning(orgId: string, name: string
|
|
15
|
+
/** The warning line for a context with no binding. */
|
|
16
|
+
export declare function unboundContextWarning(orgId: string, name: string): string;
|
|
37
17
|
/**
|
|
38
18
|
* Print the unbound-context warning when `name` is a context a job can resolve
|
|
39
19
|
* through (a fixed or glob context, `ContextType`) that has no binding. A
|