@kici-dev/orchestrator 0.1.27 → 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 +56 -4
- package/dist/artifacts/artifact-store.d.ts +233 -0
- package/dist/artifacts/failure-messages.d.ts +46 -0
- package/dist/audit/access-log.d.ts +18 -1
- package/dist/cache/dep-cache.d.ts +15 -0
- package/dist/cache/user-cache.d.ts +37 -0
- package/dist/cancel/cancel-run.d.ts +10 -3
- package/dist/cancel/dashboard-cancel-handler.d.ts +19 -0
- package/dist/cli/api-client.d.ts +22 -1
- package/dist/cli/commands/agent-package.d.ts +34 -0
- package/dist/cli/commands/check-run.d.ts +26 -0
- package/dist/cli/commands/cluster-settings.d.ts +55 -0
- package/dist/cli/commands/dashboard-encryption-key.d.ts +3 -0
- package/dist/cli/commands/db-backup.d.ts +71 -0
- package/dist/cli/commands/orchestrator-service/drain.d.ts +31 -0
- package/dist/cli/commands/orchestrator-service/index.d.ts +7 -4
- package/dist/cli/commands/orchestrator-service/install-env.d.ts +58 -0
- package/dist/cli/commands/secret.d.ts +45 -1
- package/dist/cli/commands/shared/admin-cli-access-log.d.ts +46 -0
- package/dist/cli/commands/shared/versioned-upgrade.d.ts +65 -2
- package/dist/cli/commands/signing-key.d.ts +3 -0
- package/dist/cli/commands/source.d.ts +12 -0
- package/dist/cli/commands/token.d.ts +9 -0
- package/dist/cli/commands/trust-policy.d.ts +48 -0
- package/dist/cli/join.d.ts +1 -1
- package/dist/cli/service/index.d.ts +2 -2
- package/dist/cli/service/instance/manifest.d.ts +17 -0
- package/dist/cli/service/instance/resolve.d.ts +11 -0
- package/dist/cli/wizard/orchestrator-wizard.d.ts +39 -11
- package/dist/cli.js +9818 -3408
- 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 +363 -53
- package/dist/contexts/context-store.d.ts +21 -8
- package/dist/contexts/glob-specificity.d.ts +30 -0
- package/dist/contexts/held-runs.d.ts +51 -19
- package/dist/contexts/protection/aggregate.d.ts +2 -2
- package/dist/contexts/protection/concurrency-gate.d.ts +0 -3
- package/dist/contexts/protection/reviewer-gate.d.ts +0 -3
- package/dist/contexts/protection/satisfiability.d.ts +1 -1
- package/dist/contexts/protection/trust-gate.d.ts +0 -3
- package/dist/contexts/protection/wait-timer-gate.d.ts +0 -3
- package/dist/cron/cron-scheduler.d.ts +24 -4
- package/dist/cron/cron-store.d.ts +21 -7
- package/dist/dashboard/attestation-filters.d.ts +92 -74
- package/dist/dashboard/handler.d.ts +35 -1
- package/dist/db/migration-test-harness.d.ts +41 -0
- package/dist/db/migrations/069_reroute_tunables.d.ts +21 -0
- package/dist/db/migrations/070_execution_runs_failure_class.d.ts +4 -0
- package/dist/db/migrations/071_batch_accumulation.d.ts +26 -0
- package/dist/db/migrations/072_dispatch_queue_run_id_index.d.ts +15 -0
- package/dist/db/migrations/073_org_settings_ingest_concurrency.d.ts +13 -0
- package/dist/db/migrations/074_normalize_zero_concurrency_limit.d.ts +13 -0
- package/dist/db/migrations/075_ingest_overflow_buffer.d.ts +16 -0
- package/dist/db/migrations/076_artifacts.d.ts +19 -0
- package/dist/db/migrations/077_backup_runs.d.ts +13 -0
- package/dist/db/migrations/078_org_settings_backup_staleness.d.ts +12 -0
- package/dist/db/migrations/079_org_settings_scaler_spawn_timeout.d.ts +14 -0
- package/dist/db/migrations/080_cluster_settings.d.ts +17 -0
- package/dist/db/migrations/081_org_settings_queue_timeout.d.ts +19 -0
- package/dist/db/migrations/082_host_s3_reachable.d.ts +16 -0
- package/dist/db/migrations/083_org_settings_artifact_caps.d.ts +18 -0
- package/dist/db/migrations/084_orchestrator_signing_keys.d.ts +20 -0
- package/dist/db/migrations/085_cluster_settings_reroute_flap_grace_ms.d.ts +12 -0
- package/dist/db/migrations/086_cluster_settings_max_fanout_hosts.d.ts +12 -0
- package/dist/db/migrations/087_cluster_settings_event_router_rate_limit.d.ts +12 -0
- package/dist/db/migrations/088_cluster_settings_cache_max_tarball_bytes.d.ts +12 -0
- package/dist/db/migrations/089_cluster_settings_cache_ttl_days.d.ts +12 -0
- package/dist/db/migrations/090_cluster_settings_concurrency_wait_timeout_ms.d.ts +12 -0
- package/dist/db/migrations/091_cluster_settings_agent_token_ttl_ms.d.ts +12 -0
- package/dist/db/migrations/092_cluster_settings_version.d.ts +16 -0
- package/dist/db/migrations/093_org_settings_sandbox_allowlist.d.ts +4 -0
- package/dist/db/migrations/094_dashboard_encryption_keys.d.ts +21 -0
- package/dist/db/migrations/095_dashboard_write_policy_tristate.d.ts +20 -0
- package/dist/db/migrations/096_multi_schedule_cron_last_fired.d.ts +4 -0
- package/dist/db/migrations/097_execution_runs_pr_number.d.ts +4 -0
- package/dist/db/migrations/098_execution_runs_customer_id.d.ts +4 -0
- package/dist/db/migrations/099_cluster_settings_dashboard_verified_issuer.d.ts +21 -0
- package/dist/db/migrations/100_held_runs_hold_type_vocabulary.d.ts +31 -0
- package/dist/db/migrations/101_contexts_hold_expiry_drop_default.d.ts +31 -0
- package/dist/db/migrations/102_dispatch_queue_agent_id.d.ts +20 -0
- package/dist/db/migrations/103_cluster_settings_ownership_db_check_timeout_ms.d.ts +20 -0
- package/dist/db/migrations/104_check_run_terminal_sent.d.ts +22 -0
- package/dist/db/migrations/105_org_trust_policy.d.ts +19 -0
- package/dist/db/migrations/106_cluster_settings_check_run_tracking_ttl_days.d.ts +18 -0
- package/dist/db/migrations/107_check_run_tracking_updated_at_index.d.ts +23 -0
- package/dist/db/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 +421 -7
- package/dist/deployment/deployment-identity.d.ts +87 -2
- package/dist/diagnostics/checks/backup.d.ts +18 -0
- package/dist/diagnostics/checks/index.d.ts +2 -1
- package/dist/diagnostics/fleet-collector.d.ts +1 -1
- package/dist/drain/drain-controller.d.ts +52 -0
- package/dist/events/batch-accumulator.d.ts +63 -0
- package/dist/events/circuit-breaker.d.ts +9 -3
- package/dist/events/event-emitter.d.ts +31 -0
- package/dist/events/event-retry-scanner.d.ts +12 -2
- package/dist/events/event-router.d.ts +29 -0
- package/dist/firecracker/host-network.d.ts +2 -0
- package/dist/firecracker/net-interfaces.d.ts +14 -0
- package/dist/github-app-name-refresher/github-app-name-refresher.d.ts +18 -8
- package/dist/index.d.ts +2 -0
- package/dist/index.js +604 -16
- package/dist/lockfile-cache.d.ts +4 -0
- package/dist/lockfile-validate.d.ts +16 -9
- package/dist/metrics/prometheus.d.ts +112 -15
- package/dist/oidc/aws-kms-signer.d.ts +37 -0
- package/dist/oidc/command-signer.d.ts +23 -0
- package/dist/oidc/db-signer.d.ts +48 -0
- package/dist/oidc/id-token-claims.d.ts +22 -9
- package/dist/oidc/jwt.d.ts +5 -2
- package/dist/oidc/local-dev-signer.d.ts +1 -1
- package/dist/oidc/oidc-mint-registration.d.ts +27 -11
- package/dist/oidc/orchestrator-mint.d.ts +97 -0
- package/dist/oidc/orchestrator-signer-factory.d.ts +33 -0
- package/dist/oidc/reconcile-signing-key.d.ts +21 -0
- package/dist/oidc/signer.d.ts +25 -0
- package/dist/oidc/signing-key-status.d.ts +23 -0
- package/dist/orchestrator-core.d.ts +42 -2
- package/dist/pipeline/decorating-secret-resolver.d.ts +3 -2
- package/dist/pipeline/dispatch-matched-workflow.d.ts +41 -0
- package/dist/pipeline/install-secrets-resolver.d.ts +12 -1
- package/dist/pipeline/manual-schedule.d.ts +20 -13
- package/dist/pipeline/pending-workflow-context.d.ts +1 -1
- package/dist/pipeline/process-webhook.d.ts +57 -2
- package/dist/pipeline/processor.d.ts +44 -8
- package/dist/pipeline/rerun.d.ts +12 -13
- package/dist/pipeline/resolve-sandbox-grant.d.ts +28 -0
- package/dist/pipeline/route-or-dispatch-jobs.d.ts +71 -0
- package/dist/pipeline/sandbox-allowlist-reader.d.ts +33 -0
- package/dist/policy/dashboard-write-policy.d.ts +9 -4
- package/dist/provenance/backfill-run.d.ts +1 -0
- package/dist/provenance/trust-root.d.ts +13 -0
- package/dist/providers/generic/normalizer.d.ts +1 -1
- package/dist/providers/github/auth.d.ts +1 -1
- package/dist/providers/github/changed-files.d.ts +14 -6
- package/dist/providers/github/check-status-poster.d.ts +19 -3
- package/dist/providers/github/contributor-resolver.d.ts +1 -1
- package/dist/providers/github/lock-file.d.ts +1 -1
- package/dist/providers/github/normalizer.d.ts +1 -1
- package/dist/providers/github/repo-url.d.ts +1 -1
- package/dist/providers/local/lock-file-fetcher.d.ts +1 -1
- package/dist/providers/local/normalizer.d.ts +1 -1
- package/dist/providers/local/repo-url-builder.d.ts +1 -1
- package/dist/providers/universal-git/changed-files.d.ts +8 -7
- package/dist/providers/universal-git/clone-token.d.ts +1 -1
- package/dist/providers/universal-git/config.d.ts +4 -4
- package/dist/providers/universal-git/index.d.ts +5 -1
- package/dist/providers/universal-git/lock-file.d.ts +6 -1
- package/dist/providers/universal-git/normalizer.d.ts +1 -1
- package/dist/providers/universal-git/repo-url.d.ts +1 -1
- package/dist/queue/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 +156 -10
- package/dist/reporting/fs-log-storage.d.ts +31 -2
- package/dist/reporting/job-check-run-completion.d.ts +50 -0
- package/dist/reporting/log-chunk-sink.d.ts +47 -0
- package/dist/reporting/log-retention.d.ts +16 -0
- package/dist/reporting/log-storage.d.ts +64 -4
- package/dist/reporting/log-writer.d.ts +22 -7
- package/dist/reporting/peer-log-normalize.d.ts +14 -0
- package/dist/reporting/run-aggregator.d.ts +32 -32
- package/dist/reporting/s3-log-storage.d.ts +102 -8
- package/dist/routes/admin-auth.d.ts +90 -0
- package/dist/routes/admin-cluster-settings.d.ts +31 -0
- package/dist/routes/admin-events.d.ts +3 -0
- package/dist/routes/admin-orchestrator-drain.d.ts +35 -0
- package/dist/routes/admin-runs.d.ts +9 -0
- package/dist/routes/admin-sources.d.ts +7 -0
- package/dist/routes/admin-trust-policy.d.ts +49 -0
- package/dist/routes/admin.d.ts +15 -1
- package/dist/routes/github-webhook.d.ts +9 -3
- package/dist/routes/provenance-oidc.d.ts +38 -0
- package/dist/routes/verify-attestation.d.ts +21 -0
- package/dist/scaler/bare-metal-backend.d.ts +9 -2
- package/dist/scaler/config.d.ts +25 -4
- package/dist/scaler/container-backend.d.ts +9 -1
- package/dist/scaler/firecracker-backend.d.ts +29 -2
- package/dist/scaler/index.d.ts +1 -1
- package/dist/scaler/manager.d.ts +166 -8
- package/dist/scaler/pending-scale-sweeper.d.ts +35 -0
- package/dist/scaler/types.d.ts +75 -6
- package/dist/secrets/backend-registry.d.ts +32 -1
- package/dist/secrets/dashboard-encryption-key.d.ts +48 -0
- package/dist/secrets/ephemeral-keys.d.ts +16 -0
- package/dist/secrets/pg-secret-store.d.ts +10 -0
- package/dist/secrets/rbac.d.ts +5 -1
- package/dist/secrets/routing-key-scope.d.ts +6 -0
- package/dist/secrets/scope-routing.d.ts +126 -0
- package/dist/secrets/secret-resolver.d.ts +1 -14
- package/dist/secrets/token-manager.d.ts +5 -1
- package/dist/security/contributor-cache.d.ts +9 -1
- package/dist/security/trust-policy-gate.d.ts +117 -0
- package/dist/security/trust-policy-store.d.ts +78 -0
- package/dist/server.js +35769 -25052
- package/dist/sources/source-manager.d.ts +24 -0
- package/dist/stale-detector/stale-run-detector.d.ts +7 -0
- package/dist/standalone.js +34831 -25317
- package/dist/storage/filesystem.d.ts +17 -0
- package/dist/storage/key-discriminator.d.ts +20 -0
- package/dist/storage/s3.d.ts +2 -0
- package/dist/storage/types.d.ts +16 -0
- package/dist/webhook/dedup.d.ts +9 -1
- package/dist/webhook/event-log.d.ts +13 -2
- package/dist/webhook/generic-sources-listener.d.ts +4 -0
- package/dist/webhook/ingest-admission.d.ts +140 -0
- package/dist/webhook/ingest-overflow-buffer.d.ts +27 -0
- package/dist/webhook/ingest-overflow-replayer.d.ts +49 -0
- package/dist/webhook/ingest-overflow-types.d.ts +73 -0
- package/dist/webhook/loop-lag-source.d.ts +40 -0
- package/dist/webhook/observed-relay-guard.d.ts +40 -0
- package/dist/webhook/org-ingest-cap-reader.d.ts +24 -0
- package/dist/webhook/register-source-bundle.d.ts +3 -0
- package/dist/webhook/relay-reinject.d.ts +43 -0
- package/dist/worker/in-memory-job-queue.d.ts +8 -3
- package/dist/worker-core.d.ts +10 -0
- package/dist/ws/agent-api-registry.d.ts +20 -0
- package/dist/ws/agent-handler.d.ts +63 -7
- package/dist/ws/bringup-api.d.ts +99 -0
- package/dist/ws/dashboard-context-handler.d.ts +28 -10
- package/dist/ws/dashboard-run-state-handler.d.ts +31 -0
- package/dist/ws/failure-messages.d.ts +29 -0
- package/dist/ws/oidc-token-relay.d.ts +9 -0
- package/dist/ws/ownership-gate.d.ts +22 -0
- package/dist/ws/platform-client.d.ts +96 -1
- package/dist/ws/replay-chunker.d.ts +37 -0
- package/installer-image-digests.json +3 -3
- package/package.json +22 -21
- package/sbom.spdx.json +1240 -1788
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { ResolvedSandboxGrant, SandboxNetworkMode } from '@kici-dev/engine';
|
|
2
|
+
import type { SandboxAllowList } from './sandbox-allowlist-reader.js';
|
|
3
|
+
/** The workflow-declared per-job escape-hatch request carried in the lock. */
|
|
4
|
+
export interface SandboxRequest {
|
|
5
|
+
capabilities?: string[];
|
|
6
|
+
network?: SandboxNetworkMode;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* The resolution outcome: either an authorized grant (possibly `undefined` when
|
|
10
|
+
* the request is a no-op / non-escalating) or a total, loud denial.
|
|
11
|
+
*/
|
|
12
|
+
export type SandboxGrantResolution = {
|
|
13
|
+
grant?: ResolvedSandboxGrant;
|
|
14
|
+
} | {
|
|
15
|
+
denied: {
|
|
16
|
+
reason: string;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Resolve a workflow-declared sandbox request against the operator's allow-list
|
|
21
|
+
* (the single enforcement point). Deny is loud and total — a request for any
|
|
22
|
+
* capability or host-network the operator did not allow-list fails the run with
|
|
23
|
+
* a reason naming the offending cap/knob; a disallowed cap is never silently
|
|
24
|
+
* stripped and run anyway. Pure (no I/O), so the allow-list is injected and the
|
|
25
|
+
* function is exhaustively unit-testable.
|
|
26
|
+
*/
|
|
27
|
+
export declare function resolveSandboxGrant(request: SandboxRequest | undefined, allowList: SandboxAllowList): SandboxGrantResolution;
|
|
28
|
+
//# sourceMappingURL=resolve-sandbox-grant.d.ts.map
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared coordinator-route / direct-dispatch machinery for the orchestrator
|
|
3
|
+
* pipeline.
|
|
4
|
+
*
|
|
5
|
+
* The re-run path (`rerun.ts`) and the manual-schedule path
|
|
6
|
+
* (`manual-schedule.ts`) both materialize a workflow's static jobs, try to
|
|
7
|
+
* route them through the cluster coordinator (local dispatch first, then
|
|
8
|
+
* reroute to peers), fall back to direct local dispatch in standalone mode or
|
|
9
|
+
* on a coordinator timeout, and synthesize records for rejected jobs. This
|
|
10
|
+
* module implements that once so a fix lands in a single place.
|
|
11
|
+
*/
|
|
12
|
+
import { createLogger } from '@kici-dev/shared';
|
|
13
|
+
import type { LockJob, MaterializedJob } from '@kici-dev/engine';
|
|
14
|
+
import type { RunContext, RunCoordinator } from '../cluster/coordinator.js';
|
|
15
|
+
import type { Dispatcher } from '../agent/dispatcher.js';
|
|
16
|
+
import type { ExecutionTracker } from '../reporting/execution-tracker.js';
|
|
17
|
+
export interface DispatchedJobEntry {
|
|
18
|
+
jobId: string;
|
|
19
|
+
jobName: string;
|
|
20
|
+
matrixValues?: Record<string, unknown>;
|
|
21
|
+
runsOnLabels?: string[];
|
|
22
|
+
}
|
|
23
|
+
export interface RejectedJobEntry {
|
|
24
|
+
jobId: string;
|
|
25
|
+
reason: string;
|
|
26
|
+
}
|
|
27
|
+
export interface RouteOrDispatchOptions {
|
|
28
|
+
newRunId: string;
|
|
29
|
+
/** Static jobs before materialization — the helper materializes + handles FanoutError. */
|
|
30
|
+
staticJobs: LockJob[];
|
|
31
|
+
workflowName: string;
|
|
32
|
+
repoUrl: string;
|
|
33
|
+
ref: string;
|
|
34
|
+
sha: string;
|
|
35
|
+
deliveryId: string;
|
|
36
|
+
provider: string;
|
|
37
|
+
providerContext: Record<string, unknown>;
|
|
38
|
+
routingKey: string;
|
|
39
|
+
/** Prebuilt by the caller (event name / payload / installationId differ per path). */
|
|
40
|
+
runContext: RunContext;
|
|
41
|
+
/** Per-caller jobConfig shape (schedule dispatchInputs vs. rerun source fallback). */
|
|
42
|
+
buildJobConfig: (mat: MaterializedJob) => Record<string, unknown>;
|
|
43
|
+
/** Caller's own logger — keeps the originating prefix ('manual-schedule' / 'rerun'). */
|
|
44
|
+
logger: ReturnType<typeof createLogger>;
|
|
45
|
+
/** Human label used in log messages: 'Manual schedule' | 'Re-run'. */
|
|
46
|
+
label: string;
|
|
47
|
+
coordinator: RunCoordinator | null;
|
|
48
|
+
dispatcher: Dispatcher;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Materialize the static jobs (degrading gracefully on a matrix that can no
|
|
52
|
+
* longer expand), then route them via the coordinator or, in standalone mode /
|
|
53
|
+
* on a coordinator timeout, dispatch directly. Returns the jobs to register
|
|
54
|
+
* with the execution tracker plus any synthetic-rejected IDs to mark failed.
|
|
55
|
+
*/
|
|
56
|
+
export declare function routeOrDispatchJobs(opts: RouteOrDispatchOptions): Promise<{
|
|
57
|
+
dispatchedJobs: DispatchedJobEntry[];
|
|
58
|
+
rejectedJobs: RejectedJobEntry[];
|
|
59
|
+
}>;
|
|
60
|
+
export interface RegisterDispatchedJobsOptions {
|
|
61
|
+
newRunId: string;
|
|
62
|
+
dispatchedJobs: DispatchedJobEntry[];
|
|
63
|
+
rejectedJobs: RejectedJobEntry[];
|
|
64
|
+
executionTracker: ExecutionTracker;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Register dispatched jobs with the execution tracker, then mark any
|
|
68
|
+
* synthetic-rejected jobs failed. No-op when nothing was dispatched.
|
|
69
|
+
*/
|
|
70
|
+
export declare function registerDispatchedJobs(opts: RegisterDispatchedJobsOptions): Promise<void>;
|
|
71
|
+
//# sourceMappingURL=route-or-dispatch-jobs.d.ts.map
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { Kysely } from 'kysely';
|
|
2
|
+
import type { Database } from '../db/types.js';
|
|
3
|
+
/**
|
|
4
|
+
* The operator-controlled per-org escape-hatch allow-list. `capabilities` are
|
|
5
|
+
* stored canonicalized (bare uppercase Docker-API form) so the dispatch resolver
|
|
6
|
+
* compares canonical-to-canonical.
|
|
7
|
+
*/
|
|
8
|
+
export interface SandboxAllowList {
|
|
9
|
+
capabilities: string[];
|
|
10
|
+
allowHostNetwork: boolean;
|
|
11
|
+
}
|
|
12
|
+
export interface SandboxAllowListReader {
|
|
13
|
+
/**
|
|
14
|
+
* Read the org's escape-hatch allow-list. Never throws; on a DB error (or no
|
|
15
|
+
* DB handle) it degrades to the safe deny-all default `{ capabilities: [],
|
|
16
|
+
* allowHostNetwork: false }` so a sick DB denies escalation rather than
|
|
17
|
+
* blocking dispatch.
|
|
18
|
+
*/
|
|
19
|
+
read(orgId: string): Promise<SandboxAllowList>;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Reader for the per-org container-sandbox escape-hatch allow-list. Read once per
|
|
23
|
+
* matched-workflow dispatch (not per request), against a single indexed row, so
|
|
24
|
+
* it is intentionally **uncached**: this is a security control, and an operator's
|
|
25
|
+
* `sandbox-allowlist` change must take effect on the very next dispatch (a cache
|
|
26
|
+
* would leave the old policy in force for its TTL — a stale-deny or stale-allow
|
|
27
|
+
* window on a privilege boundary). The trivial per-dispatch query is the right
|
|
28
|
+
* trade for always-fresh enforcement.
|
|
29
|
+
*/
|
|
30
|
+
export declare function createSandboxAllowListReader(deps: {
|
|
31
|
+
db?: Kysely<Database>;
|
|
32
|
+
}): SandboxAllowListReader;
|
|
33
|
+
//# sourceMappingURL=sandbox-allowlist-reader.d.ts.map
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
*/
|
|
21
21
|
import { EventEmitter } from 'node:events';
|
|
22
22
|
import { type Kysely } from 'kysely';
|
|
23
|
-
import { DashboardWriteOperation, type DashboardWritePolicyMap } from '@kici-dev/engine/protocol/dashboard-write-operations';
|
|
23
|
+
import { DashboardWriteOperation, type DashboardWritePolicyMap, type DashboardWritePolicyState } from '@kici-dev/engine/protocol/dashboard-write-operations';
|
|
24
24
|
import type { Database } from '../db/types.js';
|
|
25
25
|
import type { ActorPrincipal } from '@kici-dev/engine';
|
|
26
26
|
/**
|
|
@@ -37,7 +37,7 @@ export declare const dashboardWritePolicyEvents: EventEmitter<[never]>;
|
|
|
37
37
|
export declare class DashboardWritePolicyDisabledError extends Error {
|
|
38
38
|
readonly operation: DashboardWriteOperation;
|
|
39
39
|
readonly cliEquivalent: string;
|
|
40
|
-
readonly code:
|
|
40
|
+
readonly code: 'operation_disabled';
|
|
41
41
|
constructor(operation: DashboardWriteOperation, cliEquivalent: string);
|
|
42
42
|
}
|
|
43
43
|
/**
|
|
@@ -64,6 +64,11 @@ export declare function getDashboardWritePolicy(db: Kysely<Database>, customerId
|
|
|
64
64
|
* `getDashboardWritePolicy` + the engine-side resolver.
|
|
65
65
|
*/
|
|
66
66
|
export declare function isDashboardWriteEnabled(db: Kysely<Database>, customerId: string, op: DashboardWriteOperation): Promise<boolean>;
|
|
67
|
+
/**
|
|
68
|
+
* Resolve the tri-state posture (`permissive` | `encrypted` | `disabled`) for
|
|
69
|
+
* an operation. Reads through the same 30 s cache as the enabled check.
|
|
70
|
+
*/
|
|
71
|
+
export declare function getDashboardWritePolicyState(db: Kysely<Database>, customerId: string, op: DashboardWriteOperation): Promise<DashboardWritePolicyState>;
|
|
67
72
|
/**
|
|
68
73
|
* Defense-in-depth gate for orch-side dashboard.* handlers. Throws
|
|
69
74
|
* `DashboardWritePolicyDisabledError` when the operation is disabled.
|
|
@@ -100,8 +105,8 @@ export interface PolicyChangeEvent {
|
|
|
100
105
|
actor: ActorPrincipal;
|
|
101
106
|
customerId: string;
|
|
102
107
|
op: DashboardWriteOperation;
|
|
103
|
-
prior:
|
|
104
|
-
next:
|
|
108
|
+
prior: DashboardWritePolicyState;
|
|
109
|
+
next: DashboardWritePolicyState;
|
|
105
110
|
}
|
|
106
111
|
/**
|
|
107
112
|
* Reset to the permissive defaults (everything enabled). Useful for
|
|
@@ -16,6 +16,19 @@ export interface ProvenanceTrustRoot {
|
|
|
16
16
|
getJwks(kid?: string): Promise<JSONWebKeySet | null>;
|
|
17
17
|
setIssuer(issuer: string | null): void;
|
|
18
18
|
}
|
|
19
|
+
/**
|
|
20
|
+
* A trust root backed by the orchestrator's OWN signing keys (Phase 1
|
|
21
|
+
* orchestrator-owned attestations). Verify-at-ingest resolves the key set from
|
|
22
|
+
* the `orchestrator_signing_keys` table so fresh rotations / revocations are
|
|
23
|
+
* reflected immediately, and the issuer is the orchestrator's own configured
|
|
24
|
+
* provenance issuer. The key set is read fresh from the DB each resolve (a cheap
|
|
25
|
+
* read; ingest verification is not hot), so a rotated-in `kid` is always found.
|
|
26
|
+
*/
|
|
27
|
+
export declare function provenanceTrustRootFromRepo(repo: {
|
|
28
|
+
listTrusted: () => Promise<{
|
|
29
|
+
public_jwk: unknown;
|
|
30
|
+
}[]>;
|
|
31
|
+
}, issuer: string): ProvenanceTrustRoot;
|
|
19
32
|
export declare function createProvenanceTrustRoot(opts?: {
|
|
20
33
|
issuer?: string | null;
|
|
21
34
|
fetchImpl?: typeof fetch;
|
|
@@ -17,7 +17,7 @@ import type { GenericSourceManager } from '../../webhook/generic-sources.js';
|
|
|
17
17
|
*/
|
|
18
18
|
export declare class GenericWebhookNormalizer implements WebhookNormalizer {
|
|
19
19
|
private readonly sourceManager;
|
|
20
|
-
readonly provider:
|
|
20
|
+
readonly provider: 'generic';
|
|
21
21
|
constructor(sourceManager: GenericSourceManager);
|
|
22
22
|
/**
|
|
23
23
|
* Extract routing key from the X-KiCI-Source-ID header.
|
|
@@ -44,7 +44,7 @@ export declare function createInstallationOctokit(config: GitHubAppConfig, insta
|
|
|
44
44
|
*/
|
|
45
45
|
export declare class GitHubCloneTokenProvider implements CloneTokenProvider {
|
|
46
46
|
private readonly config;
|
|
47
|
-
readonly provider:
|
|
47
|
+
readonly provider: 'github';
|
|
48
48
|
constructor(config: GitHubAppConfig);
|
|
49
49
|
/** Get the GitHub App config for this provider instance. */
|
|
50
50
|
getAppConfig(): GitHubAppConfig;
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Implements the ChangedFilesFetcher interface from @kici-dev/engine for GitHub.
|
|
5
5
|
* Retrieves changed files for PR and push events via the GitHub API.
|
|
6
6
|
*/
|
|
7
|
-
import type { ChangedFilesFetcher } from '@kici-dev/engine';
|
|
7
|
+
import type { ChangedFilesFetcher, ChangedFilesResult } from '@kici-dev/engine';
|
|
8
8
|
import { type GitHubAppConfig } from './auth.js';
|
|
9
9
|
/**
|
|
10
10
|
* Check if an error is a GitHub 429 rate limit response.
|
|
@@ -12,9 +12,17 @@ import { type GitHubAppConfig } from './auth.js';
|
|
|
12
12
|
*/
|
|
13
13
|
export declare function isRateLimitError(err: unknown): boolean;
|
|
14
14
|
/**
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
15
|
+
* Check if an error is a transient GitHub 5xx server error worth retrying.
|
|
16
|
+
* A pure network error (no numeric `status`) is deliberately NOT transient
|
|
17
|
+
* here — it rethrows immediately (loud) rather than masking a persistent
|
|
18
|
+
* connectivity fault behind silent retries.
|
|
19
|
+
*/
|
|
20
|
+
export declare function isTransientServerError(err: unknown): boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Execute a function with bounded retry on 429 rate-limit AND 5xx server
|
|
23
|
+
* errors, each with its own budget and exponential backoff (1s, 2s, …).
|
|
24
|
+
* Every other error — a 4xx, or a network error with no `status` — is
|
|
25
|
+
* rethrown immediately (loud; not retried).
|
|
18
26
|
*/
|
|
19
27
|
export declare function withRateLimitRetry<T>(fn: () => Promise<T>, context: string): Promise<T>;
|
|
20
28
|
/**
|
|
@@ -27,7 +35,7 @@ export declare function withRateLimitRetry<T>(fn: () => Promise<T>, context: str
|
|
|
27
35
|
*/
|
|
28
36
|
export declare class GitHubChangedFilesFetcher implements ChangedFilesFetcher {
|
|
29
37
|
private readonly config;
|
|
30
|
-
readonly provider:
|
|
38
|
+
readonly provider: 'github';
|
|
31
39
|
constructor(config: GitHubAppConfig);
|
|
32
40
|
/**
|
|
33
41
|
* Get changed files for a GitHub webhook event.
|
|
@@ -38,7 +46,7 @@ export declare class GitHubChangedFilesFetcher implements ChangedFilesFetcher {
|
|
|
38
46
|
* @param credentials - Must be GitHubCredentials with installationId
|
|
39
47
|
* @returns Array of changed file paths
|
|
40
48
|
*/
|
|
41
|
-
getChangedFiles(repoIdentifier: string, eventType: string, payload: unknown, credentials: unknown): Promise<
|
|
49
|
+
getChangedFiles(repoIdentifier: string, eventType: string, payload: unknown, credentials: unknown): Promise<ChangedFilesResult>;
|
|
42
50
|
/**
|
|
43
51
|
* Get changed files for a pull request event using paginated listFiles API.
|
|
44
52
|
*/
|
|
@@ -2,10 +2,15 @@
|
|
|
2
2
|
* GitHub implementation of the CheckStatusPoster interface.
|
|
3
3
|
*
|
|
4
4
|
* Posts check statuses to GitHub PRs using the Checks API for:
|
|
5
|
-
* - Security holds (pending): "KiCI Security
|
|
6
|
-
* - Workflow modifications (neutral): "KiCI: Workflow changes
|
|
5
|
+
* - Security holds (pending): "KiCI Security" — "Held for approval"
|
|
6
|
+
* - Workflow modifications (neutral): "KiCI: Workflow changes"
|
|
7
|
+
* - Org globals skipped by the trust policy (neutral): "KiCI: Organization workflows"
|
|
7
8
|
* - Approved runs (success) / Rejected/expired runs (failure)
|
|
8
9
|
*
|
|
10
|
+
* `postWorkflowModificationCheck` and `postGlobalWorkflowsSkippedCheck` are
|
|
11
|
+
* interface-backed (the `CheckStatusPoster` contract in `@kici-dev/engine`) and
|
|
12
|
+
* post on their own check names so neither overwrites the security-hold check.
|
|
13
|
+
*
|
|
9
14
|
* Reuses the Octokit infrastructure from auth.ts via createInstallationOctokit.
|
|
10
15
|
* Uses a fixed check name per category so that subsequent updates (approve/reject)
|
|
11
16
|
* can find and update the existing check run.
|
|
@@ -21,7 +26,7 @@ import type { WorkflowModification } from '../../security/workflow-diff.js';
|
|
|
21
26
|
*/
|
|
22
27
|
export declare class GitHubCheckStatusPoster implements CheckStatusPoster {
|
|
23
28
|
private readonly getOctokit;
|
|
24
|
-
readonly provider:
|
|
29
|
+
readonly provider: 'github';
|
|
25
30
|
constructor(getOctokit: (credentials: unknown) => Octokit);
|
|
26
31
|
postCheckStatus(repoIdentifier: string, commitSha: string, status: CheckStatus, title: string, summary: string, credentials: unknown): Promise<void>;
|
|
27
32
|
/**
|
|
@@ -31,5 +36,16 @@ export declare class GitHubCheckStatusPoster implements CheckStatusPoster {
|
|
|
31
36
|
* conflict with the security hold check. Always posted as neutral/completed.
|
|
32
37
|
*/
|
|
33
38
|
postWorkflowModificationCheck(repoIdentifier: string, commitSha: string, modifications: WorkflowModification[], credentials: unknown): Promise<void>;
|
|
39
|
+
/**
|
|
40
|
+
* Post the informational check recording that the org's global workflows were
|
|
41
|
+
* skipped because the trust policy held or rejected the event.
|
|
42
|
+
*
|
|
43
|
+
* Uses a separate check name ("KiCI: Organization workflows") so it never
|
|
44
|
+
* overwrites the security-hold check: that one is a single named run per
|
|
45
|
+
* commit which the hold posts as pending and approve / reject later complete,
|
|
46
|
+
* so writing this notice onto it would resolve the hold's check to neutral
|
|
47
|
+
* while the run is still held. Always posted as neutral/completed.
|
|
48
|
+
*/
|
|
49
|
+
postGlobalWorkflowsSkippedCheck(repoIdentifier: string, commitSha: string, summary: string, credentials: unknown): Promise<void>;
|
|
34
50
|
}
|
|
35
51
|
//# sourceMappingURL=check-status-poster.d.ts.map
|
|
@@ -15,7 +15,7 @@ import { type GitHubAppConfig } from './auth.js';
|
|
|
15
15
|
*/
|
|
16
16
|
export declare class GitHubContributorResolver implements ContributorResolver {
|
|
17
17
|
private readonly config;
|
|
18
|
-
readonly provider:
|
|
18
|
+
readonly provider: 'github';
|
|
19
19
|
constructor(config: GitHubAppConfig);
|
|
20
20
|
/**
|
|
21
21
|
* Resolve a contributor's permission level on a GitHub repository.
|
|
@@ -17,7 +17,7 @@ import { type GitHubAppConfig } from './auth.js';
|
|
|
17
17
|
*/
|
|
18
18
|
export declare class GitHubLockFileFetcher implements LockFileFetcher {
|
|
19
19
|
private readonly config;
|
|
20
|
-
readonly provider:
|
|
20
|
+
readonly provider: 'github';
|
|
21
21
|
constructor(config: GitHubAppConfig);
|
|
22
22
|
/**
|
|
23
23
|
* Fetch the lock file from a GitHub repository at a specific ref.
|
|
@@ -12,7 +12,7 @@ import type { WebhookNormalizer, SimulatedEvent, AccessCacheInvalidation } from
|
|
|
12
12
|
* Headers are expected lowercase (Hono normalizes them).
|
|
13
13
|
*/
|
|
14
14
|
export declare class GitHubWebhookNormalizer implements WebhookNormalizer {
|
|
15
|
-
readonly provider:
|
|
15
|
+
readonly provider: 'github';
|
|
16
16
|
/**
|
|
17
17
|
* Extract routing key from GitHub webhook headers.
|
|
18
18
|
*
|
|
@@ -12,7 +12,7 @@ import type { RepoUrlBuilder } from '@kici-dev/engine';
|
|
|
12
12
|
* repoIdentifier is expected in "owner/repo" format.
|
|
13
13
|
*/
|
|
14
14
|
export declare class GitHubRepoUrlBuilder implements RepoUrlBuilder {
|
|
15
|
-
readonly provider:
|
|
15
|
+
readonly provider: 'github';
|
|
16
16
|
/**
|
|
17
17
|
* Build the HTTPS clone URL for a GitHub repository.
|
|
18
18
|
*
|
|
@@ -14,7 +14,7 @@ import type { LockFileFetcher, LockFile } from '@kici-dev/engine';
|
|
|
14
14
|
*/
|
|
15
15
|
export declare class LocalLockFileFetcher implements LockFileFetcher {
|
|
16
16
|
private readonly repoBasePath;
|
|
17
|
-
readonly provider:
|
|
17
|
+
readonly provider: 'local';
|
|
18
18
|
/**
|
|
19
19
|
* @param repoBasePath - Base directory for the repo(s). When repoIdentifier
|
|
20
20
|
* starts with 'file://', it is stripped and used as-is. Otherwise
|
|
@@ -17,7 +17,7 @@ import type { WebhookNormalizer, SimulatedEvent, AccessCacheInvalidation } from
|
|
|
17
17
|
* (e.g., {ref: 'refs/heads/master', repository: {full_name: 'test/repo'}}).
|
|
18
18
|
*/
|
|
19
19
|
export declare class LocalWebhookNormalizer implements WebhookNormalizer {
|
|
20
|
-
readonly provider:
|
|
20
|
+
readonly provider: 'local';
|
|
21
21
|
/**
|
|
22
22
|
* Extract routing key from the local-source webhook headers.
|
|
23
23
|
*
|
|
@@ -16,7 +16,7 @@ import type { RepoUrlBuilder } from '@kici-dev/engine';
|
|
|
16
16
|
export declare class LocalRepoUrlBuilder implements RepoUrlBuilder {
|
|
17
17
|
private readonly repoBasePath;
|
|
18
18
|
private readonly cloneUrlBase?;
|
|
19
|
-
readonly provider:
|
|
19
|
+
readonly provider: 'local';
|
|
20
20
|
/**
|
|
21
21
|
* @param repoBasePath - Base directory where test repos live on disk
|
|
22
22
|
* @param cloneUrlBase - Optional URL base for clone operations (e.g. git://host/path).
|
|
@@ -8,12 +8,13 @@
|
|
|
8
8
|
* `commits[].{added,modified,removed}` arrays in the push payload, so we
|
|
9
9
|
* extract them via JSONPath from the already-delivered webhook body.
|
|
10
10
|
*
|
|
11
|
-
* For PR events we
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* fetcher if source authors want PR
|
|
11
|
+
* For PR events we report `unavailable`: no per-commit diff is present in the
|
|
12
|
+
* webhook body, so the upstream trigger matcher matches path filters
|
|
13
|
+
* conservatively (the workflow runs) instead of silently never matching. A
|
|
14
|
+
* follow-up can add an optional REST fetcher if source authors want exact PR
|
|
15
|
+
* path filtering.
|
|
15
16
|
*/
|
|
16
|
-
import type { ChangedFilesFetcher } from '@kici-dev/engine';
|
|
17
|
+
import type { ChangedFilesFetcher, ChangedFilesResult } from '@kici-dev/engine';
|
|
17
18
|
import { type UniversalGitConfig } from './config.js';
|
|
18
19
|
/**
|
|
19
20
|
* Universal-git implementation of ChangedFilesFetcher.
|
|
@@ -22,7 +23,7 @@ import { type UniversalGitConfig } from './config.js';
|
|
|
22
23
|
* expanded `payloadPaths` + `eventMapping`.
|
|
23
24
|
*/
|
|
24
25
|
export declare class UniversalGitChangedFilesFetcher implements ChangedFilesFetcher {
|
|
25
|
-
readonly provider:
|
|
26
|
+
readonly provider: 'generic';
|
|
26
27
|
private readonly paths;
|
|
27
28
|
private readonly eventMapping;
|
|
28
29
|
constructor(params: {
|
|
@@ -36,7 +37,7 @@ export declare class UniversalGitChangedFilesFetcher implements ChangedFilesFetc
|
|
|
36
37
|
* @param payload The webhook body the forge delivered.
|
|
37
38
|
* @param _credentials Unused — no REST call is made.
|
|
38
39
|
*/
|
|
39
|
-
getChangedFiles(_repoIdentifier: string, eventType: string, payload: unknown, _credentials: unknown): Promise<
|
|
40
|
+
getChangedFiles(_repoIdentifier: string, eventType: string, payload: unknown, _credentials: unknown): Promise<ChangedFilesResult>;
|
|
40
41
|
private classifyEvent;
|
|
41
42
|
}
|
|
42
43
|
//# sourceMappingURL=changed-files.d.ts.map
|
|
@@ -42,7 +42,7 @@ export interface UniversalGitAuth extends ProviderGitAuth {
|
|
|
42
42
|
*/
|
|
43
43
|
export declare class UniversalGitCloneTokenProvider implements CloneTokenProvider {
|
|
44
44
|
private readonly params;
|
|
45
|
-
readonly provider:
|
|
45
|
+
readonly provider: 'generic';
|
|
46
46
|
constructor(params: {
|
|
47
47
|
orgId: string;
|
|
48
48
|
sourceId: string;
|
|
@@ -22,9 +22,9 @@ export declare const UniversalGitPreset: z.ZodEnum<{
|
|
|
22
22
|
custom: "custom";
|
|
23
23
|
forgejo: "forgejo";
|
|
24
24
|
gitea: "gitea";
|
|
25
|
-
gogs: "gogs";
|
|
26
|
-
"gitlab-repo": "gitlab-repo";
|
|
27
25
|
"github-repo": "github-repo";
|
|
26
|
+
"gitlab-repo": "gitlab-repo";
|
|
27
|
+
gogs: "gogs";
|
|
28
28
|
}>;
|
|
29
29
|
export type UniversalGitPreset = z.infer<typeof UniversalGitPreset>;
|
|
30
30
|
/**
|
|
@@ -101,9 +101,9 @@ export declare const UniversalGitConfigSchema: z.ZodObject<{
|
|
|
101
101
|
custom: "custom";
|
|
102
102
|
forgejo: "forgejo";
|
|
103
103
|
gitea: "gitea";
|
|
104
|
-
gogs: "gogs";
|
|
105
|
-
"gitlab-repo": "gitlab-repo";
|
|
106
104
|
"github-repo": "github-repo";
|
|
105
|
+
"gitlab-repo": "gitlab-repo";
|
|
106
|
+
gogs: "gogs";
|
|
107
107
|
}>;
|
|
108
108
|
gitUrlTemplate: z.ZodString;
|
|
109
109
|
credentialRef: z.ZodObject<{
|
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
import type { ProviderBundle } from '../../provider-registry.js';
|
|
25
25
|
import type { GenericWebhookSource } from '../../db/types.js';
|
|
26
26
|
import type { SecretResolver } from '../../secrets/secret-resolver.js';
|
|
27
|
+
import type { ClusterSettingsReader } from '../../cluster/cluster-settings-reader.js';
|
|
27
28
|
import { type UniversalGitConfig } from './config.js';
|
|
28
29
|
export { UniversalGitWebhookNormalizer } from './normalizer.js';
|
|
29
30
|
export { UniversalGitLockFileFetcher, LockFileTooLargeError } from './lock-file.js';
|
|
@@ -51,5 +52,8 @@ export declare function parseSourceGitConfig(raw: string | Record<string, unknow
|
|
|
51
52
|
* generic webhook, not a universal-git source) — callers can rely on this
|
|
52
53
|
* to differentiate the two shapes without re-parsing the row.
|
|
53
54
|
*/
|
|
54
|
-
export declare function createUniversalGitProviderBundle(source: Pick<GenericWebhookSource, 'id' | 'customer_id' | 'routing_key' | 'git_config'>, secretResolver: SecretResolver
|
|
55
|
+
export declare function createUniversalGitProviderBundle(source: Pick<GenericWebhookSource, 'id' | 'customer_id' | 'routing_key' | 'git_config'>, secretResolver: SecretResolver, opts?: {
|
|
56
|
+
clusterSettings?: ClusterSettingsReader;
|
|
57
|
+
lockFileMaxBytes?: number;
|
|
58
|
+
}): ProviderBundle | null;
|
|
55
59
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
*/
|
|
31
31
|
import type { LockFileFetcher, LockFile } from '@kici-dev/engine';
|
|
32
32
|
import type { SecretResolver } from '../../secrets/secret-resolver.js';
|
|
33
|
+
import type { ClusterSettingsReader } from '../../cluster/cluster-settings-reader.js';
|
|
33
34
|
import type { UniversalGitConfig } from './config.js';
|
|
34
35
|
/**
|
|
35
36
|
* Typed error for the 5 MiB cap. Callers can differentiate this from
|
|
@@ -49,13 +50,17 @@ export declare class LockFileTooLargeError extends Error {
|
|
|
49
50
|
*/
|
|
50
51
|
export declare class UniversalGitLockFileFetcher implements LockFileFetcher {
|
|
51
52
|
private readonly params;
|
|
52
|
-
readonly provider:
|
|
53
|
+
readonly provider: 'generic';
|
|
53
54
|
private readonly repoUrlBuilder;
|
|
54
55
|
constructor(params: {
|
|
55
56
|
orgId: string;
|
|
56
57
|
sourceId: string;
|
|
57
58
|
config: UniversalGitConfig;
|
|
58
59
|
secretResolver: SecretResolver;
|
|
60
|
+
/** Fleet-wide settings reader; overrides the lock-file cap per fetch. */
|
|
61
|
+
clusterSettings?: ClusterSettingsReader;
|
|
62
|
+
/** Cluster default cap (bytes) when no cluster_settings override is set. */
|
|
63
|
+
lockFileMaxBytes?: number;
|
|
59
64
|
});
|
|
60
65
|
/**
|
|
61
66
|
* Shallow-clone the source repo at `ref` into a private tempdir, read
|
|
@@ -22,7 +22,7 @@ import { type UniversalGitConfig } from './config.js';
|
|
|
22
22
|
* registered `generic_webhook_sources` row with a non-null `git_config`.
|
|
23
23
|
*/
|
|
24
24
|
export declare class UniversalGitWebhookNormalizer implements WebhookNormalizer {
|
|
25
|
-
readonly provider:
|
|
25
|
+
readonly provider: 'generic';
|
|
26
26
|
private readonly routingKey;
|
|
27
27
|
private readonly paths;
|
|
28
28
|
private readonly eventMapping;
|
|
@@ -18,7 +18,7 @@ import type { RepoUrlBuilder } from '@kici-dev/engine';
|
|
|
18
18
|
*/
|
|
19
19
|
export declare class UniversalGitRepoUrlBuilder implements RepoUrlBuilder {
|
|
20
20
|
private readonly gitUrlTemplate;
|
|
21
|
-
readonly provider:
|
|
21
|
+
readonly provider: 'generic';
|
|
22
22
|
constructor(gitUrlTemplate: string);
|
|
23
23
|
/**
|
|
24
24
|
* Build the clone URL by substituting placeholders in the template with
|
package/dist/queue/cleanup.d.ts
CHANGED
|
@@ -1,7 +1,71 @@
|
|
|
1
1
|
import { type Kysely } from 'kysely';
|
|
2
|
+
import { type LabelMatcher } from '@kici-dev/engine';
|
|
2
3
|
import type { Database } from '../db/types.js';
|
|
3
4
|
import type { ExecutionTracker } from '../reporting/execution-tracker.js';
|
|
5
|
+
import type { CheckRunReporter } from '../reporting/check-run-reporter.js';
|
|
6
|
+
import type { CheckRunTrackingStore } from '../reporting/check-run-tracking-store.js';
|
|
7
|
+
import type { ClusterSettingsReader } from '../cluster/cluster-settings-reader.js';
|
|
8
|
+
import type { LogStorage } from '../reporting/log-storage.js';
|
|
4
9
|
import { JobQueue } from './job-queue.js';
|
|
10
|
+
/**
|
|
11
|
+
* Optional cleanup dependencies + retention knobs. Present in platform/hybrid
|
|
12
|
+
* mode (the only wiring site, `orchestrator-core`, always supplies them); the
|
|
13
|
+
* retention sweeps and Platform status-forwarding run only when this is set.
|
|
14
|
+
*/
|
|
15
|
+
export interface CleanupExtras {
|
|
16
|
+
db: Kysely<Database>;
|
|
17
|
+
executionTracker: ExecutionTracker;
|
|
18
|
+
/**
|
|
19
|
+
* Resolves each expired job's check run to a terminal conclusion.
|
|
20
|
+
*
|
|
21
|
+
* Required for correctness, not decoration: this sweep settles a job by
|
|
22
|
+
* writing `execution_jobs` directly rather than through
|
|
23
|
+
* `ExecutionTracker.onJobStatus`, so the tracker's terminal-job hook — the
|
|
24
|
+
* funnel a tracker-driven terminal status reaches the check-run reporter
|
|
25
|
+
* through — never fires here. Absent, the check run created at trigger match
|
|
26
|
+
* stays `queued` on the commit forever, which no branch-protection rule
|
|
27
|
+
* requiring it can ever be satisfied by.
|
|
28
|
+
*/
|
|
29
|
+
checkRunReporter?: Pick<CheckRunReporter, 'updateJobStatus'>;
|
|
30
|
+
/** Terminal dispatch_queue row retention (days); 0 disables. Default 30. */
|
|
31
|
+
dispatchQueueTtlDays?: number;
|
|
32
|
+
/** Step-log object retention (days); 0 disables. Default 90. */
|
|
33
|
+
stepLogTtlDays?: number;
|
|
34
|
+
/** Store for `check_run_tracking`; the retention sweep runs only when wired. */
|
|
35
|
+
checkRunTrackingStore?: CheckRunTrackingStore;
|
|
36
|
+
/** Live cluster-settings reader; absent ⇒ the config default is used as-is. */
|
|
37
|
+
clusterSettings?: ClusterSettingsReader;
|
|
38
|
+
/** `check_run_tracking` row retention (days); 0 disables. Default 7. */
|
|
39
|
+
checkRunTrackingTtlDays?: number;
|
|
40
|
+
/** The orchestrator's log storage — the S3 sweep runs only when S3-backed. */
|
|
41
|
+
logStorage?: LogStorage;
|
|
42
|
+
/** True when `logStorage` is the S3 backend (the filesystem backend is
|
|
43
|
+
* customer-managed, so its lifecycle stays the operator's concern). */
|
|
44
|
+
logStorageIsS3?: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Whether ANYTHING could ever have run a job with these selectors — a
|
|
47
|
+
* registered agent (regardless of capacity) or a scaler backend able to spawn
|
|
48
|
+
* one.
|
|
49
|
+
*
|
|
50
|
+
* Read once per expired job to split the two reasons a queued job never ran:
|
|
51
|
+
* nothing in the fleet matched its `runsOn` (`unroutable` — a label/fleet
|
|
52
|
+
* problem an operator has to fix) versus something matched but never produced
|
|
53
|
+
* a usable agent (`timed_out_stale` — a capacity or provisioning problem).
|
|
54
|
+
* Both halves are load-bearing: a scaler-managed pool at zero has no
|
|
55
|
+
* registered agent yet still routes perfectly well, so asking only the agent
|
|
56
|
+
* registry would report every failed spawn as a bad `runsOn`.
|
|
57
|
+
*
|
|
58
|
+
* Asked at expiry rather than at dispatch so a label satisfied moments later
|
|
59
|
+
* by an autoscaled agent is not mislabelled unroutable. Absent → every expiry
|
|
60
|
+
* stays `timed_out_stale`, the behaviour before the split existed.
|
|
61
|
+
*
|
|
62
|
+
* The predicate is allowed to answer "routable" conservatively (the scaler
|
|
63
|
+
* half matches exact labels only, so a pattern-only `runsOn` reads routable on
|
|
64
|
+
* a scaler-configured orchestrator). That costs precision on the status, never
|
|
65
|
+
* safety: the job is terminal either way and the run fails either way.
|
|
66
|
+
*/
|
|
67
|
+
canRouteLabels?: (requiredLabels: string[], requiredPatterns: LabelMatcher[], excludeLabels: string[], excludePatterns: LabelMatcher[]) => boolean;
|
|
68
|
+
}
|
|
5
69
|
/**
|
|
6
70
|
* Run a single cleanup pass: remove expired dedup_cache entries and
|
|
7
71
|
* mark expired dispatch_queue entries.
|
|
@@ -18,12 +82,12 @@ import { JobQueue } from './job-queue.js';
|
|
|
18
82
|
*/
|
|
19
83
|
export declare function runCleanup(dedup: {
|
|
20
84
|
cleanup(): Promise<number>;
|
|
21
|
-
}, queue: JobQueue, extras?: {
|
|
22
|
-
db: Kysely<Database>;
|
|
23
|
-
executionTracker: ExecutionTracker;
|
|
24
|
-
}): Promise<{
|
|
85
|
+
}, queue: JobQueue, extras?: CleanupExtras): Promise<{
|
|
25
86
|
dedupDeleted: number;
|
|
26
87
|
queueExpired: number;
|
|
88
|
+
dispatchRowsPruned: number;
|
|
89
|
+
logObjectsPruned: number;
|
|
90
|
+
checkRunRowsPruned: number;
|
|
27
91
|
}>;
|
|
28
92
|
/**
|
|
29
93
|
* Build a per-tick handler for the queue-cleanup scheduled job.
|
|
@@ -34,8 +98,5 @@ export declare function runCleanup(dedup: {
|
|
|
34
98
|
*/
|
|
35
99
|
export declare function createCleanupHandler(dedup: {
|
|
36
100
|
cleanup(): Promise<number>;
|
|
37
|
-
}, queue: JobQueue, extras?:
|
|
38
|
-
db: Kysely<Database>;
|
|
39
|
-
executionTracker: ExecutionTracker;
|
|
40
|
-
}): () => Promise<void>;
|
|
101
|
+
}, queue: JobQueue, extras?: CleanupExtras): () => Promise<void>;
|
|
41
102
|
//# sourceMappingURL=cleanup.d.ts.map
|