@kici-dev/orchestrator 0.11.0 → 0.12.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 +26 -0
- package/dist/agent/registry.d.ts +7 -9
- package/dist/agent-packaging/node-runtime-members.d.ts +14 -0
- package/dist/app.d.ts +3 -3
- package/dist/approvals/apply-decision.d.ts +1 -1
- package/dist/audit/access-log.d.ts +2 -3
- 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/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 +1620 -551
- package/dist/cluster/cluster-identity.d.ts +4 -4
- package/dist/cluster/join-token.d.ts +2 -2
- package/dist/cluster/leader-gated-scheduler.d.ts +7 -1
- package/dist/cluster/peer-credentials.d.ts +1 -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 +3 -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/types.d.ts +12 -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 +50 -14
- package/dist/oidc/db-signer.d.ts +1 -1
- package/dist/pipeline/global-eval-round.d.ts +2 -2
- package/dist/pipeline/processor.d.ts +2 -2
- package/dist/provenance/retrier-mint.d.ts +1 -1
- package/dist/provenance/trust-root.d.ts +3 -3
- package/dist/providers/universal-git/clone-token.d.ts +9 -13
- 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 +1 -1
- 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/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 +2736 -2211
- package/dist/stale-detector/stale-run-detector.d.ts +1 -1
- package/dist/standalone.d.ts +1 -1
- package/dist/standalone.js +2105 -1629
- package/dist/storage/filesystem.d.ts +1 -1
- package/dist/storage/index.d.ts +1 -1
- package/dist/storage/sign-url.d.ts +2 -1
- package/dist/storage/types.d.ts +2 -2
- package/dist/ws/agent-handler.d.ts +34 -3
- package/dist/ws/agent-heartbeat.d.ts +2 -3
- 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 +4 -4
- package/sbom.spdx.json +53 -53
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Predicate + projection evaluation for the shared `createMockDb` harness.
|
|
3
3
|
*
|
|
4
|
-
* Kept BYTE-IDENTICAL in
|
|
5
|
-
*
|
|
6
|
-
* `packages/platform/src/__test-helpers__/mock-db-query.ts`. Each package owns an
|
|
4
|
+
* Kept BYTE-IDENTICAL in the orchestrator and the Platform, which each carry a
|
|
5
|
+
* copy. Each package owns an
|
|
7
6
|
* independent `createMockDb` builder and neither package may import the other, so
|
|
8
|
-
* the evaluator is duplicated rather than shared.
|
|
9
|
-
*
|
|
7
|
+
* the evaluator is duplicated rather than shared. A drift test fails the moment
|
|
8
|
+
* the copies diverge.
|
|
10
9
|
*
|
|
11
10
|
* `createMockDb` used to return its configured rows verbatim, whatever the
|
|
12
11
|
* query asked for: a `.where(...)` or a `.select([...])` was recorded on a spy
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
* An agent reports its own package version in `agent.register`
|
|
5
5
|
* (`agentRegisterSchema.version`), and the field is optional — an agent old
|
|
6
6
|
* enough to omit it predates every feature this module gates on. The
|
|
7
|
-
* orchestrator and the agent are deployed and upgraded independently
|
|
8
|
-
*
|
|
7
|
+
* orchestrator and the agent are deployed and upgraded independently,
|
|
8
|
+
* so a feature the orchestrator ships is
|
|
9
9
|
* routinely dispatched to a fleet that cannot run it, and the version is the
|
|
10
10
|
* only fact the orchestrator has about what the fleet understands.
|
|
11
11
|
*/
|
|
@@ -16,9 +16,9 @@ type VersionBase = [number, number, number];
|
|
|
16
16
|
* the string is not a version at all.
|
|
17
17
|
*
|
|
18
18
|
* The prerelease suffix is dropped rather than ordered because the suffixes in
|
|
19
|
-
* play are build counters
|
|
20
|
-
*
|
|
21
|
-
*
|
|
19
|
+
* play are build counters (`0.5.0-9159`), not semver release candidates. Strict
|
|
20
|
+
* semver orders those BELOW `0.5.0`, which would read every agent on a
|
|
21
|
+
* prerelease build as too old for a feature it in fact carries.
|
|
22
22
|
*/
|
|
23
23
|
export declare function parseVersionBase(version: string): VersionBase | null;
|
|
24
24
|
/**
|
|
@@ -444,6 +444,32 @@ export declare class Dispatcher {
|
|
|
444
444
|
private failRefusedDispatch;
|
|
445
445
|
/** Free the slot and tracking a claim took on its agent; a claim for no agent took none. */
|
|
446
446
|
private releaseClaimAccounting;
|
|
447
|
+
/**
|
|
448
|
+
* Release the slot and tracking `jobId` holds on `agentId`, if the job is
|
|
449
|
+
* still tracked there. Returns false when another path (a refusal, a
|
|
450
|
+
* put-back, a disconnect) already took it.
|
|
451
|
+
*/
|
|
452
|
+
private releaseTrackedClaim;
|
|
453
|
+
/**
|
|
454
|
+
* Hand a job this coordinator just claimed from the queue to `agentId`,
|
|
455
|
+
* whose slot the claim took. A query that fails before the job is sent
|
|
456
|
+
* returns the claim ({@link returnUndeliveredClaim}) and rethrows, so the
|
|
457
|
+
* agent is not left holding a slot for a job it never received.
|
|
458
|
+
*
|
|
459
|
+
* @returns whether the job was sent.
|
|
460
|
+
*/
|
|
461
|
+
private sendClaimedJob;
|
|
462
|
+
/**
|
|
463
|
+
* Put back a job a queue claim took but did not send: a query failed between
|
|
464
|
+
* the claim and the send. The agent's slot (and the job's tracking, once
|
|
465
|
+
* taken) is released so the agent takes work again, and the row returns to
|
|
466
|
+
* pending without spending a dispatch attempt, since no agent saw it. The
|
|
467
|
+
* next drain or the pending re-drive offers it again. A job a refusal or a
|
|
468
|
+
* disconnect already took is left to that path. If the put-back fails too,
|
|
469
|
+
* the row stays dispatched with no ack deadline and the stale-dispatch scan
|
|
470
|
+
* reaps it.
|
|
471
|
+
*/
|
|
472
|
+
private returnUndeliveredClaim;
|
|
447
473
|
/** Record that a job began executing on its agent. */
|
|
448
474
|
markJobStarted(jobId: string): void;
|
|
449
475
|
/**
|
package/dist/agent/registry.d.ts
CHANGED
|
@@ -117,7 +117,7 @@ export interface AgentEntry {
|
|
|
117
117
|
* The `agent_tokens.id` row used to authenticate this connection, or
|
|
118
118
|
* `null` when auth mode is `none`. Indexed by `tokenIdIndex` so a
|
|
119
119
|
* synchronous revocation kick can enumerate every WS authenticated by
|
|
120
|
-
* a given token.
|
|
120
|
+
* a given token.
|
|
121
121
|
*/
|
|
122
122
|
tokenId: string | null;
|
|
123
123
|
hostname: string | null;
|
|
@@ -240,10 +240,9 @@ export declare class AgentRegistry {
|
|
|
240
240
|
*
|
|
241
241
|
* Idempotent: re-scheduling the same tokenId is a no-op as long as
|
|
242
242
|
* a timer is still queued — a token's `expires_at` doesn't shift
|
|
243
|
-
* across reconnects of the same agent.
|
|
244
|
-
*
|
|
245
|
-
*
|
|
246
|
-
* propagation path to in-flight WS connections.
|
|
243
|
+
* across reconnects of the same agent. Revocation kicks a token's
|
|
244
|
+
* in-flight WS connections at once; these timers do the same when
|
|
245
|
+
* the token reaches its natural TTL.
|
|
247
246
|
*/
|
|
248
247
|
private readonly tokenExpiryTimers;
|
|
249
248
|
/**
|
|
@@ -317,10 +316,9 @@ export declare class AgentRegistry {
|
|
|
317
316
|
* Caller is the agent WS handler at register-time, when the token's
|
|
318
317
|
* `agent_tokens.expires_at` column is non-null. Static tokens have
|
|
319
318
|
* `expires_at = null` and are skipped at the call site (they have
|
|
320
|
-
* no TTL by design).
|
|
321
|
-
*
|
|
322
|
-
*
|
|
323
|
-
* in-flight WS connections.
|
|
319
|
+
* no TTL by design). Revocation kicks a token's in-flight WS
|
|
320
|
+
* connections at once; this timer does the same at the token's
|
|
321
|
+
* natural TTL.
|
|
324
322
|
*/
|
|
325
323
|
scheduleExpiryKick(tokenId: string, expiresAt: Date): void;
|
|
326
324
|
/**
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The members of an official Node.js Linux or macOS archive that a KiCI payload
|
|
3
|
+
* vendors, relative to the archive's `node-v<version>-<os>-<arch>/` directory:
|
|
4
|
+
* the `node` binary, the `npm` and `npx` launchers, and the bundled npm package.
|
|
5
|
+
* With them in place, the agent's `resolveNpm()` finds
|
|
6
|
+
* `<nodeDir>/../lib/node_modules/npm/bin/npm-cli.js` beside the vendored `node`,
|
|
7
|
+
* so the builder role needs no npm on the host.
|
|
8
|
+
*
|
|
9
|
+
* This module has no imports so that repository tooling can read the list:
|
|
10
|
+
* `scripts/lib/node-dist.mjs` (the standalone package builder) keeps its own
|
|
11
|
+
* copy, and its test pins the two lists equal.
|
|
12
|
+
*/
|
|
13
|
+
export declare const NODE_RUNTIME_MEMBERS: readonly ['bin/node', 'bin/npm', 'bin/npx', 'lib/node_modules/npm'];
|
|
14
|
+
//# sourceMappingURL=node-runtime-members.d.ts.map
|
package/dist/app.d.ts
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* - Request ID and logging middleware
|
|
11
11
|
* - 25MB body size limit
|
|
12
12
|
*
|
|
13
|
-
*
|
|
13
|
+
* Same pattern as the Platform's app: returns { app, wss }.
|
|
14
14
|
*/
|
|
15
15
|
import type { Kysely } from 'kysely';
|
|
16
16
|
import type pg from 'pg';
|
|
@@ -197,7 +197,7 @@ export interface AppDependencies {
|
|
|
197
197
|
*/
|
|
198
198
|
faultInjection?: import('./fault-injection-types.js').OrchestratorFaultInjection;
|
|
199
199
|
/**
|
|
200
|
-
* Orchestrator-owned provenance signing (
|
|
200
|
+
* Orchestrator-owned provenance signing (the root of trust). Present when
|
|
201
201
|
* `KICI_ORCHESTRATOR_PROVENANCE_ISSUER` is configured: the orchestrator mints +
|
|
202
202
|
* signs identity tokens locally with its own ES256 key, and serves its own
|
|
203
203
|
* OIDC discovery + JWKS + native verify endpoint. `resolveOrchestratorSigner`
|
|
@@ -342,7 +342,7 @@ export interface AppDependencies {
|
|
|
342
342
|
globalWorkflowPolicy?: GlobalWorkflowPolicy;
|
|
343
343
|
/** Inbound webhook delivery log writer. Optional -- if not set, deliveries are not persisted to event_log. */
|
|
344
344
|
eventLogWriter?: EventLogWriter;
|
|
345
|
-
/** Cold-store handle
|
|
345
|
+
/** Cold-store handle. Optional -- when present, admin event-log routes can serve archived rows. */
|
|
346
346
|
coldStore?: ColdStore | null;
|
|
347
347
|
/** Read + mutation attribution log writer. Optional -- if not set, access_log rows are not written. */
|
|
348
348
|
accessLogWriter?: AccessLogWriter;
|
|
@@ -50,7 +50,7 @@ export interface ApplyDecisionResult {
|
|
|
50
50
|
export interface ApplyDecisionDeps {
|
|
51
51
|
orgId: string;
|
|
52
52
|
store: HeldRunStore;
|
|
53
|
-
/** Team name → member user ids (from the
|
|
53
|
+
/** Team name → member user ids (from the trust-policy cache). */
|
|
54
54
|
teamMembershipLookup: TeamMembershipLookup;
|
|
55
55
|
/** Whether the run triggerer may self-approve (org_settings.allow_self_approval). */
|
|
56
56
|
allowSelfApproval: boolean;
|
|
@@ -88,11 +88,10 @@ export declare class AccessLogWriter {
|
|
|
88
88
|
recordInTransaction(executor: Kysely<Database> | Transaction<Database>, entry: AccessLogRecord): Promise<void>;
|
|
89
89
|
private insert;
|
|
90
90
|
/**
|
|
91
|
-
*
|
|
91
|
+
* Delegates to `loadAccessLogRange` so cold-store rows are
|
|
92
92
|
* merged transparently when pagination crosses the warm cutoff. The
|
|
93
93
|
* caller-visible `{items, nextCursor}` shape is preserved. NO
|
|
94
|
-
* --include-archived flag — access_log is "paginated/transparent"
|
|
95
|
-
* per design §7 row 11.
|
|
94
|
+
* --include-archived flag — access_log is "paginated/transparent".
|
|
96
95
|
*/
|
|
97
96
|
query(filter: AccessLogQueryFilter): Promise<AccessLogQueryResult>;
|
|
98
97
|
/**
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
* Access log commands for kici-admin.
|
|
3
3
|
*
|
|
4
4
|
* Operator-facing read access to the orchestrator's access_log table
|
|
5
|
-
* (read + mutation attribution with ActorPrincipal).
|
|
6
|
-
*
|
|
7
|
-
*
|
|
5
|
+
* (read + mutation attribution with ActorPrincipal). Use it instead of raw
|
|
6
|
+
* psql when an operator asks "who read this run's payload last Tuesday" or
|
|
7
|
+
* "show me everything a platform_operator actor did".
|
|
8
8
|
*
|
|
9
9
|
* access-log list List access-log rows with filters (cursor-paginated)
|
|
10
10
|
* access-log show Show a single entry by id
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The env file `kici-admin agent install` writes for a new agent. Each field
|
|
3
|
+
* lands in the variable the agent's config loader reads; that loader refuses
|
|
4
|
+
* any KICI_* variable it does not know, so a misspelt key here stops the agent
|
|
5
|
+
* at startup. `agent-env.test.ts` loads the rendered file through the agent's
|
|
6
|
+
* own loader to hold the two together.
|
|
7
|
+
*/
|
|
8
|
+
export interface AgentEnvFields {
|
|
9
|
+
/** First line of the file, a `#` comment naming what wrote it. */
|
|
10
|
+
header: string;
|
|
11
|
+
orchestratorUrl?: string;
|
|
12
|
+
token?: string;
|
|
13
|
+
/** Routing labels, written comma-separated. */
|
|
14
|
+
labels?: string[];
|
|
15
|
+
/** The agent's HTTP port; omitted, the agent uses its default. */
|
|
16
|
+
port?: number;
|
|
17
|
+
}
|
|
18
|
+
/** Render the env file, one `KEY=value` line per field that was given. */
|
|
19
|
+
export declare function renderAgentEnvFile(fields: AgentEnvFields): string;
|
|
20
|
+
//# sourceMappingURL=agent-env.d.ts.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* `kici-admin agent 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 agent's `/health` endpoint for its ID, orchestrator connection,
|
|
6
|
+
* active job count, version, build fingerprint and uptime.
|
|
7
7
|
*
|
|
8
8
|
* Target resolution goes through resolveInstanceTarget — the same priority chain
|
|
9
9
|
* every lifecycle command uses (--instance-dir > --name > CWD manifest >
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* unverifiable rows; `--all` re-evaluates
|
|
7
7
|
* every row. Direct DB + object storage.
|
|
8
8
|
*
|
|
9
|
-
*
|
|
9
|
+
* Belongs to `kici-admin`: it works on the orchestrator's database.
|
|
10
10
|
*/
|
|
11
11
|
import type { Command } from 'commander';
|
|
12
12
|
import type { AdminApiClient } from '../api-client.js';
|
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
*
|
|
19
19
|
* Direct-DB mode: activated when `--database-url` is passed (or
|
|
20
20
|
* KICI_DATABASE_URL / DATABASE_URL is set). Opens its own pool and runs the
|
|
21
|
-
* SQL directly via *Direct helpers in @kici-dev/shared
|
|
22
|
-
*
|
|
21
|
+
* SQL directly via *Direct helpers in @kici-dev/shared, so a setup script can
|
|
22
|
+
* seed contexts before the orchestrator is up.
|
|
23
23
|
*/
|
|
24
24
|
import type { Command } from 'commander';
|
|
25
25
|
import type { AdminApiClient } from '../api-client.js';
|
|
@@ -6,12 +6,11 @@
|
|
|
6
6
|
* event-dlq retry <id> — clear DLQ flag, schedule for retry, pg_notify
|
|
7
7
|
* event-dlq discard <id> — permanently delete a DLQ event
|
|
8
8
|
*
|
|
9
|
-
* Operator
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* if the event is no longer relevant.
|
|
9
|
+
* Operator triage path for at-least-once event delivery. Customers should
|
|
10
|
+
* generally never see anything in the DLQ — when something lands here it
|
|
11
|
+
* usually means a workflow handler is consistently failing and should be fixed
|
|
12
|
+
* at its root cause. This CLI is the triage surface: inspect last_error, retry
|
|
13
|
+
* once a fix is deployed, or discard if the event is no longer relevant.
|
|
15
14
|
*/
|
|
16
15
|
import type { Command } from 'commander';
|
|
17
16
|
import type { AdminApiClient } from '../api-client.js';
|
|
@@ -2,9 +2,8 @@
|
|
|
2
2
|
* Inbound webhook delivery log commands for kici-admin.
|
|
3
3
|
*
|
|
4
4
|
* Operator-facing read access to the orchestrator's event_log table via the
|
|
5
|
-
* admin HTTP API.
|
|
6
|
-
*
|
|
7
|
-
* like".
|
|
5
|
+
* admin HTTP API. Use it instead of raw psql / log-grep when an operator
|
|
6
|
+
* asks "did delivery <id> arrive, and what did its payload look like".
|
|
8
7
|
*
|
|
9
8
|
* event-log list List inbound deliveries with filters
|
|
10
9
|
* event-log show Show a single delivery (optionally with payload)
|
|
@@ -7,9 +7,7 @@
|
|
|
7
7
|
* READ-ONLY — mutations (purge-stale) live in `maintenance.ts` instead.
|
|
8
8
|
* Dual-mode: HTTP (via AdminApiClient) or `--database-url` (direct DB).
|
|
9
9
|
*
|
|
10
|
-
*
|
|
11
|
-
* the E2E call sites touch are execution_runs / execution_jobs, not
|
|
12
|
-
* dedup_cache.
|
|
10
|
+
* The rows come from execution_runs / execution_jobs, not dedup_cache.
|
|
13
11
|
*/
|
|
14
12
|
import type { Command } from 'commander';
|
|
15
13
|
import type { AdminApiClient } from '../api-client.js';
|
|
@@ -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
|