@kici-dev/orchestrator 0.11.0 → 0.13.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-query.d.ts +4 -5
- package/dist/agent/agent-version.d.ts +5 -5
- package/dist/agent/dispatcher.d.ts +48 -0
- package/dist/agent/registry.d.ts +38 -9
- package/dist/agent-packaging/node-runtime-members.d.ts +14 -0
- package/dist/app.d.ts +9 -3
- package/dist/approvals/apply-decision.d.ts +1 -1
- package/dist/audit/access-log.d.ts +2 -3
- package/dist/cache/cache-upload-settle.d.ts +75 -0
- package/dist/cache/pending-inits.d.ts +9 -0
- package/dist/cancel/cancel-run.d.ts +22 -4
- package/dist/cancel/peer-job-cancel.d.ts +50 -0
- package/dist/cancel/sweep-stuck-cancelling.d.ts +3 -1
- package/dist/cli/commands/access-log.d.ts +3 -3
- package/dist/cli/commands/agent-service/agent-env.d.ts +20 -0
- package/dist/cli/commands/agent-service/status.d.ts +3 -3
- package/dist/cli/commands/attestations.d.ts +1 -1
- package/dist/cli/commands/context.d.ts +2 -2
- package/dist/cli/commands/event-dlq.d.ts +5 -6
- package/dist/cli/commands/event-log.d.ts +2 -3
- package/dist/cli/commands/execution.d.ts +1 -3
- package/dist/cli/commands/local-hook.d.ts +3 -2
- package/dist/cli/commands/local-trigger.d.ts +7 -0
- package/dist/cli/commands/orchestrator-service/status.d.ts +10 -3
- package/dist/cli/commands/queue.d.ts +1 -2
- package/dist/cli/commands/runs.d.ts +2 -3
- package/dist/cli/commands/service-health.d.ts +68 -0
- package/dist/cli/commands/shared/env-file-mode.d.ts +3 -2
- package/dist/cli/commands/shared/upgrade-safety.d.ts +11 -5
- package/dist/cli/commands/shared/versioned-upgrade.d.ts +119 -7
- package/dist/cli/commands/workflow.d.ts +3 -4
- package/dist/cli/open-browser.d.ts +1 -1
- package/dist/cli/service/entrypoint.d.ts +18 -0
- package/dist/cli/service/image-digests.d.ts +10 -0
- package/dist/cli/service/index.d.ts +4 -2
- package/dist/cli/service/instance/manifest.d.ts +39 -0
- package/dist/cli/service/launchd.d.ts +45 -10
- package/dist/cli/service/shutdown-grace.d.ts +35 -0
- package/dist/cli/service/types.d.ts +9 -0
- package/dist/cli/service/windows-acl.d.ts +40 -0
- package/dist/cli/service/windows-env-file.d.ts +45 -0
- package/dist/cli/service/windows.d.ts +13 -0
- package/dist/cli.js +2601 -1232
- package/dist/cluster/cluster-identity.d.ts +4 -4
- package/dist/cluster/coordinator-credential.d.ts +45 -0
- package/dist/cluster/coordinator.d.ts +18 -2
- package/dist/cluster/index.d.ts +1 -0
- package/dist/cluster/instance-heartbeat.d.ts +6 -1
- package/dist/cluster/join-token.d.ts +4 -2
- package/dist/cluster/leader-gated-scheduler.d.ts +7 -1
- package/dist/cluster/peer-auth-coordinator.d.ts +13 -0
- package/dist/cluster/peer-client.d.ts +4 -0
- package/dist/cluster/peer-credentials.d.ts +32 -1
- package/dist/cluster/raft-state.d.ts +6 -0
- package/dist/cluster/raft.d.ts +16 -2
- package/dist/cold-store/load-access-log-range.d.ts +3 -3
- package/dist/cold-store/load-event-log-range.d.ts +1 -1
- package/dist/cold-store/load-secret-audit-log-range.d.ts +2 -2
- package/dist/cold-store/orchestrator-cold-store.d.ts +9 -11
- package/dist/cold-store/tables/access-log.d.ts +2 -2
- package/dist/cold-store/tables/event-log.d.ts +4 -10
- package/dist/cold-store/tables/execution-jobs.d.ts +1 -1
- package/dist/cold-store/tables/execution-runs.d.ts +4 -4
- package/dist/cold-store/tables/execution-steps.d.ts +1 -1
- package/dist/cold-store/tables/secret-audit-log.d.ts +3 -3
- package/dist/config.d.ts +6 -1
- package/dist/contexts/held-runs.d.ts +2 -2
- package/dist/dashboard/attestation-filters.d.ts +1 -1
- package/dist/dashboard/handler.d.ts +8 -8
- package/dist/db/deferred-indexes.d.ts +2 -2
- package/dist/db/migrations/005_cold_store_chunk_counter.d.ts +2 -4
- package/dist/db/migrations/006_runs_jobs_steps_archived_at.d.ts +4 -4
- package/dist/db/migrations/007_audit_logs_archived_at.d.ts +6 -9
- package/dist/db/migrations/008_event_log_archived_at.d.ts +4 -6
- package/dist/db/migrations/010_cold_store_chunks.d.ts +2 -2
- package/dist/db/migrations/012_peer_credentials_active_uniq.d.ts +2 -4
- package/dist/db/migrations/016_org_settings_allow_http_npm.d.ts +2 -2
- package/dist/db/migrations/045_host_properties.d.ts +1 -1
- package/dist/db/migrations/046_join_token_consumed_by_instance.d.ts +1 -1
- package/dist/db/migrations/048_host_reboot_pending.d.ts +1 -1
- package/dist/db/migrations/049_held_runs_payload.d.ts +1 -1
- package/dist/db/migrations/050_sources_slug.d.ts +1 -1
- package/dist/db/migrations/051_binding_host_pattern.d.ts +1 -1
- package/dist/db/migrations/052_host_reach_metadata.d.ts +1 -1
- package/dist/db/migrations/053_agent_token_single_use.d.ts +1 -1
- package/dist/db/migrations/054_local_working_tree.d.ts +1 -1
- package/dist/db/migrations/055_agent_token_mandatory_labels.d.ts +1 -1
- package/dist/db/migrations/056_execution_jobs_environments.d.ts +1 -1
- package/dist/db/migrations/064_execution_jobs_skipped_environments.d.ts +1 -1
- package/dist/db/migrations/152_org_settings_cache_upload_settle_timeout.d.ts +15 -0
- package/dist/db/migrations/153_execution_runs_cancel_force.d.ts +16 -0
- package/dist/db/types.d.ts +27 -13
- package/dist/events/types.d.ts +1 -1
- package/dist/fault-injection-types.d.ts +2 -2
- package/dist/firecracker/host-network.d.ts +21 -3
- package/dist/firecracker/net-interfaces.d.ts +1 -1
- package/dist/helpers/run-detached.d.ts +12 -0
- package/dist/index.js +242 -67
- package/dist/oidc/db-signer.d.ts +1 -1
- package/dist/pipeline/changed-files.d.ts +51 -0
- package/dist/pipeline/cross-source-tally.d.ts +21 -0
- package/dist/pipeline/degraded-reason.d.ts +8 -0
- package/dist/pipeline/dispatch-matched-workflow.d.ts +10 -0
- package/dist/pipeline/global-eval-round.d.ts +5 -4
- package/dist/pipeline/processor.d.ts +11 -3
- package/dist/pipeline/rerun-inputs.d.ts +16 -7
- package/dist/provenance/retrier-mint.d.ts +1 -1
- package/dist/provenance/trust-root.d.ts +3 -3
- package/dist/providers/github/changed-files.d.ts +14 -4
- package/dist/providers/universal-git/changed-files.d.ts +6 -0
- package/dist/providers/universal-git/clone-token.d.ts +9 -13
- package/dist/providers/universal-git/config.d.ts +4 -0
- package/dist/providers/universal-git/index.d.ts +1 -2
- package/dist/providers/universal-git/normalizer.d.ts +2 -3
- package/dist/providers/universal-git/ssh-auth.d.ts +4 -4
- package/dist/queue/cleanup.d.ts +2 -2
- package/dist/queue/job-queue.d.ts +6 -6
- package/dist/queue/scheduled-job.d.ts +5 -7
- package/dist/registration/extractor.d.ts +1 -1
- package/dist/registration/registration-index.d.ts +1 -1
- package/dist/reporting/execution-tracker.d.ts +3 -3
- package/dist/routes/admin-access-log.d.ts +1 -1
- package/dist/routes/admin-auth.d.ts +2 -2
- package/dist/routes/admin-event-log.d.ts +2 -2
- package/dist/routes/admin-runs.d.ts +3 -3
- package/dist/routes/admin-scheduled-jobs.d.ts +2 -3
- package/dist/routes/health.d.ts +9 -0
- package/dist/scaler/container-backend.d.ts +3 -1
- package/dist/scaler/container-runtime.d.ts +9 -0
- package/dist/scaler/firecracker-backend.d.ts +15 -10
- package/dist/scaler/firecracker-extra-hosts.d.ts +20 -0
- package/dist/scaler/machine-ledger.d.ts +3 -4
- package/dist/scaler/manager.d.ts +26 -2
- package/dist/scaler/scaler-state-store.d.ts +1 -1
- package/dist/scaler/types.d.ts +4 -1
- package/dist/secrets/audit-logger.d.ts +2 -2
- package/dist/security/reduced-privilege-note.d.ts +2 -3
- package/dist/security/trust-policy-store.d.ts +3 -3
- package/dist/server.d.ts +2 -1
- package/dist/server.js +4955 -3206
- package/dist/stale-detector/stale-run-detector.d.ts +1 -1
- package/dist/stale-detector/workflow-deadline-detector.d.ts +7 -1
- package/dist/standalone.d.ts +1 -1
- package/dist/standalone.js +12944 -11243
- package/dist/storage/filesystem.d.ts +1 -1
- package/dist/storage/index.d.ts +1 -1
- package/dist/storage/s3.d.ts +36 -0
- package/dist/storage/sign-url.d.ts +2 -1
- package/dist/storage/types.d.ts +2 -2
- package/dist/ws/agent-handler.d.ts +58 -6
- package/dist/ws/agent-heartbeat.d.ts +4 -5
- package/dist/ws/dashboard-context-handler.d.ts +1 -1
- package/dist/ws/platform-client.d.ts +44 -32
- package/dist/ws/server-options.d.ts +1 -1
- package/dist/ws/test-relay-handlers.d.ts +1 -1
- package/installer-image-digests.json +3 -3
- package/package.json +5 -5
- package/sbom.spdx.json +53 -53
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* `kici-admin orchestrator status` command.
|
|
3
3
|
*
|
|
4
|
-
* Shows OS-level service status (state, PID, uptime) and queries
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* Shows OS-level service status (state, PID, uptime) and queries the
|
|
5
|
+
* running orchestrator's `/health` and `/ready` endpoints for its version,
|
|
6
|
+
* build fingerprint, uptime and readiness (database reachable, boot finished).
|
|
7
7
|
*
|
|
8
8
|
* Target resolution goes through resolveInstanceTarget — the same priority chain
|
|
9
9
|
* every lifecycle command uses (--instance-dir > --name > CWD manifest >
|
|
@@ -11,6 +11,13 @@
|
|
|
11
11
|
*/
|
|
12
12
|
import type { Command } from 'commander';
|
|
13
13
|
import { type ServicePlatform } from '../../service/index.js';
|
|
14
|
+
/**
|
|
15
|
+
* How long to wait for `/ready`. Its database check waits up to the pool's
|
|
16
|
+
* acquire timeout before it reports `database: false`, so the wait covers that
|
|
17
|
+
* timeout plus a margin. An acquire timeout of 0 lets the pool wait without
|
|
18
|
+
* limit; the default then bounds the wait.
|
|
19
|
+
*/
|
|
20
|
+
export declare function readinessTimeoutMs(envContent: string): number;
|
|
14
21
|
/**
|
|
15
22
|
* The config files this install owns, for an operator who wants to inspect
|
|
16
23
|
* them. Derived from the instance manifest and the env file on disk, not from
|
|
@@ -7,8 +7,7 @@
|
|
|
7
7
|
* READ-ONLY — mutations live in `maintenance.ts` (queue clear) instead.
|
|
8
8
|
* Dual-mode: HTTP (via AdminApiClient) or `--database-url` (direct DB).
|
|
9
9
|
*
|
|
10
|
-
*
|
|
11
|
-
* sites were actually querying dispatch_queue, not a dedup cache.
|
|
10
|
+
* The rows come from dispatch_queue, not a dedup cache.
|
|
12
11
|
*/
|
|
13
12
|
import type { Command } from 'commander';
|
|
14
13
|
import type { AdminApiClient } from '../api-client.js';
|
|
@@ -2,9 +2,8 @@
|
|
|
2
2
|
* Execution run commands for kici-admin.
|
|
3
3
|
*
|
|
4
4
|
* Provides operator-facing read access to execution runs and their
|
|
5
|
-
* sub-resources via the orchestrator's admin HTTP API.
|
|
6
|
-
*
|
|
7
|
-
* run state.
|
|
5
|
+
* sub-resources via the orchestrator's admin HTTP API. Use it instead of
|
|
6
|
+
* hand-rolled curl commands when inspecting run state.
|
|
8
7
|
*
|
|
9
8
|
* runs list List execution runs (table or JSON)
|
|
10
9
|
* runs show <runId> Show run detail with jobs and steps
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reads a locally installed KiCI service's health endpoints and formats what
|
|
3
|
+
* they report. `kici-admin orchestrator status` and `kici-admin agent status`
|
|
4
|
+
* both render through here, so the two sections agree on layout and on how a
|
|
5
|
+
* missing field is handled.
|
|
6
|
+
*/
|
|
7
|
+
import { type BuildFingerprint, type LivenessBase } from '@kici-dev/shared';
|
|
8
|
+
/** A label and its value: one line of a status section. */
|
|
9
|
+
export type StatusRow = readonly [label: string, value: string];
|
|
10
|
+
/**
|
|
11
|
+
* Read the env file, or empty content when it is missing or unreadable. A file
|
|
12
|
+
* this account may not read is reported: the port and address the caller then
|
|
13
|
+
* falls back to may not be the ones the service uses. On Windows only
|
|
14
|
+
* LocalSystem and Administrators can read a service's env file.
|
|
15
|
+
*/
|
|
16
|
+
export declare function readEnvContent(envFilePath: string, warn?: (line: string) => void): string;
|
|
17
|
+
/** Where a service installed on this host answers HTTP. */
|
|
18
|
+
export interface LocalEndpoint {
|
|
19
|
+
host: string;
|
|
20
|
+
port: number;
|
|
21
|
+
/** The prefix the service's routes are mounted under; empty when they sit at `/`. */
|
|
22
|
+
pathPrefix: string;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Where the service answers, read from its env file: `KICI_PORT` (or
|
|
26
|
+
* `defaultPort`), `KICI_HOST` and `KICI_BASE_PATH`. A service bound to every
|
|
27
|
+
* interface is reached on `localhost`; one bound to a single address is reached
|
|
28
|
+
* there. The agent reads none of the last two, so its env file never sets them.
|
|
29
|
+
*/
|
|
30
|
+
export declare function readLocalEndpoint(envContent: string, defaultPort: number): LocalEndpoint;
|
|
31
|
+
/** The URL of `pathname` on `endpoint`, with an IPv6 host bracketed. */
|
|
32
|
+
export declare function localUrl(endpoint: LocalEndpoint, pathname: string): string;
|
|
33
|
+
/**
|
|
34
|
+
* GET a JSON body from a service on this host. `acceptStatuses` names the
|
|
35
|
+
* non-2xx codes whose body is still an answer: `/ready` returns its checks
|
|
36
|
+
* with a 503 when one fails. Returns null when nothing answers in time.
|
|
37
|
+
*/
|
|
38
|
+
export declare function fetchLocalJson<T>(endpoint: LocalEndpoint, pathname: string, opts?: {
|
|
39
|
+
acceptStatuses?: readonly number[];
|
|
40
|
+
timeoutMs?: number;
|
|
41
|
+
}): 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
|
+
/**
|
|
54
|
+
* Rows for the build fingerprint and process uptime of a `/health` body. A
|
|
55
|
+
* field the body lacks is skipped, so a service older than this CLI renders
|
|
56
|
+
* the fields it does report. The version line never shows `buildCommit`
|
|
57
|
+
* (see {@link hideBuildCommit}).
|
|
58
|
+
*/
|
|
59
|
+
export declare function buildInfoRows(health: Partial<LivenessBase & BuildFingerprint & {
|
|
60
|
+
buildDate: string;
|
|
61
|
+
}>): StatusRow[];
|
|
62
|
+
/**
|
|
63
|
+
* A status section: a blank separator line, the heading, then one line per
|
|
64
|
+
* row with each value starting at `valueColumn`. A body with no field this CLI
|
|
65
|
+
* recognises still gets a line saying so, so the heading never stands alone.
|
|
66
|
+
*/
|
|
67
|
+
export declare function formatHealthSection(heading: string, rows: readonly StatusRow[], valueColumn: number): string[];
|
|
68
|
+
//# sourceMappingURL=service-health.d.ts.map
|
|
@@ -9,8 +9,9 @@
|
|
|
9
9
|
* `cluster/peer-credentials.ts`.
|
|
10
10
|
*
|
|
11
11
|
* The guarantee is POSIX-only. Node maps a mode onto Windows by toggling the
|
|
12
|
-
* read-only attribute and changes no ACL, so a Windows install
|
|
13
|
-
* the file
|
|
12
|
+
* read-only attribute and changes no ACL, so a Windows install restricts the
|
|
13
|
+
* folder that holds the file instead (`restrictEnvFileAccess`,
|
|
14
|
+
* `cli/service/windows-acl.ts`).
|
|
14
15
|
*/
|
|
15
16
|
export declare const ENV_FILE_MODE = 384;
|
|
16
17
|
//# sourceMappingURL=env-file-mode.d.ts.map
|
|
@@ -19,6 +19,11 @@ export declare function waitForQuiesce(poll: () => Promise<DrainSnapshot>, opts:
|
|
|
19
19
|
quiesced: boolean;
|
|
20
20
|
jobsRunning: number;
|
|
21
21
|
}>;
|
|
22
|
+
/**
|
|
23
|
+
* What a version switch prints when it cannot read the live migration ledger,
|
|
24
|
+
* so it could not compare the schema to the recorded head.
|
|
25
|
+
*/
|
|
26
|
+
export declare const SCHEMA_NOT_CHECKED = "The running service could not be reached, so the schema was not checked.";
|
|
22
27
|
/** One entry of `GET /api/v1/admin/db/migrate/status`. */
|
|
23
28
|
export interface MigrationStatusRow {
|
|
24
29
|
name: string;
|
|
@@ -47,11 +52,12 @@ export type SchemaGuardVerdict = {
|
|
|
47
52
|
* Decide whether the version pointer may move.
|
|
48
53
|
*
|
|
49
54
|
* Three outcomes, and the middle one is the compatibility shim: an instance
|
|
50
|
-
* installed before `migrationHeads` existed
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
+
* installed before `migrationHeads` existed, or one whose upgrade away from the
|
|
56
|
+
* target ran without admin access, has no recorded head, and refusing there
|
|
57
|
+
* would break the documented `--rollback` on exactly those installs. So an
|
|
58
|
+
* unknown head warns loudly and falls through to the existing confirmation
|
|
59
|
+
* prompt; the map is populated at the next version change with admin access,
|
|
60
|
+
* arming the guard one upgrade later.
|
|
55
61
|
*/
|
|
56
62
|
export declare function schemaGuardVerdict(input: {
|
|
57
63
|
targetVersion: string;
|
|
@@ -11,9 +11,9 @@ import { type NpmInstallTarget, type ResolvedInstance, type ServiceManager, type
|
|
|
11
11
|
import type { LaunchSpec, ServiceConfig } from '../../service/types.js';
|
|
12
12
|
import { type MigrationStatusRow } from './upgrade-safety.js';
|
|
13
13
|
/** Component types that can be upgraded. */
|
|
14
|
-
type UpgradeComponent = 'orchestrator' | 'agent';
|
|
14
|
+
export type UpgradeComponent = 'orchestrator' | 'agent';
|
|
15
15
|
/** Options for the versioned upgrade command. */
|
|
16
|
-
interface VersionedUpgradeOptions {
|
|
16
|
+
export interface VersionedUpgradeOptions {
|
|
17
17
|
platform?: ServicePlatform;
|
|
18
18
|
/**
|
|
19
19
|
* Service name. No default — targeting flows through {@link resolveInstanceTarget}
|
|
@@ -130,8 +130,8 @@ export declare function resolveUpgradeTarget(args: {
|
|
|
130
130
|
* Install base for a KiCI component instance.
|
|
131
131
|
*
|
|
132
132
|
* Name-scoped so that two instances of the same component (e.g. an org's
|
|
133
|
-
*
|
|
134
|
-
* versioned trees and symlinks. Per-platform bases:
|
|
133
|
+
* production orchestrator and a test orchestrator on the same host) own
|
|
134
|
+
* independent versioned trees and symlinks. Per-platform bases:
|
|
135
135
|
* - systemd / compose: /opt/kici/<name>/
|
|
136
136
|
* - launchd: /usr/local/kici/<name>/
|
|
137
137
|
* - windows: C:\Program Files\KiCI\<name>\
|
|
@@ -171,6 +171,55 @@ export declare function checkPickFlagConflicts(opts: {
|
|
|
171
171
|
rollback?: boolean;
|
|
172
172
|
cleanup?: boolean;
|
|
173
173
|
}): string | null;
|
|
174
|
+
/**
|
|
175
|
+
* Stop the service, register it again on Windows, then start it: the restart
|
|
176
|
+
* every npm-source upgrade ends with.
|
|
177
|
+
*
|
|
178
|
+
* `npm install -g` replaces the package in place, so the launch command the
|
|
179
|
+
* service runs (`spec`, read back from its registration) stays valid. On
|
|
180
|
+
* Windows the registration around that command (the service wrapper's
|
|
181
|
+
* arguments, the description, the recovery settings) is whatever the CLI that
|
|
182
|
+
* installed it wrote, so `install` writes the current one, as the archive
|
|
183
|
+
* upgrade does. A launch command that names a file that does not exist was
|
|
184
|
+
* read back wrong, so it is not registered: the service restarts as it was,
|
|
185
|
+
* with a warning. systemd and launchd keep their unit as it is.
|
|
186
|
+
*/
|
|
187
|
+
export declare function restartOntoInstalledPackage(args: {
|
|
188
|
+
manager: ServiceManager;
|
|
189
|
+
config: ServiceConfig;
|
|
190
|
+
platform: ServicePlatform;
|
|
191
|
+
spec: LaunchSpec | null;
|
|
192
|
+
}): Promise<void>;
|
|
193
|
+
/**
|
|
194
|
+
* Extract a release archive into `tmpDir` and return the release folder in it.
|
|
195
|
+
* On Windows a release from before KICI_ENV_FILE is refused here, before
|
|
196
|
+
* anything is copied into the install base or the service is stopped.
|
|
197
|
+
*/
|
|
198
|
+
export declare function extractRelease(args: {
|
|
199
|
+
archivePath: string;
|
|
200
|
+
tmpDir: string;
|
|
201
|
+
component: UpgradeComponent;
|
|
202
|
+
platform: ServicePlatform;
|
|
203
|
+
version: string;
|
|
204
|
+
config: ServiceConfig;
|
|
205
|
+
}): string;
|
|
206
|
+
/**
|
|
207
|
+
* Put the release in `archivePath` at `versionedDirPath`. The release is
|
|
208
|
+
* extracted and checked first ({@link extractRelease}); only then is a folder
|
|
209
|
+
* already at `versionedDirPath` removed, which the caller allows with
|
|
210
|
+
* `--force`, and the release copied in. A refused release leaves the install
|
|
211
|
+
* base as it was.
|
|
212
|
+
*/
|
|
213
|
+
export declare function installRelease(args: {
|
|
214
|
+
archivePath: string;
|
|
215
|
+
tmpDir: string;
|
|
216
|
+
installBase: string;
|
|
217
|
+
versionedDirPath: string;
|
|
218
|
+
component: UpgradeComponent;
|
|
219
|
+
platform: ServicePlatform;
|
|
220
|
+
version: string;
|
|
221
|
+
config: ServiceConfig;
|
|
222
|
+
}): void;
|
|
174
223
|
/**
|
|
175
224
|
* Perform a versioned directory upgrade for a KiCI component.
|
|
176
225
|
*
|
|
@@ -252,13 +301,36 @@ export declare function planNpmSourceUpgrade(opts: {
|
|
|
252
301
|
force: boolean;
|
|
253
302
|
windows: boolean;
|
|
254
303
|
}): NpmSourceUpgradeAction;
|
|
255
|
-
/** Injected process runner seam for
|
|
256
|
-
type SpawnRunner = (cmd: string, args: string[], opts?: {
|
|
304
|
+
/** Injected process runner seam for the npm calls of an npm-source upgrade. */
|
|
305
|
+
export type SpawnRunner = (cmd: string, args: string[], opts?: {
|
|
257
306
|
env?: NodeJS.ProcessEnv;
|
|
258
307
|
}) => {
|
|
259
308
|
status: number | null;
|
|
309
|
+
stdout: string;
|
|
260
310
|
stderr: string;
|
|
261
311
|
};
|
|
312
|
+
/**
|
|
313
|
+
* The cmd.exe command line for npm on Windows. npm is a batch file there, which
|
|
314
|
+
* Node.js starts only through a shell, and Node.js joins the parts of a shell
|
|
315
|
+
* command with spaces and quotes none of them. The standard Node.js install is
|
|
316
|
+
* under `C:\Program Files`, so the npm path is quoted here. An argument with a
|
|
317
|
+
* character outside those of a package name, a version or a flag is refused
|
|
318
|
+
* rather than handed to cmd.exe.
|
|
319
|
+
*/
|
|
320
|
+
export declare function windowsShellCommand(cmd: string, args: string[]): string;
|
|
321
|
+
/**
|
|
322
|
+
* Whether `version` of the KiCI packages reads KICI_ENV_FILE, asked of the
|
|
323
|
+
* registry the unit's npm installs from. A release that reads it publishes the
|
|
324
|
+
* env-file loader in `@kici-dev/shared`, which every KiCI package of the same
|
|
325
|
+
* version depends on.
|
|
326
|
+
*/
|
|
327
|
+
export declare function npmReleaseReadsEnvFile(target: NpmInstallTarget, version: string, run?: SpawnRunner): {
|
|
328
|
+
ok: true;
|
|
329
|
+
reads: boolean;
|
|
330
|
+
} | {
|
|
331
|
+
ok: false;
|
|
332
|
+
error: string;
|
|
333
|
+
};
|
|
262
334
|
/**
|
|
263
335
|
* Install `<owningPackage>@<version>` globally under the unit's own pinned node,
|
|
264
336
|
* so it lands in exactly the global prefix the unit's ExecStart resolves from.
|
|
@@ -278,6 +350,47 @@ export declare function installGlobalPackage(target: NpmInstallTarget, version:
|
|
|
278
350
|
stderr: string;
|
|
279
351
|
};
|
|
280
352
|
export declare function performVersionedUpgrade(component: UpgradeComponent, opts: VersionedUpgradeOptions, hooks?: UpgradeHooks): Promise<void>;
|
|
353
|
+
/** The inputs of {@link restartOnlyUpgrade}. */
|
|
354
|
+
export interface RestartOnlyArgs {
|
|
355
|
+
component: UpgradeComponent;
|
|
356
|
+
config: ServiceConfig;
|
|
357
|
+
resolvedInstance: ResolvedInstance;
|
|
358
|
+
manager: ServiceManager;
|
|
359
|
+
verdict: NpmSourceLaunchVerdict;
|
|
360
|
+
opts: VersionedUpgradeOptions;
|
|
361
|
+
platform: ServicePlatform;
|
|
362
|
+
/** The launch command read from the registration before the upgrade. */
|
|
363
|
+
spec: LaunchSpec | null;
|
|
364
|
+
}
|
|
365
|
+
/** The inputs of {@link performSelfDrivingInstall}. */
|
|
366
|
+
export interface SelfDriveArgs extends Omit<RestartOnlyArgs, 'verdict'> {
|
|
367
|
+
action: {
|
|
368
|
+
target: NpmInstallTarget;
|
|
369
|
+
version: string;
|
|
370
|
+
};
|
|
371
|
+
/** Runs npm; tests inject it. */
|
|
372
|
+
run?: SpawnRunner;
|
|
373
|
+
}
|
|
374
|
+
/**
|
|
375
|
+
* Restart-only path: the operator pre-installed `@kici-dev/<pkg>@<version>` (or
|
|
376
|
+
* kici-admin) themselves. Verify the unit will launch the invoking CLI's version,
|
|
377
|
+
* restart onto it, and persist the manifest version.
|
|
378
|
+
*/
|
|
379
|
+
export declare function restartOnlyUpgrade(args: RestartOnlyArgs): Promise<void>;
|
|
380
|
+
/**
|
|
381
|
+
* Self-driving path: install the resolved global package under the unit's own
|
|
382
|
+
* pinned node/npm, restart, and verify the unit now launches the requested
|
|
383
|
+
* version.
|
|
384
|
+
*/
|
|
385
|
+
export declare function performSelfDrivingInstall(args: SelfDriveArgs): Promise<void>;
|
|
386
|
+
/**
|
|
387
|
+
* Stop the service, switch the active version pointer to an already-installed
|
|
388
|
+
* versioned directory (atomic symlink on Unix; re-registration + version file
|
|
389
|
+
* on Windows), restart, and persist the new `kiciVersion` into the manifest.
|
|
390
|
+
*
|
|
391
|
+
* Shared by `--rollback` (switch to the previous version) and `--pick` (switch
|
|
392
|
+
* to any chosen installed version).
|
|
393
|
+
*/
|
|
281
394
|
export declare function switchToInstalledVersion(args: {
|
|
282
395
|
component: UpgradeComponent;
|
|
283
396
|
platform: ServicePlatform;
|
|
@@ -293,5 +406,4 @@ export declare function switchToInstalledVersion(args: {
|
|
|
293
406
|
/** Skip the confirmation the unknown-head warning falls through to. */
|
|
294
407
|
yes?: boolean;
|
|
295
408
|
}): Promise<void>;
|
|
296
|
-
export {};
|
|
297
409
|
//# sourceMappingURL=versioned-upgrade.d.ts.map
|
|
@@ -2,10 +2,9 @@
|
|
|
2
2
|
* Workflow registration commands for kici-admin.
|
|
3
3
|
*
|
|
4
4
|
* Provides operator-facing read access to the workflow_registrations table
|
|
5
|
-
* via the orchestrator's admin HTTP API.
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* route.
|
|
5
|
+
* via the orchestrator's admin HTTP API. Use it instead of querying the
|
|
6
|
+
* registration table with psql: every CLI subcommand here goes through
|
|
7
|
+
* AdminApiClient and the existing /api/v1/admin/registrations route.
|
|
9
8
|
*
|
|
10
9
|
* workflow list List registered workflows (table or JSON)
|
|
11
10
|
*
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* blocked launcher) just falls back to copy-paste.
|
|
6
6
|
*
|
|
7
7
|
* `KICI_BROWSER_CMD` overrides the launcher: `none` suppresses it entirely
|
|
8
|
-
* (
|
|
8
|
+
* (automated tests / headless capture), any other value is run with `{url}` substituted —
|
|
9
9
|
* mirroring the `kici login` convention.
|
|
10
10
|
*/
|
|
11
11
|
export declare function openBrowserBestEffort(url: string): void;
|
|
@@ -33,4 +33,22 @@ export declare function resolveServiceExecutable(opts: {
|
|
|
33
33
|
nodePath: string;
|
|
34
34
|
entryScript?: string;
|
|
35
35
|
}): ServiceExecutable;
|
|
36
|
+
/**
|
|
37
|
+
* The path of a server entry script installed beside this CLI, for a service
|
|
38
|
+
* that runs `node <script>`. `resolve` is the calling module's
|
|
39
|
+
* `import.meta.resolve`, or undefined where the CLI has none: a kici-admin from a
|
|
40
|
+
* standalone package is a single CommonJS bundle that carries no orchestrator
|
|
41
|
+
* or agent server. Either way the error names `--binary`, the launcher the
|
|
42
|
+
* service runs instead.
|
|
43
|
+
*/
|
|
44
|
+
export declare function resolveServerScript(specifier: string, component: ServerComponent, resolve: ModuleResolver | undefined): string;
|
|
45
|
+
/**
|
|
46
|
+
* Refuse an install without `--binary` on a kici-admin that cannot resolve
|
|
47
|
+
* installed packages, before the wizard runs or any file is written.
|
|
48
|
+
*/
|
|
49
|
+
export declare function assertServerResolvable(component: ServerComponent, binary: string | undefined, resolve: ModuleResolver | undefined): void;
|
|
50
|
+
type ServerComponent = 'orchestrator' | 'agent';
|
|
51
|
+
/** A module's `import.meta.resolve`. */
|
|
52
|
+
export type ModuleResolver = (specifier: string) => string;
|
|
53
|
+
export {};
|
|
36
54
|
//# sourceMappingURL=entrypoint.d.ts.map
|
|
@@ -11,6 +11,16 @@
|
|
|
11
11
|
* layouts: the source tree (`src/cli/service/` → the JSON is three dirs up at
|
|
12
12
|
* the package root) and the single-file bundle (`dist/cli.js` → one dir up).
|
|
13
13
|
*/
|
|
14
|
+
import type { Component } from './instance/types.js';
|
|
15
|
+
/** The published image a component runs, whatever the service is named. */
|
|
16
|
+
export declare function installerImageName(component: Component): string;
|
|
17
|
+
/**
|
|
18
|
+
* The release {@link resolveImageRef} pins `name` at, or null when it falls
|
|
19
|
+
* back to the moving `:latest` tag.
|
|
20
|
+
*/
|
|
21
|
+
export declare function pinnedImageVersion(name: string, opts?: {
|
|
22
|
+
filePath?: string;
|
|
23
|
+
}): string | null;
|
|
14
24
|
/**
|
|
15
25
|
* Resolve `quay.io/kici-dev/<name>:<version>@sha256:<digest>` for an installer
|
|
16
26
|
* image. Falls back to `:latest` (with a warning) when no recorded digest exists.
|
|
@@ -7,12 +7,14 @@
|
|
|
7
7
|
* platform-specific code on every platform.
|
|
8
8
|
*/
|
|
9
9
|
export type { ServiceManager, ServiceConfig, LaunchSpec, ServiceStatus, ServiceState, ServicePlatform, RestartPolicy, LogOptions, } from './types.js';
|
|
10
|
-
export { DEFAULT_RESTART_POLICY } from './types.js';
|
|
10
|
+
export { DEFAULT_RESTART_POLICY, SERVICE_TEXT } from './types.js';
|
|
11
11
|
export { detectPlatform, isRoot, kiciConfigRoot, getConfigDir, getLogDir, getCacheDir, } from './platform-detect.js';
|
|
12
12
|
export { resolveUserLevel, type PrivilegeOpts } from './privilege.js';
|
|
13
|
+
export { restrictEnvFileAccess } from './windows-acl.js';
|
|
14
|
+
export { ENV_FILE_LOADER_EXPORT, envFileRefusal, launchReadsEnvFile, launchedRelease, } from './windows-env-file.js';
|
|
13
15
|
export type { Component, InstanceManifest, IndexEntry, ResolveOptions, ResolvedInstance, } from './instance/types.js';
|
|
14
16
|
export { COMPONENTS, isComponent } from './instance/types.js';
|
|
15
|
-
export { manifestFilename, manifestPath, readManifest, writeManifest, readKiciVersion, resolveVersionFromLaunchSpec, resolveNpmInstallTarget, type NpmInstallTarget, } from './instance/manifest.js';
|
|
17
|
+
export { manifestFilename, manifestPath, readManifest, writeManifest, readKiciVersion, resolveVersionFromLaunchSpec, resolveLauncherVersion, writeInstallManifest, type InstallManifestWrite, resolveNpmInstallTarget, type NpmInstallTarget, } from './instance/manifest.js';
|
|
16
18
|
export { indexPath, readIndex, writeIndex, appendIndexEntry, removeIndexEntry, } from './instance/index-file.js';
|
|
17
19
|
export { candidatePlatforms, listInstances, resolveInstance, resolveInstanceTarget, formatRefusal, InstanceNotFoundError, } from './instance/resolve.js';
|
|
18
20
|
export type { ListedInstance, ResolveArgs, ListInstancesArgs, ResolveTargetArgs, ResolvedTarget, } from './instance/resolve.js';
|
|
@@ -39,6 +39,45 @@ export declare function readKiciVersion(): string;
|
|
|
39
39
|
* stand behind.
|
|
40
40
|
*/
|
|
41
41
|
export declare function resolveVersionFromLaunchSpec(spec: LaunchSpec, component: Component): string | null;
|
|
42
|
+
/**
|
|
43
|
+
* The version of the launcher a service definition starts, or null when the
|
|
44
|
+
* launch command does not show one.
|
|
45
|
+
*
|
|
46
|
+
* An npm-installed entry script names its version in its package.json
|
|
47
|
+
* ({@link resolveVersionFromLaunchSpec}). A launcher under the instance's
|
|
48
|
+
* install base resolves into the `<component>-<version>` folder an archive
|
|
49
|
+
* upgrade extracted: through the `<component>` symlink on Linux and macOS, or
|
|
50
|
+
* directly where Windows registers it. A `--binary` anywhere else shows none.
|
|
51
|
+
*/
|
|
52
|
+
export declare function resolveLauncherVersion(spec: LaunchSpec, component: Component, installBase: string): string | null;
|
|
53
|
+
/** What {@link writeInstallManifest} wrote. */
|
|
54
|
+
export interface InstallManifestWrite {
|
|
55
|
+
file: string;
|
|
56
|
+
manifest: InstanceManifest;
|
|
57
|
+
/** Set when the folder held a manifest the install replaced instead of updating. */
|
|
58
|
+
warning?: string;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Write the manifest `install` built into `instanceDir`.
|
|
62
|
+
*
|
|
63
|
+
* A first install writes `fresh` as it is. A re-install of the same instance
|
|
64
|
+
* (the folder holds a readable manifest of this component and name) updates
|
|
65
|
+
* that manifest: it keeps what the instance recorded over time — `createdAt`,
|
|
66
|
+
* the `migrationHeads` the rollback schema guard reads, and any field a newer
|
|
67
|
+
* CLI wrote — and takes every other field from `fresh`. Its `kiciVersion` is
|
|
68
|
+
* the version of the launcher `launch` starts; when the launcher shows none,
|
|
69
|
+
* the recorded version stands, because the CLI that ran `install` need not
|
|
70
|
+
* be the version the service runs. A compose service runs the image its
|
|
71
|
+
* compose file pins, whatever `launch` names, so a compose re-install records
|
|
72
|
+
* the release of that image (`opts.digestRecordPath` overrides the digest
|
|
73
|
+
* record it reads, for tests).
|
|
74
|
+
*
|
|
75
|
+
* A manifest that cannot be read, or that names another instance, is
|
|
76
|
+
* replaced, and the result carries a warning.
|
|
77
|
+
*/
|
|
78
|
+
export declare function writeInstallManifest(instanceDir: string, fresh: InstanceManifest, launch: LaunchSpec, opts?: {
|
|
79
|
+
digestRecordPath?: string;
|
|
80
|
+
}): InstallManifestWrite;
|
|
42
81
|
/**
|
|
43
82
|
* The global npm package + node runtime an npm-source upgrade must install
|
|
44
83
|
* into, derived from a unit's launch spec. `owningPackage` is the top-level
|
|
@@ -18,8 +18,24 @@ export declare class LaunchdServiceManager implements ServiceManager {
|
|
|
18
18
|
private label;
|
|
19
19
|
/** Resolve the log directory based on service level. */
|
|
20
20
|
private logDir;
|
|
21
|
-
/**
|
|
22
|
-
private
|
|
21
|
+
/** The directory launchd loads this service level's plists from. */
|
|
22
|
+
private plistDir;
|
|
23
|
+
/** The job `install` writes: `dev.kici.<name>`. */
|
|
24
|
+
private installJob;
|
|
25
|
+
/**
|
|
26
|
+
* An installed job for this name under another label: a `com.kici.<name>`
|
|
27
|
+
* plist, or a plist named after the service itself — each one `list()`
|
|
28
|
+
* reports as this instance. Only a plist that carries the KiCI component
|
|
29
|
+
* marker counts, and the job is addressed by the Label the plist declares.
|
|
30
|
+
*/
|
|
31
|
+
private otherLabelJob;
|
|
32
|
+
/**
|
|
33
|
+
* The job a lifecycle command acts on: the `dev.kici.<name>` plist when it
|
|
34
|
+
* is installed, otherwise a job this name was installed under with another
|
|
35
|
+
* label, so every instance `list()` reports can be stopped, started and
|
|
36
|
+
* removed. With neither installed, the `dev.kici.<name>` job.
|
|
37
|
+
*/
|
|
38
|
+
private resolveJob;
|
|
23
39
|
/** Parse a .env file into key-value pairs. */
|
|
24
40
|
private parseEnvFile;
|
|
25
41
|
/** Escape XML special characters. */
|
|
@@ -41,20 +57,29 @@ export declare class LaunchdServiceManager implements ServiceManager {
|
|
|
41
57
|
* domain from the plist's filesystem location, but they fail silently on
|
|
42
58
|
* headless macOS hosts where no GUI session exists (the `gui/<uid>` domain
|
|
43
59
|
* is not available without a console login). The modern `bootstrap` /
|
|
44
|
-
* `bootout` / `kickstart` / `
|
|
60
|
+
* `bootout` / `kickstart` / `print` verbs take the domain explicitly, so a
|
|
45
61
|
* system-level LaunchDaemon loads regardless of whether anyone is logged
|
|
46
62
|
* in at the console — exactly what we need for headless deploy targets.
|
|
47
63
|
*/
|
|
48
64
|
private domain;
|
|
49
|
-
/** `<domain>/<label>` — the target string for kickstart/
|
|
65
|
+
/** `<domain>/<label>` — the target string for bootout/kickstart/print. */
|
|
50
66
|
private domainTarget;
|
|
51
|
-
/**
|
|
67
|
+
/**
|
|
68
|
+
* `launchctl print <domain>/<label>`: the job's description while it is
|
|
69
|
+
* loaded, or null when launchd reports it not loaded. Unlike `launchctl
|
|
70
|
+
* list`, which lists only the caller's own domain, this reads a system
|
|
71
|
+
* daemon without root. Any other failure throws, so a job that could not be
|
|
72
|
+
* inspected is never mistaken for a stopped one.
|
|
73
|
+
*/
|
|
74
|
+
private printJob;
|
|
75
|
+
/** Is the job currently loaded in its target domain? */
|
|
52
76
|
private isLoaded;
|
|
53
77
|
install(config: ServiceConfig): Promise<void>;
|
|
54
78
|
/**
|
|
55
|
-
* Poll until the
|
|
56
|
-
*
|
|
57
|
-
*
|
|
79
|
+
* Poll until the job is no longer loaded in its target domain, or the
|
|
80
|
+
* deadline elapses. Resolves true once the job has left the domain,
|
|
81
|
+
* false on timeout. `launchctl bootout` is asynchronous — it returns before
|
|
82
|
+
* launchd has finished releasing the job — so a bootstrap issued
|
|
58
83
|
* immediately afterward races the teardown and fails with EIO. Waiting for
|
|
59
84
|
* the unload to complete closes that race for the common case; the residual
|
|
60
85
|
* window is covered by bootstrapWithRetry.
|
|
@@ -64,13 +89,23 @@ export declare class LaunchdServiceManager implements ServiceManager {
|
|
|
64
89
|
* Bootstrap into the target domain, retrying on the transient EIO
|
|
65
90
|
* ("5: Input/output error") launchd returns when a just-removed service has
|
|
66
91
|
* not finished tearing down. A genuine, non-transient failure (bad plist,
|
|
67
|
-
* permission denied) is re-thrown on the first attempt.
|
|
68
|
-
*
|
|
92
|
+
* permission denied) is re-thrown on the first attempt.
|
|
93
|
+
*
|
|
94
|
+
* launchd answers a bootstrap of a job that is already loaded with the same
|
|
95
|
+
* EIO. With `replaceLoaded` (install, which just wrote a new plist) such a
|
|
96
|
+
* job is booted out before the next try. Without it (start), a job that
|
|
97
|
+
* another caller loaded meanwhile is the outcome start wanted: RunAtLoad has
|
|
98
|
+
* started it, so the call succeeds and leaves it running.
|
|
69
99
|
*/
|
|
70
100
|
private bootstrapWithRetry;
|
|
71
101
|
uninstall(config: ServiceConfig): Promise<void>;
|
|
72
102
|
start(config: ServiceConfig): Promise<void>;
|
|
73
103
|
stop(config: ServiceConfig): Promise<void>;
|
|
104
|
+
/**
|
|
105
|
+
* Boot the job out of its domain and wait until launchd has finished the
|
|
106
|
+
* teardown. Does nothing when no job is loaded.
|
|
107
|
+
*/
|
|
108
|
+
private unload;
|
|
74
109
|
restart(config: ServiceConfig): Promise<void>;
|
|
75
110
|
status(config: ServiceConfig): Promise<ServiceStatus>;
|
|
76
111
|
logs(config: ServiceConfig, options: LogOptions): Promise<void>;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How long an init system waits for a KiCI service to shut down.
|
|
3
|
+
*/
|
|
4
|
+
import type { ServiceConfig } from './types.js';
|
|
5
|
+
/**
|
|
6
|
+
* Seconds an init system must wait after SIGTERM before it SIGKILLs the service.
|
|
7
|
+
*
|
|
8
|
+
* The runtime defaults are shorter than either component's own graceful-shutdown
|
|
9
|
+
* budget: Compose waits 10s, launchd's default ExitTimeOut is 5s, and shawl's
|
|
10
|
+
* default `--stop-timeout` on Windows is 3s. A teardown that
|
|
11
|
+
* takes longer is killed partway through: the orchestrator never broadcasts
|
|
12
|
+
* `peer.leaving` and never closes its agent sockets, and the agent never
|
|
13
|
+
* finishes draining. That window is reached exactly when it matters most — the
|
|
14
|
+
* orchestrator's scaler stops each managed agent with its own grace, so an
|
|
15
|
+
* orchestrator with agents in flight routinely needs more than 10s.
|
|
16
|
+
*
|
|
17
|
+
* Each value is its component's force-exit budget plus headroom, so the
|
|
18
|
+
* process always reaches its own timer first and the runtime's kill stays the
|
|
19
|
+
* last resort it is meant to be:
|
|
20
|
+
* - orchestrator: 30s (`setupGracefulShutdown` default) plus up to 2s of log
|
|
21
|
+
* file flush -> 45s
|
|
22
|
+
* - agent: 10s plus a ~1s abort delay in its `onForceExit` -> 20s
|
|
23
|
+
*
|
|
24
|
+
* An unrecognised component gets the larger value: over-waiting costs a few
|
|
25
|
+
* seconds on shutdown, under-waiting corrupts it.
|
|
26
|
+
*/
|
|
27
|
+
export declare function shutdownGraceSeconds(config: ServiceConfig): number;
|
|
28
|
+
/**
|
|
29
|
+
* Seconds a `stop` waits for the init system to report the service stopped.
|
|
30
|
+
*
|
|
31
|
+
* The init system kills the process once its grace elapses, so a service still
|
|
32
|
+
* running after the grace plus this margin is hung, not slow.
|
|
33
|
+
*/
|
|
34
|
+
export declare function stopWaitSeconds(config: ServiceConfig): number;
|
|
35
|
+
//# sourceMappingURL=shutdown-grace.d.ts.map
|
|
@@ -20,6 +20,15 @@ export interface RestartPolicy {
|
|
|
20
20
|
}
|
|
21
21
|
/** Default restart policy: backoff 1s, 5s, 15s, 30s; max 5 failures in 5 minutes. */
|
|
22
22
|
export declare const DEFAULT_RESTART_POLICY: RestartPolicy;
|
|
23
|
+
/**
|
|
24
|
+
* The display name and description a component's service is registered with.
|
|
25
|
+
* `install` and every upgrade that registers a service again use it, so an
|
|
26
|
+
* upgraded registration carries the same text as a fresh one.
|
|
27
|
+
*/
|
|
28
|
+
export declare const SERVICE_TEXT: Record<'orchestrator' | 'agent', {
|
|
29
|
+
displayName: string;
|
|
30
|
+
description: string;
|
|
31
|
+
}>;
|
|
23
32
|
/** Configuration for installing a service. */
|
|
24
33
|
export interface ServiceConfig {
|
|
25
34
|
/** Service identifier (e.g., "kici-orchestrator"). */
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Restricting a Windows service's env file to the service account and to
|
|
3
|
+
* Administrators.
|
|
4
|
+
*
|
|
5
|
+
* Node maps a file mode onto Windows by toggling the read-only attribute and
|
|
6
|
+
* changes no ACL, so ENV_FILE_MODE protects nothing there. The instance folder
|
|
7
|
+
* under C:\ProgramData\kici\ inherits read access for BUILTIN\Users from
|
|
8
|
+
* C:\ProgramData. Its ACL is replaced with full control for LocalSystem (the
|
|
9
|
+
* account the shawl service runs as) and Administrators, inherited by
|
|
10
|
+
* everything created in it: the env file, the temporary file a secure write
|
|
11
|
+
* stages it through, and the service logs are unreadable to other accounts
|
|
12
|
+
* from the moment they exist.
|
|
13
|
+
*
|
|
14
|
+
* Every call passes `/L` and none recurses, so icacls acts on the folder and on
|
|
15
|
+
* the env file themselves and never on what a link there points at. A
|
|
16
|
+
* recursive `/reset` or `/setowner` descends into the target of a junction or
|
|
17
|
+
* of a symbolic link, even with `/L`, and rewrites the ACL of the files there.
|
|
18
|
+
* The new folder ACL still reaches every entry that inherits from the folder.
|
|
19
|
+
*/
|
|
20
|
+
/** NT AUTHORITY\SYSTEM, the account a shawl service runs as. */
|
|
21
|
+
export declare const LOCAL_SYSTEM_SID = "S-1-5-18";
|
|
22
|
+
/** BUILTIN\Administrators. */
|
|
23
|
+
export declare const ADMINISTRATORS_SID = "S-1-5-32-544";
|
|
24
|
+
/** Runs `icacls` with the given arguments; throws when it fails. */
|
|
25
|
+
export type IcaclsRunner = (args: string[]) => void;
|
|
26
|
+
/**
|
|
27
|
+
* The icacls arguments that remove every inherited ACE from `dir` and grant
|
|
28
|
+
* full control, inherited by files and folders, to LocalSystem and
|
|
29
|
+
* Administrators. SIDs rather than names, so a localized Windows resolves them.
|
|
30
|
+
*/
|
|
31
|
+
export declare function restrictDirArgs(dir: string): string[];
|
|
32
|
+
/** The icacls arguments that reset `file` to inherit only from its folder. */
|
|
33
|
+
export declare function resetFileArgs(file: string): string[];
|
|
34
|
+
/**
|
|
35
|
+
* Restrict the folder that holds `envFilePath`, then reset an existing env
|
|
36
|
+
* file to inherit only from it, which also drops any explicit ACE on the file.
|
|
37
|
+
* Run it before the first secret is written into the folder.
|
|
38
|
+
*/
|
|
39
|
+
export declare function restrictEnvFileAccess(envFilePath: string, run?: IcaclsRunner, exists?: (filePath: string) => boolean): void;
|
|
40
|
+
//# sourceMappingURL=windows-acl.d.ts.map
|