@kici-dev/orchestrator 0.1.22 → 0.1.24
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 +39 -3
- package/dist/agent/token-store.d.ts +33 -0
- package/dist/app.d.ts +3 -0
- package/dist/cache/pending-inits.d.ts +3 -2
- package/dist/cli/api-client.d.ts +8 -0
- package/dist/cli/commands/attestations-reverify.d.ts +18 -0
- package/dist/cli/commands/attestations.d.ts +3 -0
- package/dist/cli/commands/shared/versioned-upgrade.d.ts +52 -0
- package/dist/cli.js +2284 -442
- package/dist/config.d.ts +2 -0
- package/dist/dashboard/attestation-filters.d.ts +70 -0
- package/dist/dashboard/handler.d.ts +33 -1
- package/dist/db/migrations/051_binding_host_pattern.d.ts +18 -0
- package/dist/db/migrations/052_host_reach_metadata.d.ts +19 -0
- package/dist/db/migrations/053_agent_token_single_use.d.ts +17 -0
- 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/types.d.ts +78 -0
- package/dist/environments/binding-store.d.ts +12 -3
- package/dist/environments/held-runs.d.ts +24 -0
- package/dist/environments/protection/aggregate.d.ts +43 -0
- package/dist/environments/protection/satisfiability.d.ts +64 -0
- package/dist/index.js +9 -0
- package/dist/metrics/prometheus.d.ts +2 -0
- package/dist/orchestrator-core.d.ts +8 -0
- package/dist/pipeline/dispatch-matched-workflow.d.ts +60 -3
- 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 +22 -0
- package/dist/pipeline/test-pipeline.d.ts +15 -0
- package/dist/provenance/trust-root.d.ts +24 -0
- package/dist/provenance/verify-at-ingest.d.ts +24 -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 +22 -2
- package/dist/reporting/log-writer.d.ts +19 -0
- package/dist/reporting/run-aggregator.d.ts +161 -0
- package/dist/reporting/step-log-reader.d.ts +39 -0
- package/dist/routes/admin-registrations.d.ts +8 -0
- package/dist/routes/admin-runs.d.ts +7 -0
- package/dist/scaler/manager.d.ts +17 -0
- package/dist/secrets/index.d.ts +1 -1
- package/dist/secrets/secret-resolver.d.ts +19 -6
- package/dist/server.js +21535 -19131
- package/dist/standalone.js +26544 -24580
- package/dist/storage/loopback-guard.d.ts +49 -0
- package/dist/ws/agent-handler.d.ts +15 -1
- package/dist/ws/bringup-api.d.ts +76 -0
- package/dist/ws/dashboard-fleet-handler.d.ts +11 -1
- package/dist/ws/fleet-runs-on-all.d.ts +3 -0
- package/dist/ws/platform-client.d.ts +39 -1
- package/dist/ws/test-relay-handlers.d.ts +9 -0
- package/installer-image-digests.json +3 -3
- package/package.json +6 -8
- package/sbom.spdx.json +57 -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
|
|
@@ -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/scaler/manager.d.ts
CHANGED
|
@@ -39,6 +39,23 @@ export interface ResolvedResources {
|
|
|
39
39
|
memBytes: number;
|
|
40
40
|
};
|
|
41
41
|
}
|
|
42
|
+
/**
|
|
43
|
+
* Build the scaler-usage metric rows: one per active scaler (stamped with its
|
|
44
|
+
* backend type) plus a `__global__` rollup row. Pure so it is unit-testable
|
|
45
|
+
* without constructing a full ScalerManager.
|
|
46
|
+
*/
|
|
47
|
+
export declare function buildScalerUsageRows(perScalerUsage: ReadonlyMap<string, {
|
|
48
|
+
cpus: number;
|
|
49
|
+
memBytes: number;
|
|
50
|
+
}>, globalUsage: {
|
|
51
|
+
cpus: number;
|
|
52
|
+
memBytes: number;
|
|
53
|
+
}, scalerTypeOf: (name: string) => string | undefined): Array<{
|
|
54
|
+
scaler: string;
|
|
55
|
+
scalerType?: string;
|
|
56
|
+
cpus: number;
|
|
57
|
+
memBytes: number;
|
|
58
|
+
}>;
|
|
42
59
|
/**
|
|
43
60
|
* Status summary for metrics and health endpoints.
|
|
44
61
|
*/
|
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';
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* longest-path-wins uses scope path after stripping backend prefix.
|
|
16
16
|
* audit log includes backend name.
|
|
17
17
|
*/
|
|
18
|
-
import { type EnvironmentBinding, type ScopedSecret } from '@kici-dev/engine';
|
|
18
|
+
import { type EnvironmentBinding, type HostFacts, type ScopedSecret } from '@kici-dev/engine';
|
|
19
19
|
import type { Logger } from '@kici-dev/shared';
|
|
20
20
|
import type { AuditLogger } from './audit-logger.js';
|
|
21
21
|
/**
|
|
@@ -69,13 +69,13 @@ export interface ResolvedSecretMeta {
|
|
|
69
69
|
* can flow through `ProcessingDeps.secretResolver`.
|
|
70
70
|
*/
|
|
71
71
|
export interface SecretResolverApi {
|
|
72
|
-
resolveForJob(orgId: string, environmentName: string): Promise<Record<string, string>>;
|
|
72
|
+
resolveForJob(orgId: string, environmentName: string, hostCtx?: HostFacts): Promise<Record<string, string>>;
|
|
73
73
|
resolveNamed(orgId: string, scope: string, key: string, opts?: {
|
|
74
74
|
store?: string;
|
|
75
75
|
runId?: string;
|
|
76
76
|
jobId?: string;
|
|
77
77
|
}): Promise<string | null>;
|
|
78
|
-
resolveForJobWithMeta(orgId: string, environmentName: string): Promise<Record<string, ResolvedSecretMeta>>;
|
|
78
|
+
resolveForJobWithMeta(orgId: string, environmentName: string, hostCtx?: HostFacts): Promise<Record<string, ResolvedSecretMeta>>;
|
|
79
79
|
}
|
|
80
80
|
/**
|
|
81
81
|
* Resolves secrets for a job by matching environment bindings against scoped secrets
|
|
@@ -98,9 +98,13 @@ export declare class SecretResolver implements SecretResolverApi {
|
|
|
98
98
|
*
|
|
99
99
|
* @param orgId - Organization ID
|
|
100
100
|
* @param environmentName - Environment name to resolve secrets for
|
|
101
|
+
* @param hostCtx - Optional fan-out child identity for per-host resolution.
|
|
102
|
+
* When supplied, each binding is gated by its `host_pattern` and its
|
|
103
|
+
* `scope_pattern` is templated per-child; when omitted, only fleet-wide
|
|
104
|
+
* (`'**'`) non-templated bindings contribute.
|
|
101
105
|
* @returns Flat map of decrypted secret key-value pairs
|
|
102
106
|
*/
|
|
103
|
-
resolveForJob(orgId: string, environmentName: string): Promise<Record<string, string>>;
|
|
107
|
+
resolveForJob(orgId: string, environmentName: string, hostCtx?: HostFacts): Promise<Record<string, string>>;
|
|
104
108
|
/**
|
|
105
109
|
* Resolve a single named secret by (orgId, scope, key), optionally scoped to
|
|
106
110
|
* a specific backend. Bypasses environment bindings — this is a direct
|
|
@@ -126,7 +130,7 @@ export declare class SecretResolver implements SecretResolverApi {
|
|
|
126
130
|
*
|
|
127
131
|
* Returns the secret value along with which backend and scope provided it.
|
|
128
132
|
*/
|
|
129
|
-
resolveForJobWithMeta(orgId: string, environmentName: string): Promise<Record<string, ResolvedSecretMeta>>;
|
|
133
|
+
resolveForJobWithMeta(orgId: string, environmentName: string, hostCtx?: HostFacts): Promise<Record<string, ResolvedSecretMeta>>;
|
|
130
134
|
/**
|
|
131
135
|
* Collect all secrets from all backend stores, prefixing scopes.
|
|
132
136
|
* Per /: unreachable backends are tracked but not fatal here.
|
|
@@ -145,8 +149,17 @@ export declare class SecretResolver implements SecretResolverApi {
|
|
|
145
149
|
*/
|
|
146
150
|
private checkScopedFailure;
|
|
147
151
|
/**
|
|
148
|
-
* Find the winning secret for a given key
|
|
152
|
+
* Find the winning secret for a given key, mirroring the engine scope
|
|
153
|
+
* resolver's host-aware matching and `(host specificity, scope depth)`
|
|
154
|
+
* precedence so the enriched metadata reports the same secret the flat
|
|
155
|
+
* resolution selected.
|
|
149
156
|
*/
|
|
150
157
|
private findWinningSecret;
|
|
158
|
+
/**
|
|
159
|
+
* Resolve the effective scope pattern a binding contributes for a host,
|
|
160
|
+
* applying the host gate and per-child scope templating. Mirrors the engine
|
|
161
|
+
* scope resolver's `bindingScopeForHost`. Returns `null` to skip the binding.
|
|
162
|
+
*/
|
|
163
|
+
private bindingScopeForHost;
|
|
151
164
|
}
|
|
152
165
|
//# sourceMappingURL=secret-resolver.d.ts.map
|