@kici-dev/orchestrator 0.1.26 → 0.2.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 +69 -8
- package/dist/approvals/apply-decision.d.ts +1 -1
- package/dist/approvals/step-approval-bridge.d.ts +1 -1
- 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/pending-inits.d.ts +4 -4
- 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 +51 -5
- 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/context.d.ts +25 -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/debug-bundle.d.ts +1 -1
- 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/commands/variable.d.ts +6 -6
- 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/service/windows.d.ts +6 -0
- package/dist/cli/wizard/orchestrator-wizard.d.ts +39 -11
- package/dist/cli.js +10263 -3667
- 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 +8 -6
- package/dist/config/types.d.ts +3 -2
- package/dist/config.d.ts +372 -46
- package/dist/contexts/binding-store.d.ts +36 -0
- package/dist/contexts/context-store.d.ts +100 -0
- package/dist/contexts/glob-specificity.d.ts +30 -0
- package/dist/{environments → contexts}/held-runs.d.ts +64 -32
- package/dist/{environments → contexts}/index.d.ts +1 -1
- package/dist/contexts/protection/aggregate.d.ts +43 -0
- package/dist/contexts/protection/branch-gate.d.ts +5 -0
- package/dist/contexts/protection/concurrency-gate.d.ts +4 -0
- package/dist/{environments → contexts}/protection/pipeline.d.ts +3 -3
- package/dist/contexts/protection/reviewer-gate.d.ts +4 -0
- package/dist/{environments → contexts}/protection/satisfiability.d.ts +22 -22
- package/dist/contexts/protection/trust-gate.d.ts +4 -0
- package/dist/contexts/protection/wait-timer-gate.d.ts +4 -0
- package/dist/contexts/variable-store.d.ts +39 -0
- 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 +94 -74
- package/dist/dashboard/handler.d.ts +63 -3
- package/dist/db/migration-test-harness.d.ts +41 -0
- package/dist/db/migrations/067_environments_to_contexts.d.ts +36 -0
- package/dist/db/migrations/068_request_idempotency.d.ts +17 -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/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 +499 -66
- 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 +19 -9
- package/dist/index.d.ts +2 -0
- package/dist/index.js +625 -22
- package/dist/lockfile-cache.d.ts +4 -0
- package/dist/lockfile-validate.d.ts +16 -9
- package/dist/metrics/prometheus.d.ts +114 -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 +76 -0
- package/dist/oidc/jwt.d.ts +18 -0
- package/dist/oidc/local-dev-signer.d.ts +31 -0
- package/dist/oidc/local-mint.d.ts +77 -0
- package/dist/oidc/oidc-mint-registration.d.ts +65 -0
- 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 +5 -4
- package/dist/pipeline/dispatch-matched-workflow.d.ts +44 -3
- package/dist/pipeline/inline-eval.d.ts +2 -2
- package/dist/pipeline/install-secrets-resolver.d.ts +25 -14
- package/dist/pipeline/{job-environments.d.ts → job-contexts.d.ts} +23 -23
- package/dist/pipeline/manual-schedule.d.ts +28 -14
- 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 +49 -13
- package/dist/pipeline/request-idempotency.d.ts +28 -0
- package/dist/pipeline/rerun.d.ts +20 -13
- package/dist/pipeline/resolve-sandbox-grant.d.ts +28 -0
- package/dist/pipeline/resume-workflow.d.ts +1 -1
- package/dist/pipeline/route-or-dispatch-jobs.d.ts +71 -0
- package/dist/pipeline/sandbox-allowlist-reader.d.ts +33 -0
- package/dist/pipeline/test-pipeline.d.ts +2 -2
- 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 +20 -0
- package/dist/provider-registry.d.ts +8 -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/index.d.ts +1 -0
- package/dist/providers/local/local-source-config.d.ts +1 -0
- 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/cleanup.d.ts +69 -8
- package/dist/queue/job-queue.d.ts +94 -14
- package/dist/queue/scheduled-job.d.ts +2 -2
- 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 +173 -17
- 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 +36 -36
- 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-contexts.d.ts +47 -0
- package/dist/routes/admin-events.d.ts +3 -0
- package/dist/routes/admin-orchestrator-drain.d.ts +35 -0
- package/dist/routes/admin-registrations.d.ts +2 -2
- 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/context-secret-resolver.d.ts +30 -0
- package/dist/secrets/dashboard-encryption-key.d.ts +48 -0
- package/dist/secrets/ephemeral-keys.d.ts +16 -0
- package/dist/secrets/index.d.ts +1 -1
- package/dist/secrets/pg-secret-store.d.ts +13 -3
- 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 +19 -32
- package/dist/secrets/token-manager.d.ts +5 -1
- package/dist/security/comment-handler.d.ts +1 -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 +44012 -32721
- package/dist/sources/source-manager.d.ts +24 -0
- package/dist/stale-detector/stale-run-detector.d.ts +8 -1
- package/dist/standalone.js +44106 -33690
- package/dist/storage/blob-routes.d.ts +16 -0
- 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-env-handler.d.ts → dashboard-context-handler.d.ts} +43 -25
- 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 +15 -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 +1245 -1793
- package/dist/cli/commands/environment.d.ts +0 -25
- package/dist/environments/binding-store.d.ts +0 -36
- package/dist/environments/environment-store.d.ts +0 -87
- package/dist/environments/protection/aggregate.d.ts +0 -43
- package/dist/environments/protection/branch-gate.d.ts +0 -5
- package/dist/environments/protection/concurrency-gate.d.ts +0 -7
- package/dist/environments/protection/reviewer-gate.d.ts +0 -7
- package/dist/environments/protection/trust-gate.d.ts +0 -7
- package/dist/environments/protection/wait-timer-gate.d.ts +0 -7
- package/dist/environments/variable-store.d.ts +0 -39
- package/dist/routes/admin-environments.d.ts +0 -47
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Orchestrator-owned OIDC identity mint (production).
|
|
3
|
+
*
|
|
4
|
+
* Production sibling of `local-mint.ts`: the orchestrator mints the short-lived
|
|
5
|
+
* ES256 ID token for a build job LOCALLY from its own execution_runs/
|
|
6
|
+
* execution_jobs rows, signed with its own long-lived signing key (`Signer`),
|
|
7
|
+
* issued under its own real issuer. Zero hosted-Platform dependency.
|
|
8
|
+
*
|
|
9
|
+
* Anti-forgery is identical to the Platform-minted path and the local dev plane:
|
|
10
|
+
* every identity claim (run/job/repo/ref/sha/org) is read SERVER-SIDE from the
|
|
11
|
+
* orchestrator's own rows — never from the agent's wire input — and job ownership
|
|
12
|
+
* is resolved from dispatch state, never agent-asserted. The token is never
|
|
13
|
+
* logged.
|
|
14
|
+
*/
|
|
15
|
+
import type { Kysely } from 'kysely';
|
|
16
|
+
import { type OidcTokenResult } from '@kici-dev/engine/protocol/messages/oidc-token-relay';
|
|
17
|
+
import type { Database } from '../db/types.js';
|
|
18
|
+
import { type IdTokenClaims } from './id-token-claims.js';
|
|
19
|
+
import type { Signer } from './signer.js';
|
|
20
|
+
/** The org anchor stamped when a run has no routing key (sourceless / local plane). */
|
|
21
|
+
export declare const DEFAULT_ORG_ID = "__default__";
|
|
22
|
+
/** ID-token lifetime (seconds). Matches the Platform's 10-minute cap. */
|
|
23
|
+
export declare const ORCHESTRATOR_ID_TOKEN_TTL_SECONDS = 600;
|
|
24
|
+
export declare class OrchestratorMintRunNotFoundError extends Error {
|
|
25
|
+
}
|
|
26
|
+
export declare class OrchestratorMintJobNotFoundError extends Error {
|
|
27
|
+
}
|
|
28
|
+
export declare class OrchestratorMintJobNotActiveError extends Error {
|
|
29
|
+
}
|
|
30
|
+
export interface OrchestratorMintDeps {
|
|
31
|
+
db: Kysely<Database>;
|
|
32
|
+
signer: Signer;
|
|
33
|
+
/** The orchestrator's own provenance issuer identity (real URL). */
|
|
34
|
+
issuer: string;
|
|
35
|
+
orchestratorId: string;
|
|
36
|
+
ttlSeconds?: number;
|
|
37
|
+
/** Injectable clock (seconds). Defaults to wall-clock. */
|
|
38
|
+
nowSeconds?: () => number;
|
|
39
|
+
}
|
|
40
|
+
export interface OrchestratorMintInput {
|
|
41
|
+
runId: string;
|
|
42
|
+
jobId: string;
|
|
43
|
+
audience: string;
|
|
44
|
+
/**
|
|
45
|
+
* Deferred-fulfilment mint: knowingly targets a completed (terminal) job and
|
|
46
|
+
* binds the frozen statement hash + origin so the terminal-job check is
|
|
47
|
+
* relaxed and the mint-timing marker is stamped. The live agent path never
|
|
48
|
+
* sets this.
|
|
49
|
+
*/
|
|
50
|
+
deferred?: {
|
|
51
|
+
statementHash: string;
|
|
52
|
+
origin: 'deferred' | 'offline-backfill';
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
export interface OrchestratorMintResult {
|
|
56
|
+
token: string;
|
|
57
|
+
expiresIn: number;
|
|
58
|
+
jti: string;
|
|
59
|
+
claims: IdTokenClaims;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Mint a short-lived ES256 ID token for (run, job) from the orchestrator's own
|
|
63
|
+
* rows, signed with the orchestrator's signing key.
|
|
64
|
+
*/
|
|
65
|
+
export declare function mintOrchestratorIdToken(deps: OrchestratorMintDeps, input: OrchestratorMintInput): Promise<OrchestratorMintResult>;
|
|
66
|
+
/** Job-ownership resolver surface (the dispatcher's `resolveOwnedJob`). */
|
|
67
|
+
export interface OrchestratorMintOwnershipResolver {
|
|
68
|
+
resolveOwnedJob(agentId: string, jobId: string): {
|
|
69
|
+
runId: string;
|
|
70
|
+
} | undefined;
|
|
71
|
+
}
|
|
72
|
+
export declare class OrchestratorMintRejectedError extends Error {
|
|
73
|
+
}
|
|
74
|
+
/** unavailable: the signing key is not yet resolvable (leader election / cold start). */
|
|
75
|
+
export declare class OrchestratorMintSignerUnavailableError extends Error {
|
|
76
|
+
}
|
|
77
|
+
export interface OrchestratorOidcTokenHandlerDeps {
|
|
78
|
+
dispatcher: OrchestratorMintOwnershipResolver;
|
|
79
|
+
/**
|
|
80
|
+
* Lazily resolve the orchestrator's signing key. Resolved on first token
|
|
81
|
+
* request (not at boot) so it is unaffected by the Raft leader-election race —
|
|
82
|
+
* by the time an agent requests a token the cluster has a leader and the key
|
|
83
|
+
* exists. May return null while the key is still being reconciled.
|
|
84
|
+
*/
|
|
85
|
+
resolveSigner: () => Promise<Signer | null>;
|
|
86
|
+
/** Mint deps except the signer (supplied lazily via `resolveSigner`). */
|
|
87
|
+
mint: Omit<OrchestratorMintDeps, 'signer'>;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Build the agent.api handler for `OIDC_TOKEN_REQUEST_METHOD` when the
|
|
91
|
+
* orchestrator owns its signing key. Verifies the agent owns the named job
|
|
92
|
+
* (resolving its runId from the dispatcher — never an agent-asserted value),
|
|
93
|
+
* resolves the signing key lazily, then mints locally. A job the agent does not
|
|
94
|
+
* own is rejected without minting; an unresolved signer defers (never crashes).
|
|
95
|
+
*/
|
|
96
|
+
export declare function createOrchestratorOidcTokenHandler(deps: OrchestratorOidcTokenHandlerDeps): (agentId: string, params: Record<string, unknown>) => Promise<OidcTokenResult>;
|
|
97
|
+
//# sourceMappingURL=orchestrator-mint.d.ts.map
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { Signer } from './signer.js';
|
|
3
|
+
/** Custody backend for the orchestrator provenance signing key. */
|
|
4
|
+
export declare const OrchestratorSignerKind: z.ZodEnum<{
|
|
5
|
+
"aws-kms": "aws-kms";
|
|
6
|
+
command: "command";
|
|
7
|
+
db: "db";
|
|
8
|
+
}>;
|
|
9
|
+
export type OrchestratorSignerKind = z.infer<typeof OrchestratorSignerKind>;
|
|
10
|
+
/** The config slice the signer factory reads (subset of the orchestrator config). */
|
|
11
|
+
export interface OrchestratorSignerConfig {
|
|
12
|
+
/** When set, provenance signing is ON (the issuer identity). */
|
|
13
|
+
provenanceSigningIssuer?: string;
|
|
14
|
+
/** Custody kind; defaults to `db` when signing is on. */
|
|
15
|
+
provenanceSignerKind?: string;
|
|
16
|
+
provenanceKmsKeyArn?: string;
|
|
17
|
+
provenanceKmsRegion?: string;
|
|
18
|
+
provenanceKmsAccessKeyId?: string;
|
|
19
|
+
provenanceKmsSecretAccessKey?: string;
|
|
20
|
+
provenanceSignerCommand?: string;
|
|
21
|
+
}
|
|
22
|
+
/** True iff orchestrator-owned provenance signing is configured (issuer set). */
|
|
23
|
+
export declare function isProvenanceSigningEnabled(cfg: OrchestratorSignerConfig): boolean;
|
|
24
|
+
/** Resolve the configured custody kind (defaulting to `db`). Throws on an invalid value. */
|
|
25
|
+
export declare function resolveSignerKind(cfg: OrchestratorSignerConfig): OrchestratorSignerKind;
|
|
26
|
+
/**
|
|
27
|
+
* Build a NON-`db` (external-custody) signer from config. Returns null for `db`
|
|
28
|
+
* custody (whose generate-or-load lives in the boot reconcile, since the private
|
|
29
|
+
* key is created + persisted in the DB) and null when signing is off. Throws
|
|
30
|
+
* when an external kind is selected but its required config is incomplete.
|
|
31
|
+
*/
|
|
32
|
+
export declare function buildExternalSigner(cfg: OrchestratorSignerConfig): Promise<Signer | null>;
|
|
33
|
+
//# sourceMappingURL=orchestrator-signer-factory.d.ts.map
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type OrchestratorSignerConfig } from './orchestrator-signer-factory.js';
|
|
2
|
+
import type { Signer } from './signer.js';
|
|
3
|
+
import type { OrchestratorSigningKeyRepo } from '../db/repos/signing-keys-repo.js';
|
|
4
|
+
export interface ReconcileSigningKeyDeps {
|
|
5
|
+
repo: Pick<OrchestratorSigningKeyRepo, 'getActiveRow' | 'upsertActive'>;
|
|
6
|
+
config: OrchestratorSignerConfig;
|
|
7
|
+
isLeader: () => boolean;
|
|
8
|
+
/** The orchestrator master key (`KICI_SECRET_KEY`), for `db` custody wrapping. */
|
|
9
|
+
secretKey: string | undefined;
|
|
10
|
+
/** Called once when a NEW kid is first activated (audit log, system actor). */
|
|
11
|
+
audit: (info: {
|
|
12
|
+
kid: string;
|
|
13
|
+
signerKind: string;
|
|
14
|
+
keyRef: string | null;
|
|
15
|
+
}) => Promise<void> | void;
|
|
16
|
+
}
|
|
17
|
+
/** Reconcile + return the active signer, or null when signing is off / not yet ready. */
|
|
18
|
+
export declare function reconcileOrchestratorSigningKey(deps: ReconcileSigningKeyDeps): Promise<{
|
|
19
|
+
signer: Signer;
|
|
20
|
+
} | null>;
|
|
21
|
+
//# sourceMappingURL=reconcile-signing-key.d.ts.map
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type JWK } from 'jose';
|
|
2
|
+
/**
|
|
3
|
+
* Provider-agnostic signing seam for orchestrator-owned provenance. Verifiers
|
|
4
|
+
* never see which implementation runs (`db` / `aws-kms` / `command`). Ported from
|
|
5
|
+
* the Platform's `oidc/signer.ts` so the two stacks stay byte-compatible.
|
|
6
|
+
*/
|
|
7
|
+
export interface Signer {
|
|
8
|
+
/** JOSE alg of the produced signatures. */
|
|
9
|
+
readonly alg: 'ES256';
|
|
10
|
+
/** Backend discriminator persisted on the key row (db | aws-kms | command). */
|
|
11
|
+
readonly signerKind: string;
|
|
12
|
+
/** Provider-neutral key locator persisted on the row (KMS ARN, signer command, or null for db). */
|
|
13
|
+
readonly keyRef: string | null;
|
|
14
|
+
/** Sign `data` and return the JOSE-raw (r||s) ES256 signature. */
|
|
15
|
+
sign(data: Uint8Array): Promise<Uint8Array>;
|
|
16
|
+
/** The public key as a JWK (kty EC, crv P-256, alg ES256, use sig, kid). */
|
|
17
|
+
getPublicJwk(): Promise<JWK>;
|
|
18
|
+
/** RFC 7638 thumbprint of the public JWK. */
|
|
19
|
+
getKid(): Promise<string>;
|
|
20
|
+
}
|
|
21
|
+
/** Convert a DER-encoded ECDSA signature (KMS output) to JOSE-raw r||s of `size`*2 bytes. */
|
|
22
|
+
export declare function derToRawEcdsaSignature(der: Uint8Array, size?: number): Uint8Array;
|
|
23
|
+
/** Build the public JWK (with kid + alg + use) from a DER SPKI public key (KMS GetPublicKey output). */
|
|
24
|
+
export declare function derSpkiToPublicJwk(spkiDer: Uint8Array): Promise<JWK>;
|
|
25
|
+
//# sourceMappingURL=signer.d.ts.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Lifecycle of an orchestrator provenance signing key
|
|
4
|
+
* (orchestrator_signing_keys.status). Mirrors the Platform's status model so the
|
|
5
|
+
* rotation / retire / revoke semantics are identical.
|
|
6
|
+
*
|
|
7
|
+
* - active — the one current signing key.
|
|
8
|
+
* - retiring — just rotated out; still in the JWKS during the overlap window
|
|
9
|
+
* (in-flight short-lived JWTs minted just before rotation verify).
|
|
10
|
+
* - retired — no longer signs, but its public half STAYS in the trust root so
|
|
11
|
+
* historical attestations it signed remain verifiable. retired != removed.
|
|
12
|
+
* - revoked — compromised; REMOVED from the trust root; everything it signed is distrusted.
|
|
13
|
+
*/
|
|
14
|
+
export declare const SigningKeyStatus: z.ZodEnum<{
|
|
15
|
+
active: "active";
|
|
16
|
+
retired: "retired";
|
|
17
|
+
retiring: "retiring";
|
|
18
|
+
revoked: "revoked";
|
|
19
|
+
}>;
|
|
20
|
+
export type SigningKeyStatus = z.infer<typeof SigningKeyStatus>;
|
|
21
|
+
/** Statuses served in the JWKS / trusted for verification (everything except revoked). */
|
|
22
|
+
export declare const TRUSTED_STATUSES: readonly SigningKeyStatus[];
|
|
23
|
+
//# sourceMappingURL=signing-key-status.d.ts.map
|
|
@@ -21,19 +21,27 @@ import { Dispatcher } from './agent/dispatcher.js';
|
|
|
21
21
|
import { LockFileCache } from './lockfile-cache.js';
|
|
22
22
|
import { DedupCache } from './webhook/dedup.js';
|
|
23
23
|
import { ObserverRegistry } from './ws/observer-registry.js';
|
|
24
|
+
import { IngestAdmissionController } from './webhook/ingest-admission.js';
|
|
25
|
+
import { type OrgIngestCapReader } from './webhook/org-ingest-cap-reader.js';
|
|
26
|
+
import { type SandboxAllowListReader } from './pipeline/sandbox-allowlist-reader.js';
|
|
27
|
+
import { IngestOverflowBuffer } from './webhook/ingest-overflow-buffer.js';
|
|
28
|
+
import { IngestOverflowReplayer } from './webhook/ingest-overflow-replayer.js';
|
|
24
29
|
import { AgentMetricsAggregator } from './metrics/agent-metrics-aggregator.js';
|
|
25
30
|
import { SourceLocationStore } from './app.js';
|
|
26
|
-
import { ExecutionJobStatus, type LabelMatcher, type PeerHeartbeat, type PeerLogsCollectRequest, type PeerToPeerMessage } from '@kici-dev/engine';
|
|
31
|
+
import { ExecutionJobStatus, type LabelMatcher, type PeerHeartbeat, type PeerLogsCollectRequest, type PeerToPeerMessage, type ResolvedSandboxGrant } from '@kici-dev/engine';
|
|
27
32
|
import { ScalerManager } from './scaler/index.js';
|
|
28
33
|
import type { ScalerConfig } from './scaler/index.js';
|
|
29
34
|
import type { CacheStorage } from './storage/index.js';
|
|
30
35
|
import { type ProvenanceTrustRoot } from './provenance/trust-root.js';
|
|
36
|
+
import { type ResolvedDashboardEncryptionKey } from './secrets/dashboard-encryption-key.js';
|
|
31
37
|
import { SourceCache, BuildCoordinator, DepCache, UserCache, DispatchCacheRefTracker, PendingBuildTracker, PendingInitTracker, PendingDynamicTracker } from './cache/index.js';
|
|
38
|
+
import { ArtifactStore } from './artifacts/artifact-store.js';
|
|
32
39
|
import { CheckRunReporter } from './reporting/check-run-reporter.js';
|
|
33
40
|
import { StepLogBuffer } from './reporting/step-log-buffer.js';
|
|
34
41
|
import { type LogStorage } from './reporting/log-storage.js';
|
|
35
42
|
import { ExecutionTracker, type ExecutionTrackerDeps } from './reporting/execution-tracker.js';
|
|
36
43
|
import { LogWriter } from './reporting/log-writer.js';
|
|
44
|
+
import { type NormalizedLogChunk } from './reporting/log-chunk-sink.js';
|
|
37
45
|
import { PeerRegistry, PeerClient, createPeerHandler, RaftNode, OrphanRecovery, RunCoordinator } from './cluster/index.js';
|
|
38
46
|
import { SourceStore, SourceManager } from './sources/index.js';
|
|
39
47
|
import { PgSecretStore, AuditLogger, SecretResolver } from './secrets/index.js';
|
|
@@ -51,6 +59,7 @@ import { RegistrationStore } from './registration/registration-store.js';
|
|
|
51
59
|
import { RegistrationIndex } from './registration/registration-index.js';
|
|
52
60
|
import { CronScheduler } from './cron/cron-scheduler.js';
|
|
53
61
|
import { ProviderRegistry } from './provider-registry.js';
|
|
62
|
+
import { ClusterSettingsReader } from './cluster/cluster-settings-reader.js';
|
|
54
63
|
import { JoinHandler } from './cluster/join-handler.js';
|
|
55
64
|
import type { Kysely } from 'kysely';
|
|
56
65
|
import type { Database } from './db/types.js';
|
|
@@ -63,6 +72,8 @@ export interface OrchestratorSubsystems {
|
|
|
63
72
|
config: AppConfig;
|
|
64
73
|
db: Kysely<Database>;
|
|
65
74
|
pool: pg.Pool;
|
|
75
|
+
/** Cluster-global settings reader (fleet-wide tunables on cluster_settings). */
|
|
76
|
+
clusterSettings: ClusterSettingsReader;
|
|
66
77
|
providerRegistry: ProviderRegistry;
|
|
67
78
|
agentRegistry: AgentRegistry;
|
|
68
79
|
hostRosterStore: HostRosterStore;
|
|
@@ -80,6 +91,7 @@ export interface OrchestratorSubsystems {
|
|
|
80
91
|
sourceCache: SourceCache | undefined;
|
|
81
92
|
depCache: DepCache | undefined;
|
|
82
93
|
userCache: UserCache | undefined;
|
|
94
|
+
artifactStore: ArtifactStore | undefined;
|
|
83
95
|
/** Server-side jobId -> user-cache-namespace store, written at dispatch, read by the agent-WS handler. */
|
|
84
96
|
dispatchCacheRefs: DispatchCacheRefTracker;
|
|
85
97
|
buildCoordinator: BuildCoordinator | undefined;
|
|
@@ -96,6 +108,14 @@ export interface OrchestratorSubsystems {
|
|
|
96
108
|
secretResolver: SecretResolver | null;
|
|
97
109
|
adminDeps: AdminRouteDeps | undefined;
|
|
98
110
|
pgSecretStore: PgSecretStore | undefined;
|
|
111
|
+
/**
|
|
112
|
+
* Dashboard-encryption (X25519) key resolver for browser-sealed dashboard
|
|
113
|
+
* writes under the `encrypted` posture. Present whenever KICI_SECRET_KEY is
|
|
114
|
+
* configured; absent ⇒ `encrypted` writes fail closed at the WS handler.
|
|
115
|
+
*/
|
|
116
|
+
dashboardEncryption: {
|
|
117
|
+
resolve: () => Promise<ResolvedDashboardEncryptionKey | null>;
|
|
118
|
+
} | undefined;
|
|
99
119
|
tokenStore: AgentTokenStore;
|
|
100
120
|
ownershipTracker: OwnershipTracker;
|
|
101
121
|
lockFileCache: LockFileCache;
|
|
@@ -163,6 +183,16 @@ export interface OrchestratorSubsystems {
|
|
|
163
183
|
* no-op.
|
|
164
184
|
*/
|
|
165
185
|
fleetCollectResponder: (msg: PeerLogsCollectRequest, send: (out: PeerToPeerMessage) => boolean) => Promise<void>;
|
|
186
|
+
/** Shared webhook-ingest admission controller (HTTP + WS relay paths). */
|
|
187
|
+
ingestController: IngestAdmissionController;
|
|
188
|
+
/** Cached per-org ingest cap reader for admission fairness keying. */
|
|
189
|
+
ingestCapReader: OrgIngestCapReader;
|
|
190
|
+
/** Cached per-org container-sandbox escape-hatch allow-list reader (dispatch). */
|
|
191
|
+
sandboxAllowListReader: SandboxAllowListReader;
|
|
192
|
+
/** Durable overflow buffer capturing shed deliveries (HTTP + WS relay). */
|
|
193
|
+
ingestOverflowBuffer: IngestOverflowBuffer;
|
|
194
|
+
/** Background replayer draining the overflow buffer once capacity recovers. */
|
|
195
|
+
ingestOverflowReplayer: IngestOverflowReplayer;
|
|
166
196
|
}
|
|
167
197
|
/**
|
|
168
198
|
* Mode-specific hooks injected by each entry point.
|
|
@@ -179,8 +209,15 @@ export interface OrchestratorHooks {
|
|
|
179
209
|
onStepStatusForward?: ExecutionTrackerDeps['onStepStatusForward'];
|
|
180
210
|
onJobStatusChange?: ExecutionTrackerDeps['onJobStatusChange'];
|
|
181
211
|
onRunEventEmit?: ExecutionTrackerDeps['onRunEventEmit'];
|
|
212
|
+
onOrchLog?: ExecutionTrackerDeps['onOrchLog'];
|
|
182
213
|
orgId?: string;
|
|
183
214
|
};
|
|
215
|
+
/**
|
|
216
|
+
* Forward a step-log chunk to the Platform for browser fan-out. Implemented
|
|
217
|
+
* by modes that hold a Platform connection; left undefined in independent
|
|
218
|
+
* mode, where logs are persisted but not relayed.
|
|
219
|
+
*/
|
|
220
|
+
forwardLogChunk?: (chunk: NormalizedLogChunk) => void;
|
|
184
221
|
/**
|
|
185
222
|
* Called after the secrets subsystem is initialized.
|
|
186
223
|
* Server.ts uses this to create SecretResolver; standalone doesn't.
|
|
@@ -322,7 +359,10 @@ export declare function mergeUpstreamOutputs(db: Kysely<Database>, runId: string
|
|
|
322
359
|
upstreamJobOutputs: Record<string, Record<string, unknown>> | undefined;
|
|
323
360
|
upstreamJobStatuses: Record<string, ExecutionJobStatus> | undefined;
|
|
324
361
|
}>;
|
|
325
|
-
export declare function buildInternalJobConfigForWorkflow(workflow: any, job: any
|
|
362
|
+
export declare function buildInternalJobConfigForWorkflow(workflow: any, job: any, sandboxGrant?: ResolvedSandboxGrant, firedSchedule?: {
|
|
363
|
+
cronExpression?: string;
|
|
364
|
+
timezone?: string;
|
|
365
|
+
}): Record<string, unknown>;
|
|
326
366
|
export declare function bootstrapOrchestrator(config: AppConfig, hooks: OrchestratorHooks, options?: {
|
|
327
367
|
otelSdk?: {
|
|
328
368
|
shutdown(): Promise<void>;
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* CLI-secret overlay for `kici run` test dispatch.
|
|
3
3
|
*
|
|
4
|
-
* Wraps the orchestrator's
|
|
4
|
+
* Wraps the orchestrator's context `SecretResolver` and overlays the
|
|
5
5
|
* developer's CLI-uploaded local secrets on top of the env-resolved secrets,
|
|
6
6
|
* with CLI winning on collision. Passed to the shared dispatch core via
|
|
7
7
|
* `ProcessingDeps.secretResolver`, so the core's secret-resolution path is
|
|
8
8
|
* unchanged and oblivious to "test secrets".
|
|
9
9
|
*
|
|
10
|
-
* Precedence: env-resolved secrets → CLI context for the requested
|
|
10
|
+
* Precedence: env-resolved secrets → CLI context for the requested context
|
|
11
11
|
* → CLI flat. The CLI flat overlay is applied last so a CLI flat key always
|
|
12
12
|
* wins.
|
|
13
13
|
*/
|
|
14
|
+
import type { HostFacts } from '@kici-dev/engine';
|
|
14
15
|
import type { SecretResolverApi, ResolvedSecretMeta } from '../secrets/secret-resolver.js';
|
|
15
16
|
/** Decrypted CLI-uploaded local secrets: flat keys + per-context namespaces. */
|
|
16
17
|
export interface CliSecrets {
|
|
@@ -21,12 +22,12 @@ export declare class DecoratingSecretResolver implements SecretResolverApi {
|
|
|
21
22
|
private readonly base;
|
|
22
23
|
private readonly cli;
|
|
23
24
|
constructor(base: SecretResolverApi, cli: CliSecrets);
|
|
24
|
-
resolveForJob(orgId: string,
|
|
25
|
+
resolveForJob(orgId: string, contextName: string, hostCtx?: HostFacts): Promise<Record<string, string>>;
|
|
25
26
|
resolveNamed(orgId: string, scope: string, key: string, opts?: {
|
|
26
27
|
store?: string;
|
|
27
28
|
runId?: string;
|
|
28
29
|
jobId?: string;
|
|
29
30
|
}): Promise<string | null>;
|
|
30
|
-
resolveForJobWithMeta(orgId: string,
|
|
31
|
+
resolveForJobWithMeta(orgId: string, contextName: string, hostCtx?: HostFacts): Promise<Record<string, ResolvedSecretMeta>>;
|
|
31
32
|
}
|
|
32
33
|
//# sourceMappingURL=decorating-secret-resolver.d.ts.map
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Handles everything that happens AFTER a workflow has been matched against an
|
|
5
5
|
* incoming webhook: payload storage, cache + build coordination, secret
|
|
6
|
-
* resolution, per-job
|
|
6
|
+
* resolution, per-job context evaluation, static job dispatch (cluster +
|
|
7
7
|
* single-orch paths), execution-tracker registration, deferred init dispatch
|
|
8
8
|
* for jobs with dynamic fields, and deferred dynamic-job-fn dispatch for
|
|
9
9
|
* `_type:'dynamic'` lock entries.
|
|
@@ -21,6 +21,7 @@ import type { ProviderBundle } from '../provider-registry.js';
|
|
|
21
21
|
import type { Dispatcher } from '../agent/dispatcher.js';
|
|
22
22
|
import type { QueuedJobInput } from '../queue/job-queue.js';
|
|
23
23
|
import type { TrustResolution } from '../security/trust-resolver.js';
|
|
24
|
+
import type { TrustPolicyOutcome } from '../security/trust-policy-gate.js';
|
|
24
25
|
import { type ProcessingDeps } from './processor.js';
|
|
25
26
|
/**
|
|
26
27
|
* Trusted refs (write+ contributor, default-branch) get the org-shared cache
|
|
@@ -75,6 +76,28 @@ export interface WorkflowDispatchContext {
|
|
|
75
76
|
localWorkingTree: boolean;
|
|
76
77
|
/** True only when invoked from the cross-source dispatch shell. */
|
|
77
78
|
crossSource: boolean;
|
|
79
|
+
/**
|
|
80
|
+
* Outcome of the org trust-policy gate for this PR event. `pass` dispatches
|
|
81
|
+
* normally; `hold` parks the run in the security queue; `reject` fails it
|
|
82
|
+
* before any job starts. Computed once per PR event in the webhook pipeline
|
|
83
|
+
* and threaded down; the dispatch gate acts on it directly, see
|
|
84
|
+
* `holdRunForSecurityPolicy` / `rejectRunForSecurityPolicy`.
|
|
85
|
+
*
|
|
86
|
+
* REQUIRED: a dispatch path that does not state a decision must not compile.
|
|
87
|
+
* This field was optional once and the gate read `if (!decision) return
|
|
88
|
+
* null`, so forgetting to thread it meant the run passed the security gate —
|
|
89
|
+
* fail-open by omission inside a fail-closed control. A `pass` is stated
|
|
90
|
+
* explicitly.
|
|
91
|
+
*/
|
|
92
|
+
securityDecision: TrustPolicyOutcome;
|
|
93
|
+
/**
|
|
94
|
+
* Set when this dispatch call took a pending-jobs token for the source-pack
|
|
95
|
+
* build window. Tokens are fungible, so the `finally` must release only one
|
|
96
|
+
* it actually took — an unpaired release would consume a token held by a
|
|
97
|
+
* deferred init / dynamic task and un-hold the run while its jobs are still
|
|
98
|
+
* being registered.
|
|
99
|
+
*/
|
|
100
|
+
buildWindowTokenHeld?: boolean;
|
|
78
101
|
/** Composite dedup key `${info.deliveryId}:${reg.id}` (cross-source only). */
|
|
79
102
|
crossSourceDeliveryId?: string;
|
|
80
103
|
/**
|
|
@@ -113,7 +136,7 @@ export interface WorkflowDispatchContext {
|
|
|
113
136
|
* Run-wide flat secrets layered onto EVERY dispatched job's `jobConfig.secrets`
|
|
114
137
|
* (env-declaring or not). Used by the test path to deliver `kici run --secret`
|
|
115
138
|
* / `--env` CLI flat secrets, which must reach a job regardless of whether it
|
|
116
|
-
* declares an `
|
|
139
|
+
* declares an `context:`. Merged UNDER the per-job env-resolved secrets so
|
|
117
140
|
* the CLI value wins on a key collision (matching the prior B1-env -> A-CLI
|
|
118
141
|
* precedence). Undefined for webhook runs.
|
|
119
142
|
*/
|
|
@@ -131,6 +154,13 @@ export interface WorkflowDispatchContext {
|
|
|
131
154
|
*/
|
|
132
155
|
dispatchInputs?: Record<string, unknown>;
|
|
133
156
|
}
|
|
157
|
+
/**
|
|
158
|
+
* Build the dispatch-envelope event, carrying the orchestrator's already-fetched
|
|
159
|
+
* changed-files list + status from `eventWithFiles` as a fast-path (the agent
|
|
160
|
+
* recomputes from the clone when status !== 'fetched', so this only forfeits the
|
|
161
|
+
* optimization when a path is missed — correctness comes from the agent).
|
|
162
|
+
*/
|
|
163
|
+
export declare function envelopeEvent(baseEvent: SimulatedEvent, eventWithFiles: SimulatedEvent): SimulatedEvent;
|
|
134
164
|
export interface DispatchMatchedWorkflowResult {
|
|
135
165
|
/** Number of jobs successfully dispatched (non-rejected). */
|
|
136
166
|
dispatchedJobCount: number;
|
|
@@ -140,7 +170,7 @@ export interface DispatchMatchedWorkflowResult {
|
|
|
140
170
|
held?: boolean;
|
|
141
171
|
/**
|
|
142
172
|
* User-visible warnings aggregated from dispatched jobs — today, one per job
|
|
143
|
-
* whose bound test-run
|
|
173
|
+
* whose bound test-run context(s) were unavailable and skipped. Surfaced
|
|
144
174
|
* on the accepted trigger response so the CLI can print them.
|
|
145
175
|
*/
|
|
146
176
|
envWarnings?: string[];
|
|
@@ -296,6 +326,17 @@ export declare function materializeStaticJobsSafe(staticJobs: readonly LockJob[]
|
|
|
296
326
|
expansionMap: Map<string, readonly string[]>;
|
|
297
327
|
matrixFailures: RejectedJob[];
|
|
298
328
|
}>;
|
|
329
|
+
/**
|
|
330
|
+
* Scan a lock workflow's always-mode approval timeouts (workflow-level +
|
|
331
|
+
* each static job) for a non-positive / non-finite `timeoutSeconds`. Returns the
|
|
332
|
+
* first offender or null. Step-scope approvals ride the validated
|
|
333
|
+
* `step.approval-request` wire schema and are not checked here.
|
|
334
|
+
*/
|
|
335
|
+
export declare function findInvalidApprovalTimeout(workflow: LockWorkflow): {
|
|
336
|
+
scope: 'workflow' | 'job';
|
|
337
|
+
jobName?: string;
|
|
338
|
+
value: number;
|
|
339
|
+
} | null;
|
|
299
340
|
/**
|
|
300
341
|
* Build the per-host secret-resolution context for a materialized child. A
|
|
301
342
|
* `runsOnAll` host child carries its identity on `mat.agent` (preferred) or
|
|
@@ -36,8 +36,8 @@ export declare function evaluateInlineRecord(expression: string, event: object):
|
|
|
36
36
|
* failures are immediate dispatch failures (no init-job fallback).
|
|
37
37
|
*/
|
|
38
38
|
export declare function evaluateInlineFields(lockJob: LockJob, event: object): {
|
|
39
|
-
/** Resolved name per `
|
|
40
|
-
|
|
39
|
+
/** Resolved name per `contexts` element, aligned by index; undefined for static or impure-dynamic elements. */
|
|
40
|
+
inlineContextNames: Array<string | undefined>;
|
|
41
41
|
inlineEnv: Record<string, string> | undefined;
|
|
42
42
|
inlineConcurrencyGroup: string | undefined;
|
|
43
43
|
};
|
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
* private registries.
|
|
5
5
|
*
|
|
6
6
|
* Each `tokenSecret` / `installEnv[]` entry uses the qualified
|
|
7
|
-
* `<
|
|
7
|
+
* `<context>:<secret-name>` syntax. The resolver:
|
|
8
8
|
*
|
|
9
|
-
* 1. Parses every qualified ref and groups by
|
|
10
|
-
* 2. Fires the per-
|
|
9
|
+
* 1. Parses every qualified ref and groups by context name.
|
|
10
|
+
* 2. Fires the per-context protection-rule pipeline once per unique env
|
|
11
11
|
* (branch / trust / concurrency / reviewer / wait-timer). A `reject`
|
|
12
12
|
* result fails the whole workflow dispatch with a clear reason; a
|
|
13
13
|
* `hold` / `wait` / `queue` result returns a structured `hold` decision
|
|
@@ -15,13 +15,13 @@
|
|
|
15
15
|
* run and resume it when the gate clears. On the resume path the caller
|
|
16
16
|
* sets `skipProtectionGate` so the gate (already satisfied) is bypassed
|
|
17
17
|
* and secrets are resolved directly.
|
|
18
|
-
* 3. Resolves secrets per
|
|
18
|
+
* 3. Resolves secrets per context via `secretResolver.resolveForJob`
|
|
19
19
|
* (which writes its own audit log lines).
|
|
20
20
|
* 4. Validates each registry URL scheme: HTTPS always allowed; `http://`
|
|
21
21
|
* allowed only for loopback / `*.local` hosts OR when the org operator
|
|
22
22
|
* has flipped `org_settings.allow_http_npm_registries=true`.
|
|
23
23
|
* 5. Strips the resolved auth entirely when the contributor-trust tier is
|
|
24
|
-
* not `trusted` (defense in depth: even if a misconfigured
|
|
24
|
+
* not `trusted` (defense in depth: even if a misconfigured context
|
|
25
25
|
* lets an unknown contributor through the protection-pipeline trust
|
|
26
26
|
* gate, this strip ensures fork PRs never see registry tokens — the
|
|
27
27
|
* install fails naturally because the deps are unreachable).
|
|
@@ -32,8 +32,8 @@
|
|
|
32
32
|
import type { ApproverClause, LockRegistry } from '@kici-dev/engine';
|
|
33
33
|
import type { TrustResolution } from '../security/trust-resolver.js';
|
|
34
34
|
import type { SecretResolverApi } from '../secrets/secret-resolver.js';
|
|
35
|
-
import type {
|
|
36
|
-
import { type JobDispatchContext } from '../
|
|
35
|
+
import type { ContextStore } from '../contexts/context-store.js';
|
|
36
|
+
import { type JobDispatchContext } from '../contexts/protection/pipeline.js';
|
|
37
37
|
/** Registry spec carried on the dispatch message (token already resolved). */
|
|
38
38
|
export interface NpmRegistrySpec {
|
|
39
39
|
url: string;
|
|
@@ -47,7 +47,7 @@ export interface ResolveInstallSecretsArgs {
|
|
|
47
47
|
allowHttpNpmRegistries: boolean;
|
|
48
48
|
resolvedOrgId: string;
|
|
49
49
|
trustResolution: TrustResolution | undefined;
|
|
50
|
-
|
|
50
|
+
contextStore: ContextStore | undefined;
|
|
51
51
|
secretResolver: SecretResolverApi | undefined;
|
|
52
52
|
protectionContext: JobDispatchContext;
|
|
53
53
|
/**
|
|
@@ -75,16 +75,16 @@ export type ResolveInstallSecretsResult = {
|
|
|
75
75
|
decision: 'hold';
|
|
76
76
|
/** The gate action that paused the dispatch. */
|
|
77
77
|
action: 'hold' | 'wait' | 'queue';
|
|
78
|
-
/** The
|
|
78
|
+
/** The context whose install gate held. */
|
|
79
79
|
envName: string;
|
|
80
|
-
/** Resolved
|
|
81
|
-
|
|
82
|
-
/** Discriminates the release trigger
|
|
80
|
+
/** Resolved context id (for the held row). */
|
|
81
|
+
contextId: string;
|
|
82
|
+
/** Discriminates the release trigger — an engine `HoldType` member. */
|
|
83
83
|
holdType: string;
|
|
84
|
-
queueType: '
|
|
84
|
+
queueType: 'context' | 'security';
|
|
85
85
|
requirement: InstallHoldRequirement;
|
|
86
86
|
};
|
|
87
|
-
/** Parse `<
|
|
87
|
+
/** Parse `<context>:<secret-name>`. Returns null on malformed input. */
|
|
88
88
|
export declare function parseQualifiedSecretRef(ref: string): {
|
|
89
89
|
envName: string;
|
|
90
90
|
secretName: string;
|
|
@@ -96,5 +96,16 @@ export declare function validateRegistryUrlScheme(url: string, allowHttp: boolea
|
|
|
96
96
|
ok: false;
|
|
97
97
|
reason: string;
|
|
98
98
|
};
|
|
99
|
+
/**
|
|
100
|
+
* The held-run `hold_type` for a gate outcome — the gate's own `holdType` when
|
|
101
|
+
* it set one, otherwise the `HoldType` member its action implies. Column and
|
|
102
|
+
* gate share one vocabulary, so nothing is translated here.
|
|
103
|
+
*
|
|
104
|
+
* Distinct from the engine's `normalizePersistedHoldType`, which maps a value
|
|
105
|
+
* read back OUT of the column onto that same vocabulary.
|
|
106
|
+
*
|
|
107
|
+
* Exported for tests.
|
|
108
|
+
*/
|
|
109
|
+
export declare function resolveHoldType(action: 'hold' | 'wait' | 'queue', raw: string | undefined): string;
|
|
99
110
|
export declare function resolveInstallSecrets(args: ResolveInstallSecretsArgs): Promise<ResolveInstallSecretsResult>;
|
|
100
111
|
//# sourceMappingURL=install-secrets-resolver.d.ts.map
|
|
@@ -1,59 +1,59 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Multi-
|
|
2
|
+
* Multi-context resolution helpers for the dispatch path.
|
|
3
3
|
*
|
|
4
|
-
* A job binds an ordered list of
|
|
5
|
-
* module resolves that list into concrete
|
|
4
|
+
* A job binds an ordered list of contexts (`LockJob.contexts`). This
|
|
5
|
+
* module resolves that list into concrete context names (static values
|
|
6
6
|
* verbatim, pure-inline dynamic elements evaluated against the event) and folds
|
|
7
|
-
* the per-
|
|
7
|
+
* the per-context secrets/variables last-wins. It keeps the heavy fold logic
|
|
8
8
|
* out of `dispatchMatchedWorkflow`, which must stay under the function-length cap.
|
|
9
9
|
*/
|
|
10
|
-
import { type
|
|
10
|
+
import { type Context, type HostFacts, type LockJob } from '@kici-dev/engine';
|
|
11
11
|
import type { SecretResolverApi } from '../secrets/secret-resolver.js';
|
|
12
|
-
import type { VariableStore } from '../
|
|
12
|
+
import type { VariableStore } from '../contexts/variable-store.js';
|
|
13
13
|
/**
|
|
14
14
|
* Placeholder written into the persisted bound-env list for an impure dynamic
|
|
15
15
|
* element the orchestrator cannot resolve at dispatch. The agent's init eval
|
|
16
16
|
* later overwrites the list with the resolved name.
|
|
17
17
|
*/
|
|
18
18
|
export declare const DYNAMIC_ENV_PLACEHOLDER = "(dynamic)";
|
|
19
|
-
/** Ordered resolved
|
|
20
|
-
export interface
|
|
19
|
+
/** Ordered resolved context names plus whether any element still needs agent init. */
|
|
20
|
+
export interface ResolvedJobContexts {
|
|
21
21
|
/** Resolved static + pure-inline names, in order. */
|
|
22
22
|
names: string[];
|
|
23
23
|
/** True when an impure dynamic element must be resolved by an agent init job. */
|
|
24
24
|
needsInit: boolean;
|
|
25
25
|
}
|
|
26
26
|
/**
|
|
27
|
-
* Resolve the ordered bound-
|
|
27
|
+
* Resolve the ordered bound-context names from a lock job. Static elements
|
|
28
28
|
* use their value verbatim; pure-inline dynamic elements use the matching
|
|
29
29
|
* pre-evaluated inline name (aligned by index); an impure dynamic element cannot
|
|
30
30
|
* be resolved here and flags `needsInit`.
|
|
31
31
|
*/
|
|
32
|
-
export declare function
|
|
32
|
+
export declare function resolveJobContextNames(lockJob: LockJob, inlineNames: ReadonlyArray<string | undefined>): ResolvedJobContexts;
|
|
33
33
|
/**
|
|
34
|
-
* Build the ordered bound-
|
|
35
|
-
* Unlike {@link
|
|
34
|
+
* Build the ordered bound-context display list for persistence at dispatch.
|
|
35
|
+
* Unlike {@link resolveJobContextNames}, this never drops an unresolved
|
|
36
36
|
* element: a static element uses its value, a pure-inline element uses its
|
|
37
37
|
* resolved name when known, and any element the orchestrator cannot resolve at
|
|
38
38
|
* dispatch (impure dynamic, or an unresolved pure-inline) becomes the
|
|
39
39
|
* `(dynamic)` placeholder — so the persisted column reflects every declared
|
|
40
|
-
* slot in order. Returns an empty array when the job binds no
|
|
40
|
+
* slot in order. Returns an empty array when the job binds no context.
|
|
41
41
|
*/
|
|
42
|
-
export declare function
|
|
43
|
-
/** Merged secrets/variables across an ordered list of resolved
|
|
42
|
+
export declare function buildJobContextDisplayNames(lockJob: LockJob, inlineNames: ReadonlyArray<string | undefined>): string[];
|
|
43
|
+
/** Merged secrets/variables across an ordered list of resolved contexts. */
|
|
44
44
|
export interface MultiEnvMergedData {
|
|
45
|
-
|
|
45
|
+
contextVars?: Record<string, string>;
|
|
46
46
|
jobSecrets?: Record<string, string>;
|
|
47
47
|
jobNamespacedSecrets?: Record<string, Record<string, string>>;
|
|
48
48
|
}
|
|
49
49
|
/**
|
|
50
50
|
* Resolve and fold variables + secrets across the ordered list of matched
|
|
51
|
-
*
|
|
52
|
-
* single-env logic (longest-scope-path-wins preserved within each
|
|
53
|
-
* then folded in array order so a later
|
|
54
|
-
* Secrets are also returned namespaced per
|
|
51
|
+
* contexts, last-wins. Each context is resolved with the existing
|
|
52
|
+
* single-env logic (longest-scope-path-wins preserved within each context),
|
|
53
|
+
* then folded in array order so a later context overrides an earlier key.
|
|
54
|
+
* Secrets are also returned namespaced per context so qualified
|
|
55
55
|
* `<env>:<secret>` references still resolve. `entries` carries the matched
|
|
56
|
-
* `
|
|
56
|
+
* `Context` for each name (in order); variables resolve by context id.
|
|
57
57
|
*/
|
|
58
58
|
export declare function resolveMultiEnvMergedData(args: {
|
|
59
59
|
deps: {
|
|
@@ -63,9 +63,9 @@ export declare function resolveMultiEnvMergedData(args: {
|
|
|
63
63
|
orgId: string;
|
|
64
64
|
entries: ReadonlyArray<{
|
|
65
65
|
name: string;
|
|
66
|
-
env:
|
|
66
|
+
env: Context;
|
|
67
67
|
}>;
|
|
68
68
|
hostCtx?: HostFacts;
|
|
69
69
|
routingKey?: string;
|
|
70
70
|
}): Promise<MultiEnvMergedData>;
|
|
71
|
-
//# sourceMappingURL=job-
|
|
71
|
+
//# sourceMappingURL=job-contexts.d.ts.map
|