@kici-dev/orchestrator 0.1.23 → 0.1.25
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/token-store.d.ts +4 -0
- package/dist/app.d.ts +27 -0
- package/dist/audit/access-log.d.ts +4 -0
- package/dist/cache/pending-inits.d.ts +3 -2
- package/dist/cancel/cancel-run.d.ts +2 -0
- package/dist/cli/api-client.d.ts +10 -0
- package/dist/cli/commands/attestations-list.d.ts +49 -0
- package/dist/cli/commands/attestations-retry.d.ts +28 -0
- package/dist/cli/commands/attestations-reverify.d.ts +18 -0
- package/dist/cli/commands/attestations.d.ts +4 -0
- package/dist/cli/commands/cluster.d.ts +3 -0
- package/dist/cli/commands/shared/versioned-upgrade.d.ts +52 -0
- package/dist/cli/local-github-ingress-url.d.ts +8 -0
- package/dist/cli.js +3308 -1011
- package/dist/cluster/cluster-identity.d.ts +11 -0
- package/dist/cluster/reconcile-identity.d.ts +50 -0
- package/dist/cold-store/load-access-log-range.d.ts +4 -0
- package/dist/config.d.ts +4 -0
- package/dist/dashboard/attestation-filters.d.ts +131 -0
- package/dist/dashboard/handler.d.ts +56 -4
- package/dist/db/migrations/054_local_working_tree.d.ts +15 -0
- package/dist/db/migrations/055_agent_token_mandatory_labels.d.ts +18 -0
- package/dist/db/migrations/056_execution_jobs_environments.d.ts +17 -0
- package/dist/db/migrations/057_step_concurrency.d.ts +4 -0
- package/dist/db/migrations/058_access_log_agent_label.d.ts +4 -0
- package/dist/db/migrations/059_attestation_verdict.d.ts +4 -0
- package/dist/db/migrations/060_run_trigger_actor.d.ts +4 -0
- package/dist/db/migrations/061_execution_runs_environment_id.d.ts +4 -0
- package/dist/db/migrations/062_execution_runs_agent_label.d.ts +4 -0
- package/dist/db/migrations/063_access_log_agent_label_index.d.ts +10 -0
- package/dist/db/migrations/064_execution_jobs_skipped_environments.d.ts +17 -0
- package/dist/db/migrations/065_pending_attestations.d.ts +22 -0
- package/dist/db/migrations/066_pending_attestations_rejected.d.ts +13 -0
- package/dist/db/types.d.ts +113 -0
- package/dist/environments/protection/aggregate.d.ts +43 -0
- package/dist/environments/protection/satisfiability.d.ts +69 -0
- package/dist/events/circuit-breaker.d.ts +8 -5
- package/dist/events/event-router.d.ts +12 -4
- package/dist/events/event-store.d.ts +21 -3
- package/dist/events/trust-store.d.ts +6 -1
- package/dist/events/types.d.ts +6 -1
- package/dist/helpers/rate-limiter.d.ts +17 -2
- package/dist/index.js +11 -1
- package/dist/metrics/prometheus.d.ts +6 -0
- package/dist/orchestrator-core.d.ts +8 -0
- package/dist/pipeline/dispatch-matched-workflow.d.ts +8 -0
- package/dist/pipeline/flatten-lock-steps.d.ts +11 -0
- package/dist/pipeline/inline-eval.d.ts +2 -1
- package/dist/pipeline/job-environments.d.ts +71 -0
- package/dist/pipeline/manual-schedule.d.ts +23 -1
- package/dist/pipeline/process-webhook.d.ts +14 -1
- package/dist/pipeline/rerun.d.ts +1 -1
- package/dist/pipeline/test-pipeline.d.ts +15 -0
- package/dist/provenance/attestation-retrier.d.ts +92 -0
- package/dist/provenance/backfill-run.d.ts +41 -0
- package/dist/provenance/pending-attestations-repo.d.ts +64 -0
- package/dist/provenance/trust-root.d.ts +24 -0
- package/dist/provenance/verify-at-ingest.d.ts +31 -0
- package/dist/reporting/agent-failure-category.d.ts +27 -0
- package/dist/reporting/agent-run-result-mapper.d.ts +13 -0
- package/dist/reporting/execution-tracker.d.ts +38 -6
- package/dist/reporting/run-aggregator.d.ts +165 -0
- package/dist/reporting/step-log-reader.d.ts +39 -0
- package/dist/routes/admin-access-log.d.ts +2 -1
- package/dist/routes/admin-registrations.d.ts +8 -0
- package/dist/routes/admin-runs.d.ts +7 -0
- package/dist/routes/admin.d.ts +14 -0
- package/dist/routes/github-webhook.d.ts +37 -0
- package/dist/routes/health.d.ts +9 -0
- package/dist/routes/webhooks.d.ts +2 -4
- package/dist/secrets/index.d.ts +1 -1
- package/dist/server.js +5326 -2100
- package/dist/sources/source-store.d.ts +6 -0
- package/dist/stale-detector/workflow-deadline-detector.d.ts +25 -0
- package/dist/standalone.js +19787 -17304
- package/dist/storage/loopback-guard.d.ts +49 -0
- package/dist/webhook/dedup.d.ts +14 -0
- package/dist/ws/agent-handler.d.ts +38 -1
- package/dist/ws/oidc-token-relay.d.ts +31 -21
- package/dist/ws/orch-rpc.d.ts +9 -0
- package/dist/ws/platform-client.d.ts +53 -1
- package/dist/ws/test-relay-handlers.d.ts +2 -0
- package/installer-image-digests.json +3 -3
- package/package.json +6 -8
- package/sbom.spdx.json +62 -57
- package/dist/secrets/crypto.d.ts +0 -49
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared step-log reader for the agent-facing step-logs endpoint.
|
|
3
|
+
*
|
|
4
|
+
* Resolves a step's stored log file via the same `execution_steps.log_path` +
|
|
5
|
+
* `LogStorage` access the dashboard step.logs path uses, then returns the lines
|
|
6
|
+
* with line-based cursor pagination. `toAgentStepLogs` wraps every line in an
|
|
7
|
+
* untrusted envelope (log content is process/user output — never trusted).
|
|
8
|
+
*/
|
|
9
|
+
import type { Kysely } from 'kysely';
|
|
10
|
+
import { type AgentStepLogs } from '@kici-dev/engine';
|
|
11
|
+
import type { Database } from '../db/types.js';
|
|
12
|
+
import type { LogStorage } from './log-storage.js';
|
|
13
|
+
export interface StepLogReaderDeps {
|
|
14
|
+
db: Kysely<Database>;
|
|
15
|
+
logStorage: LogStorage;
|
|
16
|
+
}
|
|
17
|
+
export interface RawStepLogs {
|
|
18
|
+
lines: string[];
|
|
19
|
+
totalLines: number;
|
|
20
|
+
nextCursor: string | null;
|
|
21
|
+
}
|
|
22
|
+
export interface ReadStepLogArgs {
|
|
23
|
+
runId: string;
|
|
24
|
+
jobId: string;
|
|
25
|
+
stepIndex: number;
|
|
26
|
+
/** Stringified line offset to start from (0-based). Default 0. */
|
|
27
|
+
cursor?: string;
|
|
28
|
+
/** Max number of lines to return. Default 500, hard cap applied by caller. */
|
|
29
|
+
limit?: number;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Read a page of a step's log lines. Returns an empty page (not an error) when
|
|
33
|
+
* the step row or its log file is absent, so a never-emitted-logs step reads as
|
|
34
|
+
* `{ lines: [], totalLines: 0, nextCursor: null }`.
|
|
35
|
+
*/
|
|
36
|
+
export declare function readStepLogLines(deps: StepLogReaderDeps, args: ReadStepLogArgs): Promise<RawStepLogs>;
|
|
37
|
+
/** Wrap raw step logs into the untrusted-tagged `AgentStepLogs` shape. */
|
|
38
|
+
export declare function toAgentStepLogs(runId: string, jobId: string, stepIndex: number, raw: RawStepLogs): AgentStepLogs;
|
|
39
|
+
//# sourceMappingURL=step-log-reader.d.ts.map
|
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
*
|
|
9
9
|
* GET /api/v1/admin/access-log
|
|
10
10
|
* Filters: orgId, actorType, actorId, action, source, outcome,
|
|
11
|
-
* targetType, targetId, from, to,
|
|
11
|
+
* targetType, targetId, from, to, q, agentLabel, agentOnly,
|
|
12
|
+
* limit, cursor
|
|
12
13
|
* Requires: access_log.read
|
|
13
14
|
*
|
|
14
15
|
* GET /api/v1/admin/access-log/:id
|
|
@@ -10,6 +10,7 @@ import type { RegistrationStore } from '../registration/registration-store.js';
|
|
|
10
10
|
import type { RegistrationIndex } from '../registration/registration-index.js';
|
|
11
11
|
import type { TokenManager } from '../secrets/token-manager.js';
|
|
12
12
|
import type { RbacEnforcer, Role } from '../secrets/rbac.js';
|
|
13
|
+
import type { EnvironmentStore } from '../environments/environment-store.js';
|
|
13
14
|
/**
|
|
14
15
|
* Dependencies for admin registration routes.
|
|
15
16
|
*/
|
|
@@ -18,6 +19,13 @@ export interface AdminRegistrationRoutesDeps {
|
|
|
18
19
|
registrationIndex: RegistrationIndex;
|
|
19
20
|
tokenManager: TokenManager;
|
|
20
21
|
rbac: RbacEnforcer;
|
|
22
|
+
/**
|
|
23
|
+
* Resolves a bound environment by name for registration-time satisfiability.
|
|
24
|
+
* When present, a manual registration is rejected up front if a job binds a
|
|
25
|
+
* provably-unsatisfiable environment list (missing/disabled env, or
|
|
26
|
+
* mutually-exclusive fixed branch/trigger/repo restrictions).
|
|
27
|
+
*/
|
|
28
|
+
environmentStore?: Pick<EnvironmentStore, 'matchEnvironment'>;
|
|
21
29
|
}
|
|
22
30
|
/** Hono env type for admin registration routes with context variables. */
|
|
23
31
|
type AdminRegEnv = {
|
|
@@ -24,6 +24,7 @@ import type { Database } from '../db/types.js';
|
|
|
24
24
|
import type { TokenManager } from '../secrets/token-manager.js';
|
|
25
25
|
import type { RbacEnforcer, Role } from '../secrets/rbac.js';
|
|
26
26
|
import type { AuditLogger } from '../secrets/audit-logger.js';
|
|
27
|
+
import type { LogStorage } from '../reporting/log-storage.js';
|
|
27
28
|
/**
|
|
28
29
|
* Dependencies for admin run routes.
|
|
29
30
|
*/
|
|
@@ -38,6 +39,12 @@ export interface AdminRunRoutesDeps {
|
|
|
38
39
|
* secret-output plaintext. Derived once per request via deriveKey().
|
|
39
40
|
*/
|
|
40
41
|
masterSecretKey?: string;
|
|
42
|
+
/**
|
|
43
|
+
* Log storage backend. Required only by the agent step-logs endpoint
|
|
44
|
+
* (`/runs/:runId/jobs/:jobId/steps/:stepIndex/logs`); when absent, that
|
|
45
|
+
* path 503s cleanly.
|
|
46
|
+
*/
|
|
47
|
+
logStorage?: LogStorage;
|
|
41
48
|
}
|
|
42
49
|
/** Hono env type for admin run routes with context variables. */
|
|
43
50
|
type AdminRunEnv = {
|
package/dist/routes/admin.d.ts
CHANGED
|
@@ -113,6 +113,20 @@ export interface AdminRouteDeps {
|
|
|
113
113
|
* write is best-effort, never gating.
|
|
114
114
|
*/
|
|
115
115
|
accessLog?: AccessLogWriter;
|
|
116
|
+
/**
|
|
117
|
+
* Optional -- fulfil deferred attestations on demand (mints in the running
|
|
118
|
+
* orchestrator process, which owns the Platform WS). Backs
|
|
119
|
+
* `POST /api/v1/admin/attestations/retry` (the `kici-admin attestations retry`
|
|
120
|
+
* command). Unset on a WS-only / non-coordinator admin.
|
|
121
|
+
*/
|
|
122
|
+
retryAttestations?: (opts: {
|
|
123
|
+
runId?: string;
|
|
124
|
+
includeRejected?: boolean;
|
|
125
|
+
}) => Promise<{
|
|
126
|
+
minted: number;
|
|
127
|
+
stillPending: number;
|
|
128
|
+
rejected: number;
|
|
129
|
+
}>;
|
|
116
130
|
}
|
|
117
131
|
/** Hono env type for admin routes with context variables. */
|
|
118
132
|
type AdminEnv = {
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Hono } from 'hono';
|
|
2
|
+
import type { WebhookInfo } from '../webhook/handler.js';
|
|
3
|
+
import type { SourceStore } from '../sources/source-store.js';
|
|
4
|
+
import { type VerifyInboundDeps } from '../webhook/verify-inbound.js';
|
|
5
|
+
import { WebhookIngestOutcome } from '../pipeline/process-webhook.js';
|
|
6
|
+
/** Dependencies for the direct GitHub webhook ingress route. */
|
|
7
|
+
export interface GithubWebhookRoutesDeps {
|
|
8
|
+
/** Local source lookup (by UUID). */
|
|
9
|
+
sourceStore: SourceStore;
|
|
10
|
+
/** Inbound verification deps (db + secret store + generic source manager). */
|
|
11
|
+
verifyDeps: VerifyInboundDeps;
|
|
12
|
+
/** Pipeline entry — owns the atomic dedup claim + dispatch. */
|
|
13
|
+
onWebhook: (info: WebhookInfo) => Promise<WebhookIngestOutcome>;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Whether the orchestrator serves the direct GitHub ingress route for a given
|
|
17
|
+
* operating mode. Hybrid + independent run local source config; platform mode
|
|
18
|
+
* is relay-only (no local GitHub source to serve).
|
|
19
|
+
*/
|
|
20
|
+
export declare function shouldServeGithubIngress(mode: 'platform' | 'hybrid' | 'independent'): boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Direct GitHub-App webhook ingress: `POST /webhook/:orgId/github/:sourceId`.
|
|
23
|
+
*
|
|
24
|
+
* Bypasses the Platform relay. Handles both operator topologies on one route:
|
|
25
|
+
* - App-level repoint: the App's single webhook URL points here, so GitHub
|
|
26
|
+
* sends `X-GitHub-Hook-Installation-Target-Type: integration` +
|
|
27
|
+
* `-Target-ID: <appId>` — validated against the source's routing key.
|
|
28
|
+
* - Classic per-repo webhook: a repo-level hook points here with no App
|
|
29
|
+
* target headers — `:sourceId` already identifies the source, so the
|
|
30
|
+
* App-header check is skipped.
|
|
31
|
+
*
|
|
32
|
+
* Verification is the existing local `verify-inbound.ts` GitHub path (secret
|
|
33
|
+
* read from the orchestrator secret store; rotation-aware). Dedup + dispatch
|
|
34
|
+
* are the universal `processWebhook` pipeline via `onWebhook`.
|
|
35
|
+
*/
|
|
36
|
+
export declare function createGithubWebhookRoutes(deps: GithubWebhookRoutesDeps): Hono;
|
|
37
|
+
//# sourceMappingURL=github-webhook.d.ts.map
|
package/dist/routes/health.d.ts
CHANGED
|
@@ -3,6 +3,15 @@ import type { Database } from '../db/types.js';
|
|
|
3
3
|
export interface HealthRoutesDeps {
|
|
4
4
|
/** Optional DB instance for readiness checks */
|
|
5
5
|
db?: Kysely<Database>;
|
|
6
|
+
/**
|
|
7
|
+
* Optional warmth latch. Returns `true` only once the orchestrator boot
|
|
8
|
+
* sequence has finished (all subsystems started, HTTP server serving). When
|
|
9
|
+
* provided, `/ready` returns `503` until it flips `true`, so a caller can
|
|
10
|
+
* gate on the orchestrator being ready to serve rather than merely live.
|
|
11
|
+
* Absent → warm defaults to `true` (callers that don't wire the latch are
|
|
12
|
+
* unaffected).
|
|
13
|
+
*/
|
|
14
|
+
isWarm?: () => boolean;
|
|
6
15
|
}
|
|
7
16
|
/**
|
|
8
17
|
* Create orchestrator health routes with database readiness check.
|
|
@@ -1,17 +1,15 @@
|
|
|
1
1
|
import { Hono } from 'hono';
|
|
2
|
-
import type { DedupCache } from '../webhook/dedup.js';
|
|
3
2
|
import type { WebhookInfo } from '../webhook/handler.js';
|
|
4
3
|
import type { GenericSourceManager } from '../webhook/generic-sources.js';
|
|
4
|
+
import { WebhookIngestOutcome } from '../pipeline/process-webhook.js';
|
|
5
5
|
/**
|
|
6
6
|
* Dependencies for generic webhook routes.
|
|
7
7
|
*/
|
|
8
8
|
export interface GenericWebhookRoutesDeps {
|
|
9
9
|
/** Generic source manager for source lookup and validation */
|
|
10
10
|
sourceManager: GenericSourceManager;
|
|
11
|
-
/** Delivery ID deduplication cache */
|
|
12
|
-
dedup: DedupCache;
|
|
13
11
|
/** Processing callback -- connects to the trigger matching pipeline */
|
|
14
|
-
onWebhook: (info: WebhookInfo) => Promise<
|
|
12
|
+
onWebhook: (info: WebhookInfo) => Promise<WebhookIngestOutcome>;
|
|
15
13
|
}
|
|
16
14
|
/**
|
|
17
15
|
* Create generic webhook routes for non-GitHub webhook ingestion.
|
package/dist/secrets/index.d.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
export { PgSecretStore } from './pg-secret-store.js';
|
|
8
8
|
export { AuditLogger } from './audit-logger.js';
|
|
9
9
|
export { loadMasterKey, loadOldMasterKey, loadSecretStoreConfig, type SecretStoreConfig, } from './config.js';
|
|
10
|
-
export { encrypt, decrypt, deriveKey, generateMasterKey, type EncryptedValue } from '
|
|
10
|
+
export { encrypt, decrypt, deriveKey, generateMasterKey, type EncryptedValue, } from '@kici-dev/shared';
|
|
11
11
|
export { VaultSecretStore, type VaultConfig } from './vault-secret-store.js';
|
|
12
12
|
export { SecretResolver, type SecretResolverDeps, type ResolvedSecretMeta, type EnvironmentStoreLike, type BindingStoreLike, type SecretStoreLike, } from './secret-resolver.js';
|
|
13
13
|
export { BackendSyncManager } from './backend-sync.js';
|