@kici-dev/orchestrator 0.1.20 → 0.1.21
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/host-roster.d.ts +36 -1
- package/dist/agent/registry.d.ts +22 -0
- package/dist/app.d.ts +5 -0
- package/dist/cli/commands/source-manifest.d.ts +34 -0
- package/dist/cli/loopback-callback.d.ts +24 -0
- package/dist/cli/open-browser.d.ts +12 -0
- package/dist/cli.js +847 -205
- package/dist/cluster/coordinator.d.ts +5 -3
- package/dist/cluster/index.d.ts +2 -0
- package/dist/cluster/join-token.d.ts +27 -5
- package/dist/cluster/peer-auth-coordinator.d.ts +36 -0
- package/dist/cluster/peer-client.d.ts +34 -14
- package/dist/cluster/peer-credentials.d.ts +14 -2
- package/dist/cluster/peer-handler.d.ts +2 -2
- package/dist/cluster/rerouted-job-guard.d.ts +39 -0
- package/dist/db/migrations/043_rerouted_to_peer.d.ts +4 -0
- package/dist/db/migrations/044_check_mode.d.ts +4 -0
- package/dist/db/migrations/045_host_properties.d.ts +16 -0
- package/dist/db/migrations/046_join_token_consumed_by_instance.d.ts +17 -0
- package/dist/db/types.d.ts +33 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +1168 -33
- package/dist/lockfile-validate.d.ts +24 -0
- package/dist/pipeline/dispatch-matched-workflow.d.ts +53 -1
- package/dist/pipeline/test-pipeline.d.ts +7 -0
- package/dist/providers/github/manifest-form.d.ts +15 -0
- package/dist/providers/github/manifest.d.ts +78 -0
- package/dist/reporting/execution-tracker.d.ts +10 -1
- package/dist/routes/admin-sources.d.ts +11 -0
- package/dist/routes/admin.d.ts +8 -0
- package/dist/secrets/pg-secret-store.d.ts +9 -0
- package/dist/server.js +3052 -2004
- package/dist/stale-detector/stale-run-detector.d.ts +8 -0
- package/dist/standalone.js +2837 -1817
- package/dist/worker/in-memory-job-queue.d.ts +17 -0
- package/dist/worker/peer-outbox.d.ts +36 -0
- package/dist/worker/worker-outbox-relay.d.ts +13 -0
- package/dist/ws/inventory-api.d.ts +17 -0
- package/installer-image-digests.json +3 -3
- package/package.json +4 -4
- package/sbom.spdx.json +77 -128
|
@@ -42,6 +42,23 @@ export declare class InMemoryJobQueue {
|
|
|
42
42
|
* labels no longer match, or the agent's gate is not satisfied.
|
|
43
43
|
*/
|
|
44
44
|
dequeueById(jobId: string, agentLabels: string[], agentMandatoryLabels?: string[]): Promise<QueuedJob | null>;
|
|
45
|
+
/**
|
|
46
|
+
* Dequeue the oldest pending job pinned to a specific agent. Mirrors the
|
|
47
|
+
* DB-backed `JobQueue.dequeueByPinnedAgent` that `Dispatcher.onAgentAvailable`
|
|
48
|
+
* calls — host-fanout children pinned to THIS agent drain before the generic
|
|
49
|
+
* label drain. Like the DB version, a pinned job relaxes the label-subset
|
|
50
|
+
* gate (the agent is its designated runner) and only the JS regex
|
|
51
|
+
* post-filter is applied.
|
|
52
|
+
*
|
|
53
|
+
* The worker receives jobs via direct P2P dispatch and does not currently
|
|
54
|
+
* pin jobs to agents, so in practice no in-memory job carries a
|
|
55
|
+
* `pinnedAgentId` and this returns null — `onAgentAvailable` then falls back
|
|
56
|
+
* to `dequeueForLabels`. Implementing it (rather than leaving it undefined)
|
|
57
|
+
* is mandatory: `Dispatcher.onAgentAvailable` invokes it unconditionally, so
|
|
58
|
+
* its absence threw `TypeError: this.queue.dequeueByPinnedAgent is not a
|
|
59
|
+
* function` as an unhandled rejection that crashed the worker.
|
|
60
|
+
*/
|
|
61
|
+
dequeueByPinnedAgent(agentId: string, agentLabels?: string[]): Promise<QueuedJob | null>;
|
|
45
62
|
/** Return count of pending jobs. */
|
|
46
63
|
getDepth(): Promise<number>;
|
|
47
64
|
/** No-op — the job is already tracked in `dispatched` from dequeue. */
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { JobProgress } from '@kici-dev/engine';
|
|
2
|
+
export interface OutboxRecord {
|
|
3
|
+
coordUrl: string;
|
|
4
|
+
message: JobProgress;
|
|
5
|
+
persistedAt: number;
|
|
6
|
+
}
|
|
7
|
+
/** Durable, at-least-once store of terminal job.progress awaiting coordinator ACK. */
|
|
8
|
+
export declare class PeerOutbox {
|
|
9
|
+
private readonly dir;
|
|
10
|
+
private readonly now;
|
|
11
|
+
private readonly records;
|
|
12
|
+
constructor(dir: string, now?: () => number);
|
|
13
|
+
private static coordKey;
|
|
14
|
+
private static recordKey;
|
|
15
|
+
private fileFor;
|
|
16
|
+
loadFromDisk(): Promise<void>;
|
|
17
|
+
enqueue(coordUrl: string, message: JobProgress): Promise<void>;
|
|
18
|
+
/**
|
|
19
|
+
* Synchronous, durably-fsynced enqueue. The terminal job status is on disk
|
|
20
|
+
* before this method returns — there is no async window in which an
|
|
21
|
+
* un-flushed write can be lost if the worker process is killed moments
|
|
22
|
+
* later (e.g. a worker orchestrator that crashes during microVM teardown
|
|
23
|
+
* right after the job completes). The asynchronous {@link enqueue} is
|
|
24
|
+
* fire-and-forget at its call site, so its fsync can be dropped when the
|
|
25
|
+
* event loop never runs again; this variant blocks the (infrequent,
|
|
26
|
+
* once-per-job-terminal) call path until the bytes are durable instead.
|
|
27
|
+
*/
|
|
28
|
+
enqueueSync(coordUrl: string, message: JobProgress): void;
|
|
29
|
+
ack(coordUrl: string, runId: string, jobId: string): Promise<void>;
|
|
30
|
+
pendingFor(coordUrl: string): OutboxRecord[];
|
|
31
|
+
prune(ttlMs: number, now?: number): Promise<number>;
|
|
32
|
+
private fsync;
|
|
33
|
+
private fsyncDir;
|
|
34
|
+
private fsyncDirSync;
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=peer-outbox.d.ts.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Relay glue between the worker's in-memory execution tracker and the durable
|
|
3
|
+
* peer outbox. Extracted so the mapping/replay logic is unit-testable and so
|
|
4
|
+
* the worker bootstrap stays under the function-length cap.
|
|
5
|
+
*/
|
|
6
|
+
import { type JobProgress } from '@kici-dev/engine';
|
|
7
|
+
import type { StatusUpdate } from './in-memory-execution-tracker.js';
|
|
8
|
+
import type { PeerOutbox } from './peer-outbox.js';
|
|
9
|
+
/** Map a terminal job-level StatusUpdate to the JobProgress to durably relay; null otherwise. */
|
|
10
|
+
export declare function buildTerminalJobProgress(update: StatusUpdate): JobProgress | null;
|
|
11
|
+
/** Re-send every outbox record destined for `url`. Send failures are retried on the next connect. */
|
|
12
|
+
export declare function replayPending(outbox: PeerOutbox, send: (m: JobProgress) => boolean, url: string): void;
|
|
13
|
+
//# sourceMappingURL=worker-outbox-relay.d.ts.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type HostInventoryEntry } from '@kici-dev/engine';
|
|
2
|
+
import type { HostRosterStore } from '../agent/host-roster.js';
|
|
3
|
+
/** Store surface the inventory handlers need (kept narrow for testability). */
|
|
4
|
+
export interface InventoryApiDeps {
|
|
5
|
+
rosterStore: Pick<HostRosterStore, 'queryInventory' | 'getInventory'>;
|
|
6
|
+
/** Roster grace window (ms) — the same value runsOnAll's `findMatching` uses. */
|
|
7
|
+
graceMs: number;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Build the `inventory.query` handler. Validates the optional label selector
|
|
11
|
+
* (`include` OR-of-AND groups + `exclude`); an empty selector ⇒ all hosts.
|
|
12
|
+
* Property filtering is done client-side in the workflow.
|
|
13
|
+
*/
|
|
14
|
+
export declare function createInventoryQueryHandler(deps: InventoryApiDeps): (agentId: string, params: Record<string, unknown>) => Promise<HostInventoryEntry[]>;
|
|
15
|
+
/** Build the `inventory.get` handler — single-host lookup, null when absent. */
|
|
16
|
+
export declare function createInventoryGetHandler(deps: InventoryApiDeps): (agentId: string, params: Record<string, unknown>) => Promise<HostInventoryEntry | null>;
|
|
17
|
+
//# sourceMappingURL=inventory-api.d.ts.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.1.
|
|
2
|
+
"version": "0.1.21",
|
|
3
3
|
"images": {
|
|
4
|
-
"kici-agent": "sha256:
|
|
5
|
-
"kici-orchestrator": "sha256:
|
|
4
|
+
"kici-agent": "sha256:28896aa6665887f959765c821d0535f44e6bcaa73b3f45d21c39b6f2f9604c49",
|
|
5
|
+
"kici-orchestrator": "sha256:d8b1b6306be8beaa973b0828e6d5ffbcb6f10b3c81b2875e37435b4bf140ecbe"
|
|
6
6
|
}
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kici-dev/orchestrator",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.21",
|
|
4
4
|
"description": "Customer-deployable orchestrator for the KiCI CI/CD stack. Receives webhook events (direct or via Platform relay), matches triggers against the lock file, and dispatches jobs to connected agents.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ci",
|
|
@@ -86,8 +86,8 @@
|
|
|
86
86
|
"ws": "^8.21.0",
|
|
87
87
|
"yaml": "^2.9.0",
|
|
88
88
|
"zod": "^4.4.3",
|
|
89
|
-
"@kici-dev/
|
|
90
|
-
"@kici-dev/
|
|
89
|
+
"@kici-dev/engine": "0.1.21",
|
|
90
|
+
"@kici-dev/shared": "0.1.21"
|
|
91
91
|
},
|
|
92
92
|
"kici": {
|
|
93
93
|
"metrics": {
|
|
@@ -101,7 +101,7 @@
|
|
|
101
101
|
"@types/archiver": "^8.0.0",
|
|
102
102
|
"@types/dockerode": "^4.0.1",
|
|
103
103
|
"kysely-ctl": "^0.21.0",
|
|
104
|
-
"@kici-dev/agent": "0.1.
|
|
104
|
+
"@kici-dev/agent": "0.1.21"
|
|
105
105
|
},
|
|
106
106
|
"scripts": {
|
|
107
107
|
"build": "node ../../scripts/build-service.mjs && tsc --emitDeclarationOnly",
|