@kici-dev/orchestrator 0.17.0 → 0.18.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/agent/agent-version.d.ts +12 -21
- package/dist/agent/dispatcher.d.ts +283 -437
- package/dist/agent/host-roster-reaper.d.ts +8 -10
- package/dist/agent/host-roster.d.ts +77 -100
- package/dist/agent/ownership-refusal.d.ts +3 -5
- package/dist/agent/ownership-tracker.d.ts +42 -76
- package/dist/agent/registry.d.ts +121 -233
- package/dist/agent/token-store.d.ts +34 -77
- package/dist/agent-packaging/availability.d.ts +6 -9
- package/dist/agent-packaging/download.d.ts +6 -9
- package/dist/agent-packaging/install-closure.d.ts +9 -12
- package/dist/agent-packaging/node-binary.d.ts +6 -10
- package/dist/agent-packaging/node-runtime-members.d.ts +3 -5
- package/dist/agent-packaging/refresh.d.ts +12 -16
- package/dist/agent-packaging/store.d.ts +5 -6
- package/dist/agent-packaging/upload.d.ts +3 -4
- package/dist/app.d.ts +0 -3
- package/dist/approvals/apply-decision.d.ts +35 -52
- package/dist/approvals/approval-resolver.d.ts +11 -23
- package/dist/approvals/held-run-release-wiring.d.ts +14 -21
- package/dist/approvals/independent-wiring.d.ts +13 -20
- package/dist/approvals/resume-router.d.ts +1 -1
- package/dist/approvals/step-approval-bridge.d.ts +11 -21
- package/dist/approvals/triggerer-subject.d.ts +8 -10
- package/dist/artifacts/artifact-store.d.ts +55 -95
- package/dist/artifacts/failure-messages.d.ts +15 -20
- package/dist/audit/access-log.d.ts +27 -45
- package/dist/audit/sampling-rate-limiter.d.ts +11 -23
- package/dist/cache/agent-job-failed-error.d.ts +2 -3
- package/dist/cache/build-coordinator.d.ts +5 -28
- package/dist/cache/cache-upload-settle.d.ts +11 -11
- package/dist/cache/dep-cache.d.ts +32 -60
- package/dist/cache/dispatch-cache-ref-tracker.d.ts +15 -23
- package/dist/cache/global-eval-round-cache.d.ts +33 -41
- package/dist/cache/pending-builds.d.ts +2 -6
- package/dist/cache/pending-dynamics.d.ts +2 -7
- package/dist/cache/pending-global-evals.d.ts +9 -12
- package/dist/cache/pending-inits.d.ts +11 -22
- package/dist/cache/pending-precursor-db-watcher.d.ts +24 -32
- package/dist/cache/pending-tracker.d.ts +17 -45
- package/dist/cache/precursor-result.d.ts +17 -30
- package/dist/cache/source-cache.d.ts +36 -65
- package/dist/cache/user-cache.d.ts +21 -25
- package/dist/cancel/cancel-held-run.d.ts +13 -16
- package/dist/cancel/cancel-route-answer.d.ts +1 -2
- package/dist/cancel/cancel-run.d.ts +26 -50
- package/dist/cancel/dashboard-cancel-handler.d.ts +2 -2
- package/dist/cancel/peer-job-cancel.d.ts +11 -14
- package/dist/cancel/sweep-stuck-cancelling.d.ts +9 -13
- package/dist/cli/api-client.d.ts +25 -76
- package/dist/cli/commands/access-log.d.ts +4 -24
- package/dist/cli/commands/agent-package.d.ts +7 -15
- package/dist/cli/commands/agent-service/agent-env.d.ts +3 -6
- package/dist/cli/commands/agent-service/index.d.ts +4 -10
- package/dist/cli/commands/agent-service/install.d.ts +4 -11
- package/dist/cli/commands/agent-service/status.d.ts +4 -9
- package/dist/cli/commands/agent-service/upgrade.d.ts +4 -16
- package/dist/cli/commands/agent.d.ts +12 -25
- package/dist/cli/commands/api-key.d.ts +5 -12
- package/dist/cli/commands/attestations-list.d.ts +7 -17
- package/dist/cli/commands/attestations-retry.d.ts +5 -11
- package/dist/cli/commands/attestations-reverify.d.ts +4 -5
- package/dist/cli/commands/attestations.d.ts +3 -8
- package/dist/cli/commands/audit.d.ts +1 -5
- package/dist/cli/commands/backend.d.ts +2 -11
- package/dist/cli/commands/check-run.d.ts +7 -18
- package/dist/cli/commands/cluster-name.d.ts +5 -12
- package/dist/cli/commands/cluster-settings.d.ts +28 -53
- package/dist/cli/commands/cold-store.d.ts +7 -15
- package/dist/cli/commands/config.d.ts +9 -20
- package/dist/cli/commands/context.d.ts +8 -20
- package/dist/cli/commands/dashboard-encryption-key.d.ts +9 -14
- package/dist/cli/commands/db-backup.d.ts +17 -32
- package/dist/cli/commands/db.d.ts +3 -4
- package/dist/cli/commands/debug-bundle.d.ts +3 -10
- package/dist/cli/commands/diagnose.d.ts +3 -14
- package/dist/cli/commands/event-dlq.d.ts +4 -12
- package/dist/cli/commands/event-log.d.ts +2 -20
- package/dist/cli/commands/execution.d.ts +3 -9
- package/dist/cli/commands/firecracker/index.d.ts +3 -6
- package/dist/cli/commands/held-run.d.ts +23 -37
- package/dist/cli/commands/host.d.ts +4 -11
- package/dist/cli/commands/inspect-bundle.d.ts +3 -11
- package/dist/cli/commands/local-hook.d.ts +2 -10
- package/dist/cli/commands/local-trigger.d.ts +2 -2
- package/dist/cli/commands/orchestrator-service/drain.d.ts +3 -6
- package/dist/cli/commands/orchestrator-service/index.d.ts +6 -14
- package/dist/cli/commands/orchestrator-service/install-env.d.ts +25 -49
- package/dist/cli/commands/orchestrator-service/install.d.ts +2 -5
- package/dist/cli/commands/orchestrator-service/status.d.ts +10 -22
- package/dist/cli/commands/orchestrator-service/upgrade.d.ts +6 -15
- package/dist/cli/commands/org-settings.d.ts +5 -11
- package/dist/cli/commands/peer.d.ts +5 -10
- package/dist/cli/commands/queue.d.ts +3 -9
- package/dist/cli/commands/registration.d.ts +4 -8
- package/dist/cli/commands/remote-source.d.ts +6 -12
- package/dist/cli/commands/rotate.d.ts +1 -5
- package/dist/cli/commands/runs.d.ts +1 -30
- package/dist/cli/commands/scaler.d.ts +5 -12
- package/dist/cli/commands/secret.d.ts +1 -9
- package/dist/cli/commands/service-health.d.ts +5 -10
- package/dist/cli/commands/shared/admin-cli-access-log.d.ts +10 -19
- package/dist/cli/commands/shared/bare-metal-binary-check.d.ts +86 -0
- package/dist/cli/commands/shared/cli-action.d.ts +1 -4
- package/dist/cli/commands/shared/confirm.d.ts +5 -10
- package/dist/cli/commands/shared/db.d.ts +1 -12
- package/dist/cli/commands/shared/env-file-mode.d.ts +6 -9
- package/dist/cli/commands/shared/secret-input.d.ts +7 -21
- package/dist/cli/commands/shared/service-verbs.d.ts +6 -12
- package/dist/cli/commands/shared/unbound-context-warning.d.ts +2 -4
- package/dist/cli/commands/shared/upgrade-hooks.d.ts +7 -16
- package/dist/cli/commands/shared/upgrade-safety.d.ts +20 -31
- package/dist/cli/commands/shared/versioned-upgrade.d.ts +83 -161
- package/dist/cli/commands/signing-key.d.ts +4 -9
- package/dist/cli/commands/source-manifest.d.ts +11 -14
- package/dist/cli/commands/source.d.ts +7 -32
- package/dist/cli/commands/token.d.ts +4 -15
- package/dist/cli/commands/trust-policy.d.ts +35 -88
- package/dist/cli/commands/variable.d.ts +3 -5
- package/dist/cli/commands/workflow.d.ts +3 -24
- package/dist/cli/join.d.ts +3 -6
- package/dist/cli/kici-admin.d.ts +11 -29
- package/dist/cli/lazy-deps/cache.d.ts +1 -14
- package/dist/cli/lazy-deps/downloader.d.ts +4 -27
- package/dist/cli/lazy-deps/registry.d.ts +5 -25
- package/dist/cli/local-github-ingress-url.d.ts +5 -7
- package/dist/cli/loopback-callback.d.ts +6 -7
- package/dist/cli/open-browser.d.ts +4 -8
- package/dist/cli/root-option-routing.d.ts +17 -29
- package/dist/cli/service/backup-timer.d.ts +16 -39
- package/dist/cli/service/compose-path.d.ts +3 -7
- package/dist/cli/service/compose.d.ts +12 -30
- package/dist/cli/service/deploy-env.d.ts +6 -18
- package/dist/cli/service/entrypoint.d.ts +14 -25
- package/dist/cli/service/env-assignment.d.ts +6 -17
- package/dist/cli/service/image-digests.d.ts +6 -15
- package/dist/cli/service/index.d.ts +2 -18
- package/dist/cli/service/instance/index-file.d.ts +9 -16
- package/dist/cli/service/instance/manifest.d.ts +33 -59
- package/dist/cli/service/instance/resolve.d.ts +32 -68
- package/dist/cli/service/instance/types.d.ts +12 -29
- package/dist/cli/service/launchd.d.ts +29 -60
- package/dist/cli/service/platform-detect.d.ts +13 -68
- package/dist/cli/service/privilege.d.ts +12 -25
- package/dist/cli/service/shutdown-grace.d.ts +11 -20
- package/dist/cli/service/systemd.d.ts +7 -20
- package/dist/cli/service/types.d.ts +63 -114
- package/dist/cli/service/windows-acl.d.ts +14 -21
- package/dist/cli/service/windows-env-file.d.ts +10 -28
- package/dist/cli/service/windows.d.ts +15 -31
- package/dist/cli/webhook-url-notes.d.ts +4 -6
- package/dist/cli/wizard/agent-wizard.d.ts +3 -14
- package/dist/cli/wizard/orchestrator-wizard.d.ts +12 -37
- package/dist/cli/wizard/prompts.d.ts +6 -16
- package/dist/cli.js +4568 -6571
- package/dist/cluster/cluster-identity.d.ts +20 -32
- package/dist/cluster/cluster-settings-reader.d.ts +50 -77
- package/dist/cluster/coordinator-credential.d.ts +4 -5
- package/dist/cluster/coordinator.d.ts +76 -148
- package/dist/cluster/health-api.d.ts +2 -10
- package/dist/cluster/index.d.ts +1 -6
- package/dist/cluster/instance-heartbeat.d.ts +26 -42
- package/dist/cluster/join-client.d.ts +4 -7
- package/dist/cluster/join-handler.d.ts +3 -7
- package/dist/cluster/join-token.d.ts +13 -27
- package/dist/cluster/leader-gated-scheduler.d.ts +8 -17
- package/dist/cluster/orphan-recovery.d.ts +13 -35
- package/dist/cluster/peer-auth-coordinator.d.ts +2 -8
- package/dist/cluster/peer-client.d.ts +46 -76
- package/dist/cluster/peer-credentials.d.ts +24 -70
- package/dist/cluster/peer-crypto.d.ts +5 -26
- package/dist/cluster/peer-forget.d.ts +3 -3
- package/dist/cluster/peer-handler.d.ts +47 -71
- package/dist/cluster/peer-registry.d.ts +37 -106
- package/dist/cluster/plan-headroom-store.d.ts +4 -6
- package/dist/cluster/raft-state.d.ts +4 -13
- package/dist/cluster/raft.d.ts +18 -53
- package/dist/cluster/reconcile-identity.d.ts +8 -11
- package/dist/cluster/rerouted-job-guard.d.ts +7 -11
- package/dist/cluster/verified-issuer.d.ts +2 -3
- package/dist/cluster/worker-cluster-settings.d.ts +7 -10
- package/dist/cluster/worker-eviction.d.ts +16 -26
- package/dist/cold-store/load-access-log-range.d.ts +15 -31
- package/dist/cold-store/load-event-log-range.d.ts +13 -27
- package/dist/cold-store/load-secret-audit-log-range.d.ts +8 -12
- package/dist/cold-store/orchestrator-cold-store.d.ts +8 -28
- package/dist/cold-store/tables/access-log.d.ts +12 -14
- package/dist/cold-store/tables/event-log.d.ts +4 -8
- package/dist/cold-store/tables/execution-runs.d.ts +6 -11
- package/dist/cold-store/tables/secret-audit-log.d.ts +5 -12
- package/dist/concurrency/dispatch-next-queued.d.ts +13 -25
- package/dist/concurrency/queue-manager.d.ts +22 -54
- package/dist/concurrency/waiters.d.ts +15 -31
- package/dist/config/encryption.d.ts +0 -2
- package/dist/config/loader.d.ts +0 -1
- package/dist/config/reload.d.ts +0 -6
- package/dist/config/resolver.d.ts +0 -4
- package/dist/config/shared-store.d.ts +0 -2
- package/dist/config/types.d.ts +0 -3
- package/dist/content-requirements-cache.d.ts +0 -1
- package/dist/contexts/context-store.d.ts +0 -2
- package/dist/contexts/held-runs.d.ts +0 -2
- package/dist/contexts/variable-store.d.ts +0 -2
- package/dist/dashboard/attestation-filters.d.ts +13 -18
- package/dist/dashboard/handler.d.ts +143 -307
- package/dist/db/client.d.ts +2 -6
- package/dist/db/deferred-index-build.d.ts +8 -10
- package/dist/db/deferred-indexes.d.ts +15 -22
- package/dist/db/migration-provider.d.ts +2 -4
- package/dist/db/migration-test-harness.d.ts +26 -44
- package/dist/db/migrations/001_initial.d.ts +1 -4
- package/dist/db/migrations/002_config_versions_key_version.d.ts +5 -8
- package/dist/db/migrations/003_access_log.d.ts +10 -15
- package/dist/db/migrations/004_rename_bundle_to_source.d.ts +7 -9
- package/dist/db/migrations/005_cold_store_chunk_counter.d.ts +4 -10
- package/dist/db/migrations/006_runs_jobs_steps_archived_at.d.ts +9 -29
- package/dist/db/migrations/007_audit_logs_archived_at.d.ts +11 -30
- package/dist/db/migrations/008_event_log_archived_at.d.ts +14 -29
- package/dist/db/migrations/009_access_log_trigram.d.ts +4 -8
- package/dist/db/migrations/010_cold_store_chunks.d.ts +16 -26
- package/dist/db/migrations/011_drop_source_secrets_notify.d.ts +6 -14
- package/dist/db/migrations/012_peer_credentials_active_uniq.d.ts +9 -14
- package/dist/db/migrations/013_execution_log_bytes.d.ts +5 -13
- package/dist/db/migrations/014_kici_events_lease_retry.d.ts +14 -27
- package/dist/db/migrations/015_org_settings_customer_scoped.d.ts +12 -17
- package/dist/db/migrations/016_org_settings_allow_http_npm.d.ts +4 -6
- package/dist/db/migrations/019_generic_sources_change_notify.d.ts +13 -17
- package/dist/db/migrations/020_org_settings_dashboard_write_policy.d.ts +5 -8
- package/dist/db/migrations/021_check_run_tracking.d.ts +5 -17
- package/dist/db/migrations/022_scaler_manager_state.d.ts +10 -20
- package/dist/db/migrations/023_dispatch_queue_recovery_deadline.d.ts +7 -18
- package/dist/db/migrations/024_dispatch_queue_provisioning_error.d.ts +5 -11
- package/dist/db/migrations/025_init_failure.d.ts +5 -9
- package/dist/db/migrations/027_workflow_timeout.d.ts +5 -13
- package/dist/db/migrations/029_dispatch_queue_attempts.d.ts +4 -10
- package/dist/db/migrations/030_held_runs_env_set_null.d.ts +5 -6
- package/dist/db/migrations/031_dispatch_queue_ack_deadline.d.ts +6 -12
- package/dist/db/migrations/033_org_settings_approval.d.ts +7 -10
- package/dist/db/migrations/034_held_runs_generalize.d.ts +10 -18
- package/dist/db/migrations/035_pending_workflow_contexts.d.ts +4 -5
- package/dist/db/migrations/037_generic_sources_provider_type_local.d.ts +5 -6
- package/dist/db/migrations/038_remote_sources.d.ts +5 -7
- package/dist/db/migrations/045_host_properties.d.ts +5 -9
- package/dist/db/migrations/046_join_token_consumed_by_instance.d.ts +5 -10
- package/dist/db/migrations/048_host_reboot_pending.d.ts +6 -12
- package/dist/db/migrations/049_held_runs_payload.d.ts +3 -8
- package/dist/db/migrations/050_sources_slug.d.ts +4 -5
- package/dist/db/migrations/051_binding_host_pattern.d.ts +7 -10
- package/dist/db/migrations/052_host_reach_metadata.d.ts +8 -11
- package/dist/db/migrations/053_agent_token_single_use.d.ts +6 -10
- package/dist/db/migrations/054_local_working_tree.d.ts +4 -6
- package/dist/db/migrations/055_agent_token_mandatory_labels.d.ts +6 -11
- package/dist/db/migrations/056_execution_jobs_environments.d.ts +4 -11
- package/dist/db/migrations/064_execution_jobs_skipped_environments.d.ts +6 -9
- package/dist/db/migrations/065_pending_attestations.d.ts +9 -12
- package/dist/db/migrations/066_pending_attestations_rejected.d.ts +4 -7
- package/dist/db/migrations/068_request_idempotency.d.ts +7 -9
- package/dist/db/migrations/069_reroute_tunables.d.ts +6 -14
- package/dist/db/migrations/071_batch_accumulation.d.ts +8 -16
- package/dist/db/migrations/072_dispatch_queue_run_id_index.d.ts +3 -9
- package/dist/db/migrations/074_normalize_zero_concurrency_limit.d.ts +4 -7
- package/dist/db/migrations/076_artifacts.d.ts +7 -8
- package/dist/db/migrations/078_org_settings_backup_staleness.d.ts +3 -6
- package/dist/db/migrations/079_org_settings_scaler_spawn_timeout.d.ts +4 -8
- package/dist/db/migrations/080_cluster_settings.d.ts +6 -10
- package/dist/db/migrations/081_org_settings_queue_timeout.d.ts +7 -11
- package/dist/db/migrations/082_host_s3_reachable.d.ts +5 -10
- package/dist/db/migrations/083_org_settings_artifact_caps.d.ts +6 -8
- package/dist/db/migrations/084_orchestrator_signing_keys.d.ts +8 -13
- package/dist/db/migrations/085_cluster_settings_reroute_flap_grace_ms.d.ts +4 -5
- package/dist/db/migrations/086_cluster_settings_max_fanout_hosts.d.ts +3 -3
- package/dist/db/migrations/087_cluster_settings_event_router_rate_limit.d.ts +5 -3
- package/dist/db/migrations/088_cluster_settings_cache_max_tarball_bytes.d.ts +3 -3
- package/dist/db/migrations/089_cluster_settings_cache_ttl_days.d.ts +3 -5
- package/dist/db/migrations/090_cluster_settings_concurrency_wait_timeout_ms.d.ts +3 -6
- package/dist/db/migrations/091_cluster_settings_agent_token_ttl_ms.d.ts +3 -6
- package/dist/db/migrations/092_cluster_settings_version.d.ts +5 -9
- package/dist/db/migrations/094_dashboard_encryption_keys.d.ts +9 -14
- package/dist/db/migrations/095_dashboard_write_policy_tristate.d.ts +2 -6
- package/dist/db/migrations/099_cluster_settings_dashboard_verified_issuer.d.ts +8 -11
- package/dist/db/migrations/101_contexts_hold_expiry_drop_default.d.ts +9 -15
- package/dist/db/migrations/102_dispatch_queue_agent_id.d.ts +6 -11
- package/dist/db/migrations/103_cluster_settings_ownership_db_check_timeout_ms.d.ts +6 -12
- package/dist/db/migrations/104_check_run_terminal_sent.d.ts +8 -14
- package/dist/db/migrations/105_org_trust_policy.d.ts +5 -7
- package/dist/db/migrations/106_cluster_settings_check_run_tracking_ttl_days.d.ts +4 -12
- package/dist/db/migrations/107_check_run_tracking_updated_at_index.d.ts +8 -14
- package/dist/db/migrations/113_execution_runs_workflow_repo_index.d.ts +10 -19
- package/dist/db/migrations/115_global_workflows_cluster_switch.d.ts +2 -3
- package/dist/db/migrations/121_org_settings_allow_untrusted_dockerfile_builds.d.ts +7 -8
- package/dist/db/migrations/122_host_roster_scaler_managed.d.ts +9 -16
- package/dist/db/migrations/123_workflow_registrations_default_branch.d.ts +8 -16
- package/dist/db/migrations/125_org_trust_directory.d.ts +13 -21
- package/dist/db/migrations/126_held_runs_posted_pending_check.d.ts +10 -16
- package/dist/db/migrations/127_org_trust_policy_approval_expiry_seconds.d.ts +8 -16
- package/dist/db/migrations/128_execution_runs_global_eval_round.d.ts +6 -11
- package/dist/db/migrations/129_execution_runs_dispatch_routing_key.d.ts +8 -11
- package/dist/db/migrations/130_scaler_provision_outcomes.d.ts +13 -20
- package/dist/db/migrations/131_execution_jobs_git_credentials.d.ts +12 -22
- package/dist/db/migrations/132_execution_runs_trigger_event.d.ts +6 -16
- package/dist/db/migrations/133_dispatch_queue_source_tar_digest.d.ts +6 -9
- package/dist/db/migrations/140_dispatch_queue_canonical_labels.d.ts +22 -40
- package/dist/db/migrations/143_execution_jobs_precursor_result.d.ts +9 -18
- package/dist/db/migrations/144_execution_runs_registration_window.d.ts +12 -20
- package/dist/db/migrations/147_sealed_job_secrets.d.ts +5 -9
- package/dist/db/migrations/148_cluster_settings_sealed_secrets_retry_backoff_ms.d.ts +7 -13
- package/dist/db/migrations/150_execution_runs_status_epoch.d.ts +6 -11
- package/dist/db/migrations/152_org_settings_cache_upload_settle_timeout.d.ts +5 -8
- package/dist/db/migrations/157_host_roster_identity_source.d.ts +9 -13
- package/dist/db/migrations/159_org_id_widen_to_source_width.d.ts +5 -0
- package/dist/db/migrator.d.ts +17 -25
- package/dist/db/notify-listener.d.ts +8 -11
- package/dist/db/repos/dashboard-encryption-keys-repo.d.ts +9 -10
- package/dist/db/synthetic-job-ids.d.ts +6 -8
- package/dist/db/types.d.ts +531 -1058
- package/dist/deployment/deployment-identity.d.ts +42 -60
- package/dist/diagnostics/bundle-reader.d.ts +3 -15
- package/dist/diagnostics/bundle-writer.d.ts +5 -12
- package/dist/diagnostics/checks/agents.d.ts +1 -7
- package/dist/diagnostics/checks/backup.d.ts +7 -10
- package/dist/diagnostics/checks/certs.d.ts +1 -6
- package/dist/diagnostics/checks/config.d.ts +2 -5
- package/dist/diagnostics/checks/db.d.ts +1 -1
- package/dist/diagnostics/checks/disk.d.ts +1 -6
- package/dist/diagnostics/checks/firecracker-network.d.ts +3 -3
- package/dist/diagnostics/checks/index.d.ts +0 -6
- package/dist/diagnostics/checks/retention.d.ts +3 -6
- package/dist/diagnostics/checks/scaler.d.ts +3 -7
- package/dist/diagnostics/checks/ws.d.ts +1 -6
- package/dist/diagnostics/fleet-collector.d.ts +11 -14
- package/dist/diagnostics/fleet-constants.d.ts +1 -3
- package/dist/diagnostics/fleet-selection.d.ts +3 -7
- package/dist/diagnostics/fleet-topology.d.ts +2 -6
- package/dist/diagnostics/fleet-wiring.d.ts +6 -12
- package/dist/diagnostics/index.d.ts +0 -5
- package/dist/diagnostics/runner.d.ts +4 -8
- package/dist/diagnostics/types.d.ts +10 -21
- package/dist/drain/drain-controller.d.ts +16 -22
- package/dist/entry-helpers.d.ts +0 -2
- package/dist/events/circuit-breaker.d.ts +0 -3
- package/dist/events/event-router.d.ts +1 -2
- package/dist/events/event-store.d.ts +0 -9
- package/dist/events/trust-store.d.ts +0 -3
- package/dist/events/types.d.ts +0 -9
- package/dist/firecracker/host-network.d.ts +24 -30
- package/dist/firecracker/net-interfaces.d.ts +4 -7
- package/dist/helpers/rate-limiter.d.ts +0 -1
- package/dist/index.js +240 -482
- package/dist/metrics/agent-metrics-aggregator.d.ts +24 -67
- package/dist/metrics/metrics-reporter.d.ts +4 -13
- package/dist/metrics/prometheus.d.ts +47 -81
- package/dist/orchestrator-core.d.ts +3 -7
- package/dist/pipeline/content-filter.d.ts +20 -30
- package/dist/pipeline/cross-source-tally.d.ts +7 -8
- package/dist/pipeline/decorating-secret-resolver.d.ts +4 -8
- package/dist/pipeline/degraded-reason.d.ts +3 -4
- package/dist/pipeline/direct-ingress-deps.d.ts +15 -24
- package/dist/pipeline/dispatch-matched-workflow.d.ts +289 -525
- package/dist/pipeline/flatten-lock-steps.d.ts +4 -6
- package/dist/pipeline/global-dispatch-identity.d.ts +5 -10
- package/dist/pipeline/global-eval-round.d.ts +65 -151
- package/dist/pipeline/global-round-hold.d.ts +5 -7
- package/dist/pipeline/held-context-data.d.ts +5 -8
- package/dist/pipeline/held-round-registrations.d.ts +8 -11
- package/dist/pipeline/install-gate.d.ts +15 -25
- package/dist/pipeline/install-secrets-resolver.d.ts +24 -34
- package/dist/pipeline/internal-event-pipeline.d.ts +45 -62
- package/dist/pipeline/invoke-gate.d.ts +27 -40
- package/dist/pipeline/job-contexts.d.ts +19 -36
- package/dist/pipeline/manual-schedule.d.ts +7 -13
- package/dist/pipeline/needs-scheduler.d.ts +29 -46
- package/dist/pipeline/pending-workflow-context.d.ts +14 -28
- package/dist/pipeline/process-webhook.d.ts +88 -123
- package/dist/pipeline/processor.d.ts +209 -355
- package/dist/pipeline/remote-source-store.d.ts +5 -8
- package/dist/pipeline/request-idempotency.d.ts +10 -13
- package/dist/pipeline/rerun-global.d.ts +6 -7
- package/dist/pipeline/rerun-inputs.d.ts +23 -37
- package/dist/pipeline/rerun.d.ts +34 -57
- package/dist/pipeline/resolve-sandbox-grant.d.ts +5 -10
- package/dist/pipeline/resume-workflow.d.ts +28 -34
- package/dist/pipeline/route-or-dispatch-jobs.d.ts +19 -30
- package/dist/pipeline/run-event-context.d.ts +16 -21
- package/dist/pipeline/sandbox-allowlist-reader.d.ts +7 -11
- package/dist/pipeline/security-hold-check.d.ts +56 -80
- package/dist/pipeline/test-pipeline.d.ts +20 -46
- package/dist/pipeline/unbound-job-context.d.ts +6 -9
- package/dist/pipeline/undispatched-hold-checks.d.ts +4 -6
- package/dist/pipeline/wave-scheduler.d.ts +15 -22
- package/dist/pipeline/webhook-payload-store.d.ts +3 -10
- package/dist/pipeline/workflow-lock-at-sha.d.ts +14 -20
- package/dist/policy/dashboard-write-policy.d.ts +1 -1
- package/dist/provider-registry.d.ts +0 -19
- package/dist/providers/generic/index.d.ts +0 -2
- package/dist/providers/generic/normalizer.d.ts +0 -1
- package/dist/providers/generic/verification.d.ts +0 -8
- package/dist/providers/github/auth.d.ts +0 -1
- package/dist/providers/github/changed-files.d.ts +2 -1
- package/dist/providers/github/file-contents.d.ts +0 -4
- package/dist/providers/github/lock-file.d.ts +0 -4
- package/dist/providers/github/normalizer.d.ts +1 -9
- package/dist/providers/local/index.d.ts +1 -2
- package/dist/providers/local/lock-file-fetcher.d.ts +0 -4
- package/dist/providers/local/normalizer.d.ts +0 -10
- package/dist/providers/local/repo-url-builder.d.ts +0 -2
- package/dist/providers/universal-git/clone-token.d.ts +0 -2
- package/dist/providers/universal-git/lock-file.d.ts +0 -2
- package/dist/providers/universal-git/normalizer.d.ts +0 -2
- package/dist/queue/bootstrap.d.ts +3 -15
- package/dist/queue/cleanup.d.ts +29 -50
- package/dist/queue/depth-refresher.d.ts +21 -39
- package/dist/queue/job-queue.d.ts +112 -163
- package/dist/queue/retention.d.ts +23 -36
- package/dist/queue/scheduled-job.d.ts +17 -39
- package/dist/queue/terminalize-unroutable.d.ts +16 -18
- package/dist/queue/unroutable-probe.d.ts +15 -22
- package/dist/registration/extractor.d.ts +0 -6
- package/dist/registration/registration-index.d.ts +0 -6
- package/dist/registration/registration-store.d.ts +0 -9
- package/dist/reporting/agent-failure-category.d.ts +3 -5
- package/dist/reporting/check-run-reporter.d.ts +142 -316
- package/dist/reporting/check-run-summary.d.ts +16 -35
- package/dist/reporting/check-run-tracking-store.d.ts +54 -107
- package/dist/reporting/execution-tracker.d.ts +356 -526
- package/dist/reporting/fs-log-storage.d.ts +31 -33
- package/dist/reporting/job-check-run-completion.d.ts +14 -22
- package/dist/reporting/log-chunk-sink.d.ts +11 -16
- package/dist/reporting/log-pull-handler.d.ts +4 -13
- package/dist/reporting/log-retention.d.ts +3 -4
- package/dist/reporting/log-storage.d.ts +24 -52
- package/dist/reporting/log-writer.d.ts +28 -56
- package/dist/reporting/peer-log-normalize.d.ts +4 -8
- package/dist/reporting/run-aggregator.d.ts +6 -11
- package/dist/reporting/run-summary-fields.d.ts +5 -8
- package/dist/reporting/s3-log-storage.d.ts +31 -50
- package/dist/reporting/step-display-order.d.ts +11 -21
- package/dist/reporting/step-log-buffer.d.ts +7 -28
- package/dist/reporting/step-log-reader.d.ts +11 -19
- package/dist/routes/admin-access-log.d.ts +4 -6
- package/dist/routes/admin-auth.d.ts +17 -38
- package/dist/routes/admin-backends.d.ts +3 -14
- package/dist/routes/admin-cluster-name.d.ts +13 -21
- package/dist/routes/admin-cluster-settings.d.ts +6 -9
- package/dist/routes/admin-config.d.ts +7 -19
- package/dist/routes/admin-contexts.d.ts +6 -13
- package/dist/routes/admin-db.d.ts +5 -10
- package/dist/routes/admin-event-dlq.d.ts +3 -5
- package/dist/routes/admin-event-inspect.d.ts +3 -4
- package/dist/routes/admin-event-log.d.ts +3 -7
- package/dist/routes/admin-events.d.ts +16 -30
- package/dist/routes/admin-held-runs.d.ts +52 -76
- package/dist/routes/admin-maintenance.d.ts +3 -6
- package/dist/routes/admin-orchestrator-drain.d.ts +0 -2
- package/dist/routes/admin-org-settings.d.ts +8 -14
- package/dist/routes/admin-peer-forget.d.ts +0 -1
- package/dist/routes/admin-queue-execution.d.ts +3 -3
- package/dist/routes/admin-registrations.d.ts +3 -12
- package/dist/routes/admin-runs.d.ts +16 -29
- package/dist/routes/admin-scaler-orphans.d.ts +4 -4
- package/dist/routes/admin-scaler-reload.d.ts +5 -8
- package/dist/routes/admin-scheduled-jobs.d.ts +3 -4
- package/dist/routes/admin-sources.d.ts +20 -29
- package/dist/routes/admin-trust-policy.d.ts +31 -48
- package/dist/routes/admin.d.ts +67 -94
- package/dist/routes/caller-identity.d.ts +5 -12
- package/dist/routes/capabilities.d.ts +8 -13
- package/dist/routes/diagnostics.d.ts +2 -10
- package/dist/routes/fleet.d.ts +1 -2
- package/dist/routes/github-webhook.d.ts +2 -5
- package/dist/routes/health.d.ts +6 -19
- package/dist/routes/provenance-oidc.d.ts +3 -3
- package/dist/routes/uploads.d.ts +5 -11
- package/dist/routes/webhooks.d.ts +2 -24
- package/dist/scaler/agent-binary-location.d.ts +77 -0
- package/dist/scaler/agent-fit.d.ts +2 -2
- package/dist/scaler/backend-factory.d.ts +10 -18
- package/dist/scaler/bare-metal-backend.d.ts +28 -45
- package/dist/scaler/claim-store.d.ts +20 -43
- package/dist/scaler/config.d.ts +10 -37
- package/dist/scaler/container-backend.d.ts +22 -35
- package/dist/scaler/container-hostconfig.d.ts +10 -16
- package/dist/scaler/container-routing.d.ts +10 -13
- package/dist/scaler/disk-guard.d.ts +2 -3
- package/dist/scaler/event-backend.d.ts +33 -58
- package/dist/scaler/event-provision-reaper.d.ts +61 -84
- package/dist/scaler/failure-tracker.d.ts +6 -13
- package/dist/scaler/file-tail.d.ts +6 -19
- package/dist/scaler/firecracker-api.d.ts +19 -63
- package/dist/scaler/firecracker-backend.d.ts +142 -258
- package/dist/scaler/host-access.d.ts +7 -10
- package/dist/scaler/index.d.ts +3 -6
- package/dist/scaler/ip-allocator.d.ts +30 -82
- package/dist/scaler/label-matcher.d.ts +14 -35
- package/dist/scaler/log-forwarder.d.ts +6 -25
- package/dist/scaler/machine-ledger.d.ts +39 -86
- package/dist/scaler/manager.d.ts +517 -787
- package/dist/scaler/pending-scale-sweeper.d.ts +8 -11
- package/dist/scaler/reap-orphans.d.ts +8 -12
- package/dist/scaler/resolve-container-auth.d.ts +12 -21
- package/dist/scaler/scaler-events.d.ts +2 -5
- package/dist/scaler/scaler-state-store.d.ts +127 -189
- package/dist/scaler/spawn-errors.d.ts +1 -4
- package/dist/scaler/startup-orphan-sweep.d.ts +3 -4
- package/dist/scaler/startup-tools-check.d.ts +21 -0
- package/dist/scaler/types.d.ts +142 -255
- package/dist/scaler/vm-job-bindings.d.ts +5 -9
- package/dist/scaler/warm-pool.d.ts +46 -93
- package/dist/secrets/audit-logger.d.ts +0 -3
- package/dist/secrets/backend-health.d.ts +0 -9
- package/dist/secrets/backend-registry.d.ts +0 -9
- package/dist/secrets/cleanup.d.ts +0 -1
- package/dist/secrets/config.d.ts +0 -3
- package/dist/secrets/ephemeral-keys.d.ts +0 -3
- package/dist/secrets/pg-secret-store.d.ts +0 -3
- package/dist/secrets/rbac.d.ts +0 -6
- package/dist/secrets/secret-output-store.d.ts +0 -6
- package/dist/secrets/secret-resolver.d.ts +2 -6
- package/dist/secrets/token-manager.d.ts +0 -4
- package/dist/secrets/vault-secret-store.d.ts +0 -13
- package/dist/security/comment-handler.d.ts +0 -2
- package/dist/security/workflow-diff.d.ts +1 -1
- package/dist/server.js +7500 -12629
- package/dist/sources/source-manager.d.ts +0 -3
- package/dist/sources/source-store.d.ts +0 -9
- package/dist/sources/source-validator.d.ts +0 -3
- package/dist/stale-detector/all-terminal-runs.d.ts +8 -11
- package/dist/stale-detector/gate-deadline-detector.d.ts +14 -19
- package/dist/stale-detector/reboot-deadline-sweep.d.ts +7 -11
- package/dist/stale-detector/stale-dispatch-candidates.d.ts +13 -20
- package/dist/stale-detector/stale-run-detector.d.ts +74 -121
- package/dist/stale-detector/workflow-deadline-detector.d.ts +15 -43
- package/dist/standalone.js +7141 -11957
- package/dist/storage/blob-routes.d.ts +10 -19
- package/dist/storage/filesystem.d.ts +19 -29
- package/dist/storage/index.d.ts +2 -10
- package/dist/storage/key-discriminator.d.ts +8 -10
- package/dist/storage/loopback-guard.d.ts +27 -45
- package/dist/storage/s3.d.ts +25 -52
- package/dist/storage/sign-url.d.ts +7 -22
- package/dist/storage/types.d.ts +44 -70
- package/dist/webhook/event-log.d.ts +0 -2
- package/dist/webhook/generic-sources.d.ts +0 -21
- package/dist/webhook/ingest-admission.d.ts +0 -1
- package/dist/webhook/relay-buffer.d.ts +2 -2
- package/dist/webhook/verify-inbound.d.ts +0 -1
- package/dist/worker/in-memory-execution-tracker.d.ts +9 -31
- package/dist/worker/in-memory-job-queue.d.ts +32 -72
- package/dist/worker/peer-outbox.d.ts +5 -8
- package/dist/worker/reroute-dispatch.d.ts +4 -6
- package/dist/worker/static-agent-token-store.d.ts +6 -27
- package/dist/worker/worker-outbox-relay.d.ts +2 -2
- package/dist/worker/worker-status.d.ts +3 -20
- package/dist/ws/agent-api-registry.d.ts +8 -27
- package/dist/ws/agent-handler.d.ts +63 -110
- package/dist/ws/agent-heartbeat.d.ts +5 -12
- package/dist/ws/bringup-api.d.ts +31 -38
- package/dist/ws/dashboard-backends-handler.d.ts +12 -22
- package/dist/ws/dashboard-context-handler.d.ts +37 -80
- package/dist/ws/dashboard-diagnostics-handler.d.ts +8 -25
- package/dist/ws/dashboard-dispatch-guard.d.ts +3 -4
- package/dist/ws/dashboard-fleet-handler.d.ts +9 -13
- package/dist/ws/dashboard-fleet-write-handler.d.ts +7 -21
- package/dist/ws/dashboard-global-workflows-handler.d.ts +22 -44
- package/dist/ws/dashboard-registrations-handler.d.ts +10 -27
- package/dist/ws/dashboard-run-state-handler.d.ts +10 -13
- package/dist/ws/event-buffer.d.ts +3 -6
- package/dist/ws/execution-status-frame.d.ts +7 -10
- package/dist/ws/failure-messages.d.ts +9 -14
- package/dist/ws/fleet-agent-collector.d.ts +6 -12
- package/dist/ws/fleet-runs-on-all.d.ts +1 -6
- package/dist/ws/git-credential-relay.d.ts +12 -20
- package/dist/ws/inventory-api.d.ts +4 -5
- package/dist/ws/observer-registry.d.ts +14 -59
- package/dist/ws/ownership-gate.d.ts +1 -1
- package/dist/ws/platform-client.d.ts +21 -30
- package/dist/ws/replay-chunker.d.ts +7 -10
- package/dist/ws/server-options.d.ts +5 -9
- package/dist/ws/test-relay-handlers.d.ts +36 -60
- package/installer-image-digests.json +3 -3
- package/package.json +6 -5
- package/sbom.spdx.json +53 -53
- package/dist/__test-helpers__/fake-scaler-state-store.d.ts +0 -24
- package/dist/__test-helpers__/mock-db-query.d.ts +0 -129
- package/dist/__test-helpers__/mock-db.d.ts +0 -134
- package/dist/__test-helpers__/mock-ws.d.ts +0 -13
- package/dist/__test-helpers__/peer-mutual-auth.d.ts +0 -42
- package/dist/__test-helpers__/scratch-db.d.ts +0 -16
- package/dist/__test-helpers__/test-db.d.ts +0 -34
- package/dist/pipeline/dispatch-matched-workflow.test-helpers.d.ts +0 -121
|
@@ -3,12 +3,11 @@
|
|
|
3
3
|
*
|
|
4
4
|
* The receiving orchestrator becomes the run coordinator: it claims jobs
|
|
5
5
|
* it can dispatch locally and reroutes others to peers based on agent
|
|
6
|
-
* inventory.
|
|
7
|
-
* -
|
|
8
|
-
* -
|
|
9
|
-
* -
|
|
10
|
-
* -
|
|
11
|
-
* - "Cancel mode: graceful -- finish current step, cancel remaining"
|
|
6
|
+
* inventory.
|
|
7
|
+
* - One orchestrator coordinates per webhook run.
|
|
8
|
+
* - The coordinator handles ALL check run reporting.
|
|
9
|
+
* - Peers report step-by-step progress back to the coordinator.
|
|
10
|
+
* - Cancel is graceful: finish the current step, cancel the remaining ones.
|
|
12
11
|
*/
|
|
13
12
|
import type { JobReroute, JobProgress, JobProgressAck, PeerScalerEvent, PeerToPeerMessage, RerouteSpawnRetry, ResourceRequest, LabelMatcher } from '@kici-dev/engine';
|
|
14
13
|
import type { PeerRegistry } from './peer-registry.js';
|
|
@@ -54,10 +53,9 @@ export interface JobToRoute {
|
|
|
54
53
|
/** Labels that the dispatched agent must NOT have. */
|
|
55
54
|
excludeLabels?: string[];
|
|
56
55
|
/**
|
|
57
|
-
* Per-job resource request and limit (K8s-style)
|
|
58
|
-
* `Dispatcher.dispatch()`
|
|
59
|
-
*
|
|
60
|
-
* the `jobConfig.resources` JSON blob (which the dispatcher does not parse).
|
|
56
|
+
* Per-job resource request and limit (K8s-style), forwarded typed to
|
|
57
|
+
* `Dispatcher.dispatch()` for the scaler's cap accounting: the dispatcher does
|
|
58
|
+
* not parse the `jobConfig.resources` JSON blob.
|
|
61
59
|
*/
|
|
62
60
|
resources?: ResourceRequest;
|
|
63
61
|
}
|
|
@@ -66,11 +64,7 @@ export interface RouteResult {
|
|
|
66
64
|
jobName: string;
|
|
67
65
|
jobId: string;
|
|
68
66
|
}>;
|
|
69
|
-
/**
|
|
70
|
-
* Rerouted jobs include the pre-allocated jobId so the caller can
|
|
71
|
-
* register the execution_runs / execution_jobs rows under the same id
|
|
72
|
-
* the worker will report progress against.
|
|
73
|
-
*/
|
|
67
|
+
/** The pre-allocated jobId, so the caller's execution rows match the worker's reports. */
|
|
74
68
|
reroutedJobs: Array<{
|
|
75
69
|
jobName: string;
|
|
76
70
|
peerId: string;
|
|
@@ -98,28 +92,20 @@ export interface RunCoordinatorDeps {
|
|
|
98
92
|
/** Stale peer timeout in ms. Default: 60000 (60s). */
|
|
99
93
|
staleTimeoutMs?: number;
|
|
100
94
|
/**
|
|
101
|
-
*
|
|
102
|
-
*
|
|
103
|
-
*
|
|
104
|
-
* absent, {@link DEFAULT_REROUTE_SPAWN_WINDOW_MS} is used.
|
|
95
|
+
* Post-ACK re-dispatch backstop window (ms): the job's org override from
|
|
96
|
+
* `org_settings.reroute_spawn_window_ms`, else the cluster default. Absent:
|
|
97
|
+
* {@link DEFAULT_REROUTE_SPAWN_WINDOW_MS}.
|
|
105
98
|
*/
|
|
106
99
|
getRerouteSpawnWindowMs?: (job: JobToRoute) => Promise<number>;
|
|
107
|
-
/**
|
|
108
|
-
* Per-job reroute ACK timeout (ms) for the `sendAndWaitAck` deadline. When
|
|
109
|
-
* absent, falls back to `ackTimeoutMs` / {@link DEFAULT_ACK_TIMEOUT_MS}.
|
|
110
|
-
*/
|
|
100
|
+
/** `sendAndWaitAck` deadline (ms). Absent: `ackTimeoutMs` / {@link DEFAULT_ACK_TIMEOUT_MS}. */
|
|
111
101
|
getRerouteAckTimeoutMs?: (job: JobToRoute) => Promise<number>;
|
|
112
|
-
/**
|
|
113
|
-
* Per-job maximum peer hops for a rerouted job. When absent, falls back to
|
|
114
|
-
* {@link DEFAULT_MAX_HOPS}.
|
|
115
|
-
*/
|
|
102
|
+
/** Absent: {@link DEFAULT_MAX_HOPS}. */
|
|
116
103
|
getRerouteMaxHops?: (job: JobToRoute) => Promise<number>;
|
|
117
104
|
/**
|
|
118
|
-
*
|
|
119
|
-
*
|
|
120
|
-
*
|
|
121
|
-
*
|
|
122
|
-
* {@link DEFAULT_REROUTE_SPAWN_RETRY} is used.
|
|
105
|
+
* Spawn-retry budget sent to the receiving peer on `job.reroute` and enforced
|
|
106
|
+
* here on its relayed spawn failures: the job's org overrides from
|
|
107
|
+
* `org_settings.reroute_spawn_max_attempts` / `reroute_spawn_retry_backoff_ms`,
|
|
108
|
+
* else the cluster defaults. Absent: {@link DEFAULT_REROUTE_SPAWN_RETRY}.
|
|
123
109
|
*/
|
|
124
110
|
getRerouteSpawnRetry?: (job: JobToRoute) => Promise<RerouteSpawnRetry>;
|
|
125
111
|
}
|
|
@@ -137,18 +123,10 @@ export declare class RunCoordinator {
|
|
|
137
123
|
private readonly getRerouteAckTimeoutMs;
|
|
138
124
|
private readonly getRerouteMaxHops;
|
|
139
125
|
private readonly getRerouteSpawnRetry;
|
|
140
|
-
/**
|
|
141
|
-
* Tracks which jobs have been rerouted to which peers, keyed by runId.
|
|
142
|
-
* Used for cancel propagation, progress tracking, and the post-ACK spawn
|
|
143
|
-
* re-dispatch backstop.
|
|
144
|
-
*/
|
|
126
|
+
/** runId → jobId → reroute target: cancel propagation, progress, and the spawn backstop. */
|
|
145
127
|
private readonly reroutedJobs;
|
|
146
|
-
/**
|
|
147
|
-
* NAK tracking per peer: count of consecutive NAKs and backoff-until timestamp.
|
|
148
|
-
* Peers that repeatedly NAK are deprioritized via exponential backoff.
|
|
149
|
-
*/
|
|
128
|
+
/** Consecutive NAKs per peer; a repeatedly NAKing peer is skipped under exponential backoff. */
|
|
150
129
|
private readonly nakTracker;
|
|
151
|
-
/** Stale eviction timer handle. */
|
|
152
130
|
private staleEvictionTimer;
|
|
153
131
|
/** Plan-ceiling worker eviction (drain-then-disconnect). */
|
|
154
132
|
private readonly workerEviction;
|
|
@@ -168,44 +146,31 @@ export declare class RunCoordinator {
|
|
|
168
146
|
*/
|
|
169
147
|
reconcileWorkerEviction(ceiling: number, evictExcess: boolean): void;
|
|
170
148
|
/**
|
|
171
|
-
*
|
|
172
|
-
*
|
|
173
|
-
*
|
|
174
|
-
* Parallel fan-out: jobs targeting different peers are rerouted concurrently.
|
|
149
|
+
* Claim the jobs local agents can handle and reroute the rest, concurrently,
|
|
150
|
+
* to peers with matching capacity.
|
|
175
151
|
*/
|
|
176
152
|
routeJobs(runContext: RunContext, jobs: JobToRoute[]): Promise<RouteResult>;
|
|
177
|
-
/**
|
|
178
|
-
* Handle a job reroute request received from a peer (this instance is the worker).
|
|
179
|
-
* Checks loop prevention, then attempts to dispatch locally.
|
|
180
|
-
*/
|
|
153
|
+
/** Accept a peer's job reroute (this instance is the worker) by dispatching it locally. */
|
|
181
154
|
handleIncomingReroute(msg: JobReroute): Promise<{
|
|
182
155
|
accepted: boolean;
|
|
183
156
|
reason?: string;
|
|
184
157
|
}>;
|
|
185
158
|
/**
|
|
186
|
-
*
|
|
187
|
-
*
|
|
188
|
-
*
|
|
189
|
-
*
|
|
190
|
-
*
|
|
191
|
-
* `onStepStatus` (which only persists `execution_steps` rows). Without
|
|
192
|
-
* this split, every job-level event was silently funnelled into
|
|
193
|
-
* `onStepStatus` and the run stayed in `running` forever.
|
|
159
|
+
* Apply a worker (or coord) peer's job/step progress. `msg.kind` picks the
|
|
160
|
+
* tracker call: 'job' feeds `onJobStatus` (run-level state transitions and
|
|
161
|
+
* rerouted-job cleanup); 'step' feeds `onStepStatus` (only `execution_steps`
|
|
162
|
+
* rows). A job-level event sent to `onStepStatus` leaves the run in `running`
|
|
163
|
+
* forever.
|
|
194
164
|
*/
|
|
195
165
|
onPeerJobProgress(msg: JobProgress, fromPeerId: string, reply?: (m: JobProgressAck) => void): void;
|
|
196
166
|
/**
|
|
197
|
-
*
|
|
198
|
-
*
|
|
199
|
-
* Workers have no database, so they relay scaler events for jobs the
|
|
200
|
-
* worker is provisioning to the coordinator that owns the run. The
|
|
201
|
-
* coordinator's ExecutionTracker persists the event (provisioning log
|
|
202
|
-
* line + dispatch-queue last-error column) just as it would for a
|
|
203
|
-
* locally-emitted scaler event.
|
|
167
|
+
* Persist a scaler event a worker peer relayed (workers have no database):
|
|
168
|
+
* provisioning log line + dispatch-queue last-error column, as for a local one.
|
|
204
169
|
*
|
|
205
170
|
* Layer B: a `scaler.failed` for a tracked rerouted job whose spawn window is
|
|
206
|
-
* still armed is
|
|
207
|
-
*
|
|
208
|
-
*
|
|
171
|
+
* still armed is an agent spawn failing after the worker accepted the reroute.
|
|
172
|
+
* The worker retries within the spawn-retry budget sent on `job.reroute`, and
|
|
173
|
+
* the relay carries its verdict:
|
|
209
174
|
*
|
|
210
175
|
* - `final: true` — the worker gave the job back. Re-dispatch immediately (the
|
|
211
176
|
* same routine the spawn-window timer runs). Idempotent with the Layer A
|
|
@@ -230,87 +195,58 @@ export declare class RunCoordinator {
|
|
|
230
195
|
* A worker's verdict on a failed spawn for a job it holds. `final: true` means it
|
|
231
196
|
* gave the job back, so re-dispatch now. `final: false` means it is retrying, so
|
|
232
197
|
* restart the window for one more attempt plus the backoff this coordinator told it
|
|
233
|
-
* to wait. No verdict means a
|
|
234
|
-
* window as it is. The count
|
|
198
|
+
* to wait. No verdict means a repeated report of one failed spawn, or a failure
|
|
199
|
+
* the worker holds no retry budget for, so leave the window as it is. The count
|
|
200
|
+
* caps a worker that never says `final`.
|
|
235
201
|
*/
|
|
236
202
|
private onRelayedSpawnFailure;
|
|
237
203
|
/** Restart a rerouted job's spawn window for one more worker attempt plus its backoff. */
|
|
238
204
|
private rearmAfterSpawnRetry;
|
|
239
205
|
/**
|
|
240
|
-
*
|
|
241
|
-
*
|
|
242
|
-
*
|
|
243
|
-
* The data parameter carries droppedJobs for drift reporting.
|
|
206
|
+
* Apply a peer's job completion. onJobStatus fires the needs-aware scheduler
|
|
207
|
+
* hook, which dispatches newly-ready downstream jobs via onJobReadyCallback.
|
|
208
|
+
* `data` carries droppedJobs for drift reporting.
|
|
244
209
|
*/
|
|
245
210
|
onPeerJobComplete(runId: string, jobId: string, status: string, timestamp: number, data?: Record<string, unknown>): void;
|
|
246
211
|
/**
|
|
247
|
-
*
|
|
248
|
-
*
|
|
249
|
-
*
|
|
250
|
-
* Per locked decision: "graceful -- finish current step, cancel remaining."
|
|
212
|
+
* Send peer.job.cancel for every rerouted job of a run. Graceful: the peer
|
|
213
|
+
* finishes the current step and cancels the remaining ones.
|
|
251
214
|
*/
|
|
252
215
|
cancelRun(runId: string, reason: string): void;
|
|
253
|
-
/**
|
|
254
|
-
* Check if the peer registry has any connected peers.
|
|
255
|
-
*/
|
|
256
216
|
hasConnectedPeers(): boolean;
|
|
257
|
-
/**
|
|
258
|
-
* Start the stale eviction timer. Calls peerRegistry.evictStalePeers()
|
|
259
|
-
* every staleTimeoutMs/2 to detect and remove stale peers.
|
|
260
|
-
*/
|
|
217
|
+
/** Evict stale peers every staleTimeoutMs/2. */
|
|
261
218
|
startStaleEvictionTimer(staleTimeoutMs: number): void;
|
|
262
|
-
/**
|
|
263
|
-
* Stop the stale eviction timer.
|
|
264
|
-
*/
|
|
265
219
|
stopStaleEvictionTimer(): void;
|
|
266
|
-
/**
|
|
267
|
-
* Get the NAK count for a peer (used in tests).
|
|
268
|
-
*/
|
|
220
|
+
/** Used in tests. */
|
|
269
221
|
getNakCount(peerId: string): number;
|
|
270
|
-
/**
|
|
271
|
-
* Get the backoff-until timestamp for a peer (used in tests).
|
|
272
|
-
*/
|
|
222
|
+
/** Used in tests. */
|
|
273
223
|
getBackoffUntil(peerId: string): number;
|
|
274
|
-
/**
|
|
275
|
-
* Attempt to reroute a job to a peer with matching capacity. Allocates the
|
|
276
|
-
* sender-side jobId (so the caller can register execution rows under the id
|
|
277
|
-
* the worker reports back against) and delegates to {@link attemptPeerRoute}.
|
|
278
|
-
*/
|
|
224
|
+
/** Allocate the sender-side jobId and delegate to {@link attemptPeerRoute}. */
|
|
279
225
|
private rerouteJob;
|
|
280
226
|
/**
|
|
281
|
-
* Try each peer with matching capacity (most
|
|
282
|
-
*
|
|
283
|
-
*
|
|
284
|
-
*
|
|
285
|
-
*
|
|
286
|
-
* peer's loop-prevention stays correct.
|
|
227
|
+
* Try each peer with matching capacity (most first) for one job under a fixed
|
|
228
|
+
* `jobId`, returning on the first ACK. Used by initial routing and the spawn
|
|
229
|
+
* backstop; the caller passes the accumulated `triedConnections` (this
|
|
230
|
+
* instance + any failed peers) so a re-dispatch never re-selects a failed peer
|
|
231
|
+
* and the receiving peer's loop-prevention stays correct.
|
|
287
232
|
*/
|
|
288
233
|
private attemptPeerRoute;
|
|
289
|
-
/**
|
|
234
|
+
/** Tell "no peer handles this label" from "peers exist but at capacity". */
|
|
290
235
|
private noCapacityResult;
|
|
291
236
|
/** Assemble the `job.reroute` wire message for a single routing attempt. */
|
|
292
237
|
private buildRerouteMessage;
|
|
293
|
-
/**
|
|
294
|
-
* Sort peers by available capacity for the given label sets.
|
|
295
|
-
* Peers with more available capacity come first.
|
|
296
|
-
*/
|
|
297
238
|
private sortPeersByCapacity;
|
|
298
239
|
/**
|
|
299
|
-
*
|
|
300
|
-
*
|
|
301
|
-
*
|
|
302
|
-
*
|
|
303
|
-
* include every gate label. Without it, the coordinator would route a
|
|
304
|
-
* job to a peer based on a gated agent's labels, and the peer would
|
|
305
|
-
* then refuse the dispatch in `AgentRegistry.findAvailable` because the
|
|
306
|
-
* agent's gate is not satisfied.
|
|
240
|
+
* Free capacity across a peer's matching agents. A gated agent counts only for
|
|
241
|
+
* label sets that include every `mandatoryLabels` gate label, as the local
|
|
242
|
+
* matcher does; otherwise the peer refuses the dispatch in
|
|
243
|
+
* `AgentRegistry.findAvailable`.
|
|
307
244
|
*/
|
|
308
245
|
private computeAvailableCapacity;
|
|
309
246
|
/**
|
|
310
|
-
* Track a rerouted job
|
|
311
|
-
*
|
|
312
|
-
*
|
|
313
|
-
* its worker is connected.
|
|
247
|
+
* Track a rerouted job, arm its spawn-window backstop, and durably tag its
|
|
248
|
+
* `execution_jobs` row with the owning worker peer so run-recovery sweepers do
|
|
249
|
+
* not force-fail the job while its worker is connected.
|
|
314
250
|
*/
|
|
315
251
|
private trackReroutedJob;
|
|
316
252
|
/** Arm a spawn-window / reap timer that fires {@link handleRerouteSpawnTimeout}. */
|
|
@@ -320,10 +256,9 @@ export declare class RunCoordinator {
|
|
|
320
256
|
* shared `execution_jobs` row.
|
|
321
257
|
*
|
|
322
258
|
* A read failure answers "not running" so a transient database fault cannot
|
|
323
|
-
* silently disable the backstop
|
|
324
|
-
*
|
|
325
|
-
*
|
|
326
|
-
* latches, a read fault can no longer bounce a running job.
|
|
259
|
+
* silently disable the backstop; the re-dispatch it then performs is
|
|
260
|
+
* idempotent. Only the FIRST observation goes through this path: once
|
|
261
|
+
* `peerStarted` latches, a read fault can no longer bounce a running job.
|
|
327
262
|
*/
|
|
328
263
|
private rerouteTargetIsRunning;
|
|
329
264
|
/**
|
|
@@ -331,24 +266,21 @@ export declare class RunCoordinator {
|
|
|
331
266
|
* tracking entry once the shared row is terminal, otherwise re-arm the window
|
|
332
267
|
* as a reap poll.
|
|
333
268
|
*
|
|
334
|
-
* The entry cannot be dropped
|
|
335
|
-
*
|
|
336
|
-
*
|
|
337
|
-
*
|
|
338
|
-
* grow for the lifetime of the process. A read fault re-arms (never releases),
|
|
269
|
+
* The entry cannot be dropped: cancel propagation needs it while the job runs.
|
|
270
|
+
* It cannot be kept: a peer COORDINATOR relays no terminal `job.progress` (the
|
|
271
|
+
* shared row IS its report), so nothing else releases it and `reroutedJobs`
|
|
272
|
+
* would grow for the process lifetime. A read fault re-arms (never releases),
|
|
339
273
|
* so a transient fault costs one more poll rather than tracking.
|
|
340
274
|
*/
|
|
341
275
|
private reapOrDeferRerouteTracking;
|
|
342
276
|
/**
|
|
343
277
|
* Post-ACK spawn-window backstop. Fires when a rerouted job's peer accepted
|
|
344
|
-
* but produced no progress within the window (Layer A), or
|
|
345
|
-
*
|
|
346
|
-
* onPeerScalerEvent).
|
|
278
|
+
* but produced no progress within the window (Layer A), or when a worker
|
|
279
|
+
* relays its final spawn-failure verdict (Layer B, via onPeerScalerEvent).
|
|
347
280
|
* Best-effort cancels the original peer (double-execution guard against a
|
|
348
|
-
* slow-but-healthy spawn), then re-
|
|
349
|
-
*
|
|
350
|
-
*
|
|
351
|
-
* other no-ops.
|
|
281
|
+
* slow-but-healthy spawn), then re-routes to another peer, then local, and
|
|
282
|
+
* finally records the job failed rather than leaving it pending. Idempotent:
|
|
283
|
+
* whichever trigger fires first removes the tracking entry.
|
|
352
284
|
*/
|
|
353
285
|
private handleRerouteSpawnTimeout;
|
|
354
286
|
/** Best-effort cancel a single job on a peer (double-execution guard). */
|
|
@@ -365,12 +297,11 @@ export declare class RunCoordinator {
|
|
|
365
297
|
*/
|
|
366
298
|
cancelJobOnPeer(peerId: string, runId: string, jobId: string, reason: string, force?: boolean): boolean;
|
|
367
299
|
/**
|
|
368
|
-
*
|
|
369
|
-
*
|
|
370
|
-
*
|
|
371
|
-
*
|
|
372
|
-
*
|
|
373
|
-
* never delivers a message twice.
|
|
300
|
+
* Fire-and-forget to a peer: over the outbound client when connected, else
|
|
301
|
+
* over the peer's own connection to this process. The outbound client is down
|
|
302
|
+
* while it reconnects, and for good on a coordinator whose credential an
|
|
303
|
+
* operator revoked. `PeerClient.send` returns false only when it sent nothing,
|
|
304
|
+
* so the fallback never delivers a message twice.
|
|
374
305
|
*/
|
|
375
306
|
private sendToPeer;
|
|
376
307
|
/**
|
|
@@ -379,10 +310,7 @@ export declare class RunCoordinator {
|
|
|
379
310
|
* timeout, and resending would deliver the job twice.
|
|
380
311
|
*/
|
|
381
312
|
private rerouteTransport;
|
|
382
|
-
/**
|
|
383
|
-
* Local fallback for a re-dispatch: dispatch the job on this coordinator under
|
|
384
|
-
* the existing jobId. Returns true when the local dispatcher accepts it.
|
|
385
|
-
*/
|
|
313
|
+
/** Re-dispatch locally under the existing jobId; true when the dispatcher accepts it. */
|
|
386
314
|
private tryLocalRedispatch;
|
|
387
315
|
/** Mark a job failed when no backend (peer or local) can run it after re-dispatch. */
|
|
388
316
|
private failUnroutableJob;
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Cluster health HTTP endpoints
|
|
3
|
-
*
|
|
4
|
-
* Provides visibility into cluster state for monitoring and debugging:
|
|
2
|
+
* Cluster health HTTP endpoints:
|
|
5
3
|
* - GET /cluster/health -- overall cluster health status
|
|
6
4
|
* - GET /cluster/peers -- per-peer details including connectivity
|
|
7
5
|
* - GET /cluster/runs -- active execution runs with job counts
|
|
8
6
|
*
|
|
9
|
-
* Follows the
|
|
7
|
+
* Follows the Hono route factory pattern of routes/health.ts.
|
|
10
8
|
*/
|
|
11
9
|
import { Hono } from 'hono';
|
|
12
10
|
import type { RaftNode } from './raft.js';
|
|
@@ -20,11 +18,5 @@ export interface ClusterHealthRoutesDeps {
|
|
|
20
18
|
executionTracker: ExecutionTracker;
|
|
21
19
|
agentRegistry: AgentRegistry;
|
|
22
20
|
}
|
|
23
|
-
/**
|
|
24
|
-
* Create cluster health routes.
|
|
25
|
-
*
|
|
26
|
-
* @param deps - Dependencies for cluster state introspection
|
|
27
|
-
* @returns Hono app with /cluster/health, /cluster/peers, /cluster/runs endpoints
|
|
28
|
-
*/
|
|
29
21
|
export declare function createClusterHealthRoutes(deps: ClusterHealthRoutesDeps): Hono;
|
|
30
22
|
//# sourceMappingURL=health-api.d.ts.map
|
package/dist/cluster/index.d.ts
CHANGED
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Barrel export for the cluster coordination module.
|
|
3
|
-
*
|
|
4
|
-
* All cluster-related functionality is exported from this single entry point
|
|
5
|
-
* for clean imports in server.ts and standalone.ts.
|
|
6
|
-
*/
|
|
1
|
+
/** Barrel export for the cluster coordination module. */
|
|
7
2
|
export { PeerRegistry } from './peer-registry.js';
|
|
8
3
|
export type { PeerInfo, PeerAgentInfo, PeerRegistryOptions } from './peer-registry.js';
|
|
9
4
|
export { PeerClient, PeerDialOrigin } from './peer-client.js';
|
|
@@ -3,24 +3,20 @@ import type { Database } from '../db/types.js';
|
|
|
3
3
|
/** Default interval between `cluster_instances` heartbeat writes. */
|
|
4
4
|
export declare const DEFAULT_INSTANCE_HEARTBEAT_MS = 10000;
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* false "dead" verdict is another coordinator recovering jobs it is watching.
|
|
6
|
+
* Missed ticks before a coordinator reads as dead. Six (60 s at the default
|
|
7
|
+
* interval) survives a GC pause, slow DB or brief network stall; a false "dead"
|
|
8
|
+
* verdict makes another coordinator recover jobs this one is watching.
|
|
10
9
|
*/
|
|
11
10
|
export declare const HEARTBEAT_MISSES_BEFORE_DEAD = 6;
|
|
12
11
|
/**
|
|
13
|
-
* The dispatcher's recovery grace
|
|
14
|
-
*
|
|
15
|
-
* has no configured grace period to hand in.
|
|
12
|
+
* The dispatcher's default recovery grace: twice `agentMaxReconnectDelayMs` (60 s).
|
|
13
|
+
* The fallback floor when a caller has no configured grace period.
|
|
16
14
|
*/
|
|
17
15
|
export declare const DEFAULT_RECOVERY_GRACE_MS = 120000;
|
|
18
16
|
/**
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
* the ownership predicate must never call a coordinator dead sooner than the
|
|
23
|
-
* recovery machinery would have given it to reconnect.
|
|
17
|
+
* Window inside which a `cluster_instances` row counts as live: the larger of the
|
|
18
|
+
* recovery grace and six ticks, so the ownership predicate never calls a
|
|
19
|
+
* coordinator dead sooner than recovery would have let it reconnect.
|
|
24
20
|
*/
|
|
25
21
|
export declare function instanceLivenessGraceMs(gracePeriodMs: number, heartbeatMs?: number): number;
|
|
26
22
|
/**
|
|
@@ -41,18 +37,15 @@ export interface InstanceHeartbeatOptions {
|
|
|
41
37
|
/**
|
|
42
38
|
* Writes this coordinator's liveness into `cluster_instances` on a fixed tick.
|
|
43
39
|
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
* is the boot-time bug the predicate exists to fix. Raft membership is worse:
|
|
50
|
-
* a partitioned coordinator self-elects and reads the other half as gone.
|
|
40
|
+
* Dispatch-plane ownership predicates ("is this row's owner alive?") must read the
|
|
41
|
+
* DB. The in-memory peer registry is empty when startup recovery runs (no peer
|
|
42
|
+
* handshakes yet), so it reads every live sibling as dead — the boot-time bug the
|
|
43
|
+
* predicate exists to fix. Raft membership is worse: a partitioned coordinator
|
|
44
|
+
* self-elects and reads the other half as gone.
|
|
51
45
|
*
|
|
52
|
-
* A DB heartbeat needs no peer connectivity, so it behaves the same in
|
|
53
|
-
*
|
|
54
|
-
* `host_roster`
|
|
55
|
-
* mechanism pointed at coordinators.
|
|
46
|
+
* A DB heartbeat needs no peer connectivity, so it behaves the same in Raft,
|
|
47
|
+
* plain multi-coordinator and standalone deployments — the mechanism
|
|
48
|
+
* `host_roster` uses for agent liveness.
|
|
56
49
|
*/
|
|
57
50
|
export declare class InstanceHeartbeat {
|
|
58
51
|
private readonly db;
|
|
@@ -63,39 +56,30 @@ export declare class InstanceHeartbeat {
|
|
|
63
56
|
private timer;
|
|
64
57
|
constructor(opts: InstanceHeartbeatOptions);
|
|
65
58
|
/**
|
|
66
|
-
* Write one heartbeat immediately, then every `intervalMs`.
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
* reads this table, so a coordinator that had not yet written a row would be
|
|
70
|
-
* invisible to its own siblings' predicates.
|
|
59
|
+
* Write one heartbeat immediately, then every `intervalMs`. The immediate write
|
|
60
|
+
* matters: startup recovery reads this table moments after boot, and a
|
|
61
|
+
* coordinator with no row yet is invisible to its siblings' predicates.
|
|
71
62
|
*/
|
|
72
63
|
start(): Promise<void>;
|
|
73
64
|
stop(): void;
|
|
74
65
|
/**
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
* the grace window. Best-effort: a crash leaves the row to expire.
|
|
66
|
+
* Delete this row on clean shutdown so siblings see it dead immediately, not
|
|
67
|
+
* after the grace window. Best-effort: a crash leaves the row to expire.
|
|
78
68
|
*/
|
|
79
69
|
retire(): Promise<void>;
|
|
80
70
|
/**
|
|
81
71
|
* One heartbeat write. Best-effort: a failed tick is retried on the next.
|
|
82
|
-
*
|
|
83
|
-
*
|
|
84
|
-
* that rewrites `started_at` — the column records when THIS process came up,
|
|
85
|
-
* so a restart under the same instance id must move it while an ordinary tick
|
|
86
|
-
* must not.
|
|
72
|
+
* Only `start()`'s write (`processStart`) rewrites `started_at`, which records
|
|
73
|
+
* when THIS process came up: a restart under the same id moves it, a tick does not.
|
|
87
74
|
*/
|
|
88
75
|
beat(opts?: {
|
|
89
76
|
processStart?: boolean;
|
|
90
77
|
}): Promise<void>;
|
|
91
78
|
}
|
|
92
79
|
/**
|
|
93
|
-
* Which of the given coordinator
|
|
94
|
-
*
|
|
95
|
-
*
|
|
96
|
-
* reason the class above documents: the peer registry is empty during boot and
|
|
97
|
-
* blind under a partition, and a wrong "dead" verdict here means acting on a
|
|
98
|
-
* row a working coordinator owns.
|
|
80
|
+
* Which of the given coordinator ids are alive now. Reads `cluster_instances`, not
|
|
81
|
+
* the peer registry (empty at boot, blind under a partition — see the class above):
|
|
82
|
+
* a wrong "dead" verdict means acting on a row a working coordinator owns.
|
|
99
83
|
*/
|
|
100
84
|
export declare function liveInstanceIds(db: Kysely<Database>, instanceIds: readonly string[], graceMs: number): Promise<Set<string>>;
|
|
101
85
|
//# sourceMappingURL=instance-heartbeat.d.ts.map
|
|
@@ -38,10 +38,9 @@ export declare function describeJoinRefusal(response: JoinResponse): string;
|
|
|
38
38
|
* through.
|
|
39
39
|
*
|
|
40
40
|
* The `satisfies` clause makes a bundle storage field with no entry here a
|
|
41
|
-
* compile error, so the projection cannot silently drop one
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
* variable named here, resolves in the startup env definition.
|
|
41
|
+
* compile error, so the projection cannot silently drop one. The companion test
|
|
42
|
+
* pins the other half: every field `sharedConfigSchema.storage` accepts, and
|
|
43
|
+
* every variable named here, resolves in the startup env definition.
|
|
45
44
|
*/
|
|
46
45
|
export declare const STORAGE_ENV_VARS: {
|
|
47
46
|
readonly type: 'KICI_STORAGE_TYPE';
|
|
@@ -61,9 +60,7 @@ export declare const STORAGE_ENV_VARS: {
|
|
|
61
60
|
* rejected by name rather than written.
|
|
62
61
|
*/
|
|
63
62
|
export declare function buildEnvFile(bundle: ConfigBundle): string;
|
|
64
|
-
/**
|
|
65
|
-
* Write the env file the orchestrator boots from.
|
|
66
|
-
*/
|
|
63
|
+
/** Write the env file the orchestrator boots from. */
|
|
67
64
|
export declare function writeEnvFile(path: string, bundle: ConfigBundle): Promise<void>;
|
|
68
65
|
export declare class JoinClient {
|
|
69
66
|
private readonly options;
|
|
@@ -23,10 +23,7 @@ interface JoinHandlerDeps {
|
|
|
23
23
|
*/
|
|
24
24
|
secretKey?: string;
|
|
25
25
|
}
|
|
26
|
-
/**
|
|
27
|
-
* Config bundle distributed to new orchestrators via join token.
|
|
28
|
-
* Contains everything needed to configure and start an orchestrator instance.
|
|
29
|
-
*/
|
|
26
|
+
/** Config bundle a join seals to a new orchestrator: everything it needs to start. */
|
|
30
27
|
export interface ConfigBundle {
|
|
31
28
|
databaseUrl: string;
|
|
32
29
|
storage?: {
|
|
@@ -57,9 +54,8 @@ export declare class JoinHandler {
|
|
|
57
54
|
handleJoinRequest(raw: unknown): Promise<JoinResponse>;
|
|
58
55
|
private answer;
|
|
59
56
|
/**
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
* a joined orchestrator decrypts what the cluster encrypted.
|
|
57
|
+
* The secrets key is the shared configuration's `secrets.key`, else this
|
|
58
|
+
* orchestrator's own key, so a joined orchestrator decrypts what the cluster encrypted.
|
|
63
59
|
*/
|
|
64
60
|
buildConfigBundle(): Promise<ConfigBundle>;
|
|
65
61
|
}
|
|
@@ -14,10 +14,7 @@
|
|
|
14
14
|
import { OrchRole } from '@kici-dev/engine';
|
|
15
15
|
import { Kysely } from 'kysely';
|
|
16
16
|
import { z } from 'zod';
|
|
17
|
-
/**
|
|
18
|
-
* Silence the module-level logger (e.g. when a CLI is emitting JSON on stdout
|
|
19
|
-
* and a stray log line would break the contract).
|
|
20
|
-
*/
|
|
17
|
+
/** Silence the module logger, e.g. while a CLI emits JSON on stdout. */
|
|
21
18
|
export declare function silenceJoinTokenLogger(): void;
|
|
22
19
|
export declare const TOKEN_ALREADY_USED_MESSAGE = "Join token has already been used. Create a new token with: kici-admin peer create-token";
|
|
23
20
|
export declare const TOKEN_EXPIRED_MESSAGE = "Join token has expired. Create a new token with: kici-admin peer create-token";
|
|
@@ -62,10 +59,7 @@ interface JoinTokenManagerDeps {
|
|
|
62
59
|
export declare class JoinTokenManager {
|
|
63
60
|
private readonly deps;
|
|
64
61
|
constructor(deps: JoinTokenManagerDeps);
|
|
65
|
-
/**
|
|
66
|
-
* Create a new join token.
|
|
67
|
-
* Returns the full token string (only available at creation time).
|
|
68
|
-
*/
|
|
62
|
+
/** Returns the full token string, available only at creation time. */
|
|
69
63
|
createToken(opts: {
|
|
70
64
|
orgId: string;
|
|
71
65
|
routingKey: string;
|
|
@@ -77,12 +71,11 @@ export declare class JoinTokenManager {
|
|
|
77
71
|
* Peer token mode: claim the row the presented token's secret hashes to. Role and
|
|
78
72
|
* routing come from the row (`claimByHash`), never from the token's routing part.
|
|
79
73
|
*
|
|
80
|
-
* Self-healing reuse:
|
|
81
|
-
*
|
|
82
|
-
*
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
* usefulness beyond the instance that first consumed it.
|
|
74
|
+
* Self-healing reuse: the same joining peer (`peerInstanceId`) can re-consume
|
|
75
|
+
* the token until `expires_at`, so a peer that lost its credential re-presents
|
|
76
|
+
* the token in its env and gets a fresh credential without an operator action.
|
|
77
|
+
* Bounding reuse by `expires_at` and the consuming instanceId keeps a leaked
|
|
78
|
+
* token useless beyond the instance that first consumed it.
|
|
86
79
|
*/
|
|
87
80
|
validateAndConsumeToken(token: string, consumedBy: string, peerInstanceId: string): Promise<ClaimedJoinToken>;
|
|
88
81
|
/**
|
|
@@ -110,10 +103,8 @@ export declare class JoinTokenManager {
|
|
|
110
103
|
} | null>;
|
|
111
104
|
}
|
|
112
105
|
/**
|
|
113
|
-
*
|
|
114
|
-
*
|
|
115
|
-
* used by tests that need to exercise token validation/reuse against a real
|
|
116
|
-
* cluster DB.
|
|
106
|
+
* A JoinTokenManager with its own connection pool, for tests against a real
|
|
107
|
+
* cluster DB. Mirrors `createPeerCredentialStoreFromUrl`.
|
|
117
108
|
*/
|
|
118
109
|
export declare function createJoinTokenManagerFromUrl(databaseUrl: string, opts?: {
|
|
119
110
|
maxConnections?: number;
|
|
@@ -122,17 +113,12 @@ export declare function createJoinTokenManagerFromUrl(databaseUrl: string, opts?
|
|
|
122
113
|
dispose: () => Promise<void>;
|
|
123
114
|
};
|
|
124
115
|
/**
|
|
125
|
-
*
|
|
126
|
-
*
|
|
127
|
-
*
|
|
128
|
-
*
|
|
129
|
-
* across a multi-coordinator shared-DB mesh). Other validation failures
|
|
130
|
-
* (expired, not found, bad parse) MUST NOT be treated as recoverable.
|
|
116
|
+
* Detects the "already been used" error from validateAndConsumeToken(), which
|
|
117
|
+
* peer-handler.ts treats as recoverable: sibling peer-clients of one peer
|
|
118
|
+
* identity race on a shared token across a shared-DB mesh. Other validation
|
|
119
|
+
* failures (expired, not found, bad parse) MUST NOT be treated as recoverable.
|
|
131
120
|
*/
|
|
132
121
|
export declare function isTokenAlreadyUsedError(err: unknown): boolean;
|
|
133
|
-
/**
|
|
134
|
-
* Parse a join token string into routing info and secret hex.
|
|
135
|
-
*/
|
|
136
122
|
export declare function parseToken(token: string): {
|
|
137
123
|
routing: TokenRouting;
|
|
138
124
|
routingB64: string;
|