@kici-dev/orchestrator 0.1.14 → 0.1.16
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/README.md +13 -1
- package/dist/__test-helpers__/mock-db.d.ts +2 -0
- package/dist/agent/dispatcher.d.ts +110 -6
- package/dist/agent/registry.d.ts +14 -0
- package/dist/app.d.ts +36 -0
- package/dist/approvals/apply-decision.d.ts +60 -0
- package/dist/approvals/approval-resolver.d.ts +66 -0
- package/dist/approvals/step-approval-bridge.d.ts +72 -0
- package/dist/approvals/team-membership-lookup.d.ts +13 -0
- package/dist/cache/agent-job-failed-error.d.ts +13 -0
- package/dist/cache/dispatch-cache-ref-tracker.d.ts +45 -0
- package/dist/cache/index.d.ts +2 -0
- package/dist/cache/user-cache.d.ts +116 -0
- package/dist/cancel/cancel-run.d.ts +56 -0
- package/dist/cli/api-client.d.ts +24 -0
- package/dist/cli/commands/environment.d.ts +1 -0
- package/dist/cli/commands/firecracker/index.d.ts +11 -0
- package/dist/cli/commands/firecracker/provision.d.ts +13 -0
- package/dist/cli/commands/firecracker/teardown.d.ts +3 -0
- package/dist/cli/commands/firecracker/verify.d.ts +3 -0
- package/dist/cli/commands/scaler.d.ts +18 -0
- package/dist/cli/kici-admin.d.ts +10 -1
- package/dist/cli/service/image-digests.d.ts +21 -0
- package/dist/cli.js +4148 -455
- package/dist/cluster/peer-client.d.ts +23 -1
- package/dist/cluster/peer-handler.d.ts +9 -1
- package/dist/cluster/peer-registry.d.ts +6 -0
- package/dist/config/schema.d.ts +4 -0
- package/dist/config.d.ts +13 -0
- package/dist/dashboard/handler.d.ts +92 -1
- package/dist/db/migrations/026_event_log_lockfile_corrupt.d.ts +11 -0
- package/dist/db/migrations/027_workflow_timeout.d.ts +20 -0
- package/dist/db/migrations/028_org_settings_user_cache.d.ts +4 -0
- package/dist/db/migrations/029_dispatch_queue_attempts.d.ts +16 -0
- package/dist/db/migrations/030_held_runs_env_set_null.d.ts +13 -0
- package/dist/db/migrations/031_dispatch_queue_ack_deadline.d.ts +19 -0
- package/dist/db/migrations/032_org_settings_dispatch_ack_timeout.d.ts +14 -0
- package/dist/db/migrations/033_org_settings_approval.d.ts +19 -0
- package/dist/db/migrations/034_held_runs_generalize.d.ts +24 -0
- package/dist/db/types.d.ts +89 -3
- package/dist/diagnostics/bundle-writer.d.ts +1 -17
- package/dist/diagnostics/checks/firecracker-network.d.ts +13 -0
- package/dist/diagnostics/checks/index.d.ts +2 -1
- package/dist/diagnostics/fleet-collector.d.ts +52 -0
- package/dist/diagnostics/fleet-constants.d.ts +8 -0
- package/dist/diagnostics/fleet-selection.d.ts +15 -0
- package/dist/diagnostics/fleet-topology.d.ts +47 -0
- package/dist/diagnostics/fleet-wiring.d.ts +60 -0
- package/dist/environments/environment-store.d.ts +14 -1
- package/dist/environments/held-runs.d.ts +69 -1
- package/dist/firecracker/host-network.d.ts +83 -0
- package/dist/firecracker/persist.d.ts +14 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +380 -40
- package/dist/lockfile-cache.d.ts +1 -1
- package/dist/metrics/prometheus.d.ts +8 -0
- package/dist/orchestrator-core.d.ts +13 -2
- package/dist/pipeline/dispatch-matched-workflow.d.ts +9 -0
- package/dist/pipeline/inline-eval.d.ts +17 -2
- package/dist/pipeline/process-webhook.d.ts +19 -0
- package/dist/pipeline/processor.d.ts +28 -1
- package/dist/pipeline/test-pipeline.d.ts +10 -0
- package/dist/providers/github/lock-file.d.ts +1 -1
- package/dist/providers/internal/lock-file-fetcher.d.ts +3 -2
- package/dist/queue/job-queue.d.ts +53 -1
- package/dist/reporting/execution-tracker.d.ts +3 -1
- package/dist/routes/admin-environments.d.ts +1 -0
- package/dist/routes/fleet.d.ts +20 -0
- package/dist/scaler/bare-metal-backend.d.ts +1 -0
- package/dist/scaler/config.d.ts +4 -2
- package/dist/scaler/container-backend.d.ts +3 -2
- package/dist/scaler/disk-guard.d.ts +27 -0
- package/dist/scaler/firecracker-backend.d.ts +35 -0
- package/dist/scaler/manager.d.ts +8 -0
- package/dist/scaler/nftables.d.ts +29 -3
- package/dist/scaler/reap-orphans.d.ts +27 -0
- package/dist/scaler/types.d.ts +28 -1
- package/dist/server.js +6138 -1587
- package/dist/stale-detector/stale-run-detector.d.ts +18 -0
- package/dist/stale-detector/workflow-deadline-detector.d.ts +49 -0
- package/dist/standalone.js +18499 -14925
- package/dist/storage/filesystem.d.ts +14 -4
- package/dist/storage/s3.d.ts +19 -5
- package/dist/storage/types.d.ts +32 -5
- package/dist/worker/in-memory-job-queue.d.ts +40 -7
- package/dist/ws/agent-handler.d.ts +45 -0
- package/dist/ws/dashboard-env-handler.d.ts +36 -0
- package/dist/ws/fleet-agent-collector.d.ts +23 -0
- package/dist/ws/platform-client.d.ts +10 -1
- package/installer-image-digests.json +7 -0
- package/package.json +15 -11
- package/sbom.spdx.json +62 -57
|
@@ -23,6 +23,8 @@ import type { ScalerManager } from '../scaler/manager.js';
|
|
|
23
23
|
import type { Dispatcher } from '../agent/dispatcher.js';
|
|
24
24
|
import type { AgentRegistry } from '../agent/registry.js';
|
|
25
25
|
import type { HeldRunStore } from '../environments/held-runs.js';
|
|
26
|
+
import type { StepApprovalBridge } from '../approvals/step-approval-bridge.js';
|
|
27
|
+
import type { AccessLogWriter } from '../audit/access-log.js';
|
|
26
28
|
export interface StaleRunDetectorDeps {
|
|
27
29
|
db: Kysely<Database>;
|
|
28
30
|
executionTracker: ExecutionTracker;
|
|
@@ -36,6 +38,12 @@ export interface StaleRunDetectorDeps {
|
|
|
36
38
|
scanIntervalMs: number;
|
|
37
39
|
/** Held run store for expiring overdue held runs. Optional -- if not set, held run cleanup is skipped. */
|
|
38
40
|
heldRunStore?: HeldRunStore;
|
|
41
|
+
/** Step-approval bridge — notified when a step-scoped hold expires so the waiting agent fails the step. Optional. */
|
|
42
|
+
stepApprovalBridge?: StepApprovalBridge;
|
|
43
|
+
/** Fail a whole run when a job/workflow-scoped approval hold expires. Optional. */
|
|
44
|
+
failRun?: (runId: string, reason: string) => Promise<void>;
|
|
45
|
+
/** Access-log writer for the orchestrator audit stream. Optional -- if not set, expiry audit rows (`held_run.expire`) are skipped. */
|
|
46
|
+
accessLogWriter?: AccessLogWriter;
|
|
39
47
|
}
|
|
40
48
|
export declare class StaleRunDetector {
|
|
41
49
|
private readonly db;
|
|
@@ -47,8 +55,18 @@ export declare class StaleRunDetector {
|
|
|
47
55
|
private readonly staleThresholdMs;
|
|
48
56
|
private readonly scanIntervalMs;
|
|
49
57
|
private readonly heldRunStore?;
|
|
58
|
+
private readonly stepApprovalBridge?;
|
|
59
|
+
private readonly failRun?;
|
|
60
|
+
private readonly accessLogWriter?;
|
|
50
61
|
private interval;
|
|
51
62
|
constructor(deps: StaleRunDetectorDeps);
|
|
63
|
+
/**
|
|
64
|
+
* Expire overdue approval holds. Routes each overdue hold by scope BEFORE the
|
|
65
|
+
* bulk status flip: step-scoped holds notify the waiting agent (which fails
|
|
66
|
+
* the step), job/workflow-scoped holds fail the whole run. Then the bulk
|
|
67
|
+
* `expireOverdue()` flips every overdue row to `expired`.
|
|
68
|
+
*/
|
|
69
|
+
private expireOverdueHolds;
|
|
52
70
|
/**
|
|
53
71
|
* Clean up orphaned jobs left in 'recovering' state from a previous orchestrator instance.
|
|
54
72
|
*
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WorkflowDeadlineDetector: periodic DB scanner enforcing the workflow-level
|
|
3
|
+
* run deadline.
|
|
4
|
+
*
|
|
5
|
+
* A workflow `timeout` caps the whole run's wall-clock across all jobs.
|
|
6
|
+
* Because jobs span multiple agents, the cap is a run-level deadline owned by
|
|
7
|
+
* the orchestrator. This scanner finds non-terminal runs whose
|
|
8
|
+
* `started_at + workflow_timeout_ms` has passed and cancels them through the
|
|
9
|
+
* canonical run-cancel path, recording the distinct
|
|
10
|
+
* TimeoutReason.workflow_timeout so the dashboard labels the run "timed out"
|
|
11
|
+
* rather than a generic cancel.
|
|
12
|
+
*/
|
|
13
|
+
import { type Kysely } from 'kysely';
|
|
14
|
+
import type { Database } from '../db/types.js';
|
|
15
|
+
import type { JobQueue } from '../queue/job-queue.js';
|
|
16
|
+
export interface WorkflowDeadlineDetectorDeps {
|
|
17
|
+
db: Kysely<Database>;
|
|
18
|
+
/**
|
|
19
|
+
* Canonical "cancel this whole run with a reason" callback — the same
|
|
20
|
+
* implementation the user-initiated `kici cancel` route uses
|
|
21
|
+
* (cancelRunWithReason bound to the orchestrator's deps).
|
|
22
|
+
*/
|
|
23
|
+
cancelRun: (runId: string, reason: string) => Promise<unknown>;
|
|
24
|
+
jobQueue: JobQueue;
|
|
25
|
+
/** How often to scan in ms. Default supplied by the caller (reuses the stale-detector interval). */
|
|
26
|
+
scanIntervalMs: number;
|
|
27
|
+
}
|
|
28
|
+
export declare class WorkflowDeadlineDetector {
|
|
29
|
+
private readonly db;
|
|
30
|
+
private readonly cancelRun;
|
|
31
|
+
private readonly jobQueue;
|
|
32
|
+
private readonly scanIntervalMs;
|
|
33
|
+
private interval;
|
|
34
|
+
constructor(deps: WorkflowDeadlineDetectorDeps);
|
|
35
|
+
/**
|
|
36
|
+
* Start the detector: an immediate scan (crash recovery — catch runs that
|
|
37
|
+
* blew their deadline while the orchestrator was down), then periodic scans.
|
|
38
|
+
*/
|
|
39
|
+
start(): Promise<void>;
|
|
40
|
+
stop(): void;
|
|
41
|
+
/**
|
|
42
|
+
* Run a single deadline scan: find non-terminal runs with a configured
|
|
43
|
+
* workflow timeout whose `started_at + workflow_timeout_ms` has passed and
|
|
44
|
+
* cancel each one.
|
|
45
|
+
*/
|
|
46
|
+
scan(): Promise<void>;
|
|
47
|
+
private cancelOverdueRun;
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=workflow-deadline-detector.d.ts.map
|