@kici-dev/orchestrator 0.1.21 → 0.1.22
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 +44 -0
- package/dist/agent/host-roster-reaper.d.ts +2 -1
- package/dist/agent/host-roster.d.ts +18 -0
- package/dist/approvals/step-approval-bridge.d.ts +5 -0
- package/dist/cli/commands/source-manifest.d.ts +8 -0
- package/dist/cli/service/compose.d.ts +13 -0
- package/dist/cli/service/deploy-env.d.ts +31 -0
- package/dist/cli.js +515 -209
- package/dist/config.d.ts +6 -0
- package/dist/dashboard/needs-edges.d.ts +4 -3
- package/dist/db/migrations/047_needs_run_on.d.ts +4 -0
- package/dist/db/migrations/048_host_reboot_pending.d.ts +19 -0
- package/dist/db/migrations/049_held_runs_payload.d.ts +14 -0
- package/dist/db/migrations/050_sources_slug.d.ts +17 -0
- package/dist/db/types.d.ts +27 -4
- package/dist/deployment/deployment-identity.d.ts +9 -0
- package/dist/entry-helpers.d.ts +7 -0
- package/dist/environments/held-runs.d.ts +7 -1
- package/dist/github-app-name-refresher/github-app-name-refresher.d.ts +77 -0
- package/dist/index.js +21 -2
- package/dist/orchestrator-core.d.ts +13 -1
- package/dist/pipeline/decorating-secret-resolver.d.ts +32 -0
- package/dist/pipeline/dispatch-matched-workflow.d.ts +75 -3
- package/dist/pipeline/install-secrets-resolver.d.ts +2 -2
- package/dist/pipeline/needs-scheduler.d.ts +22 -13
- package/dist/pipeline/processor.d.ts +2 -2
- package/dist/pipeline/test-pipeline.d.ts +31 -59
- package/dist/providers/github/manifest.d.ts +25 -0
- package/dist/routes/admin-sources.d.ts +7 -0
- package/dist/secrets/secret-resolver.d.ts +16 -1
- package/dist/server.js +2728 -1725
- package/dist/sources/source-store.d.ts +4 -0
- package/dist/sources/source-validator.d.ts +2 -0
- package/dist/stale-detector/reboot-deadline-sweep.d.ts +29 -0
- package/dist/standalone.js +1307 -677
- package/dist/ws/agent-handler.d.ts +11 -6
- package/dist/ws/dashboard-fleet-handler.d.ts +33 -0
- package/dist/ws/dashboard-fleet-write-handler.d.ts +60 -0
- package/dist/ws/fleet-runs-on-all.d.ts +16 -0
- package/dist/ws/platform-client.d.ts +13 -1
- package/dist/ws/test-relay-handlers.d.ts +4 -2
- package/installer-image-digests.json +3 -3
- package/package.json +4 -4
- package/sbom.spdx.json +50 -50
|
@@ -33,7 +33,7 @@ import type { HostRosterStore } from '../agent/host-roster.js';
|
|
|
33
33
|
import type { RunCoordinator } from '../cluster/coordinator.js';
|
|
34
34
|
import type { TeamMembershipLookup } from '../approvals/team-membership-lookup.js';
|
|
35
35
|
import type { LogStorage } from '../reporting/log-storage.js';
|
|
36
|
-
import type {
|
|
36
|
+
import type { SecretResolverApi } from '../secrets/secret-resolver.js';
|
|
37
37
|
import type { ContributorCache } from '../security/contributor-cache.js';
|
|
38
38
|
import type { AccessLogWriter } from '../audit/access-log.js';
|
|
39
39
|
import type { LockFile as FullLockFile, LockWorkflow, SimulatedEvent, WebhookNormalizer } from '@kici-dev/engine';
|
|
@@ -281,7 +281,7 @@ export interface ProcessingDeps {
|
|
|
281
281
|
/** Run coordinator for multi-orchestrator job routing. Optional -- if not set, all jobs dispatch locally (single-orchestrator mode). */
|
|
282
282
|
coordinator?: RunCoordinator;
|
|
283
283
|
/** Secret resolver for dispatch-time secret resolution. Optional -- if not set, secrets are not resolved. */
|
|
284
|
-
secretResolver?:
|
|
284
|
+
secretResolver?: SecretResolverApi;
|
|
285
285
|
/** Optional callback when source locations are extracted from a lock file workflow. */
|
|
286
286
|
onSourceLocationsExtracted?: (workflowName: string, jobName: string, sourceLocations: Array<{
|
|
287
287
|
file: string;
|
|
@@ -1,36 +1,28 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Test
|
|
2
|
+
* Test-trigger adapter for CLI-initiated runs (`kici run`).
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
4
|
+
* Resolves the lock file, matched decisions, and fixture-specific concerns
|
|
5
|
+
* (inline-vs-provider lock, decision selection, fixture-payload storage, the
|
|
6
|
+
* `allow_local_execution` environment gate, CLI-secret overlay, in-memory
|
|
7
|
+
* test-run marking), then dispatches each matched workflow through the SAME
|
|
8
|
+
* shared core as webhooks (`dispatchMatchedWorkflow`). The test path is a thin
|
|
9
|
+
* adapter — needs-DAG scheduling, `expansionMap` fan-out edges, `runsOnAll`
|
|
10
|
+
* host fan-out, and deferred init/dynamic dispatch all come from the core.
|
|
8
11
|
*
|
|
9
|
-
*
|
|
10
|
-
* -
|
|
11
|
-
* -
|
|
12
|
-
*
|
|
13
|
-
* - deliveryId
|
|
14
|
-
* -
|
|
15
|
-
* -
|
|
12
|
+
* Differences from a webhook run:
|
|
13
|
+
* - the synthetic event is injected directly (no provider normalization/dedup);
|
|
14
|
+
* - the lock file may be inline (local repos have no remote provider, so
|
|
15
|
+
* `bundle` is undefined);
|
|
16
|
+
* - `deliveryId` carries a `test:` prefix;
|
|
17
|
+
* - the run is stamped `is_test_run = true` + `fixture_id` (via the core's
|
|
18
|
+
* `testRun` meta) and marked in-memory for live-log broadcast to the CLI;
|
|
19
|
+
* - CLI-uploaded local secrets win over orchestrator env secrets (the
|
|
20
|
+
* decorating secret resolver), and the fixture's `secrets` context mapping
|
|
21
|
+
* resolves into namespaced secrets;
|
|
22
|
+
* - direct workflow execution (bypass trigger matching) is supported.
|
|
16
23
|
*/
|
|
17
|
-
import type
|
|
18
|
-
import type {
|
|
19
|
-
import type { CheckRunReporter } from '../reporting/check-run-reporter.js';
|
|
20
|
-
import type { ExecutionTracker } from '../reporting/execution-tracker.js';
|
|
21
|
-
import type { AgentRegistry } from '../agent/registry.js';
|
|
22
|
-
import type { ProviderRegistry } from '../provider-registry.js';
|
|
23
|
-
import type { SourceCache } from '../cache/index.js';
|
|
24
|
-
import type { BuildCoordinator } from '../cache/index.js';
|
|
25
|
-
import type { DepCache } from '../cache/index.js';
|
|
26
|
-
import type { PendingBuildTracker } from '../cache/index.js';
|
|
27
|
-
import type { SecretResolver } from '../secrets/secret-resolver.js';
|
|
28
|
-
import type { EnvironmentStore } from '../environments/environment-store.js';
|
|
29
|
-
import type { VariableStore } from '../environments/variable-store.js';
|
|
30
|
-
import type { LogStorage } from '../reporting/log-storage.js';
|
|
31
|
-
import type { Kysely } from 'kysely';
|
|
32
|
-
import type { Database } from '../db/types.js';
|
|
33
|
-
import type { CheckMode } from '@kici-dev/engine';
|
|
24
|
+
import { type ProcessingDeps } from './processor.js';
|
|
25
|
+
import type { CheckMode, HostTargetSelector } from '@kici-dev/engine';
|
|
34
26
|
/**
|
|
35
27
|
* Input for a test trigger request.
|
|
36
28
|
*/
|
|
@@ -76,6 +68,11 @@ export interface TestTriggerInput {
|
|
|
76
68
|
* Omitted means `apply`.
|
|
77
69
|
*/
|
|
78
70
|
checkMode?: CheckMode;
|
|
71
|
+
/**
|
|
72
|
+
* Runtime host narrowing from `kici run --target`. Threaded onto the dispatch
|
|
73
|
+
* context, where it post-filters each runsOnAll job's matched roster.
|
|
74
|
+
*/
|
|
75
|
+
target?: HostTargetSelector;
|
|
79
76
|
}
|
|
80
77
|
/**
|
|
81
78
|
* Result of processing a test trigger.
|
|
@@ -91,37 +88,12 @@ interface TestTriggerResult {
|
|
|
91
88
|
jobIds: string[];
|
|
92
89
|
}
|
|
93
90
|
/**
|
|
94
|
-
*
|
|
95
|
-
* All injected for testability.
|
|
96
|
-
*/
|
|
97
|
-
export interface TestPipelineDeps {
|
|
98
|
-
lockFileCache: LockFileCache;
|
|
99
|
-
dispatcher: Dispatcher;
|
|
100
|
-
executionTracker?: ExecutionTracker;
|
|
101
|
-
checkRunReporter?: CheckRunReporter;
|
|
102
|
-
sourceCache?: SourceCache;
|
|
103
|
-
buildCoordinator?: BuildCoordinator;
|
|
104
|
-
depCache?: DepCache;
|
|
105
|
-
pendingBuilds?: PendingBuildTracker;
|
|
106
|
-
secretResolver?: SecretResolver;
|
|
107
|
-
agentRegistry: AgentRegistry;
|
|
108
|
-
providerRegistry: ProviderRegistry;
|
|
109
|
-
/** Log storage for persisting test fixture payloads. Optional -- if not set, payload storage is skipped. */
|
|
110
|
-
logStorage?: LogStorage;
|
|
111
|
-
/** Database connection for environment protection checks. Optional. */
|
|
112
|
-
db?: Kysely<Database>;
|
|
113
|
-
/** Environment store for resolving environment ids in test dispatch parity. Optional. */
|
|
114
|
-
environmentStore?: EnvironmentStore;
|
|
115
|
-
/** Variable store for resolving environment variables in test dispatch parity. Optional. */
|
|
116
|
-
variableStore?: VariableStore;
|
|
117
|
-
}
|
|
118
|
-
/**
|
|
119
|
-
* Process a test trigger through the existing pipeline.
|
|
91
|
+
* Process a test trigger through the shared dispatch core.
|
|
120
92
|
*
|
|
121
|
-
*
|
|
122
|
-
*
|
|
123
|
-
*
|
|
93
|
+
* Resolves the lock file + matched decisions + fixture concerns, then builds a
|
|
94
|
+
* `WorkflowDispatchContext` per matched workflow and calls
|
|
95
|
+
* `dispatchMatchedWorkflow` — the same core the webhook path uses.
|
|
124
96
|
*/
|
|
125
|
-
export declare function processTestTrigger(input: TestTriggerInput, deps:
|
|
97
|
+
export declare function processTestTrigger(input: TestTriggerInput, deps: ProcessingDeps): Promise<TestTriggerResult>;
|
|
126
98
|
export {};
|
|
127
99
|
//# sourceMappingURL=test-pipeline.d.ts.map
|
|
@@ -33,11 +33,21 @@ export interface GithubAppManifest {
|
|
|
33
33
|
default_permissions: Record<string, string>;
|
|
34
34
|
default_events: string[];
|
|
35
35
|
}
|
|
36
|
+
/**
|
|
37
|
+
* Validate a self-hosted webhook URL supplied via `source add github
|
|
38
|
+
* --webhook-url`. Must be a well-formed absolute `https://` URL. Returns the URL
|
|
39
|
+
* verbatim on success; throws a clear error otherwise. The validated URL is
|
|
40
|
+
* baked into `manifest.hook_attributes.url` as-is — KiCI adds no ingress and
|
|
41
|
+
* does not receive events at it; the operator owns delivery.
|
|
42
|
+
*/
|
|
43
|
+
export declare function validateWebhookUrl(value: string): string;
|
|
36
44
|
export declare function buildGithubAppManifest(input: GithubManifestInput): GithubAppManifest;
|
|
37
45
|
/** Credentials returned by GitHub's manifest-conversion endpoint. */
|
|
38
46
|
export interface GithubAppCredentials {
|
|
39
47
|
appId: string;
|
|
40
48
|
slug: string;
|
|
49
|
+
/** GitHub's display name for the App (the authoritative stored name). */
|
|
50
|
+
name: string;
|
|
41
51
|
privateKey: string;
|
|
42
52
|
webhookSecret: string;
|
|
43
53
|
clientId?: string;
|
|
@@ -52,6 +62,21 @@ export interface GithubAppCredentials {
|
|
|
52
62
|
export declare function convertManifestCode(code: string, deps?: {
|
|
53
63
|
octokit?: Pick<Octokit, 'request'>;
|
|
54
64
|
}): Promise<GithubAppCredentials>;
|
|
65
|
+
/**
|
|
66
|
+
* Ask GitHub who this App is (`GET /app`, authenticated as the App via its
|
|
67
|
+
* JWT) and return its authoritative display `name` + `slug`. This is the single
|
|
68
|
+
* "fetch the App's identity from GitHub" helper, reused at source creation, by
|
|
69
|
+
* the daily refresher, and by `kici-admin source refresh`.
|
|
70
|
+
*
|
|
71
|
+
* GitHub is the source of truth: a rename in the GitHub UI changes the value
|
|
72
|
+
* `GET /app` returns, which is what keeps the dashboard name fresh.
|
|
73
|
+
*/
|
|
74
|
+
export declare function fetchGithubAppIdentity(creds: Pick<GithubAppCredentials, 'appId' | 'privateKey'>, deps?: {
|
|
75
|
+
appOctokit?: Pick<Octokit, 'request'>;
|
|
76
|
+
}): Promise<{
|
|
77
|
+
name: string;
|
|
78
|
+
slug: string;
|
|
79
|
+
}>;
|
|
55
80
|
/**
|
|
56
81
|
* Poll GitHub (as the App, via a JWT) until at least one installation exists,
|
|
57
82
|
* returning the first installation's id + account login. Throws on timeout.
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
import { Hono } from 'hono';
|
|
12
12
|
import type { SourceStore } from '../sources/source-store.js';
|
|
13
13
|
import type { Role } from '../secrets/rbac.js';
|
|
14
|
+
import { type FetchGithubAppIdentity } from '../github-app-name-refresher/github-app-name-refresher.js';
|
|
14
15
|
interface SourceRouteDeps {
|
|
15
16
|
sourceStore: SourceStore;
|
|
16
17
|
/**
|
|
@@ -39,6 +40,12 @@ interface SourceRouteDeps {
|
|
|
39
40
|
webhookUrl: string | null;
|
|
40
41
|
webhookNote?: string;
|
|
41
42
|
}>;
|
|
43
|
+
/**
|
|
44
|
+
* Fetch a GitHub App's authoritative `{ name, slug }` from GitHub. Injectable
|
|
45
|
+
* for tests; defaults to the real `fetchGithubAppIdentity`. Used by the
|
|
46
|
+
* `source refresh` route.
|
|
47
|
+
*/
|
|
48
|
+
fetchAppIdentity?: FetchGithubAppIdentity;
|
|
42
49
|
}
|
|
43
50
|
type AdminSourcesEnv = {
|
|
44
51
|
Variables: {
|
|
@@ -62,6 +62,21 @@ export interface ResolvedSecretMeta {
|
|
|
62
62
|
backend: string;
|
|
63
63
|
scope: string;
|
|
64
64
|
}
|
|
65
|
+
/**
|
|
66
|
+
* The public secret-resolution surface consumed by the dispatch path and the
|
|
67
|
+
* universal-git provider. `SecretResolver` implements this; the test adapter's
|
|
68
|
+
* `DecoratingSecretResolver` (CLI-secret overlay) implements it too, so either
|
|
69
|
+
* can flow through `ProcessingDeps.secretResolver`.
|
|
70
|
+
*/
|
|
71
|
+
export interface SecretResolverApi {
|
|
72
|
+
resolveForJob(orgId: string, environmentName: string): Promise<Record<string, string>>;
|
|
73
|
+
resolveNamed(orgId: string, scope: string, key: string, opts?: {
|
|
74
|
+
store?: string;
|
|
75
|
+
runId?: string;
|
|
76
|
+
jobId?: string;
|
|
77
|
+
}): Promise<string | null>;
|
|
78
|
+
resolveForJobWithMeta(orgId: string, environmentName: string): Promise<Record<string, ResolvedSecretMeta>>;
|
|
79
|
+
}
|
|
65
80
|
/**
|
|
66
81
|
* Resolves secrets for a job by matching environment bindings against scoped secrets
|
|
67
82
|
* from multiple backends.
|
|
@@ -71,7 +86,7 @@ export interface ResolvedSecretMeta {
|
|
|
71
86
|
* are matched against binding patterns, and longest-path-wins uses the path AFTER
|
|
72
87
|
* stripping the backend prefix.
|
|
73
88
|
*/
|
|
74
|
-
export declare class SecretResolver {
|
|
89
|
+
export declare class SecretResolver implements SecretResolverApi {
|
|
75
90
|
private readonly environmentStore;
|
|
76
91
|
private readonly bindingStore;
|
|
77
92
|
private readonly backendStores;
|