@kici-dev/orchestrator 0.1.27 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/__test-helpers__/mock-db.d.ts +2 -0
- package/dist/agent/dispatcher.d.ts +52 -2
- package/dist/agent/host-roster-reaper.d.ts +1 -2
- package/dist/agent/host-roster.d.ts +34 -0
- package/dist/agent/ownership-refusal.d.ts +12 -0
- package/dist/agent/ownership-tracker.d.ts +64 -16
- package/dist/agent/token-store.d.ts +13 -0
- package/dist/agent-packaging/availability.d.ts +27 -0
- package/dist/agent-packaging/build-package.d.ts +16 -0
- package/dist/agent-packaging/download.d.ts +30 -0
- package/dist/agent-packaging/index.d.ts +9 -0
- package/dist/agent-packaging/install-closure.d.ts +30 -0
- package/dist/agent-packaging/node-binary.d.ts +26 -0
- package/dist/agent-packaging/refresh.d.ts +50 -0
- package/dist/agent-packaging/store.d.ts +15 -0
- package/dist/agent-packaging/upload.d.ts +24 -0
- package/dist/app-on-error.d.ts +29 -0
- package/dist/app.d.ts +56 -4
- package/dist/artifacts/artifact-store.d.ts +233 -0
- package/dist/artifacts/failure-messages.d.ts +46 -0
- package/dist/audit/access-log.d.ts +18 -1
- package/dist/cache/dep-cache.d.ts +15 -0
- package/dist/cache/user-cache.d.ts +37 -0
- package/dist/cancel/cancel-run.d.ts +10 -3
- package/dist/cancel/dashboard-cancel-handler.d.ts +19 -0
- package/dist/cli/api-client.d.ts +44 -1
- package/dist/cli/commands/agent-package.d.ts +34 -0
- package/dist/cli/commands/check-run.d.ts +26 -0
- package/dist/cli/commands/cluster-settings.d.ts +55 -0
- package/dist/cli/commands/dashboard-encryption-key.d.ts +3 -0
- package/dist/cli/commands/db-backup.d.ts +71 -0
- package/dist/cli/commands/orchestrator-service/drain.d.ts +31 -0
- package/dist/cli/commands/orchestrator-service/index.d.ts +7 -4
- package/dist/cli/commands/orchestrator-service/install-env.d.ts +58 -0
- package/dist/cli/commands/secret.d.ts +45 -1
- package/dist/cli/commands/shared/admin-cli-access-log.d.ts +46 -0
- package/dist/cli/commands/shared/versioned-upgrade.d.ts +65 -2
- package/dist/cli/commands/signing-key.d.ts +3 -0
- package/dist/cli/commands/source.d.ts +12 -0
- package/dist/cli/commands/token.d.ts +9 -0
- package/dist/cli/commands/trust-policy.d.ts +48 -0
- package/dist/cli/join.d.ts +1 -1
- package/dist/cli/service/index.d.ts +2 -2
- package/dist/cli/service/instance/manifest.d.ts +17 -0
- package/dist/cli/service/instance/resolve.d.ts +11 -0
- package/dist/cli/wizard/orchestrator-wizard.d.ts +39 -11
- package/dist/cli.js +9921 -3409
- package/dist/cluster/cluster-settings-reader.d.ts +78 -0
- package/dist/cluster/coordinator.d.ts +81 -9
- package/dist/cluster/join-client.d.ts +1 -1
- package/dist/cluster/leader-gated-scheduler.d.ts +50 -0
- package/dist/cluster/orphan-recovery.d.ts +14 -0
- package/dist/cluster/peer-client.d.ts +12 -2
- package/dist/cluster/peer-handler.d.ts +15 -4
- package/dist/cluster/peer-registry.d.ts +12 -0
- package/dist/cluster/verified-issuer-poller.d.ts +11 -0
- package/dist/cluster/verified-issuer.d.ts +63 -0
- package/dist/cold-store/tables/access-log.d.ts +1 -1
- package/dist/cold-store/tables/event-log.d.ts +1 -1
- package/dist/cold-store/tables/execution-jobs.d.ts +1 -1
- package/dist/cold-store/tables/execution-runs.d.ts +1 -1
- package/dist/cold-store/tables/execution-steps.d.ts +1 -1
- package/dist/cold-store/tables/secret-audit-log.d.ts +1 -1
- package/dist/config/loader.d.ts +1 -1
- package/dist/config/resolver.d.ts +2 -1
- package/dist/config/schema.d.ts +9 -6
- package/dist/config/types.d.ts +5 -2
- package/dist/config.d.ts +366 -53
- package/dist/contexts/context-store.d.ts +21 -8
- package/dist/contexts/glob-specificity.d.ts +30 -0
- package/dist/contexts/held-runs.d.ts +51 -19
- package/dist/contexts/protection/aggregate.d.ts +2 -2
- package/dist/contexts/protection/concurrency-gate.d.ts +0 -3
- package/dist/contexts/protection/reviewer-gate.d.ts +0 -3
- package/dist/contexts/protection/satisfiability.d.ts +1 -1
- package/dist/contexts/protection/trust-gate.d.ts +0 -3
- package/dist/contexts/protection/wait-timer-gate.d.ts +0 -3
- package/dist/cron/cron-scheduler.d.ts +24 -4
- package/dist/cron/cron-store.d.ts +21 -7
- package/dist/dashboard/attestation-filters.d.ts +92 -74
- package/dist/dashboard/handler.d.ts +35 -1
- package/dist/db/migration-test-harness.d.ts +41 -0
- package/dist/db/migrations/069_reroute_tunables.d.ts +21 -0
- package/dist/db/migrations/070_execution_runs_failure_class.d.ts +4 -0
- package/dist/db/migrations/071_batch_accumulation.d.ts +26 -0
- package/dist/db/migrations/072_dispatch_queue_run_id_index.d.ts +15 -0
- package/dist/db/migrations/073_org_settings_ingest_concurrency.d.ts +13 -0
- package/dist/db/migrations/074_normalize_zero_concurrency_limit.d.ts +13 -0
- package/dist/db/migrations/075_ingest_overflow_buffer.d.ts +16 -0
- package/dist/db/migrations/076_artifacts.d.ts +19 -0
- package/dist/db/migrations/077_backup_runs.d.ts +13 -0
- package/dist/db/migrations/078_org_settings_backup_staleness.d.ts +12 -0
- package/dist/db/migrations/079_org_settings_scaler_spawn_timeout.d.ts +14 -0
- package/dist/db/migrations/080_cluster_settings.d.ts +17 -0
- package/dist/db/migrations/081_org_settings_queue_timeout.d.ts +19 -0
- package/dist/db/migrations/082_host_s3_reachable.d.ts +16 -0
- package/dist/db/migrations/083_org_settings_artifact_caps.d.ts +18 -0
- package/dist/db/migrations/084_orchestrator_signing_keys.d.ts +20 -0
- package/dist/db/migrations/085_cluster_settings_reroute_flap_grace_ms.d.ts +12 -0
- package/dist/db/migrations/086_cluster_settings_max_fanout_hosts.d.ts +12 -0
- package/dist/db/migrations/087_cluster_settings_event_router_rate_limit.d.ts +12 -0
- package/dist/db/migrations/088_cluster_settings_cache_max_tarball_bytes.d.ts +12 -0
- package/dist/db/migrations/089_cluster_settings_cache_ttl_days.d.ts +12 -0
- package/dist/db/migrations/090_cluster_settings_concurrency_wait_timeout_ms.d.ts +12 -0
- package/dist/db/migrations/091_cluster_settings_agent_token_ttl_ms.d.ts +12 -0
- package/dist/db/migrations/092_cluster_settings_version.d.ts +16 -0
- package/dist/db/migrations/093_org_settings_sandbox_allowlist.d.ts +4 -0
- package/dist/db/migrations/094_dashboard_encryption_keys.d.ts +21 -0
- package/dist/db/migrations/095_dashboard_write_policy_tristate.d.ts +20 -0
- package/dist/db/migrations/096_multi_schedule_cron_last_fired.d.ts +4 -0
- package/dist/db/migrations/097_execution_runs_pr_number.d.ts +4 -0
- package/dist/db/migrations/098_execution_runs_customer_id.d.ts +4 -0
- package/dist/db/migrations/099_cluster_settings_dashboard_verified_issuer.d.ts +21 -0
- package/dist/db/migrations/100_held_runs_hold_type_vocabulary.d.ts +31 -0
- package/dist/db/migrations/101_contexts_hold_expiry_drop_default.d.ts +31 -0
- package/dist/db/migrations/102_dispatch_queue_agent_id.d.ts +20 -0
- package/dist/db/migrations/103_cluster_settings_ownership_db_check_timeout_ms.d.ts +20 -0
- package/dist/db/migrations/104_check_run_terminal_sent.d.ts +22 -0
- package/dist/db/migrations/105_org_trust_policy.d.ts +19 -0
- package/dist/db/migrations/106_cluster_settings_check_run_tracking_ttl_days.d.ts +18 -0
- package/dist/db/migrations/107_check_run_tracking_updated_at_index.d.ts +23 -0
- package/dist/db/migrations/108_unroutable_fast_fail.d.ts +4 -0
- package/dist/db/repos/dashboard-encryption-keys-repo.d.ts +48 -0
- package/dist/db/repos/signing-keys-repo.d.ts +34 -0
- package/dist/db/types.d.ts +441 -7
- package/dist/deployment/deployment-identity.d.ts +87 -2
- package/dist/diagnostics/checks/backup.d.ts +18 -0
- package/dist/diagnostics/checks/index.d.ts +2 -1
- package/dist/diagnostics/fleet-collector.d.ts +1 -1
- package/dist/drain/drain-controller.d.ts +52 -0
- package/dist/events/batch-accumulator.d.ts +63 -0
- package/dist/events/circuit-breaker.d.ts +9 -3
- package/dist/events/event-emitter.d.ts +31 -0
- package/dist/events/event-retry-scanner.d.ts +12 -2
- package/dist/events/event-router.d.ts +29 -0
- package/dist/firecracker/host-network.d.ts +2 -0
- package/dist/firecracker/net-interfaces.d.ts +14 -0
- package/dist/github-app-name-refresher/github-app-name-refresher.d.ts +18 -8
- package/dist/index.d.ts +2 -0
- package/dist/index.js +654 -29
- package/dist/lockfile-cache.d.ts +4 -0
- package/dist/lockfile-validate.d.ts +16 -9
- package/dist/metrics/prometheus.d.ts +113 -15
- package/dist/oidc/aws-kms-signer.d.ts +37 -0
- package/dist/oidc/command-signer.d.ts +23 -0
- package/dist/oidc/db-signer.d.ts +48 -0
- package/dist/oidc/id-token-claims.d.ts +22 -9
- package/dist/oidc/jwt.d.ts +5 -2
- package/dist/oidc/local-dev-signer.d.ts +1 -1
- package/dist/oidc/oidc-mint-registration.d.ts +27 -11
- package/dist/oidc/orchestrator-mint.d.ts +97 -0
- package/dist/oidc/orchestrator-signer-factory.d.ts +33 -0
- package/dist/oidc/reconcile-signing-key.d.ts +21 -0
- package/dist/oidc/signer.d.ts +25 -0
- package/dist/oidc/signing-key-status.d.ts +23 -0
- package/dist/orchestrator-core.d.ts +42 -2
- package/dist/pipeline/decorating-secret-resolver.d.ts +3 -2
- package/dist/pipeline/dispatch-matched-workflow.d.ts +41 -0
- package/dist/pipeline/install-secrets-resolver.d.ts +12 -1
- package/dist/pipeline/manual-schedule.d.ts +20 -13
- package/dist/pipeline/pending-workflow-context.d.ts +1 -1
- package/dist/pipeline/process-webhook.d.ts +57 -2
- package/dist/pipeline/processor.d.ts +44 -8
- package/dist/pipeline/rerun.d.ts +12 -13
- package/dist/pipeline/resolve-sandbox-grant.d.ts +28 -0
- package/dist/pipeline/route-or-dispatch-jobs.d.ts +71 -0
- package/dist/pipeline/sandbox-allowlist-reader.d.ts +33 -0
- package/dist/policy/dashboard-write-policy.d.ts +9 -4
- package/dist/provenance/backfill-run.d.ts +1 -0
- package/dist/provenance/trust-root.d.ts +13 -0
- package/dist/providers/generic/normalizer.d.ts +1 -1
- package/dist/providers/github/auth.d.ts +1 -1
- package/dist/providers/github/changed-files.d.ts +14 -6
- package/dist/providers/github/check-status-poster.d.ts +19 -3
- package/dist/providers/github/contributor-resolver.d.ts +1 -1
- package/dist/providers/github/lock-file.d.ts +1 -1
- package/dist/providers/github/normalizer.d.ts +1 -1
- package/dist/providers/github/repo-url.d.ts +1 -1
- package/dist/providers/local/lock-file-fetcher.d.ts +1 -1
- package/dist/providers/local/normalizer.d.ts +1 -1
- package/dist/providers/local/repo-url-builder.d.ts +1 -1
- package/dist/providers/universal-git/changed-files.d.ts +8 -7
- package/dist/providers/universal-git/clone-token.d.ts +1 -1
- package/dist/providers/universal-git/config.d.ts +4 -4
- package/dist/providers/universal-git/index.d.ts +5 -1
- package/dist/providers/universal-git/lock-file.d.ts +6 -1
- package/dist/providers/universal-git/normalizer.d.ts +1 -1
- package/dist/providers/universal-git/repo-url.d.ts +1 -1
- package/dist/queue/bootstrap.d.ts +5 -0
- package/dist/queue/cleanup.d.ts +72 -9
- package/dist/queue/job-queue.d.ts +141 -14
- package/dist/queue/scheduled-job.d.ts +3 -2
- package/dist/queue/terminalize-unroutable.d.ts +53 -0
- package/dist/queue/unroutable-probe.d.ts +52 -0
- package/dist/registration/registration-index.d.ts +1 -1
- package/dist/reporting/agent-failure-category.d.ts +4 -1
- package/dist/reporting/check-run-reporter.d.ts +34 -14
- package/dist/reporting/check-run-tracking-store.d.ts +70 -8
- package/dist/reporting/execution-tracker.d.ts +156 -10
- package/dist/reporting/fs-log-storage.d.ts +31 -2
- package/dist/reporting/job-check-run-completion.d.ts +50 -0
- package/dist/reporting/log-chunk-sink.d.ts +47 -0
- package/dist/reporting/log-retention.d.ts +16 -0
- package/dist/reporting/log-storage.d.ts +64 -4
- package/dist/reporting/log-writer.d.ts +22 -7
- package/dist/reporting/peer-log-normalize.d.ts +14 -0
- package/dist/reporting/run-aggregator.d.ts +50 -33
- package/dist/reporting/s3-log-storage.d.ts +102 -8
- package/dist/routes/admin-auth.d.ts +90 -0
- package/dist/routes/admin-cluster-settings.d.ts +31 -0
- package/dist/routes/admin-events.d.ts +3 -0
- package/dist/routes/admin-orchestrator-drain.d.ts +35 -0
- package/dist/routes/admin-runs.d.ts +9 -0
- package/dist/routes/admin-sources.d.ts +7 -0
- package/dist/routes/admin-trust-policy.d.ts +49 -0
- package/dist/routes/admin.d.ts +15 -1
- package/dist/routes/github-webhook.d.ts +9 -3
- package/dist/routes/provenance-oidc.d.ts +38 -0
- package/dist/routes/verify-attestation.d.ts +21 -0
- package/dist/scaler/bare-metal-backend.d.ts +9 -2
- package/dist/scaler/config.d.ts +25 -4
- package/dist/scaler/container-backend.d.ts +9 -1
- package/dist/scaler/firecracker-backend.d.ts +29 -2
- package/dist/scaler/index.d.ts +1 -1
- package/dist/scaler/manager.d.ts +166 -8
- package/dist/scaler/pending-scale-sweeper.d.ts +35 -0
- package/dist/scaler/types.d.ts +75 -6
- package/dist/secrets/backend-registry.d.ts +32 -1
- package/dist/secrets/dashboard-encryption-key.d.ts +48 -0
- package/dist/secrets/ephemeral-keys.d.ts +16 -0
- package/dist/secrets/pg-secret-store.d.ts +10 -0
- package/dist/secrets/rbac.d.ts +5 -1
- package/dist/secrets/routing-key-scope.d.ts +6 -0
- package/dist/secrets/scope-routing.d.ts +126 -0
- package/dist/secrets/secret-resolver.d.ts +1 -14
- package/dist/secrets/token-manager.d.ts +5 -1
- package/dist/security/contributor-cache.d.ts +9 -1
- package/dist/security/trust-policy-gate.d.ts +117 -0
- package/dist/security/trust-policy-store.d.ts +78 -0
- package/dist/server.js +36074 -25052
- package/dist/sources/source-manager.d.ts +24 -0
- package/dist/stale-detector/stale-run-detector.d.ts +7 -0
- package/dist/standalone.js +35203 -25387
- package/dist/storage/filesystem.d.ts +17 -0
- package/dist/storage/key-discriminator.d.ts +20 -0
- package/dist/storage/s3.d.ts +2 -0
- package/dist/storage/types.d.ts +16 -0
- package/dist/webhook/dedup.d.ts +9 -1
- package/dist/webhook/event-log.d.ts +13 -2
- package/dist/webhook/generic-sources-listener.d.ts +4 -0
- package/dist/webhook/ingest-admission.d.ts +140 -0
- package/dist/webhook/ingest-overflow-buffer.d.ts +27 -0
- package/dist/webhook/ingest-overflow-replayer.d.ts +49 -0
- package/dist/webhook/ingest-overflow-types.d.ts +73 -0
- package/dist/webhook/loop-lag-source.d.ts +40 -0
- package/dist/webhook/observed-relay-guard.d.ts +40 -0
- package/dist/webhook/org-ingest-cap-reader.d.ts +24 -0
- package/dist/webhook/register-source-bundle.d.ts +3 -0
- package/dist/webhook/relay-reinject.d.ts +43 -0
- package/dist/worker/in-memory-job-queue.d.ts +8 -3
- package/dist/worker-core.d.ts +10 -0
- package/dist/ws/agent-api-registry.d.ts +20 -0
- package/dist/ws/agent-handler.d.ts +63 -7
- package/dist/ws/bringup-api.d.ts +99 -0
- package/dist/ws/dashboard-context-handler.d.ts +28 -10
- package/dist/ws/dashboard-run-state-handler.d.ts +31 -0
- package/dist/ws/failure-messages.d.ts +29 -0
- package/dist/ws/oidc-token-relay.d.ts +9 -0
- package/dist/ws/ownership-gate.d.ts +22 -0
- package/dist/ws/platform-client.d.ts +96 -1
- package/dist/ws/replay-chunker.d.ts +37 -0
- package/installer-image-digests.json +3 -3
- package/package.json +22 -21
- package/sbom.spdx.json +1240 -1788
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { Command } from 'commander';
|
|
2
|
+
import { type AgentPlatform as AgentPlatformType } from '@kici-dev/shared';
|
|
3
|
+
import { type AgentPackageStorage } from '../../agent-packaging/index.js';
|
|
4
|
+
/** The orchestrator's own version (single-version invariant) = the packaged agent version. */
|
|
5
|
+
export declare function resolveKiciVersion(): string;
|
|
6
|
+
/** Parse the --platform value: default set | single | CSV | `all`. */
|
|
7
|
+
export declare function parsePlatforms(raw: string | undefined): AgentPlatformType[];
|
|
8
|
+
/** Build the cache-bucket storage client from the orchestrator config (S3 only). */
|
|
9
|
+
export declare function resolveUploadStorage(): AgentPackageStorage;
|
|
10
|
+
/** Options for {@link runAgentPackageRefresh} (the auto-package-on-upgrade hook). */
|
|
11
|
+
export interface AgentPackageRefreshOptions {
|
|
12
|
+
platforms?: AgentPlatformType[];
|
|
13
|
+
nodeMirror?: string;
|
|
14
|
+
npmRegistry?: string;
|
|
15
|
+
nodeVersion?: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Auto-produce + upload the agent payloads for the orchestrator's current
|
|
19
|
+
* version after a versioned upgrade (the C9 automation-completeness hook).
|
|
20
|
+
*
|
|
21
|
+
* Best-effort by design: a filesystem-cache orchestrator has no bucket to serve
|
|
22
|
+
* payloads from, so it logs and skips rather than failing the upgrade; a
|
|
23
|
+
* produce/upload error is reported but non-fatal to the (already-completed)
|
|
24
|
+
* orchestrator upgrade. Idempotent — a version whose payloads already exist is
|
|
25
|
+
* a no-op. Returns true when a refresh ran (S3 configured), false when skipped.
|
|
26
|
+
*/
|
|
27
|
+
export declare function runAgentPackageRefresh(opts?: AgentPackageRefreshOptions): Promise<boolean>;
|
|
28
|
+
/**
|
|
29
|
+
* Register the `kici-admin agent package` producer on the existing `agent`
|
|
30
|
+
* command group. Must be called after registerAgentCommands (which creates the
|
|
31
|
+
* group).
|
|
32
|
+
*/
|
|
33
|
+
export declare function registerAgentPackage(program: Command): void;
|
|
34
|
+
//# sourceMappingURL=agent-package.d.ts.map
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Check-run read CLI command for kici-admin.
|
|
3
|
+
*
|
|
4
|
+
* check-run list --sha <sha> [--check-name <name>] [--limit <n>] [--json]
|
|
5
|
+
*
|
|
6
|
+
* READ-ONLY. Answers "did we post that check run?" — the question that
|
|
7
|
+
* previously needed raw SQL against `check_run_tracking`.
|
|
8
|
+
*
|
|
9
|
+
* Each column answers a different half of it:
|
|
10
|
+
* - CHECK_RUN_ID the check run was created at the provider.
|
|
11
|
+
* - CREATE_STATE stamped `pending` BEFORE the create and never reset on
|
|
12
|
+
* failure, so `pending` distinguishes an in-flight create
|
|
13
|
+
* from a missing one — it does not prove success.
|
|
14
|
+
* - TERMINAL_SENT the terminal `completed` update was accepted by the
|
|
15
|
+
* provider.
|
|
16
|
+
*
|
|
17
|
+
* Every write on this table is best-effort, so an em dash is "no record", never
|
|
18
|
+
* proof that the call failed.
|
|
19
|
+
*
|
|
20
|
+
* Direct-DB only: there is no admin HTTP route for check-run tracking, so this
|
|
21
|
+
* requires `--database-url` (or `KICI_DATABASE_URL`) the same way `attestations`,
|
|
22
|
+
* `cluster` and `cold-store` do.
|
|
23
|
+
*/
|
|
24
|
+
import type { Command } from 'commander';
|
|
25
|
+
export declare function registerCheckRunCommands(program: Command): void;
|
|
26
|
+
//# sourceMappingURL=check-run.d.ts.map
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cluster-settings management commands for kici-admin.
|
|
3
|
+
*
|
|
4
|
+
* Subcommand namespace: `kici-admin cluster-settings <show|set|reset>`.
|
|
5
|
+
*
|
|
6
|
+
* Talks to the orchestrator admin API directly (not the Platform dashboard
|
|
7
|
+
* proxy), so the CLI stays operable even when Platform is unavailable. Backed
|
|
8
|
+
* by `packages/orchestrator/src/routes/admin-cluster-settings.ts`.
|
|
9
|
+
*
|
|
10
|
+
* These knobs are fleet-wide (a single `cluster_settings` row), not per-tenant.
|
|
11
|
+
* For per-tenant knobs use `kici-admin org-settings`.
|
|
12
|
+
*/
|
|
13
|
+
import type { Command } from 'commander';
|
|
14
|
+
import type { AdminApiClient } from '../api-client.js';
|
|
15
|
+
/**
|
|
16
|
+
* One text knob. Kept separate from {@link KnobSpec} because the value parser,
|
|
17
|
+
* the PATCH body type, and the `show` formatter all differ — a string knob has
|
|
18
|
+
* no `min` floor and is validated by shape, not by magnitude.
|
|
19
|
+
*/
|
|
20
|
+
interface StringKnobSpec {
|
|
21
|
+
field: string;
|
|
22
|
+
flag: string;
|
|
23
|
+
label: string;
|
|
24
|
+
/** Human-facing description of the accepted shape, used in the error message. */
|
|
25
|
+
expects: string;
|
|
26
|
+
validate: (value: string) => boolean;
|
|
27
|
+
}
|
|
28
|
+
/** camelCase → value (null clears the override). */
|
|
29
|
+
type PatchBody = Record<string, number | string | null>;
|
|
30
|
+
/** Parse an integer CLI flag with a minimum, exiting with an error on failure. */
|
|
31
|
+
export declare function parseKnobValue(flag: string, value: string, min: number): number;
|
|
32
|
+
/** Validate a text CLI flag against its knob's shape, exiting on failure. */
|
|
33
|
+
export declare function parseStringKnobValue(knob: StringKnobSpec, value: string): string;
|
|
34
|
+
/** Assemble the PATCH body from provided `set` flags (exits if none given). */
|
|
35
|
+
export declare function buildClusterPatch(opts: Record<string, string | undefined>): PatchBody;
|
|
36
|
+
/** Build the reset PATCH body: all knobs → null, or just the flagged ones. */
|
|
37
|
+
export declare function buildClusterReset(opts: Record<string, boolean | undefined>): PatchBody;
|
|
38
|
+
/**
|
|
39
|
+
* Check that `issuer` actually publishes a dashboard-encryption key.
|
|
40
|
+
*
|
|
41
|
+
* Runs after the setting has already been written, so it never throws: a
|
|
42
|
+
* network fault, a non-2xx status and a malformed body all come back as a
|
|
43
|
+
* `reason` the caller prints as a warning. The check is advisory — the CLI may
|
|
44
|
+
* sit in a different network position than the browser that will do the real
|
|
45
|
+
* fetch, so a failure is definitive but a pass is not a guarantee.
|
|
46
|
+
*/
|
|
47
|
+
export declare function checkVerifiedIssuerPublishes(issuer: string, fetchImpl?: typeof fetch): Promise<{
|
|
48
|
+
ok: true;
|
|
49
|
+
} | {
|
|
50
|
+
ok: false;
|
|
51
|
+
reason: string;
|
|
52
|
+
}>;
|
|
53
|
+
export declare function registerClusterSettingsCommands(program: Command, getClient: () => AdminApiClient): void;
|
|
54
|
+
export {};
|
|
55
|
+
//# sourceMappingURL=cluster-settings.d.ts.map
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import os from 'node:os';
|
|
2
|
+
import type { Kysely } from 'kysely';
|
|
3
|
+
import type { Database, NewBackupRun } from '../../db/types.js';
|
|
4
|
+
export type RunFn = (bin: string, args: string[], opts?: {
|
|
5
|
+
env?: NodeJS.ProcessEnv;
|
|
6
|
+
}) => Promise<{
|
|
7
|
+
stdout: string;
|
|
8
|
+
stderr: string;
|
|
9
|
+
}>;
|
|
10
|
+
export type FsLike = {
|
|
11
|
+
writeFile: (path: string, data: string) => Promise<void>;
|
|
12
|
+
readFile: (path: string) => Promise<string>;
|
|
13
|
+
};
|
|
14
|
+
export interface BackupManifest {
|
|
15
|
+
createdAt: string;
|
|
16
|
+
byteSize: number;
|
|
17
|
+
secretKeyVersion: number | null;
|
|
18
|
+
pgServerVersion: string;
|
|
19
|
+
migrationsHash: string;
|
|
20
|
+
clusterId: string | null;
|
|
21
|
+
hostname: string;
|
|
22
|
+
}
|
|
23
|
+
export declare function manifestPath(dumpPath: string): string;
|
|
24
|
+
export declare function defaultDumpPath(now: Date): string;
|
|
25
|
+
export declare function parsePgToolMajor(versionOutput: string): number;
|
|
26
|
+
export declare function serverVersionMajor(numStr: string): number;
|
|
27
|
+
export declare function assertToolVersionCompatible(toolMajor: number, serverMajor: number, tool: 'pg_dump' | 'pg_restore'): void;
|
|
28
|
+
export declare function pgToolVersion(bin: 'pg_dump' | 'pg_restore', run?: RunFn): Promise<number>;
|
|
29
|
+
export declare function writeManifest(dumpPath: string, m: BackupManifest, fs?: FsLike): Promise<void>;
|
|
30
|
+
export declare function readManifest(dumpPath: string, fs?: FsLike): Promise<BackupManifest | null>;
|
|
31
|
+
export declare function readServerAndKeyMeta(pool: import('pg').Pool): Promise<{
|
|
32
|
+
serverVersionNum: string;
|
|
33
|
+
secretKeyVersion: number | null;
|
|
34
|
+
clusterId: string | null;
|
|
35
|
+
}>;
|
|
36
|
+
/**
|
|
37
|
+
* Translate a libpq connection URL into a PG* environment overlay. The
|
|
38
|
+
* connection URL (which embeds the DB password) MUST NOT be passed as a
|
|
39
|
+
* pg_dump/pg_restore argv element: `/proc/<pid>/cmdline` is world-readable, so
|
|
40
|
+
* a URL-in-argv leaks the DB password to every local user for the tool's
|
|
41
|
+
* lifetime. libpq reads PGHOST/PGPORT/PGUSER/PGPASSWORD/PGDATABASE/PGSSLMODE
|
|
42
|
+
* from the environment (`/proc/<pid>/environ`, owner-only 0400) instead — the
|
|
43
|
+
* same credential-off-the-command-line discipline used elsewhere in the repo.
|
|
44
|
+
* Only the components that are actually present are set, so socket / trust
|
|
45
|
+
* connections (no password, no port) are left untouched.
|
|
46
|
+
*/
|
|
47
|
+
export declare function pgEnvFromUrl(url: string): NodeJS.ProcessEnv;
|
|
48
|
+
export declare function runPgDump(url: string, outputPath: string, run?: RunFn): Promise<void>;
|
|
49
|
+
export declare function runPgRestore(url: string, inputPath: string, run?: RunFn): Promise<void>;
|
|
50
|
+
export declare function recordBackupRun(db: Kysely<Database>, row: NewBackupRun): Promise<void>;
|
|
51
|
+
export declare function buildBackupManifest(input: {
|
|
52
|
+
now: Date;
|
|
53
|
+
byteSize: number;
|
|
54
|
+
serverVersionNum: string;
|
|
55
|
+
secretKeyVersion: number | null;
|
|
56
|
+
clusterId: string | null;
|
|
57
|
+
migrationsHash: string;
|
|
58
|
+
hostname: string;
|
|
59
|
+
}): BackupManifest;
|
|
60
|
+
/**
|
|
61
|
+
* Message to print after a restore about the secret-key requirement. Returns
|
|
62
|
+
* null when the dump carried no encrypted secrets (nothing to warn about),
|
|
63
|
+
* a loud warning when secrets exist but no `KICI_SECRET_KEY` is set on the box,
|
|
64
|
+
* or an informational reminder when a key IS set (it must be the matching one).
|
|
65
|
+
*/
|
|
66
|
+
export declare function restoreKeyWarning(input: {
|
|
67
|
+
secretKeyVersion: number | null;
|
|
68
|
+
keyEnvPresent: boolean;
|
|
69
|
+
}): string | null;
|
|
70
|
+
export { os };
|
|
71
|
+
//# sourceMappingURL=db-backup.d.ts.map
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `kici-admin orchestrator drain` / `resume` CLI verbs.
|
|
3
|
+
*
|
|
4
|
+
* Quiesce a coordinator before an upgrade: stop dispatching new jobs, let
|
|
5
|
+
* in-flight jobs finish, report when quiesced. `--wait` polls status
|
|
6
|
+
* client-side until `jobsRunning` reaches 0 or the timeout elapses; exit codes
|
|
7
|
+
* are scriptable (0 quiesced/initiated, 2 wait timed out, 1 error).
|
|
8
|
+
*/
|
|
9
|
+
import type { Command } from 'commander';
|
|
10
|
+
import type { AdminApiClient } from '../../api-client.js';
|
|
11
|
+
type Snapshot = {
|
|
12
|
+
draining: boolean;
|
|
13
|
+
jobsRunning: number;
|
|
14
|
+
};
|
|
15
|
+
export interface WaitOpts {
|
|
16
|
+
timeoutMs: number;
|
|
17
|
+
intervalMs: number;
|
|
18
|
+
now?: () => number;
|
|
19
|
+
sleep?: (ms: number) => Promise<void>;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Poll `poll` until jobsRunning hits 0 or the timeout elapses. Pure with an
|
|
23
|
+
* injectable clock + sleep so it is testable without real time.
|
|
24
|
+
*/
|
|
25
|
+
export declare function waitForQuiesce(poll: () => Promise<Snapshot>, opts: WaitOpts): Promise<{
|
|
26
|
+
quiesced: boolean;
|
|
27
|
+
jobsRunning: number;
|
|
28
|
+
}>;
|
|
29
|
+
export declare function registerOrchestratorDrain(orchestrator: Command, getClient: () => AdminApiClient): void;
|
|
30
|
+
export {};
|
|
31
|
+
//# sourceMappingURL=drain.d.ts.map
|
|
@@ -2,11 +2,14 @@
|
|
|
2
2
|
* Orchestrator service command group registration.
|
|
3
3
|
*
|
|
4
4
|
* Registers `kici-admin orchestrator` with install, uninstall, start, stop,
|
|
5
|
-
* restart, status, logs, and
|
|
6
|
-
* as a system service.
|
|
5
|
+
* restart, status, logs, upgrade, drain, and resume subcommands for managing the
|
|
6
|
+
* orchestrator as a system service.
|
|
7
7
|
*
|
|
8
|
-
*
|
|
8
|
+
* The lifecycle verbs (install/start/stop/…) manage local services directly and
|
|
9
|
+
* do NOT use AdminApiClient. The drain/resume verbs DO — they talk to the running
|
|
10
|
+
* coordinator's admin HTTP API to quiesce it before an upgrade.
|
|
9
11
|
*/
|
|
10
12
|
import type { Command } from 'commander';
|
|
11
|
-
|
|
13
|
+
import type { AdminApiClient } from '../../api-client.js';
|
|
14
|
+
export declare function registerOrchestratorServiceCommands(program: Command, getClient: () => AdminApiClient): void;
|
|
12
15
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Env-file resolution + content for `kici-admin orchestrator install`.
|
|
3
|
+
*
|
|
4
|
+
* Three write paths — the interactive wizard, copying a supplied --env-file,
|
|
5
|
+
* or writing an enumerated stub the operator fills in by hand — plus the
|
|
6
|
+
* flag/TTY precedence that picks between them. Kept out of install.ts so the
|
|
7
|
+
* command action stays small and the decision + stub content are unit-testable
|
|
8
|
+
* without driving the whole install through Commander.
|
|
9
|
+
*/
|
|
10
|
+
import type { OrchestratorSourceHint } from '../../wizard/orchestrator-wizard.js';
|
|
11
|
+
/** Which config source the install writes the env file from. */
|
|
12
|
+
export type InstallEnvMode = 'wizard' | 'env-file' | 'stub';
|
|
13
|
+
/** Result of writing the install env file. */
|
|
14
|
+
export interface WriteInstallEnvResult {
|
|
15
|
+
/** Present only in wizard mode when the operator opted into a GitHub App source. */
|
|
16
|
+
sourceHint?: OrchestratorSourceHint;
|
|
17
|
+
}
|
|
18
|
+
/** Public compose quickstart, pointed at from the stub env file. */
|
|
19
|
+
export declare const COMPOSE_QUICKSTART_URL = "https://docs.kici.dev/user/quickstart/compose/";
|
|
20
|
+
export interface WizardModeInput {
|
|
21
|
+
/** --wizard=true / --no-wizard=false / undefined when neither is passed. */
|
|
22
|
+
wizard?: boolean;
|
|
23
|
+
/** --env-file value, if any. */
|
|
24
|
+
envFile?: string;
|
|
25
|
+
/** --dev (spins up a local Postgres and fills the DB URL). */
|
|
26
|
+
dev?: boolean;
|
|
27
|
+
/** Whether stdout is attached to an interactive terminal. */
|
|
28
|
+
isTTY: boolean;
|
|
29
|
+
/** Whether the process runs under CI (non-interactive). */
|
|
30
|
+
isCI: boolean;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Pick the install env mode. Precedence: an explicit --env-file wins; then an
|
|
34
|
+
* explicit --wizard / --no-wizard; --dev keeps the stub (it provisions the DB,
|
|
35
|
+
* so the wizard's DB prompt would be redundant); otherwise the wizard is the
|
|
36
|
+
* default only on a bare interactive terminal (mirrors `kici init`), and every
|
|
37
|
+
* non-interactive/scripted install writes the stub.
|
|
38
|
+
*/
|
|
39
|
+
export declare function resolveWizardMode(input: WizardModeInput): InstallEnvMode;
|
|
40
|
+
/**
|
|
41
|
+
* Build the stub env file: every required key with an inline explanation, a
|
|
42
|
+
* generation command for the two secrets, and a pointer to the compose
|
|
43
|
+
* quickstart. Fills KICI_DATABASE_URL from a --dev container URL when present.
|
|
44
|
+
*/
|
|
45
|
+
export declare function buildStubEnv(opts: {
|
|
46
|
+
devDbUrl?: string;
|
|
47
|
+
}): string;
|
|
48
|
+
export interface WriteInstallEnvArgs {
|
|
49
|
+
mode: InstallEnvMode;
|
|
50
|
+
envFilePath: string;
|
|
51
|
+
/** Source path for env-file mode. */
|
|
52
|
+
envFileSource?: string;
|
|
53
|
+
/** Dev-provisioned DB URL, threaded into the stub / appended to an env file. */
|
|
54
|
+
devDbUrl?: string;
|
|
55
|
+
}
|
|
56
|
+
/** Materialise the env file for the resolved mode. */
|
|
57
|
+
export declare function writeInstallEnvFile(args: WriteInstallEnvArgs): Promise<WriteInstallEnvResult>;
|
|
58
|
+
//# sourceMappingURL=install-env.d.ts.map
|
|
@@ -2,11 +2,55 @@
|
|
|
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, fix-prefixed-scopes
|
|
6
6
|
*
|
|
7
7
|
* Secret values are write-only -- there is no "get value" command.
|
|
8
8
|
*/
|
|
9
9
|
import type { Command } from 'commander';
|
|
10
10
|
import type { AdminApiClient } from '../api-client.js';
|
|
11
|
+
/** One planned rename from a stored qualified scope to its bare path. */
|
|
12
|
+
export interface PrefixedScopeRename {
|
|
13
|
+
from: string;
|
|
14
|
+
to: string;
|
|
15
|
+
backendName: string;
|
|
16
|
+
}
|
|
17
|
+
/** One stored scope that cannot be repaired automatically. */
|
|
18
|
+
export interface PrefixedScopeSkip {
|
|
19
|
+
scope: string;
|
|
20
|
+
reason: string;
|
|
21
|
+
}
|
|
22
|
+
/** Outcome of planning the repair of legacy qualifier-bearing scopes. */
|
|
23
|
+
export interface PrefixedScopeFixPlan {
|
|
24
|
+
renames: PrefixedScopeRename[];
|
|
25
|
+
skips: PrefixedScopeSkip[];
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Plan the repair of scopes stored with a `<backend>:` qualifier still attached.
|
|
29
|
+
*
|
|
30
|
+
* Before backend-qualified routing landed on the HTTP admin plane, a scope
|
|
31
|
+
* written as `pg:production` was stored verbatim, so the stored name carries a
|
|
32
|
+
* qualifier the resolver now strips before it reaches the store. Such a row is
|
|
33
|
+
* unreachable: every read addresses the bare `production`.
|
|
34
|
+
*
|
|
35
|
+
* Only a `pg:` qualifier is repaired. The scopes handed in come out of the PG
|
|
36
|
+
* store, so a row named `vault:foo` is a PG row wearing another backend's
|
|
37
|
+
* name: renaming it to `foo` would turn it into a genuine PG secret, moving it
|
|
38
|
+
* across a backend boundary and past a `pgCustomerSecrets: false` setting that
|
|
39
|
+
* exists to keep customer secrets out of PG. That is the same cross-backend
|
|
40
|
+
* move the rename route refuses, so it is reported as a skip instead.
|
|
41
|
+
*
|
|
42
|
+
* An unregistered head is left alone entirely -- it is an ordinary (if
|
|
43
|
+
* unusual) scope path, not a stale qualifier.
|
|
44
|
+
*
|
|
45
|
+
* A repair whose bare target already exists is SKIPPED, never merged: merging
|
|
46
|
+
* two scopes would silently overwrite whichever key the two share, and there
|
|
47
|
+
* is no way to tell which value the operator meant to keep.
|
|
48
|
+
*
|
|
49
|
+
* Pure -- no I/O, so the decision table is unit-testable without a database.
|
|
50
|
+
*
|
|
51
|
+
* @param scopes - Scope names as currently stored in the PG backend.
|
|
52
|
+
* @param backendNames - Names of the registered secret backends.
|
|
53
|
+
*/
|
|
54
|
+
export declare function planPrefixedScopeFixes(scopes: string[], backendNames: string[]): PrefixedScopeFixPlan;
|
|
11
55
|
export declare function registerSecretCommands(program: Command, getClient: () => AdminApiClient): void;
|
|
12
56
|
//# sourceMappingURL=secret.d.ts.map
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared access-log recorder for the direct-DB kici-admin subcommands.
|
|
3
|
+
*
|
|
4
|
+
* The mutating db / host subcommands act straight against Postgres (bypassing
|
|
5
|
+
* the orchestrator HTTP admin API), so without this they would leave no
|
|
6
|
+
* `access_log` trail — unlike the HTTP/WS admin path. This helper records one
|
|
7
|
+
* `admin_cli`-source row per mutation, attributed to a service_account actor
|
|
8
|
+
* derived from the operator's OS identity, so the audit story is identical
|
|
9
|
+
* regardless of transport.
|
|
10
|
+
*
|
|
11
|
+
* Best-effort by design: the orchestrator access_log is a broad audit stream
|
|
12
|
+
* whose writer swallows insert failures so a broken audit table can never take
|
|
13
|
+
* down an admin command. This recorder inherits that contract.
|
|
14
|
+
*/
|
|
15
|
+
import type { Kysely } from 'kysely';
|
|
16
|
+
import { type AccessLogAction, type AccessLogOutcome, type AccessLogTargetType, type ServiceAccountActor } from '@kici-dev/engine';
|
|
17
|
+
import type { Database } from '../../../db/types.js';
|
|
18
|
+
export interface AdminCliAccessEntry {
|
|
19
|
+
action: AccessLogAction;
|
|
20
|
+
target: {
|
|
21
|
+
type: AccessLogTargetType;
|
|
22
|
+
id: string;
|
|
23
|
+
} | null;
|
|
24
|
+
outcome: AccessLogOutcome;
|
|
25
|
+
errorMessage?: string | null;
|
|
26
|
+
meta?: Record<string, unknown>;
|
|
27
|
+
orgId?: string | null;
|
|
28
|
+
routingKey?: string | null;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* The actor for a bare-metal CLI operator. There is no Keycloak sub on the
|
|
32
|
+
* box, so we attribute to a service_account keyed on the OS identity — the
|
|
33
|
+
* same actor family the HTTP CLI-driven admin routes use.
|
|
34
|
+
*/
|
|
35
|
+
export declare function adminCliActor(): ServiceAccountActor;
|
|
36
|
+
/** Record on an already-open orchestrator-DB Kysely handle. Never throws. */
|
|
37
|
+
export declare function recordAdminCliAccessOnDb(db: Kysely<Database>, entry: AdminCliAccessEntry): Promise<void>;
|
|
38
|
+
/**
|
|
39
|
+
* Open a short-lived connection to the orchestrator's own DB (auditDbUrl, or
|
|
40
|
+
* KICI_DATABASE_URL) and record there. Used by the provisioning subcommands
|
|
41
|
+
* whose own connection targets a schemaless / admin DB with no access_log
|
|
42
|
+
* table. A best-effort no-op when no URL resolves (pure bootstrap): the
|
|
43
|
+
* subcommand's stderr banner is the audit floor in that case.
|
|
44
|
+
*/
|
|
45
|
+
export declare function recordAdminCliAccess(entry: AdminCliAccessEntry, auditDbUrl?: string): Promise<void>;
|
|
46
|
+
//# sourceMappingURL=admin-cli-access-log.d.ts.map
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
* - Preserve old versions for rollback
|
|
8
8
|
* - Optional cleanup of old versions
|
|
9
9
|
*/
|
|
10
|
-
import { type ResolvedInstance, type ServiceManager, type ServicePlatform } from '../../service/index.js';
|
|
11
|
-
import type { ServiceConfig } from '../../service/types.js';
|
|
10
|
+
import { type NpmInstallTarget, type ResolvedInstance, type ServiceManager, type ServicePlatform } from '../../service/index.js';
|
|
11
|
+
import type { LaunchSpec, ServiceConfig } from '../../service/types.js';
|
|
12
12
|
/** Component types that can be upgraded. */
|
|
13
13
|
type UpgradeComponent = 'orchestrator' | 'agent';
|
|
14
14
|
/** Options for the versioned upgrade command. */
|
|
@@ -29,6 +29,11 @@ interface VersionedUpgradeOptions {
|
|
|
29
29
|
rollback?: boolean;
|
|
30
30
|
pick?: boolean;
|
|
31
31
|
force?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Opt-in escape hatch: restart the already-installed package without
|
|
34
|
+
* self-driving the npm install (the pre-staged / air-gapped path).
|
|
35
|
+
*/
|
|
36
|
+
restartOnly?: boolean;
|
|
32
37
|
}
|
|
33
38
|
/**
|
|
34
39
|
* Resolved upgrade target: the manifest-backed ServiceConfig the upgrade
|
|
@@ -157,6 +162,64 @@ export declare function verifyNpmSourceLaunch(opts: {
|
|
|
157
162
|
launchedPath: string | null;
|
|
158
163
|
force: boolean;
|
|
159
164
|
}): NpmSourceLaunchVerdict;
|
|
165
|
+
/**
|
|
166
|
+
* An npm-source upgrade proceeds one of three ways: restart the already-installed
|
|
167
|
+
* package (`restart-only`, carrying a {@link NpmSourceLaunchVerdict}), self-drive
|
|
168
|
+
* the install of a resolved target under the unit's own runtime (`self-drive`),
|
|
169
|
+
* or refuse with an operator-facing message (`error`).
|
|
170
|
+
*/
|
|
171
|
+
export type NpmSourceUpgradeAction = {
|
|
172
|
+
kind: 'restart-only';
|
|
173
|
+
verdict: NpmSourceLaunchVerdict;
|
|
174
|
+
} | {
|
|
175
|
+
kind: 'self-drive';
|
|
176
|
+
target: NpmInstallTarget;
|
|
177
|
+
version: string;
|
|
178
|
+
} | {
|
|
179
|
+
kind: 'error';
|
|
180
|
+
reason: string;
|
|
181
|
+
};
|
|
182
|
+
/**
|
|
183
|
+
* Decide how an npm-source upgrade proceeds. `restart-only` re-verifies and
|
|
184
|
+
* restarts the already-installed package (the pre-staged / air-gapped path).
|
|
185
|
+
* The default self-drives: it resolves the global package + pinned node from
|
|
186
|
+
* the unit's launch spec so the CLI can install the target itself. Returns an
|
|
187
|
+
* `error` action (not a throw) for the two operator-facing refusals.
|
|
188
|
+
*/
|
|
189
|
+
export declare function planNpmSourceUpgrade(opts: {
|
|
190
|
+
component: UpgradeComponent;
|
|
191
|
+
spec: LaunchSpec | null;
|
|
192
|
+
invoked: string;
|
|
193
|
+
requestedVersion: string | undefined;
|
|
194
|
+
restartOnly: boolean;
|
|
195
|
+
force: boolean;
|
|
196
|
+
windows: boolean;
|
|
197
|
+
}): NpmSourceUpgradeAction;
|
|
198
|
+
/** Injected process runner seam for {@link installGlobalPackage}. */
|
|
199
|
+
type SpawnRunner = (cmd: string, args: string[], opts?: {
|
|
200
|
+
env?: NodeJS.ProcessEnv;
|
|
201
|
+
}) => {
|
|
202
|
+
status: number | null;
|
|
203
|
+
stderr: string;
|
|
204
|
+
};
|
|
205
|
+
/**
|
|
206
|
+
* Install `<owningPackage>@<version>` globally under the unit's own pinned node,
|
|
207
|
+
* so it lands in exactly the global prefix the unit's ExecStart resolves from.
|
|
208
|
+
*
|
|
209
|
+
* npm derives its global prefix from the node that *runs* npm-cli.js, not from
|
|
210
|
+
* the location of the npm script — and the unit's `<pinned>/bin/npm` is a
|
|
211
|
+
* `#!/usr/bin/env node` shebang (or a version-manager bash wrapper invoking a
|
|
212
|
+
* bare `node`), both of which resolve `node` off PATH. So invoking that npm
|
|
213
|
+
* bare would inherit whatever node the shell has active — exactly the
|
|
214
|
+
* version-manager (mise/nvm/asdf) drift this upgrade exists to fix. We prepend
|
|
215
|
+
* the pinned node's bin dir to PATH so npm always runs under the unit's node
|
|
216
|
+
* and computes the unit's prefix, regardless of the caller's active node. The
|
|
217
|
+
* `run` seam is injected in tests.
|
|
218
|
+
*/
|
|
219
|
+
export declare function installGlobalPackage(target: NpmInstallTarget, version: string, run?: SpawnRunner): {
|
|
220
|
+
ok: boolean;
|
|
221
|
+
stderr: string;
|
|
222
|
+
};
|
|
160
223
|
export declare function performVersionedUpgrade(component: UpgradeComponent, opts: VersionedUpgradeOptions): Promise<void>;
|
|
161
224
|
/**
|
|
162
225
|
* Stop the service, switch the active version pointer to an already-installed
|
|
@@ -20,5 +20,17 @@
|
|
|
20
20
|
*/
|
|
21
21
|
import type { Command } from 'commander';
|
|
22
22
|
import type { AdminApiClient } from '../api-client.js';
|
|
23
|
+
/** Error shown when both the private key and the webhook secret ask for stdin. */
|
|
24
|
+
export declare const BOTH_STDIN_ERROR = "cannot read both the private key and the webhook secret from stdin \u2014 use @file or --from-env for one of them";
|
|
25
|
+
/**
|
|
26
|
+
* Resolve the `--webhook-secret` value. A literal value passes through; `-`
|
|
27
|
+
* reads the secret from stdin; absent stays undefined. The private key can also
|
|
28
|
+
* be piped via `--stdin`, and stdin can only be consumed once — so `-` here
|
|
29
|
+
* while the private key also reads stdin is a hard error.
|
|
30
|
+
*/
|
|
31
|
+
export declare function resolveWebhookSecret(opts: {
|
|
32
|
+
value?: string;
|
|
33
|
+
privateKeyFromStdin: boolean;
|
|
34
|
+
}, readStdin?: () => Promise<string>): Promise<string | undefined>;
|
|
23
35
|
export declare function registerSourceCommands(program: Command, getClient: () => AdminApiClient): void;
|
|
24
36
|
//# sourceMappingURL=source.d.ts.map
|
|
@@ -6,5 +6,14 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import type { Command } from 'commander';
|
|
8
8
|
import type { AdminApiClient } from '../api-client.js';
|
|
9
|
+
/**
|
|
10
|
+
* Parse a `--expires` value into an absolute expiry Date.
|
|
11
|
+
*
|
|
12
|
+
* Accepts either a duration shorthand relative to now (`<N>d` days,
|
|
13
|
+
* `<N>h` hours, `<N>m` minutes — e.g. `30d`, `12h`, `45m`) or an
|
|
14
|
+
* absolute ISO-8601 datetime (e.g. `2026-12-31T00:00:00Z`). Throws on any
|
|
15
|
+
* other input so a typo never silently creates a non-expiring token.
|
|
16
|
+
*/
|
|
17
|
+
export declare function parseExpiresAt(input: string, now?: Date): Date;
|
|
9
18
|
export declare function registerTokenCommands(program: Command, getClient: () => AdminApiClient): void;
|
|
10
19
|
//# sourceMappingURL=token.d.ts.map
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Org trust-policy commands for kici-admin.
|
|
3
|
+
*
|
|
4
|
+
* Subcommand namespace: `kici-admin trust-policy <show|set>`.
|
|
5
|
+
*
|
|
6
|
+
* Talks to the orchestrator admin API directly (not the Platform dashboard
|
|
7
|
+
* proxy), so the CLI stays operable even when Platform is unavailable. Backed
|
|
8
|
+
* by `packages/orchestrator/src/routes/admin-trust-policy.ts`.
|
|
9
|
+
*
|
|
10
|
+
* `set` only works on an independent orchestrator. Wherever a Platform is
|
|
11
|
+
* attached the Platform owns the policy and the route refuses with 409; the
|
|
12
|
+
* message is surfaced verbatim rather than reworded here, so the CLI cannot
|
|
13
|
+
* drift from what the server actually said.
|
|
14
|
+
*/
|
|
15
|
+
import type { Command } from 'commander';
|
|
16
|
+
import { TrustPolicyEnforcement } from '../../security/trust-policy-gate.js';
|
|
17
|
+
import type { AdminApiClient } from '../api-client.js';
|
|
18
|
+
/**
|
|
19
|
+
* The policy shape the admin route returns.
|
|
20
|
+
*
|
|
21
|
+
* The four policy fields are OPTIONAL because the route omits them under
|
|
22
|
+
* `enforcement: 'legacy'` — there they would be values nothing enforces, and
|
|
23
|
+
* printing them is the false assurance this feature exists to remove.
|
|
24
|
+
*/
|
|
25
|
+
export interface TrustPolicyView {
|
|
26
|
+
customerId: string;
|
|
27
|
+
forkPolicy?: string;
|
|
28
|
+
unknownContributorPolicy?: string;
|
|
29
|
+
workflowChangePolicy?: string;
|
|
30
|
+
approvalExpiryHours?: number;
|
|
31
|
+
/** `policy` = the values below are enforced; `legacy` = only the legacy rule. */
|
|
32
|
+
enforcement?: TrustPolicyEnforcement;
|
|
33
|
+
source: string | null;
|
|
34
|
+
updatedAt: string | null;
|
|
35
|
+
effectiveDefault?: boolean;
|
|
36
|
+
platformManaged?: boolean;
|
|
37
|
+
}
|
|
38
|
+
/** Render the policy as an aligned table, or as JSON when asked. */
|
|
39
|
+
export declare function formatPolicy(policy: TrustPolicyView, format: string): string;
|
|
40
|
+
/**
|
|
41
|
+
* Turn CLI flags into a PATCH body, exiting on an unknown value.
|
|
42
|
+
*
|
|
43
|
+
* Validating here as well as on the route is deliberate: it turns a typo into a
|
|
44
|
+
* clear local message naming the accepted values instead of a 400 from the API.
|
|
45
|
+
*/
|
|
46
|
+
export declare function buildPolicyPatch(opts: Record<string, string | undefined>): Record<string, string | number>;
|
|
47
|
+
export declare function registerTrustPolicyCommands(program: Command, getClient: () => AdminApiClient): void;
|
|
48
|
+
//# sourceMappingURL=trust-policy.d.ts.map
|
package/dist/cli/join.d.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* writing the local YAML config.
|
|
7
7
|
*
|
|
8
8
|
* Usage:
|
|
9
|
-
* kici-admin join --token kici_join_v1.xxx.yyy --platform wss://
|
|
9
|
+
* kici-admin join --token kici_join_v1.xxx.yyy --platform wss://api.kici.dev/ws --api-key KEY
|
|
10
10
|
* kici-admin join --token kici_join_v1.xxx.yyy --peer https://orch-1:8080
|
|
11
11
|
*/
|
|
12
12
|
import type { Command } from 'commander';
|
|
@@ -12,9 +12,9 @@ export { detectPlatform, isRoot, kiciConfigRoot, getConfigDir, getLogDir, getCac
|
|
|
12
12
|
export { resolveUserLevel, type PrivilegeOpts } from './privilege.js';
|
|
13
13
|
export type { Component, InstanceManifest, IndexEntry, ResolveOptions, ResolvedInstance, } from './instance/types.js';
|
|
14
14
|
export { COMPONENTS, isComponent } from './instance/types.js';
|
|
15
|
-
export { manifestFilename, manifestPath, readManifest, writeManifest, readKiciVersion, resolveVersionFromLaunchSpec, } from './instance/manifest.js';
|
|
15
|
+
export { manifestFilename, manifestPath, readManifest, writeManifest, readKiciVersion, resolveVersionFromLaunchSpec, resolveNpmInstallTarget, type NpmInstallTarget, } from './instance/manifest.js';
|
|
16
16
|
export { indexPath, readIndex, writeIndex, appendIndexEntry, removeIndexEntry, } from './instance/index-file.js';
|
|
17
|
-
export { listInstances, resolveInstance, formatRefusal } from './instance/resolve.js';
|
|
17
|
+
export { listInstances, resolveInstance, formatRefusal, InstanceNotFoundError, } from './instance/resolve.js';
|
|
18
18
|
export type { ListedInstance, ResolveArgs, ListInstancesArgs } from './instance/resolve.js';
|
|
19
19
|
import type { ServiceManager, ServicePlatform } from './types.js';
|
|
20
20
|
/**
|
|
@@ -39,4 +39,21 @@ 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 global npm package + node runtime an npm-source upgrade must install
|
|
44
|
+
* into, derived from a unit's launch spec. `owningPackage` is the top-level
|
|
45
|
+
* global package whose ExecStart the unit runs — `kici-admin` when the
|
|
46
|
+
* component is loaded through its nested node_modules, or `@kici-dev/<component>`
|
|
47
|
+
* for a standalone install. `npmPath` is the npm co-located with the unit's
|
|
48
|
+
* pinned node, so `npm install -g` with it lands in exactly the prefix
|
|
49
|
+
* ExecStart resolves from, regardless of the shell's active node.
|
|
50
|
+
*/
|
|
51
|
+
export interface NpmInstallTarget {
|
|
52
|
+
nodeExecPath: string;
|
|
53
|
+
npmPath: string;
|
|
54
|
+
owningPackage: string;
|
|
55
|
+
}
|
|
56
|
+
export declare function resolveNpmInstallTarget(spec: LaunchSpec, component: Component, opts: {
|
|
57
|
+
windows: boolean;
|
|
58
|
+
}): NpmInstallTarget | null;
|
|
42
59
|
//# sourceMappingURL=manifest.d.ts.map
|
|
@@ -41,6 +41,17 @@ export interface ListInstancesArgs {
|
|
|
41
41
|
* the requested component + isUserLevel.
|
|
42
42
|
*/
|
|
43
43
|
export declare function listInstances(args: ListInstancesArgs): Promise<ListedInstance[]>;
|
|
44
|
+
/**
|
|
45
|
+
* Thrown by resolveInstance when `--name <n>` is given but no installed
|
|
46
|
+
* instance matches. Lifecycle commands catch this to treat stop/uninstall of
|
|
47
|
+
* a never-installed instance as an idempotent no-op. Distinct from the
|
|
48
|
+
* ambiguous-refusal and missing-manifest errors, which stay hard failures.
|
|
49
|
+
*/
|
|
50
|
+
export declare class InstanceNotFoundError extends Error {
|
|
51
|
+
readonly component: Component;
|
|
52
|
+
readonly instanceName: string;
|
|
53
|
+
constructor(component: Component, instanceName: string, message: string);
|
|
54
|
+
}
|
|
44
55
|
export interface ResolveArgs {
|
|
45
56
|
component: Component;
|
|
46
57
|
opts: ResolveOptions;
|