@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
|
@@ -9,28 +9,30 @@
|
|
|
9
9
|
* eventRouter fire-and-forget. The manual path needs request/response
|
|
10
10
|
* correlation to return the newRunId to the dashboard.
|
|
11
11
|
*/
|
|
12
|
-
import type { LockWorkflow, MaterializedJob } from '@kici-dev/engine';
|
|
12
|
+
import type { LockScheduleTrigger, LockWorkflow, MaterializedJob } from '@kici-dev/engine';
|
|
13
13
|
import type { RerunDeps } from './rerun.js';
|
|
14
14
|
import type { RegistrationIndex } from '../registration/registration-index.js';
|
|
15
15
|
interface ManualScheduleDeps extends RerunDeps {
|
|
16
16
|
registrationIndex: RegistrationIndex;
|
|
17
17
|
}
|
|
18
|
-
export declare function handleManualSchedule(registrationId: string, triggeredBy: string | null, triggeredByAgentLabel: string | null, deps: ManualScheduleDeps
|
|
18
|
+
export declare function handleManualSchedule(registrationId: string, triggeredBy: string | null, triggeredByAgentLabel: string | null, deps: ManualScheduleDeps,
|
|
19
|
+
/**
|
|
20
|
+
* Platform-minted `requestId`. Stable across an HA relay failover re-send, so
|
|
21
|
+
* it is the idempotency key: after the read-only validation, the first
|
|
22
|
+
* coordinator to claim it creates the run and a failover re-send returns that
|
|
23
|
+
* same run instead of minting a second one.
|
|
24
|
+
*/
|
|
25
|
+
requestId: string): Promise<{
|
|
19
26
|
newRunId: string;
|
|
20
27
|
}>;
|
|
28
|
+
/**
|
|
29
|
+
* A manual "fire now" targets no specific schedule, so merge the declared
|
|
30
|
+
* default inputs across ALL of the workflow's schedule triggers (later triggers
|
|
31
|
+
* win on key collision) rather than arbitrarily taking the first. Returns
|
|
32
|
+
* undefined when no schedule declares resolvable inputs.
|
|
33
|
+
*/
|
|
34
|
+
export declare function mergeScheduleInputs(scheduleTriggers: LockScheduleTrigger[]): Record<string, unknown> | undefined;
|
|
21
35
|
export declare function buildManualJobConfig(workflow: LockWorkflow, mat: MaterializedJob): {
|
|
22
|
-
resolvedHashFiles?: string[] | undefined;
|
|
23
|
-
contentHash?: string | undefined;
|
|
24
|
-
dispatchInputs?: Record<string, unknown> | undefined;
|
|
25
|
-
steps: readonly import("@kici-dev/engine").LockStepEntry[];
|
|
26
|
-
needs: readonly (string | {
|
|
27
|
-
name: string;
|
|
28
|
-
runOn: ("success" | "pending" | "failed" | "recovering" | "running" | "queued" | "skipped" | "cancelled" | "cancelling" | "timed_out_stale" | "drift_dropped")[];
|
|
29
|
-
} | {
|
|
30
|
-
group: string;
|
|
31
|
-
runOn: ("success" | "pending" | "failed" | "recovering" | "running" | "queued" | "skipped" | "cancelled" | "cancelling" | "timed_out_stale" | "drift_dropped")[];
|
|
32
|
-
})[];
|
|
33
|
-
rules: readonly import("@kici-dev/engine").LockRule[] | undefined;
|
|
34
36
|
name: string;
|
|
35
37
|
baseJobName: string;
|
|
36
38
|
matrixValues?: import("@kici-dev/engine").MatrixValues;
|
|
@@ -38,6 +40,18 @@ export declare function buildManualJobConfig(workflow: LockWorkflow, mat: Materi
|
|
|
38
40
|
fanoutTotal?: number;
|
|
39
41
|
source: import("@kici-dev/engine").LockSource | undefined;
|
|
40
42
|
workflowName: string;
|
|
43
|
+
steps: readonly import("@kici-dev/engine").LockStepEntry[];
|
|
44
|
+
needs: readonly (string | {
|
|
45
|
+
name: string;
|
|
46
|
+
runOn: ("cancelled" | "cancelling" | "drift_dropped" | "failed" | "pending" | "queued" | "recovering" | "running" | "skipped" | "success" | "timed_out_stale" | "unroutable")[];
|
|
47
|
+
} | {
|
|
48
|
+
group: string;
|
|
49
|
+
runOn: ("cancelled" | "cancelling" | "drift_dropped" | "failed" | "pending" | "queued" | "recovering" | "running" | "skipped" | "success" | "timed_out_stale" | "unroutable")[];
|
|
50
|
+
})[];
|
|
51
|
+
rules: readonly import("@kici-dev/engine").LockRule[] | undefined;
|
|
52
|
+
dispatchInputs?: Record<string, unknown> | undefined;
|
|
53
|
+
contentHash?: string | undefined;
|
|
54
|
+
resolvedHashFiles?: string[] | undefined;
|
|
41
55
|
};
|
|
42
56
|
export {};
|
|
43
57
|
//# sourceMappingURL=manual-schedule.d.ts.map
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* Writes to both an in-memory Map (fast read on the same process) and the DB
|
|
13
13
|
* (crash recovery + cross-orchestrator read), mirroring the pending-job store.
|
|
14
14
|
*/
|
|
15
|
-
import type
|
|
15
|
+
import { type Kysely } from 'kysely';
|
|
16
16
|
import type { Database } from '../db/types.js';
|
|
17
17
|
import type { WorkflowDispatchContext } from './dispatch-matched-workflow.js';
|
|
18
18
|
/**
|
|
@@ -17,10 +17,13 @@
|
|
|
17
17
|
* top-level export is `processWebhook`, callable from server.ts / app.ts.
|
|
18
18
|
*/
|
|
19
19
|
import { z } from 'zod';
|
|
20
|
-
import type { SimulatedEvent } from '@kici-dev/engine';
|
|
20
|
+
import type { LockFile as FullLockFile, SimulatedEvent } from '@kici-dev/engine';
|
|
21
|
+
import type { OrchestratorMode } from '@kici-dev/engine';
|
|
21
22
|
import type { WebhookInfo } from '../webhook/handler.js';
|
|
22
23
|
import type { ProviderBundle } from '../provider-registry.js';
|
|
23
24
|
import type { TrustResolution } from '../security/trust-resolver.js';
|
|
25
|
+
import { type TrustPolicyOutcome } from '../security/trust-policy-gate.js';
|
|
26
|
+
import { type WorkflowModification } from '../security/workflow-diff.js';
|
|
24
27
|
import { type ProcessingDeps } from './processor.js';
|
|
25
28
|
/**
|
|
26
29
|
* Outcome of a single inbound-webhook ingestion. `duplicate` lets a direct-
|
|
@@ -29,9 +32,10 @@ import { type ProcessingDeps } from './processor.js';
|
|
|
29
32
|
* `processed` means the pipeline matched and dispatched (or recorded a run).
|
|
30
33
|
*/
|
|
31
34
|
export declare const WebhookIngestOutcome: z.ZodEnum<{
|
|
35
|
+
duplicate: "duplicate";
|
|
32
36
|
processed: "processed";
|
|
37
|
+
shed: "shed";
|
|
33
38
|
skipped: "skipped";
|
|
34
|
-
duplicate: "duplicate";
|
|
35
39
|
}>;
|
|
36
40
|
export type WebhookIngestOutcome = z.infer<typeof WebhookIngestOutcome>;
|
|
37
41
|
interface TrustOutcome {
|
|
@@ -49,6 +53,57 @@ export declare function resolveTrustForPR(args: {
|
|
|
49
53
|
repoIdentifier: string;
|
|
50
54
|
credentials: Record<string, unknown>;
|
|
51
55
|
}): Promise<TrustOutcome>;
|
|
56
|
+
interface SecurityState {
|
|
57
|
+
workflowModifications: WorkflowModification[];
|
|
58
|
+
/**
|
|
59
|
+
* True when this PR changes `.kici/` workflow definitions. A *signal*, not a
|
|
60
|
+
* decision — the trust-policy gate turns it into an outcome, which the
|
|
61
|
+
* dispatch gate then enforces as a held run or a rejected run.
|
|
62
|
+
*/
|
|
63
|
+
hasWorkflowModifications: boolean;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Phase G — On PR events evaluated against the base lock file, detect workflow
|
|
67
|
+
* modifications by diffing base vs. head and post a neutral informational check
|
|
68
|
+
* (on its own dedicated check name).
|
|
69
|
+
*
|
|
70
|
+
* Detection only. Whether a modification gates the run is the org trust policy's
|
|
71
|
+
* call, evaluated in `evaluateSecurityPolicy` and enforced by the dispatch gate
|
|
72
|
+
* — which creates the real `held_runs` row and posts the pending
|
|
73
|
+
* "Held for approval" check, so `/kici approve` / reject / expiry can resolve it.
|
|
74
|
+
*/
|
|
75
|
+
export declare function applyWorkflowModificationsAndSecurityHold(args: {
|
|
76
|
+
info: WebhookInfo;
|
|
77
|
+
bundle: ProviderBundle;
|
|
78
|
+
event: SimulatedEvent;
|
|
79
|
+
fullLockFile: FullLockFile;
|
|
80
|
+
headLockFileForDiff: FullLockFile | undefined;
|
|
81
|
+
isPREvent: boolean;
|
|
82
|
+
lockFileSource: 'head' | 'base';
|
|
83
|
+
trustResolution: TrustResolution | undefined;
|
|
84
|
+
repoIdentifier: string;
|
|
85
|
+
ref: string;
|
|
86
|
+
credentials: Record<string, unknown>;
|
|
87
|
+
}): SecurityState;
|
|
88
|
+
/**
|
|
89
|
+
* Evaluate the org trust policy for a PR event.
|
|
90
|
+
*
|
|
91
|
+
* Scoped to providers with a contributor model — the same condition trust
|
|
92
|
+
* resolution uses. A source without a `ContributorResolver` (generic, local,
|
|
93
|
+
* universal-git) is trusted by construction, so it passes regardless of policy;
|
|
94
|
+
* in particular, universal-git computes an `isForkPR` signal that must NOT gate
|
|
95
|
+
* those sources.
|
|
96
|
+
*/
|
|
97
|
+
export declare function evaluateSecurityPolicy(args: {
|
|
98
|
+
deps: ProcessingDeps;
|
|
99
|
+
bundle: ProviderBundle;
|
|
100
|
+
isPREvent: boolean;
|
|
101
|
+
resolvedOrgId: string;
|
|
102
|
+
mode: OrchestratorMode;
|
|
103
|
+
trustResolution: TrustResolution | undefined;
|
|
104
|
+
isForkPR: boolean;
|
|
105
|
+
hasWorkflowModifications: boolean;
|
|
106
|
+
}): Promise<TrustPolicyOutcome>;
|
|
52
107
|
/**
|
|
53
108
|
* Process a webhook through the complete pipeline.
|
|
54
109
|
*
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
*/
|
|
14
14
|
import { type Kysely } from 'kysely';
|
|
15
15
|
import type { Database } from '../db/types.js';
|
|
16
|
+
import type { SandboxAllowListReader } from './sandbox-allowlist-reader.js';
|
|
16
17
|
import type { WebhookInfo } from '../webhook/handler.js';
|
|
17
18
|
import type { DedupCache } from '../webhook/dedup.js';
|
|
18
19
|
import type { ProviderRegistry, ProviderBundle } from '../provider-registry.js';
|
|
@@ -31,6 +32,7 @@ import type { ExecutionTracker } from '../reporting/execution-tracker.js';
|
|
|
31
32
|
import type { AgentRegistry } from '../agent/registry.js';
|
|
32
33
|
import type { HostRosterStore } from '../agent/host-roster.js';
|
|
33
34
|
import type { RunCoordinator } from '../cluster/coordinator.js';
|
|
35
|
+
import type { ClusterSettingsReader } from '../cluster/cluster-settings-reader.js';
|
|
34
36
|
import type { TeamMembershipLookup } from '../approvals/team-membership-lookup.js';
|
|
35
37
|
import type { LogStorage } from '../reporting/log-storage.js';
|
|
36
38
|
import type { SecretResolverApi } from '../secrets/secret-resolver.js';
|
|
@@ -46,11 +48,12 @@ import type { GlobalWorkflowPolicy } from '../security/global-workflow-policy.js
|
|
|
46
48
|
import type { EventLogWriter } from '../webhook/event-log.js';
|
|
47
49
|
import { EventLogSource } from '@kici-dev/engine';
|
|
48
50
|
import type { LockJob } from '@kici-dev/engine';
|
|
49
|
-
import type {
|
|
50
|
-
import type { VariableStore } from '../
|
|
51
|
+
import type { ContextStore } from '../contexts/context-store.js';
|
|
52
|
+
import type { VariableStore } from '../contexts/variable-store.js';
|
|
51
53
|
import type { TrustResolver, IdentityLink, PermissionLevel } from '../security/trust-resolver.js';
|
|
52
|
-
import type
|
|
53
|
-
import type { WorkflowDecision } from '@kici-dev/engine';
|
|
54
|
+
import { type HeldRunStore } from '../contexts/held-runs.js';
|
|
55
|
+
import type { OrchestratorMode, WorkflowDecision } from '@kici-dev/engine';
|
|
56
|
+
import type { TrustPolicyStore } from '../security/trust-policy-store.js';
|
|
54
57
|
/**
|
|
55
58
|
* Pending dispatch context for jobs gated by the needs scheduler.
|
|
56
59
|
* Keyed by `${runId}:${jobName}`. Populated at processWebhook time for all
|
|
@@ -210,13 +213,9 @@ export declare function eventTypeToTriggerType(eventType: string): string;
|
|
|
210
213
|
* Combines event type with action (e.g. "push", "pull_request:opened").
|
|
211
214
|
*/
|
|
212
215
|
export declare function buildTriggerEvent(event: string, action: string | null | undefined): string;
|
|
213
|
-
/**
|
|
214
|
-
* Extract the first line of the commit message from a webhook payload.
|
|
215
|
-
* Handles push (head_commit.message) and PR (pull_request.title) events.
|
|
216
|
-
*/
|
|
217
216
|
/**
|
|
218
217
|
* Best-effort extraction of a repository identifier from a generic webhook
|
|
219
|
-
* payload for cross-source dispatch
|
|
218
|
+
* payload for cross-source dispatch. Generic webhooks have no
|
|
220
219
|
* canonical repo shape, so we probe the conventions a sender is most likely
|
|
221
220
|
* to use:
|
|
222
221
|
*
|
|
@@ -228,11 +227,25 @@ export declare function buildTriggerEvent(event: string, action: string | null |
|
|
|
228
227
|
* cross-source repo lookup is skipped (event-name fan-out still runs).
|
|
229
228
|
*/
|
|
230
229
|
export declare function extractInboundRepoIdentifier(payload: unknown): string | null;
|
|
230
|
+
/**
|
|
231
|
+
* Extract the first line of the commit message from a webhook payload.
|
|
232
|
+
* Handles push (head_commit.message) and PR (pull_request.title) events.
|
|
233
|
+
*/
|
|
231
234
|
export declare function extractCommitMessage(event: string, payload: unknown): string | undefined;
|
|
232
235
|
/**
|
|
233
236
|
* Build a human-readable summary for a security hold check.
|
|
234
237
|
*/
|
|
235
238
|
export declare function buildSecurityHoldSummary(reason: string, tier: string, contributorUsername?: string): string;
|
|
239
|
+
/**
|
|
240
|
+
* Build the failure check-run description for a run the org trust policy
|
|
241
|
+
* REJECTED.
|
|
242
|
+
*
|
|
243
|
+
* Deliberately not `buildSecurityHoldSummary`: a rejected run creates no
|
|
244
|
+
* `held_runs` row, so telling the contributor to seek "approval from a user
|
|
245
|
+
* with ci_trust:write or higher" points at a queue the run will never appear
|
|
246
|
+
* in. Only an org policy change can unblock it.
|
|
247
|
+
*/
|
|
248
|
+
export declare function buildSecurityRejectionSummary(reason: string, message: string, tier: string, contributorUsername?: string): string;
|
|
236
249
|
/**
|
|
237
250
|
* Build the pending check-run description for a job/workflow approval hold,
|
|
238
251
|
* naming the clauses an approver must satisfy. `{team:X}` renders as
|
|
@@ -282,6 +295,12 @@ export interface ProcessingDeps {
|
|
|
282
295
|
coordinator?: RunCoordinator;
|
|
283
296
|
/** Secret resolver for dispatch-time secret resolution. Optional -- if not set, secrets are not resolved. */
|
|
284
297
|
secretResolver?: SecretResolverApi;
|
|
298
|
+
/**
|
|
299
|
+
* Cached per-org container-sandbox escape-hatch allow-list reader. Optional --
|
|
300
|
+
* when absent, dispatch defaults to the safe deny-all allow-list, so no
|
|
301
|
+
* workflow can escalate capabilities / host networking.
|
|
302
|
+
*/
|
|
303
|
+
sandboxAllowListReader?: SandboxAllowListReader;
|
|
285
304
|
/** Optional callback when source locations are extracted from a lock file workflow. */
|
|
286
305
|
onSourceLocationsExtracted?: (workflowName: string, jobName: string, sourceLocations: Array<{
|
|
287
306
|
file: string;
|
|
@@ -302,14 +321,28 @@ export interface ProcessingDeps {
|
|
|
302
321
|
secretKey?: string;
|
|
303
322
|
/** Log storage backend for persisting webhook payloads. Optional -- if not set, payload storage is skipped. */
|
|
304
323
|
logStorage?: LogStorage;
|
|
305
|
-
/**
|
|
306
|
-
|
|
307
|
-
/** Variable store for resolving
|
|
324
|
+
/** Context store for looking up deployment contexts. Optional -- if not set, context features are inactive. */
|
|
325
|
+
contextStore?: ContextStore;
|
|
326
|
+
/** Variable store for resolving context variables. Optional -- if not set, context vars are not merged. */
|
|
308
327
|
variableStore?: VariableStore;
|
|
309
328
|
/** Held run store for persisting protection rule holds. Optional -- if not set, holds are not persisted. */
|
|
310
329
|
heldRunStore?: HeldRunStore;
|
|
311
330
|
/** Trust resolver for determining contributor trust tiers. Optional -- if not set, trust resolution is skipped. */
|
|
312
331
|
trustResolver?: TrustResolver;
|
|
332
|
+
/**
|
|
333
|
+
* Cache of the Platform-owned org trust policy. Read per PR event by the
|
|
334
|
+
* trust-policy gate. Optional so existing tests and independent deployments
|
|
335
|
+
* that construct deps by hand keep working.
|
|
336
|
+
*/
|
|
337
|
+
trustPolicyStore?: TrustPolicyStore;
|
|
338
|
+
/**
|
|
339
|
+
* This orchestrator's mode. The trust-policy gate needs it to decide what an
|
|
340
|
+
* absent policy means: Platform-attached modes fail closed (a push is
|
|
341
|
+
* imminent), independent mode has no upstream authority and keeps legacy
|
|
342
|
+
* behavior. Defaults to `'platform'` at the read site — the fail-closed side —
|
|
343
|
+
* so a hand-built deps object never accidentally opens the gate.
|
|
344
|
+
*/
|
|
345
|
+
orchestratorMode?: OrchestratorMode;
|
|
313
346
|
/** Identity links pushed from Platform for trust resolution. Optional -- defaults to empty. */
|
|
314
347
|
identityLinks?: IdentityLink[];
|
|
315
348
|
/** ci_trust permission levels per user ID from Platform push. Optional -- defaults to empty. */
|
|
@@ -343,8 +376,11 @@ export interface ProcessingDeps {
|
|
|
343
376
|
instanceId?: string;
|
|
344
377
|
/** Static-host grace before a disconnected static host reads unreachable (ms). */
|
|
345
378
|
rosterGraceMs?: number;
|
|
346
|
-
/** Cap on runsOnAll per-host children (default 1024).
|
|
379
|
+
/** Cap on runsOnAll per-host children (default 1024). Cluster default; the
|
|
380
|
+
* live per-cluster override is read from `cluster_settings.max_fanout_hosts`. */
|
|
347
381
|
maxFanoutHosts?: number;
|
|
382
|
+
/** Reader for fleet-wide cluster tunables (max_fanout_hosts live override). */
|
|
383
|
+
clusterSettings?: ClusterSettingsReader;
|
|
348
384
|
}
|
|
349
385
|
/**
|
|
350
386
|
* Check if any trigger in the lock file workflows uses path filters.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { Kysely } from 'kysely';
|
|
2
|
+
import type { Database } from '../db/types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Atomically claim a run-minting request by its Platform `requestId`. Returns
|
|
5
|
+
* the run id to use. `claimed: false` means a sibling coordinator already owns
|
|
6
|
+
* this requestId (a relay failover re-sent the same request): the caller MUST
|
|
7
|
+
* return `{ newRunId }` WITHOUT creating or dispatching a run, so one user
|
|
8
|
+
* click yields exactly one run.
|
|
9
|
+
*
|
|
10
|
+
* Shared by `run.rerun.request` and `run.manual_schedule.request` — both mint a
|
|
11
|
+
* fresh run and both ride the Platform's timeout-driven failover path. HA
|
|
12
|
+
* coordinator siblings share one orchestrator DB, so the `INSERT … ON CONFLICT
|
|
13
|
+
* (request_id) DO NOTHING` is the single point of arbitration: exactly one hop
|
|
14
|
+
* inserts and wins; the loser reads back the winner's `new_run_id`.
|
|
15
|
+
*/
|
|
16
|
+
export declare function claimRequestId(db: Kysely<Database>, requestId: string): Promise<{
|
|
17
|
+
newRunId: string;
|
|
18
|
+
claimed: boolean;
|
|
19
|
+
}>;
|
|
20
|
+
/**
|
|
21
|
+
* Prune `request_idempotency` rows older than 1h. The request budget is ~10s,
|
|
22
|
+
* so a claimed requestId is never re-sent after an hour; keeping the table
|
|
23
|
+
* bounded avoids unbounded growth on a long-lived coordinator.
|
|
24
|
+
*
|
|
25
|
+
* @returns the number of rows deleted.
|
|
26
|
+
*/
|
|
27
|
+
export declare function pruneRequestIdempotency(db: Kysely<Database>): Promise<number>;
|
|
28
|
+
//# sourceMappingURL=request-idempotency.d.ts.map
|
package/dist/pipeline/rerun.d.ts
CHANGED
|
@@ -28,18 +28,17 @@ import type { BuildCoordinator } from '../cache/index.js';
|
|
|
28
28
|
import type { DepCache } from '../cache/index.js';
|
|
29
29
|
import type { PendingBuildTracker } from '../cache/index.js';
|
|
30
30
|
/**
|
|
31
|
-
* Thrown when a rerun is attempted on
|
|
32
|
-
* replay path failed (chunk missing,
|
|
33
|
-
* cold-store probe disabled).
|
|
34
|
-
*
|
|
35
|
-
* a genuine "we tried to bring the row back and could not".
|
|
31
|
+
* Thrown when a rerun is attempted on a run whose row is absent from PG AND
|
|
32
|
+
* the cold-store replay path failed or is unavailable (chunk missing,
|
|
33
|
+
* contentHash mismatch, S3 outage, or cold-store probe disabled). Signals a
|
|
34
|
+
* genuine "we tried to bring the row back and could not".
|
|
36
35
|
*
|
|
37
36
|
* The WS dashboard handler maps this to a structured response that the
|
|
38
37
|
* Platform proxy surfaces as HTTP 410 (`errorCode: 'runArchivedNotRerunnable'`).
|
|
39
38
|
*/
|
|
40
39
|
export declare class RunArchivedNotRerunnableError extends Error {
|
|
41
40
|
readonly runId: string;
|
|
42
|
-
readonly code:
|
|
41
|
+
readonly code: 'runArchivedNotRerunnable';
|
|
43
42
|
constructor(runId: string);
|
|
44
43
|
}
|
|
45
44
|
export interface RerunDeps {
|
|
@@ -60,18 +59,26 @@ export interface RerunDeps {
|
|
|
60
59
|
buildCoordinator: BuildCoordinator | null;
|
|
61
60
|
pendingBuilds: PendingBuildTracker | null;
|
|
62
61
|
/**
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
62
|
+
* When set, a PG miss on `originalRunId` triggers a cold-store replay of
|
|
63
|
+
* the chunk containing the row, then a re-read. `null` keeps the "throw
|
|
64
|
+
* RunArchivedNotRerunnableError on PG miss" path for deployments without
|
|
65
|
+
* cold-store wired up.
|
|
67
66
|
*/
|
|
68
67
|
coldStore: ColdStore | null;
|
|
69
68
|
}
|
|
70
69
|
export declare function handleRerun(originalRunId: string, triggeredBy: string | null, triggeredByAgentLabel: string | null, deps: RerunDeps,
|
|
71
70
|
/**
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
*
|
|
71
|
+
* Platform-minted `requestId` for this rerun. Stable across an HA relay
|
|
72
|
+
* failover re-send (the Platform re-sends the same message verbatim to a
|
|
73
|
+
* sibling coordinator on a timeout), so it is the idempotency key: after the
|
|
74
|
+
* read-only validation, the first coordinator to claim it creates the run and
|
|
75
|
+
* a failover re-send returns that same run instead of minting a second one.
|
|
76
|
+
*/
|
|
77
|
+
requestId: string,
|
|
78
|
+
/**
|
|
79
|
+
* Routing key for the original run, forwarded by Platform via the WS
|
|
80
|
+
* `run.rerun.request` payload. Required to address the cold-store chunk
|
|
81
|
+
* under the right tenant prefix.
|
|
75
82
|
*/
|
|
76
83
|
routingKeyHint?: string): Promise<{
|
|
77
84
|
newRunId: string;
|
|
@@ -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
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Kysely } from 'kysely';
|
|
2
2
|
import type { Database } from '../db/types.js';
|
|
3
3
|
import type { ProcessingDeps } from './processor.js';
|
|
4
|
-
import type { ReleaseSignal } from '../
|
|
4
|
+
import type { ReleaseSignal } from '../contexts/held-runs.js';
|
|
5
5
|
import { type WorkflowDispatchContext } from './dispatch-matched-workflow.js';
|
|
6
6
|
import { type SerializableWorkflowDispatchInputs } from './pending-workflow-context.js';
|
|
7
7
|
/**
|
|
@@ -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
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Resolves the lock file, matched decisions, and fixture-specific concerns
|
|
5
5
|
* (inline-vs-provider lock, decision selection, fixture-payload storage, the
|
|
6
|
-
* `allow_local_execution`
|
|
6
|
+
* `allow_local_execution` context gate, CLI-secret overlay, in-memory
|
|
7
7
|
* test-run marking), then dispatches each matched workflow through the SAME
|
|
8
8
|
* shared core as webhooks (`dispatchMatchedWorkflow`). The test path is a thin
|
|
9
9
|
* adapter — needs-DAG scheduling, `expansionMap` fan-out edges, `runsOnAll`
|
|
@@ -94,7 +94,7 @@ interface TestTriggerResult {
|
|
|
94
94
|
jobIds: string[];
|
|
95
95
|
/**
|
|
96
96
|
* User-visible warnings on an accepted run — today, one per job whose bound
|
|
97
|
-
* test-run
|
|
97
|
+
* test-run context(s) were unavailable (non-test or unconfigured) and
|
|
98
98
|
* skipped. Printed by the CLI on acceptance.
|
|
99
99
|
*/
|
|
100
100
|
warnings?: string[];
|
|
@@ -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,9 +16,29 @@ 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;
|
|
22
35
|
ttlMs?: number;
|
|
36
|
+
/**
|
|
37
|
+
* In-process JWKS served directly (no HTTP fetch). Set for the offline local
|
|
38
|
+
* dev plane, whose `kici-local` issuer is not a URL — the plane's own signer
|
|
39
|
+
* is the key source, so a `kici-local` bundle verifies at ingest without a
|
|
40
|
+
* `.well-known/jwks.json` endpoint. When set, discovery/fetch is bypassed.
|
|
41
|
+
*/
|
|
42
|
+
staticJwks?: JSONWebKeySet;
|
|
23
43
|
}): ProvenanceTrustRoot;
|
|
24
44
|
//# sourceMappingURL=trust-root.d.ts.map
|
|
@@ -29,6 +29,14 @@ export interface ProviderBundle {
|
|
|
29
29
|
repoUrlBuilder?: RepoUrlBuilder;
|
|
30
30
|
contributorResolver?: ContributorResolver;
|
|
31
31
|
checkStatusPoster?: CheckStatusPoster;
|
|
32
|
+
/**
|
|
33
|
+
* Local `file://` in-place profile: this bundle's `repoBasePath` is the
|
|
34
|
+
* operator's real working tree, so a dispatched run against it skips the
|
|
35
|
+
* source-pack `__build__` job (the tree is used directly by the agent's
|
|
36
|
+
* `KICI_IN_PLACE` profile). Set only by `createLocalProviderBundle`. Undefined
|
|
37
|
+
* for every non-local (or non-in-place local) bundle.
|
|
38
|
+
*/
|
|
39
|
+
localInPlace?: boolean;
|
|
32
40
|
}
|
|
33
41
|
/**
|
|
34
42
|
* Registry mapping routing keys to their implementation bundles.
|
|
@@ -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.
|