@kici-dev/orchestrator 0.12.0 → 0.13.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/dispatcher.d.ts +22 -0
- package/dist/agent/registry.d.ts +31 -0
- package/dist/app.d.ts +6 -0
- package/dist/cache/cache-upload-settle.d.ts +75 -0
- package/dist/cache/pending-inits.d.ts +9 -0
- package/dist/cancel/cancel-run.d.ts +22 -4
- package/dist/cancel/peer-job-cancel.d.ts +50 -0
- package/dist/cancel/sweep-stuck-cancelling.d.ts +3 -1
- package/dist/cli/commands/local-hook.d.ts +3 -2
- package/dist/cli/commands/local-trigger.d.ts +7 -0
- package/dist/cli.js +983 -683
- package/dist/cluster/coordinator-credential.d.ts +45 -0
- package/dist/cluster/coordinator.d.ts +18 -2
- package/dist/cluster/index.d.ts +1 -0
- package/dist/cluster/instance-heartbeat.d.ts +6 -1
- package/dist/cluster/join-token.d.ts +2 -0
- package/dist/cluster/peer-auth-coordinator.d.ts +13 -0
- package/dist/cluster/peer-client.d.ts +4 -0
- package/dist/cluster/peer-credentials.d.ts +31 -0
- package/dist/config.d.ts +3 -0
- package/dist/db/migrations/152_org_settings_cache_upload_settle_timeout.d.ts +15 -0
- package/dist/db/migrations/153_execution_runs_cancel_force.d.ts +16 -0
- package/dist/db/types.d.ts +15 -0
- package/dist/index.js +192 -53
- package/dist/pipeline/changed-files.d.ts +51 -0
- package/dist/pipeline/cross-source-tally.d.ts +21 -0
- package/dist/pipeline/degraded-reason.d.ts +8 -0
- package/dist/pipeline/dispatch-matched-workflow.d.ts +10 -0
- package/dist/pipeline/global-eval-round.d.ts +3 -2
- package/dist/pipeline/processor.d.ts +9 -1
- package/dist/pipeline/rerun-inputs.d.ts +16 -7
- package/dist/providers/github/changed-files.d.ts +14 -4
- package/dist/providers/universal-git/changed-files.d.ts +6 -0
- package/dist/providers/universal-git/config.d.ts +4 -0
- package/dist/scaler/container-backend.d.ts +2 -0
- package/dist/scaler/container-runtime.d.ts +9 -0
- package/dist/scaler/manager.d.ts +26 -2
- package/dist/server.js +2710 -1486
- package/dist/stale-detector/workflow-deadline-detector.d.ts +7 -1
- package/dist/standalone.js +11527 -10302
- package/dist/storage/s3.d.ts +36 -0
- package/dist/ws/agent-handler.d.ts +24 -3
- package/dist/ws/agent-heartbeat.d.ts +2 -2
- package/installer-image-digests.json +3 -3
- package/package.json +5 -5
- package/sbom.spdx.json +53 -53
|
@@ -87,8 +87,9 @@ export declare function hasDeferredGenerator(lockEntry: LockWorkflow): boolean;
|
|
|
87
87
|
* those that must go through an eval round first.
|
|
88
88
|
*
|
|
89
89
|
* A candidate needs the round when it declares a `filter` (only the agent may
|
|
90
|
-
* run the predicate)
|
|
91
|
-
* run the generator, and it depends on nothing the run produces)
|
|
90
|
+
* run the predicate), carries a needs-free `DynamicJobFn` (only the agent may
|
|
91
|
+
* run the generator, and it depends on nothing the run produces), or matched
|
|
92
|
+
* with deferred `paths` (only the agent's clone holds the diff). Everything
|
|
92
93
|
* else — static jobs, and result-aware generators the run evaluates later — is
|
|
93
94
|
* handed to the dispatch pipeline as declared, so routing it through a round
|
|
94
95
|
* would add a job dispatch and an agent round trip for nothing.
|
|
@@ -49,6 +49,8 @@ import type { RegistrationIndex } from '../registration/registration-index.js';
|
|
|
49
49
|
import type { CronScheduler } from '../cron/cron-scheduler.js';
|
|
50
50
|
import type { GlobalWorkflowPolicy } from '../security/global-workflow-policy.js';
|
|
51
51
|
import type { EventLogWriter } from '../webhook/event-log.js';
|
|
52
|
+
/** The one event-log method the pipeline calls; a per-delivery wrapper can stand in for the writer. */
|
|
53
|
+
export type EventLogRecorder = Pick<EventLogWriter, 'record'>;
|
|
52
54
|
import { EventLogSource } from '@kici-dev/engine';
|
|
53
55
|
import type { LockJob } from '@kici-dev/engine';
|
|
54
56
|
import type { ContextStore } from '../contexts/context-store.js';
|
|
@@ -203,6 +205,12 @@ export declare function resolveLockFileWithFallback(args: {
|
|
|
203
205
|
registrationIndex: RegistrationIndex | undefined;
|
|
204
206
|
lockFileCache: LockFileCache;
|
|
205
207
|
deliveryId: string;
|
|
208
|
+
/**
|
|
209
|
+
* False when cross-source repo mode already evaluated this delivery's
|
|
210
|
+
* other-source registrations for the same repository: the fallback would
|
|
211
|
+
* re-read exactly those registrations. Defaults to true.
|
|
212
|
+
*/
|
|
213
|
+
allowRegistrationFallback?: boolean;
|
|
206
214
|
}): Promise<{
|
|
207
215
|
lockFile: FullLockFile | null;
|
|
208
216
|
resolvedVia: 'inbound' | 'fallback' | 'miss' | 'corrupt';
|
|
@@ -476,7 +484,7 @@ export interface ProcessingDeps {
|
|
|
476
484
|
/** Global workflow policy for org-level permission enforcement. Optional -- if not set, global workflows are unrestricted. */
|
|
477
485
|
globalWorkflowPolicy?: GlobalWorkflowPolicy;
|
|
478
486
|
/** Inbound webhook delivery log writer. Optional -- if not set, deliveries are not persisted to event_log. */
|
|
479
|
-
eventLog?:
|
|
487
|
+
eventLog?: EventLogRecorder;
|
|
480
488
|
/** Where this delivery arrived: 'relay' (Platform WS) or 'direct' (HTTP).
|
|
481
489
|
* Used by the eventLog writer to populate the source column. Defaults to
|
|
482
490
|
* 'direct' when omitted (independent / direct paths). */
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Inputs every re-run path rebuilds from an original run: its stored webhook
|
|
3
|
+
* payload, the provider binding its row records, the delivery's event name, the
|
|
4
|
+
* normalized event, and its changed files. Shared by the per-repository re-run,
|
|
5
|
+
* the evaluation-round re-run and release, and the cross-repository global
|
|
6
|
+
* re-run, so the paths cannot disagree about how a run's inputs are read back.
|
|
7
|
+
*/
|
|
1
8
|
import type { SimulatedEvent } from '@kici-dev/engine';
|
|
2
9
|
import type { ProviderRegistry } from '../provider-registry.js';
|
|
3
10
|
import type { TrustPolicyOutcome } from '../security/trust-policy-gate.js';
|
|
@@ -59,7 +66,9 @@ export declare function loadDeliveryEventName(originalRun: OriginalRunRow, deps:
|
|
|
59
66
|
/** The verdict an approved security hold stands for. */
|
|
60
67
|
export declare const RELEASED_DECISION: TrustPolicyOutcome;
|
|
61
68
|
/**
|
|
62
|
-
* The normalized form of the delivery the round was deciding
|
|
69
|
+
* The normalized form of the delivery the round was deciding, stamped with the
|
|
70
|
+
* repository's default branch as the delivery stamped it: the jobs a re-run
|
|
71
|
+
* dispatches carry this event, and an agent derives a new-branch diff from it.
|
|
63
72
|
*
|
|
64
73
|
* Read-only, and it throws — so it runs before the requestId claim, never
|
|
65
74
|
* inside the re-evaluation.
|
|
@@ -69,13 +78,13 @@ export declare function normalizeRoundEvent(originalRun: OriginalRunRow, provide
|
|
|
69
78
|
action: string | null;
|
|
70
79
|
}, payload: Record<string, unknown>, refusal?: RerunRefusal): SimulatedEvent;
|
|
71
80
|
/**
|
|
72
|
-
* Stamp the re-evaluated event with the source repository's
|
|
81
|
+
* Stamp the re-evaluated event with the source repository's default branch and
|
|
82
|
+
* changed files.
|
|
73
83
|
*
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
* `unavailable
|
|
78
|
-
* conservatively.
|
|
84
|
+
* The resolve is unconditional: the delivery path skips it when no trigger in
|
|
85
|
+
* the source repo's lock file uses path patterns, and a scoped re-evaluation
|
|
86
|
+
* has no such lock file to bound it. A bundle with no fetcher, or a fetch
|
|
87
|
+
* error, carries `unavailable`.
|
|
79
88
|
*/
|
|
80
89
|
export declare function withChangedFiles(opts: {
|
|
81
90
|
event: SimulatedEvent;
|
|
@@ -28,10 +28,15 @@ export declare function withRateLimitRetry<T>(fn: () => Promise<T>, context: str
|
|
|
28
28
|
/**
|
|
29
29
|
* GitHub-specific implementation of ChangedFilesFetcher.
|
|
30
30
|
*
|
|
31
|
-
* For PRs: uses paginated pulls.listFiles API
|
|
32
|
-
*
|
|
33
|
-
* For
|
|
34
|
-
*
|
|
31
|
+
* For PRs: uses the paginated pulls.listFiles API; a result at GitHub's
|
|
32
|
+
* 3000-file cap is truncated, so it reports `unavailable`.
|
|
33
|
+
* For pushes: uses the repos.compareCommits API; a result at GitHub's 300-file
|
|
34
|
+
* cap is truncated, so it reports `unavailable`.
|
|
35
|
+
* For a new branch (zero `before`): compares the default branch against
|
|
36
|
+
* `after` (three-dot), the files the branch adds. With no known default
|
|
37
|
+
* branch, or the default branch itself being created, it reports `unavailable`.
|
|
38
|
+
* For a deleted branch (zero `after`): `fetched` + [].
|
|
39
|
+
* For unknown events: reports `unavailable`.
|
|
35
40
|
*/
|
|
36
41
|
export declare class GitHubChangedFilesFetcher implements ChangedFilesFetcher {
|
|
37
42
|
private readonly config;
|
|
@@ -55,5 +60,10 @@ export declare class GitHubChangedFilesFetcher implements ChangedFilesFetcher {
|
|
|
55
60
|
* Get changed files for a push event using compareCommits API.
|
|
56
61
|
*/
|
|
57
62
|
private getPushChangedFiles;
|
|
63
|
+
/**
|
|
64
|
+
* Compare two refs through the compareCommits API. A result at GitHub's
|
|
65
|
+
* 300-file cap is truncated, so it reports `unavailable`.
|
|
66
|
+
*/
|
|
67
|
+
private compare;
|
|
58
68
|
}
|
|
59
69
|
//# sourceMappingURL=changed-files.d.ts.map
|
|
@@ -8,6 +8,10 @@
|
|
|
8
8
|
* `commits[].{added,modified,removed}` arrays in the push payload, so we
|
|
9
9
|
* extract them via JSONPath from the already-delivered webhook body.
|
|
10
10
|
*
|
|
11
|
+
* Forges cap `commits[]`. A preset whose forge sends a total commit count
|
|
12
|
+
* (`commitsTotal`) or has a documented list cap (`commitsCap`) reports a
|
|
13
|
+
* truncated push as `unavailable` rather than a partial list.
|
|
14
|
+
*
|
|
11
15
|
* For PR events we report `unavailable`: no per-commit diff is present in the
|
|
12
16
|
* webhook body, so the upstream trigger matcher matches path filters
|
|
13
17
|
* conservatively (the workflow runs) instead of silently never matching. A
|
|
@@ -38,6 +42,8 @@ export declare class UniversalGitChangedFilesFetcher implements ChangedFilesFetc
|
|
|
38
42
|
* @param _credentials Unused — no REST call is made.
|
|
39
43
|
*/
|
|
40
44
|
getChangedFiles(_repoIdentifier: string, eventType: string, payload: unknown, _credentials: unknown): Promise<ChangedFilesResult>;
|
|
45
|
+
/** Whether the payload lists fewer commits than the push carried. */
|
|
46
|
+
private isTruncated;
|
|
41
47
|
private classifyEvent;
|
|
42
48
|
}
|
|
43
49
|
//# sourceMappingURL=changed-files.d.ts.map
|
|
@@ -73,6 +73,8 @@ export declare const UniversalGitPayloadPathsSchema: z.ZodObject<{
|
|
|
73
73
|
commitsModified: z.ZodString;
|
|
74
74
|
commitsRemoved: z.ZodString;
|
|
75
75
|
commitMessage: z.ZodOptional<z.ZodString>;
|
|
76
|
+
commitsTotal: z.ZodOptional<z.ZodString>;
|
|
77
|
+
commitsCap: z.ZodOptional<z.ZodNumber>;
|
|
76
78
|
}, z.core.$strip>;
|
|
77
79
|
export type UniversalGitPayloadPaths = z.infer<typeof UniversalGitPayloadPathsSchema>;
|
|
78
80
|
/**
|
|
@@ -131,6 +133,8 @@ export declare const UniversalGitConfigSchema: z.ZodObject<{
|
|
|
131
133
|
commitsModified: z.ZodString;
|
|
132
134
|
commitsRemoved: z.ZodString;
|
|
133
135
|
commitMessage: z.ZodOptional<z.ZodString>;
|
|
136
|
+
commitsTotal: z.ZodOptional<z.ZodString>;
|
|
137
|
+
commitsCap: z.ZodOptional<z.ZodNumber>;
|
|
134
138
|
}, z.core.$strip>>;
|
|
135
139
|
eventMapping: z.ZodOptional<z.ZodObject<{
|
|
136
140
|
push: z.ZodArray<z.ZodString>;
|
|
@@ -211,6 +211,8 @@ export declare class ContainerScalerBackend implements ScalerBackend {
|
|
|
211
211
|
* Returns the count of cleaned containers plus reaped rules.
|
|
212
212
|
*/
|
|
213
213
|
cleanupOrphans(): Promise<number>;
|
|
214
|
+
/** Stop and remove one orphaned agent container; true when it was removed. */
|
|
215
|
+
private removeOrphan;
|
|
214
216
|
/**
|
|
215
217
|
* Remove containers this backend spawned for one agent id.
|
|
216
218
|
*
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The container runtime behind a configured socket path.
|
|
3
|
+
*
|
|
4
|
+
* A path containing `podman` is Podman; any other path is Docker. The container
|
|
5
|
+
* backend reads a configured `socketPath` this way, and the runtime it picks
|
|
6
|
+
* only labels the agents' log source and the scaler diagnostics.
|
|
7
|
+
*/
|
|
8
|
+
export declare function containerRuntimeForSocketPath(socketPath: string): 'docker' | 'podman';
|
|
9
|
+
//# sourceMappingURL=container-runtime.d.ts.map
|
package/dist/scaler/manager.d.ts
CHANGED
|
@@ -11,6 +11,21 @@ import { ScaleDownReason } from './scaler-events.js';
|
|
|
11
11
|
import { type ScalerAgentView } from './agent-fit.js';
|
|
12
12
|
import type { ScalerEventEmitterLike } from './event-backend.js';
|
|
13
13
|
import type { ClaimStore, ClaimedCredentials } from './claim-store.js';
|
|
14
|
+
/**
|
|
15
|
+
* How long a graceful shutdown waits for the scaler backends to stop their
|
|
16
|
+
* agents. It is the first window inside the coordinator's 30 s shutdown limit,
|
|
17
|
+
* and every later step (the HTTP stop grace, the database drain) still has to
|
|
18
|
+
* fit after it.
|
|
19
|
+
*
|
|
20
|
+
* A container stop normally takes at most its own 10 s stop timeout, but the
|
|
21
|
+
* container runtime can take far longer: a Docker daemon that misses a
|
|
22
|
+
* container's exit waits out the stop timeout and then another 10 s for its
|
|
23
|
+
* kill, and one such container held the whole step for 29.7 s. Past this
|
|
24
|
+
* window the orchestrator logs each backend still stopping and continues. The
|
|
25
|
+
* runtime finishes the stop on its own, and the next start's orphan cleanup
|
|
26
|
+
* removes any agent container that is still there.
|
|
27
|
+
*/
|
|
28
|
+
export declare const SCALER_SHUTDOWN_GRACE_MS = 15000;
|
|
14
29
|
import type { BackendFailureSummary } from './failure-tracker.js';
|
|
15
30
|
import type { ScalerBackend, ScalerConfig, ScalerEntry, ScaleResult, ScalerEvent, ResourceCap, ValidationResult, ResolvedContainerSpawn } from './types.js';
|
|
16
31
|
import type { ScalerStateStore, ScalerStateRecovery, ReapCandidate } from './scaler-state-store.js';
|
|
@@ -948,9 +963,12 @@ export declare class ScalerManager {
|
|
|
948
963
|
*/
|
|
949
964
|
private completeLocalRegistration;
|
|
950
965
|
/**
|
|
951
|
-
* Called from agent-handler.ts when an agent disconnects.
|
|
966
|
+
* Called from agent-handler.ts when an agent disconnects. `reason` is what an
|
|
967
|
+
* event scaler's scale-down carries: `shutdown` for an ordinary disconnect,
|
|
968
|
+
* `heartbeat-timeout` for an agent the orchestrator dropped without waiting
|
|
969
|
+
* for its socket.
|
|
952
970
|
*/
|
|
953
|
-
onAgentDisconnected(agentId: string): void;
|
|
971
|
+
onAgentDisconnected(agentId: string, reason?: ScaleDownReason): void;
|
|
954
972
|
/**
|
|
955
973
|
* Tear down a stranded provision the `EventProvisionReaper` found.
|
|
956
974
|
*
|
|
@@ -1145,6 +1163,12 @@ export declare class ScalerManager {
|
|
|
1145
1163
|
* Sum of all backends' active count + spawning agents.
|
|
1146
1164
|
*/
|
|
1147
1165
|
getGlobalActiveCount(): number;
|
|
1166
|
+
/**
|
|
1167
|
+
* Shut every backend down in parallel, waiting at most
|
|
1168
|
+
* {@link SCALER_SHUTDOWN_GRACE_MS} for the slowest. A backend still stopping
|
|
1169
|
+
* when the window closes is logged by name and left to finish on its own.
|
|
1170
|
+
*/
|
|
1171
|
+
private shutdownBackendsWithinGrace;
|
|
1148
1172
|
/**
|
|
1149
1173
|
* Stop warm pool, shutdown all backends, clear tracking maps.
|
|
1150
1174
|
*/
|