@kici-dev/orchestrator 0.0.0 → 0.1.2
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/LICENSE +661 -0
- package/README.md +1 -6
- package/dist/__test-helpers__/mock-db.d.ts +103 -0
- package/dist/__test-helpers__/mock-ws.d.ts +13 -0
- package/dist/agent/dispatcher.d.ts +231 -0
- package/dist/agent/ownership-tracker.d.ts +46 -0
- package/dist/agent/registry.d.ts +255 -0
- package/dist/agent/token-store.d.ts +96 -0
- package/dist/app.d.ts +234 -0
- package/dist/audit/access-log.d.ts +92 -0
- package/dist/audit/sampling-rate-limiter.d.ts +41 -0
- package/dist/cache/build-coordinator.d.ts +42 -0
- package/dist/cache/dep-cache.d.ts +51 -0
- package/dist/cache/index.d.ts +16 -0
- package/dist/cache/pending-builds.d.ts +14 -0
- package/dist/cache/pending-dynamics.d.ts +15 -0
- package/dist/cache/pending-inits.d.ts +19 -0
- package/dist/cache/pending-tracker.d.ts +65 -0
- package/dist/cache/source-cache.d.ts +30 -0
- package/dist/cli/api-client.d.ts +411 -0
- package/dist/cli/commands/access-log.d.ts +30 -0
- package/dist/cli/commands/agent-service/index.d.ts +15 -0
- package/dist/cli/commands/agent-service/install.d.ts +9 -0
- package/dist/cli/commands/agent-service/logs.d.ts +9 -0
- package/dist/cli/commands/agent-service/restart.d.ts +8 -0
- package/dist/cli/commands/agent-service/start.d.ts +8 -0
- package/dist/cli/commands/agent-service/status.d.ts +10 -0
- package/dist/cli/commands/agent-service/stop.d.ts +8 -0
- package/dist/cli/commands/agent-service/uninstall.d.ts +9 -0
- package/dist/cli/commands/agent-service/upgrade.d.ts +11 -0
- package/dist/cli/commands/agent.d.ts +10 -0
- package/dist/cli/commands/api-key.d.ts +12 -0
- package/dist/cli/commands/audit.d.ts +9 -0
- package/dist/cli/commands/backend.d.ts +17 -0
- package/dist/cli/commands/cold-store-impl.d.ts +101 -0
- package/dist/cli/commands/cold-store.d.ts +30 -0
- package/dist/cli/commands/config.d.ts +16 -0
- package/dist/cli/commands/db.d.ts +19 -0
- package/dist/cli/commands/debug-bundle.d.ts +16 -0
- package/dist/cli/commands/diagnose.d.ts +15 -0
- package/dist/cli/commands/environment.d.ts +24 -0
- package/dist/cli/commands/event-dlq.d.ts +19 -0
- package/dist/cli/commands/event-log.d.ts +27 -0
- package/dist/cli/commands/event.d.ts +4 -0
- package/dist/cli/commands/execution.d.ts +17 -0
- package/dist/cli/commands/inspect-bundle.d.ts +16 -0
- package/dist/cli/commands/maintenance.d.ts +4 -0
- package/dist/cli/commands/orchestrator-service/index.d.ts +12 -0
- package/dist/cli/commands/orchestrator-service/install.d.ts +10 -0
- package/dist/cli/commands/orchestrator-service/logs.d.ts +10 -0
- package/dist/cli/commands/orchestrator-service/restart.d.ts +8 -0
- package/dist/cli/commands/orchestrator-service/start.d.ts +8 -0
- package/dist/cli/commands/orchestrator-service/status.d.ts +10 -0
- package/dist/cli/commands/orchestrator-service/stop.d.ts +8 -0
- package/dist/cli/commands/orchestrator-service/uninstall.d.ts +9 -0
- package/dist/cli/commands/orchestrator-service/upgrade.d.ts +12 -0
- package/dist/cli/commands/org-settings.d.ts +17 -0
- package/dist/cli/commands/peer.d.ts +13 -0
- package/dist/cli/commands/queue.d.ts +16 -0
- package/dist/cli/commands/registration.d.ts +18 -0
- package/dist/cli/commands/rotate.d.ts +9 -0
- package/dist/cli/commands/runs.d.ts +34 -0
- package/dist/cli/commands/secret.d.ts +12 -0
- package/dist/cli/commands/shared/db.d.ts +16 -0
- package/dist/cli/commands/shared/versioned-upgrade.d.ts +38 -0
- package/dist/cli/commands/source.d.ts +24 -0
- package/dist/cli/commands/token.d.ts +10 -0
- package/dist/cli/commands/workflow.d.ts +31 -0
- package/dist/cli/join.d.ts +14 -0
- package/dist/cli/kici-admin.d.ts +13 -0
- package/dist/cli/lazy-deps/cache.d.ts +17 -0
- package/dist/cli/lazy-deps/downloader.d.ts +33 -0
- package/dist/cli/lazy-deps/registry.d.ts +43 -0
- package/dist/cli/service/compose.d.ts +25 -0
- package/dist/cli/service/index.d.ts +24 -0
- package/dist/cli/service/launchd.d.ts +34 -0
- package/dist/cli/service/platform-detect.d.ts +59 -0
- package/dist/cli/service/systemd.d.ts +41 -0
- package/dist/cli/service/types.d.ts +91 -0
- package/dist/cli/service/windows.d.ts +20 -0
- package/dist/cli/wizard/agent-wizard.d.ts +24 -0
- package/dist/cli/wizard/orchestrator-wizard.d.ts +38 -0
- package/dist/cli/wizard/prompts.d.ts +23 -0
- package/dist/cli.js +11435 -0
- package/dist/cluster/cluster-identity.d.ts +59 -0
- package/dist/cluster/coordinator.d.ts +204 -0
- package/dist/cluster/health-api.d.ts +30 -0
- package/dist/cluster/index.d.ts +24 -0
- package/dist/cluster/join-client.d.ts +75 -0
- package/dist/cluster/join-handler.d.ts +58 -0
- package/dist/cluster/join-token.d.ts +94 -0
- package/dist/cluster/orphan-recovery.d.ts +67 -0
- package/dist/cluster/peer-client.d.ts +190 -0
- package/dist/cluster/peer-credentials.d.ts +108 -0
- package/dist/cluster/peer-crypto.d.ts +57 -0
- package/dist/cluster/peer-handler.d.ts +97 -0
- package/dist/cluster/peer-registry.d.ts +186 -0
- package/dist/cluster/raft-state.d.ts +36 -0
- package/dist/cluster/raft.d.ts +140 -0
- package/dist/cold-store/load-access-log-range.d.ts +73 -0
- package/dist/cold-store/load-event-log-range.d.ts +62 -0
- package/dist/cold-store/load-secret-audit-log-range.d.ts +38 -0
- package/dist/cold-store/orchestrator-cold-store.d.ts +58 -0
- package/dist/cold-store/tables/access-log.d.ts +80 -0
- package/dist/cold-store/tables/event-log.d.ts +70 -0
- package/dist/cold-store/tables/execution-jobs.d.ts +63 -0
- package/dist/cold-store/tables/execution-runs.d.ts +81 -0
- package/dist/cold-store/tables/execution-steps.d.ts +65 -0
- package/dist/cold-store/tables/secret-audit-log.d.ts +77 -0
- package/dist/concurrency/dispatch-next-queued.d.ts +63 -0
- package/dist/concurrency/group-tracker.d.ts +51 -0
- package/dist/concurrency/index.d.ts +3 -0
- package/dist/concurrency/queue-manager.d.ts +68 -0
- package/dist/concurrency/waiters.d.ts +58 -0
- package/dist/config/encryption.d.ts +82 -0
- package/dist/config/env-overlay.d.ts +45 -0
- package/dist/config/index.d.ts +16 -0
- package/dist/config/loader.d.ts +26 -0
- package/dist/config/reload.d.ts +113 -0
- package/dist/config/resolver.d.ts +47 -0
- package/dist/config/schema.d.ts +210 -0
- package/dist/config/shared-store.d.ts +142 -0
- package/dist/config/types.d.ts +218 -0
- package/dist/config.d.ts +249 -0
- package/dist/cron/cron-scheduler.d.ts +78 -0
- package/dist/cron/cron-store.d.ts +38 -0
- package/dist/dashboard/handler.d.ts +243 -0
- package/dist/db/client.d.ts +13 -0
- package/dist/db/migration-provider.d.ts +9 -0
- package/dist/db/migrations/001_initial.d.ts +8 -0
- package/dist/db/migrations/002_config_versions_key_version.d.ts +16 -0
- package/dist/db/migrations/003_access_log.d.ts +26 -0
- package/dist/db/migrations/004_rename_bundle_to_source.d.ts +19 -0
- package/dist/db/migrations/005_cold_store_chunk_counter.d.ts +19 -0
- package/dist/db/migrations/006_runs_jobs_steps_archived_at.d.ts +38 -0
- package/dist/db/migrations/007_audit_logs_archived_at.d.ts +42 -0
- package/dist/db/migrations/008_event_log_archived_at.d.ts +40 -0
- package/dist/db/migrations/009_access_log_trigram.d.ts +15 -0
- package/dist/db/migrations/010_cold_store_chunks.d.ts +34 -0
- package/dist/db/migrations/011_drop_source_secrets_notify.d.ts +21 -0
- package/dist/db/migrations/012_peer_credentials_active_uniq.d.ts +28 -0
- package/dist/db/migrations/013_execution_log_bytes.d.ts +21 -0
- package/dist/db/migrations/014_kici_events_lease_retry.d.ts +36 -0
- package/dist/db/migrations/015_org_settings_customer_scoped.d.ts +30 -0
- package/dist/db/migrations/016_org_settings_allow_http_npm.d.ts +15 -0
- package/dist/db/migrations/017_org_id_widen.d.ts +4 -0
- package/dist/db/migrations/018_org_id_prefix_backfill.d.ts +4 -0
- package/dist/db/migrator.d.ts +32 -0
- package/dist/db/types.d.ts +1266 -0
- package/dist/diagnostics/bundle-reader.d.ts +48 -0
- package/dist/diagnostics/bundle-writer.d.ts +57 -0
- package/dist/diagnostics/checks/agents.d.ts +10 -0
- package/dist/diagnostics/checks/certs.d.ts +9 -0
- package/dist/diagnostics/checks/config.d.ts +10 -0
- package/dist/diagnostics/checks/db.d.ts +9 -0
- package/dist/diagnostics/checks/disk.d.ts +9 -0
- package/dist/diagnostics/checks/index.d.ts +17 -0
- package/dist/diagnostics/checks/ws.d.ts +9 -0
- package/dist/diagnostics/index.d.ts +13 -0
- package/dist/diagnostics/runner.d.ts +23 -0
- package/dist/diagnostics/types.d.ts +38 -0
- package/dist/entry-helpers.d.ts +93 -0
- package/dist/environments/binding-store.d.ts +27 -0
- package/dist/environments/environment-store.d.ts +74 -0
- package/dist/environments/held-runs.d.ts +64 -0
- package/dist/environments/index.d.ts +10 -0
- package/dist/environments/protection/branch-gate.d.ts +5 -0
- package/dist/environments/protection/concurrency-gate.d.ts +7 -0
- package/dist/environments/protection/pipeline.d.ts +18 -0
- package/dist/environments/protection/reviewer-gate.d.ts +7 -0
- package/dist/environments/protection/trust-gate.d.ts +7 -0
- package/dist/environments/protection/wait-timer-gate.d.ts +7 -0
- package/dist/environments/variable-store.d.ts +39 -0
- package/dist/events/circuit-breaker.d.ts +33 -0
- package/dist/events/event-emitter.d.ts +55 -0
- package/dist/events/event-retry-scanner.d.ts +52 -0
- package/dist/events/event-router.d.ts +183 -0
- package/dist/events/event-store.d.ts +157 -0
- package/dist/events/trust-store.d.ts +54 -0
- package/dist/events/types.d.ts +61 -0
- package/dist/helpers/ip-extraction.d.ts +29 -0
- package/dist/helpers/rate-limiter.d.ts +23 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +772 -0
- package/dist/lockfile-cache.d.ts +39 -0
- package/dist/metrics/agent-metrics-aggregator.d.ts +116 -0
- package/dist/metrics/metrics-reporter.d.ts +40 -0
- package/dist/metrics/prometheus.d.ts +261 -0
- package/dist/metrics/scheduled-jobs.d.ts +20 -0
- package/dist/orchestrator-core.d.ts +193 -0
- package/dist/pipeline/dispatch-matched-workflow.d.ts +102 -0
- package/dist/pipeline/inline-eval.d.ts +28 -0
- package/dist/pipeline/install-secrets-resolver.d.ts +73 -0
- package/dist/pipeline/manual-schedule.d.ts +21 -0
- package/dist/pipeline/needs-scheduler.d.ts +85 -0
- package/dist/pipeline/process-webhook.d.ts +38 -0
- package/dist/pipeline/processor.d.ts +326 -0
- package/dist/pipeline/rerun.d.ts +79 -0
- package/dist/pipeline/test-pipeline.d.ts +110 -0
- package/dist/provider-registry.d.ts +122 -0
- package/dist/providers/generic/index.d.ts +23 -0
- package/dist/providers/generic/normalizer.d.ts +112 -0
- package/dist/providers/generic/verification.d.ts +47 -0
- package/dist/providers/github/auth.d.ts +60 -0
- package/dist/providers/github/changed-files.d.ts +51 -0
- package/dist/providers/github/check-status-poster.d.ts +35 -0
- package/dist/providers/github/contributor-resolver.d.ts +30 -0
- package/dist/providers/github/index.d.ts +20 -0
- package/dist/providers/github/lock-file.d.ts +32 -0
- package/dist/providers/github/normalizer.d.ts +103 -0
- package/dist/providers/github/repo-url.d.ts +35 -0
- package/dist/providers/internal/index.d.ts +32 -0
- package/dist/providers/internal/lock-file-fetcher.d.ts +34 -0
- package/dist/providers/internal/normalizer.d.ts +89 -0
- package/dist/providers/internal/repo-url-builder.d.ts +42 -0
- package/dist/providers/universal-git/changed-files.d.ts +42 -0
- package/dist/providers/universal-git/clone-token.d.ts +83 -0
- package/dist/providers/universal-git/config.d.ts +192 -0
- package/dist/providers/universal-git/index.d.ts +55 -0
- package/dist/providers/universal-git/lock-file.d.ts +71 -0
- package/dist/providers/universal-git/normalizer.d.ts +90 -0
- package/dist/providers/universal-git/repo-url.d.ts +50 -0
- package/dist/providers/universal-git/ssh-auth.d.ts +94 -0
- package/dist/queue/bootstrap.d.ts +50 -0
- package/dist/queue/cleanup.d.ts +41 -0
- package/dist/queue/depth-refresher.d.ts +65 -0
- package/dist/queue/job-queue.d.ts +343 -0
- package/dist/queue/scheduled-job.d.ts +91 -0
- package/dist/registration/extractor.d.ts +44 -0
- package/dist/registration/registration-index.d.ts +162 -0
- package/dist/registration/registration-store.d.ts +111 -0
- package/dist/reporting/check-run-summary.d.ts +102 -0
- package/dist/reporting/commit-status.d.ts +382 -0
- package/dist/reporting/execution-tracker.d.ts +538 -0
- package/dist/reporting/fs-log-storage.d.ts +41 -0
- package/dist/reporting/log-pull-handler.d.ts +35 -0
- package/dist/reporting/log-storage.d.ts +70 -0
- package/dist/reporting/log-writer.d.ts +45 -0
- package/dist/reporting/s3-log-storage.d.ts +42 -0
- package/dist/reporting/step-log-buffer.d.ts +57 -0
- package/dist/routes/admin-access-log.d.ts +34 -0
- package/dist/routes/admin-backends.d.ts +28 -0
- package/dist/routes/admin-config.d.ts +57 -0
- package/dist/routes/admin-db.d.ts +20 -0
- package/dist/routes/admin-environments.d.ts +42 -0
- package/dist/routes/admin-errors.d.ts +4 -0
- package/dist/routes/admin-event-dlq.d.ts +39 -0
- package/dist/routes/admin-event-log.d.ts +42 -0
- package/dist/routes/admin-events.d.ts +46 -0
- package/dist/routes/admin-maintenance.d.ts +22 -0
- package/dist/routes/admin-org-settings.d.ts +29 -0
- package/dist/routes/admin-queue-execution.d.ts +27 -0
- package/dist/routes/admin-registrations.d.ts +37 -0
- package/dist/routes/admin-runs.d.ts +57 -0
- package/dist/routes/admin-scheduled-jobs.d.ts +36 -0
- package/dist/routes/admin-sources.d.ts +18 -0
- package/dist/routes/admin.d.ts +103 -0
- package/dist/routes/capabilities.d.ts +24 -0
- package/dist/routes/diagnostics.d.ts +16 -0
- package/dist/routes/health.d.ts +20 -0
- package/dist/routes/test-trigger.d.ts +41 -0
- package/dist/routes/uploads.d.ts +38 -0
- package/dist/routes/webhooks.d.ts +36 -0
- package/dist/scaler/bare-metal-backend.d.ts +107 -0
- package/dist/scaler/config.d.ts +303 -0
- package/dist/scaler/container-backend.d.ts +125 -0
- package/dist/scaler/file-tail.d.ts +23 -0
- package/dist/scaler/firecracker-api.d.ts +100 -0
- package/dist/scaler/firecracker-backend.d.ts +263 -0
- package/dist/scaler/index.d.ts +24 -0
- package/dist/scaler/ip-allocator.d.ts +177 -0
- package/dist/scaler/label-matcher.d.ts +73 -0
- package/dist/scaler/log-forwarder.d.ts +54 -0
- package/dist/scaler/machine-ledger.d.ts +160 -0
- package/dist/scaler/manager.d.ts +338 -0
- package/dist/scaler/nftables.d.ts +85 -0
- package/dist/scaler/types.d.ts +388 -0
- package/dist/scaler/warm-pool.d.ts +81 -0
- package/dist/secrets/audit-logger.d.ts +65 -0
- package/dist/secrets/backend-health.d.ts +60 -0
- package/dist/secrets/backend-registry.d.ts +68 -0
- package/dist/secrets/backend-sync.d.ts +40 -0
- package/dist/secrets/cleanup.d.ts +40 -0
- package/dist/secrets/config.d.ts +51 -0
- package/dist/secrets/crypto.d.ts +49 -0
- package/dist/secrets/ephemeral-keys.d.ts +49 -0
- package/dist/secrets/index.d.ts +17 -0
- package/dist/secrets/pg-secret-store.d.ts +105 -0
- package/dist/secrets/rbac.d.ts +47 -0
- package/dist/secrets/secret-output-store.d.ts +46 -0
- package/dist/secrets/secret-resolver.d.ts +137 -0
- package/dist/secrets/source-credentials.d.ts +61 -0
- package/dist/secrets/token-manager.d.ts +63 -0
- package/dist/secrets/vault-secret-store.d.ts +85 -0
- package/dist/security/comment-handler.d.ts +67 -0
- package/dist/security/contributor-cache.d.ts +75 -0
- package/dist/security/global-workflow-policy.d.ts +72 -0
- package/dist/security/lock-source.d.ts +34 -0
- package/dist/security/trust-resolver.d.ts +108 -0
- package/dist/security/workflow-diff.d.ts +26 -0
- package/dist/server.d.ts +17 -0
- package/dist/server.js +48055 -0
- package/dist/sources/index.d.ts +10 -0
- package/dist/sources/source-manager.d.ts +63 -0
- package/dist/sources/source-store.d.ts +79 -0
- package/dist/sources/source-validator.d.ts +16 -0
- package/dist/stale-detector/stale-run-detector.d.ts +109 -0
- package/dist/standalone.d.ts +20 -0
- package/dist/standalone.js +41546 -0
- package/dist/storage/blob-routes.d.ts +20 -0
- package/dist/storage/filesystem.d.ts +60 -0
- package/dist/storage/index.d.ts +20 -0
- package/dist/storage/s3.d.ts +68 -0
- package/dist/storage/sign-url.d.ts +45 -0
- package/dist/storage/types.d.ts +98 -0
- package/dist/webhook/dedup.d.ts +44 -0
- package/dist/webhook/event-log.d.ts +83 -0
- package/dist/webhook/generic-sources.d.ts +169 -0
- package/dist/webhook/handler.d.ts +23 -0
- package/dist/webhook/relay-buffer.d.ts +96 -0
- package/dist/webhook/verify-inbound.d.ts +78 -0
- package/dist/worker/in-memory-execution-tracker.d.ts +94 -0
- package/dist/worker/in-memory-job-queue.d.ts +74 -0
- package/dist/worker/static-agent-token-store.d.ts +58 -0
- package/dist/worker/worker-status.d.ts +36 -0
- package/dist/worker-core.d.ts +74 -0
- package/dist/ws/agent-api-registry.d.ts +49 -0
- package/dist/ws/agent-handler.d.ts +176 -0
- package/dist/ws/agent-heartbeat.d.ts +45 -0
- package/dist/ws/dashboard-backends-handler.d.ts +51 -0
- package/dist/ws/dashboard-diagnostics-handler.d.ts +56 -0
- package/dist/ws/dashboard-env-handler.d.ts +107 -0
- package/dist/ws/dashboard-global-workflows-handler.d.ts +72 -0
- package/dist/ws/dashboard-registrations-handler.d.ts +84 -0
- package/dist/ws/event-buffer.d.ts +16 -0
- package/dist/ws/observer-handler.d.ts +42 -0
- package/dist/ws/observer-registry.d.ts +88 -0
- package/dist/ws/platform-client.d.ts +270 -0
- package/dist/ws/server-options.d.ts +15 -0
- package/package.json +87 -7
- package/sbom.spdx.json +14370 -0
- package/index.js +0 -3
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Orchestrator scheduled-job wrapper.
|
|
3
|
+
*
|
|
4
|
+
* Mirrors `packages/platform/src/queue/scheduled-job.ts` in observable
|
|
5
|
+
* surface (5 Prometheus metrics + structured logs + audit row on
|
|
6
|
+
* failure) but uses `setInterval` instead of pg-boss — the orchestrator
|
|
7
|
+
* has no pg-boss dependency and we're not adding one.
|
|
8
|
+
*
|
|
9
|
+
* All future orchestrator periodic jobs MUST use this wrapper — per
|
|
10
|
+
* CLAUDE.md "no workarounds", the legacy setInterval call sites in
|
|
11
|
+
* queue/cleanup.ts and secrets/cleanup.ts migrate in the same phase
|
|
12
|
+
* they'd otherwise be updated.
|
|
13
|
+
*
|
|
14
|
+
* `triggerNow()` on the returned handle forces one off-cadence tick
|
|
15
|
+
* (used by the admin `/api/v1/admin/scheduled-jobs/:name/trigger`
|
|
16
|
+
* endpoint and by E2E harnesses). It does NOT reset the interval
|
|
17
|
+
* timer — a real tick still fires at the scheduled cadence after.
|
|
18
|
+
*/
|
|
19
|
+
import { z } from 'zod';
|
|
20
|
+
import type { Kysely } from 'kysely';
|
|
21
|
+
import type { Database } from '../db/types.js';
|
|
22
|
+
/**
|
|
23
|
+
* All registered orchestrator scheduled-job names. Adding a new
|
|
24
|
+
* periodic job MUST add its name here before it can register.
|
|
25
|
+
*/
|
|
26
|
+
export declare const OrchestratorScheduledJobName: z.ZodEnum<{
|
|
27
|
+
cleanup: "cleanup";
|
|
28
|
+
"orphan-secret-cleanup": "orphan-secret-cleanup";
|
|
29
|
+
"token-cleanup": "token-cleanup";
|
|
30
|
+
"cold-store-archive": "cold-store-archive";
|
|
31
|
+
"cold-store-purge": "cold-store-purge";
|
|
32
|
+
}>;
|
|
33
|
+
export type OrchestratorScheduledJobName = z.infer<typeof OrchestratorScheduledJobName>;
|
|
34
|
+
/** Access-log action for a manually triggered off-cadence tick. */
|
|
35
|
+
export declare const ACCESS_LOG_ACTION_TRIGGER = "scheduled_job.trigger";
|
|
36
|
+
export interface OrchestratorScheduledJobOptions {
|
|
37
|
+
name: OrchestratorScheduledJobName;
|
|
38
|
+
/** Tick cadence. Must be > 0. */
|
|
39
|
+
intervalMs: number;
|
|
40
|
+
/** Handler called per tick. Exceptions are caught and metered. */
|
|
41
|
+
handler: () => Promise<void>;
|
|
42
|
+
/**
|
|
43
|
+
* Orchestrator instance ID — appears on failure access-log rows as
|
|
44
|
+
* `actor_id` alongside `actor_type='system'`.
|
|
45
|
+
*/
|
|
46
|
+
instanceId: string;
|
|
47
|
+
/** DB used for failure audit rows. If omitted, failures are logs-only. */
|
|
48
|
+
db?: Kysely<Database>;
|
|
49
|
+
/** Routing key for failure access-log partitioning (null = not scoped). */
|
|
50
|
+
routingKey?: string;
|
|
51
|
+
/** Fire one tick immediately on register. Defaults to false. */
|
|
52
|
+
runOnStart?: boolean;
|
|
53
|
+
/** `timer.unref()` — allows process exit while scheduled. Defaults to true. */
|
|
54
|
+
unref?: boolean;
|
|
55
|
+
}
|
|
56
|
+
export interface OrchestratorScheduledJobHandle {
|
|
57
|
+
readonly name: OrchestratorScheduledJobName;
|
|
58
|
+
/** Clears the interval. Safe to call multiple times. */
|
|
59
|
+
stop(): void;
|
|
60
|
+
/**
|
|
61
|
+
* Force one off-cadence tick and await it (success or failure).
|
|
62
|
+
* Returns the tick's outcome so E2E and admin routes can report it.
|
|
63
|
+
*/
|
|
64
|
+
triggerNow(): Promise<{
|
|
65
|
+
ok: boolean;
|
|
66
|
+
durationMs: number;
|
|
67
|
+
error?: string;
|
|
68
|
+
}>;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Readonly snapshot of per-job metric state. Used by the admin
|
|
72
|
+
* `/api/v1/admin/scheduled-jobs` route to surface last-run info.
|
|
73
|
+
*/
|
|
74
|
+
export declare function getOrchestratorJobMetricState(): ReadonlyMap<string, {
|
|
75
|
+
consecutiveFailures: number;
|
|
76
|
+
lastSuccessAt: Date | null;
|
|
77
|
+
lastFailureAt: Date | null;
|
|
78
|
+
}>;
|
|
79
|
+
/**
|
|
80
|
+
* Look up a registered scheduled job's handle by name. Returns
|
|
81
|
+
* `undefined` if the job isn't registered on this instance. Used by
|
|
82
|
+
* the admin trigger-now endpoint.
|
|
83
|
+
*/
|
|
84
|
+
export declare function findOrchestratorScheduledJob(name: OrchestratorScheduledJobName): OrchestratorScheduledJobHandle | undefined;
|
|
85
|
+
/**
|
|
86
|
+
* Clear the scheduled-job registry. Intended for tests only —
|
|
87
|
+
* production code should keep a stable set of registered jobs.
|
|
88
|
+
*/
|
|
89
|
+
export declare function __resetOrchestratorScheduledJobsForTesting(): void;
|
|
90
|
+
export declare function registerOrchestratorScheduledJob(opts: OrchestratorScheduledJobOptions): OrchestratorScheduledJobHandle;
|
|
91
|
+
//# sourceMappingURL=scheduled-job.d.ts.map
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { LockFile, LockTrigger, LockWorkflow } from '@kici-dev/engine';
|
|
2
|
+
/**
|
|
3
|
+
* Trigger types that cause a workflow to be stored in workflow_registrations.
|
|
4
|
+
*
|
|
5
|
+
* Non-Git-provider triggers (kici_event, schedule, webhook, …) live in the
|
|
6
|
+
* registration table because they have no per-repo lock file pipeline to
|
|
7
|
+
* fall back to. Git-provider triggers (push, pr, tag, …) ALSO live in the
|
|
8
|
+
* registration table so that the cross-source dispatch path (phase 28.5)
|
|
9
|
+
* can resolve them by (customer_id, repo_identifier) when a generic webhook
|
|
10
|
+
* targets an externally-hosted repo. The per-event lock file pipeline still
|
|
11
|
+
* handles same-source dispatch for git triggers; registration is an additive
|
|
12
|
+
* index.
|
|
13
|
+
*/
|
|
14
|
+
declare const REGISTERABLE_TRIGGER_TYPES: ReadonlySet<string>;
|
|
15
|
+
/**
|
|
16
|
+
* Check whether a trigger has repo patterns, indicating
|
|
17
|
+
* it is part of a global workflow that matches across repositories.
|
|
18
|
+
*/
|
|
19
|
+
export declare function hasRepoPatterns(trigger: LockTrigger): boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Extract workflows that have at least one trigger with repo patterns.
|
|
22
|
+
* These are "global workflows" that match events across repositories.
|
|
23
|
+
*
|
|
24
|
+
* @param lockFile - The compiled lock file to extract from
|
|
25
|
+
* @returns Workflows that have at least one trigger with repo patterns
|
|
26
|
+
*/
|
|
27
|
+
export declare function extractGlobalWorkflows(lockFile: LockFile): LockWorkflow[];
|
|
28
|
+
/**
|
|
29
|
+
* Extract workflows that have at least one registerable trigger, OR that
|
|
30
|
+
* have repo patterns (global workflows).
|
|
31
|
+
*
|
|
32
|
+
* Since phase 28.5, Git-provider triggers (push, pr, tag, …) are ALSO
|
|
33
|
+
* registerable so cross-source dispatch can resolve them via the registration
|
|
34
|
+
* index when a generic webhook targets an externally-hosted repo. The
|
|
35
|
+
* per-event lock file pipeline remains the primary matching path for
|
|
36
|
+
* same-source git events; registration is an additive index.
|
|
37
|
+
*
|
|
38
|
+
* @param lockFile - The compiled lock file to extract from
|
|
39
|
+
* @returns Workflows that have at least one registerable trigger or repo patterns
|
|
40
|
+
*/
|
|
41
|
+
export declare function extractRegisterableWorkflows(lockFile: LockFile): LockWorkflow[];
|
|
42
|
+
/** Exposed for testing */
|
|
43
|
+
export { REGISTERABLE_TRIGGER_TYPES };
|
|
44
|
+
//# sourceMappingURL=extractor.d.ts.map
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import type { LockWorkflow } from '@kici-dev/engine';
|
|
2
|
+
import type { RegistrationStore } from './registration-store.js';
|
|
3
|
+
/**
|
|
4
|
+
* A registered workflow entry with typed fields for fast in-memory lookup.
|
|
5
|
+
*/
|
|
6
|
+
export interface RegisteredWorkflow {
|
|
7
|
+
id: string;
|
|
8
|
+
repoIdentifier: string;
|
|
9
|
+
workflowName: string;
|
|
10
|
+
lockEntry: LockWorkflow;
|
|
11
|
+
triggerTypes: string[];
|
|
12
|
+
routingKey: string;
|
|
13
|
+
providerContext: Record<string, unknown>;
|
|
14
|
+
disabled: boolean;
|
|
15
|
+
/** Whether this is a global workflow (has repo patterns) */
|
|
16
|
+
isGlobal: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Customer/org ID that owns this registration. Drives org-scoped lookups
|
|
19
|
+
* via getByOrgAndEvent — cross-org leakage is structurally impossible
|
|
20
|
+
* because the byOrgAndEvent key is namespaced by customerId.
|
|
21
|
+
*/
|
|
22
|
+
customerId: string;
|
|
23
|
+
commitSha: string | null;
|
|
24
|
+
sourceFile: string | null;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* In-memory index of workflow registrations with version-based reload.
|
|
28
|
+
*
|
|
29
|
+
* Provides fast lookups by trigger type, customer/repo, and event type.
|
|
30
|
+
* Updates happen only via loadFromDb/refreshIfNeeded -- the index is
|
|
31
|
+
* read-only from the outside.
|
|
32
|
+
*/
|
|
33
|
+
export declare class RegistrationIndex {
|
|
34
|
+
private readonly store;
|
|
35
|
+
/** Current version matching the DB registry_versions counter */
|
|
36
|
+
private version;
|
|
37
|
+
/** Primary index: keyed by `{routingKey}:{repoIdentifier}` */
|
|
38
|
+
private entries;
|
|
39
|
+
/** Secondary index: keyed by trigger type for fast event routing */
|
|
40
|
+
private byTriggerType;
|
|
41
|
+
/** Tertiary index: global workflows keyed by `{routingKey}:{triggerType}` */
|
|
42
|
+
private globalByTriggerType;
|
|
43
|
+
/**
|
|
44
|
+
* Tertiary-b index: global workflows keyed by `{customerId}|{triggerType}`.
|
|
45
|
+
* Used for cross-provider global workflow dispatch within an org — e.g.
|
|
46
|
+
* a universal-git Forgejo source authors a global workflow, a GitHub App
|
|
47
|
+
* source in the same org delivers a push, and the global is dispatched
|
|
48
|
+
* even though the inbound routing key differs from the registration's.
|
|
49
|
+
* Cross-org isolation is structurally enforced by the customer_id prefix.
|
|
50
|
+
*/
|
|
51
|
+
private globalByOrgAndTriggerType;
|
|
52
|
+
/**
|
|
53
|
+
* Quaternary index: webhook-trigger registrations keyed by
|
|
54
|
+
* `${customerId}|${eventName}`. Drives the cross-source webhook lookup
|
|
55
|
+
* (a generic webhook arriving in org A finds all webhook-trigger
|
|
56
|
+
* registrations in org A whose lock_entry has a matching event). Cross-org
|
|
57
|
+
* isolation is structurally enforced by the customer_id-prefixed key.
|
|
58
|
+
*/
|
|
59
|
+
private byOrgAndEvent;
|
|
60
|
+
/**
|
|
61
|
+
* Quinary index: registrations keyed by `${customerId}|${repoIdentifier}`.
|
|
62
|
+
* Drives the cross-source repo lookup (phase 28.5): when a generic webhook
|
|
63
|
+
* carries a repository identifier in its payload, the dispatcher looks up
|
|
64
|
+
* registrations for that (org, repo) pair across ALL routing keys and uses
|
|
65
|
+
* each registration's stored `providerContext` + `routingKey` to reach the
|
|
66
|
+
* owning provider bundle (e.g. a github source) for credential minting and
|
|
67
|
+
* trigger evaluation. Cross-org isolation is structurally enforced by the
|
|
68
|
+
* customer_id-prefixed key.
|
|
69
|
+
*/
|
|
70
|
+
private byOrgAndRepo;
|
|
71
|
+
constructor(store: RegistrationStore);
|
|
72
|
+
/**
|
|
73
|
+
* Bulk load all registrations from the DB store.
|
|
74
|
+
* Rebuilds both in-memory indexes and updates the version.
|
|
75
|
+
*/
|
|
76
|
+
loadFromDb(): Promise<void>;
|
|
77
|
+
/**
|
|
78
|
+
* Reload from DB if the remote version is newer than the local version.
|
|
79
|
+
* Called when a peer heartbeat reports a higher registryVersion.
|
|
80
|
+
*/
|
|
81
|
+
refreshIfNeeded(remoteVersion: number): Promise<void>;
|
|
82
|
+
/**
|
|
83
|
+
* Get the current in-memory version.
|
|
84
|
+
*/
|
|
85
|
+
getVersion(): number;
|
|
86
|
+
/**
|
|
87
|
+
* Look up a single registration by ID (includes disabled entries).
|
|
88
|
+
* Used by manual schedule to distinguish "not found" from "disabled".
|
|
89
|
+
*/
|
|
90
|
+
getById(id: string): RegisteredWorkflow | undefined;
|
|
91
|
+
/**
|
|
92
|
+
* Get all workflows registered for a specific trigger type.
|
|
93
|
+
* Used for event routing (e.g., find all workflows listening for 'kici_event').
|
|
94
|
+
*/
|
|
95
|
+
getByTriggerType(triggerType: string): RegisteredWorkflow[];
|
|
96
|
+
/**
|
|
97
|
+
* Get all workflows registered for a specific routing key and repo.
|
|
98
|
+
*/
|
|
99
|
+
getByRoutingKeyAndRepo(routingKey: string, repoIdentifier: string): RegisteredWorkflow[];
|
|
100
|
+
/**
|
|
101
|
+
* Cross-source webhook lookup: return all webhook-trigger registrations
|
|
102
|
+
* within a customer/org that listen for `eventName`.
|
|
103
|
+
*
|
|
104
|
+
* Used by the cross-source dispatch branch in `processWebhook()` so that an
|
|
105
|
+
* inbound generic webhook in org A can fan out to webhook-trigger workflows
|
|
106
|
+
* registered to ANY source in org A. Org isolation is structurally enforced:
|
|
107
|
+
* the lookup key is `${customerId}|${eventName}`, so registrations in a
|
|
108
|
+
* different customer's bucket cannot leak through this method even if the
|
|
109
|
+
* eventName matches.
|
|
110
|
+
*
|
|
111
|
+
* Disabled rows are filtered out, mirroring the other typed lookups.
|
|
112
|
+
*/
|
|
113
|
+
getByOrgAndEvent(customerId: string, eventName: string): RegisteredWorkflow[];
|
|
114
|
+
/**
|
|
115
|
+
* Cross-source repo lookup: return all registrations in a given customer/org
|
|
116
|
+
* that target a specific repo identifier, across all routing keys.
|
|
117
|
+
*
|
|
118
|
+
* Used by the cross-source dispatch branch in `processWebhook()` so that a
|
|
119
|
+
* generic webhook carrying `repository.full_name` (or an equivalent payload
|
|
120
|
+
* field) can be routed to git-trigger workflows (push, pr, tag, …) owned by
|
|
121
|
+
* any source in the same org. Each returned registration carries its own
|
|
122
|
+
* `routingKey` + `providerContext`, which the caller uses to resolve the
|
|
123
|
+
* correct provider bundle and mint credentials for the owning provider.
|
|
124
|
+
*
|
|
125
|
+
* Org isolation is structurally enforced: the lookup key is
|
|
126
|
+
* `${customerId}|${repoIdentifier}`, so registrations in a different
|
|
127
|
+
* customer's bucket cannot leak through even if the repo identifier matches.
|
|
128
|
+
*
|
|
129
|
+
* Disabled rows are filtered out, mirroring the other typed lookups.
|
|
130
|
+
*/
|
|
131
|
+
getByOrgAndRepo(customerId: string, repoIdentifier: string): RegisteredWorkflow[];
|
|
132
|
+
/**
|
|
133
|
+
* Get global workflows matching a trigger type within a routing key.
|
|
134
|
+
* Used by the webhook processor for dual-query (per-repo + global).
|
|
135
|
+
*/
|
|
136
|
+
getGlobalByTriggerType(triggerType: string, routingKey: string): RegisteredWorkflow[];
|
|
137
|
+
/**
|
|
138
|
+
* Get global workflows matching a trigger type within an org, across ALL
|
|
139
|
+
* routing keys. Used by the webhook processor for cross-provider global
|
|
140
|
+
* workflow dispatch.
|
|
141
|
+
*/
|
|
142
|
+
getGlobalByOrgAndTriggerType(customerId: string, triggerType: string): RegisteredWorkflow[];
|
|
143
|
+
/**
|
|
144
|
+
* Convenience: get all workflows with 'schedule' trigger type.
|
|
145
|
+
* Used by the cron scheduler to evaluate pending schedules.
|
|
146
|
+
*/
|
|
147
|
+
getCronSchedules(): RegisteredWorkflow[];
|
|
148
|
+
/**
|
|
149
|
+
* Get workflows matching an event type string.
|
|
150
|
+
* Maps event type strings to trigger type strings for lookup.
|
|
151
|
+
*
|
|
152
|
+
* Event type -> trigger type mapping:
|
|
153
|
+
* - 'kici_event' -> 'kici_event'
|
|
154
|
+
* - 'workflow_complete' -> 'workflow_complete' or 'lifecycle'
|
|
155
|
+
* - 'job_complete' -> 'job_complete' or 'lifecycle'
|
|
156
|
+
* - 'generic_webhook' -> 'generic_webhook'
|
|
157
|
+
* - 'schedule' -> 'schedule'
|
|
158
|
+
* - lifecycle event names -> 'lifecycle'
|
|
159
|
+
*/
|
|
160
|
+
getByEventType(eventType: string): RegisteredWorkflow[];
|
|
161
|
+
}
|
|
162
|
+
//# sourceMappingURL=registration-index.d.ts.map
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import type { Kysely } from 'kysely';
|
|
2
|
+
import type { LockWorkflow } from '@kici-dev/engine';
|
|
3
|
+
import type { Database } from '../db/types.js';
|
|
4
|
+
/**
|
|
5
|
+
* Parsed registration row with typed fields.
|
|
6
|
+
* DB stores lock_entry as JSON string and trigger_types as TEXT[],
|
|
7
|
+
* but this interface exposes them as typed objects.
|
|
8
|
+
*/
|
|
9
|
+
export interface RegistrationRow {
|
|
10
|
+
id: string;
|
|
11
|
+
repo_identifier: string;
|
|
12
|
+
workflow_name: string;
|
|
13
|
+
lock_entry: LockWorkflow;
|
|
14
|
+
trigger_types: string[];
|
|
15
|
+
routing_key: string;
|
|
16
|
+
provider_context: Record<string, unknown>;
|
|
17
|
+
disabled: boolean;
|
|
18
|
+
isGlobal: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Customer/org ID that owns this registration. Sourced from the source row
|
|
21
|
+
* (sources or generic_webhook_sources joined on routing_key) and persisted
|
|
22
|
+
* by replaceAll. Drives the (customer_id, eventName) lookup in
|
|
23
|
+
* RegistrationIndex used by cross-source webhook delivery.
|
|
24
|
+
*/
|
|
25
|
+
customerId: string;
|
|
26
|
+
commitSha: string | null;
|
|
27
|
+
sourceFile: string | null;
|
|
28
|
+
created_at: Date;
|
|
29
|
+
updated_at: Date;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Options for replaceAll to pass commit tracking metadata.
|
|
33
|
+
*/
|
|
34
|
+
interface ReplaceAllOptions {
|
|
35
|
+
/**
|
|
36
|
+
* Customer/org ID that owns the registrations being written. REQUIRED —
|
|
37
|
+
* persisted into workflow_registrations.customer_id (NOT NULL since
|
|
38
|
+
* migration 020) and used by RegistrationIndex.byOrgAndEvent for
|
|
39
|
+
* cross-source webhook lookup.
|
|
40
|
+
*/
|
|
41
|
+
customerId: string;
|
|
42
|
+
commitSha?: string;
|
|
43
|
+
sourceFile?: string;
|
|
44
|
+
/** Set of workflow names that should be marked as global */
|
|
45
|
+
globalWorkflowNames?: Set<string>;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* DB CRUD for workflow_registrations table with atomic upsert-based replace-all.
|
|
49
|
+
*
|
|
50
|
+
* The replace-all pattern uses SELECT + UPDATE/INSERT + selective DELETE in a
|
|
51
|
+
* single transaction. This preserves existing registration UUIDs (and their
|
|
52
|
+
* cascaded cron_last_fired records) while still being atomic against concurrent
|
|
53
|
+
* pushes.
|
|
54
|
+
*/
|
|
55
|
+
export declare class RegistrationStore {
|
|
56
|
+
private readonly db;
|
|
57
|
+
constructor(db: Kysely<Database>);
|
|
58
|
+
/**
|
|
59
|
+
* Atomically replace all registrations for a repo (scoped by routing key).
|
|
60
|
+
*
|
|
61
|
+
* Uses an upsert pattern that preserves existing registration IDs:
|
|
62
|
+
* 1. SELECT existing rows for this routing_key + repo
|
|
63
|
+
* 2. UPDATE rows whose workflow_name still exists in the incoming set
|
|
64
|
+
* 3. INSERT rows for new workflow_names
|
|
65
|
+
* 4. DELETE rows whose workflow_name is no longer in the incoming set
|
|
66
|
+
*
|
|
67
|
+
* This prevents cascade deletion of cron_last_fired records when workflows
|
|
68
|
+
* are re-registered on every default-branch push.
|
|
69
|
+
*/
|
|
70
|
+
replaceAll(repoIdentifier: string, workflows: LockWorkflow[], routingKey: string, providerContext: Record<string, unknown>, options: ReplaceAllOptions): Promise<void>;
|
|
71
|
+
/**
|
|
72
|
+
* Toggle the disabled state of a workflow registration.
|
|
73
|
+
* Returns true if a row was updated, false if the ID was not found.
|
|
74
|
+
*/
|
|
75
|
+
setDisabled(id: string, disabled: boolean): Promise<boolean>;
|
|
76
|
+
/**
|
|
77
|
+
* Get all registrations (for index loading on startup).
|
|
78
|
+
*/
|
|
79
|
+
getAll(): Promise<RegistrationRow[]>;
|
|
80
|
+
/**
|
|
81
|
+
* Get registrations for a specific routing key.
|
|
82
|
+
*/
|
|
83
|
+
getByRoutingKey(routingKey: string): Promise<RegistrationRow[]>;
|
|
84
|
+
/**
|
|
85
|
+
* Get registrations for a specific routing key + repo pair.
|
|
86
|
+
*/
|
|
87
|
+
getByRoutingKeyAndRepo(routingKey: string, repoIdentifier: string): Promise<RegistrationRow[]>;
|
|
88
|
+
/**
|
|
89
|
+
* Get a single registration by ID. Returns null if not found.
|
|
90
|
+
*/
|
|
91
|
+
getById(id: string): Promise<RegistrationRow | null>;
|
|
92
|
+
/**
|
|
93
|
+
* Delete a single registration by ID. Returns true if deleted.
|
|
94
|
+
*/
|
|
95
|
+
deleteById(id: string): Promise<boolean>;
|
|
96
|
+
/**
|
|
97
|
+
* Delete all registrations for a routing key + repo pair.
|
|
98
|
+
*/
|
|
99
|
+
deleteByRoutingKeyAndRepo(routingKey: string, repoIdentifier: string): Promise<void>;
|
|
100
|
+
/**
|
|
101
|
+
* Get the current registry version (for cluster sync).
|
|
102
|
+
*/
|
|
103
|
+
getVersion(): Promise<number>;
|
|
104
|
+
/**
|
|
105
|
+
* Increment the registry version and return the new value.
|
|
106
|
+
* Called after registration changes to notify peers via heartbeat.
|
|
107
|
+
*/
|
|
108
|
+
bumpVersion(): Promise<number>;
|
|
109
|
+
}
|
|
110
|
+
export {};
|
|
111
|
+
//# sourceMappingURL=registration-store.d.ts.map
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Check run summary, annotation, and progress text builders.
|
|
3
|
+
*
|
|
4
|
+
* These are pure functions that produce markdown and annotation objects
|
|
5
|
+
* for the GitHub Checks API. No side effects, no API calls -- just data
|
|
6
|
+
* transformation from step results + log buffers to GitHub-ready output.
|
|
7
|
+
*
|
|
8
|
+
* Per locked decisions:
|
|
9
|
+
* - Summary headline: "Job '{jobName}' failed (N/M steps passed)" or success equivalent
|
|
10
|
+
* - Step table with Status | Step | Duration columns
|
|
11
|
+
* - Failed steps: error + last 20 log lines in code blocks
|
|
12
|
+
* - Annotations: failure/warning level, capped at 50
|
|
13
|
+
* - Progress: checklist-style with emoji prefixes
|
|
14
|
+
* - Size safety: 65535 byte limit with progressive truncation
|
|
15
|
+
*/
|
|
16
|
+
import type { StepLogBuffer } from './step-log-buffer.js';
|
|
17
|
+
/** Step result data as sent by the agent in job.status data.stepResults. */
|
|
18
|
+
export interface StepResultData {
|
|
19
|
+
name: string;
|
|
20
|
+
status: 'success' | 'failed' | 'error' | 'skipped' | 'cancelled';
|
|
21
|
+
durationMs?: number;
|
|
22
|
+
error?: string;
|
|
23
|
+
exitCode?: number;
|
|
24
|
+
timedOut?: boolean;
|
|
25
|
+
continueOnError?: boolean;
|
|
26
|
+
}
|
|
27
|
+
/** Source location data from the lock file for annotation linking. */
|
|
28
|
+
export interface SourceLocationData {
|
|
29
|
+
file: string;
|
|
30
|
+
line: number;
|
|
31
|
+
column: number;
|
|
32
|
+
}
|
|
33
|
+
/** A GitHub Check annotation object. */
|
|
34
|
+
export interface CheckAnnotation {
|
|
35
|
+
path: string;
|
|
36
|
+
start_line: number;
|
|
37
|
+
end_line: number;
|
|
38
|
+
annotation_level: 'failure' | 'warning' | 'notice';
|
|
39
|
+
message: string;
|
|
40
|
+
title: string;
|
|
41
|
+
raw_details?: string;
|
|
42
|
+
}
|
|
43
|
+
/** Step progress entry for live updates. */
|
|
44
|
+
export interface StepProgressEntry {
|
|
45
|
+
name: string;
|
|
46
|
+
status: 'pending' | 'running' | 'success' | 'failed' | 'error' | 'skipped' | 'cancelled';
|
|
47
|
+
durationMs?: number;
|
|
48
|
+
}
|
|
49
|
+
interface BuildCheckRunSummaryOptions {
|
|
50
|
+
jobName: string;
|
|
51
|
+
stepResults: StepResultData[];
|
|
52
|
+
logBuffer: StepLogBuffer;
|
|
53
|
+
runId: string;
|
|
54
|
+
jobId: string;
|
|
55
|
+
traceIds: {
|
|
56
|
+
requestId: string;
|
|
57
|
+
runId: string;
|
|
58
|
+
};
|
|
59
|
+
/** Total job duration in milliseconds. */
|
|
60
|
+
jobDurationMs?: number;
|
|
61
|
+
}
|
|
62
|
+
interface BuildAnnotationsOptions {
|
|
63
|
+
stepResults: StepResultData[];
|
|
64
|
+
/** Source locations indexed by step index. Missing entries are skipped. */
|
|
65
|
+
sourceLocations: Map<number, SourceLocationData>;
|
|
66
|
+
}
|
|
67
|
+
interface BuildProgressTextOptions {
|
|
68
|
+
steps: StepProgressEntry[];
|
|
69
|
+
traceIds: {
|
|
70
|
+
requestId: string;
|
|
71
|
+
runId: string;
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
export { formatDuration } from '@kici-dev/shared';
|
|
75
|
+
/**
|
|
76
|
+
* Build a rich markdown summary for a GitHub Check run output.summary field.
|
|
77
|
+
*
|
|
78
|
+
* Includes: headline, step table, failure details with log context, trace footer.
|
|
79
|
+
* Respects the 65535 byte limit with progressive log truncation.
|
|
80
|
+
*/
|
|
81
|
+
export declare function buildCheckRunSummary(opts: BuildCheckRunSummaryOptions): string;
|
|
82
|
+
/**
|
|
83
|
+
* Build GitHub Check annotation objects from step results and source locations.
|
|
84
|
+
*
|
|
85
|
+
* Returns an object with the annotations array (capped at 50) and the count
|
|
86
|
+
* of remaining annotations that could not be included.
|
|
87
|
+
*/
|
|
88
|
+
export declare function buildAnnotations(opts: BuildAnnotationsOptions): {
|
|
89
|
+
annotations: CheckAnnotation[];
|
|
90
|
+
remainingCount: number;
|
|
91
|
+
};
|
|
92
|
+
/**
|
|
93
|
+
* Build a checklist-style markdown string for live check run updates.
|
|
94
|
+
*
|
|
95
|
+
* Example:
|
|
96
|
+
* checkmark Install deps (1.2s)
|
|
97
|
+
* checkmark Build (3.4s)
|
|
98
|
+
* hourglass Run tests...
|
|
99
|
+
* (not yet started) Deploy
|
|
100
|
+
*/
|
|
101
|
+
export declare function buildProgressText(opts: BuildProgressTextOptions): string;
|
|
102
|
+
//# sourceMappingURL=check-run-summary.d.ts.map
|