@kici-dev/orchestrator 0.1.26 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/__test-helpers__/mock-db.d.ts +2 -0
- package/dist/agent/dispatcher.d.ts +52 -2
- package/dist/agent/host-roster-reaper.d.ts +1 -2
- package/dist/agent/host-roster.d.ts +34 -0
- package/dist/agent/ownership-refusal.d.ts +12 -0
- package/dist/agent/ownership-tracker.d.ts +64 -16
- package/dist/agent/token-store.d.ts +13 -0
- package/dist/agent-packaging/availability.d.ts +27 -0
- package/dist/agent-packaging/build-package.d.ts +16 -0
- package/dist/agent-packaging/download.d.ts +30 -0
- package/dist/agent-packaging/index.d.ts +9 -0
- package/dist/agent-packaging/install-closure.d.ts +30 -0
- package/dist/agent-packaging/node-binary.d.ts +26 -0
- package/dist/agent-packaging/refresh.d.ts +50 -0
- package/dist/agent-packaging/store.d.ts +15 -0
- package/dist/agent-packaging/upload.d.ts +24 -0
- package/dist/app-on-error.d.ts +29 -0
- package/dist/app.d.ts +69 -8
- package/dist/approvals/apply-decision.d.ts +1 -1
- package/dist/approvals/step-approval-bridge.d.ts +1 -1
- package/dist/artifacts/artifact-store.d.ts +233 -0
- package/dist/artifacts/failure-messages.d.ts +46 -0
- package/dist/audit/access-log.d.ts +18 -1
- package/dist/cache/dep-cache.d.ts +15 -0
- package/dist/cache/pending-inits.d.ts +4 -4
- package/dist/cache/user-cache.d.ts +37 -0
- package/dist/cancel/cancel-run.d.ts +10 -3
- package/dist/cancel/dashboard-cancel-handler.d.ts +19 -0
- package/dist/cli/api-client.d.ts +51 -5
- package/dist/cli/commands/agent-package.d.ts +34 -0
- package/dist/cli/commands/check-run.d.ts +26 -0
- package/dist/cli/commands/cluster-settings.d.ts +55 -0
- package/dist/cli/commands/context.d.ts +25 -0
- package/dist/cli/commands/dashboard-encryption-key.d.ts +3 -0
- package/dist/cli/commands/db-backup.d.ts +71 -0
- package/dist/cli/commands/debug-bundle.d.ts +1 -1
- package/dist/cli/commands/orchestrator-service/drain.d.ts +31 -0
- package/dist/cli/commands/orchestrator-service/index.d.ts +7 -4
- package/dist/cli/commands/orchestrator-service/install-env.d.ts +58 -0
- package/dist/cli/commands/secret.d.ts +45 -1
- package/dist/cli/commands/shared/admin-cli-access-log.d.ts +46 -0
- package/dist/cli/commands/shared/versioned-upgrade.d.ts +65 -2
- package/dist/cli/commands/signing-key.d.ts +3 -0
- package/dist/cli/commands/source.d.ts +12 -0
- package/dist/cli/commands/token.d.ts +9 -0
- package/dist/cli/commands/trust-policy.d.ts +48 -0
- package/dist/cli/commands/variable.d.ts +6 -6
- package/dist/cli/join.d.ts +1 -1
- package/dist/cli/service/index.d.ts +2 -2
- package/dist/cli/service/instance/manifest.d.ts +17 -0
- package/dist/cli/service/instance/resolve.d.ts +11 -0
- package/dist/cli/service/windows.d.ts +6 -0
- package/dist/cli/wizard/orchestrator-wizard.d.ts +39 -11
- package/dist/cli.js +10263 -3667
- package/dist/cluster/cluster-settings-reader.d.ts +78 -0
- package/dist/cluster/coordinator.d.ts +81 -9
- package/dist/cluster/join-client.d.ts +1 -1
- package/dist/cluster/leader-gated-scheduler.d.ts +50 -0
- package/dist/cluster/orphan-recovery.d.ts +14 -0
- package/dist/cluster/peer-client.d.ts +12 -2
- package/dist/cluster/peer-handler.d.ts +15 -4
- package/dist/cluster/peer-registry.d.ts +12 -0
- package/dist/cluster/verified-issuer-poller.d.ts +11 -0
- package/dist/cluster/verified-issuer.d.ts +63 -0
- package/dist/cold-store/tables/access-log.d.ts +1 -1
- package/dist/cold-store/tables/event-log.d.ts +1 -1
- package/dist/cold-store/tables/execution-jobs.d.ts +1 -1
- package/dist/cold-store/tables/execution-runs.d.ts +1 -1
- package/dist/cold-store/tables/execution-steps.d.ts +1 -1
- package/dist/cold-store/tables/secret-audit-log.d.ts +1 -1
- package/dist/config/loader.d.ts +1 -1
- package/dist/config/resolver.d.ts +2 -1
- package/dist/config/schema.d.ts +8 -6
- package/dist/config/types.d.ts +3 -2
- package/dist/config.d.ts +372 -46
- package/dist/contexts/binding-store.d.ts +36 -0
- package/dist/contexts/context-store.d.ts +100 -0
- package/dist/contexts/glob-specificity.d.ts +30 -0
- package/dist/{environments → contexts}/held-runs.d.ts +64 -32
- package/dist/{environments → contexts}/index.d.ts +1 -1
- package/dist/contexts/protection/aggregate.d.ts +43 -0
- package/dist/contexts/protection/branch-gate.d.ts +5 -0
- package/dist/contexts/protection/concurrency-gate.d.ts +4 -0
- package/dist/{environments → contexts}/protection/pipeline.d.ts +3 -3
- package/dist/contexts/protection/reviewer-gate.d.ts +4 -0
- package/dist/{environments → contexts}/protection/satisfiability.d.ts +22 -22
- package/dist/contexts/protection/trust-gate.d.ts +4 -0
- package/dist/contexts/protection/wait-timer-gate.d.ts +4 -0
- package/dist/contexts/variable-store.d.ts +39 -0
- package/dist/cron/cron-scheduler.d.ts +24 -4
- package/dist/cron/cron-store.d.ts +21 -7
- package/dist/dashboard/attestation-filters.d.ts +94 -74
- package/dist/dashboard/handler.d.ts +63 -3
- package/dist/db/migration-test-harness.d.ts +41 -0
- package/dist/db/migrations/067_environments_to_contexts.d.ts +36 -0
- package/dist/db/migrations/068_request_idempotency.d.ts +17 -0
- package/dist/db/migrations/069_reroute_tunables.d.ts +21 -0
- package/dist/db/migrations/070_execution_runs_failure_class.d.ts +4 -0
- package/dist/db/migrations/071_batch_accumulation.d.ts +26 -0
- package/dist/db/migrations/072_dispatch_queue_run_id_index.d.ts +15 -0
- package/dist/db/migrations/073_org_settings_ingest_concurrency.d.ts +13 -0
- package/dist/db/migrations/074_normalize_zero_concurrency_limit.d.ts +13 -0
- package/dist/db/migrations/075_ingest_overflow_buffer.d.ts +16 -0
- package/dist/db/migrations/076_artifacts.d.ts +19 -0
- package/dist/db/migrations/077_backup_runs.d.ts +13 -0
- package/dist/db/migrations/078_org_settings_backup_staleness.d.ts +12 -0
- package/dist/db/migrations/079_org_settings_scaler_spawn_timeout.d.ts +14 -0
- package/dist/db/migrations/080_cluster_settings.d.ts +17 -0
- package/dist/db/migrations/081_org_settings_queue_timeout.d.ts +19 -0
- package/dist/db/migrations/082_host_s3_reachable.d.ts +16 -0
- package/dist/db/migrations/083_org_settings_artifact_caps.d.ts +18 -0
- package/dist/db/migrations/084_orchestrator_signing_keys.d.ts +20 -0
- package/dist/db/migrations/085_cluster_settings_reroute_flap_grace_ms.d.ts +12 -0
- package/dist/db/migrations/086_cluster_settings_max_fanout_hosts.d.ts +12 -0
- package/dist/db/migrations/087_cluster_settings_event_router_rate_limit.d.ts +12 -0
- package/dist/db/migrations/088_cluster_settings_cache_max_tarball_bytes.d.ts +12 -0
- package/dist/db/migrations/089_cluster_settings_cache_ttl_days.d.ts +12 -0
- package/dist/db/migrations/090_cluster_settings_concurrency_wait_timeout_ms.d.ts +12 -0
- package/dist/db/migrations/091_cluster_settings_agent_token_ttl_ms.d.ts +12 -0
- package/dist/db/migrations/092_cluster_settings_version.d.ts +16 -0
- package/dist/db/migrations/093_org_settings_sandbox_allowlist.d.ts +4 -0
- package/dist/db/migrations/094_dashboard_encryption_keys.d.ts +21 -0
- package/dist/db/migrations/095_dashboard_write_policy_tristate.d.ts +20 -0
- package/dist/db/migrations/096_multi_schedule_cron_last_fired.d.ts +4 -0
- package/dist/db/migrations/097_execution_runs_pr_number.d.ts +4 -0
- package/dist/db/migrations/098_execution_runs_customer_id.d.ts +4 -0
- package/dist/db/migrations/099_cluster_settings_dashboard_verified_issuer.d.ts +21 -0
- package/dist/db/migrations/100_held_runs_hold_type_vocabulary.d.ts +31 -0
- package/dist/db/migrations/101_contexts_hold_expiry_drop_default.d.ts +31 -0
- package/dist/db/migrations/102_dispatch_queue_agent_id.d.ts +20 -0
- package/dist/db/migrations/103_cluster_settings_ownership_db_check_timeout_ms.d.ts +20 -0
- package/dist/db/migrations/104_check_run_terminal_sent.d.ts +22 -0
- package/dist/db/migrations/105_org_trust_policy.d.ts +19 -0
- package/dist/db/migrations/106_cluster_settings_check_run_tracking_ttl_days.d.ts +18 -0
- package/dist/db/migrations/107_check_run_tracking_updated_at_index.d.ts +23 -0
- package/dist/db/repos/dashboard-encryption-keys-repo.d.ts +48 -0
- package/dist/db/repos/signing-keys-repo.d.ts +34 -0
- package/dist/db/types.d.ts +499 -66
- package/dist/deployment/deployment-identity.d.ts +87 -2
- package/dist/diagnostics/checks/backup.d.ts +18 -0
- package/dist/diagnostics/checks/index.d.ts +2 -1
- package/dist/diagnostics/fleet-collector.d.ts +1 -1
- package/dist/drain/drain-controller.d.ts +52 -0
- package/dist/events/batch-accumulator.d.ts +63 -0
- package/dist/events/circuit-breaker.d.ts +9 -3
- package/dist/events/event-emitter.d.ts +31 -0
- package/dist/events/event-retry-scanner.d.ts +12 -2
- package/dist/events/event-router.d.ts +29 -0
- package/dist/firecracker/host-network.d.ts +2 -0
- package/dist/firecracker/net-interfaces.d.ts +14 -0
- package/dist/github-app-name-refresher/github-app-name-refresher.d.ts +19 -9
- package/dist/index.d.ts +2 -0
- package/dist/index.js +625 -22
- package/dist/lockfile-cache.d.ts +4 -0
- package/dist/lockfile-validate.d.ts +16 -9
- package/dist/metrics/prometheus.d.ts +114 -15
- package/dist/oidc/aws-kms-signer.d.ts +37 -0
- package/dist/oidc/command-signer.d.ts +23 -0
- package/dist/oidc/db-signer.d.ts +48 -0
- package/dist/oidc/id-token-claims.d.ts +76 -0
- package/dist/oidc/jwt.d.ts +18 -0
- package/dist/oidc/local-dev-signer.d.ts +31 -0
- package/dist/oidc/local-mint.d.ts +77 -0
- package/dist/oidc/oidc-mint-registration.d.ts +65 -0
- package/dist/oidc/orchestrator-mint.d.ts +97 -0
- package/dist/oidc/orchestrator-signer-factory.d.ts +33 -0
- package/dist/oidc/reconcile-signing-key.d.ts +21 -0
- package/dist/oidc/signer.d.ts +25 -0
- package/dist/oidc/signing-key-status.d.ts +23 -0
- package/dist/orchestrator-core.d.ts +42 -2
- package/dist/pipeline/decorating-secret-resolver.d.ts +5 -4
- package/dist/pipeline/dispatch-matched-workflow.d.ts +44 -3
- package/dist/pipeline/inline-eval.d.ts +2 -2
- package/dist/pipeline/install-secrets-resolver.d.ts +25 -14
- package/dist/pipeline/{job-environments.d.ts → job-contexts.d.ts} +23 -23
- package/dist/pipeline/manual-schedule.d.ts +28 -14
- package/dist/pipeline/pending-workflow-context.d.ts +1 -1
- package/dist/pipeline/process-webhook.d.ts +57 -2
- package/dist/pipeline/processor.d.ts +49 -13
- package/dist/pipeline/request-idempotency.d.ts +28 -0
- package/dist/pipeline/rerun.d.ts +20 -13
- package/dist/pipeline/resolve-sandbox-grant.d.ts +28 -0
- package/dist/pipeline/resume-workflow.d.ts +1 -1
- package/dist/pipeline/route-or-dispatch-jobs.d.ts +71 -0
- package/dist/pipeline/sandbox-allowlist-reader.d.ts +33 -0
- package/dist/pipeline/test-pipeline.d.ts +2 -2
- package/dist/policy/dashboard-write-policy.d.ts +9 -4
- package/dist/provenance/backfill-run.d.ts +1 -0
- package/dist/provenance/trust-root.d.ts +20 -0
- package/dist/provider-registry.d.ts +8 -0
- package/dist/providers/generic/normalizer.d.ts +1 -1
- package/dist/providers/github/auth.d.ts +1 -1
- package/dist/providers/github/changed-files.d.ts +14 -6
- package/dist/providers/github/check-status-poster.d.ts +19 -3
- package/dist/providers/github/contributor-resolver.d.ts +1 -1
- package/dist/providers/github/lock-file.d.ts +1 -1
- package/dist/providers/github/normalizer.d.ts +1 -1
- package/dist/providers/github/repo-url.d.ts +1 -1
- package/dist/providers/local/index.d.ts +1 -0
- package/dist/providers/local/local-source-config.d.ts +1 -0
- package/dist/providers/local/lock-file-fetcher.d.ts +1 -1
- package/dist/providers/local/normalizer.d.ts +1 -1
- package/dist/providers/local/repo-url-builder.d.ts +1 -1
- package/dist/providers/universal-git/changed-files.d.ts +8 -7
- package/dist/providers/universal-git/clone-token.d.ts +1 -1
- package/dist/providers/universal-git/config.d.ts +4 -4
- package/dist/providers/universal-git/index.d.ts +5 -1
- package/dist/providers/universal-git/lock-file.d.ts +6 -1
- package/dist/providers/universal-git/normalizer.d.ts +1 -1
- package/dist/providers/universal-git/repo-url.d.ts +1 -1
- package/dist/queue/cleanup.d.ts +69 -8
- package/dist/queue/job-queue.d.ts +94 -14
- package/dist/queue/scheduled-job.d.ts +2 -2
- package/dist/registration/registration-index.d.ts +1 -1
- package/dist/reporting/agent-failure-category.d.ts +4 -1
- package/dist/reporting/check-run-reporter.d.ts +34 -14
- package/dist/reporting/check-run-tracking-store.d.ts +70 -8
- package/dist/reporting/execution-tracker.d.ts +173 -17
- package/dist/reporting/fs-log-storage.d.ts +31 -2
- package/dist/reporting/job-check-run-completion.d.ts +50 -0
- package/dist/reporting/log-chunk-sink.d.ts +47 -0
- package/dist/reporting/log-retention.d.ts +16 -0
- package/dist/reporting/log-storage.d.ts +64 -4
- package/dist/reporting/log-writer.d.ts +22 -7
- package/dist/reporting/peer-log-normalize.d.ts +14 -0
- package/dist/reporting/run-aggregator.d.ts +36 -36
- package/dist/reporting/s3-log-storage.d.ts +102 -8
- package/dist/routes/admin-auth.d.ts +90 -0
- package/dist/routes/admin-cluster-settings.d.ts +31 -0
- package/dist/routes/admin-contexts.d.ts +47 -0
- package/dist/routes/admin-events.d.ts +3 -0
- package/dist/routes/admin-orchestrator-drain.d.ts +35 -0
- package/dist/routes/admin-registrations.d.ts +2 -2
- package/dist/routes/admin-runs.d.ts +9 -0
- package/dist/routes/admin-sources.d.ts +7 -0
- package/dist/routes/admin-trust-policy.d.ts +49 -0
- package/dist/routes/admin.d.ts +15 -1
- package/dist/routes/github-webhook.d.ts +9 -3
- package/dist/routes/provenance-oidc.d.ts +38 -0
- package/dist/routes/verify-attestation.d.ts +21 -0
- package/dist/scaler/bare-metal-backend.d.ts +9 -2
- package/dist/scaler/config.d.ts +25 -4
- package/dist/scaler/container-backend.d.ts +9 -1
- package/dist/scaler/firecracker-backend.d.ts +29 -2
- package/dist/scaler/index.d.ts +1 -1
- package/dist/scaler/manager.d.ts +166 -8
- package/dist/scaler/pending-scale-sweeper.d.ts +35 -0
- package/dist/scaler/types.d.ts +75 -6
- package/dist/secrets/backend-registry.d.ts +32 -1
- package/dist/secrets/context-secret-resolver.d.ts +30 -0
- package/dist/secrets/dashboard-encryption-key.d.ts +48 -0
- package/dist/secrets/ephemeral-keys.d.ts +16 -0
- package/dist/secrets/index.d.ts +1 -1
- package/dist/secrets/pg-secret-store.d.ts +13 -3
- package/dist/secrets/rbac.d.ts +5 -1
- package/dist/secrets/routing-key-scope.d.ts +6 -0
- package/dist/secrets/scope-routing.d.ts +126 -0
- package/dist/secrets/secret-resolver.d.ts +19 -32
- package/dist/secrets/token-manager.d.ts +5 -1
- package/dist/security/comment-handler.d.ts +1 -1
- package/dist/security/contributor-cache.d.ts +9 -1
- package/dist/security/trust-policy-gate.d.ts +117 -0
- package/dist/security/trust-policy-store.d.ts +78 -0
- package/dist/server.js +44012 -32721
- package/dist/sources/source-manager.d.ts +24 -0
- package/dist/stale-detector/stale-run-detector.d.ts +8 -1
- package/dist/standalone.js +44106 -33690
- package/dist/storage/blob-routes.d.ts +16 -0
- package/dist/storage/filesystem.d.ts +17 -0
- package/dist/storage/key-discriminator.d.ts +20 -0
- package/dist/storage/s3.d.ts +2 -0
- package/dist/storage/types.d.ts +16 -0
- package/dist/webhook/dedup.d.ts +9 -1
- package/dist/webhook/event-log.d.ts +13 -2
- package/dist/webhook/generic-sources-listener.d.ts +4 -0
- package/dist/webhook/ingest-admission.d.ts +140 -0
- package/dist/webhook/ingest-overflow-buffer.d.ts +27 -0
- package/dist/webhook/ingest-overflow-replayer.d.ts +49 -0
- package/dist/webhook/ingest-overflow-types.d.ts +73 -0
- package/dist/webhook/loop-lag-source.d.ts +40 -0
- package/dist/webhook/observed-relay-guard.d.ts +40 -0
- package/dist/webhook/org-ingest-cap-reader.d.ts +24 -0
- package/dist/webhook/register-source-bundle.d.ts +3 -0
- package/dist/webhook/relay-reinject.d.ts +43 -0
- package/dist/worker/in-memory-job-queue.d.ts +8 -3
- package/dist/worker-core.d.ts +10 -0
- package/dist/ws/agent-api-registry.d.ts +20 -0
- package/dist/ws/agent-handler.d.ts +63 -7
- package/dist/ws/bringup-api.d.ts +99 -0
- package/dist/ws/{dashboard-env-handler.d.ts → dashboard-context-handler.d.ts} +43 -25
- package/dist/ws/dashboard-run-state-handler.d.ts +31 -0
- package/dist/ws/failure-messages.d.ts +29 -0
- package/dist/ws/oidc-token-relay.d.ts +15 -0
- package/dist/ws/ownership-gate.d.ts +22 -0
- package/dist/ws/platform-client.d.ts +96 -1
- package/dist/ws/replay-chunker.d.ts +37 -0
- package/installer-image-digests.json +3 -3
- package/package.json +22 -21
- package/sbom.spdx.json +1245 -1793
- package/dist/cli/commands/environment.d.ts +0 -25
- package/dist/environments/binding-store.d.ts +0 -36
- package/dist/environments/environment-store.d.ts +0 -87
- package/dist/environments/protection/aggregate.d.ts +0 -43
- package/dist/environments/protection/branch-gate.d.ts +0 -5
- package/dist/environments/protection/concurrency-gate.d.ts +0 -7
- package/dist/environments/protection/reviewer-gate.d.ts +0 -7
- package/dist/environments/protection/trust-gate.d.ts +0 -7
- package/dist/environments/protection/wait-timer-gate.d.ts +0 -7
- package/dist/environments/variable-store.d.ts +0 -39
- package/dist/routes/admin-environments.d.ts +0 -47
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Admin API routes for context management.
|
|
3
|
+
*
|
|
4
|
+
* POST /api/v1/admin/contexts — create (upsert)
|
|
5
|
+
* POST /api/v1/admin/contexts/:name/bind — bind a scope pattern
|
|
6
|
+
* PATCH /api/v1/admin/contexts/:name/policy — update policy fields
|
|
7
|
+
* GET /api/v1/admin/contexts?orgId=<id> — list contexts
|
|
8
|
+
* GET /api/v1/admin/contexts/:name?orgId=<id> — show env + vars + bindings
|
|
9
|
+
* DELETE /api/v1/admin/contexts/:name?orgId=<id> — delete env (cascades bindings/variables/overrides; pending held runs block with 409)
|
|
10
|
+
* POST /api/v1/admin/contexts/templates — create/update a template
|
|
11
|
+
* GET /api/v1/admin/contexts/:name/variables?orgId=<id> — list org-level variables
|
|
12
|
+
* PUT /api/v1/admin/contexts/:name/variables/:key?orgId=<id> — upsert variable
|
|
13
|
+
* DELETE /api/v1/admin/contexts/:name/variables/:key?orgId=<id> — delete variable
|
|
14
|
+
*
|
|
15
|
+
* Backs the `kici-admin context` dual-mode CLI. Offline (direct-DB) mode
|
|
16
|
+
* bypasses this router entirely — the CLI calls `*Direct` helpers from
|
|
17
|
+
* @kici-dev/shared. This HTTP surface exists so tooling with only an admin
|
|
18
|
+
* token (no DB reach) can do the same operations.
|
|
19
|
+
*
|
|
20
|
+
* All routes are protected by the admin auth middleware mounted in admin.ts
|
|
21
|
+
* (at `/api/v1/admin/*`). That middleware sets `role` + `userId` on the
|
|
22
|
+
* context, which we use for RBAC gating here.
|
|
23
|
+
*/
|
|
24
|
+
import { Hono } from 'hono';
|
|
25
|
+
import { type Kysely } from 'kysely';
|
|
26
|
+
import type { RbacEnforcer, Role } from '../secrets/rbac.js';
|
|
27
|
+
export interface AdminContextRoutesDeps {
|
|
28
|
+
db: Kysely<any>;
|
|
29
|
+
rbac: RbacEnforcer;
|
|
30
|
+
}
|
|
31
|
+
/** Hono env type for admin-contexts routes with context variables. */
|
|
32
|
+
type AdminEnvEnv = {
|
|
33
|
+
Variables: {
|
|
34
|
+
role: Role;
|
|
35
|
+
userId: string;
|
|
36
|
+
routingKey: string | null;
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* Create admin API routes for context management.
|
|
41
|
+
*
|
|
42
|
+
* @param deps - db (Kysely) + rbac enforcer
|
|
43
|
+
* @returns Hono app mounted at /api/v1/admin
|
|
44
|
+
*/
|
|
45
|
+
export declare function createAdminContextRoutes(deps: AdminContextRoutesDeps): Hono<AdminEnvEnv>;
|
|
46
|
+
export {};
|
|
47
|
+
//# sourceMappingURL=admin-contexts.d.ts.map
|
|
@@ -16,6 +16,7 @@ import type { RbacEnforcer, Role } from '../secrets/rbac.js';
|
|
|
16
16
|
import type { AppConfig } from '../config.js';
|
|
17
17
|
import type { ProviderRegistry } from '../provider-registry.js';
|
|
18
18
|
import type { SecretResolver } from '../secrets/secret-resolver.js';
|
|
19
|
+
import type { ClusterSettingsReader } from '../cluster/cluster-settings-reader.js';
|
|
19
20
|
/**
|
|
20
21
|
* Dependencies for admin event routes.
|
|
21
22
|
*/
|
|
@@ -38,6 +39,8 @@ interface AdminEventRouteDeps {
|
|
|
38
39
|
/** Required for universal-git source registration — `null` is allowed;
|
|
39
40
|
* rows with `git_config` are skipped + metric-bumped in that case. */
|
|
40
41
|
secretResolver: SecretResolver | null;
|
|
42
|
+
/** Fleet-wide settings reader; threads the live lock-file cap into newly-registered universal-git sources. */
|
|
43
|
+
clusterSettings?: ClusterSettingsReader;
|
|
41
44
|
/**
|
|
42
45
|
* Optional — when provided, the `POST /api/v1/admin/events/emit` route is
|
|
43
46
|
* mounted so operators can INSERT into `kici_events` + `pg_notify` via HTTP.
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Orchestrator drain admin routes.
|
|
3
|
+
*
|
|
4
|
+
* Backs the `kici-admin orchestrator drain` / `resume` / `drain --status`
|
|
5
|
+
* verbs used to quiesce a coordinator before an upgrade. Mounted inside
|
|
6
|
+
* `createAdminRoutes` at `/api/v1/admin/orchestrator/drain`, so it inherits the
|
|
7
|
+
* Bearer-token auth middleware (which resolves the caller's role) and gates on
|
|
8
|
+
* the `orchestrator.drain` RBAC permission (owner + admin).
|
|
9
|
+
*
|
|
10
|
+
* - `GET /api/v1/admin/orchestrator/drain` → current `{ draining, jobsRunning }`.
|
|
11
|
+
* - `POST /api/v1/admin/orchestrator/drain { action: 'drain' | 'resume' }` →
|
|
12
|
+
* flips the drain flag and returns the new snapshot.
|
|
13
|
+
*/
|
|
14
|
+
import { Hono } from 'hono';
|
|
15
|
+
import { z } from 'zod';
|
|
16
|
+
import type { DrainController } from '../drain/drain-controller.js';
|
|
17
|
+
import type { RbacEnforcer, Role } from '../secrets/rbac.js';
|
|
18
|
+
export declare const DrainActionSchema: z.ZodEnum<{
|
|
19
|
+
drain: "drain";
|
|
20
|
+
resume: "resume";
|
|
21
|
+
}>;
|
|
22
|
+
export type DrainAction = z.infer<typeof DrainActionSchema>;
|
|
23
|
+
type AdminEnv = {
|
|
24
|
+
Variables: {
|
|
25
|
+
role: Role;
|
|
26
|
+
userId: string;
|
|
27
|
+
routingKey: string | null;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
export declare function createOrchestratorDrainRoutes(deps: {
|
|
31
|
+
drainController: DrainController;
|
|
32
|
+
rbac: RbacEnforcer;
|
|
33
|
+
}): Hono<AdminEnv>;
|
|
34
|
+
export {};
|
|
35
|
+
//# sourceMappingURL=admin-orchestrator-drain.d.ts.map
|
|
@@ -10,7 +10,7 @@ import type { RegistrationStore } from '../registration/registration-store.js';
|
|
|
10
10
|
import type { RegistrationIndex } from '../registration/registration-index.js';
|
|
11
11
|
import type { TokenManager } from '../secrets/token-manager.js';
|
|
12
12
|
import type { RbacEnforcer, Role } from '../secrets/rbac.js';
|
|
13
|
-
import type {
|
|
13
|
+
import type { ContextStore } from '../contexts/context-store.js';
|
|
14
14
|
/**
|
|
15
15
|
* Dependencies for admin registration routes.
|
|
16
16
|
*/
|
|
@@ -25,7 +25,7 @@ export interface AdminRegistrationRoutesDeps {
|
|
|
25
25
|
* provably-unsatisfiable environment list (missing/disabled env, or
|
|
26
26
|
* mutually-exclusive fixed branch/trigger/repo restrictions).
|
|
27
27
|
*/
|
|
28
|
-
|
|
28
|
+
contextStore?: Pick<ContextStore, 'matchContext'>;
|
|
29
29
|
}
|
|
30
30
|
/** Hono env type for admin registration routes with context variables. */
|
|
31
31
|
type AdminRegEnv = {
|
|
@@ -25,6 +25,15 @@ import type { TokenManager } from '../secrets/token-manager.js';
|
|
|
25
25
|
import type { RbacEnforcer, Role } from '../secrets/rbac.js';
|
|
26
26
|
import type { AuditLogger } from '../secrets/audit-logger.js';
|
|
27
27
|
import type { LogStorage } from '../reporting/log-storage.js';
|
|
28
|
+
/**
|
|
29
|
+
* Statuses accepted by the `?status=` filter.
|
|
30
|
+
*
|
|
31
|
+
* The full canonical union rather than just `ExecutionRunStatus.options`: only
|
|
32
|
+
* run statuses can appear in `execution_runs.status`, but the job-only members
|
|
33
|
+
* were accepted before and simply match no row, so keeping them avoids turning
|
|
34
|
+
* an empty result into a rejected request.
|
|
35
|
+
*/
|
|
36
|
+
export declare const RUN_STATUSES: ReadonlySet<string>;
|
|
28
37
|
/**
|
|
29
38
|
* Dependencies for admin run routes.
|
|
30
39
|
*/
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
* the admin auth middleware in admin.ts.
|
|
10
10
|
*/
|
|
11
11
|
import { Hono } from 'hono';
|
|
12
|
+
import { OrchestratorMode } from '@kici-dev/engine';
|
|
12
13
|
import type { SourceStore } from '../sources/source-store.js';
|
|
13
14
|
import type { Role } from '../secrets/rbac.js';
|
|
14
15
|
import { type FetchGithubAppIdentity } from '../github-app-name-refresher/github-app-name-refresher.js';
|
|
@@ -46,6 +47,12 @@ interface SourceRouteDeps {
|
|
|
46
47
|
* `source refresh` route.
|
|
47
48
|
*/
|
|
48
49
|
fetchAppIdentity?: FetchGithubAppIdentity;
|
|
50
|
+
/**
|
|
51
|
+
* Orchestrator operating mode. `observed` refuses GitHub-App source creation:
|
|
52
|
+
* those sources are ingested through the Platform relay, and an observed
|
|
53
|
+
* orchestrator never accepts a relay. Omitted (undefined) behaves as before.
|
|
54
|
+
*/
|
|
55
|
+
mode?: OrchestratorMode;
|
|
49
56
|
}
|
|
50
57
|
type AdminSourcesEnv = {
|
|
51
58
|
Variables: {
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Admin API routes for the org trust policy.
|
|
3
|
+
*
|
|
4
|
+
* Exposes GET / PATCH `/api/v1/admin/trust-policy` so `kici-admin` can read the
|
|
5
|
+
* enforced policy and, on an independent orchestrator, set it.
|
|
6
|
+
*
|
|
7
|
+
* The policy is Platform-owned wherever a Platform is attached: the Platform
|
|
8
|
+
* pushes it on `trust_policy.update` and the next push would clobber a local
|
|
9
|
+
* write. PATCH therefore refuses on any Platform-attached orchestrator, and the
|
|
10
|
+
* refusal is server-side so it cannot be bypassed by calling the API directly.
|
|
11
|
+
*/
|
|
12
|
+
import { Hono } from 'hono';
|
|
13
|
+
import type { OrchestratorMode } from '@kici-dev/engine';
|
|
14
|
+
import type { TrustPolicyStore } from '../security/trust-policy-store.js';
|
|
15
|
+
import type { RbacEnforcer, Role } from '../secrets/rbac.js';
|
|
16
|
+
import type { AccessLogWriter } from '../audit/access-log.js';
|
|
17
|
+
/**
|
|
18
|
+
* Wording for the Platform-managed refusal. Shared with the CLI through the
|
|
19
|
+
* response body — the CLI surfaces this verbatim rather than inventing its own.
|
|
20
|
+
*/
|
|
21
|
+
export declare const PLATFORM_MANAGED_MESSAGE: string;
|
|
22
|
+
interface TrustPolicyRouteDeps {
|
|
23
|
+
store: TrustPolicyStore;
|
|
24
|
+
rbac: RbacEnforcer;
|
|
25
|
+
/** This orchestrator's mode; decides whether PATCH is permitted at all. */
|
|
26
|
+
mode: OrchestratorMode;
|
|
27
|
+
/**
|
|
28
|
+
* Audit sink for the PATCH, written inside the policy transaction.
|
|
29
|
+
*
|
|
30
|
+
* REQUIRED, not optional. The guarantee this route makes is that a loosened
|
|
31
|
+
* `forkPolicy` can never land unattributed; an optional sink would leave that
|
|
32
|
+
* resting on every construction site remembering to pass one, and a route
|
|
33
|
+
* built without one would accept the write and silently skip the audit. A
|
|
34
|
+
* required dependency moves the guarantee from convention to the compiler —
|
|
35
|
+
* and `admin.ts` skips mounting the route entirely rather than mounting an
|
|
36
|
+
* unauditable one.
|
|
37
|
+
*/
|
|
38
|
+
accessLog: AccessLogWriter;
|
|
39
|
+
}
|
|
40
|
+
type AdminEnv = {
|
|
41
|
+
Variables: {
|
|
42
|
+
role: Role;
|
|
43
|
+
userId: string;
|
|
44
|
+
routingKey: string | null;
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
export declare function createTrustPolicyRoutes(deps: TrustPolicyRouteDeps): Hono<AdminEnv>;
|
|
48
|
+
export {};
|
|
49
|
+
//# sourceMappingURL=admin-trust-policy.d.ts.map
|
package/dist/routes/admin.d.ts
CHANGED
|
@@ -16,11 +16,12 @@ import type { AuditLogger } from '../secrets/audit-logger.js';
|
|
|
16
16
|
import type { AgentTokenStore } from '../agent/token-store.js';
|
|
17
17
|
import type { AgentRegistry } from '../agent/registry.js';
|
|
18
18
|
import type { SharedConfigStore } from '../config/shared-store.js';
|
|
19
|
+
import type { DrainController } from '../drain/drain-controller.js';
|
|
19
20
|
import type { SourceStore } from '../sources/source-store.js';
|
|
20
21
|
import type { JoinTokenManager } from '../cluster/join-token.js';
|
|
21
22
|
import type { BackendRegistry } from '../secrets/backend-registry.js';
|
|
22
23
|
import type { BackendHealthChecker } from '../secrets/backend-health.js';
|
|
23
|
-
import type { BackendSyncManager } from '@kici-dev/engine';
|
|
24
|
+
import type { BackendSyncManager, OrchestratorMode } from '@kici-dev/engine';
|
|
24
25
|
import type { Kysely } from 'kysely';
|
|
25
26
|
import type pg from 'pg';
|
|
26
27
|
import type { AccessLogWriter } from '../audit/access-log.js';
|
|
@@ -29,9 +30,22 @@ import type { AccessLogWriter } from '../audit/access-log.js';
|
|
|
29
30
|
*/
|
|
30
31
|
export interface AdminRouteDeps {
|
|
31
32
|
tokenManager: TokenManager;
|
|
33
|
+
/**
|
|
34
|
+
* Orchestrator operating mode. Gates mode-specific admin behavior — today the
|
|
35
|
+
* `observed`-mode refusal of GitHub-App source creation (those sources are
|
|
36
|
+
* Platform-relayed by nature, and an observed orchestrator never accepts a
|
|
37
|
+
* relay). Optional so WS-only / test admins can omit it.
|
|
38
|
+
*/
|
|
39
|
+
mode?: OrchestratorMode;
|
|
32
40
|
rbac: RbacEnforcer;
|
|
33
41
|
secretStore: PgSecretStore;
|
|
34
42
|
auditLogger: AuditLogger;
|
|
43
|
+
/**
|
|
44
|
+
* Optional -- the coordinator drain controller. When provided, the
|
|
45
|
+
* `POST`/`GET /api/v1/admin/orchestrator/drain` routes are mounted (backing
|
|
46
|
+
* the `kici-admin orchestrator drain` verbs). Omitted on WS-only admins.
|
|
47
|
+
*/
|
|
48
|
+
drainController?: DrainController;
|
|
35
49
|
/** Optional -- for agent token CRUD endpoints. */
|
|
36
50
|
tokenStore?: AgentTokenStore;
|
|
37
51
|
/**
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { Hono } from 'hono';
|
|
2
|
+
import type { OrchestratorMode } from '@kici-dev/engine';
|
|
2
3
|
import type { WebhookInfo } from '../webhook/handler.js';
|
|
3
4
|
import type { SourceStore } from '../sources/source-store.js';
|
|
5
|
+
import type { ClusterSettingsReader } from '../cluster/cluster-settings-reader.js';
|
|
4
6
|
import { type VerifyInboundDeps } from '../webhook/verify-inbound.js';
|
|
5
7
|
import { WebhookIngestOutcome } from '../pipeline/process-webhook.js';
|
|
6
8
|
/** Dependencies for the direct GitHub webhook ingress route. */
|
|
@@ -11,13 +13,17 @@ export interface GithubWebhookRoutesDeps {
|
|
|
11
13
|
verifyDeps: VerifyInboundDeps;
|
|
12
14
|
/** Pipeline entry — owns the atomic dedup claim + dispatch. */
|
|
13
15
|
onWebhook: (info: WebhookInfo) => Promise<WebhookIngestOutcome>;
|
|
16
|
+
/** Fleet-wide settings reader; overrides the payload cap per request. */
|
|
17
|
+
clusterSettings?: ClusterSettingsReader;
|
|
18
|
+
/** Cluster default payload cap (bytes) when no cluster_settings override is set. */
|
|
19
|
+
maxGithubPayloadBytes?: number;
|
|
14
20
|
}
|
|
15
21
|
/**
|
|
16
22
|
* Whether the orchestrator serves the direct GitHub ingress route for a given
|
|
17
|
-
* operating mode. Hybrid
|
|
18
|
-
* is relay-only (no local GitHub source to serve).
|
|
23
|
+
* operating mode. Hybrid, independent, and observed modes serve their own
|
|
24
|
+
* ingress; platform mode is relay-only (no local GitHub source to serve).
|
|
19
25
|
*/
|
|
20
|
-
export declare function shouldServeGithubIngress(mode:
|
|
26
|
+
export declare function shouldServeGithubIngress(mode: OrchestratorMode): boolean;
|
|
21
27
|
/**
|
|
22
28
|
* Direct GitHub-App webhook ingress: `POST /webhook/:orgId/github/:sourceId`.
|
|
23
29
|
*
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Hono } from 'hono';
|
|
2
|
+
import type { OrchestratorSigningKeyRepo } from '../db/repos/signing-keys-repo.js';
|
|
3
|
+
import type { DashboardEncryptionKeyRepo } from '../db/repos/dashboard-encryption-keys-repo.js';
|
|
4
|
+
/** OIDC discovery document for the orchestrator provenance issuer. */
|
|
5
|
+
export interface OpenidConfiguration {
|
|
6
|
+
issuer: string;
|
|
7
|
+
jwks_uri: string;
|
|
8
|
+
id_token_signing_alg_values_supported: string[];
|
|
9
|
+
response_types_supported: string[];
|
|
10
|
+
subject_types_supported: string[];
|
|
11
|
+
claims_supported: string[];
|
|
12
|
+
}
|
|
13
|
+
/** Build the `/.well-known/openid-configuration` document for the orchestrator issuer. */
|
|
14
|
+
export declare function buildOpenidConfiguration(issuer: string): OpenidConfiguration;
|
|
15
|
+
export interface ProvenanceOidcRoutesDeps {
|
|
16
|
+
/** The orchestrator's own provenance issuer (config.provenanceSigningIssuer). */
|
|
17
|
+
issuer: string | undefined;
|
|
18
|
+
repo: Pick<OrchestratorSigningKeyRepo, 'listTrusted'>;
|
|
19
|
+
/** Whether orchestrator-owned signing is configured. */
|
|
20
|
+
enabled: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Dashboard-encryption key repo. When present, the JWKS additionally serves
|
|
23
|
+
* the non-revoked X25519 `use:'enc'` key(s) for browser-sealed dashboard
|
|
24
|
+
* writes (the Verified tier's trust root). Independent of provenance signing.
|
|
25
|
+
*/
|
|
26
|
+
dashboardEncryptionRepo?: Pick<DashboardEncryptionKeyRepo, 'listNonRevoked'>;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Public, unauthenticated OIDC discovery + JWKS endpoints for the orchestrator
|
|
30
|
+
* provenance issuer. Serves ONLY the public key halves (safe to expose).
|
|
31
|
+
*
|
|
32
|
+
* The discovery document returns 503 when orchestrator-owned signing is not
|
|
33
|
+
* configured. The JWKS does not: it also carries the X25519 dashboard-encryption
|
|
34
|
+
* key, which is unrelated to build attestations, and returns 503 only when there
|
|
35
|
+
* is no key of either kind to publish.
|
|
36
|
+
*/
|
|
37
|
+
export declare function createProvenanceOidcRoutes(deps: ProvenanceOidcRoutesDeps): Hono;
|
|
38
|
+
//# sourceMappingURL=provenance-oidc.d.ts.map
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Hono } from 'hono';
|
|
2
|
+
import type { OrchestratorSigningKeyRepo } from '../db/repos/signing-keys-repo.js';
|
|
3
|
+
export interface VerifyAttestationRoutesDeps {
|
|
4
|
+
/** The orchestrator's own provenance issuer (config.provenanceSigningIssuer). */
|
|
5
|
+
issuer: string | undefined;
|
|
6
|
+
repo: Pick<OrchestratorSigningKeyRepo, 'listTrusted'>;
|
|
7
|
+
/** Whether orchestrator-owned signing is configured. */
|
|
8
|
+
enabled: boolean;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Native online verify endpoint: a third party POSTs a bundle and the
|
|
12
|
+
* orchestrator verifies it against its LIVE key set (fresh rotations /
|
|
13
|
+
* revocations included), returning a structured verdict. No Platform involved.
|
|
14
|
+
*
|
|
15
|
+
* The token `iss` is ALWAYS pinned out-of-band to the orchestrator's configured
|
|
16
|
+
* issuer — the bundle can never name its own trusted issuer. Never throws on a
|
|
17
|
+
* verification failure (returns `verified:false`); the shared engine core owns
|
|
18
|
+
* all crypto (ES256 pinned; no alg-confusion / alg:none).
|
|
19
|
+
*/
|
|
20
|
+
export declare function createVerifyAttestationRoutes(deps: VerifyAttestationRoutesDeps): Hono;
|
|
21
|
+
//# sourceMappingURL=verify-attestation.d.ts.map
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { type ToolRequirement } from '@kici-dev/shared';
|
|
9
9
|
import type { AgentTokenStore } from '../agent/token-store.js';
|
|
10
|
-
import type { ScalerBackend, ScalerEntry, ManagedAgent, LabelSetConfig, LogCapture, ResourceRequest, ScalerEventCallback, ValidationResult, EffectiveLimits } from './types.js';
|
|
10
|
+
import type { ScalerBackend, ScalerEntry, ManagedAgent, LabelSetConfig, LogCapture, ResourceRequest, ScalerEventCallback, ValidationResult, EffectiveLimits, SpawnContext } from './types.js';
|
|
11
11
|
export interface BareMetalScalerBackendOptions {
|
|
12
12
|
/** Human-readable name for this scaler */
|
|
13
13
|
name: string;
|
|
@@ -21,6 +21,12 @@ export interface BareMetalScalerBackendOptions {
|
|
|
21
21
|
tokenStore?: AgentTokenStore;
|
|
22
22
|
/** TTL for ephemeral agent tokens in ms. Default: 1 hour. */
|
|
23
23
|
tokenTtlMs?: number;
|
|
24
|
+
/**
|
|
25
|
+
* Live resolver for the ephemeral agent-token TTL (ms). When set, called per
|
|
26
|
+
* spawn so the leader can serve the fleet-wide
|
|
27
|
+
* `cluster_settings.agent_token_ttl_ms` override; falls back to `tokenTtlMs`.
|
|
28
|
+
*/
|
|
29
|
+
tokenTtlProvider?: () => Promise<number>;
|
|
24
30
|
/** Agent roles for this scaler. undefined = all, [] = execution only. */
|
|
25
31
|
roles?: string[];
|
|
26
32
|
/**
|
|
@@ -47,6 +53,7 @@ export declare class BareMetalScalerBackend implements ScalerBackend {
|
|
|
47
53
|
private readonly defaultResources?;
|
|
48
54
|
private readonly tokenStore?;
|
|
49
55
|
private readonly tokenTtlMs;
|
|
56
|
+
private readonly tokenTtlProvider?;
|
|
50
57
|
private readonly roles;
|
|
51
58
|
private readonly enforceCgroups;
|
|
52
59
|
/** Tracks all managed agent processes */
|
|
@@ -72,7 +79,7 @@ export declare class BareMetalScalerBackend implements ScalerBackend {
|
|
|
72
79
|
static getRequiredTools(entry: ScalerEntry): ToolRequirement[];
|
|
73
80
|
get labelSets(): LabelSetConfig[];
|
|
74
81
|
getActiveCount(): number;
|
|
75
|
-
spawn(labelSet: string[], agentId: string, orchestratorUrl: string, onEvent?: ScalerEventCallback, effectiveLimits?: EffectiveLimits): Promise<ManagedAgent>;
|
|
82
|
+
spawn(labelSet: string[], agentId: string, orchestratorUrl: string, onEvent?: ScalerEventCallback, effectiveLimits?: EffectiveLimits, _spawnContext?: SpawnContext, _signal?: AbortSignal): Promise<ManagedAgent>;
|
|
76
83
|
getScalerContext(agentId: string): Record<string, unknown> | undefined;
|
|
77
84
|
destroy(managedId: string): Promise<void>;
|
|
78
85
|
/**
|
package/dist/scaler/config.d.ts
CHANGED
|
@@ -9,6 +9,13 @@
|
|
|
9
9
|
*/
|
|
10
10
|
import { z } from 'zod';
|
|
11
11
|
import type { ScalerConfig } from './types.js';
|
|
12
|
+
/**
|
|
13
|
+
* Default cap on concurrent `backend.spawn` operations per backend when a
|
|
14
|
+
* scaler entry does not set `maxConcurrentSpawns`. Bounds the provisioning rate
|
|
15
|
+
* (image pull + create + start) so a burst of queued jobs cannot storm the
|
|
16
|
+
* container socket / registry.
|
|
17
|
+
*/
|
|
18
|
+
export declare const DEFAULT_MAX_CONCURRENT_SPAWNS = 8;
|
|
12
19
|
/**
|
|
13
20
|
* Zod schema for network policy configuration on a label set.
|
|
14
21
|
* Controls RFC1918 and internet access for spawned agents.
|
|
@@ -67,8 +74,8 @@ export declare const labelSetConfigSchema: z.ZodObject<{
|
|
|
67
74
|
containerSocket: z.ZodDefault<z.ZodBoolean>;
|
|
68
75
|
env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
69
76
|
backpressureMode: z.ZodOptional<z.ZodEnum<{
|
|
70
|
-
pause: "pause";
|
|
71
77
|
drop: "drop";
|
|
78
|
+
pause: "pause";
|
|
72
79
|
}>>;
|
|
73
80
|
networkPolicy: z.ZodOptional<z.ZodObject<{
|
|
74
81
|
allowlist: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
@@ -90,6 +97,7 @@ export declare const firecrackerNetworkSchema: z.ZodObject<{
|
|
|
90
97
|
gateway: z.ZodDefault<z.ZodString>;
|
|
91
98
|
netmask: z.ZodDefault<z.ZodString>;
|
|
92
99
|
table: z.ZodDefault<z.ZodString>;
|
|
100
|
+
autoProvisionHost: z.ZodDefault<z.ZodBoolean>;
|
|
93
101
|
}, z.core.$strip>;
|
|
94
102
|
/**
|
|
95
103
|
* Zod schema for the complete scaler configuration file.
|
|
@@ -160,11 +168,12 @@ export declare const scalerFileSchema: z.ZodObject<{
|
|
|
160
168
|
scalers: z.ZodArray<z.ZodObject<{
|
|
161
169
|
name: z.ZodString;
|
|
162
170
|
type: z.ZodEnum<{
|
|
163
|
-
container: "container";
|
|
164
171
|
"bare-metal": "bare-metal";
|
|
172
|
+
container: "container";
|
|
165
173
|
firecracker: "firecracker";
|
|
166
174
|
}>;
|
|
167
175
|
maxAgents: z.ZodNumber;
|
|
176
|
+
maxConcurrentSpawns: z.ZodDefault<z.ZodNumber>;
|
|
168
177
|
labelSets: z.ZodArray<z.ZodObject<{
|
|
169
178
|
labels: z.ZodArray<z.ZodString>;
|
|
170
179
|
image: z.ZodOptional<z.ZodString>;
|
|
@@ -212,8 +221,8 @@ export declare const scalerFileSchema: z.ZodObject<{
|
|
|
212
221
|
containerSocket: z.ZodDefault<z.ZodBoolean>;
|
|
213
222
|
env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
214
223
|
backpressureMode: z.ZodOptional<z.ZodEnum<{
|
|
215
|
-
pause: "pause";
|
|
216
224
|
drop: "drop";
|
|
225
|
+
pause: "pause";
|
|
217
226
|
}>>;
|
|
218
227
|
networkPolicy: z.ZodOptional<z.ZodObject<{
|
|
219
228
|
allowlist: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
@@ -228,9 +237,9 @@ export declare const scalerFileSchema: z.ZodObject<{
|
|
|
228
237
|
host: z.ZodOptional<z.ZodString>;
|
|
229
238
|
socketPath: z.ZodOptional<z.ZodString>;
|
|
230
239
|
runtime: z.ZodDefault<z.ZodEnum<{
|
|
240
|
+
auto: "auto";
|
|
231
241
|
docker: "docker";
|
|
232
242
|
podman: "podman";
|
|
233
|
-
auto: "auto";
|
|
234
243
|
}>>;
|
|
235
244
|
orchestratorUrl: z.ZodOptional<z.ZodString>;
|
|
236
245
|
extraHosts: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
@@ -241,6 +250,17 @@ export declare const scalerFileSchema: z.ZodObject<{
|
|
|
241
250
|
idleTimeoutSeconds: z.ZodDefault<z.ZodNumber>;
|
|
242
251
|
}, z.core.$strip>>;
|
|
243
252
|
mandatoryLabels: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
253
|
+
platform: z.ZodOptional<z.ZodObject<{
|
|
254
|
+
os: z.ZodEnum<{
|
|
255
|
+
linux: "linux";
|
|
256
|
+
macos: "macos";
|
|
257
|
+
windows: "windows";
|
|
258
|
+
}>;
|
|
259
|
+
arch: z.ZodEnum<{
|
|
260
|
+
arm64: "arm64";
|
|
261
|
+
x64: "x64";
|
|
262
|
+
}>;
|
|
263
|
+
}, z.core.$strict>>;
|
|
244
264
|
roles: z.ZodPipe<z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
245
265
|
all: "all";
|
|
246
266
|
builder: "builder";
|
|
@@ -274,6 +294,7 @@ export declare const scalerFileSchema: z.ZodObject<{
|
|
|
274
294
|
gateway: z.ZodDefault<z.ZodString>;
|
|
275
295
|
netmask: z.ZodDefault<z.ZodString>;
|
|
276
296
|
table: z.ZodDefault<z.ZodString>;
|
|
297
|
+
autoProvisionHost: z.ZodDefault<z.ZodBoolean>;
|
|
277
298
|
}, z.core.$strip>>;
|
|
278
299
|
}, z.core.$strip>;
|
|
279
300
|
/**
|
|
@@ -44,6 +44,12 @@ export interface ContainerScalerBackendOptions {
|
|
|
44
44
|
tokenStore?: AgentTokenStore;
|
|
45
45
|
/** TTL for ephemeral agent tokens in ms. Default: 1 hour. */
|
|
46
46
|
tokenTtlMs?: number;
|
|
47
|
+
/**
|
|
48
|
+
* Live resolver for the ephemeral agent-token TTL (ms). When set, called per
|
|
49
|
+
* spawn so the leader can serve the fleet-wide
|
|
50
|
+
* `cluster_settings.agent_token_ttl_ms` override; falls back to `tokenTtlMs`.
|
|
51
|
+
*/
|
|
52
|
+
tokenTtlProvider?: () => Promise<number>;
|
|
47
53
|
/** Agent roles for this scaler. undefined = all, [] = execution only. */
|
|
48
54
|
roles?: string[];
|
|
49
55
|
}
|
|
@@ -67,6 +73,8 @@ export declare class ContainerScalerBackend implements ScalerBackend {
|
|
|
67
73
|
private readonly tokenStore?;
|
|
68
74
|
/** TTL for ephemeral agent tokens in ms */
|
|
69
75
|
private readonly tokenTtlMs;
|
|
76
|
+
/** Live per-spawn resolver for the ephemeral agent-token TTL (ms). */
|
|
77
|
+
private readonly tokenTtlProvider?;
|
|
70
78
|
/** Agent roles for this scaler. undefined = all, [] = execution only. */
|
|
71
79
|
private readonly roles;
|
|
72
80
|
/** ID of the isolated bridge network (set after creation/discovery) */
|
|
@@ -113,7 +121,7 @@ export declare class ContainerScalerBackend implements ScalerBackend {
|
|
|
113
121
|
get logsSource(): string;
|
|
114
122
|
get labelSets(): LabelSetConfig[];
|
|
115
123
|
getActiveCount(): number;
|
|
116
|
-
spawn(labelSet: string[], agentId: string, orchestratorUrl: string, onEvent?: ScalerEventCallback, effectiveLimits?: EffectiveLimits, spawnContext?: SpawnContext): Promise<ManagedAgent>;
|
|
124
|
+
spawn(labelSet: string[], agentId: string, orchestratorUrl: string, onEvent?: ScalerEventCallback, effectiveLimits?: EffectiveLimits, spawnContext?: SpawnContext, signal?: AbortSignal): Promise<ManagedAgent>;
|
|
117
125
|
getScalerContext(agentId: string): Record<string, unknown> | undefined;
|
|
118
126
|
destroy(managedId: string): Promise<void>;
|
|
119
127
|
/**
|
|
@@ -19,7 +19,8 @@
|
|
|
19
19
|
import { type ToolRequirement } from '@kici-dev/shared';
|
|
20
20
|
import type { IpAllocator, IpAllocationResult } from './ip-allocator.js';
|
|
21
21
|
import type { AgentTokenStore } from '../agent/token-store.js';
|
|
22
|
-
import
|
|
22
|
+
import { type FirecrackerBridgeConfig, type BridgeHealth, type ExecOptions } from '../firecracker/host-network.js';
|
|
23
|
+
import type { ScalerBackend, ScalerEntry, ManagedAgent, LabelSetConfig, ScalerEventCallback, ValidationResult, EffectiveLimits, SpawnContext } from './types.js';
|
|
23
24
|
/**
|
|
24
25
|
* Infrastructure interfaces that share the `kici-` prefix but must NEVER be
|
|
25
26
|
* deleted by the orphan sweep. Bridges (kici-br0/kici-br1) carry all VM
|
|
@@ -73,6 +74,12 @@ export interface FirecrackerScalerBackendOptions {
|
|
|
73
74
|
tokenStore?: AgentTokenStore;
|
|
74
75
|
/** TTL for ephemeral agent tokens in ms. Default: 1 hour. */
|
|
75
76
|
tokenTtlMs?: number;
|
|
77
|
+
/**
|
|
78
|
+
* Live resolver for the ephemeral agent-token TTL (ms). When set, called per
|
|
79
|
+
* spawn so the leader can serve the fleet-wide
|
|
80
|
+
* `cluster_settings.agent_token_ttl_ms` override; falls back to `tokenTtlMs`.
|
|
81
|
+
*/
|
|
82
|
+
tokenTtlProvider?: () => Promise<number>;
|
|
76
83
|
/** Agent roles for this scaler. undefined = all, [] = execution only. */
|
|
77
84
|
roles?: string[];
|
|
78
85
|
/**
|
|
@@ -83,6 +90,16 @@ export interface FirecrackerScalerBackendOptions {
|
|
|
83
90
|
* @default false
|
|
84
91
|
*/
|
|
85
92
|
requireSudo?: boolean;
|
|
93
|
+
/**
|
|
94
|
+
* When true, `ensureHostReady()` verifies and provisions this host bridge on
|
|
95
|
+
* startup (self-heal). Threaded from `firecracker.autoProvisionHost`. When
|
|
96
|
+
* false the method is a no-op. @default false (cores pass the real value)
|
|
97
|
+
*/
|
|
98
|
+
autoProvisionHost?: boolean;
|
|
99
|
+
/** Injectable bridge verifier (tests). @default host-network verifyBridge */
|
|
100
|
+
verifyBridgeFn?: (cfg: FirecrackerBridgeConfig, opts: ExecOptions) => Promise<BridgeHealth>;
|
|
101
|
+
/** Injectable bridge provisioner (tests). @default host-network provisionBridge */
|
|
102
|
+
provisionBridgeFn?: (cfg: FirecrackerBridgeConfig, opts: ExecOptions) => Promise<void>;
|
|
86
103
|
}
|
|
87
104
|
export declare class FirecrackerScalerBackend implements ScalerBackend {
|
|
88
105
|
readonly type: "firecracker";
|
|
@@ -109,8 +126,12 @@ export declare class FirecrackerScalerBackend implements ScalerBackend {
|
|
|
109
126
|
private readonly table;
|
|
110
127
|
private readonly tokenStore?;
|
|
111
128
|
private readonly tokenTtlMs;
|
|
129
|
+
private readonly tokenTtlProvider?;
|
|
112
130
|
private readonly roles;
|
|
113
131
|
private readonly requireSudo;
|
|
132
|
+
private readonly autoProvisionHost;
|
|
133
|
+
private readonly verifyBridgeFn;
|
|
134
|
+
private readonly provisionBridgeFn;
|
|
114
135
|
/** Tracks all managed VM agents by ManagedAgent.id */
|
|
115
136
|
private readonly agents;
|
|
116
137
|
/** Periodic orphan sweep timer (null when stopped). */
|
|
@@ -124,7 +145,7 @@ export declare class FirecrackerScalerBackend implements ScalerBackend {
|
|
|
124
145
|
static getRequiredTools(entry: ScalerEntry): ToolRequirement[];
|
|
125
146
|
get labelSets(): LabelSetConfig[];
|
|
126
147
|
getActiveCount(): number;
|
|
127
|
-
spawn(labelSet: string[], agentId: string, orchestratorUrl: string, onEvent?: ScalerEventCallback, effectiveLimits?: EffectiveLimits): Promise<ManagedAgent>;
|
|
148
|
+
spawn(labelSet: string[], agentId: string, orchestratorUrl: string, onEvent?: ScalerEventCallback, effectiveLimits?: EffectiveLimits, _spawnContext?: SpawnContext, _signal?: AbortSignal): Promise<ManagedAgent>;
|
|
128
149
|
getScalerContext(agentId: string): Record<string, unknown> | undefined;
|
|
129
150
|
/**
|
|
130
151
|
* Bridge config for host-network diagnostics (read-only snapshot).
|
|
@@ -138,6 +159,12 @@ export declare class FirecrackerScalerBackend implements ScalerBackend {
|
|
|
138
159
|
bridgeCidr: string;
|
|
139
160
|
table: string;
|
|
140
161
|
};
|
|
162
|
+
/**
|
|
163
|
+
* Verify and (if needed) provision this backend's host bridge on startup.
|
|
164
|
+
* No-op unless autoProvisionHost is set. Throws on a real provision failure;
|
|
165
|
+
* ScalerManager.ensureHostsReady catches per-backend and degrades this scaler.
|
|
166
|
+
*/
|
|
167
|
+
ensureHostReady(): Promise<void>;
|
|
141
168
|
destroy(managedId: string): Promise<void>;
|
|
142
169
|
shutdownAll(): Promise<void>;
|
|
143
170
|
/**
|
package/dist/scaler/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Supports Docker, bare-metal, and Firecracker backends with YAML configuration,
|
|
6
6
|
* label-set matching, and warm pool management.
|
|
7
7
|
*/
|
|
8
|
-
export type { ResourceLimits, LabelSetConfig, ManagedAgent, ScaleResult, ValidationResult, ScalerBackend, ScalerConfig, ScalerEntry, ScalerEvent, WarmPoolConfig, FirecrackerNetworkConfig, } from './types.js';
|
|
8
|
+
export type { ResourceLimits, LabelSetConfig, ManagedAgent, ScaleResult, ValidationResult, ScalerBackend, ScalerConfig, ScalerEntry, ScalerEvent, ScalerRedispatchTrigger, WarmPoolConfig, FirecrackerNetworkConfig, } from './types.js';
|
|
9
9
|
export { loadScalerConfig, scalerFileSchema, firecrackerNetworkSchema, parseMemoryString, } from './config.js';
|
|
10
10
|
export { normalizeLabelSet, labelSetsMatch, detectLabelSetOverlaps, findBackendForLabels, } from './label-matcher.js';
|
|
11
11
|
export { ContainerScalerBackend, detectRuntime } from './container-backend.js';
|