@kici-dev/orchestrator 0.16.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 +39 -45
- 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 +33 -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 +7 -7
- 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 +4553 -6556
- 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 +251 -486
- 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 +21 -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 +21 -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 +19 -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 +45 -0
- 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/test-direct.d.ts +46 -0
- package/dist/routes/uploads.d.ts +14 -19
- 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 +5 -7
- package/dist/secrets/routing-key-scope.d.ts +1 -0
- 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 +1 -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 +49004 -53782
- 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 +9342 -13077
- 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 +26 -53
- package/dist/storage/sign-url.d.ts +7 -22
- package/dist/storage/types.d.ts +46 -72
- 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 +46 -63
- 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
- package/dist/scaler/container-spawn.d.ts +0 -28
package/dist/db/types.d.ts
CHANGED
|
@@ -24,10 +24,7 @@ export declare enum HostIdentitySource {
|
|
|
24
24
|
operator = "operator",
|
|
25
25
|
platform = "platform"
|
|
26
26
|
}
|
|
27
|
-
/**
|
|
28
|
-
* PostgreSQL-only database types.
|
|
29
|
-
* Column names use snake_case matching the actual database column names.
|
|
30
|
-
*/
|
|
27
|
+
/** PostgreSQL schema; every key and column name is the snake_case database name. */
|
|
31
28
|
export interface Database {
|
|
32
29
|
dispatch_queue: DispatchQueueTable;
|
|
33
30
|
dedup_cache: DedupCacheTable;
|
|
@@ -93,13 +90,12 @@ export interface Database {
|
|
|
93
90
|
backup_runs: BackupRunsTable;
|
|
94
91
|
}
|
|
95
92
|
/**
|
|
96
|
-
* Open accumulation window for a `workflowsFailedBatch` registration
|
|
97
|
-
*
|
|
98
|
-
*
|
|
99
|
-
* `expires_at` passes, emitting a single `__workflows_failed_batch` event.
|
|
93
|
+
* Open accumulation window for a `workflowsFailedBatch` registration, one per subscribing
|
|
94
|
+
* workflow. The first matching failure opens it; the leader sweep closes it once `expires_at`
|
|
95
|
+
* passes, emitting a single `__workflows_failed_batch` event.
|
|
100
96
|
*/
|
|
101
97
|
export interface BatchAccumulationWindowsTable {
|
|
102
|
-
/**
|
|
98
|
+
/** Primary key. */
|
|
103
99
|
id: string;
|
|
104
100
|
/** Owning customer/org id. */
|
|
105
101
|
customer_id: string;
|
|
@@ -107,7 +103,7 @@ export interface BatchAccumulationWindowsTable {
|
|
|
107
103
|
registration_id: string;
|
|
108
104
|
/** Routing key captured at open time so the sweep can emit without the index. */
|
|
109
105
|
routing_key: string;
|
|
110
|
-
/**
|
|
106
|
+
/** Captured at open time. */
|
|
111
107
|
repo_identifier: string;
|
|
112
108
|
/** Accumulation window length in milliseconds. */
|
|
113
109
|
accumulate_for_ms: number;
|
|
@@ -118,43 +114,32 @@ export interface BatchAccumulationWindowsTable {
|
|
|
118
114
|
}
|
|
119
115
|
export type BatchAccumulationWindow = Selectable<BatchAccumulationWindowsTable>;
|
|
120
116
|
export type NewBatchAccumulationWindow = Insertable<BatchAccumulationWindowsTable>;
|
|
121
|
-
/**
|
|
122
|
-
* A single failed run buffered into a batch-accumulation window.
|
|
123
|
-
* Deleted with its window via `ON DELETE CASCADE` when the window is swept.
|
|
124
|
-
*/
|
|
117
|
+
/** A failed run buffered into a batch-accumulation window; cascade-deleted with its window. */
|
|
125
118
|
export interface BatchAccumulationItemsTable {
|
|
126
|
-
/**
|
|
119
|
+
/** Primary key. */
|
|
127
120
|
id: string;
|
|
128
|
-
/** Owning window id (FK, cascade-deleted). */
|
|
129
121
|
window_id: string;
|
|
130
|
-
/** The failed run's id. */
|
|
131
122
|
run_id: string;
|
|
132
|
-
/** Repo identifier of the failed run. */
|
|
133
123
|
repo_identifier: string;
|
|
134
|
-
/** Workflow name of the failed run. */
|
|
135
124
|
workflow_name: string;
|
|
136
125
|
/** Failure class (`RunFailureClass`) when known. */
|
|
137
126
|
failure_class: string | null;
|
|
138
127
|
/** Triggering actor username when known. */
|
|
139
128
|
sender_username: string | null;
|
|
140
|
-
/** When the item was buffered. */
|
|
141
129
|
created_at: Generated<Date>;
|
|
142
130
|
}
|
|
143
131
|
export type BatchAccumulationItem = Selectable<BatchAccumulationItemsTable>;
|
|
144
132
|
export type NewBatchAccumulationItem = Insertable<BatchAccumulationItemsTable>;
|
|
145
133
|
/**
|
|
146
|
-
*
|
|
147
|
-
*
|
|
148
|
-
*
|
|
149
|
-
* relay failover so a re-sent request returns the first coordinator's
|
|
150
|
-
* `new_run_id` instead of creating a second run. Pruned after 1h.
|
|
134
|
+
* Makes run-minting dashboard requests (`run.rerun.request`, `run.manual_schedule.request`)
|
|
135
|
+
* idempotent across an HA relay failover: a re-sent Platform `requestId` returns the first
|
|
136
|
+
* coordinator's `new_run_id` instead of a second run. Pruned after 1h.
|
|
151
137
|
*/
|
|
152
138
|
export interface RequestIdempotencyTable {
|
|
153
|
-
/** Platform-minted requestId
|
|
139
|
+
/** Platform-minted requestId (primary key). */
|
|
154
140
|
request_id: string;
|
|
155
|
-
/** The run
|
|
141
|
+
/** The run the winning coordinator created. */
|
|
156
142
|
new_run_id: string;
|
|
157
|
-
/** When the claim was recorded. */
|
|
158
143
|
created_at: Generated<Date>;
|
|
159
144
|
}
|
|
160
145
|
export type RequestIdempotency = Selectable<RequestIdempotencyTable>;
|
|
@@ -169,9 +154,9 @@ export interface BackupRunsTable {
|
|
|
169
154
|
created_at: Generated<Date>;
|
|
170
155
|
/** Local path the dump was written to (informational). */
|
|
171
156
|
dump_path: string;
|
|
172
|
-
/**
|
|
157
|
+
/** Dump size in bytes. */
|
|
173
158
|
byte_size: string | bigint;
|
|
174
|
-
/** Secret-key generation the DB's encrypted config
|
|
159
|
+
/** Secret-key generation of the DB's encrypted config (null when it has none). */
|
|
175
160
|
secret_key_version: number | null;
|
|
176
161
|
/** Server version string the dump was taken from (e.g. "160003"). */
|
|
177
162
|
pg_server_version: string;
|
|
@@ -182,22 +167,16 @@ export interface BackupRunsTable {
|
|
|
182
167
|
}
|
|
183
168
|
export type BackupRun = Selectable<BackupRunsTable>;
|
|
184
169
|
export type NewBackupRun = Insertable<BackupRunsTable>;
|
|
185
|
-
/**
|
|
186
|
-
* Cluster metadata table
|
|
187
|
-
* Key-value store for cluster-wide configuration (e.g. cluster_id).
|
|
188
|
-
*/
|
|
170
|
+
/** Key-value store for cluster-wide configuration (e.g. cluster_id). */
|
|
189
171
|
export interface ClusterMetaTable {
|
|
190
|
-
/**
|
|
172
|
+
/** Primary key. */
|
|
191
173
|
key: string;
|
|
192
|
-
/** Value */
|
|
193
174
|
value: string;
|
|
194
|
-
/** When this entry was created */
|
|
195
175
|
created_at: Generated<Date>;
|
|
196
176
|
}
|
|
197
177
|
export type ClusterMeta = Selectable<ClusterMetaTable>;
|
|
198
178
|
export type NewClusterMeta = Insertable<ClusterMetaTable>;
|
|
199
179
|
/**
|
|
200
|
-
* Join tokens table
|
|
201
180
|
* Stores hashed join tokens. `kici-admin join` and peer token mode find a row by
|
|
202
181
|
* its hash; a token is consumed on first use and re-usable by the instance that
|
|
203
182
|
* consumed it until it expires.
|
|
@@ -209,40 +188,30 @@ export interface JoinTokenTable {
|
|
|
209
188
|
token_hash: string;
|
|
210
189
|
/** Routing info embedded in the token (orgId, routingKey, expiry) */
|
|
211
190
|
routing_info: string;
|
|
212
|
-
/** Who created this token */
|
|
213
191
|
created_by: string;
|
|
214
|
-
/** When this token was created */
|
|
215
192
|
created_at: Generated<Date>;
|
|
216
|
-
/** When this token expires */
|
|
217
193
|
expires_at: Date;
|
|
218
|
-
/**
|
|
194
|
+
/** null = unused */
|
|
219
195
|
consumed_at: Date | null;
|
|
220
|
-
/**
|
|
196
|
+
/** The coordinator that processed the claim (null = unused) */
|
|
221
197
|
consumed_by: string | null;
|
|
222
198
|
/**
|
|
223
|
-
* The
|
|
224
|
-
*
|
|
225
|
-
* reuse the token until `expires_at` to self-heal after a transient outage.
|
|
199
|
+
* The joining peer that consumed the token (null = unused); `consumed_by` is the coordinator.
|
|
200
|
+
* The same peer may reuse the token until `expires_at` to self-heal after a transient outage.
|
|
226
201
|
*/
|
|
227
202
|
consumed_by_instance: string | null;
|
|
228
203
|
}
|
|
229
204
|
export type JoinToken = Selectable<JoinTokenTable>;
|
|
230
205
|
export type NewJoinToken = Insertable<JoinTokenTable>;
|
|
231
|
-
/**
|
|
232
|
-
* Dispatch queue table
|
|
233
|
-
* Holds jobs waiting to be dispatched to agents.
|
|
234
|
-
*/
|
|
206
|
+
/** Holds jobs waiting to be dispatched to agents. */
|
|
235
207
|
export interface DispatchQueueTable {
|
|
236
208
|
/** UUID primary key */
|
|
237
209
|
id: Generated<string>;
|
|
238
|
-
/** Unique run identifier for this execution */
|
|
239
210
|
run_id: string;
|
|
240
211
|
/** Workflow name from lock file */
|
|
241
212
|
workflow_name: string;
|
|
242
|
-
/** Job name within the workflow */
|
|
243
213
|
job_name: string;
|
|
244
|
-
/** JSONB array
|
|
245
|
-
* Insert: JSON.stringify(labels), Select: auto-parsed by pg driver. */
|
|
214
|
+
/** JSONB label array: insert `JSON.stringify(labels)`; the pg driver parses it on select. */
|
|
246
215
|
runs_on_labels: string;
|
|
247
216
|
/** JSON-encoded Record of the job configuration, without the fields in `sealed_secrets` */
|
|
248
217
|
job_config: string;
|
|
@@ -253,13 +222,11 @@ export interface DispatchQueueTable {
|
|
|
253
222
|
* before the column existed: those rows keep the fields in the plain column.
|
|
254
223
|
*/
|
|
255
224
|
sealed_secrets: ColumnType<string | null, string | null | undefined, string | null>;
|
|
256
|
-
/** Repository clone URL */
|
|
257
225
|
repo_url: string;
|
|
258
226
|
/** Git ref (branch/tag) */
|
|
259
227
|
ref: string;
|
|
260
|
-
/** Git commit SHA */
|
|
261
228
|
sha: string;
|
|
262
|
-
/** Job status:
|
|
229
|
+
/** Job status: a `DispatchQueueStatus` value (`queue/job-queue.ts`). */
|
|
263
230
|
status: Generated<string>;
|
|
264
231
|
/** When this job was queued */
|
|
265
232
|
created_at: Generated<Date>;
|
|
@@ -267,7 +234,7 @@ export interface DispatchQueueTable {
|
|
|
267
234
|
expires_at: Date | null;
|
|
268
235
|
/** Webhook delivery ID for tracing */
|
|
269
236
|
delivery_id: string;
|
|
270
|
-
/**
|
|
237
|
+
/** e.g. "github", "gitlab" */
|
|
271
238
|
provider: Generated<string>;
|
|
272
239
|
/** JSON-encoded provider-specific context (e.g., {"installationId": 42}) */
|
|
273
240
|
provider_context: Generated<string>;
|
|
@@ -282,48 +249,41 @@ export interface DispatchQueueTable {
|
|
|
282
249
|
request_id: string | null;
|
|
283
250
|
/** JSONB array of exclusion labels. Default '[]'. */
|
|
284
251
|
exclude_labels: Generated<string>;
|
|
285
|
-
/**
|
|
252
|
+
/** Required LabelMatcher[] regexes; JS post-filter over runs_on_labels. Default '[]'. */
|
|
286
253
|
runs_on_patterns: Generated<string>;
|
|
287
254
|
/** Regex matchers (LabelMatcher[]) that disqualify an agent; JS post-filter. Default '[]'. */
|
|
288
255
|
exclude_patterns: Generated<string>;
|
|
289
|
-
/**
|
|
290
|
-
* per-app provider bundle in multi-app setups. Required (NOT NULL). */
|
|
256
|
+
/** NOT NULL; e.g. "github:12345". Picks the per-app provider bundle in multi-app setups. */
|
|
291
257
|
routing_key: string;
|
|
292
258
|
/**
|
|
293
|
-
* For
|
|
294
|
-
*
|
|
295
|
-
*
|
|
296
|
-
* when the leader-gated sweep transitions the row to `failed`.
|
|
297
|
-
* NULL for all other statuses.
|
|
259
|
+
* For `status='recovering'` jobs, when the recovery grace period elapses. Set when an agent
|
|
260
|
+
* disconnects with the job in flight; cleared when the agent reconnects and claims it, or when
|
|
261
|
+
* the leader-gated sweep fails the row. NULL for all other statuses.
|
|
298
262
|
*/
|
|
299
263
|
recovery_deadline: ColumnType<Date | null, Date | null | undefined, Date | null>;
|
|
300
264
|
/**
|
|
301
|
-
*
|
|
302
|
-
*
|
|
303
|
-
* the rightful claimant. NULL for non-recovering rows.
|
|
265
|
+
* The agent that owned the job before disconnect; a reconnecting agent must match it.
|
|
266
|
+
* NULL for non-recovering rows.
|
|
304
267
|
*/
|
|
305
268
|
recovery_agent_id: ColumnType<string | null, string | null | undefined, string | null>;
|
|
306
269
|
/**
|
|
307
|
-
*
|
|
308
|
-
*
|
|
309
|
-
*
|
|
310
|
-
* real provisioning cause; cleared on dispatch. NULL when none recorded.
|
|
270
|
+
* Latest scaler spawn-failure detail (e.g. "agent process error: spawn node ENOENT"). Written
|
|
271
|
+
* on a `scaler.failed` event bound to the job, surfaced by the queue-timeout reaper as the
|
|
272
|
+
* provisioning cause, cleared on dispatch. NULL when none recorded.
|
|
311
273
|
*/
|
|
312
274
|
last_provisioning_error: ColumnType<string | null, string | null | undefined, string | null>;
|
|
313
275
|
/**
|
|
314
|
-
* When
|
|
315
|
-
*
|
|
316
|
-
*
|
|
317
|
-
* rather than in-memory so a restart mid-grace resumes the same clock.
|
|
276
|
+
* When the job first read unroutable (no agent and no scaler backend matched its selectors).
|
|
277
|
+
* NULL once routable again, so the grace clock measures only a CONTINUOUS unroutable window.
|
|
278
|
+
* Persisted so a restart mid-grace resumes the same clock.
|
|
318
279
|
*/
|
|
319
280
|
unroutable_since: ColumnType<Date | null, Date | string | null | undefined, Date | string | null>;
|
|
320
281
|
/** Times this job was returned to pending for re-dispatch (job.reject / pre-start agent loss). */
|
|
321
282
|
dispatch_attempts: Generated<number>;
|
|
322
283
|
/**
|
|
323
|
-
* Deadline
|
|
324
|
-
*
|
|
325
|
-
*
|
|
326
|
-
* deadline are requeued by the owning coord's timer or the leader sweep.
|
|
284
|
+
* Deadline for the agent to answer job.dispatch (job.ack / job.reject / job.status running).
|
|
285
|
+
* Stamped on send, cleared on any answer; a `dispatched` row past it is requeued by the owning
|
|
286
|
+
* coord's timer or the leader sweep.
|
|
327
287
|
*/
|
|
328
288
|
ack_deadline: ColumnType<Date | null, Date | null | undefined, Date | null>;
|
|
329
289
|
/** Agent the dispatch was sent to (for ack-timeout disconnect + logging). */
|
|
@@ -335,46 +295,34 @@ export interface DispatchQueueTable {
|
|
|
335
295
|
*/
|
|
336
296
|
pinned_agent_id: ColumnType<string | null, string | null | undefined, string | null>;
|
|
337
297
|
/**
|
|
338
|
-
* Durable owner
|
|
339
|
-
*
|
|
340
|
-
*
|
|
341
|
-
*
|
|
342
|
-
* dispatch answer "does this agent own this job?" from the database alone.
|
|
343
|
-
* NULL for pending rows and for rows dispatched before the column existed.
|
|
298
|
+
* Durable owner: the agent the job was handed to. Written at dispatch, cleared on requeue.
|
|
299
|
+
* Unlike `ack_agent_id` (cleared once the agent answers), it lets a coordinator that never saw
|
|
300
|
+
* the dispatch resolve ownership from the database alone. NULL for pending rows and for rows
|
|
301
|
+
* dispatched before the column existed.
|
|
344
302
|
*/
|
|
345
303
|
agent_id: ColumnType<string | null, string | null | undefined, string | null>;
|
|
346
304
|
/**
|
|
347
|
-
* The coordinator
|
|
348
|
-
* `config.instanceId`, cleared on requeue.
|
|
349
|
-
*
|
|
350
|
-
*
|
|
351
|
-
*
|
|
352
|
-
* cluster-wide sweep has to answer before it acts. A NULL reads as "unknown
|
|
353
|
-
* owner", never as "not mine" — the convention migration 119 established for
|
|
354
|
-
* the scaler plane — so an unknown-owner row is spared by recovery selection
|
|
355
|
-
* and reaped, if genuinely dead, by the stale detector's dispatch-time scan.
|
|
305
|
+
* The coordinator that armed this dispatch's timers, which every cluster-wide sweep must know
|
|
306
|
+
* before it acts. Written at claim/dispatch from `config.instanceId`, cleared on requeue.
|
|
307
|
+
* NULL reads as "unknown owner", never "not mine" (the migration 119 scaler-plane convention):
|
|
308
|
+
* recovery selection spares the row, and the stale detector's dispatch-time scan reaps it if
|
|
309
|
+
* genuinely dead.
|
|
356
310
|
*/
|
|
357
311
|
owner_instance_id: ColumnType<string | null, string | null | undefined, string | null>;
|
|
358
312
|
/**
|
|
359
|
-
* When the row was handed to an agent
|
|
360
|
-
*
|
|
361
|
-
*
|
|
362
|
-
*
|
|
363
|
-
* dispatched before the column existed; readers fall back to `created_at`.
|
|
313
|
+
* When the row was handed to an agent; `created_at` is when it was enqueued. Only this one
|
|
314
|
+
* measures "this dispatch has gone unacknowledged" for a job that waited behind a busy fleet.
|
|
315
|
+
* NULL for pending rows and for rows dispatched before the column existed; readers fall back
|
|
316
|
+
* to `created_at`.
|
|
364
317
|
*/
|
|
365
318
|
dispatched_at: ColumnType<Date | null, Date | null | undefined, Date | null>;
|
|
366
319
|
}
|
|
367
320
|
/**
|
|
368
|
-
* Coordinator
|
|
369
|
-
*
|
|
370
|
-
*
|
|
371
|
-
*
|
|
372
|
-
*
|
|
373
|
-
* the in-memory peer registry because the peer registry is empty at exactly the
|
|
374
|
-
* moment startup recovery runs — a freshly booted process has handshaken with
|
|
375
|
-
* nobody — and because it needs no peer connectivity, so it works the same in
|
|
376
|
-
* non-Raft multi-coordinator and standalone deployments. `host_roster` does the
|
|
377
|
-
* same job for agents.
|
|
321
|
+
* Coordinator heartbeats: the liveness source every ownership predicate reads. Each
|
|
322
|
+
* orchestrator upserts its row on a fixed tick; a `last_heartbeat_at` inside the grace window
|
|
323
|
+
* means alive. A DB heartbeat, not the in-memory peer registry, because that registry is empty
|
|
324
|
+
* when startup recovery runs and because it needs no peer connectivity (non-Raft and standalone
|
|
325
|
+
* deployments work the same). `host_roster` does the same job for agents.
|
|
378
326
|
*/
|
|
379
327
|
export interface ClusterInstancesTable {
|
|
380
328
|
/** The coordinator's instance id (`config.instanceId`). */
|
|
@@ -390,10 +338,7 @@ export interface ClusterInstancesTable {
|
|
|
390
338
|
}
|
|
391
339
|
export type ClusterInstance = Selectable<ClusterInstancesTable>;
|
|
392
340
|
export type NewClusterInstance = Insertable<ClusterInstancesTable>;
|
|
393
|
-
/**
|
|
394
|
-
* Deduplication cache table
|
|
395
|
-
* Tracks recently processed webhook delivery IDs to prevent reprocessing.
|
|
396
|
-
*/
|
|
341
|
+
/** Tracks recently processed webhook delivery IDs to prevent reprocessing. */
|
|
397
342
|
export interface DedupCacheTable {
|
|
398
343
|
/** Webhook delivery ID (primary key) */
|
|
399
344
|
delivery_id: string;
|
|
@@ -435,19 +380,15 @@ export interface IngestOverflowBufferTable {
|
|
|
435
380
|
/** Last replay error, or null. */
|
|
436
381
|
last_error: string | null;
|
|
437
382
|
/**
|
|
438
|
-
* When the row moved `buffered` → `replaying`; null while
|
|
439
|
-
*
|
|
440
|
-
* row is not reclaimed the instant a worker picks it up.
|
|
383
|
+
* When the row moved `buffered` → `replaying`; null while buffered. Separate from
|
|
384
|
+
* `captured_at` (the FIFO drain order) so a long-buffered row is not reclaimed on pickup.
|
|
441
385
|
*/
|
|
442
386
|
claimed_at: ColumnType<Date | null, Date | null | undefined, Date | null>;
|
|
443
387
|
}
|
|
444
388
|
export type DispatchQueueItem = Selectable<DispatchQueueTable>;
|
|
445
389
|
export type NewDispatchQueueItem = Insertable<DispatchQueueTable>;
|
|
446
390
|
export type DispatchQueueItemUpdate = Updateable<DispatchQueueTable>;
|
|
447
|
-
/**
|
|
448
|
-
* IP allocation table for Firecracker VM networking.
|
|
449
|
-
* Tracks assigned IPs from the CIDR pool. DB-backed to survive restarts.
|
|
450
|
-
*/
|
|
391
|
+
/** Firecracker VM IPs assigned from the CIDR pool; DB-backed to survive restarts. */
|
|
451
392
|
export interface IpAllocationTable {
|
|
452
393
|
/** Allocated IP address (primary key), e.g. "10.0.0.5" */
|
|
453
394
|
ip: string;
|
|
@@ -459,14 +400,9 @@ export interface IpAllocationTable {
|
|
|
459
400
|
tap_device: string;
|
|
460
401
|
/** Guest MAC address */
|
|
461
402
|
mac_address: string;
|
|
462
|
-
/** When this IP was allocated */
|
|
463
403
|
allocated_at: Generated<Date>;
|
|
464
404
|
}
|
|
465
|
-
/**
|
|
466
|
-
* Execution run table
|
|
467
|
-
* Top-level workflow runs (one per webhook trigger).
|
|
468
|
-
* Stores status, timing, and trigger decision metadata.
|
|
469
|
-
*/
|
|
405
|
+
/** Top-level workflow runs, one per webhook trigger. */
|
|
470
406
|
export interface ExecutionRunTable {
|
|
471
407
|
/** UUID primary key */
|
|
472
408
|
id: Generated<string>;
|
|
@@ -475,80 +411,64 @@ export interface ExecutionRunTable {
|
|
|
475
411
|
/** Routing key (e.g. github:appId) for Platform StaleOrchDetector when sharing DB */
|
|
476
412
|
routing_key: string | null;
|
|
477
413
|
/**
|
|
478
|
-
* Owning org
|
|
479
|
-
*
|
|
480
|
-
* '__default__' (the no-source fallback org) via the column DEFAULT.
|
|
414
|
+
* Owning org, denormalized from routing_key at insert so the concurrency-gate running count
|
|
415
|
+
* is per tenant. Column DEFAULT '__default__' (the no-source fallback org).
|
|
481
416
|
*/
|
|
482
417
|
customer_id: Generated<string>;
|
|
483
418
|
/** Workflow name from lock file */
|
|
484
419
|
workflow_name: string;
|
|
485
|
-
/** Run status:
|
|
420
|
+
/** Run status: an `ExecutionRunStatus` value (engine). */
|
|
486
421
|
status: Generated<string>;
|
|
487
422
|
/** Provider type (e.g. "github", "gitlab") */
|
|
488
423
|
provider: string;
|
|
489
424
|
/** Repository identifier (e.g. "owner/repo") */
|
|
490
425
|
repo_identifier: string;
|
|
491
426
|
/**
|
|
492
|
-
* The branch (or tag) the run PRESENTS — `event.targetBranch`:
|
|
493
|
-
*
|
|
494
|
-
*
|
|
427
|
+
* The branch (or tag) the run PRESENTS — `event.targetBranch`: where a push landed, a PR's
|
|
428
|
+
* base branch, the default branch a schedule fire executes, or an internal trigger's
|
|
429
|
+
* inherited branch.
|
|
495
430
|
*
|
|
496
|
-
*
|
|
497
|
-
*
|
|
498
|
-
*
|
|
499
|
-
*
|
|
500
|
-
*
|
|
501
|
-
*
|
|
502
|
-
*
|
|
503
|
-
*
|
|
504
|
-
* are the exception: they insert from a `job.reroute` message, which carries
|
|
505
|
-
* only the job's ref. Their row is fail-safe by conflicting — the run is
|
|
506
|
-
* registered before the first job is handed to an agent
|
|
507
|
-
* (`startRunBeforeDispatch`), so a reroute is only possible once the
|
|
508
|
-
* authoritative row exists, and their insert is
|
|
509
|
-
* `ON CONFLICT (run_id) DO NOTHING`.
|
|
431
|
+
* NOT a job's checkout ref: a PR job checks out the HEAD branch, carried in
|
|
432
|
+
* `QueuedJobInput.ref`. Load-bearing: an internally-triggered run inherits this column as its
|
|
433
|
+
* branch claim before the context branch gate matches `branchRestrictions`, and a fork
|
|
434
|
+
* contributor names the head branch freely. Every writer that CREATES the row uses the
|
|
435
|
+
* presented branch. The two reroute projections (`cluster/coordinator.ts`, `worker-core.ts`)
|
|
436
|
+
* insert from a `job.reroute` message carrying only the job's ref; they are fail-safe because
|
|
437
|
+
* the run is registered before the first job reaches an agent (`startRunBeforeDispatch`) and
|
|
438
|
+
* their insert is `ON CONFLICT (run_id) DO NOTHING`.
|
|
510
439
|
*/
|
|
511
440
|
ref: string;
|
|
512
|
-
/** Git commit SHA */
|
|
513
441
|
sha: string;
|
|
514
442
|
/** Webhook delivery ID for tracing */
|
|
515
443
|
delivery_id: string | null;
|
|
516
444
|
/** Serialized WorkflowDecision (trigger decision trace) */
|
|
517
445
|
trigger_decision: string | null;
|
|
518
|
-
/** When the run started */
|
|
519
446
|
started_at: Generated<Date>;
|
|
520
|
-
/** When the run completed */
|
|
521
447
|
completed_at: Date | null;
|
|
522
448
|
/**
|
|
523
|
-
* When the run entered `cancelling`. Stamped once
|
|
524
|
-
*
|
|
525
|
-
*
|
|
526
|
-
* cancelled and for one that entered `cancelling` before the column existed.
|
|
449
|
+
* When the run entered `cancelling`. Stamped once on the transition and never cleared: the
|
|
450
|
+
* only record of when the cancel started, read by the stuck-cancelling re-drive. NULL for a
|
|
451
|
+
* run that never cancelled and for one that entered `cancelling` before the column existed.
|
|
527
452
|
*/
|
|
528
453
|
cancelling_at: ColumnType<Date | null, Date | null | undefined, Date | null>;
|
|
529
454
|
/**
|
|
530
|
-
* TRUE once a forced cancel reached the run (migration 153)
|
|
531
|
-
*
|
|
532
|
-
*
|
|
533
|
-
* not undo a forced one. NULL re-drives gracefully.
|
|
455
|
+
* TRUE once a forced cancel reached the run (migration 153); the stuck-cancelling re-drive
|
|
456
|
+
* re-sends an incomplete cancel with `force`. Never reset to FALSE: a later graceful cancel
|
|
457
|
+
* does not undo a forced one. NULL re-drives gracefully.
|
|
534
458
|
*/
|
|
535
459
|
cancel_force: ColumnType<boolean | null, boolean | null | undefined, boolean | null>;
|
|
536
460
|
/**
|
|
537
|
-
*
|
|
538
|
-
*
|
|
539
|
-
*
|
|
540
|
-
* reopen from a frame that arrives late after the run finished.
|
|
461
|
+
* Status generation (migration 150): starts at 0, +1 each time the run leaves a terminal
|
|
462
|
+
* status to continue. Sent on every `execution.status` frame as `statusEpoch` so the Platform
|
|
463
|
+
* tells a reopen from a late frame.
|
|
541
464
|
*/
|
|
542
465
|
status_epoch: Generated<number>;
|
|
543
466
|
/** Total execution duration in milliseconds */
|
|
544
467
|
duration_ms: number | null;
|
|
545
468
|
/**
|
|
546
|
-
*
|
|
547
|
-
*
|
|
548
|
-
* `
|
|
549
|
-
* rows. Powers the operator-side `kici_org_log_bytes` capacity-planning
|
|
550
|
-
* gauge on the Platform. Postgres BIGINT — pg returns string; cast at
|
|
551
|
-
* read sites.
|
|
469
|
+
* Raw log bytes across all jobs: the sum of the agent's `LogStreamer.getTotalBytes()` on each
|
|
470
|
+
* terminal `step.status`. Default 0 for pre-migration rows. Feeds the Platform's
|
|
471
|
+
* `kici_org_log_bytes` capacity gauge. Postgres BIGINT — pg returns string; cast at read sites.
|
|
552
472
|
*/
|
|
553
473
|
log_bytes: Generated<number>;
|
|
554
474
|
/** Provider-specific context (e.g. {"installationId": 42}) */
|
|
@@ -561,66 +481,50 @@ export interface ExecutionRunTable {
|
|
|
561
481
|
fixture_id: string | null;
|
|
562
482
|
/** Parent run ID for re-run lineage (null for original runs). */
|
|
563
483
|
parent_run_id: string | null;
|
|
564
|
-
/**
|
|
484
|
+
/** First run in the re-run chain (null for original runs). */
|
|
565
485
|
original_run_id: string | null;
|
|
566
|
-
/**
|
|
486
|
+
/** Who triggered this re-run: "user:email" or "key:name" (null for webhook-triggered). */
|
|
567
487
|
triggered_by: string | null;
|
|
568
|
-
/** Agent provenance label when
|
|
488
|
+
/** Agent provenance label when triggered through an agent credential (null otherwise). */
|
|
569
489
|
triggered_by_agent_label: string | null;
|
|
570
490
|
/** User identity that cancelled this run (null for non-cancelled). */
|
|
571
491
|
cancelled_by: string | null;
|
|
572
|
-
/** Agent provenance label when
|
|
492
|
+
/** Agent provenance label when cancelled through an agent credential (null otherwise). */
|
|
573
493
|
cancelled_by_agent_label: string | null;
|
|
574
494
|
/** Context name for this run (null if no context applies) */
|
|
575
495
|
context: string | null;
|
|
576
496
|
/** Matched context id for this run (null if no/unresolved context). */
|
|
577
497
|
context_id: string | null;
|
|
578
498
|
/**
|
|
579
|
-
* The event type that started this run (`push`, `pr:open`, `schedule`, …).
|
|
580
|
-
*
|
|
581
|
-
*
|
|
582
|
-
* protection rules against the run, and a context may restrict which trigger
|
|
583
|
-
* types may use it. NULL means the trigger was never recorded, which fails a
|
|
584
|
-
* `triggerTypeFilters` rule closed — a credential is withheld rather than
|
|
585
|
-
* granted on a rule nobody could check.
|
|
499
|
+
* The event type that started this run (`push`, `pr:open`, `schedule`, …). The git credential
|
|
500
|
+
* relay checks a context's `triggerTypeFilters` against it; NULL (never recorded) fails that
|
|
501
|
+
* rule closed, withholding the credential.
|
|
586
502
|
*/
|
|
587
503
|
trigger_event: string | null;
|
|
588
504
|
/**
|
|
589
|
-
* The event the OIDC token's SUBJECT
|
|
590
|
-
* {@link ExecutionRunTable.trigger_event}.
|
|
591
|
-
*
|
|
592
|
-
*
|
|
593
|
-
*
|
|
594
|
-
*
|
|
595
|
-
* request presented the branch-shaped subject a push to the same base branch
|
|
596
|
-
* presents. A re-run copies the original run's event here so the subject
|
|
597
|
-
* survives the hop.
|
|
598
|
-
*
|
|
599
|
-
* `buildIdTokenSubject` is the ONLY reader. NULL means "use `trigger_event`",
|
|
600
|
-
* which is what every row written before this column existed says, so a
|
|
601
|
-
* legacy row keeps the subject it already mints.
|
|
505
|
+
* The event the OIDC token's SUBJECT derives from, when it differs from
|
|
506
|
+
* {@link ExecutionRunTable.trigger_event}. A re-run records `trigger_event: 'rerun'` (which the
|
|
507
|
+
* dashboard filter and `triggerTypeFilters` read) and copies the original event here, so a
|
|
508
|
+
* re-run of a PR keeps the PR-shaped subject instead of a push's branch-shaped one.
|
|
509
|
+
* `buildIdTokenSubject` is the ONLY reader. NULL means "use `trigger_event`", so a legacy row
|
|
510
|
+
* keeps the subject it already mints.
|
|
602
511
|
*/
|
|
603
512
|
subject_trigger_event: string | null;
|
|
604
513
|
/**
|
|
605
|
-
* The
|
|
606
|
-
*
|
|
607
|
-
* targets. NULL for a non-PR run and for a row written before this column
|
|
608
|
-
* existed.
|
|
514
|
+
* The PR HEAD branch, where a contributor's code lives; {@link ExecutionRunTable.ref} is the
|
|
515
|
+
* base branch. NULL for a non-PR run and for a row written before this column existed.
|
|
609
516
|
*/
|
|
610
517
|
head_ref: string | null;
|
|
611
518
|
/**
|
|
612
|
-
* `owner/repo` of the
|
|
613
|
-
*
|
|
614
|
-
* non-PR run and for a legacy row.
|
|
519
|
+
* `owner/repo` of the PR HEAD: `repo_identifier` for a same-repo PR, the contributor's fork
|
|
520
|
+
* for a fork PR. NULL for a non-PR run and for a legacy row.
|
|
615
521
|
*/
|
|
616
522
|
head_repository: string | null;
|
|
617
523
|
/**
|
|
618
|
-
* True when the
|
|
619
|
-
*
|
|
620
|
-
*
|
|
621
|
-
*
|
|
622
|
-
* `'unresolved'` rather than `'false'`, so a trust policy that pins it fails
|
|
623
|
-
* closed.
|
|
524
|
+
* True when the PR came from a fork (head repo != base repo). NULL means NOT RESOLVED: a
|
|
525
|
+
* legacy row, or a reroute projection (its `job.reroute` message carries no event context).
|
|
526
|
+
* Derived claims render NULL as `'unresolved'`, never `'false'`, so a trust policy pinning it
|
|
527
|
+
* fails closed.
|
|
624
528
|
*/
|
|
625
529
|
is_fork: boolean | null;
|
|
626
530
|
/** Trust tier of the contributor for PR runs (null for non-PR events) */
|
|
@@ -629,151 +533,115 @@ export interface ExecutionRunTable {
|
|
|
629
533
|
lock_file_source: string | null;
|
|
630
534
|
/** Username of the contributor (null for non-PR events) */
|
|
631
535
|
contributor_username: string | null;
|
|
632
|
-
/**
|
|
536
|
+
/**
|
|
537
|
+
* PR number for PR-triggered runs (null for non-PR events). Scopes `/kici approve|reject`
|
|
538
|
+
* hold selection to the comment's PR.
|
|
539
|
+
*/
|
|
633
540
|
pr_number: number | null;
|
|
634
541
|
/**
|
|
635
|
-
* Origin provider of the triggering actor (`github` today
|
|
636
|
-
*
|
|
542
|
+
* Origin provider of the triggering actor (`github` today; provider-generic for later
|
|
543
|
+
* GitLab/Bitbucket). Null when no actor was captured.
|
|
637
544
|
*/
|
|
638
545
|
trigger_actor_provider: string | null;
|
|
639
546
|
/**
|
|
640
|
-
* Provider login of
|
|
641
|
-
*
|
|
547
|
+
* Provider login of whoever triggered the run (pusher / PR author), for ALL event types,
|
|
548
|
+
* unlike the PR-only `contributor_username`.
|
|
642
549
|
*/
|
|
643
550
|
trigger_actor_username: string | null;
|
|
644
551
|
/**
|
|
645
552
|
* Immutable provider user id of the triggering actor (mirrors
|
|
646
|
-
* `identity_links.provider_user_id`)
|
|
647
|
-
*
|
|
553
|
+
* `identity_links.provider_user_id`); preferred over the mutable username when resolving
|
|
554
|
+
* the actor to a KiCI user.
|
|
648
555
|
*/
|
|
649
556
|
trigger_actor_user_id: string | null;
|
|
650
557
|
/**
|
|
651
|
-
* The repository that DEFINES this run's workflow, when
|
|
652
|
-
*
|
|
653
|
-
*
|
|
654
|
-
* `repo_identifier` is the repository the run acted on and whose code its
|
|
655
|
-
* jobs check out. For an organization-wide workflow dispatched against
|
|
656
|
-
* another repository, the workflow was authored somewhere else, and that
|
|
657
|
-
* authoring repository is recorded here. NULL means the two are the same —
|
|
658
|
-
* true of every per-repository run.
|
|
659
|
-
*
|
|
660
|
-
* Read by the rerun path, which must resolve the workflow from the
|
|
661
|
-
* repository that defines it rather than from the one it ran against.
|
|
558
|
+
* The repository that DEFINES this run's workflow, when it differs from `repo_identifier`
|
|
559
|
+
* (the repository acted on and checked out), as for an organization-wide workflow. NULL means
|
|
560
|
+
* the same — every per-repository run. The rerun path resolves the workflow from here.
|
|
662
561
|
*/
|
|
663
562
|
workflow_repo_identifier: string | null;
|
|
664
563
|
/**
|
|
665
|
-
*
|
|
666
|
-
* defined in another repository (`workflow_repo_identifier` set). A re-run
|
|
564
|
+
* Workflow-repository commit dispatched when `workflow_repo_identifier` is set; a re-run
|
|
667
565
|
* dispatches this exact commit. NULL on every per-repository run.
|
|
668
566
|
*/
|
|
669
567
|
workflow_sha: string | null;
|
|
670
568
|
/**
|
|
671
|
-
* The workflow repository's registered branch
|
|
672
|
-
*
|
|
673
|
-
*
|
|
569
|
+
* The workflow repository's registered branch when the workflow lives elsewhere; the
|
|
570
|
+
* git-credential relay checks context branch rules against it. NULL on every per-repository
|
|
571
|
+
* run.
|
|
674
572
|
*/
|
|
675
573
|
workflow_branch: string | null;
|
|
676
574
|
/**
|
|
677
|
-
* True when
|
|
678
|
-
*
|
|
679
|
-
*
|
|
680
|
-
*
|
|
681
|
-
* round that fails is recorded as one errored run so the suppression is
|
|
682
|
-
* visible. Re-running such a run re-executes the evaluation, not a workflow,
|
|
683
|
-
* so the re-run path branches on this column. It is structural on purpose:
|
|
684
|
-
* the round job's `__globaleval__` name prefix is a string a customer
|
|
685
|
-
* workflow may also carry, and a name a customer chooses must not decide
|
|
686
|
-
* which code path a re-run takes.
|
|
575
|
+
* True when the row records a global evaluation round (which decides the org-wide workflows
|
|
576
|
+
* for an event; a failed round is one errored run so the suppression is visible). The re-run
|
|
577
|
+
* path branches on it to re-execute the evaluation. Structural on purpose: the round job's
|
|
578
|
+
* `__globaleval__` name prefix is a string a customer workflow may also carry.
|
|
687
579
|
*/
|
|
688
580
|
is_global_eval_round: Generated<boolean>;
|
|
689
581
|
/**
|
|
690
|
-
* The source whose credentials `provider_context` holds, when
|
|
691
|
-
*
|
|
692
|
-
*
|
|
693
|
-
*
|
|
694
|
-
*
|
|
695
|
-
* context is written from that source's credentials — so anything pairing
|
|
696
|
-
* `routing_key` with `provider_context` hands one source's credentials to
|
|
697
|
-
* another source's API client. NULL means the two are the same, which is true
|
|
698
|
-
* of every ordinary run.
|
|
699
|
-
*
|
|
700
|
-
* Read by the rerun path of a failed evaluation round, which re-drives the
|
|
701
|
-
* organization-wide pass and has to hand it the same dispatch pair the
|
|
702
|
-
* delivery used.
|
|
582
|
+
* The source whose credentials `provider_context` holds, when not the INBOUND source in
|
|
583
|
+
* `routing_key` (a cross-provider global workflow resolves through another source's bundle).
|
|
584
|
+
* Pairing `routing_key` with `provider_context` there would hand one source's credentials to
|
|
585
|
+
* another's API client. NULL means the same — every ordinary run. The rerun path of a failed
|
|
586
|
+
* evaluation round reads it to re-drive the org-wide pass with the delivery's dispatch pair.
|
|
703
587
|
*/
|
|
704
588
|
dispatch_routing_key: string | null;
|
|
705
589
|
/** Human-readable reason why the run failed (null for non-failed runs). */
|
|
706
590
|
failure_reason: string | null;
|
|
707
591
|
/**
|
|
708
|
-
*
|
|
709
|
-
* /
|
|
710
|
-
*
|
|
592
|
+
* `RunFailureClass` (`@kici-dev/engine`): never_started / timed_out / dead_orchestrator /
|
|
593
|
+
* step_failure / cancelled, derived at completion from the terminal job statuses. NULL for
|
|
594
|
+
* success / not-yet-terminal.
|
|
711
595
|
*/
|
|
712
596
|
failure_class: string | null;
|
|
713
597
|
/**
|
|
714
|
-
*
|
|
715
|
-
*
|
|
716
|
-
*
|
|
717
|
-
* provider context, agent spawn). NULL for normal runs.
|
|
598
|
+
* `InitFailure` (`@kici-dev/engine`) detail. Non-null means the run never executed a step
|
|
599
|
+
* because the init phase failed (lock-file fetch, provider context, agent spawn). NULL for
|
|
600
|
+
* normal runs.
|
|
718
601
|
*/
|
|
719
602
|
init_failure: ColumnType<InitFailure | null, unknown, unknown>;
|
|
720
603
|
/**
|
|
721
|
-
* Whole-run wall-clock timeout in ms from the workflow lock
|
|
722
|
-
*
|
|
723
|
-
* the other `*_ms` columns, so pg returns a plain number.
|
|
604
|
+
* Whole-run wall-clock timeout in ms from the workflow lock (null = unset), read by the
|
|
605
|
+
* WorkflowDeadlineDetector. INTEGER like the other `*_ms` columns, so pg returns a number.
|
|
724
606
|
*/
|
|
725
607
|
workflow_timeout_ms: ColumnType<number | null, number | null | undefined, number | null>;
|
|
726
|
-
/** When this record was created */
|
|
727
608
|
created_at: Generated<Date>;
|
|
728
609
|
/**
|
|
729
|
-
*
|
|
730
|
-
*
|
|
731
|
-
* labels the run a check-mode preview in the dashboard.
|
|
610
|
+
* Idempotent-step mode (`CheckMode`: `apply` | `check` | `check-fail-on-drift`). NULL means a
|
|
611
|
+
* legacy/apply run; a non-apply value labels the run a check-mode preview in the dashboard.
|
|
732
612
|
*/
|
|
733
613
|
check_mode: string | null;
|
|
734
614
|
/**
|
|
735
|
-
* Set inside the cold-store archive transaction before the row is
|
|
736
|
-
*
|
|
737
|
-
* "promote-chunk-back-into-PG" path can restore rows with
|
|
738
|
-
* their original archive pointer.
|
|
615
|
+
* Set inside the cold-store archive transaction before the row is DELETEd; survivors carry
|
|
616
|
+
* NULL. Lets the promote-chunk-back-into-PG path restore rows with their archive pointer.
|
|
739
617
|
*/
|
|
740
618
|
archived_at: Date | null;
|
|
741
619
|
/** S3 object key of the chunk that carried this row; see `archived_at`. */
|
|
742
620
|
archive_object_key: string | null;
|
|
743
|
-
/**
|
|
744
|
-
* For a run summoned by an invoke gate, the summoning (global) run's id. NULL
|
|
745
|
-
* for every run not summoned by a gate.
|
|
746
|
-
*/
|
|
621
|
+
/** The summoning (global) run's id for a gate-summoned run; NULL otherwise. */
|
|
747
622
|
summoned_by_run_id: string | null;
|
|
748
623
|
/**
|
|
749
|
-
*
|
|
750
|
-
*
|
|
624
|
+
* The summoning run's proxy job to update when this run completes; NULL for every run not
|
|
625
|
+
* summoned by a gate.
|
|
751
626
|
*/
|
|
752
627
|
summoned_by_proxy_job: string | null;
|
|
753
628
|
/**
|
|
754
|
-
*
|
|
755
|
-
*
|
|
756
|
-
*
|
|
757
|
-
* breaker bounds recursion. Defaults to 0.
|
|
629
|
+
* Invoke-chain depth: 0 for a webhook-triggered run, the summoner's depth + 1 for a summoned
|
|
630
|
+
* one. Read when this run fires its own invoke gate so the chain-depth circuit breaker bounds
|
|
631
|
+
* recursion. Defaults to 0.
|
|
758
632
|
*/
|
|
759
633
|
chain_depth: Generated<number>;
|
|
760
634
|
/**
|
|
761
|
-
* The coordinator whose dispatch pipeline still has jobs to register for
|
|
762
|
-
*
|
|
763
|
-
*
|
|
764
|
-
*
|
|
765
|
-
*
|
|
766
|
-
*
|
|
767
|
-
* `owner_instance_id` predicates use). A dead holder's id reads as no
|
|
768
|
-
* window. NULL for every run with no window open and every row written
|
|
769
|
-
* before the column existed.
|
|
635
|
+
* The coordinator whose dispatch pipeline still has jobs to register for this run: the
|
|
636
|
+
* durable form of the pending-jobs token (`ExecutionTracker.holdRunForPendingJobs`). Written
|
|
637
|
+
* on its first token, cleared on its last; every finalization path defers while it names a
|
|
638
|
+
* LIVE sibling (liveness from `cluster_instances`, as the dispatch queue's
|
|
639
|
+
* `owner_instance_id` predicates read it). A dead holder reads as no window. NULL with no
|
|
640
|
+
* window open and on rows written before the column existed.
|
|
770
641
|
*/
|
|
771
642
|
registration_window_instance_id: string | null;
|
|
772
643
|
}
|
|
773
|
-
/**
|
|
774
|
-
* Execution job table
|
|
775
|
-
* Individual jobs within a run (including matrix expansions).
|
|
776
|
-
*/
|
|
644
|
+
/** Individual jobs within a run, including matrix expansions. */
|
|
777
645
|
export interface ExecutionJobTable {
|
|
778
646
|
/** UUID primary key */
|
|
779
647
|
id: Generated<string>;
|
|
@@ -783,48 +651,38 @@ export interface ExecutionJobTable {
|
|
|
783
651
|
job_id: string;
|
|
784
652
|
/** Job name (e.g. "test", "test[node-18]") */
|
|
785
653
|
job_name: string;
|
|
786
|
-
/** Job status:
|
|
654
|
+
/** Job status: an `ExecutionJobStatus` value (engine). */
|
|
787
655
|
status: Generated<string>;
|
|
788
656
|
/**
|
|
789
|
-
* Operator-facing reason
|
|
790
|
-
*
|
|
791
|
-
*
|
|
792
|
-
* or scaler backend appears. NULL whenever the job is routable.
|
|
657
|
+
* Operator-facing reason the job cannot be routed to any agent. Written by the unroutable
|
|
658
|
+
* probe while queued, so the cause shows before the job terminalizes; cleared when a matching
|
|
659
|
+
* agent or scaler backend appears. NULL whenever the job is routable.
|
|
793
660
|
*/
|
|
794
661
|
routing_reason: ColumnType<string | null, string | null | undefined, string | null>;
|
|
795
|
-
/**
|
|
796
|
-
* Matrix values JSON (e.g. {"node": "18"}). JSONB: the driver returns a parsed
|
|
797
|
-
* object on SELECT, while writers pass a `JSON.stringify` string.
|
|
798
|
-
*/
|
|
662
|
+
/** Matrix values JSONB (e.g. {"node": "18"}); writers pass a `JSON.stringify` string. */
|
|
799
663
|
matrix_values: ColumnType<Record<string, unknown> | null, string | null, string | null>;
|
|
800
664
|
/** Agent ID that ran this job */
|
|
801
665
|
agent_id: string | null;
|
|
802
|
-
/** When the job started */
|
|
803
666
|
started_at: Date | null;
|
|
804
|
-
/** When the job completed */
|
|
805
667
|
completed_at: Date | null;
|
|
806
668
|
/** Job execution duration in milliseconds */
|
|
807
669
|
duration_ms: number | null;
|
|
808
670
|
/**
|
|
809
|
-
*
|
|
810
|
-
*
|
|
811
|
-
*
|
|
812
|
-
* Postgres BIGINT — pg returns string; cast at read sites.
|
|
671
|
+
* Raw log bytes across the job's steps (agent `LogStreamer.getTotalBytes()` on each terminal
|
|
672
|
+
* `step.status`). Default 0 for pre-migration rows. Postgres BIGINT — pg returns string; cast
|
|
673
|
+
* at read sites.
|
|
813
674
|
*/
|
|
814
675
|
log_bytes: Generated<number>;
|
|
815
|
-
/** Error info if failed */
|
|
816
676
|
error_message: string | null;
|
|
817
677
|
/**
|
|
818
|
-
*
|
|
819
|
-
*
|
|
820
|
-
* because something failed during init (lock-file fetch, provider
|
|
821
|
-
* context, agent spawn). NULL for normal runs.
|
|
678
|
+
* `InitFailure` (`@kici-dev/engine`) detail. Non-null means the job never executed a step
|
|
679
|
+
* because init failed (lock-file fetch, provider context, agent spawn). NULL for normal runs.
|
|
822
680
|
*/
|
|
823
681
|
init_failure: ColumnType<InitFailure | null, unknown, unknown>;
|
|
824
682
|
/**
|
|
825
|
-
*
|
|
826
|
-
*
|
|
827
|
-
*
|
|
683
|
+
* Agent-routing labels JSONB (e.g. ["kici:os:linux", "kici:arch:x64"]); writers pass a
|
|
684
|
+
* `JSON.stringify` string. The driver returns a parsed array: re-parsing it as a string
|
|
685
|
+
* yields null for every job.
|
|
828
686
|
*/
|
|
829
687
|
runs_on_labels: ColumnType<string[] | null, string | null, string | null>;
|
|
830
688
|
/** Last heartbeat received from agent (for stale run detection) */
|
|
@@ -834,27 +692,19 @@ export interface ExecutionJobTable {
|
|
|
834
692
|
/** Aggregated step outputs JSONB (step-keyed map of outputs). Populated on job success. */
|
|
835
693
|
outputs: string | null;
|
|
836
694
|
/**
|
|
837
|
-
* Ordered bound deployment-context names
|
|
838
|
-
*
|
|
839
|
-
* overwritten with the agent-resolved list for dynamic contexts.
|
|
695
|
+
* Ordered bound deployment-context names, JSON `string[]` (null when none). Written at
|
|
696
|
+
* dispatch; overwritten with the agent-resolved list for dynamic contexts.
|
|
840
697
|
*/
|
|
841
698
|
contexts: string | null;
|
|
842
699
|
/**
|
|
843
|
-
* The `gitCredentials` map
|
|
844
|
-
*
|
|
845
|
-
*
|
|
846
|
-
* `
|
|
700
|
+
* The lock entry's `gitCredentials` map: server truth the credential relay reads on every git
|
|
701
|
+
* network operation. JSONB; writers pass a `JSON.stringify` string. Copied verbatim because
|
|
702
|
+
* the relay compares byte for byte: `<name>Secret` is a qualified `<context>:<key>` secret
|
|
703
|
+
* NAME, and `<name>Value` is material for a credential with no store entry.
|
|
847
704
|
*
|
|
848
|
-
*
|
|
849
|
-
*
|
|
850
|
-
*
|
|
851
|
-
* credential with no store entry to name.
|
|
852
|
-
*
|
|
853
|
-
* This row is written after the dispatch loop, so NULL means either "the job
|
|
854
|
-
* declared none" or "the row has not caught up with the dispatch yet". The
|
|
855
|
-
* relay does not guess between them — `git/job-context.ts` reads the job's
|
|
856
|
-
* dispatch record, which carries the same declaration and is written before
|
|
857
|
-
* the agent is told about the job.
|
|
705
|
+
* Written after the dispatch loop, so NULL means "declared none" or "not caught up yet"; the
|
|
706
|
+
* relay does not guess — `git/job-context.ts` reads the dispatch record, which carries the
|
|
707
|
+
* same declaration and is written before the agent learns of the job.
|
|
858
708
|
*/
|
|
859
709
|
git_credentials: ColumnType<Record<string, Record<string, string>> | null, string | null, string | null>;
|
|
860
710
|
/**
|
|
@@ -877,93 +727,72 @@ export interface ExecutionJobTable {
|
|
|
877
727
|
/** Fan-out label for a child: matrix suffix or hostname. NULL for non-fanned jobs. */
|
|
878
728
|
variant_label: string | null;
|
|
879
729
|
/**
|
|
880
|
-
* Wave gate: a fan-out child beyond the
|
|
881
|
-
*
|
|
882
|
-
*
|
|
883
|
-
* held by a rolling wave.
|
|
730
|
+
* Wave gate: `true` holds a fan-out child beyond the `maxParallel` window instead of
|
|
731
|
+
* dispatching it; the wave-scheduler clears it when a sibling terminates and frees a slot.
|
|
732
|
+
* NULL/false for any job not held by a rolling wave.
|
|
884
733
|
*/
|
|
885
734
|
wave_gated: Generated<boolean>;
|
|
886
|
-
/** The fan-out base's `maxParallel
|
|
735
|
+
/** The fan-out base's `maxParallel`, stamped on every child. NULL = no bounded wave. */
|
|
887
736
|
wave_max_parallel: number | null;
|
|
888
737
|
/** The fan-out base's `failFast` policy, stamped on every child. NULL = no bounded wave. */
|
|
889
738
|
wave_fail_fast: boolean | null;
|
|
890
739
|
/** Instance id of the worker peer this job was rerouted to, or null if local. */
|
|
891
740
|
rerouted_to_peer: string | null;
|
|
892
|
-
/** When this record was created */
|
|
893
741
|
created_at: Generated<Date>;
|
|
894
742
|
/**
|
|
895
|
-
*
|
|
896
|
-
*
|
|
897
|
-
* if an insert site doesn't populate it, the cold-store adapter
|
|
898
|
-
* skips the row.
|
|
743
|
+
* Copied from execution_runs at insert; the cold-store partition tenant. NULLable for safety:
|
|
744
|
+
* the cold-store adapter skips a row an insert site left without it.
|
|
899
745
|
*/
|
|
900
746
|
routing_key: string | null;
|
|
901
747
|
/** Cold-store archive marker — see ExecutionRunTable.archived_at. */
|
|
902
748
|
archived_at: Date | null;
|
|
903
749
|
/** S3 object key of the chunk that carried this row. */
|
|
904
750
|
archive_object_key: string | null;
|
|
905
|
-
/**
|
|
906
|
-
* Job kind (`JobKind`): `standard` runs steps on an agent, `gate` is an
|
|
907
|
-
* invoke gate, `proxy` mirrors a summoned run. Defaults to `standard`.
|
|
908
|
-
*/
|
|
751
|
+
/** `JobKind`; defaults to `standard`. */
|
|
909
752
|
job_kind: Generated<string>;
|
|
910
753
|
/** For a `proxy` job, the summoned run it mirrors. NULL for every other kind. */
|
|
911
754
|
summoned_run_id: string | null;
|
|
912
755
|
/**
|
|
913
|
-
*
|
|
914
|
-
*
|
|
915
|
-
*
|
|
916
|
-
* proxies have not all terminalized in time. NULL = no gate timeout.
|
|
756
|
+
* A `gate` job's wall-clock timeout in ms, copied from the lock job. A gate runs no agent
|
|
757
|
+
* steps, so no agent-side timeout fires; the orchestrator sweeps this column and fails a gate
|
|
758
|
+
* whose proxies have not all terminalized in time. NULL = no gate timeout.
|
|
917
759
|
*/
|
|
918
760
|
timeout_ms: number | null;
|
|
919
761
|
/**
|
|
920
|
-
* The
|
|
921
|
-
*
|
|
922
|
-
*
|
|
923
|
-
*
|
|
924
|
-
* object on SELECT, while writers pass a `JSON.stringify` string. NULL for
|
|
925
|
-
* every ordinary job and for a precursor job that has not reached a
|
|
926
|
-
* terminal state.
|
|
762
|
+
* The `PrecursorResult` a build / init / dynamic-eval job reported on its terminal
|
|
763
|
+
* `job.status`, persisted so any coordinator can settle its pending tracker from the shared
|
|
764
|
+
* row. JSONB; writers pass a `JSON.stringify` string. NULL for ordinary jobs and for a
|
|
765
|
+
* precursor job not yet terminal.
|
|
927
766
|
*/
|
|
928
767
|
precursor_result: ColumnType<PrecursorResult | null, string | null | undefined, string | null>;
|
|
929
768
|
}
|
|
930
|
-
/**
|
|
931
|
-
* Execution step table
|
|
932
|
-
* Individual steps within a job.
|
|
933
|
-
*/
|
|
769
|
+
/** Individual steps within a job. */
|
|
934
770
|
export interface ExecutionStepTable {
|
|
935
771
|
/** UUID primary key */
|
|
936
772
|
id: Generated<string>;
|
|
937
773
|
/** References execution_runs.run_id */
|
|
938
774
|
run_id: string;
|
|
939
|
-
/** Job identifier */
|
|
940
775
|
job_id: string;
|
|
941
776
|
/** Step index within the job (0-based) */
|
|
942
777
|
step_index: number;
|
|
943
|
-
/** Step name */
|
|
944
778
|
step_name: string;
|
|
945
|
-
/** Step status:
|
|
779
|
+
/** Step status: an `ExecutionStepStatus` value (engine). */
|
|
946
780
|
status: Generated<string>;
|
|
947
|
-
/** When the step started */
|
|
948
781
|
started_at: Date | null;
|
|
949
|
-
/** When the step completed */
|
|
950
782
|
completed_at: Date | null;
|
|
951
783
|
/** Step execution duration in milliseconds */
|
|
952
784
|
duration_ms: number | null;
|
|
953
|
-
/** Process exit code */
|
|
954
785
|
exit_code: number | null;
|
|
955
|
-
/** Error info if failed */
|
|
956
786
|
error_message: string | null;
|
|
957
787
|
/** Path in storage backend (e.g. "executions/{runId}/job-test/step-0.log") */
|
|
958
788
|
log_path: string | null;
|
|
959
789
|
/** Step type: 'step' for regular steps, 'hook:onCancel', 'hook:cleanup', etc. for hooks */
|
|
960
790
|
step_type: Generated<string>;
|
|
961
|
-
/** JSON array of secret context names
|
|
791
|
+
/** JSON array of secret context names the step accessed. NULL = not tracked (old runs). */
|
|
962
792
|
secrets_accessed: string | null;
|
|
963
793
|
/**
|
|
964
|
-
*
|
|
965
|
-
*
|
|
966
|
-
* mode. Orthogonal to `status`.
|
|
794
|
+
* `CheckStepOutcome`: skipped | applied | declined | dry-run | no_check. NULL when the step
|
|
795
|
+
* ran without a check mode. Orthogonal to `status`.
|
|
967
796
|
*/
|
|
968
797
|
check_outcome: string | null;
|
|
969
798
|
/** Human-readable drift summary (`summarize(drift)`). NULL when no drift. */
|
|
@@ -977,12 +806,8 @@ export interface ExecutionStepTable {
|
|
|
977
806
|
concurrency_kind: string | null;
|
|
978
807
|
/** Parallel-group correlation id shared by a group's children. NULL for sequential steps. */
|
|
979
808
|
group_id: string | null;
|
|
980
|
-
/** When this record was created */
|
|
981
809
|
created_at: Generated<Date>;
|
|
982
|
-
/**
|
|
983
|
-
* Denormalized routing_key copied from execution_runs at insert time.
|
|
984
|
-
* Used by cold-store as the partition tenant. NULLable for safety.
|
|
985
|
-
*/
|
|
810
|
+
/** Copied from execution_runs at insert; the cold-store partition tenant. NULLable for safety. */
|
|
986
811
|
routing_key: string | null;
|
|
987
812
|
/** Cold-store archive marker — see ExecutionRunTable.archived_at. */
|
|
988
813
|
archived_at: Date | null;
|
|
@@ -999,9 +824,8 @@ export type ExecutionStep = Selectable<ExecutionStepTable>;
|
|
|
999
824
|
export type NewExecutionStep = Insertable<ExecutionStepTable>;
|
|
1000
825
|
export type ExecutionStepUpdate = Updateable<ExecutionStepTable>;
|
|
1001
826
|
/**
|
|
1002
|
-
*
|
|
1003
|
-
*
|
|
1004
|
-
* Static-to-static edges inserted at run start; group edges after resolution.
|
|
827
|
+
* One row per concrete dependency edge in a run: static-to-static edges at run start, group
|
|
828
|
+
* edges after resolution.
|
|
1005
829
|
*/
|
|
1006
830
|
export interface ExecutionJobNeedsTable {
|
|
1007
831
|
/** References execution_runs.run_id */
|
|
@@ -1011,43 +835,32 @@ export interface ExecutionJobNeedsTable {
|
|
|
1011
835
|
/** Upstream job name (the job that must complete first) */
|
|
1012
836
|
upstream_name: string;
|
|
1013
837
|
/**
|
|
1014
|
-
*
|
|
1015
|
-
*
|
|
1016
|
-
* `'["success"]'`. The downstream dispatches when the upstream's terminal
|
|
1017
|
-
* status is a member of this set.
|
|
838
|
+
* JSON `ExecutionJobStatus[]` of upstream terminal statuses that satisfy the edge (default
|
|
839
|
+
* `'["success"]'`); the downstream dispatches when the upstream ends in one of them.
|
|
1018
840
|
*/
|
|
1019
841
|
run_on: Generated<string>;
|
|
1020
842
|
}
|
|
1021
843
|
export type ExecutionJobNeeds = Selectable<ExecutionJobNeedsTable>;
|
|
1022
844
|
export type NewExecutionJobNeeds = Insertable<ExecutionJobNeedsTable>;
|
|
1023
|
-
/**
|
|
1024
|
-
* Raft consensus state table
|
|
1025
|
-
* Persistent state for Raft leader election across orchestrator cluster.
|
|
1026
|
-
* Single row per cluster (default cluster_id = 'default').
|
|
1027
|
-
*/
|
|
845
|
+
/** Raft leader-election state, one row per cluster (default cluster_id = 'default'). */
|
|
1028
846
|
export interface RaftStateTable {
|
|
1029
847
|
/** Cluster identifier (primary key). Default 'default'. */
|
|
1030
848
|
cluster_id: Generated<string>;
|
|
1031
|
-
/** Current Raft term */
|
|
1032
849
|
current_term: Generated<number>;
|
|
1033
850
|
/** Instance ID this node voted for in the current term */
|
|
1034
851
|
voted_for: string | null;
|
|
1035
852
|
/** Current known leader instance ID */
|
|
1036
853
|
leader_id: string | null;
|
|
1037
|
-
/** When this state was last updated */
|
|
1038
854
|
updated_at: Generated<Date>;
|
|
1039
855
|
}
|
|
1040
856
|
export type RaftState = Selectable<RaftStateTable>;
|
|
1041
857
|
export type RaftStateUpdate = Updateable<RaftStateTable>;
|
|
1042
858
|
/**
|
|
1043
|
-
*
|
|
1044
|
-
* Named deployment contexts with concurrency, branch restrictions, and approval rules.
|
|
1045
|
-
* Scoped to an organization.
|
|
859
|
+
* Org-scoped named deployment contexts with concurrency, branch restrictions and approval rules.
|
|
1046
860
|
*/
|
|
1047
861
|
export interface ContextsTable {
|
|
1048
862
|
/** UUID primary key */
|
|
1049
863
|
id: Generated<string>;
|
|
1050
|
-
/** Organization ID */
|
|
1051
864
|
org_id: string;
|
|
1052
865
|
/** Context name (unique within org) */
|
|
1053
866
|
name: string;
|
|
@@ -1064,9 +877,8 @@ export interface ContextsTable {
|
|
|
1064
877
|
/** Max concurrent runs (null = unlimited) */
|
|
1065
878
|
concurrency_limit: number | null;
|
|
1066
879
|
/**
|
|
1067
|
-
*
|
|
1068
|
-
*
|
|
1069
|
-
* written by another orchestrator version always maps (null = unset).
|
|
880
|
+
* `ConcurrencyStrategy` (`@kici-dev/engine`) applied when concurrency is exceeded; a plain
|
|
881
|
+
* `string` so a row from another orchestrator version always maps (null = unset).
|
|
1070
882
|
*/
|
|
1071
883
|
concurrency_strategy: Generated<string | null>;
|
|
1072
884
|
/** Timeout for queued runs in milliseconds */
|
|
@@ -1081,30 +893,21 @@ export interface ContextsTable {
|
|
|
1081
893
|
minimum_trust: string | null;
|
|
1082
894
|
/** Whether this context allows local (no-remote) executions. Default false. */
|
|
1083
895
|
allow_local_execution: Generated<boolean>;
|
|
1084
|
-
/** Whether this context is active */
|
|
1085
896
|
enabled: Generated<boolean>;
|
|
1086
|
-
/** When this context was created */
|
|
1087
897
|
created_at: Generated<Date>;
|
|
1088
|
-
/** When this context was last updated */
|
|
1089
898
|
updated_at: Generated<Date>;
|
|
1090
|
-
/** Who created this context */
|
|
1091
899
|
created_by: string | null;
|
|
1092
900
|
}
|
|
1093
901
|
export type Context = Selectable<ContextsTable>;
|
|
1094
902
|
export type NewContext = Insertable<ContextsTable>;
|
|
1095
903
|
export type ContextUpdate = Updateable<ContextsTable>;
|
|
1096
|
-
/**
|
|
1097
|
-
* Scoped secrets table
|
|
1098
|
-
* Encrypted key-value pairs scoped to org + scope (e.g. context name, repo pattern).
|
|
1099
|
-
*/
|
|
904
|
+
/** Encrypted key-value pairs scoped to org + scope (e.g. context name, repo pattern). */
|
|
1100
905
|
export interface ScopedSecretsTable {
|
|
1101
906
|
/** UUID primary key */
|
|
1102
907
|
id: Generated<string>;
|
|
1103
|
-
/** Organization ID */
|
|
1104
908
|
org_id: string;
|
|
1105
909
|
/** Scope identifier (e.g. context name, repo pattern) */
|
|
1106
910
|
scope: string;
|
|
1107
|
-
/** Secret key name */
|
|
1108
911
|
key: string;
|
|
1109
912
|
/** Encrypted secret value */
|
|
1110
913
|
encrypted_value: string;
|
|
@@ -1112,22 +915,16 @@ export interface ScopedSecretsTable {
|
|
|
1112
915
|
backend_type: Generated<string>;
|
|
1113
916
|
/** Version of the encryption key used */
|
|
1114
917
|
key_version: Generated<number>;
|
|
1115
|
-
/** When this secret was created */
|
|
1116
918
|
created_at: Generated<Date>;
|
|
1117
|
-
/** When this secret was last updated */
|
|
1118
919
|
updated_at: Generated<Date>;
|
|
1119
920
|
}
|
|
1120
921
|
export type ScopedSecret = Selectable<ScopedSecretsTable>;
|
|
1121
922
|
export type NewScopedSecret = Insertable<ScopedSecretsTable>;
|
|
1122
923
|
export type ScopedSecretUpdate = Updateable<ScopedSecretsTable>;
|
|
1123
|
-
/**
|
|
1124
|
-
* Context bindings table
|
|
1125
|
-
* Links contexts to scope patterns (e.g. workflow names, repo identifiers).
|
|
1126
|
-
*/
|
|
924
|
+
/** Links contexts to scope patterns (e.g. workflow names, repo identifiers). */
|
|
1127
925
|
export interface ContextBindingsTable {
|
|
1128
926
|
/** UUID primary key */
|
|
1129
927
|
id: Generated<string>;
|
|
1130
|
-
/** Organization ID */
|
|
1131
928
|
org_id: string;
|
|
1132
929
|
/** Context ID (FK to contexts.id, cascade delete) */
|
|
1133
930
|
context_id: string;
|
|
@@ -1139,80 +936,56 @@ export interface ContextBindingsTable {
|
|
|
1139
936
|
* host.
|
|
1140
937
|
*/
|
|
1141
938
|
host_pattern: Generated<string>;
|
|
1142
|
-
/** When this binding was created */
|
|
1143
939
|
created_at: Generated<Date>;
|
|
1144
940
|
}
|
|
1145
941
|
export type ContextBinding = Selectable<ContextBindingsTable>;
|
|
1146
942
|
export type NewContextBinding = Insertable<ContextBindingsTable>;
|
|
1147
|
-
/**
|
|
1148
|
-
* Context variables table
|
|
1149
|
-
* Non-secret key-value pairs attached to a context.
|
|
1150
|
-
*/
|
|
943
|
+
/** Non-secret key-value pairs attached to a context. */
|
|
1151
944
|
export interface ContextVariablesTable {
|
|
1152
945
|
/** UUID primary key */
|
|
1153
946
|
id: Generated<string>;
|
|
1154
|
-
/** Organization ID */
|
|
1155
947
|
org_id: string;
|
|
1156
948
|
/** Context ID (FK to contexts.id, cascade delete) */
|
|
1157
949
|
context_id: string;
|
|
1158
|
-
/** Variable key name */
|
|
1159
950
|
key: string;
|
|
1160
|
-
/** Variable value */
|
|
1161
951
|
value: string;
|
|
1162
952
|
/** Whether this variable is locked (cannot be overridden by workflow) */
|
|
1163
953
|
locked: Generated<boolean>;
|
|
1164
|
-
/** When this variable was created */
|
|
1165
954
|
created_at: Generated<Date>;
|
|
1166
|
-
/** When this variable was last updated */
|
|
1167
955
|
updated_at: Generated<Date>;
|
|
1168
956
|
}
|
|
1169
957
|
export type ContextVariable = Selectable<ContextVariablesTable>;
|
|
1170
958
|
export type NewContextVariable = Insertable<ContextVariablesTable>;
|
|
1171
959
|
export type ContextVariableUpdate = Updateable<ContextVariablesTable>;
|
|
1172
|
-
/**
|
|
1173
|
-
* Context source overrides table
|
|
1174
|
-
* Per-source (routing key) variable overrides within a context.
|
|
1175
|
-
*/
|
|
960
|
+
/** Per-source (routing key) variable overrides within a context. */
|
|
1176
961
|
export interface ContextSourceOverridesTable {
|
|
1177
962
|
/** UUID primary key */
|
|
1178
963
|
id: Generated<string>;
|
|
1179
|
-
/** Organization ID */
|
|
1180
964
|
org_id: string;
|
|
1181
965
|
/** Context ID (FK to contexts.id, cascade delete) */
|
|
1182
966
|
context_id: string;
|
|
1183
|
-
/** Routing key for the source */
|
|
1184
967
|
routing_key: string;
|
|
1185
|
-
/** Override key name */
|
|
1186
968
|
key: string;
|
|
1187
|
-
/** Override value */
|
|
1188
969
|
value: string;
|
|
1189
|
-
/** When this override was created */
|
|
1190
970
|
created_at: Generated<Date>;
|
|
1191
|
-
/** When this override was last updated */
|
|
1192
971
|
updated_at: Generated<Date>;
|
|
1193
972
|
}
|
|
1194
973
|
export type ContextSourceOverride = Selectable<ContextSourceOverridesTable>;
|
|
1195
974
|
export type NewContextSourceOverride = Insertable<ContextSourceOverridesTable>;
|
|
1196
975
|
export type ContextSourceOverrideUpdate = Updateable<ContextSourceOverridesTable>;
|
|
1197
|
-
/**
|
|
1198
|
-
* Held runs table
|
|
1199
|
-
* Tracks runs waiting for approval, wait timer, or concurrency slot.
|
|
1200
|
-
*/
|
|
976
|
+
/** Tracks runs waiting for approval, wait timer, or concurrency slot. */
|
|
1201
977
|
export interface HeldRunsTable {
|
|
1202
978
|
/** UUID primary key */
|
|
1203
979
|
id: Generated<string>;
|
|
1204
|
-
/** Organization ID */
|
|
1205
980
|
org_id: string;
|
|
1206
981
|
/** Run ID (references execution_runs) */
|
|
1207
982
|
run_id: string;
|
|
1208
|
-
/** Job ID within the run */
|
|
1209
983
|
job_id: string;
|
|
1210
984
|
/** Context ID (FK to contexts.id); null once the context is deleted */
|
|
1211
985
|
context_id: string | null;
|
|
1212
986
|
/**
|
|
1213
|
-
*
|
|
1214
|
-
*
|
|
1215
|
-
* different orchestrator version is never rejected.
|
|
987
|
+
* Engine `HoldType` ('reviewer' | 'timer' | 'concurrency' | 'security'). A plain `string`
|
|
988
|
+
* so a row from a different orchestrator version is never rejected.
|
|
1216
989
|
*/
|
|
1217
990
|
hold_type: string;
|
|
1218
991
|
/** Hold status: 'pending' | 'approved' | 'rejected' | 'expired' | 'released' */
|
|
@@ -1223,11 +996,8 @@ export interface HeldRunsTable {
|
|
|
1223
996
|
reason: string | null;
|
|
1224
997
|
/** Who approved/rejected this hold */
|
|
1225
998
|
approved_by: string | null;
|
|
1226
|
-
/** When this hold was created */
|
|
1227
999
|
created_at: Generated<Date>;
|
|
1228
|
-
/** When this hold expires */
|
|
1229
1000
|
expires_at: Date;
|
|
1230
|
-
/** When this hold was resolved */
|
|
1231
1001
|
resolved_at: Date | null;
|
|
1232
1002
|
/**
|
|
1233
1003
|
* Hold granularity: 'workflow' | 'job' | 'step' (engine `HoldScope`).
|
|
@@ -1253,13 +1023,10 @@ export interface HeldRunsTable {
|
|
|
1253
1023
|
*/
|
|
1254
1024
|
payload: ColumnType<StepApprovalPayload | null, StepApprovalPayload | string | null | undefined, StepApprovalPayload | string | null>;
|
|
1255
1025
|
/**
|
|
1256
|
-
* Whether
|
|
1257
|
-
*
|
|
1258
|
-
*
|
|
1259
|
-
*
|
|
1260
|
-
*
|
|
1261
|
-
* Read through `postedPendingSecurityCheck`. It decides whether a hold has a
|
|
1262
|
-
* check to terminalize — and terminalizing one it never posted CREATES a
|
|
1026
|
+
* Whether the hold's pending `KiCI Security` check reached the provider: `true` after a post
|
|
1027
|
+
* returned, `false` when none was attempted or one failed, `null` on a pre-column row (the
|
|
1028
|
+
* hold's shape is then the only answer). Read through `postedPendingSecurityCheck` to decide
|
|
1029
|
+
* whether a hold has a check to terminalize — terminalizing one never posted CREATES a
|
|
1263
1030
|
* `KiCI Security` run on a commit that had none.
|
|
1264
1031
|
*/
|
|
1265
1032
|
posted_pending_check: Generated<boolean | null>;
|
|
@@ -1283,24 +1050,18 @@ export interface HeldRunApprovalsTable {
|
|
|
1283
1050
|
decision: string;
|
|
1284
1051
|
/** Which requirement clauses this decision satisfied (for attribution). */
|
|
1285
1052
|
clauses_satisfied: ColumnType<ApproverClause[] | null, ApproverClause[] | string | null | undefined, ApproverClause[] | string | null>;
|
|
1286
|
-
/** When the decision was recorded */
|
|
1287
1053
|
created_at: Generated<Date>;
|
|
1288
1054
|
}
|
|
1289
1055
|
export type HeldRunApproval = Selectable<HeldRunApprovalsTable>;
|
|
1290
1056
|
export type NewHeldRunApproval = Insertable<HeldRunApprovalsTable>;
|
|
1291
1057
|
export type HeldRunApprovalUpdate = Updateable<HeldRunApprovalsTable>;
|
|
1292
|
-
/**
|
|
1293
|
-
* Secret audit log table
|
|
1294
|
-
* Immutable log of secret access and denial events.
|
|
1295
|
-
*/
|
|
1058
|
+
/** Immutable log of secret access and denial events. */
|
|
1296
1059
|
export interface SecretAuditLogTable {
|
|
1297
1060
|
/** UUID primary key */
|
|
1298
1061
|
id: Generated<string>;
|
|
1299
|
-
/** When the event occurred */
|
|
1300
1062
|
timestamp: Generated<Date>;
|
|
1301
1063
|
/** The action performed (e.g., 'getSecrets', 'setSecret') */
|
|
1302
1064
|
action: string;
|
|
1303
|
-
/** The context name involved */
|
|
1304
1065
|
context_name: string;
|
|
1305
1066
|
/** Routing key scope */
|
|
1306
1067
|
routing_key: string | null;
|
|
@@ -1318,10 +1079,7 @@ export interface SecretAuditLogTable {
|
|
|
1318
1079
|
role: string | null;
|
|
1319
1080
|
/** Additional metadata (JSON) */
|
|
1320
1081
|
metadata: string | null;
|
|
1321
|
-
/**
|
|
1322
|
-
* Set inside the archive transaction before the row is DELETEd.
|
|
1323
|
-
* Survivors carry NULL.
|
|
1324
|
-
*/
|
|
1082
|
+
/** Set inside the archive transaction before the row is DELETEd; survivors carry NULL. */
|
|
1325
1083
|
archived_at: Date | null;
|
|
1326
1084
|
/** S3 object key of the chunk that carried this row; see `archived_at`. */
|
|
1327
1085
|
archive_object_key: string | null;
|
|
@@ -1329,10 +1087,9 @@ export interface SecretAuditLogTable {
|
|
|
1329
1087
|
export type SecretAuditLogRow = Selectable<SecretAuditLogTable>;
|
|
1330
1088
|
export type NewSecretAuditLogRow = Insertable<SecretAuditLogTable>;
|
|
1331
1089
|
/**
|
|
1332
|
-
* Access log table.
|
|
1333
1090
|
* One row per read or orchestrator-admin mutation attributable to an
|
|
1334
1091
|
* ActorPrincipal (user / api_key / service_account / platform_operator /
|
|
1335
|
-
* system).
|
|
1092
|
+
* system). Retention: see `archived_at`.
|
|
1336
1093
|
*/
|
|
1337
1094
|
export interface AccessLogTable {
|
|
1338
1095
|
id: Generated<string>;
|
|
@@ -1349,16 +1106,16 @@ export interface AccessLogTable {
|
|
|
1349
1106
|
outcome: string;
|
|
1350
1107
|
error_message: string | null;
|
|
1351
1108
|
/**
|
|
1352
|
-
* Human-set agent name
|
|
1353
|
-
*
|
|
1354
|
-
* log can be filtered by agent.
|
|
1109
|
+
* Human-set agent name when the actor used an agent-kind PAT; NULL for human / API-key /
|
|
1110
|
+
* system actors. Queryable so the access log filters by agent.
|
|
1355
1111
|
*/
|
|
1356
1112
|
agent_label: string | null;
|
|
1357
1113
|
created_at: Generated<Date>;
|
|
1358
1114
|
/**
|
|
1359
|
-
* Set inside the archive transaction before the row is DELETEd.
|
|
1360
|
-
*
|
|
1361
|
-
*
|
|
1115
|
+
* Set inside the archive transaction before the row is DELETEd; survivors carry NULL. No
|
|
1116
|
+
* `expires_at`-based TTL. With the cold store on, rows past their per-action warm TTL
|
|
1117
|
+
* (`accessLogWarmSqlCase`) are archived to S3; with it off, the database retention sweep
|
|
1118
|
+
* (`audit_retention_days`) prunes them.
|
|
1362
1119
|
*/
|
|
1363
1120
|
archived_at: Date | null;
|
|
1364
1121
|
/** S3 object key of the chunk that carried this row; see `archived_at`. */
|
|
@@ -1366,44 +1123,34 @@ export interface AccessLogTable {
|
|
|
1366
1123
|
}
|
|
1367
1124
|
export type AccessLogRow = Selectable<AccessLogTable>;
|
|
1368
1125
|
export type NewAccessLogRow = Insertable<AccessLogTable>;
|
|
1369
|
-
/**
|
|
1370
|
-
* Admin tokens table
|
|
1371
|
-
* Hashed tokens for admin API authentication with role-based access.
|
|
1372
|
-
*/
|
|
1126
|
+
/** Hashed tokens for admin API authentication with role-based access. */
|
|
1373
1127
|
export interface AdminTokenTable {
|
|
1374
1128
|
/** UUID primary key */
|
|
1375
1129
|
id: Generated<string>;
|
|
1376
1130
|
/** SHA-256 hash of the token */
|
|
1377
1131
|
token_hash: string;
|
|
1378
|
-
/** Human-readable label */
|
|
1379
1132
|
label: string;
|
|
1380
1133
|
/** Role (e.g. 'admin', 'reader') */
|
|
1381
1134
|
role: string;
|
|
1382
1135
|
/** Routing key scope (null = all) */
|
|
1383
1136
|
routing_key: string | null;
|
|
1384
1137
|
/**
|
|
1385
|
-
* The intended holder
|
|
1386
|
-
*
|
|
1387
|
-
*
|
|
1388
|
-
* join key the Platform's RBAC drift report compares against org membership.
|
|
1389
|
-
* NULL means nobody recorded a holder — the report's `unlinked` finding.
|
|
1138
|
+
* The intended holder from `token create --subject` (an OIDC `sub` or an email). Advisory
|
|
1139
|
+
* only: never verified and never read when authorizing. The join key the Platform's RBAC
|
|
1140
|
+
* drift report compares against org membership; NULL is the report's `unlinked` finding.
|
|
1390
1141
|
*/
|
|
1391
1142
|
subject: string | null;
|
|
1392
|
-
/** When this token was created */
|
|
1393
1143
|
created_at: Generated<Date>;
|
|
1394
1144
|
/** When this token expires (null = never) */
|
|
1395
1145
|
expires_at: Date | null;
|
|
1396
|
-
/** When this token was last used */
|
|
1397
1146
|
last_used_at: Date | null;
|
|
1398
|
-
/** Whether this token has been revoked */
|
|
1399
1147
|
revoked: Generated<boolean>;
|
|
1400
1148
|
}
|
|
1401
1149
|
export type AdminTokenRow = Selectable<AdminTokenTable>;
|
|
1402
1150
|
export type NewAdminTokenRow = Insertable<AdminTokenTable>;
|
|
1403
1151
|
/**
|
|
1404
|
-
*
|
|
1405
|
-
*
|
|
1406
|
-
* Supports static (long-lived, CLI-created) and ephemeral (scaler-issued, TTL-bound) tokens.
|
|
1152
|
+
* Hashed PSK tokens for agent authentication: static (long-lived, CLI-created) or ephemeral
|
|
1153
|
+
* (scaler-issued, TTL-bound).
|
|
1407
1154
|
*/
|
|
1408
1155
|
export interface AgentTokenTable {
|
|
1409
1156
|
/** UUID primary key */
|
|
@@ -1415,16 +1162,13 @@ export interface AgentTokenTable {
|
|
|
1415
1162
|
/** JSON-encoded string[] of agent labels (null = any) */
|
|
1416
1163
|
labels: string | null;
|
|
1417
1164
|
/**
|
|
1418
|
-
* JSON
|
|
1419
|
-
* a
|
|
1420
|
-
*
|
|
1421
|
-
* default; the agent accepts any job its advertised labels match).
|
|
1422
|
-
* Authorized at mint time alongside `labels`.
|
|
1165
|
+
* JSON `string[]` of mandatory labels (a Kubernetes-taint-style gate): a static agent on this
|
|
1166
|
+
* token accepts a job only when every label here is among the job's required labels. null =
|
|
1167
|
+
* no taint (the default). Authorized at mint time alongside `labels`.
|
|
1423
1168
|
*/
|
|
1424
1169
|
mandatory_labels: string | null;
|
|
1425
1170
|
/** Token type: 'ephemeral' (scaler-issued) or 'static' (CLI-created) */
|
|
1426
1171
|
agent_type: string;
|
|
1427
|
-
/** When this token was created */
|
|
1428
1172
|
created_at: Generated<Date>;
|
|
1429
1173
|
/** When this token was last used for authentication */
|
|
1430
1174
|
last_seen_at: Date | null;
|
|
@@ -1435,20 +1179,17 @@ export interface AgentTokenTable {
|
|
|
1435
1179
|
/** When this token expires (null = never, static tokens) */
|
|
1436
1180
|
expires_at: Date | null;
|
|
1437
1181
|
/**
|
|
1438
|
-
* Single-use marker for bootstrap (init-runner) tokens
|
|
1439
|
-
*
|
|
1440
|
-
*
|
|
1441
|
-
* expiry).
|
|
1182
|
+
* Single-use marker for bootstrap (init-runner) tokens, set on first `agent.register`; a
|
|
1183
|
+
* second register is rejected. NULL = never consumed (static / ephemeral tokens stay
|
|
1184
|
+
* reusable until expiry).
|
|
1442
1185
|
*/
|
|
1443
1186
|
consumed_at: ColumnType<Date | null, Date | string | null | undefined, Date | string | null>;
|
|
1444
1187
|
}
|
|
1445
1188
|
export type AgentTokenRow = Selectable<AgentTokenTable>;
|
|
1446
1189
|
export type NewAgentTokenRow = Insertable<AgentTokenTable>;
|
|
1447
1190
|
/**
|
|
1448
|
-
*
|
|
1449
|
-
*
|
|
1450
|
-
* Each config change creates a new version with auto-incrementing version number.
|
|
1451
|
-
* Sensitive fields are encrypted and tracked via encrypted_paths array.
|
|
1191
|
+
* Versioned JSONB config snapshots with audit trail; each change adds a version. Sensitive
|
|
1192
|
+
* fields are encrypted and listed in `encrypted_paths`.
|
|
1452
1193
|
*/
|
|
1453
1194
|
export interface ConfigVersionTable {
|
|
1454
1195
|
/** UUID primary key */
|
|
@@ -1457,7 +1198,6 @@ export interface ConfigVersionTable {
|
|
|
1457
1198
|
version: Generated<number>;
|
|
1458
1199
|
/** Full config snapshot as JSONB */
|
|
1459
1200
|
config: string;
|
|
1460
|
-
/** When this version was created */
|
|
1461
1201
|
created_at: Generated<Date>;
|
|
1462
1202
|
/** Who created this version (e.g. "cli:seed", "api:set", "api:rollback") */
|
|
1463
1203
|
created_by: string;
|
|
@@ -1466,19 +1206,14 @@ export interface ConfigVersionTable {
|
|
|
1466
1206
|
/** JSONB paths that contain encrypted values */
|
|
1467
1207
|
encrypted_paths: Generated<string[]>;
|
|
1468
1208
|
/**
|
|
1469
|
-
* Master-key generation
|
|
1470
|
-
*
|
|
1471
|
-
* both the current and the previous generation during a grace window.
|
|
1209
|
+
* Master-key generation of this row's sensitive fields, bumped atomically by
|
|
1210
|
+
* `kici-admin rotate-key`; decrypt accepts current and previous during a grace window.
|
|
1472
1211
|
*/
|
|
1473
1212
|
key_version: Generated<number>;
|
|
1474
1213
|
}
|
|
1475
1214
|
export type ConfigVersionRow = Selectable<ConfigVersionTable>;
|
|
1476
1215
|
export type NewConfigVersionRow = Insertable<ConfigVersionTable>;
|
|
1477
|
-
/**
|
|
1478
|
-
* Internal events table (kici_events)
|
|
1479
|
-
* Persists internal events (system + custom) for routing, circuit-breaking, and audit.
|
|
1480
|
-
* Events have a TTL-based expiry for automatic cleanup.
|
|
1481
|
-
*/
|
|
1216
|
+
/** Internal events (system + custom) for routing, circuit-breaking and audit; TTL-expired. */
|
|
1482
1217
|
export interface KiciEventTable {
|
|
1483
1218
|
/** UUID primary key */
|
|
1484
1219
|
id: Generated<string>;
|
|
@@ -1488,7 +1223,6 @@ export interface KiciEventTable {
|
|
|
1488
1223
|
payload: string;
|
|
1489
1224
|
/** Source repo identifier (null for non-repo events) */
|
|
1490
1225
|
source_repo: string | null;
|
|
1491
|
-
/** Source routing key */
|
|
1492
1226
|
source_routing_key: string | null;
|
|
1493
1227
|
/** Run ID that emitted this event */
|
|
1494
1228
|
source_run_id: string | null;
|
|
@@ -1498,9 +1232,7 @@ export interface KiciEventTable {
|
|
|
1498
1232
|
chain_depth: Generated<number>;
|
|
1499
1233
|
/** Whether all subscribers have processed this event */
|
|
1500
1234
|
processed: Generated<boolean>;
|
|
1501
|
-
/** When this event was created */
|
|
1502
1235
|
created_at: Generated<Date>;
|
|
1503
|
-
/** When this event expires (TTL-based cleanup) */
|
|
1504
1236
|
expires_at: Date;
|
|
1505
1237
|
/** Optional target repos for cross-repo event targeting (JSONB string[] or null) */
|
|
1506
1238
|
target_repos: string | null;
|
|
@@ -1508,7 +1240,7 @@ export interface KiciEventTable {
|
|
|
1508
1240
|
claimed_at: Date | null;
|
|
1509
1241
|
/** Node id holding the current lease (for diagnostics; not part of the lease check) */
|
|
1510
1242
|
claimed_by: string | null;
|
|
1511
|
-
/**
|
|
1243
|
+
/** Times the event has been leased for processing */
|
|
1512
1244
|
attempts: Generated<number>;
|
|
1513
1245
|
/** Most recent dispatch failure message (truncated to 4 KB by application code) */
|
|
1514
1246
|
last_error: string | null;
|
|
@@ -1526,15 +1258,10 @@ export interface KiciEventTable {
|
|
|
1526
1258
|
export type KiciEvent = Selectable<KiciEventTable>;
|
|
1527
1259
|
export type NewKiciEvent = Insertable<KiciEventTable>;
|
|
1528
1260
|
export type KiciEventUpdate = Updateable<KiciEventTable>;
|
|
1529
|
-
/**
|
|
1530
|
-
* Generic webhook sources table (generic_webhook_sources)
|
|
1531
|
-
* Stores per-source verification config, event extraction rules, and rate limits
|
|
1532
|
-
* for non-GitHub webhook sources.
|
|
1533
|
-
*/
|
|
1261
|
+
/** Non-GitHub webhook sources: verification config, event extraction rules and rate limits. */
|
|
1534
1262
|
export interface GenericWebhookSourceTable {
|
|
1535
1263
|
/** UUID primary key */
|
|
1536
1264
|
id: Generated<string>;
|
|
1537
|
-
/** Customer/tenant identifier */
|
|
1538
1265
|
customer_id: string;
|
|
1539
1266
|
/** Human-readable source name (unique within customer when not deleted) */
|
|
1540
1267
|
name: string;
|
|
@@ -1548,7 +1275,6 @@ export interface GenericWebhookSourceTable {
|
|
|
1548
1275
|
event_type_header: string | null;
|
|
1549
1276
|
/** JSONPath expression to extract event type from payload body */
|
|
1550
1277
|
event_type_path: string | null;
|
|
1551
|
-
/** Header name for idempotency key */
|
|
1552
1278
|
idempotency_key_header: string | null;
|
|
1553
1279
|
/** JSONPath expression for idempotency key from body */
|
|
1554
1280
|
idempotency_key_path: string | null;
|
|
@@ -1560,71 +1286,55 @@ export interface GenericWebhookSourceTable {
|
|
|
1560
1286
|
allowed_events: string | null;
|
|
1561
1287
|
/** JSON array of sensitive headers to strip (default: auth-related headers) */
|
|
1562
1288
|
strip_headers: Generated<string>;
|
|
1563
|
-
/** Whether this source is active */
|
|
1564
1289
|
enabled: Generated<boolean>;
|
|
1565
1290
|
/** Token bucket rate limit: requests per minute */
|
|
1566
1291
|
rate_limit_rpm: Generated<number>;
|
|
1567
|
-
/** When this source was created */
|
|
1568
1292
|
created_at: Generated<Date>;
|
|
1569
|
-
/** When this source was last updated */
|
|
1570
1293
|
updated_at: Generated<Date>;
|
|
1571
1294
|
/** Soft-delete marker (null = active) */
|
|
1572
1295
|
deleted_at: Date | null;
|
|
1573
|
-
/**
|
|
1574
|
-
*
|
|
1575
|
-
*
|
|
1576
|
-
*
|
|
1296
|
+
/**
|
|
1297
|
+
* Normalizer: 'generic' (default) → GenericWebhookNormalizer (Stripe-shaped payloads);
|
|
1298
|
+
* 'local' → LocalWebhookNormalizer (github-shaped push/PR payloads for a repository on the
|
|
1299
|
+
* agent filesystem, cloned via file://).
|
|
1300
|
+
*/
|
|
1577
1301
|
provider_type: Generated<string>;
|
|
1578
|
-
/**
|
|
1579
|
-
*
|
|
1580
|
-
*
|
|
1581
|
-
*
|
|
1582
|
-
*
|
|
1583
|
-
*
|
|
1584
|
-
|
|
1585
|
-
* validated by the matching Zod schema at the application layer. */
|
|
1302
|
+
/**
|
|
1303
|
+
* Git config JSONB, discriminated by `provider_type`: a universal-git source ('generic' with
|
|
1304
|
+
* git_config) stores a `UniversalGitConfig` (clone URLs, lock-file fetch, clone credentials
|
|
1305
|
+
* against Forgejo / Gitea / Gogs / GitLab repo-webhook / GitHub repo); a 'local' source a
|
|
1306
|
+
* `LocalSourceConfig` (`{ repoBasePath, cloneUrlBase? }`). null for plain generic sources
|
|
1307
|
+
* with no git operations. Validated by the matching Zod schema in the application layer.
|
|
1308
|
+
*/
|
|
1586
1309
|
git_config: ColumnType<string | Record<string, unknown> | null, string | null, string | null>;
|
|
1587
1310
|
}
|
|
1588
1311
|
export type GenericWebhookSource = Selectable<GenericWebhookSourceTable>;
|
|
1589
1312
|
export type NewGenericWebhookSource = Insertable<GenericWebhookSourceTable>;
|
|
1590
1313
|
export type GenericWebhookSourceUpdate = Updateable<GenericWebhookSourceTable>;
|
|
1591
|
-
/**
|
|
1592
|
-
* Cross-repo trust table (cross_repo_trust)
|
|
1593
|
-
* Bidirectional trust relationships for cross-repo event delivery.
|
|
1594
|
-
* Both source and target must declare trust for delivery to proceed.
|
|
1595
|
-
*/
|
|
1314
|
+
/** Cross-repo event-delivery trust; delivery needs both source and target to declare it. */
|
|
1596
1315
|
export interface CrossRepoTrustTable {
|
|
1597
1316
|
/** UUID primary key */
|
|
1598
1317
|
id: Generated<string>;
|
|
1599
1318
|
/** Source repo that is trusted to emit events */
|
|
1600
1319
|
source_repo: string;
|
|
1601
|
-
/** Source routing key */
|
|
1602
1320
|
source_routing_key: string;
|
|
1603
1321
|
/** Target repo that accepts events from source */
|
|
1604
1322
|
target_repo: string;
|
|
1605
|
-
/** Target routing key */
|
|
1606
1323
|
target_routing_key: string;
|
|
1607
1324
|
/** JSON array of event name glob patterns allowed (null = all) */
|
|
1608
1325
|
allowed_events: string | null;
|
|
1609
|
-
/** Whether this trust relationship is active */
|
|
1610
1326
|
enabled: Generated<boolean>;
|
|
1611
|
-
/** When this trust relationship was created */
|
|
1612
1327
|
created_at: Generated<Date>;
|
|
1613
1328
|
}
|
|
1614
1329
|
export type CrossRepoTrust = Selectable<CrossRepoTrustTable>;
|
|
1615
1330
|
export type NewCrossRepoTrust = Insertable<CrossRepoTrustTable>;
|
|
1616
1331
|
export type CrossRepoTrustUpdate = Updateable<CrossRepoTrustTable>;
|
|
1617
|
-
/**
|
|
1618
|
-
* Test uploads table (test_uploads)
|
|
1619
|
-
* Tracks CLI code uploads for remote test runs.
|
|
1620
|
-
* Uploads are temporary (24h TTL) and cleaned up by a periodic job.
|
|
1621
|
-
*/
|
|
1332
|
+
/** CLI code uploads for remote test runs; a periodic job removes them after a 24h TTL. */
|
|
1622
1333
|
export interface TestUploadsTable {
|
|
1623
1334
|
/** UUID primary key */
|
|
1624
1335
|
id: Generated<string>;
|
|
1625
1336
|
/** Client-facing upload ID */
|
|
1626
1337
|
upload_id: string;
|
|
1627
|
-
/** Routing key for this upload */
|
|
1628
1338
|
routing_key: string;
|
|
1629
1339
|
/** Git SHA from the upload */
|
|
1630
1340
|
sha: string | null;
|
|
@@ -1638,7 +1348,6 @@ export interface TestUploadsTable {
|
|
|
1638
1348
|
encryption_private_key: string | null;
|
|
1639
1349
|
/** Upload status: pending | uploaded | dispatched | expired */
|
|
1640
1350
|
status: Generated<string>;
|
|
1641
|
-
/** When this upload was created */
|
|
1642
1351
|
created_at: Generated<Date>;
|
|
1643
1352
|
/** When this upload expires (24h from creation) */
|
|
1644
1353
|
expires_at: Date;
|
|
@@ -1648,11 +1357,7 @@ export interface TestUploadsTable {
|
|
|
1648
1357
|
export type TestUpload = Selectable<TestUploadsTable>;
|
|
1649
1358
|
export type NewTestUpload = Insertable<TestUploadsTable>;
|
|
1650
1359
|
export type TestUploadUpdate = Updateable<TestUploadsTable>;
|
|
1651
|
-
/**
|
|
1652
|
-
* Workflow registrations table
|
|
1653
|
-
* Per-workflow rows with full lock entry and trigger type index.
|
|
1654
|
-
* Each registration is unique per (routing_key, repo, workflow).
|
|
1655
|
-
*/
|
|
1360
|
+
/** One row per (routing_key, repo, workflow): the full lock entry plus a trigger-type index. */
|
|
1656
1361
|
export interface WorkflowRegistrationsTable {
|
|
1657
1362
|
/** UUID primary key */
|
|
1658
1363
|
id: Generated<string>;
|
|
@@ -1673,27 +1378,19 @@ export interface WorkflowRegistrationsTable {
|
|
|
1673
1378
|
/** Git commit SHA from the push that last updated this registration */
|
|
1674
1379
|
commit_sha: ColumnType<string | null, string | null | undefined, string | null>;
|
|
1675
1380
|
/**
|
|
1676
|
-
* The
|
|
1677
|
-
*
|
|
1678
|
-
*
|
|
1679
|
-
*
|
|
1680
|
-
*
|
|
1681
|
-
* NULL when the registration predates migration 123, or when the webhook
|
|
1682
|
-
* payload named no default branch. There is no backfill: the value is only
|
|
1683
|
-
* knowable from a payload, so a NULL row heals on its repo's next
|
|
1684
|
-
* default-branch push. NULL presents no branch, which keeps the honest
|
|
1685
|
-
* branch-gate rejection rather than inventing a branch.
|
|
1381
|
+
* The repo's default branch from the push that last updated this registration. A
|
|
1382
|
+
* `__schedule_fire` run executes this branch's lock file, so this IS that run's branch for
|
|
1383
|
+
* context branch restrictions. NULL when the row predates migration 123 or the payload named
|
|
1384
|
+
* no default branch; no backfill is possible, so a NULL row heals on the next default-branch
|
|
1385
|
+
* push. NULL presents no branch, keeping the honest branch-gate rejection.
|
|
1686
1386
|
*/
|
|
1687
1387
|
default_branch: ColumnType<string | null, string | null | undefined, string | null>;
|
|
1688
1388
|
/** Source file path for this workflow (e.g. ".kici/workflows/deploy.ts") */
|
|
1689
1389
|
source_file: ColumnType<string | null, string | null | undefined, string | null>;
|
|
1690
1390
|
/**
|
|
1691
|
-
* `lockfileHash` of the lock file that last registered this workflow: the
|
|
1692
|
-
*
|
|
1693
|
-
*
|
|
1694
|
-
*
|
|
1695
|
-
* NULL when that lock file records none, and on rows written before migration
|
|
1696
|
-
* 149. NULL means the run installs its dependencies on the agent.
|
|
1391
|
+
* `lockfileHash` of the lock file that last registered this workflow: the package-manager
|
|
1392
|
+
* lockfile hash a dispatched run probes the dependency cache with. NULL when that lock file
|
|
1393
|
+
* records none and on rows before migration 149; the run then installs deps on the agent.
|
|
1697
1394
|
*/
|
|
1698
1395
|
lockfile_hash: ColumnType<string | null, string | null | undefined, string | null>;
|
|
1699
1396
|
/**
|
|
@@ -1703,74 +1400,55 @@ export interface WorkflowRegistrationsTable {
|
|
|
1703
1400
|
*/
|
|
1704
1401
|
siblings_digest: ColumnType<string | null, string | null | undefined, string | null>;
|
|
1705
1402
|
/**
|
|
1706
|
-
* The `commit_sha` written
|
|
1707
|
-
*
|
|
1708
|
-
*
|
|
1709
|
-
*
|
|
1710
|
-
*
|
|
1711
|
-
* NULL on rows written before migration 151 and on rows registered with no
|
|
1712
|
-
* commit; such a row uses no key.
|
|
1403
|
+
* The `commit_sha` written with `lockfile_hash` and `siblings_digest`; the key is used only
|
|
1404
|
+
* while this equals `commit_sha`, since a writer unaware of the key columns moves
|
|
1405
|
+
* `commit_sha` alone and leaves an older lock file's key. NULL (rows before migration 151 or
|
|
1406
|
+
* registered with no commit) uses no key.
|
|
1713
1407
|
*/
|
|
1714
1408
|
dep_cache_key_sha: ColumnType<string | null, string | null | undefined, string | null>;
|
|
1715
1409
|
/** Whether this is a global workflow (triggers across all repos under same routing key) */
|
|
1716
1410
|
is_global: ColumnType<boolean, boolean | undefined, boolean>;
|
|
1717
1411
|
/**
|
|
1718
|
-
*
|
|
1719
|
-
*
|
|
1720
|
-
*
|
|
1721
|
-
*
|
|
1722
|
-
*
|
|
1723
|
-
* Required on insert (no DB default — migration 020 enforces NOT NULL);
|
|
1724
|
-
* Updateable type allows omission so the existing replaceAll UPDATE branch
|
|
1725
|
-
* (which preserves the existing customer_id alongside the rest of the row)
|
|
1726
|
-
* can keep its current shape.
|
|
1412
|
+
* Owning org, backfilled by migration 020 from sources / generic_webhook_sources on
|
|
1413
|
+
* routing_key and NOT NULL since. The cross-source lookup index
|
|
1414
|
+
* (RegistrationIndex.byOrgAndEvent) enforces org isolation with it. Required on insert (no DB
|
|
1415
|
+
* default); optional on update because the replaceAll UPDATE branch preserves it.
|
|
1727
1416
|
*/
|
|
1728
1417
|
customer_id: ColumnType<string, string, string | undefined>;
|
|
1729
|
-
/** When this registration was created */
|
|
1730
1418
|
created_at: Generated<Date>;
|
|
1731
|
-
/** When this registration was last updated */
|
|
1732
1419
|
updated_at: Generated<Date>;
|
|
1733
1420
|
}
|
|
1734
1421
|
export type WorkflowRegistration = Selectable<WorkflowRegistrationsTable>;
|
|
1735
1422
|
export type NewWorkflowRegistration = Insertable<WorkflowRegistrationsTable>;
|
|
1736
1423
|
export type WorkflowRegistrationUpdate = Updateable<WorkflowRegistrationsTable>;
|
|
1737
1424
|
/**
|
|
1738
|
-
*
|
|
1739
|
-
*
|
|
1740
|
-
* Default row with id='default' inserted by migration.
|
|
1425
|
+
* Cluster sync version counter, bumped on registration changes. A migration inserts the
|
|
1426
|
+
* id='default' row.
|
|
1741
1427
|
*/
|
|
1742
1428
|
export interface RegistryVersionsTable {
|
|
1743
1429
|
/** Version identifier (default: 'default') */
|
|
1744
1430
|
id: Generated<string>;
|
|
1745
1431
|
/** Monotonically increasing version counter */
|
|
1746
1432
|
version: Generated<number>;
|
|
1747
|
-
/** When the version was last bumped */
|
|
1748
1433
|
updated_at: Generated<Date>;
|
|
1749
1434
|
}
|
|
1750
1435
|
export type RegistryVersion = Selectable<RegistryVersionsTable>;
|
|
1751
1436
|
export type RegistryVersionUpdate = Updateable<RegistryVersionsTable>;
|
|
1752
|
-
/**
|
|
1753
|
-
* Cron last-fired table
|
|
1754
|
-
* Tracks the last time each cron-triggered workflow registration fired.
|
|
1755
|
-
* Used for fire-once-on-recovery after orchestrator restart.
|
|
1756
|
-
*/
|
|
1437
|
+
/** Last fire time per cron registration, for fire-once-on-recovery after a restart. */
|
|
1757
1438
|
export interface CronLastFiredTable {
|
|
1758
1439
|
/** References workflow_registrations.id (cascade delete) */
|
|
1759
1440
|
registration_id: string;
|
|
1760
1441
|
/** Per-schedule identity: `${cronExpression}\n${timezone}` (see scheduleTriggerKey) */
|
|
1761
1442
|
schedule_key: string;
|
|
1762
|
-
/** When this cron trigger last fired */
|
|
1763
1443
|
last_fired_at: Date;
|
|
1764
|
-
/** When this record was last updated */
|
|
1765
1444
|
updated_at: Generated<Date>;
|
|
1766
1445
|
}
|
|
1767
1446
|
export type CronLastFired = Selectable<CronLastFiredTable>;
|
|
1768
1447
|
export type NewCronLastFired = Insertable<CronLastFiredTable>;
|
|
1769
1448
|
export type CronLastFiredUpdate = Updateable<CronLastFiredTable>;
|
|
1770
1449
|
/**
|
|
1771
|
-
*
|
|
1772
|
-
*
|
|
1773
|
-
* Private keys are encrypted with the orchestrator PSK (AES-256-GCM).
|
|
1450
|
+
* Per-run X25519 key pairs for cross-job secret output encryption. Private keys are encrypted
|
|
1451
|
+
* with the orchestrator master key (`KICI_SECRET_KEY`, AES-256-GCM).
|
|
1774
1452
|
*/
|
|
1775
1453
|
export interface RunEphemeralKeysTable {
|
|
1776
1454
|
/** Run ID (primary key, references execution_runs.run_id) */
|
|
@@ -1781,20 +1459,15 @@ export interface RunEphemeralKeysTable {
|
|
|
1781
1459
|
public_key: string;
|
|
1782
1460
|
/** Master-key generation this row is sealed under. Bumped by `rotate-key`. */
|
|
1783
1461
|
key_version: Generated<number>;
|
|
1784
|
-
/** When this key pair was created */
|
|
1785
1462
|
created_at: Generated<Date>;
|
|
1786
1463
|
}
|
|
1787
1464
|
export type RunEphemeralKey = Selectable<RunEphemeralKeysTable>;
|
|
1788
1465
|
export type NewRunEphemeralKey = Insertable<RunEphemeralKeysTable>;
|
|
1789
1466
|
/**
|
|
1790
|
-
*
|
|
1791
|
-
*
|
|
1792
|
-
*
|
|
1793
|
-
*
|
|
1794
|
-
* but that envelope is not what lands here: the orchestrator opens it with the
|
|
1795
|
-
* run private key and RE-ENCRYPTS the plaintext under the master key
|
|
1796
|
-
* (`KICI_SECRET_KEY`) before storing. So this is one of the master-key-wrapped
|
|
1797
|
-
* stores and moves with every key rotation.
|
|
1467
|
+
* Encrypted job secret outputs for cross-job consumption. The agent seals each value to the
|
|
1468
|
+
* run's ephemeral public key (ECDH + AES-256-GCM); the orchestrator opens it with the run
|
|
1469
|
+
* private key and RE-ENCRYPTS it under the master key (`KICI_SECRET_KEY`) before storing, so
|
|
1470
|
+
* this store moves with every key rotation.
|
|
1798
1471
|
*/
|
|
1799
1472
|
export interface RunSecretOutputsTable {
|
|
1800
1473
|
/** UUID primary key */
|
|
@@ -1803,31 +1476,23 @@ export interface RunSecretOutputsTable {
|
|
|
1803
1476
|
run_id: string;
|
|
1804
1477
|
/** Job ID that produced this output */
|
|
1805
1478
|
job_id: string;
|
|
1806
|
-
/** Output key name */
|
|
1807
1479
|
output_key: string;
|
|
1808
1480
|
/**
|
|
1809
|
-
* Base64
|
|
1810
|
-
*
|
|
1811
|
-
* the rotation grace window's old-key fallback.
|
|
1481
|
+
* Base64 value, AES-256-GCM sealed under the master key with AAD `secret-output:<run_id>`.
|
|
1482
|
+
* Read through `unsealSecretOutput`, which carries the rotation grace window's old-key fallback.
|
|
1812
1483
|
*/
|
|
1813
1484
|
encrypted_value: string;
|
|
1814
1485
|
/** Master-key generation this row is sealed under. Bumped by `rotate-key`. */
|
|
1815
1486
|
key_version: Generated<number>;
|
|
1816
|
-
/** When this output was stored */
|
|
1817
1487
|
created_at: Generated<Date>;
|
|
1818
1488
|
}
|
|
1819
1489
|
export type RunSecretOutput = Selectable<RunSecretOutputsTable>;
|
|
1820
1490
|
export type NewRunSecretOutput = Insertable<RunSecretOutputsTable>;
|
|
1821
1491
|
/**
|
|
1822
|
-
*
|
|
1823
|
-
*
|
|
1824
|
-
*
|
|
1825
|
-
*
|
|
1826
|
-
* `status='active'` rows for the scope and inserts only when the count is below
|
|
1827
|
-
* `max`. That is what makes the cap hold across a restart and across every
|
|
1828
|
-
* coordinator in a cluster, which a per-process map cannot. A partial unique
|
|
1829
|
-
* index on `(routing_key, group_key, run_id) WHERE status='active'` makes a
|
|
1830
|
-
* re-acquire idempotent.
|
|
1492
|
+
* The arbiter of `concurrency: { group, max }`: an advisory-locked transaction counts
|
|
1493
|
+
* `status='active'` rows for the scope and inserts only below `max`, so the cap holds across
|
|
1494
|
+
* restarts and every coordinator (a per-process map cannot). A partial unique index on
|
|
1495
|
+
* `(routing_key, group_key, run_id) WHERE status='active'` makes a re-acquire idempotent.
|
|
1831
1496
|
*/
|
|
1832
1497
|
export interface ConcurrencyGroupsTable {
|
|
1833
1498
|
/** UUID primary key */
|
|
@@ -1836,13 +1501,11 @@ export interface ConcurrencyGroupsTable {
|
|
|
1836
1501
|
group_key: string;
|
|
1837
1502
|
/** Run ID that owns this slot or is queued */
|
|
1838
1503
|
run_id: string;
|
|
1839
|
-
/** Job ID within the run */
|
|
1840
1504
|
job_id: string;
|
|
1841
1505
|
/** Routing key for scoping (e.g. "github:42") */
|
|
1842
1506
|
routing_key: string;
|
|
1843
1507
|
/** Status: 'active' | 'queued' | 'completed' | 'cancelled' */
|
|
1844
1508
|
status: Generated<string>;
|
|
1845
|
-
/** When this entry was created */
|
|
1846
1509
|
created_at: Generated<Date>;
|
|
1847
1510
|
/** When this entry was completed/cancelled */
|
|
1848
1511
|
completed_at: Date | null;
|
|
@@ -1851,39 +1514,34 @@ export type ConcurrencyGroup = Selectable<ConcurrencyGroupsTable>;
|
|
|
1851
1514
|
export type NewConcurrencyGroup = Insertable<ConcurrencyGroupsTable>;
|
|
1852
1515
|
export type ConcurrencyGroupUpdate = Updateable<ConcurrencyGroupsTable>;
|
|
1853
1516
|
/**
|
|
1854
|
-
*
|
|
1855
|
-
*
|
|
1856
|
-
* Secrets (private key, webhook secret) are stored separately in PgSecretStore.
|
|
1517
|
+
* Webhook source configs (e.g. GitHub Apps) with routing keys. Secrets (private key, webhook
|
|
1518
|
+
* secret) live separately in PgSecretStore.
|
|
1857
1519
|
*/
|
|
1858
1520
|
export interface SourcesTable {
|
|
1859
1521
|
/** UUID primary key */
|
|
1860
1522
|
id: Generated<string>;
|
|
1861
1523
|
/** Provider type (e.g. 'github') */
|
|
1862
1524
|
provider: string;
|
|
1863
|
-
/** Human-readable source name */
|
|
1864
1525
|
name: string;
|
|
1865
1526
|
/** Routing key (e.g. 'github:12345') */
|
|
1866
1527
|
routing_key: string;
|
|
1867
1528
|
/** JSONB config (non-sensitive, e.g. { appId: '12345' }) */
|
|
1868
1529
|
config: string;
|
|
1869
1530
|
/**
|
|
1870
|
-
* GitHub App slug (
|
|
1871
|
-
*
|
|
1872
|
-
* is the source of truth for both `name` and `slug` on GitHub-App sources.
|
|
1531
|
+
* GitHub App slug (e.g. `my-kici-app`); NULL until the GitHub identity fetch populates it.
|
|
1532
|
+
* GitHub is the source of truth for `name` and `slug` on GitHub-App sources.
|
|
1873
1533
|
*/
|
|
1874
1534
|
slug: string | null;
|
|
1875
1535
|
/** Customer/org identifier for secret and context scoping */
|
|
1876
1536
|
customer_id: Generated<string>;
|
|
1877
|
-
/** When this source was created */
|
|
1878
1537
|
created_at: Generated<Date>;
|
|
1879
|
-
/** When this source was last updated */
|
|
1880
1538
|
updated_at: Generated<Date>;
|
|
1881
1539
|
}
|
|
1882
1540
|
export type Source = Selectable<SourcesTable>;
|
|
1883
1541
|
export type NewSource = Insertable<SourcesTable>;
|
|
1884
1542
|
export type SourceUpdate = Updateable<SourcesTable>;
|
|
1885
1543
|
/**
|
|
1886
|
-
* Repo-pattern entry stored inside the
|
|
1544
|
+
* Repo-pattern entry stored inside the jsonb repo-list columns of
|
|
1887
1545
|
* `org_settings`. `routingKey` is optional — when undefined the entry
|
|
1888
1546
|
* applies to any source in the org; when set, it qualifies the entry to
|
|
1889
1547
|
* one specific webhook source.
|
|
@@ -1893,11 +1551,9 @@ export interface OrgSettingsRepoPatternEntry {
|
|
|
1893
1551
|
pattern: string;
|
|
1894
1552
|
}
|
|
1895
1553
|
/**
|
|
1896
|
-
*
|
|
1897
|
-
*
|
|
1898
|
-
*
|
|
1899
|
-
* a `routingKey` apply to any source in the org, entries with a routing
|
|
1900
|
-
* key are scoped to that source only.
|
|
1554
|
+
* Per-org (customer_id) global workflow permissions and overrides of cluster defaults. Repo
|
|
1555
|
+
* list columns hold `OrgSettingsRepoPatternEntry[]` jsonb. A BIGINT column reads back from pg
|
|
1556
|
+
* as a string and takes a number on write.
|
|
1901
1557
|
*/
|
|
1902
1558
|
export interface OrgSettingsTable {
|
|
1903
1559
|
/** Customer/org identifier (primary key) */
|
|
@@ -1905,177 +1561,141 @@ export interface OrgSettingsTable {
|
|
|
1905
1561
|
/** Repos allowed to author global workflows (null = any repo can author) */
|
|
1906
1562
|
global_workflow_allowed_repos: ColumnType<OrgSettingsRepoPatternEntry[] | null, OrgSettingsRepoPatternEntry[] | null | undefined | string, OrgSettingsRepoPatternEntry[] | null | string>;
|
|
1907
1563
|
/**
|
|
1908
|
-
* Repos
|
|
1909
|
-
* Deny takes precedence over the allow-list (null = no deny patterns).
|
|
1564
|
+
* Repos denied as event sources for global workflows; deny beats the allow-list (null = none).
|
|
1910
1565
|
*/
|
|
1911
1566
|
global_workflow_denied_repos: ColumnType<OrgSettingsRepoPatternEntry[] | null, OrgSettingsRepoPatternEntry[] | null | undefined | string, OrgSettingsRepoPatternEntry[] | null | string>;
|
|
1912
1567
|
/**
|
|
1913
|
-
*
|
|
1914
|
-
*
|
|
1915
|
-
* URLs are accepted; arbitrary `http://` registries are rejected at dispatch.
|
|
1568
|
+
* True lets workflow `registries:` URLs use plain `http://` to any host. False (default)
|
|
1569
|
+
* accepts only `https://` and loopback / `*.local` `http://`; others are rejected at dispatch.
|
|
1916
1570
|
*/
|
|
1917
1571
|
allow_http_npm_registries: ColumnType<boolean, boolean | undefined, boolean>;
|
|
1918
1572
|
/**
|
|
1919
|
-
* May an UNTRUSTED ref build its job's container image from a Dockerfile?
|
|
1920
|
-
*
|
|
1921
|
-
* Default false. The build runs outside the job's hardened sandbox, so this
|
|
1922
|
-
* is an opt-in, never inherited.
|
|
1573
|
+
* May an UNTRUSTED ref build its job's container image from a Dockerfile? Default false: the
|
|
1574
|
+
* build runs outside the job's hardened sandbox, so this is opt-in, never inherited.
|
|
1923
1575
|
*/
|
|
1924
1576
|
allow_untrusted_dockerfile_builds: ColumnType<boolean, boolean | undefined, boolean>;
|
|
1925
1577
|
/**
|
|
1926
|
-
*
|
|
1927
|
-
*
|
|
1928
|
-
* `
|
|
1929
|
-
* `
|
|
1930
|
-
* Resolver in `@kici-dev/engine/protocol/dashboard-write-operations`
|
|
1931
|
-
* treats missing keys as `true`.
|
|
1578
|
+
* Which Platform-routed dashboard.* writes the orch accepts: JSONB
|
|
1579
|
+
* `{ [operation]: boolean }` keyed by engine `DashboardWriteOperation`. The resolver in
|
|
1580
|
+
* `@kici-dev/engine/protocol/dashboard-write-operations` treats missing keys as `true`, so
|
|
1581
|
+
* `{}` enables all.
|
|
1932
1582
|
*/
|
|
1933
1583
|
dashboard_write_policy: ColumnType<Record<string, boolean>, Record<string, boolean> | string | undefined, Record<string, boolean> | string>;
|
|
1934
1584
|
/**
|
|
1935
|
-
*
|
|
1936
|
-
* cluster-wide default (`KICI_USER_CACHE_QUOTA_BYTES`, 5 GiB). Postgres
|
|
1937
|
-
* BIGINT — pg returns a string on select; accept a number on insert/update.
|
|
1585
|
+
* UserCache byte quota. NULL = cluster default (`KICI_USER_CACHE_QUOTA_BYTES`, 5 GiB). BIGINT.
|
|
1938
1586
|
*/
|
|
1939
1587
|
user_cache_quota_bytes: ColumnType<string | null, number | null | undefined, number | null>;
|
|
1940
1588
|
/**
|
|
1941
|
-
*
|
|
1942
|
-
*
|
|
1943
|
-
* pg returns a string on select; accept a number on insert/update.
|
|
1589
|
+
* UserCache per-entry TTL (ms). NULL = cluster default (`KICI_USER_CACHE_TTL_MS`, 7 days).
|
|
1590
|
+
* BIGINT.
|
|
1944
1591
|
*/
|
|
1945
1592
|
user_cache_ttl_ms: ColumnType<string | null, number | null | undefined, number | null>;
|
|
1946
1593
|
/**
|
|
1947
|
-
*
|
|
1948
|
-
*
|
|
1949
|
-
* pg returns a string on select; accept a number on insert/update.
|
|
1594
|
+
* ArtifactStore byte quota. NULL = cluster default (`KICI_ARTIFACT_QUOTA_BYTES`, 20 GiB).
|
|
1595
|
+
* BIGINT.
|
|
1950
1596
|
*/
|
|
1951
1597
|
artifact_quota_bytes: ColumnType<string | null, number | null | undefined, number | null>;
|
|
1952
1598
|
/**
|
|
1953
|
-
*
|
|
1954
|
-
*
|
|
1955
|
-
* pg returns a string on select; accept a number on insert/update.
|
|
1599
|
+
* ArtifactStore per-artifact TTL (ms). NULL = cluster default (`KICI_ARTIFACT_TTL_MS`,
|
|
1600
|
+
* 30 days). BIGINT.
|
|
1956
1601
|
*/
|
|
1957
1602
|
artifact_ttl_ms: ColumnType<string | null, number | null | undefined, number | null>;
|
|
1958
1603
|
/**
|
|
1959
|
-
*
|
|
1960
|
-
* (
|
|
1961
|
-
* (`KICI_ARTIFACT_MAX_BYTES`, 1 GiB). Postgres BIGINT — pg returns a string on
|
|
1962
|
-
* select; accept a number on insert/update.
|
|
1604
|
+
* ArtifactStore per-artifact size cap (bytes). NULL = cluster default
|
|
1605
|
+
* (`KICI_ARTIFACT_MAX_BYTES`, 1 GiB). BIGINT.
|
|
1963
1606
|
*/
|
|
1964
1607
|
artifact_max_bytes: ColumnType<string | null, number | null | undefined, number | null>;
|
|
1965
1608
|
/**
|
|
1966
|
-
*
|
|
1967
|
-
* (
|
|
1968
|
-
* (`KICI_ARTIFACT_MAX_PER_RUN`, 50). Postgres BIGINT — pg returns a string on
|
|
1969
|
-
* select; accept a number on insert/update.
|
|
1609
|
+
* ArtifactStore per-run artifact count cap. NULL = cluster default
|
|
1610
|
+
* (`KICI_ARTIFACT_MAX_PER_RUN`, 50). BIGINT.
|
|
1970
1611
|
*/
|
|
1971
1612
|
artifact_max_per_run: ColumnType<string | null, number | null | undefined, number | null>;
|
|
1972
1613
|
/**
|
|
1973
|
-
*
|
|
1974
|
-
* (config.dispatchAckTimeoutMs / KICI_DISPATCH_ACK_TIMEOUT_MS).
|
|
1975
|
-
* BIGINT — pg returns a string on select; accept a number on insert/update.
|
|
1614
|
+
* Dispatch-acknowledgment deadline (ms); null = cluster default
|
|
1615
|
+
* (config.dispatchAckTimeoutMs / KICI_DISPATCH_ACK_TIMEOUT_MS). BIGINT.
|
|
1976
1616
|
*/
|
|
1977
1617
|
dispatch_ack_timeout_ms: ColumnType<string | null, number | null | undefined, number | null>;
|
|
1978
1618
|
/**
|
|
1979
|
-
*
|
|
1980
|
-
* (config.ingestOrgMaxConcurrency / KICI_INGEST_ORG_MAX_CONCURRENCY).
|
|
1981
|
-
* BIGINT — pg returns a string on select; accept a number on insert/update.
|
|
1619
|
+
* Webhook-ingest concurrency cap; null = cluster default
|
|
1620
|
+
* (config.ingestOrgMaxConcurrency / KICI_INGEST_ORG_MAX_CONCURRENCY). BIGINT.
|
|
1982
1621
|
*/
|
|
1983
1622
|
ingest_max_concurrency: ColumnType<string | null, number | null | undefined, number | null>;
|
|
1984
1623
|
/**
|
|
1985
|
-
*
|
|
1986
|
-
*
|
|
1987
|
-
* (config.scalerSpawnTimeoutMs / KICI_SCALER_SPAWN_TIMEOUT_MS). Postgres
|
|
1988
|
-
* BIGINT — pg returns a string on select; accept a number on insert/update.
|
|
1624
|
+
* Deadline (ms) for one `backend.spawn` (image pull + container create + start); null =
|
|
1625
|
+
* cluster default (config.scalerSpawnTimeoutMs / KICI_SCALER_SPAWN_TIMEOUT_MS). BIGINT.
|
|
1989
1626
|
*/
|
|
1990
1627
|
scaler_spawn_timeout_ms: ColumnType<string | null, number | null | undefined, number | null>;
|
|
1991
1628
|
/**
|
|
1992
|
-
*
|
|
1993
|
-
*
|
|
1994
|
-
*
|
|
1995
|
-
* BIGINT — pg returns a string on select; accept a number on insert/update.
|
|
1629
|
+
* Reroute spawn window (ms): how long after a peer ACKs a reroute the coordinator waits
|
|
1630
|
+
* before treating "accepted but no progress" as a spawn failure and re-dispatching. Null =
|
|
1631
|
+
* cluster default (config.rerouteSpawnWindowMs). BIGINT.
|
|
1996
1632
|
*/
|
|
1997
1633
|
reroute_spawn_window_ms: ColumnType<string | null, number | null | undefined, number | null>;
|
|
1998
1634
|
/**
|
|
1999
|
-
*
|
|
2000
|
-
*
|
|
1635
|
+
* Reroute sendAndWaitAck deadline (ms). Null = cluster default (config.rerouteAckTimeoutMs).
|
|
1636
|
+
* BIGINT.
|
|
2001
1637
|
*/
|
|
2002
1638
|
reroute_ack_timeout_ms: ColumnType<string | null, number | null | undefined, number | null>;
|
|
2003
|
-
/**
|
|
2004
|
-
* Per-org maximum peer hops for a rerouted job. Null = cluster default
|
|
2005
|
-
* (config.rerouteMaxHops). Plain INTEGER — pg returns a number on select.
|
|
2006
|
-
*/
|
|
1639
|
+
/** Max peer hops for a rerouted job. Null = cluster default (config.rerouteMaxHops). INTEGER. */
|
|
2007
1640
|
reroute_max_hops: ColumnType<number | null, number | null | undefined, number | null>;
|
|
2008
1641
|
/**
|
|
2009
|
-
*
|
|
2010
|
-
*
|
|
1642
|
+
* Agent spawns a worker attempts for one rerouted job. Null = cluster default
|
|
1643
|
+
* (config.rerouteSpawnMaxAttempts). INTEGER.
|
|
2011
1644
|
*/
|
|
2012
1645
|
reroute_spawn_max_attempts: ColumnType<number | null, number | null | undefined, number | null>;
|
|
2013
1646
|
/**
|
|
2014
|
-
*
|
|
2015
|
-
*
|
|
1647
|
+
* Wait (ms) after a failed spawn of a rerouted job. Null = cluster default
|
|
1648
|
+
* (config.rerouteSpawnRetryBackoffMs). BIGINT.
|
|
2016
1649
|
*/
|
|
2017
1650
|
reroute_spawn_retry_backoff_ms: ColumnType<string | null, number | null | undefined, number | null>;
|
|
2018
1651
|
/**
|
|
2019
|
-
*
|
|
2020
|
-
*
|
|
1652
|
+
* DB-backup freshness diagnostic threshold (hours). Null = cluster default
|
|
1653
|
+
* (config.backupStalenessWarnHours). INTEGER.
|
|
2021
1654
|
*/
|
|
2022
1655
|
backup_staleness_warn_hours: ColumnType<number | null, number | null | undefined, number | null>;
|
|
2023
1656
|
/**
|
|
2024
|
-
*
|
|
1657
|
+
* Dispatch-queue job timeout (ms): a queued job's deadline is
|
|
2025
1658
|
* `job.timeoutMs ?? <this> ?? config.queueTimeoutMs`. Null = cluster default
|
|
2026
|
-
* (config.queueTimeoutMs / KICI_QUEUE_TIMEOUT_MS).
|
|
2027
|
-
* returns a string on select; accept a number on insert/update.
|
|
1659
|
+
* (config.queueTimeoutMs / KICI_QUEUE_TIMEOUT_MS). BIGINT.
|
|
2028
1660
|
*/
|
|
2029
1661
|
queue_timeout_ms: ColumnType<string | null, number | null | undefined, number | null>;
|
|
2030
1662
|
/**
|
|
2031
|
-
*
|
|
2032
|
-
*
|
|
2033
|
-
*
|
|
2034
|
-
* KICI_CACHE_UPLOAD_SETTLE_TIMEOUT_MS). Postgres BIGINT — pg returns a string
|
|
2035
|
-
* on select; accept a number on insert/update.
|
|
1663
|
+
* Bound (ms) on how long a build job's success waits for the cache publish its agent
|
|
1664
|
+
* reported just before; 0 turns the wait off. Null = cluster default
|
|
1665
|
+
* (config.cacheUploadSettleTimeoutMs / KICI_CACHE_UPLOAD_SETTLE_TIMEOUT_MS). BIGINT.
|
|
2036
1666
|
*/
|
|
2037
1667
|
cache_upload_settle_timeout_ms: ColumnType<string | null, number | null | undefined, number | null>;
|
|
2038
1668
|
/**
|
|
2039
|
-
*
|
|
2040
|
-
*
|
|
2041
|
-
* `requireApproval` `timeout` overrides this per element.
|
|
1669
|
+
* Seconds before a held approval element is rejected and its run/job/step fails. NOT NULL,
|
|
1670
|
+
* default 86400 (one day); an SDK `requireApproval` `timeout` overrides it per element.
|
|
2042
1671
|
*/
|
|
2043
1672
|
approval_expiry_seconds: ColumnType<number, number | undefined, number>;
|
|
2044
1673
|
/**
|
|
2045
|
-
* Whether
|
|
2046
|
-
*
|
|
1674
|
+
* Whether a run's triggering user may approve its held elements. NOT NULL, default true;
|
|
1675
|
+
* turn it off to enforce four-eyes review.
|
|
2047
1676
|
*/
|
|
2048
1677
|
allow_self_approval: ColumnType<boolean, boolean | undefined, boolean>;
|
|
2049
1678
|
/**
|
|
2050
|
-
*
|
|
2051
|
-
*
|
|
2052
|
-
* reads as `[]` (deny every capability request). Postgres TEXT[].
|
|
1679
|
+
* Sandbox escape-hatch allow-list: Linux capabilities a workflow may request via SDK
|
|
1680
|
+
* `sandbox: { capabilities }`. NULL reads as `[]` (deny every request). TEXT[].
|
|
2053
1681
|
*/
|
|
2054
1682
|
sandbox_allowed_capabilities: ColumnType<string[] | null, string[] | null | undefined, string[] | null>;
|
|
2055
1683
|
/**
|
|
2056
|
-
*
|
|
2057
|
-
*
|
|
2058
|
-
* networking). Postgres BOOLEAN.
|
|
1684
|
+
* Sandbox escape-hatch: whether a workflow may request `sandbox: { network: 'host' }`. NULL
|
|
1685
|
+
* reads as `false` (deny host networking).
|
|
2059
1686
|
*/
|
|
2060
1687
|
sandbox_allow_host_network: ColumnType<boolean | null, boolean | null | undefined, boolean | null>;
|
|
2061
|
-
/** When this setting was created */
|
|
2062
1688
|
created_at: Generated<Date>;
|
|
2063
|
-
/** When this setting was last updated */
|
|
2064
1689
|
updated_at: Generated<Date>;
|
|
2065
1690
|
}
|
|
2066
1691
|
export type OrgSettings = Selectable<OrgSettingsTable>;
|
|
2067
1692
|
export type NewOrgSettings = Insertable<OrgSettingsTable>;
|
|
2068
1693
|
export type OrgSettingsUpdate = Updateable<OrgSettingsTable>;
|
|
2069
1694
|
/**
|
|
2070
|
-
*
|
|
2071
|
-
*
|
|
2072
|
-
*
|
|
2073
|
-
*
|
|
2074
|
-
* wrote the row.
|
|
2075
|
-
*
|
|
2076
|
-
* The policy column is plain `string`, not the Zod enum that names the known
|
|
2077
|
-
* vocabulary — same reasoning as `held_runs.hold_type`: a value written by a
|
|
2078
|
-
* newer Platform must still be readable rather than failing the row.
|
|
1695
|
+
* The orchestrator's cache of the Platform-owned per-org trust policy from
|
|
1696
|
+
* `trust_policy.update`; `org_settings` is the operator-owned counterpart. The policy column is
|
|
1697
|
+
* a plain `string`, not the Zod enum, so a value from a newer Platform stays readable (as with
|
|
1698
|
+
* `held_runs.hold_type`).
|
|
2079
1699
|
*/
|
|
2080
1700
|
export interface OrgTrustPolicyTable {
|
|
2081
1701
|
/** Customer/org identifier (primary key) */
|
|
@@ -2086,26 +1706,19 @@ export interface OrgTrustPolicyTable {
|
|
|
2086
1706
|
approval_expiry_seconds: number;
|
|
2087
1707
|
/** Which side last wrote this row: platform | local */
|
|
2088
1708
|
source: string;
|
|
2089
|
-
/** When this policy was last written */
|
|
2090
1709
|
updated_at: ColumnType<Date, Date | undefined, Date>;
|
|
2091
1710
|
}
|
|
2092
1711
|
export type OrgTrustPolicy = Selectable<OrgTrustPolicyTable>;
|
|
2093
1712
|
export type NewOrgTrustPolicy = Insertable<OrgTrustPolicyTable>;
|
|
2094
1713
|
export type OrgTrustPolicyUpdate = Updateable<OrgTrustPolicyTable>;
|
|
2095
1714
|
/**
|
|
2096
|
-
*
|
|
2097
|
-
*
|
|
2098
|
-
*
|
|
2099
|
-
*
|
|
2100
|
-
* policy
|
|
2101
|
-
*
|
|
2102
|
-
*
|
|
2103
|
-
* `kici-admin trust-policy directory-set` instead.
|
|
2104
|
-
*
|
|
2105
|
-
* The three JSONB columns are `unknown` on the select side because the pg
|
|
2106
|
-
* driver hands back whatever JSON the column holds; `TrustDirectoryStore`
|
|
2107
|
-
* validates each one against the wire schema before returning it. Inserts are
|
|
2108
|
-
* `JSON.stringify`d strings, matching every other JSONB column here.
|
|
1715
|
+
* The approval directory `/kici approve` resolves a commenter against: identity links, per-member
|
|
1716
|
+
* CI trust levels and team memberships. With a Platform attached, it pushes this beside the
|
|
1717
|
+
* policy on `trust_policy.update` and the orchestrator only reads it back, so approvals survive
|
|
1718
|
+
* a restart; an independent orchestrator's operator writes it with
|
|
1719
|
+
* `kici-admin trust-policy directory-set`. JSONB columns select as `unknown` because pg returns
|
|
1720
|
+
* whatever JSON is stored; `TrustDirectoryStore` validates each against the wire schema.
|
|
1721
|
+
* Inserts are `JSON.stringify`d strings.
|
|
2109
1722
|
*/
|
|
2110
1723
|
export interface OrgTrustDirectoryTable {
|
|
2111
1724
|
/** Customer/org identifier (primary key) */
|
|
@@ -2116,21 +1729,17 @@ export interface OrgTrustDirectoryTable {
|
|
|
2116
1729
|
member_ci_trust: ColumnType<unknown, string, string>;
|
|
2117
1730
|
/** JSONB array of `{ teamName, memberUserIds }` entries */
|
|
2118
1731
|
team_memberships: ColumnType<unknown, string, string>;
|
|
2119
|
-
/** When this directory was last written */
|
|
2120
1732
|
updated_at: ColumnType<Date, Date | undefined, Date>;
|
|
2121
1733
|
}
|
|
2122
1734
|
export type OrgTrustDirectory = Selectable<OrgTrustDirectoryTable>;
|
|
2123
1735
|
export type NewOrgTrustDirectory = Insertable<OrgTrustDirectoryTable>;
|
|
2124
1736
|
export type OrgTrustDirectoryUpdate = Updateable<OrgTrustDirectoryTable>;
|
|
2125
1737
|
/**
|
|
2126
|
-
*
|
|
2127
|
-
*
|
|
2128
|
-
*
|
|
2129
|
-
* ownership shape as org_trust_policy: the Platform writes it, the orchestrator
|
|
2130
|
-
* only reads it back, so it survives a Platform outage + a coordinator restart.
|
|
1738
|
+
* Cache of the Platform-owned worker ceiling pushed on `plan.headroom`. Single row
|
|
1739
|
+
* (id='default'): the orchestrator serves exactly one org. The Platform writes it and the
|
|
1740
|
+
* orchestrator only reads it back, so it survives a Platform outage plus a coordinator restart.
|
|
2131
1741
|
*/
|
|
2132
1742
|
export interface OrgPlanHeadroomTable {
|
|
2133
|
-
/** Single-row sentinel id, always 'default'. */
|
|
2134
1743
|
id: string;
|
|
2135
1744
|
/** Absolute ceiling on this coordinator's connected worker peers. */
|
|
2136
1745
|
max_worker_peers: number;
|
|
@@ -2140,23 +1749,18 @@ export interface OrgPlanHeadroomTable {
|
|
|
2140
1749
|
org_total: number;
|
|
2141
1750
|
/** Whether the Platform asked the coordinator to drain its excess workers. */
|
|
2142
1751
|
evict_excess: boolean;
|
|
2143
|
-
/** When this ceiling was last written. */
|
|
2144
1752
|
updated_at: ColumnType<Date, Date, Date>;
|
|
2145
1753
|
}
|
|
2146
1754
|
/**
|
|
2147
|
-
*
|
|
2148
|
-
*
|
|
2149
|
-
*
|
|
2150
|
-
* org_settings (per customer_id) — these knobs have no per-tenant meaning.
|
|
2151
|
-
* Byte-valued knobs are Postgres BIGINT (pg returns a string on select); count
|
|
2152
|
-
* / seconds knobs are INTEGER (pg returns a number).
|
|
1755
|
+
* Single row (id='default') of fleet-wide operator tunables with no per-tenant meaning, read via
|
|
1756
|
+
* ClusterSettingsReader. Each knob is nullable; NULL = the config.ts default. A BIGINT knob (every
|
|
1757
|
+
* byte-valued knob, and some counts) reads back as a string; an INTEGER knob as a number.
|
|
2153
1758
|
*/
|
|
2154
1759
|
export interface ClusterSettingsTable {
|
|
2155
1760
|
/**
|
|
2156
|
-
* Database-side retention windows
|
|
2157
|
-
*
|
|
2158
|
-
*
|
|
2159
|
-
* on, the archivers keep sole ownership of the tables they register.
|
|
1761
|
+
* Database-side retention windows in days; 0 disables one. They prune the warm tables for
|
|
1762
|
+
* installs with no object store; with the cold store on, the archivers keep sole ownership
|
|
1763
|
+
* of the tables they register.
|
|
2160
1764
|
*/
|
|
2161
1765
|
run_retention_days: number | null;
|
|
2162
1766
|
audit_retention_days: number | null;
|
|
@@ -2180,125 +1784,107 @@ export interface ClusterSettingsTable {
|
|
|
2180
1784
|
event_router_rate_limit_per_workflow_per_minute: ColumnType<number | null, number | null | undefined, number | null>;
|
|
2181
1785
|
cache_max_tarball_bytes: ColumnType<string | null, number | null | undefined, number | null>;
|
|
2182
1786
|
cache_ttl_days: ColumnType<number | null, number | null | undefined, number | null>;
|
|
2183
|
-
/** LRU entry ceiling for the lock-file cache.
|
|
1787
|
+
/** LRU entry ceiling for the lock-file cache. Applies at next restart. */
|
|
2184
1788
|
lockfile_cache_max: ColumnType<string | null, number | null | undefined, number | null>;
|
|
2185
|
-
/** Byte ceiling for the lock-file cache.
|
|
1789
|
+
/** Byte ceiling for the lock-file cache. Applies at next restart. */
|
|
2186
1790
|
lockfile_cache_max_bytes: ColumnType<string | null, number | null | undefined, number | null>;
|
|
2187
|
-
/** Entry TTL (ms) for the lock-file cache.
|
|
1791
|
+
/** Entry TTL (ms) for the lock-file cache. Applies at next restart. */
|
|
2188
1792
|
lockfile_cache_ttl_ms: ColumnType<string | null, number | null | undefined, number | null>;
|
|
2189
|
-
/** LRU entry ceiling for the Tier-1 content cache.
|
|
1793
|
+
/** LRU entry ceiling for the Tier-1 content cache. Applies at next restart. */
|
|
2190
1794
|
content_cache_max: ColumnType<string | null, number | null | undefined, number | null>;
|
|
2191
|
-
/** Byte ceiling for the Tier-1 content cache.
|
|
1795
|
+
/** Byte ceiling for the Tier-1 content cache. Applies at next restart. */
|
|
2192
1796
|
content_cache_max_bytes: ColumnType<string | null, number | null | undefined, number | null>;
|
|
2193
|
-
/** Entry TTL (ms) for the Tier-1 content cache.
|
|
1797
|
+
/** Entry TTL (ms) for the Tier-1 content cache. Applies at next restart. */
|
|
2194
1798
|
content_cache_ttl_ms: ColumnType<string | null, number | null | undefined, number | null>;
|
|
2195
|
-
/** Wall-clock budget (ms) for a whole Tier-2 global eval round.
|
|
1799
|
+
/** Wall-clock budget (ms) for a whole Tier-2 global eval round. Read per round. */
|
|
2196
1800
|
global_eval_round_timeout_ms: ColumnType<string | null, number | null | undefined, number | null>;
|
|
2197
|
-
/** Wall-clock budget (ms) for one candidate inside a round.
|
|
1801
|
+
/** Wall-clock budget (ms) for one candidate inside a round. Read per round. */
|
|
2198
1802
|
global_eval_candidate_timeout_ms: ColumnType<string | null, number | null | undefined, number | null>;
|
|
2199
|
-
/** LRU entry ceiling for the round-result cache.
|
|
1803
|
+
/** LRU entry ceiling for the round-result cache. Applies at next restart. */
|
|
2200
1804
|
global_eval_cache_max: ColumnType<string | null, number | null | undefined, number | null>;
|
|
2201
1805
|
/**
|
|
2202
|
-
* Orchestrator-side ceiling (ms) on waiting for one eval round to settle.
|
|
2203
|
-
*
|
|
2204
|
-
*
|
|
2205
|
-
* budget starts — is only bounded here. NULL ⇒ the configured default. Read
|
|
2206
|
-
* per round.
|
|
1806
|
+
* Orchestrator-side ceiling (ms) on waiting for one eval round to settle. The round and
|
|
1807
|
+
* candidate budgets are agent-enforced, so a round that never reaches an agent, or an agent
|
|
1808
|
+
* that wedges before its budget starts, is bounded only here. Read per round.
|
|
2207
1809
|
*/
|
|
2208
1810
|
global_eval_wait_timeout_ms: ColumnType<string | null, number | null | undefined, number | null>;
|
|
2209
|
-
/** How long a Firecracker spawn waits for the VM's API socket.
|
|
1811
|
+
/** How long a Firecracker spawn waits for the VM's API socket. */
|
|
2210
1812
|
firecracker_api_socket_wait_ms: ColumnType<string | null, number | null | undefined, number | null>;
|
|
2211
1813
|
/**
|
|
2212
|
-
* Retention
|
|
2213
|
-
*
|
|
2214
|
-
* NULL ⇒ the orchestrator's configured default.
|
|
1814
|
+
* Retention in days for `check_run_tracking`: the hourly cleanup deletes rows untouched for
|
|
1815
|
+
* longer; 0 disables the sweep.
|
|
2215
1816
|
*/
|
|
2216
1817
|
check_run_tracking_ttl_days: ColumnType<number | null, number | null | undefined, number | null>;
|
|
2217
1818
|
/**
|
|
2218
|
-
* Grace
|
|
2219
|
-
* terminalized as `unroutable`. NULL = the orchestrator's configured default;
|
|
1819
|
+
* Grace (ms) a job may stay continuously unroutable before it terminalizes as `unroutable`;
|
|
2220
1820
|
* 0 disables fast-fail, leaving `queue_timeout_ms` as the only backstop.
|
|
2221
1821
|
*/
|
|
2222
1822
|
unroutable_grace_ms: ColumnType<number | null, number | null | undefined, number | null>;
|
|
2223
1823
|
/**
|
|
2224
|
-
* Fleet-wide master switch for global workflows
|
|
2225
|
-
*
|
|
2226
|
-
*
|
|
2227
|
-
* reports an unreadable row separately so the gate can fail closed.
|
|
1824
|
+
* Fleet-wide master switch for global workflows (default `KICI_GLOBAL_WORKFLOWS_ENABLED`,
|
|
1825
|
+
* false). Read per policy decision via `ClusterSettingsReader.tryGetBoolean`, which reports
|
|
1826
|
+
* an unreadable row separately so the gate fails closed.
|
|
2228
1827
|
*/
|
|
2229
1828
|
global_workflows_enabled: ColumnType<boolean | null, boolean | null | undefined, boolean | null>;
|
|
2230
1829
|
/**
|
|
2231
|
-
* How long a `replaying` claim on `ingest_overflow_buffer`
|
|
2232
|
-
* the
|
|
2233
|
-
* orchestrator's configured default. Must exceed the longest a single
|
|
2234
|
-
* delivery's pipeline can legitimately run.
|
|
1830
|
+
* How long a `replaying` claim on `ingest_overflow_buffer` stands before the drain pass
|
|
1831
|
+
* reclaims the row. Must exceed the longest legitimate single-delivery pipeline run.
|
|
2235
1832
|
*/
|
|
2236
1833
|
ingest_overflow_claim_timeout_ms: ColumnType<number | null, number | null | undefined, number | null>;
|
|
2237
1834
|
concurrency_wait_timeout_ms: ColumnType<string | null, number | null | undefined, number | null>;
|
|
2238
1835
|
agent_token_ttl_ms: ColumnType<string | null, number | null | undefined, number | null>;
|
|
2239
1836
|
/**
|
|
2240
|
-
* How often the leader sweeps for stranded event-scaler provisions. Re-read
|
|
2241
|
-
*
|
|
2242
|
-
* tick rather than waiting for a leadership transition. NULL ⇒ the
|
|
2243
|
-
* orchestrator's configured default.
|
|
1837
|
+
* How often the leader sweeps for stranded event-scaler provisions. Re-read after every
|
|
1838
|
+
* sweep, so a change reschedules on the next tick, not at a leadership transition.
|
|
2244
1839
|
*/
|
|
2245
1840
|
scaler_reap_interval_ms: ColumnType<string | null, number | null | undefined, number | null>;
|
|
2246
1841
|
/**
|
|
2247
|
-
* How long an adopted event-scaler provision whose agent is registered
|
|
2248
|
-
*
|
|
2249
|
-
* heartbeat
|
|
2250
|
-
* derived. NULL ⇒ the orchestrator's configured default. Read per sweep.
|
|
1842
|
+
* How long an adopted event-scaler provision whose agent is registered nowhere may sit
|
|
1843
|
+
* before teardown. Keep it well above the peer heartbeat period: "registered nowhere" is
|
|
1844
|
+
* partly heartbeat-derived. Read per sweep.
|
|
2251
1845
|
*/
|
|
2252
1846
|
scaler_reap_stranded_timeout_ms: ColumnType<string | null, number | null | undefined, number | null>;
|
|
2253
1847
|
/**
|
|
2254
|
-
* How long before the reaper retries a provision whose
|
|
2255
|
-
*
|
|
2256
|
-
* sweep.
|
|
1848
|
+
* How long before the reaper retries a provision whose last teardown left the row in place.
|
|
1849
|
+
* Read per sweep.
|
|
2257
1850
|
*/
|
|
2258
1851
|
scaler_reap_reattempt_interval_ms: ColumnType<string | null, number | null | undefined, number | null>;
|
|
2259
1852
|
/**
|
|
2260
|
-
* How long an expired
|
|
2261
|
-
*
|
|
2262
|
-
*
|
|
2263
|
-
* code". NULL ⇒ the orchestrator's configured default. Read per sweep.
|
|
1853
|
+
* How long the reaper keeps an expired provisioning claim. It is never redeemable, so this
|
|
1854
|
+
* only sets how long a late redeemer hears "expired" instead of "unknown code". Read per
|
|
1855
|
+
* sweep.
|
|
2264
1856
|
*/
|
|
2265
1857
|
scaler_claim_retention_ms: ColumnType<string | null, number | null | undefined, number | null>;
|
|
2266
1858
|
/**
|
|
2267
|
-
* First deferral
|
|
2268
|
-
*
|
|
2269
|
-
*
|
|
2270
|
-
* default. Read per spawn request.
|
|
1859
|
+
* First deferral for an external (event) scaler after one provisioning failure; each further
|
|
1860
|
+
* consecutive failure doubles it, up to `scaler_provision_backoff_max_ms`. Read per spawn
|
|
1861
|
+
* request.
|
|
2271
1862
|
*/
|
|
2272
1863
|
scaler_provision_backoff_base_ms: ColumnType<string | null, number | null | undefined, number | null>;
|
|
2273
1864
|
/**
|
|
2274
|
-
* Ceiling on
|
|
2275
|
-
*
|
|
2276
|
-
* orchestrator's configured default. Read per spawn request.
|
|
1865
|
+
* Ceiling on that doubling, so a long provider outage settles into a steady retry cadence.
|
|
1866
|
+
* Read per spawn request.
|
|
2277
1867
|
*/
|
|
2278
1868
|
scaler_provision_backoff_max_ms: ColumnType<string | null, number | null | undefined, number | null>;
|
|
2279
1869
|
/**
|
|
2280
|
-
*
|
|
2281
|
-
*
|
|
2282
|
-
* NULL ⇒ the orchestrator's configured default. Read per spawn request.
|
|
1870
|
+
* Consecutive provisioning failures before a scaler's refusals name repeated failure, not a
|
|
1871
|
+
* single timeout, as the cause. Read per spawn request.
|
|
2283
1872
|
*/
|
|
2284
1873
|
scaler_provision_max_consecutive_failures: ColumnType<string | null, number | null | undefined, number | null>;
|
|
2285
1874
|
/**
|
|
2286
|
-
* Deadline for one
|
|
2287
|
-
*
|
|
2288
|
-
* violation. NULL ⇒ the orchestrator's configured default.
|
|
1875
|
+
* Deadline for one DB-backed agent-ownership lookup; past it the lookup is undecided and the
|
|
1876
|
+
* frame is refused without counting a violation.
|
|
2289
1877
|
*/
|
|
2290
1878
|
ownership_db_check_timeout_ms: ColumnType<string | null, number | null | undefined, number | null>;
|
|
2291
1879
|
/**
|
|
2292
|
-
* How long a coordinator leaves a queued job alone after
|
|
2293
|
-
*
|
|
2294
|
-
* configured default.
|
|
1880
|
+
* How long a coordinator leaves a queued job alone after failing to open its sealed secrets
|
|
1881
|
+
* before claiming it again.
|
|
2295
1882
|
*/
|
|
2296
1883
|
sealed_secrets_retry_backoff_ms: ColumnType<string | null, number | null | undefined, number | null>;
|
|
2297
1884
|
/**
|
|
2298
|
-
* Verified-tier origin the dashboard fetches the orchestrator's X25519
|
|
2299
|
-
* dashboard-encryption public key from
|
|
2300
|
-
*
|
|
2301
|
-
* is not offered and the convenient tier is used.
|
|
1885
|
+
* Verified-tier origin the dashboard fetches (and always displays) the orchestrator's X25519
|
|
1886
|
+
* dashboard-encryption public key from, under the `encrypted` write posture. Explicit opt-in:
|
|
1887
|
+
* NULL means the tier is not offered and the convenient tier is used.
|
|
2302
1888
|
*/
|
|
2303
1889
|
dashboard_verified_issuer: ColumnType<string | null, string | null | undefined, string | null>;
|
|
2304
1890
|
/** Monotonic settings version; bumped on each real settings change, advertised to workers. */
|
|
@@ -2310,81 +1896,55 @@ export type ClusterSettings = Selectable<ClusterSettingsTable>;
|
|
|
2310
1896
|
export type NewClusterSettings = Insertable<ClusterSettingsTable>;
|
|
2311
1897
|
export type ClusterSettingsUpdate = Updateable<ClusterSettingsTable>;
|
|
2312
1898
|
/**
|
|
2313
|
-
*
|
|
2314
|
-
*
|
|
2315
|
-
*
|
|
2316
|
-
* Rows are created at storePendingJobContext time, deleted on consume or run completion.
|
|
1899
|
+
* Persisted PendingJobContext for crash recovery of needs-gated jobs, keyed by (run_id,
|
|
1900
|
+
* job_name) like the in-memory Map. Created by storePendingJobContext, deleted on consume or
|
|
1901
|
+
* run completion.
|
|
2317
1902
|
*/
|
|
2318
1903
|
export interface PendingJobContextsTable {
|
|
2319
|
-
/** Run identifier */
|
|
2320
1904
|
run_id: string;
|
|
2321
|
-
/** Job name within the workflow */
|
|
2322
1905
|
job_name: string;
|
|
2323
1906
|
/** Full QueuedJobInput serialized as JSONB */
|
|
2324
1907
|
job_input: ColumnType<Record<string, unknown>, string, string>;
|
|
2325
1908
|
/** string[] of labels serialized as JSONB */
|
|
2326
1909
|
runs_on_labels: ColumnType<string[], string, string>;
|
|
2327
1910
|
/**
|
|
2328
|
-
*
|
|
2329
|
-
*
|
|
2330
|
-
*
|
|
2331
|
-
* instead of dispatching to an agent. NULL for every ordinary job.
|
|
1911
|
+
* An invoke-gate job's parameters (event, payload, optional, maxParallel, failFast) as JSON.
|
|
1912
|
+
* Non-null marks a gate: on release it summons the source repo's subscribers instead of
|
|
1913
|
+
* dispatching to an agent. NULL for every ordinary job.
|
|
2332
1914
|
*/
|
|
2333
1915
|
invoke_config: ColumnType<string | null, string | null | undefined, string | null>;
|
|
2334
1916
|
/**
|
|
2335
|
-
*
|
|
2336
|
-
*
|
|
2337
|
-
*
|
|
2338
|
-
*
|
|
2339
|
-
* existed, whose `job_input` still carries its resolved context data.
|
|
1917
|
+
* JSONB inputs the stored job's dispatch resolves context variables and secrets from (context
|
|
1918
|
+
* names, org, routing key, host facts, registry-auth inputs); never a secret value. NULL for a
|
|
1919
|
+
* job with no bound context and for a pre-column row, whose `job_input` carries the resolved
|
|
1920
|
+
* context data.
|
|
2340
1921
|
*/
|
|
2341
1922
|
context_resolution: ColumnType<DeferredContextResolution | null, string | null | undefined, string | null>;
|
|
2342
|
-
/**
|
|
2343
|
-
* The secret fields of the stored job, AES-256-GCM encrypted under the
|
|
2344
|
-
* orchestrator master key (`secrets/job-secret-seal.ts`). NULL when there is
|
|
2345
|
-
* nothing to seal, when no master key is configured, and on a row written
|
|
2346
|
-
* before the column existed: those rows keep the fields in the plain column.
|
|
2347
|
-
*/
|
|
1923
|
+
/** Sealed secret fields; same contract as `dispatch_queue.sealed_secrets`. */
|
|
2348
1924
|
sealed_secrets: ColumnType<string | null, string | null | undefined, string | null>;
|
|
2349
|
-
/** When this context was stored */
|
|
2350
1925
|
created_at: Generated<Date>;
|
|
2351
1926
|
}
|
|
2352
1927
|
export type PendingJobContextRow = Selectable<PendingJobContextsTable>;
|
|
2353
1928
|
export type NewPendingJobContext = Insertable<PendingJobContextsTable>;
|
|
2354
1929
|
/**
|
|
2355
|
-
*
|
|
2356
|
-
*
|
|
2357
|
-
* workflow whose install gate held. One row per held run (keyed by run_id).
|
|
2358
|
-
* Created at hold time, deleted once the resume dispatch is kicked off.
|
|
1930
|
+
* Serializable WorkflowDispatchContext inputs to resume a workflow whose install gate held. One
|
|
1931
|
+
* row per held run, created at hold time and deleted once the resume dispatch starts.
|
|
2359
1932
|
*/
|
|
2360
1933
|
export interface PendingWorkflowContextsTable {
|
|
2361
|
-
/** Run identifier (one pending dispatch per run) */
|
|
2362
1934
|
run_id: string;
|
|
2363
|
-
/** Organization id */
|
|
2364
1935
|
org_id: string;
|
|
2365
1936
|
/** Serializable WorkflowDispatchContext inputs as JSONB */
|
|
2366
1937
|
context: ColumnType<Record<string, unknown>, string, string>;
|
|
2367
|
-
/**
|
|
2368
|
-
* The secret fields of the stored job, AES-256-GCM encrypted under the
|
|
2369
|
-
* orchestrator master key (`secrets/job-secret-seal.ts`). NULL when there is
|
|
2370
|
-
* nothing to seal, when no master key is configured, and on a row written
|
|
2371
|
-
* before the column existed: those rows keep the fields in the plain column.
|
|
2372
|
-
*/
|
|
1938
|
+
/** Sealed secret fields; same contract as `dispatch_queue.sealed_secrets`. */
|
|
2373
1939
|
sealed_secrets: ColumnType<string | null, string | null | undefined, string | null>;
|
|
2374
|
-
/** When this context was stored */
|
|
2375
1940
|
created_at: Generated<Date>;
|
|
2376
1941
|
}
|
|
2377
1942
|
export type PendingWorkflowContextRow = Selectable<PendingWorkflowContextsTable>;
|
|
2378
1943
|
export type NewPendingWorkflowContext = Insertable<PendingWorkflowContextsTable>;
|
|
2379
1944
|
/**
|
|
2380
|
-
*
|
|
2381
|
-
*
|
|
2382
|
-
*
|
|
2383
|
-
*
|
|
2384
|
-
* Payload bytes live in object storage (LogStorage) at `payload_key`. When
|
|
2385
|
-
* `payload_omitted=true`, the payload was not stored (size cap or upload
|
|
2386
|
-
* failure) -- the metadata + hash + size are still durable for correlation.
|
|
2387
|
-
*
|
|
1945
|
+
* One row per inbound webhook delivery (relay or direct), whatever the outcome; joins the
|
|
1946
|
+
* Platform-side `event_log` on `(org_id, delivery_id)`. Payload bytes live in LogStorage at
|
|
1947
|
+
* `payload_key`; an omitted payload still keeps metadata, hash and size for correlation.
|
|
2388
1948
|
* Retention: 30 days, cleaned by queue/cleanup.ts.
|
|
2389
1949
|
*/
|
|
2390
1950
|
export interface EventLogTable {
|
|
@@ -2426,7 +1986,6 @@ export interface EventLogTable {
|
|
|
2426
1986
|
run_id: string | null;
|
|
2427
1987
|
/** Failure reason when status='failed' */
|
|
2428
1988
|
error_message: string | null;
|
|
2429
|
-
/** When the delivery was received */
|
|
2430
1989
|
received_at: Generated<Date>;
|
|
2431
1990
|
/** Cold-store: set inside the archive transaction; NULL for hot rows. */
|
|
2432
1991
|
archived_at: Date | null;
|
|
@@ -2437,11 +1996,9 @@ export type EventLogRow = Selectable<EventLogTable>;
|
|
|
2437
1996
|
export type NewEventLogRow = Insertable<EventLogTable>;
|
|
2438
1997
|
export type EventLogRowUpdate = Updateable<EventLogTable>;
|
|
2439
1998
|
/**
|
|
2440
|
-
*
|
|
2441
|
-
*
|
|
2442
|
-
*
|
|
2443
|
-
* CLI can report totals without S3 LIST calls. The cold-store archiver
|
|
2444
|
-
* populates it transactionally on each chunk write.
|
|
1999
|
+
* Per-(db, table, tenant) archived-chunk totals, so the `cold_store_chunks_total` gauge and
|
|
2000
|
+
* `kici-admin cold-store list-chunks` need no S3 LIST. The archiver updates it transactionally
|
|
2001
|
+
* on each chunk write.
|
|
2445
2002
|
*/
|
|
2446
2003
|
export interface ColdStoreChunkCountsTable {
|
|
2447
2004
|
/** DbKind identifier ('orchestrator' on this side). */
|
|
@@ -2463,13 +2020,9 @@ export type ColdStoreChunkCountsRow = Selectable<ColdStoreChunkCountsTable>;
|
|
|
2463
2020
|
export type NewColdStoreChunkCountsRow = Insertable<ColdStoreChunkCountsTable>;
|
|
2464
2021
|
export type ColdStoreChunkCountsUpdate = Updateable<ColdStoreChunkCountsTable>;
|
|
2465
2022
|
/**
|
|
2466
|
-
*
|
|
2467
|
-
*
|
|
2468
|
-
*
|
|
2469
|
-
* Inserted inside `markArchivedAndDelete`'s transaction by adapters that
|
|
2470
|
-
* opt into the per-bucket layout via `coldTtlDays(row)`. V1
|
|
2471
|
-
* chunks are NOT in this table — they're treated as
|
|
2472
|
-
* `'forever'` and never purged.
|
|
2023
|
+
* One row per archived chunk the GC sweep can later purge from S3, inserted in
|
|
2024
|
+
* `markArchivedAndDelete`'s transaction by adapters that opt into the per-bucket layout via
|
|
2025
|
+
* `coldTtlDays(row)`. V1 chunks are NOT here: they count as `'forever'` and are never purged.
|
|
2473
2026
|
*/
|
|
2474
2027
|
export interface ColdStoreChunksTable {
|
|
2475
2028
|
/** DbKind identifier ('orchestrator' on this side). */
|
|
@@ -2488,13 +2041,11 @@ export interface ColdStoreChunksTable {
|
|
|
2488
2041
|
archived_at: Generated<Date>;
|
|
2489
2042
|
/** Compressed size of the data chunk (bytes). */
|
|
2490
2043
|
gzip_bytes: ColumnType<string, string | number, string | number>;
|
|
2491
|
-
/** Number of rows in the chunk. */
|
|
2492
2044
|
row_count: ColumnType<string, string | number, string | number>;
|
|
2493
2045
|
/**
|
|
2494
|
-
* Row-level cold-retention horizon
|
|
2495
|
-
*
|
|
2496
|
-
* `max_cold_days != 'forever' AND now() > archived_at + max_cold_days
|
|
2497
|
-
* * INTERVAL '1 day'`.
|
|
2046
|
+
* Row-level cold-retention horizon: TEXT holding a day count or the literal `'forever'`. The
|
|
2047
|
+
* GC sweep checks
|
|
2048
|
+
* `max_cold_days != 'forever' AND now() > archived_at + max_cold_days * INTERVAL '1 day'`.
|
|
2498
2049
|
*/
|
|
2499
2050
|
max_cold_days: string;
|
|
2500
2051
|
/** Full S3 key of the data chunk (used by the GC sweep's DeleteObject). */
|
|
@@ -2504,88 +2055,66 @@ export type ColdStoreChunksRow = Selectable<ColdStoreChunksTable>;
|
|
|
2504
2055
|
export type NewColdStoreChunksRow = Insertable<ColdStoreChunksTable>;
|
|
2505
2056
|
export type ColdStoreChunksUpdate = Updateable<ColdStoreChunksTable>;
|
|
2506
2057
|
/**
|
|
2507
|
-
*
|
|
2508
|
-
*
|
|
2509
|
-
*
|
|
2510
|
-
* `
|
|
2511
|
-
* Raft leader switch reads this table to recover check-run IDs, build
|
|
2512
|
-
* creation state, step-progress entries, in-progress-sent timestamps, and
|
|
2513
|
-
* the run-id reverse index used for cleanup. A coord crash mid-check-run
|
|
2514
|
-
* no longer leaves a GitHub check stuck in `queued` forever.
|
|
2058
|
+
* HA-safe `CheckRunReporter` state: a replacement coord after a Raft leader switch recovers
|
|
2059
|
+
* check-run IDs, build creation state, step progress, in-progress-sent timestamps and the run-id
|
|
2060
|
+
* cleanup index from here, so a coord crash mid-check-run cannot leave a GitHub check stuck in
|
|
2061
|
+
* `queued`.
|
|
2515
2062
|
*/
|
|
2516
2063
|
export interface CheckRunTrackingTable {
|
|
2517
2064
|
/** Provider type (e.g. 'github'). */
|
|
2518
2065
|
provider: string;
|
|
2519
2066
|
/** Repo owner / namespace. */
|
|
2520
2067
|
owner: string;
|
|
2521
|
-
/** Repo name. */
|
|
2522
2068
|
repo: string;
|
|
2523
2069
|
/** Git commit SHA the check run is anchored to. */
|
|
2524
2070
|
sha: string;
|
|
2525
2071
|
/** Check-run name (e.g. 'kici/build', 'kici/build/job/test', 'kici/build/setup'). */
|
|
2526
2072
|
check_name: string;
|
|
2527
2073
|
/**
|
|
2528
|
-
* GitHub Checks API check-run ID
|
|
2529
|
-
*
|
|
2530
|
-
* 'pending'` before the create finishes).
|
|
2074
|
+
* GitHub Checks API check-run ID from `checks.create()`; null while the build create is in
|
|
2075
|
+
* flight (`build_creation_state = 'pending'`).
|
|
2531
2076
|
*/
|
|
2532
2077
|
check_run_id: ColumnType<number | null, number | null | undefined, number | null>;
|
|
2533
2078
|
/**
|
|
2534
|
-
* Build check-run creation state: 'pending' while a `setBuildPending`
|
|
2535
|
-
*
|
|
2536
|
-
* Replaces the in-memory `pendingBuildCreations` Promise map.
|
|
2079
|
+
* Build check-run creation state: 'pending' while a `setBuildPending` create is in flight,
|
|
2080
|
+
* 'completed' once `setBuildComplete` has reconciled.
|
|
2537
2081
|
*/
|
|
2538
2082
|
build_creation_state: ColumnType<string | null, string | null | undefined, string | null>;
|
|
2539
2083
|
/**
|
|
2540
|
-
*
|
|
2541
|
-
* `{ name: string, status: string, durationMs?: number }`. Replaces the
|
|
2542
|
-
* in-memory `stepProgress` map.
|
|
2084
|
+
* JSONB array of `{ name: string, status: string, durationMs?: number }` step-progress entries.
|
|
2543
2085
|
*/
|
|
2544
2086
|
step_progress_json: ColumnType<unknown, string | unknown, string | unknown>;
|
|
2545
2087
|
/**
|
|
2546
|
-
*
|
|
2547
|
-
*
|
|
2548
|
-
* boolean map (presence-as-truth).
|
|
2088
|
+
* When the first in-progress transition was sent to GitHub; NULL before the first running
|
|
2089
|
+
* step. Presence is the truth value.
|
|
2549
2090
|
*/
|
|
2550
2091
|
in_progress_sent_at: ColumnType<Date | null, Date | null | undefined, Date | null>;
|
|
2551
2092
|
/**
|
|
2552
|
-
* When the terminal (`completed`)
|
|
2553
|
-
*
|
|
2554
|
-
*
|
|
2555
|
-
* update failed.
|
|
2556
|
-
*
|
|
2557
|
-
* `check_run_id` is written at create time, while the check run is still
|
|
2558
|
-
* `queued`, so it proves creation and never completion. This column is the
|
|
2559
|
-
* completion signal.
|
|
2093
|
+
* When the provider accepted the terminal (`completed`) update: the completion signal, since
|
|
2094
|
+
* `check_run_id` is written while still `queued` and proves only creation. NULL means no
|
|
2095
|
+
* record of sending (never sent, or the best-effort write failed), never proof it failed.
|
|
2560
2096
|
*/
|
|
2561
2097
|
terminal_sent_at: ColumnType<Date | null, Date | null | undefined, Date | null>;
|
|
2562
2098
|
/**
|
|
2563
|
-
* KiCI run
|
|
2564
|
-
*
|
|
2565
|
-
*
|
|
2566
|
-
* the `updated_at`-age sweep, which deliberately ignores this column.
|
|
2099
|
+
* Owning KiCI run, written at create time; partial NOT NULL index so a per-run lookup never
|
|
2100
|
+
* scans. An attribution key, not a retention key: the `updated_at`-age sweep reclaims rows and
|
|
2101
|
+
* deliberately ignores it.
|
|
2567
2102
|
*/
|
|
2568
2103
|
run_id: ColumnType<string | null, string | null | undefined, string | null>;
|
|
2569
|
-
/** When this row was first inserted. */
|
|
2570
2104
|
created_at: Generated<Date>;
|
|
2571
|
-
/** When this row was last updated. */
|
|
2572
2105
|
updated_at: Generated<Date>;
|
|
2573
2106
|
}
|
|
2574
2107
|
export type CheckRunTrackingRow = Selectable<CheckRunTrackingTable>;
|
|
2575
2108
|
export type NewCheckRunTrackingRow = Insertable<CheckRunTrackingTable>;
|
|
2576
2109
|
export type CheckRunTrackingUpdate = Updateable<CheckRunTrackingTable>;
|
|
2577
2110
|
/**
|
|
2578
|
-
*
|
|
2579
|
-
*
|
|
2580
|
-
* One row per `ctx.attestProvenance` bundle uploaded to object storage. The
|
|
2581
|
-
* dashboard lists/fetches attestations by `(run_id, job_id)`.
|
|
2111
|
+
* One row per `ctx.attestProvenance` bundle in object storage; the dashboard lists and fetches
|
|
2112
|
+
* them by `(run_id, job_id)`.
|
|
2582
2113
|
*/
|
|
2583
2114
|
export interface AttestationsTable {
|
|
2584
2115
|
/** Random id (primary key). */
|
|
2585
2116
|
id: string;
|
|
2586
|
-
/** KiCI run this attestation belongs to. */
|
|
2587
2117
|
run_id: string;
|
|
2588
|
-
/** KiCI job this attestation was produced by. */
|
|
2589
2118
|
job_id: string;
|
|
2590
2119
|
/** Caller-supplied artifact name (e.g. an npm package coordinate). */
|
|
2591
2120
|
subject_name: string;
|
|
@@ -2595,14 +2124,11 @@ export interface AttestationsTable {
|
|
|
2595
2124
|
storage_key: string;
|
|
2596
2125
|
/** Signing mode ('kici' for Mode A). */
|
|
2597
2126
|
mode: string;
|
|
2598
|
-
/** Bundle media type. */
|
|
2599
2127
|
media_type: string;
|
|
2600
|
-
/** When this row was inserted. */
|
|
2601
2128
|
created_at: Generated<Date>;
|
|
2602
2129
|
/**
|
|
2603
|
-
*
|
|
2604
|
-
* `
|
|
2605
|
-
* (`attestationVerifyStatusSchema.enum.*`). DB default is `pending`.
|
|
2130
|
+
* Ingest-time server-side verdict: `verified` / `failed` / `unverifiable` / `pending`
|
|
2131
|
+
* (`attestationVerifyStatusSchema.enum.*`); DB default `pending`.
|
|
2606
2132
|
*/
|
|
2607
2133
|
verify_status: Generated<string>;
|
|
2608
2134
|
/** First failure code from `verifyKiciBundle`, or NULL when verified/pending. */
|
|
@@ -2645,10 +2171,9 @@ export interface OrchestratorSigningKeysTable {
|
|
|
2645
2171
|
export type OrchestratorSigningKeyRow = Selectable<OrchestratorSigningKeysTable>;
|
|
2646
2172
|
export type NewOrchestratorSigningKeyRow = Insertable<OrchestratorSigningKeysTable>;
|
|
2647
2173
|
/**
|
|
2648
|
-
*
|
|
2649
|
-
*
|
|
2650
|
-
*
|
|
2651
|
-
* their rows stay so envelopes already sealed to the old `kid` still decrypt.
|
|
2174
|
+
* X25519 dashboard-encryption keys: the trust root for browser-sealed dashboard writes under
|
|
2175
|
+
* the `encrypted` posture. One `active` key seals; rotated-out keys go `revoked` and leave the
|
|
2176
|
+
* published JWKS, but their rows stay so envelopes sealed to an old `kid` still decrypt.
|
|
2652
2177
|
*/
|
|
2653
2178
|
export interface DashboardEncryptionKeysTable {
|
|
2654
2179
|
/** RFC 7638 thumbprint of the public JWK (primary key, also the `kid`). */
|
|
@@ -2669,22 +2194,17 @@ export interface DashboardEncryptionKeysTable {
|
|
|
2669
2194
|
export type DashboardEncryptionKeyRow = Selectable<DashboardEncryptionKeysTable>;
|
|
2670
2195
|
export type NewDashboardEncryptionKeyRow = Insertable<DashboardEncryptionKeysTable>;
|
|
2671
2196
|
/**
|
|
2672
|
-
* A user-facing build artifact (`ctx.artifacts.upload`)
|
|
2673
|
-
*
|
|
2674
|
-
*
|
|
2675
|
-
*
|
|
2676
|
-
* where the discriminator is a hash of the exact name). Reads go through the
|
|
2677
|
-
* stored key rather than re-deriving it, so a row written under an earlier key
|
|
2678
|
-
* format resolves unchanged.
|
|
2197
|
+
* A user-facing build artifact (`ctx.artifacts.upload`), named and immutable per run:
|
|
2198
|
+
* `UNIQUE (run_id, name)` enforces first-upload-wins. The tarball lives at `storage_key`
|
|
2199
|
+
* (`artifacts/{run_id}/{name}-{discriminator}.tar.gz`, discriminator = a hash of the exact
|
|
2200
|
+
* name); reads use the stored key, never re-derive it, so older key formats resolve unchanged.
|
|
2679
2201
|
*/
|
|
2680
2202
|
export interface ArtifactsTable {
|
|
2681
2203
|
/** Random id (primary key). */
|
|
2682
2204
|
id: string;
|
|
2683
2205
|
/** Owning customer/org id (quota-accounting scope). */
|
|
2684
2206
|
customer_id: string;
|
|
2685
|
-
/** KiCI run this artifact belongs to. */
|
|
2686
2207
|
run_id: string;
|
|
2687
|
-
/** KiCI job that produced this artifact. */
|
|
2688
2208
|
job_id: string;
|
|
2689
2209
|
/** Caller-supplied artifact name (unique within the run). */
|
|
2690
2210
|
name: string;
|
|
@@ -2694,7 +2214,6 @@ export interface ArtifactsTable {
|
|
|
2694
2214
|
sha256: string;
|
|
2695
2215
|
/** Object-storage key the tarball was written to. */
|
|
2696
2216
|
storage_key: string;
|
|
2697
|
-
/** When this row was inserted. */
|
|
2698
2217
|
created_at: Generated<Date>;
|
|
2699
2218
|
}
|
|
2700
2219
|
export type ArtifactRow = Selectable<ArtifactsTable>;
|
|
@@ -2707,9 +2226,7 @@ export type NewArtifactRow = Insertable<ArtifactsTable>;
|
|
|
2707
2226
|
export interface PendingAttestationsTable {
|
|
2708
2227
|
/** Random id (primary key). */
|
|
2709
2228
|
id: string;
|
|
2710
|
-
/** KiCI run this deferred attestation belongs to. */
|
|
2711
2229
|
run_id: string;
|
|
2712
|
-
/** KiCI job this deferred attestation was produced by. */
|
|
2713
2230
|
job_id: string;
|
|
2714
2231
|
/** Caller-supplied artifact name. */
|
|
2715
2232
|
subject_name: string;
|
|
@@ -2721,19 +2238,15 @@ export interface PendingAttestationsTable {
|
|
|
2721
2238
|
dsse_envelope: unknown;
|
|
2722
2239
|
/** The ephemeral public-key JWK (JSONB). */
|
|
2723
2240
|
public_key: unknown;
|
|
2724
|
-
/** Bundle media type. */
|
|
2725
2241
|
media_type: string;
|
|
2726
2242
|
/** SHA-256 of the frozen statement payload — the later-mint binding. */
|
|
2727
2243
|
statement_hash: string;
|
|
2728
2244
|
/** Non-`live` AttestationOrigin: `deferred` | `offline-backfill`. */
|
|
2729
2245
|
origin_kind: string;
|
|
2730
|
-
/** Retry attempts so far. */
|
|
2731
2246
|
attempt_count: Generated<number>;
|
|
2732
2247
|
/** First-capture time = the true build-time anchor. */
|
|
2733
2248
|
created_at: Generated<Date>;
|
|
2734
|
-
/** When fulfilment was last attempted. */
|
|
2735
2249
|
last_attempt_at: Date | null;
|
|
2736
|
-
/** Last fulfilment error, or NULL. */
|
|
2737
2250
|
last_error: string | null;
|
|
2738
2251
|
/**
|
|
2739
2252
|
* Terminal-rejection time: the Platform definitively rejected the mint
|
|
@@ -2744,12 +2257,9 @@ export interface PendingAttestationsTable {
|
|
|
2744
2257
|
export type PendingAttestationRow = Selectable<PendingAttestationsTable>;
|
|
2745
2258
|
export type NewPendingAttestationRow = Insertable<PendingAttestationsTable>;
|
|
2746
2259
|
/**
|
|
2747
|
-
*
|
|
2748
|
-
*
|
|
2749
|
-
*
|
|
2750
|
-
* `remote:<orgId>` maps to the canonical org id so `resolveOrgId` resolves the
|
|
2751
|
-
* real tenant through the same local-source path a webhook takes. One row per
|
|
2752
|
-
* org served by this orchestrator, auto-provisioned on Platform auth.
|
|
2260
|
+
* Anchors a Platform-relayed `kici run remote` to its org: routing key `remote:<orgId>` maps to
|
|
2261
|
+
* the canonical org id, so `resolveOrgId` takes the same local-source path as a webhook. One
|
|
2262
|
+
* row per served org, auto-provisioned on Platform auth.
|
|
2753
2263
|
*/
|
|
2754
2264
|
export interface RemoteSourcesTable {
|
|
2755
2265
|
/** Canonical org id (`org_<…>`) this anchor resolves to. */
|
|
@@ -2758,22 +2268,15 @@ export interface RemoteSourcesTable {
|
|
|
2758
2268
|
routing_key: string;
|
|
2759
2269
|
/** Cluster id this orchestrator deployment reports, or null. */
|
|
2760
2270
|
cluster_id: string | null;
|
|
2761
|
-
/** When this row was first provisioned. */
|
|
2762
2271
|
created_at: Generated<Date>;
|
|
2763
|
-
/** When this row was last upserted. */
|
|
2764
2272
|
updated_at: Generated<Date>;
|
|
2765
2273
|
}
|
|
2766
2274
|
export type RemoteSourceRow = Selectable<RemoteSourcesTable>;
|
|
2767
2275
|
export type NewRemoteSourceRow = Insertable<RemoteSourcesTable>;
|
|
2768
2276
|
/**
|
|
2769
|
-
*
|
|
2770
|
-
*
|
|
2771
|
-
*
|
|
2772
|
-
* enrolled, reconciled from the in-memory AgentRegistry on register/unregister.
|
|
2773
|
-
* `lifecycle_class` (snapshot of the auth token's `agent_type`) drives reaping;
|
|
2774
|
-
* `connected_instance_id` records which orchestrator holds the live WS (cluster
|
|
2775
|
-
* liveness + the host-fanout reroute target), null when disconnected. Status is
|
|
2776
|
-
* derived at read from the shared `last_seen` + `connected_instance_id`.
|
|
2277
|
+
* KiCI's declared inventory: one durable row per agent ever enrolled, reconciled from the
|
|
2278
|
+
* AgentRegistry on register/unregister. `lifecycle_class` drives reaping; status is derived at
|
|
2279
|
+
* read from the shared `last_seen` + `connected_instance_id`.
|
|
2777
2280
|
*/
|
|
2778
2281
|
export interface HostRosterTable {
|
|
2779
2282
|
/** UUID primary key */
|
|
@@ -2785,14 +2288,10 @@ export interface HostRosterTable {
|
|
|
2785
2288
|
/** Snapshot of the token's agent_type: 'static' | 'ephemeral'. */
|
|
2786
2289
|
lifecycle_class: string;
|
|
2787
2290
|
/**
|
|
2788
|
-
* True when an auto-scaler backend spawned this agent
|
|
2789
|
-
*
|
|
2790
|
-
*
|
|
2791
|
-
*
|
|
2792
|
-
*
|
|
2793
|
-
* `runsOnAll` fan-out targets declared fleet members, so a true here keeps
|
|
2794
|
-
* the host out of the fan-out set. Defaults false, so a row predating the
|
|
2795
|
-
* column stays a fan-out target without re-registering.
|
|
2291
|
+
* True when an auto-scaler backend spawned this agent, per the scaler manager's spawn record;
|
|
2292
|
+
* NOT from `lifecycle_class`, which reads `ephemeral` for every agent under auth mode `none`.
|
|
2293
|
+
* True keeps the host out of `runsOnAll` fan-out (declared fleet members only). Default false
|
|
2294
|
+
* keeps pre-column rows fan-out targets without re-registering.
|
|
2796
2295
|
*/
|
|
2797
2296
|
scaler_managed: ColumnType<boolean, boolean | undefined, boolean>;
|
|
2798
2297
|
/** JSON-encoded string[] of the post-Gate-1 validated labels. */
|
|
@@ -2800,28 +2299,27 @@ export interface HostRosterTable {
|
|
|
2800
2299
|
hostname: string | null;
|
|
2801
2300
|
platform: string | null;
|
|
2802
2301
|
arch: string | null;
|
|
2803
|
-
/**
|
|
2302
|
+
/**
|
|
2303
|
+
* Which orchestrator holds the live WS (cluster liveness and the host-fanout reroute target);
|
|
2304
|
+
* null = disconnected.
|
|
2305
|
+
*/
|
|
2804
2306
|
connected_instance_id: string | null;
|
|
2805
2307
|
/**
|
|
2806
|
-
* Typed host-vars
|
|
2807
|
-
*
|
|
2808
|
-
*
|
|
2809
|
-
* defaults to `{}`. pg returns the parsed object on select; accept a
|
|
2810
|
-
* JSON-stringified value on insert/update.
|
|
2308
|
+
* Typed host-vars jsonb bag, reported by the agent at registration and/or declared by the
|
|
2309
|
+
* operator (`kici-admin host declare --prop`), shallow-merged on upsert. NOT NULL, default
|
|
2310
|
+
* `{}`.
|
|
2811
2311
|
*/
|
|
2812
2312
|
host_properties: ColumnType<Record<string, string | number | boolean>, Record<string, string | number | boolean> | string | undefined, Record<string, string | number | boolean> | string>;
|
|
2813
2313
|
last_seen: ColumnType<Date, Date | string | undefined, Date | string>;
|
|
2814
2314
|
/**
|
|
2815
|
-
*
|
|
2816
|
-
*
|
|
2817
|
-
* recovery-fail) and its pinned post-restart job is held until the host
|
|
2315
|
+
* Workflow-level host restart: a future timestamp marks the imminent disconnect as an
|
|
2316
|
+
* expected reboot (not a recovery-fail) and holds the pinned post-restart job until the host
|
|
2818
2317
|
* reconnects (down-then-up). NULL = no reboot pending.
|
|
2819
2318
|
*/
|
|
2820
2319
|
reboot_pending_until: ColumnType<Date | null, Date | string | null, Date | string | null>;
|
|
2821
2320
|
/**
|
|
2822
|
-
* Pre-agent reach metadata
|
|
2823
|
-
*
|
|
2824
|
-
* metadata cannot be bootstrapped and behaves exactly as before.
|
|
2321
|
+
* Pre-agent SSH reach metadata for bootstrap bring-up of a declared host. All nullable: a
|
|
2322
|
+
* host without it cannot be bootstrapped and is otherwise unaffected.
|
|
2825
2323
|
*/
|
|
2826
2324
|
address: ColumnType<string | null, string | null | undefined, string | null>;
|
|
2827
2325
|
ssh_user: ColumnType<string | null, string | null | undefined, string | null>;
|
|
@@ -2829,9 +2327,8 @@ export interface HostRosterTable {
|
|
|
2829
2327
|
/** Scoped-secret ref (`scope/key`) holding the bring-up private key. */
|
|
2830
2328
|
ssh_key_secret: ColumnType<string | null, string | null | undefined, string | null>;
|
|
2831
2329
|
/**
|
|
2832
|
-
*
|
|
2833
|
-
*
|
|
2834
|
-
* presigned URL). NULL / false ⇒ the conservative `ssh-push` fallback.
|
|
2330
|
+
* True when the box reaches the orchestrator's object storage, so bring-up picks `s3-direct`
|
|
2331
|
+
* (the box pulls the payload via a presigned URL). NULL / false ⇒ the `ssh-push` fallback.
|
|
2835
2332
|
*/
|
|
2836
2333
|
s3_reachable: ColumnType<boolean | null, boolean | null | undefined, boolean | null>;
|
|
2837
2334
|
/** Who last set the host's identity. See {@link HostIdentitySource}. */
|
|
@@ -2843,19 +2340,13 @@ export type HostRosterRow = Selectable<HostRosterTable>;
|
|
|
2843
2340
|
export type NewHostRosterRow = Insertable<HostRosterTable>;
|
|
2844
2341
|
export type HostRosterUpdate = Updateable<HostRosterTable>;
|
|
2845
2342
|
/**
|
|
2846
|
-
*
|
|
2847
|
-
*
|
|
2848
|
-
*
|
|
2849
|
-
*
|
|
2850
|
-
*
|
|
2851
|
-
*
|
|
2852
|
-
*
|
|
2853
|
-
* leader-gated reaper routinely is not the spawner — can still attribute a
|
|
2854
|
-
* provisioning failure back to the job waiting on it. Reaped per
|
|
2855
|
-
* instance and adoption-aware: `listReapCandidates` narrows to event rows that
|
|
2856
|
-
* are either adopted or past their spawn deadline, and the reaper tears each
|
|
2857
|
-
* one down with `deleteSpawningAgent` — an adopted event agent legitimately
|
|
2858
|
-
* outlives the spawn timeout, so no blanket age-based sweep may drop it.
|
|
2343
|
+
* One row per agent spawned via a scaler backend but not yet registered via WS. `bound_job_id`
|
|
2344
|
+
* lets a replacement coord still issue the eager-dispatch hop on registration; `run_id` lets a
|
|
2345
|
+
* non-spawning coordinator (the leader-gated reaper usually is one) attribute a provisioning
|
|
2346
|
+
* failure to the waiting job. Reaping is per instance and adoption-aware:
|
|
2347
|
+
* `listReapCandidates` narrows to event rows that are adopted or past their spawn deadline,
|
|
2348
|
+
* torn down via `deleteSpawningAgent`. An adopted event agent legitimately outlives the spawn
|
|
2349
|
+
* timeout, so no blanket age-based sweep may drop it.
|
|
2859
2350
|
*/
|
|
2860
2351
|
export interface ScalerSpawningAgentsTable {
|
|
2861
2352
|
agent_id: string;
|
|
@@ -2866,8 +2357,8 @@ export interface ScalerSpawningAgentsTable {
|
|
|
2866
2357
|
bound_job_id: ColumnType<string | null, string | null | undefined, string | null>;
|
|
2867
2358
|
spawned_at: Generated<Date>;
|
|
2868
2359
|
/**
|
|
2869
|
-
* The coordinator
|
|
2870
|
-
*
|
|
2360
|
+
* The spawning coordinator; scopes recovery and the per-instance reaper. NULL reads as
|
|
2361
|
+
* "unknown owner", never "not mine".
|
|
2871
2362
|
*/
|
|
2872
2363
|
owner_instance_id: ColumnType<string | null, string | null | undefined, string | null>;
|
|
2873
2364
|
/** The coordinator the agent actually reached when it registered. */
|
|
@@ -2875,8 +2366,8 @@ export interface ScalerSpawningAgentsTable {
|
|
|
2875
2366
|
/** When the adopting coordinator claimed the agent. */
|
|
2876
2367
|
adopted_at: ColumnType<Date | null, Date | null | undefined, Date | null>;
|
|
2877
2368
|
/**
|
|
2878
|
-
* The scaler's mandatory labels, copied
|
|
2879
|
-
*
|
|
2369
|
+
* The scaler's mandatory labels, copied so a coordinator with no matching scaler entry can
|
|
2370
|
+
* still stamp the taint and emit the teardown.
|
|
2880
2371
|
*/
|
|
2881
2372
|
mandatory_labels: ColumnType<string[] | null, string | string[] | null | undefined, string | string[] | null>;
|
|
2882
2373
|
/** The scaler's provisioning targets, copied onto the row for the same reason. */
|
|
@@ -2884,27 +2375,20 @@ export interface ScalerSpawningAgentsTable {
|
|
|
2884
2375
|
/** The scaler's roles, copied onto the row for the same reason. */
|
|
2885
2376
|
roles: ColumnType<string[] | null, string | string[] | null | undefined, string | string[] | null>;
|
|
2886
2377
|
/**
|
|
2887
|
-
*
|
|
2888
|
-
*
|
|
2889
|
-
*
|
|
2890
|
-
* nobody. NULL means the row predates the column.
|
|
2378
|
+
* Spawning backend: `container`, `bare-metal`, `firecracker` or `event`. Every adoption and
|
|
2379
|
+
* reap predicate matches `event`, so a row missing it is adopted and reaped by nobody. NULL
|
|
2380
|
+
* means the row predates the column.
|
|
2891
2381
|
*/
|
|
2892
2382
|
backend_type: ColumnType<string | null, string | null | undefined, string | null>;
|
|
2893
2383
|
}
|
|
2894
2384
|
export type ScalerSpawningAgentRow = Selectable<ScalerSpawningAgentsTable>;
|
|
2895
2385
|
export type NewScalerSpawningAgentRow = Insertable<ScalerSpawningAgentsTable>;
|
|
2896
2386
|
/**
|
|
2897
|
-
*
|
|
2898
|
-
*
|
|
2899
|
-
*
|
|
2900
|
-
*
|
|
2901
|
-
*
|
|
2902
|
-
* adopted, which the spawn row's absence cannot.
|
|
2903
|
-
*
|
|
2904
|
-
* `adopted_by` is written in the same transaction as
|
|
2905
|
-
* `scaler_spawning_agents.adopted_by`, inside `adoptSpawningAgent`, which is
|
|
2906
|
-
* the single writer of that column. Any future writer of `adopted_by` MUST
|
|
2907
|
-
* write this row too, or the prune loses the signal again.
|
|
2387
|
+
* What became of each provisioned agent id. Outlives the `scaler_spawning_agents` row (deleted
|
|
2388
|
+
* on teardown), so the stale-spawn prune can tell an adopted provision from a never-adopted one.
|
|
2389
|
+
* `adopted_by` is written in the same transaction as `scaler_spawning_agents.adopted_by`, in
|
|
2390
|
+
* `adoptSpawningAgent`, its single writer. Any future writer of `adopted_by` MUST write this row
|
|
2391
|
+
* too, or the prune loses the signal.
|
|
2908
2392
|
*/
|
|
2909
2393
|
export interface ScalerProvisionOutcomesTable {
|
|
2910
2394
|
agent_id: string;
|
|
@@ -2914,13 +2398,11 @@ export interface ScalerProvisionOutcomesTable {
|
|
|
2914
2398
|
/** When it was first adopted. Never refreshed by a re-adopt. */
|
|
2915
2399
|
adopted_at: ColumnType<Date | null, Date | null | undefined, Date | null>;
|
|
2916
2400
|
/**
|
|
2917
|
-
* The reaper's teardown reason (`spawn-timeout` / `heartbeat-timeout`), set
|
|
2918
|
-
*
|
|
2919
|
-
*
|
|
2920
|
-
* the adoption here would restore the misattribution this table removes.
|
|
2401
|
+
* The reaper's teardown reason (`spawn-timeout` / `heartbeat-timeout`), set only once the
|
|
2402
|
+
* teardown was delivered. Independent of `adopted_by`: a `heartbeat-timeout` condemns an
|
|
2403
|
+
* adopted provision, and clearing the adoption would restore the misattribution.
|
|
2921
2404
|
*/
|
|
2922
2405
|
condemned_reason: ColumnType<string | null, string | null | undefined, string | null>;
|
|
2923
|
-
/** When the reaper condemned it. */
|
|
2924
2406
|
condemned_at: ColumnType<Date | null, Date | null | undefined, Date | null>;
|
|
2925
2407
|
recorded_at: Generated<Date>;
|
|
2926
2408
|
updated_at: ColumnType<Date, Date | string | undefined, Date | string>;
|
|
@@ -2928,12 +2410,9 @@ export interface ScalerProvisionOutcomesTable {
|
|
|
2928
2410
|
export type ScalerProvisionOutcomeRow = Selectable<ScalerProvisionOutcomesTable>;
|
|
2929
2411
|
export type NewScalerProvisionOutcomeRow = Insertable<ScalerProvisionOutcomesTable>;
|
|
2930
2412
|
/**
|
|
2931
|
-
*
|
|
2932
|
-
*
|
|
2933
|
-
*
|
|
2934
|
-
* events (spawn / boot / ready / kill) to the execution tracker. Row
|
|
2935
|
-
* inserted in `correlateAgentToJob`, deleted on agent disconnect / job
|
|
2936
|
-
* completion.
|
|
2413
|
+
* agentId → (runId, jobId) correlation routing scaler-lifecycle events (spawn / boot / ready /
|
|
2414
|
+
* kill) to the execution tracker. Inserted in `correlateAgentToJob`, deleted on agent
|
|
2415
|
+
* disconnect / job completion.
|
|
2937
2416
|
*/
|
|
2938
2417
|
export interface ScalerAgentJobsTable {
|
|
2939
2418
|
agent_id: string;
|
|
@@ -2944,11 +2423,8 @@ export interface ScalerAgentJobsTable {
|
|
|
2944
2423
|
export type ScalerAgentJobRow = Selectable<ScalerAgentJobsTable>;
|
|
2945
2424
|
export type NewScalerAgentJobRow = Insertable<ScalerAgentJobsTable>;
|
|
2946
2425
|
/**
|
|
2947
|
-
*
|
|
2948
|
-
*
|
|
2949
|
-
* One row per outstanding resource reservation. `perScalerUsage` /
|
|
2950
|
-
* `globalUsage` are derived state — recomputed from `SUM(...)` on coord
|
|
2951
|
-
* boot so the cap-check critical section is correct under HA.
|
|
2426
|
+
* One row per outstanding resource reservation. `perScalerUsage` / `globalUsage` are derived:
|
|
2427
|
+
* recomputed from `SUM(...)` on coord boot so the cap-check critical section holds under HA.
|
|
2952
2428
|
*/
|
|
2953
2429
|
export interface ScalerReservationsTable {
|
|
2954
2430
|
agent_id: string;
|
|
@@ -2957,21 +2433,18 @@ export interface ScalerReservationsTable {
|
|
|
2957
2433
|
mem_bytes: ColumnType<string, string | number, string | number>;
|
|
2958
2434
|
reserved_at: Generated<Date>;
|
|
2959
2435
|
/**
|
|
2960
|
-
* The coordinator
|
|
2961
|
-
*
|
|
2436
|
+
* The holding coordinator; scopes recovery and the per-instance reaper. NULL reads as
|
|
2437
|
+
* "unknown owner", never "not mine".
|
|
2962
2438
|
*/
|
|
2963
2439
|
owner_instance_id: ColumnType<string | null, string | null | undefined, string | null>;
|
|
2964
2440
|
}
|
|
2965
2441
|
export type ScalerReservationRow = Selectable<ScalerReservationsTable>;
|
|
2966
2442
|
export type NewScalerReservationRow = Insertable<ScalerReservationsTable>;
|
|
2967
2443
|
/**
|
|
2968
|
-
*
|
|
2969
|
-
*
|
|
2970
|
-
*
|
|
2971
|
-
*
|
|
2972
|
-
* The code itself is never stored — only its sha256 — so a DB read cannot hand
|
|
2973
|
-
* back a redeemable secret. Single use is enforced by a conditional UPDATE on
|
|
2974
|
-
* `consumed_at`.
|
|
2444
|
+
* One row per outstanding event-scaler claim code, so any coordinator behind the shared
|
|
2445
|
+
* endpoint can redeem it, not only the minting process. Only the code's sha256 is stored, so a
|
|
2446
|
+
* DB read never yields a redeemable secret. A conditional UPDATE on `consumed_at` enforces
|
|
2447
|
+
* single use.
|
|
2975
2448
|
*/
|
|
2976
2449
|
export interface ScalerPendingClaimsTable {
|
|
2977
2450
|
claim_hash: string;
|