@kici-dev/engine 0.1.26 → 0.2.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/approval/types.d.ts +11 -4
- package/dist/approval/types.js +11 -4
- package/dist/artifacts/name.d.ts +60 -0
- package/dist/artifacts/name.js +71 -0
- package/dist/audit/access-log-policy.d.ts +1 -1
- package/dist/audit/access-log-policy.js +20 -11
- package/dist/audit/activity.d.ts +12 -12
- package/dist/audit/retention-policy.js +40 -22
- package/dist/billing/plan-type.d.ts +53 -0
- package/dist/billing/plan-type.js +70 -0
- package/dist/bundler/rolldown-config.d.ts +3 -3
- package/dist/check-mode.d.ts +1 -1
- package/dist/context/concurrency-strategy.d.ts +34 -0
- package/dist/context/concurrency-strategy.js +35 -0
- package/dist/context/held-run-job-id.d.ts +45 -0
- package/dist/context/held-run-job-id.js +56 -0
- package/dist/context/held-run-status.d.ts +33 -0
- package/dist/context/held-run-status.js +37 -0
- package/dist/context/hold-expiry.d.ts +20 -0
- package/dist/context/hold-expiry.js +25 -0
- package/dist/context/hold-reason.d.ts +33 -0
- package/dist/context/hold-reason.js +23 -0
- package/dist/context/hold-type.d.ts +40 -0
- package/dist/context/hold-type.js +61 -0
- package/dist/{environment → context}/host-match.js +1 -1
- package/dist/context/index.d.ts +14 -0
- package/dist/context/index.js +12 -0
- package/dist/context/multi-context.d.ts +30 -0
- package/dist/context/multi-context.js +38 -0
- package/dist/context/scope-name.d.ts +29 -0
- package/dist/context/scope-name.js +49 -0
- package/dist/context/scope-resolver.d.ts +79 -0
- package/dist/{environment → context}/scope-resolver.js +47 -17
- package/dist/{environment → context}/scope-template.js +1 -1
- package/dist/{environment → context}/types.d.ts +25 -22
- package/dist/{environment → context}/types.js +3 -3
- package/dist/dev-ops/operations.d.ts +9 -1
- package/dist/dev-ops/operations.js +37 -20
- package/dist/diagnostics/infra-alert.d.ts +71 -0
- package/dist/diagnostics/infra-alert.js +60 -0
- package/dist/env/environment-allowlist.d.ts +26 -3
- package/dist/env/environment-allowlist.js +35 -1
- package/dist/fanout/materialize.d.ts +16 -0
- package/dist/fanout/materialize.js +34 -5
- package/dist/index.d.ts +16 -7
- package/dist/index.js +38 -23
- package/dist/inputs/descriptor.d.ts +9 -9
- package/dist/inventory.d.ts +4 -4
- package/dist/labels.d.ts +82 -2
- package/dist/labels.js +119 -1
- package/dist/matrix/expand.d.ts +49 -2
- package/dist/matrix/expand.js +102 -13
- package/dist/matrix/format.d.ts +6 -1
- package/dist/matrix/format.js +6 -1
- package/dist/mcp/held-run-resolve.d.ts +7 -10
- package/dist/mcp/held-run-resolve.js +33 -7
- package/dist/metrics/catalog-policy.js +4 -4
- package/dist/metrics/metric-catalog.generated.d.ts +954 -734
- package/dist/metrics/metric-catalog.generated.js +296 -32
- package/dist/metrics/metric-kind-compat.d.ts +26 -0
- package/dist/metrics/metric-kind-compat.js +33 -0
- package/dist/protocol/analytics-events.d.ts +6 -6
- package/dist/protocol/dashboard-api-errors.d.ts +13 -0
- package/dist/protocol/dashboard-api-errors.js +17 -0
- package/dist/protocol/dashboard-write-operations.d.ts +143 -86
- package/dist/protocol/dashboard-write-operations.js +143 -69
- package/dist/protocol/messages/access-log.d.ts +438 -388
- package/dist/protocol/messages/access-log.js +24 -14
- package/dist/protocol/messages/actor.d.ts +2 -2
- package/dist/protocol/messages/agent-dev-ops.d.ts +4 -2
- package/dist/protocol/messages/agent-dev-ops.js +2 -5
- package/dist/protocol/messages/agent-run-result.d.ts +74 -64
- package/dist/protocol/messages/agent-run-result.js +1 -1
- package/dist/protocol/messages/auth.d.ts +35 -23
- package/dist/protocol/messages/browser.d.ts +81 -5
- package/dist/protocol/messages/browser.js +53 -2
- package/dist/protocol/messages/capabilities.d.ts +106 -31
- package/dist/protocol/messages/capabilities.js +94 -10
- package/dist/protocol/messages/common.d.ts +45 -2
- package/dist/protocol/messages/common.js +64 -3
- package/dist/protocol/messages/dashboard-sealed-write.d.ts +52 -0
- package/dist/protocol/messages/dashboard-sealed-write.js +57 -0
- package/dist/protocol/messages/dashboard.d.ts +1232 -706
- package/dist/protocol/messages/dashboard.js +387 -220
- package/dist/protocol/messages/deployment-identity.d.ts +37 -10
- package/dist/protocol/messages/deployment-identity.js +30 -3
- package/dist/protocol/messages/event-log.d.ts +5 -5
- package/dist/protocol/messages/execution-status.d.ts +198 -62
- package/dist/protocol/messages/execution-status.js +114 -46
- package/dist/protocol/messages/heartbeat-health.d.ts +83 -0
- package/dist/protocol/messages/heartbeat-health.js +87 -0
- package/dist/protocol/messages/log-stream.d.ts +18 -0
- package/dist/protocol/messages/log-stream.js +19 -0
- package/dist/protocol/messages/oidc-mint.d.ts +7 -0
- package/dist/protocol/messages/oidc-mint.js +7 -0
- package/dist/protocol/messages/orchestrator-agent.d.ts +264 -67
- package/dist/protocol/messages/orchestrator-agent.js +170 -5
- package/dist/protocol/messages/pat-kind.d.ts +1 -1
- package/dist/protocol/messages/peer.d.ts +122 -58
- package/dist/protocol/messages/peer.js +37 -2
- package/dist/protocol/messages/platform-orchestrator.d.ts +603 -258
- package/dist/protocol/messages/platform-orchestrator.js +131 -21
- package/dist/protocol/messages/run-events.d.ts +5 -5
- package/dist/protocol/messages/scaler-event.d.ts +3 -3
- package/dist/protocol/messages/source-registration.d.ts +56 -13
- package/dist/protocol/messages/source-registration.js +49 -6
- package/dist/protocol/session-policy.d.ts +20 -0
- package/dist/protocol/session-policy.js +25 -0
- package/dist/protocol/source-origin.d.ts +1 -1
- package/dist/provenance/attestation-origin.d.ts +1 -1
- package/dist/provenance/schema.d.ts +11 -11
- package/dist/provenance/verify.js +2 -1
- package/dist/provider/changed-files-fetcher.d.ts +21 -2
- package/dist/provider/check-run-conclusion.d.ts +2 -2
- package/dist/provider/check-status-poster.d.ts +23 -0
- package/dist/provider/index.d.ts +2 -2
- package/dist/registration/registerable-trigger-type.d.ts +14 -13
- package/dist/registration/registerable-trigger-type.js +1 -0
- package/dist/sandbox/capabilities.d.ts +6 -0
- package/dist/sandbox/capabilities.js +57 -0
- package/dist/scaler/scaler-backend-type.d.ts +1 -1
- package/dist/status/presentation.d.ts +89 -0
- package/dist/status/presentation.js +163 -0
- package/dist/trigger/compiled-matchers.d.ts +13 -0
- package/dist/trigger/compiled-matchers.js +44 -0
- package/dist/trigger/event-buckets.d.ts +44 -0
- package/dist/trigger/event-buckets.js +93 -0
- package/dist/trigger/matcher.d.ts +7 -3
- package/dist/trigger/matcher.js +53 -15
- package/dist/trigger/schedule-key.d.ts +14 -0
- package/dist/trigger/schedule-key.js +21 -0
- package/dist/trigger/trigger-event-type.d.ts +1 -1
- package/dist/trigger/trigger-event-type.js +2 -0
- package/dist/trigger/types.d.ts +178 -47
- package/dist/trigger/types.js +82 -24
- package/dist/webhook/event-types.d.ts +56 -0
- package/dist/webhook/event-types.js +59 -0
- package/dist/ws/ws-like.d.ts +13 -0
- package/package.json +26 -10
- package/sbom.spdx.json +10 -10
- package/dist/environment/index.d.ts +0 -6
- package/dist/environment/index.js +0 -5
- package/dist/environment/multi-env.d.ts +0 -30
- package/dist/environment/multi-env.js +0 -38
- package/dist/environment/scope-resolver.d.ts +0 -46
- package/dist/package-manager.d.ts +0 -20
- package/dist/protocol/messages/observe.d.ts +0 -76
- package/dist/protocol/messages/saas-orchestrator.d.ts +0 -2179
- package/dist/protocol/messages/test-run.d.ts +0 -59
- package/dist/state-machine/index.d.ts +0 -2
- package/dist/state-machine/index.js +0 -3
- package/dist/state-machine/machine.d.ts +0 -34
- package/dist/state-machine/machine.js +0 -103
- package/dist/state-machine/types.d.ts +0 -34
- package/dist/state-machine/types.js +0 -15
- /package/dist/{environment → context}/host-match.d.ts +0 -0
- /package/dist/{environment → context}/scope-template.d.ts +0 -0
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import type { ContextBinding, ScopedSecret } from './types.js';
|
|
2
|
+
import { type HostFacts } from './host-match.js';
|
|
3
|
+
export type { HostFacts } from './host-match.js';
|
|
4
|
+
/**
|
|
5
|
+
* Check whether a scope string matches a pattern.
|
|
6
|
+
*
|
|
7
|
+
* Supports exact match and glob patterns (via picomatch).
|
|
8
|
+
* Scope paths use '/' as separator (e.g., 'aws/prod/db').
|
|
9
|
+
*
|
|
10
|
+
* For prefixed scopes (e.g., 'pg:aws/prod'), the pattern may be prefixed too
|
|
11
|
+
* (e.g., 'pg:**'). In this case, the backend prefix must match exactly and
|
|
12
|
+
* the path portion is matched separately against the glob. This is needed
|
|
13
|
+
* because picomatch's '**' requires '/' separators — 'pg:**' wouldn't match
|
|
14
|
+
* 'pg:aws/prod' without splitting on the colon.
|
|
15
|
+
*/
|
|
16
|
+
export declare function matchScopePattern(scope: string, pattern: string): boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Strip the backend prefix from a scope string.
|
|
19
|
+
* Prefixed scopes have the form "backendName:path" (e.g., "pg:aws/prod").
|
|
20
|
+
* Returns the path after the first colon, or the full scope if no prefix.
|
|
21
|
+
*/
|
|
22
|
+
export declare function stripScopePrefix(scope: string): string;
|
|
23
|
+
/** The winning scoped secret for a key, with the precedence tuple that selected it. */
|
|
24
|
+
export interface ResolvedSecretCandidate {
|
|
25
|
+
secret: ScopedSecret;
|
|
26
|
+
scopeDepth: number;
|
|
27
|
+
hostSpec: number;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Resolve the winning secret per key by matching bindings against scoped secrets,
|
|
31
|
+
* applying the host gate and `(host specificity, scope depth)` precedence — WITHOUT
|
|
32
|
+
* decrypting, keeping this module crypto-free. This is the single source of truth for
|
|
33
|
+
* scope precedence; `resolveSecretsForContext` delegates to it and adds the decrypt step.
|
|
34
|
+
*
|
|
35
|
+
* Takes already-filtered bindings (for the target context). For each binding, finds
|
|
36
|
+
* secrets whose (substituted) scope matches the binding's scopePattern via picomatch.
|
|
37
|
+
* When multiple scopes provide the same key, precedence is the tuple
|
|
38
|
+
* `(host specificity, scope depth)` — a per-host binding (exact host) overrides a
|
|
39
|
+
* fleet-wide one, then longest scope path wins. Scope depth is computed AFTER stripping
|
|
40
|
+
* the backend prefix.
|
|
41
|
+
*
|
|
42
|
+
* When `hostFacts` is supplied (a fan-out child's identity), each binding is gated by
|
|
43
|
+
* its `host_pattern` and its `scope_pattern` is templated per-child
|
|
44
|
+
* (`${agentId}`/`${host}`/`${label:NAME}`). When omitted, only fleet-wide (`'**'`/NULL)
|
|
45
|
+
* non-templated bindings contribute — preserving the workflow-level (no-host) behaviour.
|
|
46
|
+
*
|
|
47
|
+
* @param bindings - Bindings already filtered for the target context
|
|
48
|
+
* @param allSecrets - All scoped secrets in the org
|
|
49
|
+
* @param hostFacts - Optional fan-out child identity for per-host resolution
|
|
50
|
+
* @returns Map of secret key → winning candidate (secret + precedence tuple)
|
|
51
|
+
*/
|
|
52
|
+
export declare function resolveSecretsWithProvenance(bindings: ContextBinding[], allSecrets: ScopedSecret[], hostFacts?: HostFacts): Map<string, ResolvedSecretCandidate>;
|
|
53
|
+
/**
|
|
54
|
+
* Resolve secrets for a context by matching bindings against scoped secrets.
|
|
55
|
+
*
|
|
56
|
+
* Takes already-filtered bindings (for the target context). For each binding,
|
|
57
|
+
* finds secrets whose (substituted) scope matches the binding's scopePattern via
|
|
58
|
+
* picomatch. When multiple scopes provide the same key, precedence is the tuple
|
|
59
|
+
* `(host specificity, scope depth)` — a per-host binding (exact host) overrides a
|
|
60
|
+
* fleet-wide one, then longest scope path wins. Scope depth is computed AFTER
|
|
61
|
+
* stripping the backend prefix.
|
|
62
|
+
*
|
|
63
|
+
* When `hostFacts` is supplied (a fan-out child's identity), each binding is
|
|
64
|
+
* gated by its `host_pattern` and its `scope_pattern` is templated per-child
|
|
65
|
+
* (`${agentId}`/`${host}`/`${label:NAME}`). When omitted, only fleet-wide
|
|
66
|
+
* (`'**'`/NULL) non-templated bindings contribute — preserving the workflow-level
|
|
67
|
+
* (no-host) behaviour.
|
|
68
|
+
*
|
|
69
|
+
* Delegates precedence to `resolveSecretsWithProvenance` and applies `decryptFn`
|
|
70
|
+
* to each winning secret.
|
|
71
|
+
*
|
|
72
|
+
* @param bindings - Bindings already filtered for the target context
|
|
73
|
+
* @param allSecrets - All scoped secrets in the org
|
|
74
|
+
* @param decryptFn - Pure decryption function (keeps this module crypto-free)
|
|
75
|
+
* @param hostFacts - Optional fan-out child identity for per-host resolution
|
|
76
|
+
* @returns Flat record of decrypted secret key-value pairs
|
|
77
|
+
*/
|
|
78
|
+
export declare function resolveSecretsForContext(bindings: ContextBinding[], allSecrets: ScopedSecret[], decryptFn: (s: ScopedSecret) => string, hostFacts?: HostFacts): Record<string, string>;
|
|
79
|
+
//# sourceMappingURL=scope-resolver.d.ts.map
|
|
@@ -2,7 +2,7 @@ import "../rolldown-runtime-ClRpJifh.js";
|
|
|
2
2
|
import { hostSpecificity, matchHostPattern } from "./host-match.js";
|
|
3
3
|
import { substituteScopePattern } from "./scope-template.js";
|
|
4
4
|
import picomatch from "picomatch";
|
|
5
|
-
//#region src/
|
|
5
|
+
//#region src/context/scope-resolver.ts
|
|
6
6
|
/**
|
|
7
7
|
* Check whether a scope string matches a pattern.
|
|
8
8
|
*
|
|
@@ -70,28 +70,29 @@ function candidateWins(c, existing) {
|
|
|
70
70
|
return c.scopeDepth > existing.scopeDepth;
|
|
71
71
|
}
|
|
72
72
|
/**
|
|
73
|
-
* Resolve
|
|
73
|
+
* Resolve the winning secret per key by matching bindings against scoped secrets,
|
|
74
|
+
* applying the host gate and `(host specificity, scope depth)` precedence — WITHOUT
|
|
75
|
+
* decrypting, keeping this module crypto-free. This is the single source of truth for
|
|
76
|
+
* scope precedence; `resolveSecretsForContext` delegates to it and adds the decrypt step.
|
|
74
77
|
*
|
|
75
|
-
* Takes already-filtered bindings (for the target
|
|
76
|
-
*
|
|
77
|
-
*
|
|
78
|
+
* Takes already-filtered bindings (for the target context). For each binding, finds
|
|
79
|
+
* secrets whose (substituted) scope matches the binding's scopePattern via picomatch.
|
|
80
|
+
* When multiple scopes provide the same key, precedence is the tuple
|
|
78
81
|
* `(host specificity, scope depth)` — a per-host binding (exact host) overrides a
|
|
79
|
-
* fleet-wide one, then longest scope path wins. Scope depth is computed AFTER
|
|
80
|
-
*
|
|
82
|
+
* fleet-wide one, then longest scope path wins. Scope depth is computed AFTER stripping
|
|
83
|
+
* the backend prefix.
|
|
81
84
|
*
|
|
82
|
-
* When `hostFacts` is supplied (a fan-out child's identity), each binding is
|
|
83
|
-
*
|
|
84
|
-
* (`${agentId}`/`${host}`/`${label:NAME}`). When omitted, only fleet-wide
|
|
85
|
-
*
|
|
86
|
-
* (no-host) behaviour.
|
|
85
|
+
* When `hostFacts` is supplied (a fan-out child's identity), each binding is gated by
|
|
86
|
+
* its `host_pattern` and its `scope_pattern` is templated per-child
|
|
87
|
+
* (`${agentId}`/`${host}`/`${label:NAME}`). When omitted, only fleet-wide (`'**'`/NULL)
|
|
88
|
+
* non-templated bindings contribute — preserving the workflow-level (no-host) behaviour.
|
|
87
89
|
*
|
|
88
|
-
* @param bindings - Bindings already filtered for the target
|
|
90
|
+
* @param bindings - Bindings already filtered for the target context
|
|
89
91
|
* @param allSecrets - All scoped secrets in the org
|
|
90
|
-
* @param decryptFn - Pure decryption function (keeps this module crypto-free)
|
|
91
92
|
* @param hostFacts - Optional fan-out child identity for per-host resolution
|
|
92
|
-
* @returns
|
|
93
|
+
* @returns Map of secret key → winning candidate (secret + precedence tuple)
|
|
93
94
|
*/
|
|
94
|
-
function
|
|
95
|
+
function resolveSecretsWithProvenance(bindings, allSecrets, hostFacts) {
|
|
95
96
|
const resolved = /* @__PURE__ */ new Map();
|
|
96
97
|
for (const binding of bindings) {
|
|
97
98
|
const scopePattern = bindingScopeForHost(binding, hostFacts);
|
|
@@ -107,11 +108,40 @@ function resolveSecretsForEnvironment(bindings, allSecrets, decryptFn, hostFacts
|
|
|
107
108
|
if (candidateWins(candidate, resolved.get(secret.key))) resolved.set(secret.key, candidate);
|
|
108
109
|
}
|
|
109
110
|
}
|
|
111
|
+
return resolved;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Resolve secrets for a context by matching bindings against scoped secrets.
|
|
115
|
+
*
|
|
116
|
+
* Takes already-filtered bindings (for the target context). For each binding,
|
|
117
|
+
* finds secrets whose (substituted) scope matches the binding's scopePattern via
|
|
118
|
+
* picomatch. When multiple scopes provide the same key, precedence is the tuple
|
|
119
|
+
* `(host specificity, scope depth)` — a per-host binding (exact host) overrides a
|
|
120
|
+
* fleet-wide one, then longest scope path wins. Scope depth is computed AFTER
|
|
121
|
+
* stripping the backend prefix.
|
|
122
|
+
*
|
|
123
|
+
* When `hostFacts` is supplied (a fan-out child's identity), each binding is
|
|
124
|
+
* gated by its `host_pattern` and its `scope_pattern` is templated per-child
|
|
125
|
+
* (`${agentId}`/`${host}`/`${label:NAME}`). When omitted, only fleet-wide
|
|
126
|
+
* (`'**'`/NULL) non-templated bindings contribute — preserving the workflow-level
|
|
127
|
+
* (no-host) behaviour.
|
|
128
|
+
*
|
|
129
|
+
* Delegates precedence to `resolveSecretsWithProvenance` and applies `decryptFn`
|
|
130
|
+
* to each winning secret.
|
|
131
|
+
*
|
|
132
|
+
* @param bindings - Bindings already filtered for the target context
|
|
133
|
+
* @param allSecrets - All scoped secrets in the org
|
|
134
|
+
* @param decryptFn - Pure decryption function (keeps this module crypto-free)
|
|
135
|
+
* @param hostFacts - Optional fan-out child identity for per-host resolution
|
|
136
|
+
* @returns Flat record of decrypted secret key-value pairs
|
|
137
|
+
*/
|
|
138
|
+
function resolveSecretsForContext(bindings, allSecrets, decryptFn, hostFacts) {
|
|
139
|
+
const resolved = resolveSecretsWithProvenance(bindings, allSecrets, hostFacts);
|
|
110
140
|
const result = {};
|
|
111
141
|
for (const [key, { secret }] of resolved) result[key] = decryptFn(secret);
|
|
112
142
|
return result;
|
|
113
143
|
}
|
|
114
144
|
//#endregion
|
|
115
|
-
export { matchScopePattern,
|
|
145
|
+
export { matchScopePattern, resolveSecretsForContext, resolveSecretsWithProvenance, stripScopePrefix };
|
|
116
146
|
|
|
117
147
|
//# sourceMappingURL=scope-resolver.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "../rolldown-runtime-ClRpJifh.js";
|
|
2
|
-
//#region src/
|
|
2
|
+
//#region src/context/scope-template.ts
|
|
3
3
|
/** A substituted value must be a single literal path segment — no `/` or glob. */
|
|
4
4
|
const SAFE_SEGMENT = /^[A-Za-z0-9._-]+$/;
|
|
5
5
|
const PLACEHOLDER = /\$\{(agentId|host|label:[^}]+)\}/g;
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Context types for KiCI's named-context model.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* Contexts are org-level entities that group secrets, variables,
|
|
5
5
|
* and protection rules for deployment targets (dev, staging, production).
|
|
6
6
|
*/
|
|
7
7
|
import { z } from 'zod';
|
|
8
8
|
import type { ApproverClause } from '../approval/types.js';
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
import type { HoldType } from './hold-type.js';
|
|
10
|
+
import type { HeldRunStatus } from './held-run-status.js';
|
|
11
|
+
import type { ConcurrencyStrategy } from './concurrency-strategy.js';
|
|
12
|
+
/** Context entity — org-level deployment target with protection rules. */
|
|
13
|
+
export interface Context {
|
|
11
14
|
id: string;
|
|
12
15
|
orgId: string;
|
|
13
16
|
name: string;
|
|
@@ -17,14 +20,14 @@ export interface Environment {
|
|
|
17
20
|
triggerTypeFilters: string[];
|
|
18
21
|
repoPatterns: string[];
|
|
19
22
|
concurrencyLimit: number | null;
|
|
20
|
-
concurrencyStrategy:
|
|
23
|
+
concurrencyStrategy: ConcurrencyStrategy;
|
|
21
24
|
concurrencyTimeoutMs: number;
|
|
22
25
|
requiredReviewers: string[] | null;
|
|
23
26
|
waitTimerSeconds: number | null;
|
|
24
27
|
holdExpirySeconds: number;
|
|
25
|
-
/** Minimum trust tier required for CI execution in this
|
|
28
|
+
/** Minimum trust tier required for CI execution in this context. */
|
|
26
29
|
minimumTrust?: 'known' | 'trusted';
|
|
27
|
-
/** Whether this
|
|
30
|
+
/** Whether this context allows local (no-remote) executions. Default false. */
|
|
28
31
|
allowLocalExecution?: boolean;
|
|
29
32
|
enabled: boolean;
|
|
30
33
|
createdAt: string;
|
|
@@ -43,11 +46,11 @@ export interface ScopedSecret {
|
|
|
43
46
|
createdAt: string;
|
|
44
47
|
updatedAt: string;
|
|
45
48
|
}
|
|
46
|
-
/** Binding that maps a scope pattern to
|
|
47
|
-
export interface
|
|
49
|
+
/** Binding that maps a scope pattern to a context. */
|
|
50
|
+
export interface ContextBinding {
|
|
48
51
|
id: string;
|
|
49
52
|
orgId: string;
|
|
50
|
-
|
|
53
|
+
contextId: string;
|
|
51
54
|
scopePattern: string;
|
|
52
55
|
/**
|
|
53
56
|
* Host selector this binding applies to (exact / glob / regex, matched
|
|
@@ -58,22 +61,22 @@ export interface EnvironmentBinding {
|
|
|
58
61
|
hostPattern: string;
|
|
59
62
|
createdAt: string;
|
|
60
63
|
}
|
|
61
|
-
/** Non-secret key-value config per
|
|
62
|
-
export interface
|
|
64
|
+
/** Non-secret key-value config per context, with optional lock. */
|
|
65
|
+
export interface ContextVariable {
|
|
63
66
|
id: string;
|
|
64
67
|
orgId: string;
|
|
65
|
-
|
|
68
|
+
contextId: string;
|
|
66
69
|
key: string;
|
|
67
70
|
value: string;
|
|
68
71
|
locked: boolean;
|
|
69
72
|
createdAt: string;
|
|
70
73
|
updatedAt: string;
|
|
71
74
|
}
|
|
72
|
-
/** Per-source override for
|
|
73
|
-
export interface
|
|
75
|
+
/** Per-source override for a context variable. */
|
|
76
|
+
export interface ContextSourceOverride {
|
|
74
77
|
id: string;
|
|
75
78
|
orgId: string;
|
|
76
|
-
|
|
79
|
+
contextId: string;
|
|
77
80
|
routingKey: string;
|
|
78
81
|
key: string;
|
|
79
82
|
value: string;
|
|
@@ -82,9 +85,9 @@ export interface EnvironmentSourceOverride {
|
|
|
82
85
|
}
|
|
83
86
|
/** Trust tier for contributor-based CI execution gating (single source of truth). */
|
|
84
87
|
export declare const TrustTierSchema: z.ZodEnum<{
|
|
85
|
-
unknown: "unknown";
|
|
86
88
|
known: "known";
|
|
87
89
|
trusted: "trusted";
|
|
90
|
+
unknown: "unknown";
|
|
88
91
|
}>;
|
|
89
92
|
export type TrustTier = z.infer<typeof TrustTierSchema>;
|
|
90
93
|
/** Held run record for protection gate enforcement. */
|
|
@@ -93,9 +96,9 @@ export interface HeldRun {
|
|
|
93
96
|
orgId: string;
|
|
94
97
|
runId: string;
|
|
95
98
|
jobId: string;
|
|
96
|
-
|
|
97
|
-
holdType:
|
|
98
|
-
status:
|
|
99
|
+
contextId: string;
|
|
100
|
+
holdType: HoldType;
|
|
101
|
+
status: HeldRunStatus;
|
|
99
102
|
reason: string | null;
|
|
100
103
|
approvedBy: string | null;
|
|
101
104
|
createdAt: string;
|
|
@@ -107,9 +110,9 @@ export interface ProtectionGateResult {
|
|
|
107
110
|
action: 'pass' | 'reject' | 'hold' | 'queue' | 'wait';
|
|
108
111
|
reason?: string;
|
|
109
112
|
holdUntil?: string;
|
|
110
|
-
holdType?:
|
|
113
|
+
holdType?: HoldType;
|
|
111
114
|
/**
|
|
112
|
-
* Approver clauses for a reviewer hold, mapped from the
|
|
115
|
+
* Approver clauses for a reviewer hold, mapped from the context's
|
|
113
116
|
* `requiredReviewers`. Each reviewer string maps to a `{ user }` clause
|
|
114
117
|
* (team-named reviewers are a documented follow-up). Empty/undefined means
|
|
115
118
|
* "any approval-capable member".
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import "../rolldown-runtime-ClRpJifh.js";
|
|
2
2
|
import { z } from "zod";
|
|
3
|
-
//#region src/
|
|
3
|
+
//#region src/context/types.ts
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* Context types for KiCI's named-context model.
|
|
6
6
|
*
|
|
7
|
-
*
|
|
7
|
+
* Contexts are org-level entities that group secrets, variables,
|
|
8
8
|
* and protection rules for deployment targets (dev, staging, production).
|
|
9
9
|
*/
|
|
10
10
|
/** Trust tier for contributor-based CI execution gating (single source of truth). */
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
* Browser-safe: data + TypeScript types only, no Node imports, so it lives in
|
|
22
22
|
* the engine barrel importable by the web UI, the CLI, and the Platform.
|
|
23
23
|
*/
|
|
24
|
-
export type DeveloperOpDomain = 'runs' | 'workflows' | '
|
|
24
|
+
export type DeveloperOpDomain = 'runs' | 'workflows' | 'contexts' | 'secrets' | 'held-runs' | 'diagnostics' | 'orchestrators' | 'sources' | 'dlq' | 'attestations' | 'activity' | 'orgs';
|
|
25
25
|
export type DeveloperOpKind = 'read' | 'write';
|
|
26
26
|
/** Which of the three entrypoints a developer op is (or should be) exposed on. */
|
|
27
27
|
export interface DeveloperOpEntrypoints {
|
|
@@ -45,6 +45,14 @@ export interface DeveloperOperation {
|
|
|
45
45
|
mcpAppropriate: boolean;
|
|
46
46
|
/** MCP tool name when `entrypoints.mcp` is true; null otherwise. */
|
|
47
47
|
mcpTool: string | null;
|
|
48
|
+
/**
|
|
49
|
+
* True when the op acts on a specific repository's resource and must honour
|
|
50
|
+
* the caller's repo glob patterns on EVERY entrypoint. Required on every row
|
|
51
|
+
* so a new op cannot compile without an explicit decision, and NOT derivable
|
|
52
|
+
* from `domain` — `workflows.list` is repo-scoped while `secrets.list`, whose
|
|
53
|
+
* rows are context-keyed with no repository to scope against, is not.
|
|
54
|
+
*/
|
|
55
|
+
repoScoped: boolean;
|
|
48
56
|
}
|
|
49
57
|
/**
|
|
50
58
|
* The workflow-developer core. Developer plane only — org-membership-scoped,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "../rolldown-runtime-ClRpJifh.js";
|
|
2
2
|
//#region src/dev-ops/operations.ts
|
|
3
3
|
/** Build a row, defaulting every unspecified entrypoint to false. */
|
|
4
|
-
function op(id, domain, kind, ep, mcpAppropriate, mcpTool) {
|
|
4
|
+
function op(id, domain, kind, ep, mcpAppropriate, mcpTool, repoScoped) {
|
|
5
5
|
return {
|
|
6
6
|
id,
|
|
7
7
|
domain,
|
|
@@ -14,7 +14,8 @@ function op(id, domain, kind, ep, mcpAppropriate, mcpTool) {
|
|
|
14
14
|
...ep
|
|
15
15
|
},
|
|
16
16
|
mcpAppropriate,
|
|
17
|
-
mcpTool
|
|
17
|
+
mcpTool,
|
|
18
|
+
repoScoped
|
|
18
19
|
};
|
|
19
20
|
}
|
|
20
21
|
/**
|
|
@@ -27,103 +28,119 @@ const DEVELOPER_OPERATIONS = [
|
|
|
27
28
|
cli: true,
|
|
28
29
|
mcp: true,
|
|
29
30
|
ui: true
|
|
30
|
-
}, true, "list_runs"),
|
|
31
|
+
}, true, "list_runs", true),
|
|
31
32
|
op("runs.get", "runs", "read", {
|
|
32
33
|
http: true,
|
|
33
34
|
cli: true,
|
|
34
35
|
mcp: true,
|
|
35
36
|
ui: true
|
|
36
|
-
}, true, "get_run"),
|
|
37
|
+
}, true, "get_run", true),
|
|
37
38
|
op("runs.stepLogs", "runs", "read", {
|
|
38
39
|
http: true,
|
|
39
40
|
cli: true,
|
|
40
41
|
mcp: true,
|
|
41
42
|
ui: true
|
|
42
|
-
}, true, "get_step_logs"),
|
|
43
|
+
}, true, "get_step_logs", true),
|
|
43
44
|
op("runs.cancel", "runs", "write", {
|
|
44
45
|
http: true,
|
|
45
46
|
cli: true,
|
|
46
47
|
mcp: true,
|
|
47
48
|
ui: true
|
|
48
|
-
}, true, "cancel_run"),
|
|
49
|
+
}, true, "cancel_run", true),
|
|
49
50
|
op("runs.cancelByBranch", "runs", "write", {
|
|
50
51
|
http: true,
|
|
51
52
|
cli: true,
|
|
52
53
|
mcp: true,
|
|
53
54
|
ui: false
|
|
54
|
-
}, true, "cancel_runs_by_branch"),
|
|
55
|
+
}, true, "cancel_runs_by_branch", true),
|
|
55
56
|
op("runs.rerun", "runs", "write", {
|
|
56
57
|
http: true,
|
|
57
58
|
cli: true,
|
|
58
59
|
mcp: true,
|
|
59
60
|
ui: true
|
|
60
|
-
}, true, "rerun_run"),
|
|
61
|
+
}, true, "rerun_run", true),
|
|
61
62
|
op("workflows.list", "workflows", "read", {
|
|
62
63
|
http: true,
|
|
63
64
|
cli: true,
|
|
64
65
|
mcp: true,
|
|
65
66
|
ui: true
|
|
66
|
-
}, true, "list_workflows"),
|
|
67
|
+
}, true, "list_workflows", true),
|
|
67
68
|
op("workflows.trigger", "workflows", "write", {
|
|
68
69
|
http: true,
|
|
69
70
|
cli: false,
|
|
70
71
|
mcp: true,
|
|
71
72
|
ui: true
|
|
72
|
-
}, true, "trigger_run"),
|
|
73
|
+
}, true, "trigger_run", true),
|
|
74
|
+
op("workflows.disable", "workflows", "write", {
|
|
75
|
+
http: true,
|
|
76
|
+
cli: false,
|
|
77
|
+
mcp: false,
|
|
78
|
+
ui: true
|
|
79
|
+
}, false, null, true),
|
|
80
|
+
op("workflows.delete", "workflows", "write", {
|
|
81
|
+
http: true,
|
|
82
|
+
cli: false,
|
|
83
|
+
mcp: false,
|
|
84
|
+
ui: true
|
|
85
|
+
}, false, null, true),
|
|
73
86
|
op("secrets.list", "secrets", "read", {
|
|
74
87
|
http: true,
|
|
75
88
|
cli: true,
|
|
76
89
|
mcp: true,
|
|
77
90
|
ui: true
|
|
78
|
-
}, true, "list_secrets"),
|
|
91
|
+
}, true, "list_secrets", false),
|
|
79
92
|
op("secrets.set", "secrets", "write", {
|
|
80
93
|
http: true,
|
|
81
94
|
cli: false,
|
|
82
95
|
mcp: false,
|
|
83
96
|
ui: true
|
|
84
|
-
}, false, null),
|
|
97
|
+
}, false, null, false),
|
|
85
98
|
op("secrets.delete", "secrets", "write", {
|
|
86
99
|
http: true,
|
|
87
100
|
cli: false,
|
|
88
101
|
mcp: false,
|
|
89
102
|
ui: true
|
|
90
|
-
}, false, null),
|
|
91
|
-
op("
|
|
103
|
+
}, false, null, false),
|
|
104
|
+
op("contexts.delete", "contexts", "write", {
|
|
92
105
|
http: true,
|
|
93
106
|
cli: false,
|
|
94
107
|
mcp: false,
|
|
95
108
|
ui: true
|
|
96
|
-
}, false, null),
|
|
109
|
+
}, false, null, false),
|
|
110
|
+
op("held-runs.list", "held-runs", "read", {
|
|
111
|
+
http: true,
|
|
112
|
+
ui: true
|
|
113
|
+
}, false, null, true),
|
|
97
114
|
op("held-runs.approve", "held-runs", "write", {
|
|
98
115
|
http: true,
|
|
99
116
|
cli: true,
|
|
100
117
|
mcp: true,
|
|
101
118
|
ui: true
|
|
102
|
-
}, true, "approve_run"),
|
|
119
|
+
}, true, "approve_run", true),
|
|
103
120
|
op("held-runs.reject", "held-runs", "write", {
|
|
104
121
|
http: true,
|
|
105
122
|
cli: true,
|
|
106
123
|
mcp: true,
|
|
107
124
|
ui: true
|
|
108
|
-
}, true, "reject_run"),
|
|
125
|
+
}, true, "reject_run", true),
|
|
109
126
|
op("diagnostics.get", "diagnostics", "read", {
|
|
110
127
|
http: true,
|
|
111
128
|
cli: true,
|
|
112
129
|
mcp: true,
|
|
113
130
|
ui: true
|
|
114
|
-
}, true, "get_diagnostics"),
|
|
131
|
+
}, true, "get_diagnostics", false),
|
|
115
132
|
op("orchestrators.list", "orchestrators", "read", {
|
|
116
133
|
http: true,
|
|
117
134
|
cli: true,
|
|
118
135
|
mcp: true,
|
|
119
136
|
ui: true
|
|
120
|
-
}, true, "list_orchestrators"),
|
|
137
|
+
}, true, "list_orchestrators", false),
|
|
121
138
|
op("orgs.list", "orgs", "read", {
|
|
122
139
|
http: true,
|
|
123
140
|
cli: true,
|
|
124
141
|
mcp: true,
|
|
125
142
|
ui: true
|
|
126
|
-
}, true, "list_orgs")
|
|
143
|
+
}, true, "list_orgs", false)
|
|
127
144
|
];
|
|
128
145
|
/** All ops a given entrypoint should expose. */
|
|
129
146
|
function developerOpsForEntrypoint(ep) {
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Infrastructure alert vocabulary — the single definition of what a diagnostics
|
|
3
|
+
* infrastructure alert's `type` and `severity` can be.
|
|
4
|
+
*
|
|
5
|
+
* Lives beside the other shared vocabularies (`billing/plan-type.ts`,
|
|
6
|
+
* `context/held-run-status.ts`) rather than in the protocol module, so the
|
|
7
|
+
* Platform producer, the dashboard, and the `kici` CLI all name one enum
|
|
8
|
+
* instead of each carrying a copy. Pure Zod with no Node built-ins, so it is
|
|
9
|
+
* safe on the browser-facing engine barrel.
|
|
10
|
+
*
|
|
11
|
+
* This is the *known* vocabulary — the set the Platform mints alerts from and
|
|
12
|
+
* the set the read-side consumers colour their badges by. It is deliberately
|
|
13
|
+
* NOT the wire type of the response fields. The hosted Platform always runs the
|
|
14
|
+
* newest build, while a customer's `kici` CLI is pinned to whatever version
|
|
15
|
+
* they installed and hard-parses this response
|
|
16
|
+
* (`packages/compiler/src/remote/dashboard-client.ts`). A strict enum on the
|
|
17
|
+
* wire would not degrade one alert row — it would fail the whole
|
|
18
|
+
* `/diagnostics/infrastructure` parse and take `kici diagnostics` down with it
|
|
19
|
+
* the day a fifth alert type ships. So the response carries `z.string()` and
|
|
20
|
+
* the producer carries the enum: strict on write, permissive on read.
|
|
21
|
+
*/
|
|
22
|
+
import { z } from 'zod';
|
|
23
|
+
/**
|
|
24
|
+
* Known infrastructure alert types, matching what the Platform mints from the
|
|
25
|
+
* state it computes about connected orchestrators.
|
|
26
|
+
*/
|
|
27
|
+
export declare const InfraAlertType: z.ZodEnum<{
|
|
28
|
+
capacity: "capacity";
|
|
29
|
+
"label-gaps": "label-gaps";
|
|
30
|
+
"no-raft-leader": "no-raft-leader";
|
|
31
|
+
"zero-agents": "zero-agents";
|
|
32
|
+
}>;
|
|
33
|
+
export type InfraAlertType = z.infer<typeof InfraAlertType>;
|
|
34
|
+
/** Every known alert type, in declaration order. */
|
|
35
|
+
export declare const INFRA_ALERT_TYPES: readonly InfraAlertType[];
|
|
36
|
+
/** Known alert severities, in ascending urgency. */
|
|
37
|
+
export declare const InfraAlertSeverity: z.ZodEnum<{
|
|
38
|
+
critical: "critical";
|
|
39
|
+
warning: "warning";
|
|
40
|
+
}>;
|
|
41
|
+
export type InfraAlertSeverity = z.infer<typeof InfraAlertSeverity>;
|
|
42
|
+
/**
|
|
43
|
+
* An alert as the Platform mints it, with both fields narrowed to the known
|
|
44
|
+
* vocabulary.
|
|
45
|
+
*
|
|
46
|
+
* The producer annotates its accumulator with this type, which is what turns a
|
|
47
|
+
* misspelled or unranked alert type into a `pnpm typecheck` failure at the mint
|
|
48
|
+
* site rather than a string that validates on the wire and renders as an
|
|
49
|
+
* unrecognised row.
|
|
50
|
+
*/
|
|
51
|
+
export interface MintedInfraAlert {
|
|
52
|
+
type: InfraAlertType;
|
|
53
|
+
message: string;
|
|
54
|
+
severity: InfraAlertSeverity;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Resolve an arbitrary severity string read off the wire to a known severity.
|
|
58
|
+
*
|
|
59
|
+
* An unrecognised value resolves to `critical`. A client older than the
|
|
60
|
+
* Platform cannot know whether a severity it has never seen is quieter or
|
|
61
|
+
* louder than `critical`, and on an operator surface the safe reading of "I
|
|
62
|
+
* don't know" is the conspicuous one. A plain `severity === 'critical'`
|
|
63
|
+
* comparison instead reads every unrecognised value as a yellow warning, so a
|
|
64
|
+
* `critcal` typo silently downgrades a critical alert.
|
|
65
|
+
*
|
|
66
|
+
* `safeParse` is a set membership test, so an attacker-supplied
|
|
67
|
+
* `constructor` / `toString` cannot walk the prototype chain the way a bare
|
|
68
|
+
* object index would.
|
|
69
|
+
*/
|
|
70
|
+
export declare function normalizeInfraAlertSeverity(severity: string): InfraAlertSeverity;
|
|
71
|
+
//# sourceMappingURL=infra-alert.d.ts.map
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import "../rolldown-runtime-ClRpJifh.js";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
//#region src/diagnostics/infra-alert.ts
|
|
4
|
+
/**
|
|
5
|
+
* Infrastructure alert vocabulary — the single definition of what a diagnostics
|
|
6
|
+
* infrastructure alert's `type` and `severity` can be.
|
|
7
|
+
*
|
|
8
|
+
* Lives beside the other shared vocabularies (`billing/plan-type.ts`,
|
|
9
|
+
* `context/held-run-status.ts`) rather than in the protocol module, so the
|
|
10
|
+
* Platform producer, the dashboard, and the `kici` CLI all name one enum
|
|
11
|
+
* instead of each carrying a copy. Pure Zod with no Node built-ins, so it is
|
|
12
|
+
* safe on the browser-facing engine barrel.
|
|
13
|
+
*
|
|
14
|
+
* This is the *known* vocabulary — the set the Platform mints alerts from and
|
|
15
|
+
* the set the read-side consumers colour their badges by. It is deliberately
|
|
16
|
+
* NOT the wire type of the response fields. The hosted Platform always runs the
|
|
17
|
+
* newest build, while a customer's `kici` CLI is pinned to whatever version
|
|
18
|
+
* they installed and hard-parses this response
|
|
19
|
+
* (`packages/compiler/src/remote/dashboard-client.ts`). A strict enum on the
|
|
20
|
+
* wire would not degrade one alert row — it would fail the whole
|
|
21
|
+
* `/diagnostics/infrastructure` parse and take `kici diagnostics` down with it
|
|
22
|
+
* the day a fifth alert type ships. So the response carries `z.string()` and
|
|
23
|
+
* the producer carries the enum: strict on write, permissive on read.
|
|
24
|
+
*/
|
|
25
|
+
/**
|
|
26
|
+
* Known infrastructure alert types, matching what the Platform mints from the
|
|
27
|
+
* state it computes about connected orchestrators.
|
|
28
|
+
*/
|
|
29
|
+
const InfraAlertType = z.enum([
|
|
30
|
+
"zero-agents",
|
|
31
|
+
"capacity",
|
|
32
|
+
"label-gaps",
|
|
33
|
+
"no-raft-leader"
|
|
34
|
+
]);
|
|
35
|
+
/** Every known alert type, in declaration order. */
|
|
36
|
+
const INFRA_ALERT_TYPES = InfraAlertType.options;
|
|
37
|
+
/** Known alert severities, in ascending urgency. */
|
|
38
|
+
const InfraAlertSeverity = z.enum(["warning", "critical"]);
|
|
39
|
+
/**
|
|
40
|
+
* Resolve an arbitrary severity string read off the wire to a known severity.
|
|
41
|
+
*
|
|
42
|
+
* An unrecognised value resolves to `critical`. A client older than the
|
|
43
|
+
* Platform cannot know whether a severity it has never seen is quieter or
|
|
44
|
+
* louder than `critical`, and on an operator surface the safe reading of "I
|
|
45
|
+
* don't know" is the conspicuous one. A plain `severity === 'critical'`
|
|
46
|
+
* comparison instead reads every unrecognised value as a yellow warning, so a
|
|
47
|
+
* `critcal` typo silently downgrades a critical alert.
|
|
48
|
+
*
|
|
49
|
+
* `safeParse` is a set membership test, so an attacker-supplied
|
|
50
|
+
* `constructor` / `toString` cannot walk the prototype chain the way a bare
|
|
51
|
+
* object index would.
|
|
52
|
+
*/
|
|
53
|
+
function normalizeInfraAlertSeverity(severity) {
|
|
54
|
+
const parsed = InfraAlertSeverity.safeParse(severity);
|
|
55
|
+
return parsed.success ? parsed.data : InfraAlertSeverity.enum.critical;
|
|
56
|
+
}
|
|
57
|
+
//#endregion
|
|
58
|
+
export { INFRA_ALERT_TYPES, InfraAlertSeverity, InfraAlertType, normalizeInfraAlertSeverity };
|
|
59
|
+
|
|
60
|
+
//# sourceMappingURL=infra-alert.js.map
|