@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
package/dist/lockfile-cache.d.ts
CHANGED
|
@@ -10,11 +10,13 @@
|
|
|
10
10
|
import { type LockFileFetcher, type LockFile } from '@kici-dev/engine';
|
|
11
11
|
export declare class LockFileCache {
|
|
12
12
|
private readonly cache;
|
|
13
|
+
private readonly inFlight;
|
|
13
14
|
private hits;
|
|
14
15
|
private misses;
|
|
15
16
|
constructor(options: {
|
|
16
17
|
max: number;
|
|
17
18
|
ttl: number;
|
|
19
|
+
maxBytes?: number;
|
|
18
20
|
});
|
|
19
21
|
/**
|
|
20
22
|
* Fetch the lock file for a repository at a specific ref,
|
|
@@ -27,6 +29,7 @@ export declare class LockFileCache {
|
|
|
27
29
|
* @returns Parsed lock file, or null if not found
|
|
28
30
|
*/
|
|
29
31
|
get(fetcher: LockFileFetcher, repoIdentifier: string, ref: string, credentials: unknown): Promise<LockFile | null>;
|
|
32
|
+
private fetchAndValidate;
|
|
30
33
|
/**
|
|
31
34
|
* Get cache statistics for metrics/monitoring.
|
|
32
35
|
*/
|
|
@@ -34,6 +37,7 @@ export declare class LockFileCache {
|
|
|
34
37
|
hits: number;
|
|
35
38
|
misses: number;
|
|
36
39
|
size: number;
|
|
40
|
+
calculatedSize: number;
|
|
37
41
|
};
|
|
38
42
|
}
|
|
39
43
|
//# sourceMappingURL=lockfile-cache.d.ts.map
|
|
@@ -1,19 +1,26 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Lock-load shape + compatibility validation.
|
|
3
3
|
*
|
|
4
|
-
* A fetched lock must be a valid JSON document whose schemaVersion
|
|
5
|
-
* orchestrator's
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
4
|
+
* A fetched lock must be a valid JSON document whose schemaVersion falls within
|
|
5
|
+
* this orchestrator's compatibility window (at or above BREAKING_FLOOR, and
|
|
6
|
+
* requiring a reader no newer than SCHEMA_VERSION), and whose routing matchers
|
|
7
|
+
* are well-formed LabelMatcher objects. A lock compiled by an older engine
|
|
8
|
+
* stored `runsOn` as a plain string array; without the floor gate those strings
|
|
9
|
+
* would parse past the dispatch path as an empty label set and mis-route jobs to
|
|
10
|
+
* an arbitrary scaler. These checks run at the cache choke point and surface as
|
|
11
|
+
* a `LockFileParseError` (the established corrupt-lock signal).
|
|
11
12
|
*/
|
|
12
13
|
import { type LockFile } from '@kici-dev/engine';
|
|
13
14
|
/** Parse the raw lock JSON and assert the minimal document shape. */
|
|
14
15
|
export declare function parseLockDocument(raw: string, repoIdentifier: string, ref: string): LockFile;
|
|
15
|
-
/**
|
|
16
|
-
|
|
16
|
+
/**
|
|
17
|
+
* Enforce the two-sided lock-schema compatibility window. Accept any lock whose
|
|
18
|
+
* `schemaVersion` is at or above this codebase's `BREAKING_FLOOR` and whose
|
|
19
|
+
* required reader version is at or below this orchestrator's `SCHEMA_VERSION`.
|
|
20
|
+
* Both out-of-window cases throw a `LockFileParseError` (the established
|
|
21
|
+
* corrupt-lock signal) carrying operator-actionable guidance.
|
|
22
|
+
*/
|
|
23
|
+
export declare function assertLockFileSchemaCompatible(lockFile: LockFile, repoIdentifier: string, ref: string): void;
|
|
17
24
|
/**
|
|
18
25
|
* Walk every static job's runsOn / excludeLabels / runsOnAll matchers and throw
|
|
19
26
|
* if any element is not a valid LabelMatcher. Dynamic job generators carry no
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
+
import type { ScalerRedispatchTrigger } from '../scaler/types.js';
|
|
1
2
|
/** Set the current number of active agents. */
|
|
2
3
|
export declare function setAgentsActive(value: number): void;
|
|
3
4
|
/** Set the current config version number. */
|
|
4
5
|
export declare function setConfigVersion(value: number): void;
|
|
6
|
+
/** Set whether this coordinator is draining (1) or accepting new jobs (0). */
|
|
7
|
+
export declare function setDraining(value: boolean): void;
|
|
5
8
|
/** Set the current number of declared (static) roster hosts that are unreachable. */
|
|
6
9
|
export declare function setDeclaredHostsUnreachable(value: number): void;
|
|
7
10
|
/** Set the current number of stale runs detected. */
|
|
@@ -12,6 +15,8 @@ export declare function setPendingAttestations(value: number): void;
|
|
|
12
15
|
export declare function setPendingAttestationOldestAgeSeconds(value: number): void;
|
|
13
16
|
/** Set the current number of terminally-rejected deferred attestations. */
|
|
14
17
|
export declare function setRejectedAttestations(value: number): void;
|
|
18
|
+
/** Record the collation-drift flag (1 = drift, 0 = clean) for a database. */
|
|
19
|
+
export declare function setDbCollationDrift(database: string, drifted: boolean): void;
|
|
15
20
|
interface ScalerUsageRow {
|
|
16
21
|
scaler: string;
|
|
17
22
|
/** Backend type for this scaler (rollup dimension). `__global__` for the orchestrator-wide row. */
|
|
@@ -31,6 +36,12 @@ interface ScalerUsageRow {
|
|
|
31
36
|
export declare function setScalerUsageBreakdown(rows: ScalerUsageRow[]): void;
|
|
32
37
|
/** Increment the spawn-refusal counter (called by ScalerManager when a request fails the cap check). */
|
|
33
38
|
export declare function incScalerSpawnRefusals(): void;
|
|
39
|
+
/**
|
|
40
|
+
* Record `count` pending jobs re-driven through the scaler by `trigger`
|
|
41
|
+
* (`hook` = capacity-freed callback, `sweep` = leader-gated backstop).
|
|
42
|
+
* Called by the dispatcher's metrics facade.
|
|
43
|
+
*/
|
|
44
|
+
export declare function incScalerRedispatch(trigger: ScalerRedispatchTrigger, count: number): void;
|
|
34
45
|
/**
|
|
35
46
|
* Merge current per-label counts with explicit `0`s for previously-seen labels
|
|
36
47
|
* whose queue has drained. Mutates `everSeen` to include the current labels.
|
|
@@ -52,6 +63,48 @@ export declare function setDispatchQueueDepthBreakdown(snapshot: {
|
|
|
52
63
|
byStatus: Partial<Record<'pending' | 'dispatched', number>>;
|
|
53
64
|
byLabel: Record<string, number>;
|
|
54
65
|
}): void;
|
|
66
|
+
interface IngestMetricState {
|
|
67
|
+
inflight: number;
|
|
68
|
+
queueDepth: number;
|
|
69
|
+
sheddingActive: boolean;
|
|
70
|
+
loopDelayP99Ms: number;
|
|
71
|
+
loopDelayMaxMs: number;
|
|
72
|
+
}
|
|
73
|
+
export declare function setIngestAdmissionState(s: IngestMetricState): void;
|
|
74
|
+
export declare function getIngestMetricState(): IngestMetricState;
|
|
75
|
+
interface IngestLimitState {
|
|
76
|
+
maxConcurrency: number;
|
|
77
|
+
maxQueueDepth: number;
|
|
78
|
+
orgMaxConcurrency: number;
|
|
79
|
+
loopLagShedMs: number;
|
|
80
|
+
loopLagResumeMs: number;
|
|
81
|
+
overflowMax: number;
|
|
82
|
+
}
|
|
83
|
+
export declare function setIngestAdmissionLimits(l: IngestLimitState): void;
|
|
84
|
+
/** Reset ingest metric state (test helper). */
|
|
85
|
+
export declare function resetIngestMetricState(): void;
|
|
86
|
+
/**
|
|
87
|
+
* Total webhook-ingest admissions shed by the admission controller.
|
|
88
|
+
* Labels:
|
|
89
|
+
* - reason: loop_overload | codel_drop | queue_full | max_sojourn
|
|
90
|
+
*/
|
|
91
|
+
export declare const ingestShedTotal: import("@opentelemetry/api").Counter<import("@opentelemetry/api").Attributes>;
|
|
92
|
+
/** Total times the state.replay circuit breaker opened, skipping replay on connect. */
|
|
93
|
+
export declare const stateReplayBreakerTripsTotal: import("@opentelemetry/api").Counter<import("@opentelemetry/api").Attributes>;
|
|
94
|
+
/** Total webhook-ingest admissions granted. */
|
|
95
|
+
export declare const ingestAdmittedTotal: import("@opentelemetry/api").Counter<import("@opentelemetry/api").Attributes>;
|
|
96
|
+
/** Set the current buffered-row depth (called by the buffer + replayer). */
|
|
97
|
+
export declare function setIngestOverflowBuffered(value: number): void;
|
|
98
|
+
/** Current buffered-row depth (test helper). */
|
|
99
|
+
export declare function getIngestOverflowBuffered(): number;
|
|
100
|
+
/** Reset overflow metric state (test helper). */
|
|
101
|
+
export declare function resetIngestOverflowMetricState(): void;
|
|
102
|
+
/** Deliveries captured into the durable overflow buffer. */
|
|
103
|
+
export declare const ingestOverflowCapturedTotal: import("@opentelemetry/api").Counter<import("@opentelemetry/api").Attributes>;
|
|
104
|
+
/** Buffered deliveries successfully replayed through normal ingest. */
|
|
105
|
+
export declare const ingestOverflowReplayedTotal: import("@opentelemetry/api").Counter<import("@opentelemetry/api").Attributes>;
|
|
106
|
+
/** Buffered deliveries permanently dropped. Labels: reason (cap_full|max_attempts). */
|
|
107
|
+
export declare const ingestOverflowDroppedTotal: import("@opentelemetry/api").Counter<import("@opentelemetry/api").Attributes>;
|
|
55
108
|
/**
|
|
56
109
|
* Total webhooks received by the orchestrator.
|
|
57
110
|
* Labels:
|
|
@@ -65,6 +118,16 @@ export declare const webhooksReceivedTotal: import("@opentelemetry/api").Counter
|
|
|
65
118
|
* - result: matched (triggered workflow) | skipped (no match) | error (processing failure)
|
|
66
119
|
*/
|
|
67
120
|
export declare const webhooksProcessedTotal: import("@opentelemetry/api").Counter<import("@opentelemetry/api").Attributes>;
|
|
121
|
+
/**
|
|
122
|
+
* Org trust-policy gate decisions.
|
|
123
|
+
* Labels:
|
|
124
|
+
* - arm: which policy arm decided — workflow_modification | fork_pr | unknown_contributor | none (the PR passed)
|
|
125
|
+
* - action: pass | hold | reject
|
|
126
|
+
*
|
|
127
|
+
* Incremented once per evaluated PR event, including passes, so the ratio of
|
|
128
|
+
* gated to ungated PRs is visible rather than only the gated ones.
|
|
129
|
+
*/
|
|
130
|
+
export declare const trustPolicyDecisionsTotal: import("@opentelemetry/api").Counter<import("@opentelemetry/api").Attributes>;
|
|
68
131
|
/**
|
|
69
132
|
* Duration of trigger matching operations (lock file evaluation).
|
|
70
133
|
* Buckets: 1ms to 5s covering fast rejects through complex evaluations.
|
|
@@ -129,10 +192,14 @@ export declare const stepsTotal: import("@opentelemetry/api").Counter<import("@o
|
|
|
129
192
|
export declare const githubCheckRunTotal: import("@opentelemetry/api").Counter<import("@opentelemetry/api").Attributes>;
|
|
130
193
|
/**
|
|
131
194
|
* Total log chunks received from agents.
|
|
195
|
+
* Labels:
|
|
196
|
+
* - source: local (directly-connected agent) | peer (relayed by a worker orchestrator)
|
|
132
197
|
*/
|
|
133
198
|
export declare const logChunksReceivedTotal: import("@opentelemetry/api").Counter<import("@opentelemetry/api").Attributes>;
|
|
134
199
|
/**
|
|
135
200
|
* Total log bytes written to storage backend.
|
|
201
|
+
* Labels:
|
|
202
|
+
* - source: local (directly-connected agent) | peer (relayed by a worker orchestrator)
|
|
136
203
|
*/
|
|
137
204
|
export declare const logBytesStoredTotal: import("@opentelemetry/api").Counter<import("@opentelemetry/api").Attributes>;
|
|
138
205
|
/**
|
|
@@ -147,8 +214,8 @@ export declare const scalerConfigReloadsTotal: import("@opentelemetry/api").Coun
|
|
|
147
214
|
* - `false` — a warm-pool / unbound pre-spawn (no run impact yet; fleet-health signal).
|
|
148
215
|
*/
|
|
149
216
|
export declare const ScalerSpawnFailureBound: {
|
|
150
|
-
readonly Bound:
|
|
151
|
-
readonly Unbound:
|
|
217
|
+
readonly Bound: 'true';
|
|
218
|
+
readonly Unbound: 'false';
|
|
152
219
|
};
|
|
153
220
|
export type ScalerSpawnFailureBound = (typeof ScalerSpawnFailureBound)[keyof typeof ScalerSpawnFailureBound];
|
|
154
221
|
/**
|
|
@@ -196,7 +263,7 @@ export declare const crossSourceFanoutSize: import("@opentelemetry/api").Histogr
|
|
|
196
263
|
* provider bundle not found in registry)
|
|
197
264
|
*
|
|
198
265
|
* NOTE: dashboard panel for `kici_cross_source_errors_total` not yet added —
|
|
199
|
-
* follow-up per
|
|
266
|
+
* follow-up per the dashboards 1:1 invariant in the monitoring rule.
|
|
200
267
|
*/
|
|
201
268
|
export declare const crossSourceErrorsTotal: import("@opentelemetry/api").Counter<import("@opentelemetry/api").Attributes>;
|
|
202
269
|
/**
|
|
@@ -265,17 +332,17 @@ export declare function setEventDlqDepth(value: number): void;
|
|
|
265
332
|
* constants, so adding a new reject path requires extending the union here.
|
|
266
333
|
*/
|
|
267
334
|
export declare const InstallSecretsDecisionReason: {
|
|
268
|
-
readonly Ok:
|
|
269
|
-
readonly MalformedRef:
|
|
270
|
-
readonly InvalidUrlScheme:
|
|
271
|
-
readonly MissingEnvStore:
|
|
272
|
-
readonly MissingSecretResolver:
|
|
273
|
-
readonly EnvNotFound:
|
|
274
|
-
readonly ProtectionRuleBlock:
|
|
275
|
-
readonly MissingToken:
|
|
276
|
-
readonly MissingInstallEnv:
|
|
335
|
+
readonly Ok: 'ok';
|
|
336
|
+
readonly MalformedRef: 'malformed_ref';
|
|
337
|
+
readonly InvalidUrlScheme: 'invalid_url_scheme';
|
|
338
|
+
readonly MissingEnvStore: 'missing_env_store';
|
|
339
|
+
readonly MissingSecretResolver: 'missing_secret_resolver';
|
|
340
|
+
readonly EnvNotFound: 'env_not_found';
|
|
341
|
+
readonly ProtectionRuleBlock: 'protection_rule_block';
|
|
342
|
+
readonly MissingToken: 'missing_token';
|
|
343
|
+
readonly MissingInstallEnv: 'missing_install_env';
|
|
277
344
|
/** A protection gate held the workflow install (hold / wait / queue). */
|
|
278
|
-
readonly Held:
|
|
345
|
+
readonly Held: 'held';
|
|
279
346
|
};
|
|
280
347
|
export type InstallSecretsDecisionReason = (typeof InstallSecretsDecisionReason)[keyof typeof InstallSecretsDecisionReason];
|
|
281
348
|
/**
|
|
@@ -284,8 +351,8 @@ export type InstallSecretsDecisionReason = (typeof InstallSecretsDecisionReason)
|
|
|
284
351
|
* - `install_env` is Option C (committed `.kici/.npmrc` + `installEnv:`).
|
|
285
352
|
*/
|
|
286
353
|
export declare const InstallSecretsChannel: {
|
|
287
|
-
readonly Registries:
|
|
288
|
-
readonly InstallEnv:
|
|
354
|
+
readonly Registries: 'registries';
|
|
355
|
+
readonly InstallEnv: 'install_env';
|
|
289
356
|
};
|
|
290
357
|
export type InstallSecretsChannel = (typeof InstallSecretsChannel)[keyof typeof InstallSecretsChannel];
|
|
291
358
|
/**
|
|
@@ -332,6 +399,38 @@ export declare const installSecretsContributorStrippedTotal: import("@openteleme
|
|
|
332
399
|
* - environment: the environment name referenced in the qualified `<environment>:<secret>` ref (per-org count is typically <10)
|
|
333
400
|
*/
|
|
334
401
|
export declare const installSecretsTokenResolutionDurationSeconds: import("@opentelemetry/api").Histogram<import("@opentelemetry/api").Attributes>;
|
|
402
|
+
/**
|
|
403
|
+
* Terminal dispatch_queue rows deleted by the retention sweep (the cleanup
|
|
404
|
+
* tick's `pruneTerminalDispatchRows`).
|
|
405
|
+
*/
|
|
406
|
+
export declare const dispatchQueueRowsPrunedTotal: import("@opentelemetry/api").Counter<import("@opentelemetry/api").Attributes>;
|
|
407
|
+
/**
|
|
408
|
+
* Step-log objects deleted by the retention sweep (the cleanup tick's
|
|
409
|
+
* `pruneExpiredLogs`, S3 backend only).
|
|
410
|
+
*/
|
|
411
|
+
export declare const stepLogsPrunedTotal: import("@opentelemetry/api").Counter<import("@opentelemetry/api").Attributes>;
|
|
412
|
+
/**
|
|
413
|
+
* `check_run_tracking` rows deleted by the retention sweep (the cleanup tick's
|
|
414
|
+
* `pruneStale`).
|
|
415
|
+
*/
|
|
416
|
+
export declare const checkRunTrackingRowsPrunedTotal: import("@opentelemetry/api").Counter<import("@opentelemetry/api").Attributes>;
|
|
417
|
+
/**
|
|
418
|
+
* Unsupported-message NACKs the orchestrator SENT back to the Platform — an
|
|
419
|
+
* inbound frame whose type this orchestrator build does not understand
|
|
420
|
+
* (Platform is ahead). Labelled by `received_type`.
|
|
421
|
+
*/
|
|
422
|
+
export declare const wsUnsupportedMessageSentTotal: import("@opentelemetry/api").Counter<import("@opentelemetry/api").Attributes>;
|
|
423
|
+
/**
|
|
424
|
+
* NACKs the orchestrator RECEIVED from the Platform — the Platform could not
|
|
425
|
+
* process a frame we sent (this orchestrator is ahead). Labelled by
|
|
426
|
+
* `received_type`.
|
|
427
|
+
*/
|
|
428
|
+
export declare const wsNackReceivedTotal: import("@opentelemetry/api").Counter<import("@opentelemetry/api").Attributes>;
|
|
429
|
+
/**
|
|
430
|
+
* Feature-gated sends the orchestrator SUPPRESSED because the Platform advertised
|
|
431
|
+
* a capability set that lacks the required flag. Labelled by `capability` + `type`.
|
|
432
|
+
*/
|
|
433
|
+
export declare const wsPlatformCapabilityGapTotal: import("@opentelemetry/api").Counter<import("@opentelemetry/api").Attributes>;
|
|
335
434
|
/**
|
|
336
435
|
* Register every queued orchestrator observable gauge on the real meter.
|
|
337
436
|
*
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { JWK } from 'jose';
|
|
2
|
+
import { type Signer } from './signer.js';
|
|
3
|
+
/** Minimal surface of the KMS client we use (so tests can inject a fake). */
|
|
4
|
+
export interface KmsLike {
|
|
5
|
+
send(command: unknown): Promise<{
|
|
6
|
+
PublicKey?: Uint8Array;
|
|
7
|
+
Signature?: Uint8Array;
|
|
8
|
+
}>;
|
|
9
|
+
}
|
|
10
|
+
export interface AwsKmsSignerOptions {
|
|
11
|
+
client: KmsLike;
|
|
12
|
+
keyArn: string;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Signs with an AWS KMS asymmetric ECC_NIST_P256 key (ES256). The private key
|
|
16
|
+
* never leaves KMS; sign() is a kms:Sign call. getPublicJwk() resolves once via
|
|
17
|
+
* kms:GetPublicKey and is cached. Ported verbatim from the Platform.
|
|
18
|
+
*/
|
|
19
|
+
export declare class AwsKmsSigner implements Signer {
|
|
20
|
+
private readonly opts;
|
|
21
|
+
readonly alg: 'ES256';
|
|
22
|
+
readonly signerKind = "aws-kms";
|
|
23
|
+
readonly keyRef: string;
|
|
24
|
+
private cachedJwk?;
|
|
25
|
+
constructor(opts: AwsKmsSignerOptions);
|
|
26
|
+
/** Build a KMS client with explicit, dedicated AWS creds (NOT the ambient AWS_* chain). */
|
|
27
|
+
static fromCredentials(opts: {
|
|
28
|
+
keyArn: string;
|
|
29
|
+
region: string;
|
|
30
|
+
accessKeyId: string;
|
|
31
|
+
secretAccessKey: string;
|
|
32
|
+
}): AwsKmsSigner;
|
|
33
|
+
sign(data: Uint8Array): Promise<Uint8Array>;
|
|
34
|
+
getPublicJwk(): Promise<JWK>;
|
|
35
|
+
getKid(): Promise<string>;
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=aws-kms-signer.d.ts.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type JWK } from 'jose';
|
|
2
|
+
import type { Signer } from './signer.js';
|
|
3
|
+
export declare class CommandSigner implements Signer {
|
|
4
|
+
private readonly command;
|
|
5
|
+
private readonly publicJwk;
|
|
6
|
+
readonly alg: 'ES256';
|
|
7
|
+
readonly signerKind = "command";
|
|
8
|
+
readonly keyRef: string;
|
|
9
|
+
private constructor();
|
|
10
|
+
/** Resolve the public JWK once (via `<command> get-public-jwk`) and build the signer. */
|
|
11
|
+
static create(opts: {
|
|
12
|
+
command: string;
|
|
13
|
+
}): Promise<CommandSigner>;
|
|
14
|
+
/** Build directly from a known public JWK (tests / preloaded material). */
|
|
15
|
+
static fromPublicJwk(opts: {
|
|
16
|
+
command: string;
|
|
17
|
+
publicJwk: JWK;
|
|
18
|
+
}): Promise<CommandSigner>;
|
|
19
|
+
sign(data: Uint8Array): Promise<Uint8Array>;
|
|
20
|
+
getPublicJwk(): Promise<JWK>;
|
|
21
|
+
getKid(): Promise<string>;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=command-signer.d.ts.map
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Persistent ES256 signer whose private JWK lives AES-256-GCM-wrapped in the
|
|
3
|
+
* orchestrator DB (`orchestrator_signing_keys.encrypted_private_jwk`), wrapped
|
|
4
|
+
* with the orchestrator's `KICI_SECRET_KEY` master key — the same posture as
|
|
5
|
+
* `scoped_secrets` and the run ephemeral keys. The master key lives in env / KMS
|
|
6
|
+
* and never in the DB, so a DB backup alone cannot sign.
|
|
7
|
+
*
|
|
8
|
+
* The in-memory private key is imported NON-EXTRACTABLE (`extractable: false`),
|
|
9
|
+
* so once loaded the raw private material can never be read back out of the
|
|
10
|
+
* process — the only export path is the public JWK. This is what makes the
|
|
11
|
+
* private key "non-exportable by design" (design spec § A / § H).
|
|
12
|
+
*/
|
|
13
|
+
import { type JWK } from 'jose';
|
|
14
|
+
import type { Signer } from './signer.js';
|
|
15
|
+
/** AAD binding the wrapped private JWK to its purpose (AES-GCM authenticated data). */
|
|
16
|
+
export declare const SIGNING_KEY_AAD = "orchestrator-signing-key";
|
|
17
|
+
/** Encrypt a private JWK with the master key. Returns the base64 wrapped blob. */
|
|
18
|
+
export declare function wrapPrivateJwk(privateJwk: JWK, secretKey: string): string;
|
|
19
|
+
/** Decrypt a wrapped private JWK with the master key. Throws on wrong key / tamper. */
|
|
20
|
+
export declare function unwrapPrivateJwk(encrypted: string, secretKey: string): JWK;
|
|
21
|
+
export declare class DbSigner implements Signer {
|
|
22
|
+
private readonly privateKey;
|
|
23
|
+
private readonly publicJwk;
|
|
24
|
+
readonly alg: 'ES256';
|
|
25
|
+
readonly signerKind = "db";
|
|
26
|
+
readonly keyRef: null;
|
|
27
|
+
private constructor();
|
|
28
|
+
/** Import an EC P-256 private JWK NON-EXTRACTABLE and derive its public half. */
|
|
29
|
+
private static fromPrivateJwk;
|
|
30
|
+
/**
|
|
31
|
+
* Generate a fresh ES256 keypair, wrap the private half with the master key,
|
|
32
|
+
* and return the signer + the artifacts to persist. The generated private key
|
|
33
|
+
* is extractable only long enough to serialize + wrap it; the returned signer
|
|
34
|
+
* re-imports it non-extractable.
|
|
35
|
+
*/
|
|
36
|
+
static generate(secretKey: string): Promise<{
|
|
37
|
+
signer: DbSigner;
|
|
38
|
+
publicJwk: JWK;
|
|
39
|
+
encryptedPrivateJwk: string;
|
|
40
|
+
kid: string;
|
|
41
|
+
}>;
|
|
42
|
+
/** Reconstruct a signer from a wrapped private JWK. */
|
|
43
|
+
static fromEncrypted(encryptedPrivateJwk: string, secretKey: string): Promise<DbSigner>;
|
|
44
|
+
sign(data: Uint8Array): Promise<Uint8Array>;
|
|
45
|
+
getPublicJwk(): Promise<JWK>;
|
|
46
|
+
getKid(): Promise<string>;
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=db-signer.d.ts.map
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OIDC ID-token claims for orchestrator-side minting — shared by the
|
|
3
|
+
* production orchestrator-owned mint (`orchestrator-mint.ts`) and the local
|
|
4
|
+
* dev-signed identity (`local-mint.ts`). Mirrors the Platform's claim shape so
|
|
5
|
+
* every bundle carries the exact same claims the agent's statement builder +
|
|
6
|
+
* the engine verifier expect — the cross-check between the in-toto statement
|
|
7
|
+
* and the token claims is identical across all minters. The dev-signed path
|
|
8
|
+
* differs only in the local sentinel issuer (`kici-local`) and the org anchor
|
|
9
|
+
* (`__default__`, the plane's default org).
|
|
10
|
+
*/
|
|
11
|
+
import { AttestationOrigin, SourceOrigin } from '@kici-dev/engine';
|
|
12
|
+
/** The subset of an execution_runs row the claims need. */
|
|
13
|
+
export interface RunClaimSource {
|
|
14
|
+
run_id: string;
|
|
15
|
+
org_id: string;
|
|
16
|
+
repo_identifier: string | null;
|
|
17
|
+
ref: string | null;
|
|
18
|
+
sha: string | null;
|
|
19
|
+
workflow_name: string | null;
|
|
20
|
+
provider: string | null;
|
|
21
|
+
/** True when the run executed an uploaded local working tree (`kici run remote`). */
|
|
22
|
+
local_working_tree: boolean;
|
|
23
|
+
}
|
|
24
|
+
/** The subset of an execution_jobs row the claims need. */
|
|
25
|
+
export interface JobClaimSource {
|
|
26
|
+
run_id: string;
|
|
27
|
+
job_id: string;
|
|
28
|
+
orchestrator_id: string | null;
|
|
29
|
+
status: string;
|
|
30
|
+
}
|
|
31
|
+
export interface BuildClaimsOpts {
|
|
32
|
+
issuer: string;
|
|
33
|
+
audience: string;
|
|
34
|
+
nowSeconds: number;
|
|
35
|
+
ttlSeconds: number;
|
|
36
|
+
/**
|
|
37
|
+
* Deferred-fulfilment marker: binds the frozen DSSE statement hash + the
|
|
38
|
+
* mint-timing origin. Absent for a live (synchronous) mint. The local dev
|
|
39
|
+
* plane never sets this; the orchestrator-owned mint sets it when re-minting
|
|
40
|
+
* for a completed job bound to a frozen statement.
|
|
41
|
+
*/
|
|
42
|
+
deferred?: {
|
|
43
|
+
statementHash: string;
|
|
44
|
+
origin: 'deferred' | 'offline-backfill';
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
export interface IdTokenClaims {
|
|
48
|
+
iss: string;
|
|
49
|
+
sub: string;
|
|
50
|
+
aud: string;
|
|
51
|
+
iat: number;
|
|
52
|
+
nbf: number;
|
|
53
|
+
exp: number;
|
|
54
|
+
jti: string;
|
|
55
|
+
kici_run_id: string;
|
|
56
|
+
kici_job_id: string;
|
|
57
|
+
repository: string | null;
|
|
58
|
+
ref: string | null;
|
|
59
|
+
sha: string | null;
|
|
60
|
+
workflow_ref: string | null;
|
|
61
|
+
orchestrator_id: string | null;
|
|
62
|
+
org_id: string;
|
|
63
|
+
source_origin: SourceOrigin;
|
|
64
|
+
provider: string | null;
|
|
65
|
+
statement_hash: string | null;
|
|
66
|
+
attestation_origin: AttestationOrigin;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Build the OIDC ID-token claims for a build job from the orchestrator's own
|
|
70
|
+
* execution_runs/execution_jobs rows. A live (synchronous) mint leaves
|
|
71
|
+
* `attestation_origin=live` and `statement_hash=null` (the statement is
|
|
72
|
+
* cross-checked field-by-field); a deferred fulfilment stamps the frozen
|
|
73
|
+
* statement hash + origin marker via `opts.deferred`.
|
|
74
|
+
*/
|
|
75
|
+
export declare function buildIdTokenClaims(run: RunClaimSource, job: JobClaimSource, opts: BuildClaimsOpts): IdTokenClaims;
|
|
76
|
+
//# sourceMappingURL=id-token-claims.d.ts.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compact-JWS assembly for the local dev-signed identity. Mirrors the Platform's
|
|
3
|
+
* `oidc/jwt.ts`: `jose.SignJWT` wants a local KeyLike, but our `LocalSigner`
|
|
4
|
+
* returns the JOSE-raw r||s ES256 signature directly, so we base64url-assemble
|
|
5
|
+
* the compact JWS (`header.payload.signature`) by hand.
|
|
6
|
+
*/
|
|
7
|
+
export interface JwsProtectedHeader {
|
|
8
|
+
alg: 'ES256';
|
|
9
|
+
kid: string;
|
|
10
|
+
typ: 'JWT';
|
|
11
|
+
}
|
|
12
|
+
/** The minimal signing surface `signCompactJws` needs (both `LocalSigner` and `Signer` satisfy it). */
|
|
13
|
+
export interface CompactJwsSigner {
|
|
14
|
+
sign(data: Uint8Array): Promise<Uint8Array>;
|
|
15
|
+
}
|
|
16
|
+
/** Assemble a compact JWS from a protected header + payload, signed by `signer`. */
|
|
17
|
+
export declare function signCompactJws(signer: CompactJwsSigner, protectedHeader: JwsProtectedHeader, payload: Record<string, unknown>): Promise<string>;
|
|
18
|
+
//# sourceMappingURL=jwt.d.ts.map
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { type JWK } from 'jose';
|
|
2
|
+
/** The fixed, non-prod dev-identity issuer. Never `https://api.kici.dev`. */
|
|
3
|
+
export declare const KICI_LOCAL_ISSUER = "kici-local";
|
|
4
|
+
/** Minimal signing seam mirrored from the Platform's `Signer` idiom. */
|
|
5
|
+
export interface LocalSigner {
|
|
6
|
+
readonly alg: 'ES256';
|
|
7
|
+
/** Sign `data`, returning the JOSE-raw (r||s) ES256 signature. */
|
|
8
|
+
sign(data: Uint8Array): Promise<Uint8Array>;
|
|
9
|
+
/** The public key as a JWK (kty EC, crv P-256, alg ES256, use sig, kid). */
|
|
10
|
+
getPublicJwk(): JWK;
|
|
11
|
+
/** RFC 7638 thumbprint of the public JWK — the token-header `kid`. */
|
|
12
|
+
getKid(): string;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* In-process ES256 signer over a persisted EC P-256 private JWK. NEVER selected
|
|
16
|
+
* in a Platform-connected deployment; the local dev plane is its only caller.
|
|
17
|
+
*/
|
|
18
|
+
export declare class LocalDevSigner implements LocalSigner {
|
|
19
|
+
private readonly privateKey;
|
|
20
|
+
private readonly publicJwk;
|
|
21
|
+
readonly alg: 'ES256';
|
|
22
|
+
private constructor();
|
|
23
|
+
/** Build a signer from an EC P-256 private JWK (`{ kty, crv, x, y, d }`). */
|
|
24
|
+
static fromPrivateJwk(jwk: JWK): Promise<LocalDevSigner>;
|
|
25
|
+
/** Read + import the private JWK from `path` (the plane's 0600 key file). */
|
|
26
|
+
static fromFile(path: string): Promise<LocalDevSigner>;
|
|
27
|
+
sign(data: Uint8Array): Promise<Uint8Array>;
|
|
28
|
+
getPublicJwk(): JWK;
|
|
29
|
+
getKid(): string;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=local-dev-signer.d.ts.map
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Local dev-signed OIDC mint (independent mode only).
|
|
3
|
+
*
|
|
4
|
+
* The Platform-connected orchestrator relays `oidc.token.request` to the hosted
|
|
5
|
+
* Platform, which reads its own run/job rows and mints (`ws/oidc-token-relay.ts`
|
|
6
|
+
* → `oidc.mint.request`). The offline local dev plane has no Platform, so this
|
|
7
|
+
* module mints locally: it reads the orchestrator's OWN execution_runs/
|
|
8
|
+
* execution_jobs rows and signs claims with the in-process `LocalDevSigner`,
|
|
9
|
+
* issuer `kici-local`.
|
|
10
|
+
*
|
|
11
|
+
* Security: this path is registered ONLY when the orchestrator runs in
|
|
12
|
+
* `independent` mode with a `LocalDevSigner` present, and app.ts registers the
|
|
13
|
+
* Platform relay in preference (the local path is registered strictly in the
|
|
14
|
+
* `else` branch), so a Platform-connected orchestrator can never reach the local
|
|
15
|
+
* signer — it keeps minting via the Platform exactly as today. The agent never
|
|
16
|
+
* asserts its own claims; every identity claim is read server-side from the
|
|
17
|
+
* orchestrator's rows, and the job-ownership check is against dispatch state.
|
|
18
|
+
*/
|
|
19
|
+
import type { Kysely } from 'kysely';
|
|
20
|
+
import { type OidcTokenResult } from '@kici-dev/engine/protocol/messages/oidc-token-relay';
|
|
21
|
+
import type { Database } from '../db/types.js';
|
|
22
|
+
import { type IdTokenClaims } from './id-token-claims.js';
|
|
23
|
+
import { type LocalSigner } from './local-dev-signer.js';
|
|
24
|
+
/** ID-token lifetime (seconds). Matches the Platform's 10-minute cap. */
|
|
25
|
+
export declare const LOCAL_ID_TOKEN_TTL_SECONDS = 600;
|
|
26
|
+
/** The org anchor stamped into a local-plane token (the plane's default org). */
|
|
27
|
+
export declare const LOCAL_ORG_ID = "__default__";
|
|
28
|
+
export declare class LocalMintRunNotFoundError extends Error {
|
|
29
|
+
}
|
|
30
|
+
export declare class LocalMintJobNotFoundError extends Error {
|
|
31
|
+
}
|
|
32
|
+
export declare class LocalMintJobNotActiveError extends Error {
|
|
33
|
+
}
|
|
34
|
+
export interface LocalMintDeps {
|
|
35
|
+
db: Kysely<Database>;
|
|
36
|
+
signer: LocalSigner;
|
|
37
|
+
orchestratorId: string;
|
|
38
|
+
/** Injectable clock (seconds). Defaults to wall-clock. */
|
|
39
|
+
nowSeconds?: () => number;
|
|
40
|
+
}
|
|
41
|
+
export interface LocalMintInput {
|
|
42
|
+
runId: string;
|
|
43
|
+
jobId: string;
|
|
44
|
+
audience: string;
|
|
45
|
+
}
|
|
46
|
+
export interface LocalMintResult {
|
|
47
|
+
token: string;
|
|
48
|
+
expiresIn: number;
|
|
49
|
+
jti: string;
|
|
50
|
+
claims: IdTokenClaims;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Mint a short-lived dev-signed ES256 ID token for (run, job). Every identity
|
|
54
|
+
* claim is read from the orchestrator's own run/job rows; the token is never
|
|
55
|
+
* logged.
|
|
56
|
+
*/
|
|
57
|
+
export declare function mintLocalIdToken(deps: LocalMintDeps, input: LocalMintInput): Promise<LocalMintResult>;
|
|
58
|
+
/** Job-ownership resolver surface (the dispatcher's `resolveOwnedJob`). */
|
|
59
|
+
export interface LocalMintOwnershipResolver {
|
|
60
|
+
resolveOwnedJob(agentId: string, jobId: string): {
|
|
61
|
+
runId: string;
|
|
62
|
+
} | undefined;
|
|
63
|
+
}
|
|
64
|
+
export declare class LocalMintRejectedError extends Error {
|
|
65
|
+
}
|
|
66
|
+
export interface LocalOidcTokenHandlerDeps {
|
|
67
|
+
dispatcher: LocalMintOwnershipResolver;
|
|
68
|
+
mint: LocalMintDeps;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Build the agent.api handler for `OIDC_TOKEN_REQUEST_METHOD` in independent
|
|
72
|
+
* mode. Verifies the agent owns the named job (resolving its runId from the
|
|
73
|
+
* dispatcher — never trusting an agent-asserted value), then mints locally. A
|
|
74
|
+
* job the agent does not own is rejected without minting anything.
|
|
75
|
+
*/
|
|
76
|
+
export declare function createLocalOidcTokenHandler(deps: LocalOidcTokenHandlerDeps): (agentId: string, params: Record<string, unknown>) => Promise<OidcTokenResult>;
|
|
77
|
+
//# sourceMappingURL=local-mint.d.ts.map
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Selects which OIDC-mint handler backs `OIDC_TOKEN_REQUEST_METHOD` — the
|
|
3
|
+
* anti-forgery choke point for signed identity.
|
|
4
|
+
*
|
|
5
|
+
* The rule (enforced here, unit-tested in `oidc-mint-registration.test.ts`):
|
|
6
|
+
*
|
|
7
|
+
* 1. **Orchestrator-owned signing** (a resolved signer + the orchestrator's own
|
|
8
|
+
* provenance issuer) → the **orchestrator** handler, minting + signing
|
|
9
|
+
* locally. Wins whenever signing is configured — even Platform-connected —
|
|
10
|
+
* because the orchestrator is now the root of trust.
|
|
11
|
+
* 2. **Platform-connected** (platformUrl + token + client), no signer → the
|
|
12
|
+
* **relay** handler, minting via the hosted Platform (the DEPRECATED path,
|
|
13
|
+
* kept for orchestrators with no signer configured).
|
|
14
|
+
* 3. **Offline local dev plane** (independent identity + a local signer, AND
|
|
15
|
+
* NOT Platform-connected) → the **local** dev-signed handler (`kici-local`).
|
|
16
|
+
* 4. None → **no** registration (the method returns "unknown method").
|
|
17
|
+
*
|
|
18
|
+
* The identity claims are always read SERVER-SIDE from the orchestrator's own
|
|
19
|
+
* rows and job ownership from dispatch state — no forgeable agent-asserted mint
|
|
20
|
+
* path appears in any case.
|
|
21
|
+
*/
|
|
22
|
+
import type { Kysely } from 'kysely';
|
|
23
|
+
import type { OidcTokenResult } from '@kici-dev/engine/protocol/messages/oidc-token-relay';
|
|
24
|
+
import type { Database } from '../db/types.js';
|
|
25
|
+
import { type MintPlatformClient } from '../ws/oidc-token-relay.js';
|
|
26
|
+
import { type LocalMintOwnershipResolver } from './local-mint.js';
|
|
27
|
+
import type { LocalSigner } from './local-dev-signer.js';
|
|
28
|
+
import type { Signer } from './signer.js';
|
|
29
|
+
export type OidcMintHandler = (agentId: string, params: Record<string, unknown>) => Promise<OidcTokenResult>;
|
|
30
|
+
export interface OidcMintRegistration {
|
|
31
|
+
/**
|
|
32
|
+
* `orchestrator` = orchestrator-owned signing (the new root of trust);
|
|
33
|
+
* `relay` = Platform-minted (deprecated); `local` = offline dev-signed.
|
|
34
|
+
*/
|
|
35
|
+
kind: 'orchestrator' | 'relay' | 'local';
|
|
36
|
+
handler: OidcMintHandler;
|
|
37
|
+
}
|
|
38
|
+
export interface OidcMintRegistrationInput {
|
|
39
|
+
platformUrl?: string;
|
|
40
|
+
platformToken?: string;
|
|
41
|
+
platformClient?: MintPlatformClient;
|
|
42
|
+
independentIdentity: boolean;
|
|
43
|
+
localOidcSigner?: LocalSigner;
|
|
44
|
+
/**
|
|
45
|
+
* Lazily resolve the orchestrator's own provenance signer (Task 7 reconcile).
|
|
46
|
+
* Present whenever orchestrator-owned signing is configured; the signer itself
|
|
47
|
+
* is resolved on first mint (leader-election-race-safe).
|
|
48
|
+
*/
|
|
49
|
+
resolveOrchestratorSigner?: () => Promise<Signer | null>;
|
|
50
|
+
/** The orchestrator's own provenance issuer identity (config.provenanceSigningIssuer). */
|
|
51
|
+
provenanceSigningIssuer?: string;
|
|
52
|
+
dispatcher: LocalMintOwnershipResolver & {
|
|
53
|
+
resolveOwnedJob(agentId: string, jobId: string): {
|
|
54
|
+
runId: string;
|
|
55
|
+
} | undefined;
|
|
56
|
+
};
|
|
57
|
+
db: Kysely<Database>;
|
|
58
|
+
orchestratorId: string;
|
|
59
|
+
testMode: boolean;
|
|
60
|
+
testMintDeferAudience?: string;
|
|
61
|
+
testMintRejectAudience?: string;
|
|
62
|
+
}
|
|
63
|
+
/** Decide which mint handler (if any) backs `OIDC_TOKEN_REQUEST_METHOD`. */
|
|
64
|
+
export declare function selectOidcMintRegistration(input: OidcMintRegistrationInput): OidcMintRegistration | undefined;
|
|
65
|
+
//# sourceMappingURL=oidc-mint-registration.d.ts.map
|