@kici-dev/engine 0.0.0 → 0.1.1
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/LICENSE +661 -0
- package/README.md +1 -6
- package/dist/audit/access-log-policy.d.ts +97 -0
- package/dist/audit/access-log-policy.js +195 -0
- package/dist/audit/activity.d.ts +156 -0
- package/dist/audit/activity.js +175 -0
- package/dist/audit/retention-policy.d.ts +157 -0
- package/dist/audit/retention-policy.js +364 -0
- package/dist/bundler/index.d.ts +3 -0
- package/dist/bundler/index.js +3 -0
- package/dist/bundler/rolldown-config.d.ts +41 -0
- package/dist/bundler/rolldown-config.js +40 -0
- package/dist/chunk-gOLHoazu.js +4 -0
- package/dist/env/environment-allowlist.d.ts +45 -0
- package/dist/env/environment-allowlist.js +69 -0
- package/dist/environment/index.d.ts +3 -0
- package/dist/environment/index.js +3 -0
- package/dist/environment/scope-resolver.d.ts +35 -0
- package/dist/environment/scope-resolver.js +77 -0
- package/dist/environment/types.d.ts +98 -0
- package/dist/environment/types.js +2 -0
- package/dist/index.d.ts +54 -0
- package/dist/index.js +45 -0
- package/dist/labels.d.ts +106 -0
- package/dist/labels.js +162 -0
- package/dist/metrics/metric-catalog.generated.d.ts +400 -0
- package/dist/metrics/metric-catalog.generated.js +510 -0
- package/dist/protocol/dashboard-global-workflows.d.ts +9 -0
- package/dist/protocol/dashboard-global-workflows.js +3 -0
- package/dist/protocol/event-log-payload.d.ts +16 -0
- package/dist/protocol/event-log-payload.js +21 -0
- package/dist/protocol/messages/access-log.d.ts +545 -0
- package/dist/protocol/messages/access-log.js +175 -0
- package/dist/protocol/messages/actor.d.ts +100 -0
- package/dist/protocol/messages/actor.js +139 -0
- package/dist/protocol/messages/auth.d.ts +25 -0
- package/dist/protocol/messages/auth.js +36 -0
- package/dist/protocol/messages/browser.d.ts +369 -0
- package/dist/protocol/messages/browser.js +225 -0
- package/dist/protocol/messages/capabilities.d.ts +46 -0
- package/dist/protocol/messages/capabilities.js +42 -0
- package/dist/protocol/messages/common.d.ts +53 -0
- package/dist/protocol/messages/common.js +55 -0
- package/dist/protocol/messages/dashboard-global-workflows.d.ts +166 -0
- package/dist/protocol/messages/dashboard-global-workflows.js +80 -0
- package/dist/protocol/messages/dashboard.d.ts +4068 -0
- package/dist/protocol/messages/dashboard.js +1237 -0
- package/dist/protocol/messages/event-log.d.ts +49 -0
- package/dist/protocol/messages/event-log.js +45 -0
- package/dist/protocol/messages/execution-status.d.ts +164 -0
- package/dist/protocol/messages/execution-status.js +166 -0
- package/dist/protocol/messages/join.d.ts +18 -0
- package/dist/protocol/messages/join.js +28 -0
- package/dist/protocol/messages/log-pull.d.ts +27 -0
- package/dist/protocol/messages/log-pull.js +36 -0
- package/dist/protocol/messages/observe.d.ts +75 -0
- package/dist/protocol/messages/observe.js +70 -0
- package/dist/protocol/messages/orchestrator-agent.d.ts +606 -0
- package/dist/protocol/messages/orchestrator-agent.js +481 -0
- package/dist/protocol/messages/peer.d.ts +795 -0
- package/dist/protocol/messages/peer.js +372 -0
- package/dist/protocol/messages/platform-orchestrator.d.ts +1888 -0
- package/dist/protocol/messages/platform-orchestrator.js +379 -0
- package/dist/protocol/messages/run-events.d.ts +155 -0
- package/dist/protocol/messages/run-events.js +115 -0
- package/dist/protocol/messages/saas-orchestrator.d.ts +2179 -0
- package/dist/protocol/messages/source-registration.d.ts +103 -0
- package/dist/protocol/messages/source-registration.js +109 -0
- package/dist/protocol/messages/test-run.d.ts +59 -0
- package/dist/protocol/messages/test-run.js +52 -0
- package/dist/protocol/version.d.ts +12 -0
- package/dist/protocol/version.js +17 -0
- package/dist/provider/changed-files-fetcher.d.ts +24 -0
- package/dist/provider/changed-files-fetcher.js +2 -0
- package/dist/provider/check-run-conclusion.d.ts +15 -0
- package/dist/provider/check-run-conclusion.js +19 -0
- package/dist/provider/check-status-poster.d.ts +15 -0
- package/dist/provider/check-status-poster.js +2 -0
- package/dist/provider/clone-token-provider.d.ts +58 -0
- package/dist/provider/clone-token-provider.js +2 -0
- package/dist/provider/contributor-resolver.d.ts +22 -0
- package/dist/provider/contributor-resolver.js +2 -0
- package/dist/provider/index.d.ts +23 -0
- package/dist/provider/index.js +3 -0
- package/dist/provider/lock-file-fetcher.d.ts +24 -0
- package/dist/provider/lock-file-fetcher.js +2 -0
- package/dist/provider/repo-url-builder.d.ts +35 -0
- package/dist/provider/repo-url-builder.js +2 -0
- package/dist/provider/types.d.ts +9 -0
- package/dist/provider/types.js +2 -0
- package/dist/provider/webhook-normalizer.d.ts +163 -0
- package/dist/provider/webhook-normalizer.js +2 -0
- package/dist/registration/registerable-trigger-type.d.ts +52 -0
- package/dist/registration/registerable-trigger-type.js +56 -0
- package/dist/scaler/resource-types.d.ts +90 -0
- package/dist/scaler/resource-types.js +99 -0
- package/dist/scaler/scaler-backend-type.d.ts +16 -0
- package/dist/scaler/scaler-backend-type.js +20 -0
- package/dist/secrets/index.d.ts +7 -0
- package/dist/secrets/index.js +2 -0
- package/dist/secrets/types.d.ts +138 -0
- package/dist/secrets/types.js +2 -0
- package/dist/state-machine/index.d.ts +2 -0
- package/dist/state-machine/index.js +3 -0
- package/dist/state-machine/machine.d.ts +34 -0
- package/dist/state-machine/machine.js +103 -0
- package/dist/state-machine/types.d.ts +34 -0
- package/dist/state-machine/types.js +15 -0
- package/dist/trigger/decision-trace.d.ts +41 -0
- package/dist/trigger/decision-trace.js +30 -0
- package/dist/trigger/jsonpath-matcher.d.ts +27 -0
- package/dist/trigger/jsonpath-matcher.js +92 -0
- package/dist/trigger/matcher.d.ts +29 -0
- package/dist/trigger/matcher.js +704 -0
- package/dist/trigger/trigger-event-type.d.ts +14 -0
- package/dist/trigger/trigger-event-type.js +66 -0
- package/dist/trigger/types.d.ts +524 -0
- package/dist/trigger/types.js +48 -0
- package/dist/webhook/signature.d.ts +15 -0
- package/dist/webhook/signature.js +32 -0
- package/dist/ws/close-codes.d.ts +28 -0
- package/dist/ws/close-codes.js +33 -0
- package/dist/ws/rate-limiter.d.ts +86 -0
- package/dist/ws/rate-limiter.js +136 -0
- package/dist/ws/ws-like.d.ts +12 -0
- package/dist/ws/ws-like.js +2 -0
- package/package.json +54 -6
- package/sbom.spdx.json +202 -0
- package/index.js +0 -3
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import "../chunk-gOLHoazu.js";
|
|
2
|
+
//#region src/env/environment-allowlist.ts
|
|
3
|
+
/**
|
|
4
|
+
* Shared environment allowlist constants for KiCI.
|
|
5
|
+
*
|
|
6
|
+
* Single source of truth for environment variable filtering used across tiers:
|
|
7
|
+
* - Orchestrator bare-metal backend (spawned agent processes)
|
|
8
|
+
* - Agent sandbox execution (customer code isolation)
|
|
9
|
+
*
|
|
10
|
+
* These constants ensure that orchestrator/agent secrets (DATABASE_URL,
|
|
11
|
+
* GITHUB_PRIVATE_KEY, PLATFORM_TOKEN, WEBHOOK_SECRET, etc.) are never leaked
|
|
12
|
+
* to child processes or customer code.
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* System environment variables that are safe to pass into spawned processes.
|
|
16
|
+
*
|
|
17
|
+
* This is an explicit allowlist -- anything NOT listed here is stripped.
|
|
18
|
+
* Adding new variables to the host process will NOT leak them downstream.
|
|
19
|
+
*/
|
|
20
|
+
const ALLOWED_SYSTEM_VARS = [
|
|
21
|
+
"PATH",
|
|
22
|
+
"HOME",
|
|
23
|
+
"USER",
|
|
24
|
+
"SHELL",
|
|
25
|
+
"LANG",
|
|
26
|
+
"LC_ALL",
|
|
27
|
+
"TERM",
|
|
28
|
+
"TMPDIR",
|
|
29
|
+
"NODE_PATH",
|
|
30
|
+
"TZ"
|
|
31
|
+
];
|
|
32
|
+
/**
|
|
33
|
+
* Default environment variables injected into every sandbox execution.
|
|
34
|
+
*
|
|
35
|
+
* These are set before user/secret env vars so they can be overridden.
|
|
36
|
+
* - FORCE_COLOR=1: Ensures color-aware libraries (chalk, etc.) emit ANSI
|
|
37
|
+
* codes even when stdout is a pipe (non-TTY). Without this, log output
|
|
38
|
+
* appears uncolored in the dashboard log viewer.
|
|
39
|
+
*/
|
|
40
|
+
const SANDBOX_DEFAULT_VARS = { FORCE_COLOR: "1" };
|
|
41
|
+
/**
|
|
42
|
+
* KICI environment variables required by the agent.
|
|
43
|
+
*
|
|
44
|
+
* These are set explicitly by the scaler (not copied from orchestrator process.env)
|
|
45
|
+
* to ensure the agent receives only the values it needs with correct content.
|
|
46
|
+
*/
|
|
47
|
+
const AGENT_REQUIRED_KICI_VARS = [
|
|
48
|
+
"KICI_ORCHESTRATOR_URL",
|
|
49
|
+
"KICI_AGENT_ID",
|
|
50
|
+
"KICI_LABELS",
|
|
51
|
+
"KICI_MAX_CONCURRENT_JOBS",
|
|
52
|
+
"KICI_SCALER_MANAGED",
|
|
53
|
+
"KICI_EXECUTION_MODE",
|
|
54
|
+
"KICI_PORT"
|
|
55
|
+
];
|
|
56
|
+
/**
|
|
57
|
+
* Prefix for operator-defined environment variables that should be forwarded
|
|
58
|
+
* from the orchestrator process to spawned agent processes.
|
|
59
|
+
*
|
|
60
|
+
* Variables with this prefix in the orchestrator's process.env are forwarded
|
|
61
|
+
* to agent child processes with the prefix stripped. For example:
|
|
62
|
+
* KICI_AGENT_ENV_HTTP_PROXY=http://proxy:3128
|
|
63
|
+
* -> HTTP_PROXY=http://proxy:3128 in the agent process
|
|
64
|
+
*/
|
|
65
|
+
const KICI_AGENT_ENV_PREFIX = "KICI_AGENT_ENV_";
|
|
66
|
+
//#endregion
|
|
67
|
+
export { AGENT_REQUIRED_KICI_VARS, ALLOWED_SYSTEM_VARS, KICI_AGENT_ENV_PREFIX, SANDBOX_DEFAULT_VARS };
|
|
68
|
+
|
|
69
|
+
//# sourceMappingURL=environment-allowlist.js.map
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export type { Environment, EnvironmentBinding, EnvironmentVariable, EnvironmentSourceOverride, ScopedSecret, HeldRun, ProtectionGateResult, TrustTier, } from './types.js';
|
|
2
|
+
export { resolveSecretsForEnvironment, matchScopePattern, stripScopePrefix, } from './scope-resolver.js';
|
|
3
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { EnvironmentBinding, ScopedSecret } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Check whether a scope string matches a pattern.
|
|
4
|
+
*
|
|
5
|
+
* Supports exact match and glob patterns (via picomatch).
|
|
6
|
+
* Scope paths use '/' as separator (e.g., 'aws/prod/db').
|
|
7
|
+
*
|
|
8
|
+
* For prefixed scopes (e.g., 'pg:aws/prod'), the pattern may be prefixed too
|
|
9
|
+
* (e.g., 'pg:**'). In this case, the backend prefix must match exactly and
|
|
10
|
+
* the path portion is matched separately against the glob. This is needed
|
|
11
|
+
* because picomatch's '**' requires '/' separators — 'pg:**' wouldn't match
|
|
12
|
+
* 'pg:aws/prod' without splitting on the colon.
|
|
13
|
+
*/
|
|
14
|
+
export declare function matchScopePattern(scope: string, pattern: string): boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Strip the backend prefix from a scope string.
|
|
17
|
+
* Prefixed scopes have the form "backendName:path" (e.g., "pg:aws/prod").
|
|
18
|
+
* Returns the path after the first colon, or the full scope if no prefix.
|
|
19
|
+
*/
|
|
20
|
+
export declare function stripScopePrefix(scope: string): string;
|
|
21
|
+
/**
|
|
22
|
+
* Resolve secrets for an environment by matching bindings against scoped secrets.
|
|
23
|
+
*
|
|
24
|
+
* Takes already-filtered bindings (for the target environment). For each binding,
|
|
25
|
+
* finds secrets whose scope matches the binding's scopePattern via picomatch.
|
|
26
|
+
* When multiple scopes provide the same key, longest scope path wins (higher specificity).
|
|
27
|
+
* Scope depth is computed AFTER stripping the backend prefix.
|
|
28
|
+
*
|
|
29
|
+
* @param bindings - Bindings already filtered for the target environment
|
|
30
|
+
* @param allSecrets - All scoped secrets in the org
|
|
31
|
+
* @param decryptFn - Pure decryption function (keeps this module crypto-free)
|
|
32
|
+
* @returns Flat record of decrypted secret key-value pairs
|
|
33
|
+
*/
|
|
34
|
+
export declare function resolveSecretsForEnvironment(bindings: EnvironmentBinding[], allSecrets: ScopedSecret[], decryptFn: (s: ScopedSecret) => string): Record<string, string>;
|
|
35
|
+
//# sourceMappingURL=scope-resolver.d.ts.map
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import "../chunk-gOLHoazu.js";
|
|
2
|
+
import picomatch from "picomatch";
|
|
3
|
+
//#region src/environment/scope-resolver.ts
|
|
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
|
+
function matchScopePattern(scope, pattern) {
|
|
17
|
+
if (scope === pattern) return true;
|
|
18
|
+
const scopeColon = scope.indexOf(":");
|
|
19
|
+
const patternColon = pattern.indexOf(":");
|
|
20
|
+
if (scopeColon >= 0 && patternColon >= 0) {
|
|
21
|
+
if (scope.slice(0, scopeColon) !== pattern.slice(0, patternColon)) return false;
|
|
22
|
+
const scopePath = scope.slice(scopeColon + 1);
|
|
23
|
+
const patternPath = pattern.slice(patternColon + 1);
|
|
24
|
+
if (scopePath === patternPath) return true;
|
|
25
|
+
return picomatch.isMatch(scopePath, patternPath);
|
|
26
|
+
}
|
|
27
|
+
if (scopeColon >= 0 && patternColon < 0) {
|
|
28
|
+
const scopePath = scope.slice(scopeColon + 1);
|
|
29
|
+
if (scopePath === pattern) return true;
|
|
30
|
+
return picomatch.isMatch(scopePath, pattern);
|
|
31
|
+
}
|
|
32
|
+
return picomatch.isMatch(scope, pattern);
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Strip the backend prefix from a scope string.
|
|
36
|
+
* Prefixed scopes have the form "backendName:path" (e.g., "pg:aws/prod").
|
|
37
|
+
* Returns the path after the first colon, or the full scope if no prefix.
|
|
38
|
+
*/
|
|
39
|
+
function stripScopePrefix(scope) {
|
|
40
|
+
const colonIdx = scope.indexOf(":");
|
|
41
|
+
return colonIdx >= 0 ? scope.slice(colonIdx + 1) : scope;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Resolve secrets for an environment by matching bindings against scoped secrets.
|
|
45
|
+
*
|
|
46
|
+
* Takes already-filtered bindings (for the target environment). For each binding,
|
|
47
|
+
* finds secrets whose scope matches the binding's scopePattern via picomatch.
|
|
48
|
+
* When multiple scopes provide the same key, longest scope path wins (higher specificity).
|
|
49
|
+
* Scope depth is computed AFTER stripping the backend prefix.
|
|
50
|
+
*
|
|
51
|
+
* @param bindings - Bindings already filtered for the target environment
|
|
52
|
+
* @param allSecrets - All scoped secrets in the org
|
|
53
|
+
* @param decryptFn - Pure decryption function (keeps this module crypto-free)
|
|
54
|
+
* @returns Flat record of decrypted secret key-value pairs
|
|
55
|
+
*/
|
|
56
|
+
function resolveSecretsForEnvironment(bindings, allSecrets, decryptFn) {
|
|
57
|
+
const candidates = [];
|
|
58
|
+
for (const binding of bindings) for (const secret of allSecrets) if (matchScopePattern(secret.scope, binding.scopePattern)) {
|
|
59
|
+
const scopePath = stripScopePrefix(secret.scope);
|
|
60
|
+
candidates.push({
|
|
61
|
+
secret,
|
|
62
|
+
scopeDepth: scopePath.split("/").length
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
const resolved = /* @__PURE__ */ new Map();
|
|
66
|
+
for (const candidate of candidates) {
|
|
67
|
+
const existing = resolved.get(candidate.secret.key);
|
|
68
|
+
if (!existing || candidate.scopeDepth > existing.scopeDepth) resolved.set(candidate.secret.key, candidate);
|
|
69
|
+
}
|
|
70
|
+
const result = {};
|
|
71
|
+
for (const [key, { secret }] of resolved) result[key] = decryptFn(secret);
|
|
72
|
+
return result;
|
|
73
|
+
}
|
|
74
|
+
//#endregion
|
|
75
|
+
export { matchScopePattern, resolveSecretsForEnvironment, stripScopePrefix };
|
|
76
|
+
|
|
77
|
+
//# sourceMappingURL=scope-resolver.js.map
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Environment types for KiCI's deployment environment model.
|
|
3
|
+
*
|
|
4
|
+
* Environments are org-level entities that group secrets, variables,
|
|
5
|
+
* and protection rules for deployment targets (dev, staging, production).
|
|
6
|
+
*/
|
|
7
|
+
/** Environment entity — org-level deployment target with protection rules. */
|
|
8
|
+
export interface Environment {
|
|
9
|
+
id: string;
|
|
10
|
+
orgId: string;
|
|
11
|
+
name: string;
|
|
12
|
+
type: 'fixed' | 'glob';
|
|
13
|
+
globPattern: string | null;
|
|
14
|
+
branchRestrictions: string[];
|
|
15
|
+
triggerTypeFilters: string[];
|
|
16
|
+
repoPatterns: string[];
|
|
17
|
+
concurrencyLimit: number | null;
|
|
18
|
+
concurrencyStrategy: 'queue' | 'cancel-pending';
|
|
19
|
+
concurrencyTimeoutMs: number;
|
|
20
|
+
requiredReviewers: string[] | null;
|
|
21
|
+
waitTimerSeconds: number | null;
|
|
22
|
+
holdExpirySeconds: number;
|
|
23
|
+
/** Minimum trust tier required for CI execution in this environment. */
|
|
24
|
+
minimumTrust?: 'known' | 'trusted';
|
|
25
|
+
/** Whether this environment allows local (no-remote) executions. Default false. */
|
|
26
|
+
allowLocalExecution?: boolean;
|
|
27
|
+
enabled: boolean;
|
|
28
|
+
createdAt: string;
|
|
29
|
+
updatedAt: string;
|
|
30
|
+
createdBy: string;
|
|
31
|
+
}
|
|
32
|
+
/** Scoped secret — individual secret with a scope path for precedence resolution. */
|
|
33
|
+
export interface ScopedSecret {
|
|
34
|
+
id: string;
|
|
35
|
+
orgId: string;
|
|
36
|
+
scope: string;
|
|
37
|
+
key: string;
|
|
38
|
+
encryptedValue: string;
|
|
39
|
+
backendType: 'pg' | 'vault';
|
|
40
|
+
keyVersion: number;
|
|
41
|
+
createdAt: string;
|
|
42
|
+
updatedAt: string;
|
|
43
|
+
}
|
|
44
|
+
/** Binding that maps a scope pattern to an environment. */
|
|
45
|
+
export interface EnvironmentBinding {
|
|
46
|
+
id: string;
|
|
47
|
+
orgId: string;
|
|
48
|
+
environmentId: string;
|
|
49
|
+
scopePattern: string;
|
|
50
|
+
createdAt: string;
|
|
51
|
+
}
|
|
52
|
+
/** Non-secret key-value config per environment, with optional lock. */
|
|
53
|
+
export interface EnvironmentVariable {
|
|
54
|
+
id: string;
|
|
55
|
+
orgId: string;
|
|
56
|
+
environmentId: string;
|
|
57
|
+
key: string;
|
|
58
|
+
value: string;
|
|
59
|
+
locked: boolean;
|
|
60
|
+
createdAt: string;
|
|
61
|
+
updatedAt: string;
|
|
62
|
+
}
|
|
63
|
+
/** Per-source override for an environment variable. */
|
|
64
|
+
export interface EnvironmentSourceOverride {
|
|
65
|
+
id: string;
|
|
66
|
+
orgId: string;
|
|
67
|
+
environmentId: string;
|
|
68
|
+
routingKey: string;
|
|
69
|
+
key: string;
|
|
70
|
+
value: string;
|
|
71
|
+
createdAt: string;
|
|
72
|
+
updatedAt: string;
|
|
73
|
+
}
|
|
74
|
+
/** Trust tier for contributor-based CI execution gating. */
|
|
75
|
+
export type TrustTier = 'trusted' | 'known' | 'unknown';
|
|
76
|
+
/** Held run record for protection gate enforcement. */
|
|
77
|
+
export interface HeldRun {
|
|
78
|
+
id: string;
|
|
79
|
+
orgId: string;
|
|
80
|
+
runId: string;
|
|
81
|
+
jobId: string;
|
|
82
|
+
environmentId: string;
|
|
83
|
+
holdType: 'reviewer' | 'timer' | 'concurrency' | 'security';
|
|
84
|
+
status: 'pending' | 'approved' | 'rejected' | 'expired';
|
|
85
|
+
reason: string | null;
|
|
86
|
+
approvedBy: string | null;
|
|
87
|
+
createdAt: string;
|
|
88
|
+
expiresAt: string | null;
|
|
89
|
+
resolvedAt: string | null;
|
|
90
|
+
}
|
|
91
|
+
/** Result from the protection gate pipeline evaluation. */
|
|
92
|
+
export interface ProtectionGateResult {
|
|
93
|
+
action: 'pass' | 'reject' | 'hold' | 'queue' | 'wait';
|
|
94
|
+
reason?: string;
|
|
95
|
+
holdUntil?: string;
|
|
96
|
+
holdType?: 'reviewer' | 'timer' | 'concurrency' | 'security';
|
|
97
|
+
}
|
|
98
|
+
//# sourceMappingURL=types.d.ts.map
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @kici-dev/engine - Consolidated business logic for KiCI.
|
|
3
|
+
*
|
|
4
|
+
* Single source of truth for shared logic used across tiers:
|
|
5
|
+
* - Protocol message schemas (Zod-based, direction-specific unions)
|
|
6
|
+
* - Trigger matching engine (branch, path, event evaluation)
|
|
7
|
+
* - Execution state machine (pure function transitions)
|
|
8
|
+
* - Webhook signature verification (HMAC-SHA256)
|
|
9
|
+
* - WebSocket close codes (unified across all tiers)
|
|
10
|
+
*/
|
|
11
|
+
export * from './protocol/version.js';
|
|
12
|
+
export * from './protocol/messages/common.js';
|
|
13
|
+
export * from './protocol/messages/actor.js';
|
|
14
|
+
export * from './protocol/messages/auth.js';
|
|
15
|
+
export * from './protocol/messages/capabilities.js';
|
|
16
|
+
export { webhookRelaySchema, webhookRelayStartSchema, webhookRelayChunkSchema, webhookAckSchema, WebhookRelayResult, WEBHOOK_RELAY_MAX_BODY_BYTES, WEBHOOK_RELAY_CHUNK_SIZE, executionEventSchema, logChunkSchema, peerDiscoverSchema, peerUpdateSchema, cacheStatsSchema, orchMetricsSchema, platformToOrchestratorMessageSchema, orchestratorToPlatformMessageSchema, type WebhookRelay, type WebhookRelayStart, type WebhookRelayChunk, type WebhookAck, type LogChunk, type PeerDiscover, type PeerUpdate, type CacheStats, type OrchMetrics, trustPolicyUpdateSchema, type TrustPolicyUpdate, staleCheckrunCleanupSchema, type StaleCheckrunCleanup, type PlatformToOrchestratorMessage, type OrchestratorToPlatformMessage, } from './protocol/messages/platform-orchestrator.js';
|
|
17
|
+
export * from './protocol/messages/execution-status.js';
|
|
18
|
+
export * from './protocol/messages/event-log.js';
|
|
19
|
+
export * from './protocol/messages/access-log.js';
|
|
20
|
+
export * from './audit/access-log-policy.js';
|
|
21
|
+
export * from './audit/retention-policy.js';
|
|
22
|
+
export * from './audit/activity.js';
|
|
23
|
+
export * from './protocol/messages/log-pull.js';
|
|
24
|
+
export * from './protocol/messages/dashboard.js';
|
|
25
|
+
export * from './protocol/event-log-payload.js';
|
|
26
|
+
export * from './protocol/messages/browser.js';
|
|
27
|
+
export * from './protocol/messages/run-events.js';
|
|
28
|
+
export { sourceRegistrationSchema, sourceRegistrationAckSchema, sourceDeregisterSchema, sourceDeregisterAckSchema, SourceSubtype, SourceProvider, type SourceRegistration, type SourceRegistrationAck, type SourceDeregister, type SourceDeregisterAck, } from './protocol/messages/source-registration.js';
|
|
29
|
+
export * from './protocol/messages/join.js';
|
|
30
|
+
export * from './protocol/messages/peer.js';
|
|
31
|
+
export * from './protocol/messages/orchestrator-agent.js';
|
|
32
|
+
export * from './protocol/messages/test-run.js';
|
|
33
|
+
export * from './protocol/messages/observe.js';
|
|
34
|
+
export * from './trigger/types.js';
|
|
35
|
+
export * from './trigger/trigger-event-type.js';
|
|
36
|
+
export * from './trigger/decision-trace.js';
|
|
37
|
+
export * from './trigger/matcher.js';
|
|
38
|
+
export * from './state-machine/index.js';
|
|
39
|
+
export * from './provider/index.js';
|
|
40
|
+
export type { WsLike } from './ws/ws-like.js';
|
|
41
|
+
export * from './ws/close-codes.js';
|
|
42
|
+
export { WsRateLimiter } from './ws/rate-limiter.js';
|
|
43
|
+
export type { RateLimiterConfig, RateLimitResult } from './ws/rate-limiter.js';
|
|
44
|
+
export * from './env/environment-allowlist.js';
|
|
45
|
+
export * from './secrets/index.js';
|
|
46
|
+
export * from './environment/index.js';
|
|
47
|
+
export { deriveOsArchLabels, hostLabel, agentTypeLabel, scalerLabel, mergeAutoLabels, normalizeRunsOn, KNOWN_ROLES, resolveRoleLabels, validateNoReservedLabels, } from './labels.js';
|
|
48
|
+
export type { NormalizedRunsOn } from './labels.js';
|
|
49
|
+
export type { AgentRole } from './labels.js';
|
|
50
|
+
export * from './scaler/scaler-backend-type.js';
|
|
51
|
+
export * from './scaler/resource-types.js';
|
|
52
|
+
export * from './registration/registerable-trigger-type.js';
|
|
53
|
+
export * from './bundler/index.js';
|
|
54
|
+
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import "./chunk-gOLHoazu.js";
|
|
2
|
+
import { MIN_PROTOCOL_VERSION, PROTOCOL_VERSION } from "./protocol/version.js";
|
|
3
|
+
import { WS_MAX_PAYLOAD_BYTES, ackSchema, errorSchema, heartbeatSchema, nackSchema } from "./protocol/messages/common.js";
|
|
4
|
+
import { ActorType, actorPrincipalSchema, apiKeyActorSchema, flattenActor, parseActor, platformOperatorActorSchema, serviceAccountActorSchema, stringifyActor, systemActorSchema, userActorSchema } from "./protocol/messages/actor.js";
|
|
5
|
+
import { ORCH_CAPABILITIES, OrchRole, hasOrchCapability, orchCapabilitiesSchema } from "./protocol/messages/capabilities.js";
|
|
6
|
+
import { authFailureSchema, authRequestSchema, authSuccessSchema } from "./protocol/messages/auth.js";
|
|
7
|
+
import { ExecutionJobStatus, ExecutionRunStatus, ExecutionStepStatus, TERMINAL_JOB_STATES, TERMINAL_RUN_STATES, executionStatusSchema, jobStatusForwardSchema, stateReplaySchema, stepStatusForwardSchema } from "./protocol/messages/execution-status.js";
|
|
8
|
+
import { SourceProvider, SourceSubtype, sourceDeregisterAckSchema, sourceDeregisterSchema, sourceRegistrationAckSchema, sourceRegistrationSchema } from "./protocol/messages/source-registration.js";
|
|
9
|
+
import { AccessLogAction, AccessLogOutcome, AccessLogSource, AccessLogTargetType, accessLogFilterSchema, accessLogItemSchema, dashboardAccessLogListRequestSchema, dashboardAccessLogListResponseSchema } from "./protocol/messages/access-log.js";
|
|
10
|
+
import { browserJobContextSchema, browserRunEventSchema, dashboardOrchLogsRequestSchema, dashboardOrchLogsResponseSchema, jobContextMessageSchema, runEventMessageSchema } from "./protocol/messages/run-events.js";
|
|
11
|
+
import { EventLogSource, EventLogStatus, PayloadOmittedReason } from "./protocol/messages/event-log.js";
|
|
12
|
+
import { EventLogPayloadStreamError, HeldRunQueueType, HeldRunStatus, backendGetRequestSchema, backendGetResponseSchema, backendItemSchema, backendSyncRequestSchema, backendSyncResponseSchema, backendTestRequestSchema, backendTestResponseSchema, backendsListRequestSchema, backendsListResponseSchema, backendsSyncAllRequestSchema, backendsSyncAllResponseSchema, browserEventLogPayloadChunkSchema, dashboardDiagnosticsRequestSchema, dashboardDiagnosticsResponseSchema, dashboardEventLogDetailRequestSchema, dashboardEventLogListRequestSchema, dashboardEventLogPayloadChunkSchema, dashboardEventLogPayloadStreamRequestSchema, dashboardJobDetailSchema, dashboardOrchToPlatformSchema, dashboardPayloadRequestSchema, dashboardPlatformToOrchSchema, dashboardRunDetailApiResponseSchema, dashboardRunDetailRequestSchema, dashboardRunDetailResponseSchema, dashboardScalerAgentsRequestSchema, dashboardScalerAgentsResponseSchema, dashboardScalerCapacityRequestSchema, dashboardScalerCapacityResponseSchema, dashboardStepLogsApiResponseSchema, dashboardStepLogsRequestSchema, dashboardStepLogsResponseSchema, envBindingsListRequestSchema, envBindingsSetRequestSchema, envCreateRequestSchema, envDeleteRequestSchema, envGetRequestSchema, envHistoryRequestSchema, envListRequestSchema, envSecretDeleteRequestSchema, envSecretScopeCreateRequestSchema, envSecretScopeDeleteRequestSchema, envSecretScopeRenameRequestSchema, envSecretSetRequestSchema, envSecretsListRequestSchema, envSourceOverrideDeleteRequestSchema, envSourceOverrideSetRequestSchema, envSourceOverridesListRequestSchema, envUpdateRequestSchema, envVarDeleteRequestSchema, envVarSetRequestSchema, envVarsListRequestSchema, eventLogListItemSchema, heldRunApproveRequestSchema, heldRunRejectRequestSchema, heldRunsListRequestSchema, identityLinkItemSchema, identityLinkListResponseSchema, manualScheduleRequestSchema, memberIdentityLinkSchema, memberListResponseSchema, memberRoleAssignmentSchema, orgMemberSchema, registrationDeleteRequestSchema, registrationDisableRequestSchema, registrationItemSchema, registrationsListRequestSchema, registrationsListResponseSchema, runCancelRequestSchema, runEventSchema, runLineageResponseSchema, runRerunRequestSchema, trustPolicyResponseSchema } from "./protocol/messages/dashboard.js";
|
|
13
|
+
import { WEBHOOK_RELAY_CHUNK_SIZE, WEBHOOK_RELAY_MAX_BODY_BYTES, WebhookRelayResult, cacheStatsSchema, executionEventSchema, logChunkSchema, orchMetricsSchema, orchestratorToPlatformMessageSchema, peerDiscoverSchema, peerUpdateSchema, platformToOrchestratorMessageSchema, staleCheckrunCleanupSchema, trustPolicyUpdateSchema, webhookAckSchema, webhookRelayChunkSchema, webhookRelaySchema, webhookRelayStartSchema } from "./protocol/messages/platform-orchestrator.js";
|
|
14
|
+
import { AccessLogPolicyKind, POLICY_BY_ACTION, fnv1a32, shouldRecordAccess, shouldRecordSecretResolve } from "./audit/access-log-policy.js";
|
|
15
|
+
import { ACCESS_LOG_COLD_DAYS, ACCESS_LOG_WARM_DAYS, accessLogWarmSqlCase, auditLogColdDays, auditLogWarmDays, auditLogWarmSqlCase, getAccessLogColdDays, getAccessLogWarmDays, getAuditLogColdDays, getAuditLogWarmDays, getSecretAuditLogColdDays, getSecretAuditLogWarmDays, minAccessLogWarmDays, minAuditLogWarmDays, minSecretAuditLogWarmDays, secretAuditLogColdDays, secretAuditLogWarmDays, secretAuditLogWarmSqlCase } from "./audit/retention-policy.js";
|
|
16
|
+
import { ActivityFilterSource, ActivityRowSource, activityCursorSchema, activityFilterSchema, activityRowSchema, decodeActivityCursor, encodeActivityCursor, resolveRunIdSugar } from "./audit/activity.js";
|
|
17
|
+
import { logPullOrchToPlatformSchema, logPullPlatformToOrchSchema } from "./protocol/messages/log-pull.js";
|
|
18
|
+
import { EVENT_LOG_PAYLOAD_CHUNK_BYTES } from "./protocol/event-log-payload.js";
|
|
19
|
+
import { browserAuthFailureSchema, browserAuthRefreshSchema, browserAuthRequestSchema, browserAuthSuccessSchema, browserErrorSchema, browserEventLogPayloadFetchSchema, browserGapSchema, browserJobNewSchema, browserJobStatusSchema, browserLogLinesSchema, browserLogStreamTerminatedReason, browserLogStreamTerminatedSchema, browserLogSubscribeSchema, browserLogUnsubscribeSchema, browserPingSchema, browserPongSchema, browserRunNewSchema, browserRunStatusSchema, browserStatusSubscribeSchema, browserStatusUnsubscribeSchema, browserStepStatusSchema, browserToPlatformMessageSchema, platformToBrowserMessageSchema } from "./protocol/messages/browser.js";
|
|
20
|
+
import { joinRequestSchema, joinResponseSchema } from "./protocol/messages/join.js";
|
|
21
|
+
import { jobProgressSchema, jobRerouteAckSchema, jobRerouteSchema, peerAgentTokenRevokeSchema, peerAuthRequestSchema, peerAuthResponseSchema, peerCapabilitiesSchema, peerConfigReloadResponseSchema, peerConfigReloadSchema, peerFromPeerMessageSchema, peerHeartbeatSchema, peerHelloResponseSchema, peerHelloSchema, peerJobCancelSchema, peerLeavingSchema, peerToPeerMessageSchema, raftAppendEntriesSchema, raftVoteRequestSchema, raftVoteResponseSchema } from "./protocol/messages/peer.js";
|
|
22
|
+
import { agentApiRequestSchema, agentApiResponseSchema, agentAuthFailureSchema, agentAuthRequestSchema, agentAuthSuccessSchema, agentLogChunkSchema, agentMetricsSchema, agentRegisterSchema, agentStatusSchema, agentStepStatusSchema, agentToOrchestratorMessageSchema, configAckSchema, eventEmitResponseSchema, eventEmitSchema, gitAuthSchema, jobCancelSchema, jobConcurrencyAckSchema, jobConcurrencyReportSchema, jobDispatchSchema, jobStatusSchema, orchestratorToAgentMessageSchema, registerAckSchema } from "./protocol/messages/orchestrator-agent.js";
|
|
23
|
+
import { testCancelResponseSchema, testCancelSchema, testEventSchema, testTriggerResponseSchema, testTriggerSchema } from "./protocol/messages/test-run.js";
|
|
24
|
+
import { observeCompleteSchema, observeLogSchema, observeStatusSchema, observeStepSchema, observeSubscribeSchema } from "./protocol/messages/observe.js";
|
|
25
|
+
import { NeedsEntrySchema, NeedsGroupEntrySchema, SCHEMA_VERSION, isLockDynamicJobFn, isLockInlineValue, isLockStaticJob } from "./trigger/types.js";
|
|
26
|
+
import { TRIGGER_EVENT_META, TRIGGER_EVENT_TYPES } from "./trigger/trigger-event-type.js";
|
|
27
|
+
import { createTraceEntry, createWorkflowDecision } from "./trigger/decision-trace.js";
|
|
28
|
+
import { matchAllWorkflows, matchBranchPattern, matchPathPatterns, matchRepoPatterns, matchWorkflowTriggers } from "./trigger/matcher.js";
|
|
29
|
+
import { isTerminal, transition } from "./state-machine/machine.js";
|
|
30
|
+
import "./state-machine/index.js";
|
|
31
|
+
import { CheckRunConclusion } from "./provider/check-run-conclusion.js";
|
|
32
|
+
import "./provider/index.js";
|
|
33
|
+
import { WS_CLOSE_AGENT_AUTH_FAILED, WS_CLOSE_AUTH_TIMEOUT, WS_CLOSE_GOING_AWAY, WS_CLOSE_HEARTBEAT_TIMEOUT, WS_CLOSE_INTERNAL_ERROR, WS_CLOSE_INVALID_MESSAGE, WS_CLOSE_PLAN_LIMIT, WS_CLOSE_PROTOCOL_ERROR, WS_CLOSE_RUN_NOT_FOUND, WS_CLOSE_UNAUTHORIZED } from "./ws/close-codes.js";
|
|
34
|
+
import { WsRateLimiter } from "./ws/rate-limiter.js";
|
|
35
|
+
import { AGENT_REQUIRED_KICI_VARS, ALLOWED_SYSTEM_VARS, KICI_AGENT_ENV_PREFIX, SANDBOX_DEFAULT_VARS } from "./env/environment-allowlist.js";
|
|
36
|
+
import "./secrets/index.js";
|
|
37
|
+
import { matchScopePattern, resolveSecretsForEnvironment, stripScopePrefix } from "./environment/scope-resolver.js";
|
|
38
|
+
import "./environment/index.js";
|
|
39
|
+
import { KNOWN_ROLES, agentTypeLabel, deriveOsArchLabels, hostLabel, mergeAutoLabels, normalizeRunsOn, resolveRoleLabels, scalerLabel, validateNoReservedLabels } from "./labels.js";
|
|
40
|
+
import { ScalerBackendType } from "./scaler/scaler-backend-type.js";
|
|
41
|
+
import { parseMemoryString, resourceRequestNestedSchema, resourceSpecSchema, validateResourceRequest } from "./scaler/resource-types.js";
|
|
42
|
+
import { RegisterableTriggerType } from "./registration/registerable-trigger-type.js";
|
|
43
|
+
import { createWorkflowBundleConfig } from "./bundler/rolldown-config.js";
|
|
44
|
+
import "./bundler/index.js";
|
|
45
|
+
export { ACCESS_LOG_COLD_DAYS, ACCESS_LOG_WARM_DAYS, AGENT_REQUIRED_KICI_VARS, ALLOWED_SYSTEM_VARS, AccessLogAction, AccessLogOutcome, AccessLogPolicyKind, AccessLogSource, AccessLogTargetType, ActivityFilterSource, ActivityRowSource, ActorType, CheckRunConclusion, EVENT_LOG_PAYLOAD_CHUNK_BYTES, EventLogPayloadStreamError, EventLogSource, EventLogStatus, ExecutionJobStatus, ExecutionRunStatus, ExecutionStepStatus, HeldRunQueueType, HeldRunStatus, KICI_AGENT_ENV_PREFIX, KNOWN_ROLES, MIN_PROTOCOL_VERSION, NeedsEntrySchema, NeedsGroupEntrySchema, ORCH_CAPABILITIES, OrchRole, POLICY_BY_ACTION, PROTOCOL_VERSION, PayloadOmittedReason, RegisterableTriggerType, SANDBOX_DEFAULT_VARS, SCHEMA_VERSION, ScalerBackendType, SourceProvider, SourceSubtype, TERMINAL_JOB_STATES, TERMINAL_RUN_STATES, TRIGGER_EVENT_META, TRIGGER_EVENT_TYPES, WEBHOOK_RELAY_CHUNK_SIZE, WEBHOOK_RELAY_MAX_BODY_BYTES, WS_CLOSE_AGENT_AUTH_FAILED, WS_CLOSE_AUTH_TIMEOUT, WS_CLOSE_GOING_AWAY, WS_CLOSE_HEARTBEAT_TIMEOUT, WS_CLOSE_INTERNAL_ERROR, WS_CLOSE_INVALID_MESSAGE, WS_CLOSE_PLAN_LIMIT, WS_CLOSE_PROTOCOL_ERROR, WS_CLOSE_RUN_NOT_FOUND, WS_CLOSE_UNAUTHORIZED, WS_MAX_PAYLOAD_BYTES, WebhookRelayResult, WsRateLimiter, accessLogFilterSchema, accessLogItemSchema, accessLogWarmSqlCase, ackSchema, activityCursorSchema, activityFilterSchema, activityRowSchema, actorPrincipalSchema, agentApiRequestSchema, agentApiResponseSchema, agentAuthFailureSchema, agentAuthRequestSchema, agentAuthSuccessSchema, agentLogChunkSchema, agentMetricsSchema, agentRegisterSchema, agentStatusSchema, agentStepStatusSchema, agentToOrchestratorMessageSchema, agentTypeLabel, apiKeyActorSchema, auditLogColdDays, auditLogWarmDays, auditLogWarmSqlCase, authFailureSchema, authRequestSchema, authSuccessSchema, backendGetRequestSchema, backendGetResponseSchema, backendItemSchema, backendSyncRequestSchema, backendSyncResponseSchema, backendTestRequestSchema, backendTestResponseSchema, backendsListRequestSchema, backendsListResponseSchema, backendsSyncAllRequestSchema, backendsSyncAllResponseSchema, browserAuthFailureSchema, browserAuthRefreshSchema, browserAuthRequestSchema, browserAuthSuccessSchema, browserErrorSchema, browserEventLogPayloadChunkSchema, browserEventLogPayloadFetchSchema, browserGapSchema, browserJobContextSchema, browserJobNewSchema, browserJobStatusSchema, browserLogLinesSchema, browserLogStreamTerminatedReason, browserLogStreamTerminatedSchema, browserLogSubscribeSchema, browserLogUnsubscribeSchema, browserPingSchema, browserPongSchema, browserRunEventSchema, browserRunNewSchema, browserRunStatusSchema, browserStatusSubscribeSchema, browserStatusUnsubscribeSchema, browserStepStatusSchema, browserToPlatformMessageSchema, cacheStatsSchema, configAckSchema, createTraceEntry, createWorkflowBundleConfig, createWorkflowDecision, dashboardAccessLogListRequestSchema, dashboardAccessLogListResponseSchema, dashboardDiagnosticsRequestSchema, dashboardDiagnosticsResponseSchema, dashboardEventLogDetailRequestSchema, dashboardEventLogListRequestSchema, dashboardEventLogPayloadChunkSchema, dashboardEventLogPayloadStreamRequestSchema, dashboardJobDetailSchema, dashboardOrchLogsRequestSchema, dashboardOrchLogsResponseSchema, dashboardOrchToPlatformSchema, dashboardPayloadRequestSchema, dashboardPlatformToOrchSchema, dashboardRunDetailApiResponseSchema, dashboardRunDetailRequestSchema, dashboardRunDetailResponseSchema, dashboardScalerAgentsRequestSchema, dashboardScalerAgentsResponseSchema, dashboardScalerCapacityRequestSchema, dashboardScalerCapacityResponseSchema, dashboardStepLogsApiResponseSchema, dashboardStepLogsRequestSchema, dashboardStepLogsResponseSchema, decodeActivityCursor, deriveOsArchLabels, encodeActivityCursor, envBindingsListRequestSchema, envBindingsSetRequestSchema, envCreateRequestSchema, envDeleteRequestSchema, envGetRequestSchema, envHistoryRequestSchema, envListRequestSchema, envSecretDeleteRequestSchema, envSecretScopeCreateRequestSchema, envSecretScopeDeleteRequestSchema, envSecretScopeRenameRequestSchema, envSecretSetRequestSchema, envSecretsListRequestSchema, envSourceOverrideDeleteRequestSchema, envSourceOverrideSetRequestSchema, envSourceOverridesListRequestSchema, envUpdateRequestSchema, envVarDeleteRequestSchema, envVarSetRequestSchema, envVarsListRequestSchema, errorSchema, eventEmitResponseSchema, eventEmitSchema, eventLogListItemSchema, executionEventSchema, executionStatusSchema, flattenActor, fnv1a32, getAccessLogColdDays, getAccessLogWarmDays, getAuditLogColdDays, getAuditLogWarmDays, getSecretAuditLogColdDays, getSecretAuditLogWarmDays, gitAuthSchema, hasOrchCapability, heartbeatSchema, heldRunApproveRequestSchema, heldRunRejectRequestSchema, heldRunsListRequestSchema, hostLabel, identityLinkItemSchema, identityLinkListResponseSchema, isLockDynamicJobFn, isLockInlineValue, isLockStaticJob, isTerminal, jobCancelSchema, jobConcurrencyAckSchema, jobConcurrencyReportSchema, jobContextMessageSchema, jobDispatchSchema, jobProgressSchema, jobRerouteAckSchema, jobRerouteSchema, jobStatusForwardSchema, jobStatusSchema, joinRequestSchema, joinResponseSchema, logChunkSchema, logPullOrchToPlatformSchema, logPullPlatformToOrchSchema, manualScheduleRequestSchema, matchAllWorkflows, matchBranchPattern, matchPathPatterns, matchRepoPatterns, matchScopePattern, matchWorkflowTriggers, memberIdentityLinkSchema, memberListResponseSchema, memberRoleAssignmentSchema, mergeAutoLabels, minAccessLogWarmDays, minAuditLogWarmDays, minSecretAuditLogWarmDays, nackSchema, normalizeRunsOn, observeCompleteSchema, observeLogSchema, observeStatusSchema, observeStepSchema, observeSubscribeSchema, orchCapabilitiesSchema, orchMetricsSchema, orchestratorToAgentMessageSchema, orchestratorToPlatformMessageSchema, orgMemberSchema, parseActor, parseMemoryString, peerAgentTokenRevokeSchema, peerAuthRequestSchema, peerAuthResponseSchema, peerCapabilitiesSchema, peerConfigReloadResponseSchema, peerConfigReloadSchema, peerDiscoverSchema, peerFromPeerMessageSchema, peerHeartbeatSchema, peerHelloResponseSchema, peerHelloSchema, peerJobCancelSchema, peerLeavingSchema, peerToPeerMessageSchema, peerUpdateSchema, platformOperatorActorSchema, platformToBrowserMessageSchema, platformToOrchestratorMessageSchema, raftAppendEntriesSchema, raftVoteRequestSchema, raftVoteResponseSchema, registerAckSchema, registrationDeleteRequestSchema, registrationDisableRequestSchema, registrationItemSchema, registrationsListRequestSchema, registrationsListResponseSchema, resolveRoleLabels, resolveRunIdSugar, resolveSecretsForEnvironment, resourceRequestNestedSchema, resourceSpecSchema, runCancelRequestSchema, runEventMessageSchema, runEventSchema, runLineageResponseSchema, runRerunRequestSchema, scalerLabel, secretAuditLogColdDays, secretAuditLogWarmDays, secretAuditLogWarmSqlCase, serviceAccountActorSchema, shouldRecordAccess, shouldRecordSecretResolve, sourceDeregisterAckSchema, sourceDeregisterSchema, sourceRegistrationAckSchema, sourceRegistrationSchema, staleCheckrunCleanupSchema, stateReplaySchema, stepStatusForwardSchema, stringifyActor, stripScopePrefix, systemActorSchema, testCancelResponseSchema, testCancelSchema, testEventSchema, testTriggerResponseSchema, testTriggerSchema, transition, trustPolicyResponseSchema, trustPolicyUpdateSchema, userActorSchema, validateNoReservedLabels, validateResourceRequest, webhookAckSchema, webhookRelayChunkSchema, webhookRelaySchema, webhookRelayStartSchema };
|
package/dist/labels.d.ts
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Structured auto-labels with category prefixes.
|
|
3
|
+
*
|
|
4
|
+
* Auto-labels are injected into agent label sets so that workflows can target
|
|
5
|
+
* specific platforms, architectures, scaler types, hosts, etc. without
|
|
6
|
+
* requiring manual label configuration.
|
|
7
|
+
*
|
|
8
|
+
* All auto-labels use the `kici:` namespace prefix to distinguish them from
|
|
9
|
+
* user-defined labels. Users cannot set labels with this prefix.
|
|
10
|
+
*
|
|
11
|
+
* Categories:
|
|
12
|
+
* kici:os: — operating system (kici:os:linux, kici:os:macos, kici:os:windows)
|
|
13
|
+
* kici:arch: — CPU architecture (kici:arch:x64, kici:arch:amd64, kici:arch:arm64)
|
|
14
|
+
* kici:agent: — scaler/execution backend type (kici:agent:container, kici:agent:bare-metal, kici:agent:firecracker)
|
|
15
|
+
* kici:scaler: — scaler backend name (kici:scaler:stg-container, kici:scaler:prod-firecracker)
|
|
16
|
+
* kici:host: — hostname of the machine running the agent (kici:host:<hostname>)
|
|
17
|
+
* kici:role: — agent role (kici:role:builder, kici:role:init-runner)
|
|
18
|
+
*
|
|
19
|
+
* Platform mapping (os.platform() → kici:os: labels):
|
|
20
|
+
* 'linux' → ['kici:os:linux']
|
|
21
|
+
* 'darwin' → ['kici:os:macos', 'kici:os:darwin']
|
|
22
|
+
* 'win32' → ['kici:os:windows', 'kici:os:win32']
|
|
23
|
+
*
|
|
24
|
+
* Architecture mapping (os.arch() → kici:arch: labels):
|
|
25
|
+
* 'x64' → ['kici:arch:x64', 'kici:arch:amd64']
|
|
26
|
+
* 'arm64' → ['kici:arch:arm64']
|
|
27
|
+
* other → ['kici:arch:{value}']
|
|
28
|
+
*/
|
|
29
|
+
/**
|
|
30
|
+
* Derive kici:os: and kici:arch: labels from platform and architecture strings.
|
|
31
|
+
*/
|
|
32
|
+
export declare function deriveOsArchLabels(platform: string, arch: string): string[];
|
|
33
|
+
/**
|
|
34
|
+
* Build a kici:host: label from a hostname.
|
|
35
|
+
*/
|
|
36
|
+
export declare function hostLabel(hostname: string): string;
|
|
37
|
+
/**
|
|
38
|
+
* Build a kici:agent: label from the scaler backend type.
|
|
39
|
+
*/
|
|
40
|
+
export declare function agentTypeLabel(backendType: string): string;
|
|
41
|
+
/**
|
|
42
|
+
* Build a kici:scaler: label from the scaler backend name.
|
|
43
|
+
*/
|
|
44
|
+
export declare function scalerLabel(backendName: string): string;
|
|
45
|
+
/**
|
|
46
|
+
* Merges explicit labels with auto-derived structured labels.
|
|
47
|
+
* Deduplicates the result.
|
|
48
|
+
*/
|
|
49
|
+
export declare function mergeAutoLabels(labels: string[], autoLabels: string[]): string[];
|
|
50
|
+
/**
|
|
51
|
+
* Normalized runsOn result with labels and exclude arrays.
|
|
52
|
+
*/
|
|
53
|
+
export interface NormalizedRunsOn {
|
|
54
|
+
labels: string[];
|
|
55
|
+
exclude: string[];
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Normalize the polymorphic runsOn value into a consistent object form.
|
|
59
|
+
* Accepts string, string[], or { labels, exclude? } object.
|
|
60
|
+
*/
|
|
61
|
+
export declare function normalizeRunsOn(runsOn: string | string[] | {
|
|
62
|
+
labels: string | string[];
|
|
63
|
+
exclude?: string | string[];
|
|
64
|
+
}): NormalizedRunsOn;
|
|
65
|
+
/**
|
|
66
|
+
* Known agent roles that grant capabilities beyond basic execution.
|
|
67
|
+
* - builder: can run __build__ jobs (dependency cache compilation)
|
|
68
|
+
* - init-runner: can run __init__ jobs (workspace initialization)
|
|
69
|
+
*/
|
|
70
|
+
export declare const KNOWN_ROLES: readonly ["builder", "init-runner"];
|
|
71
|
+
/** Agent role type derived from KNOWN_ROLES. */
|
|
72
|
+
export type AgentRole = (typeof KNOWN_ROLES)[number];
|
|
73
|
+
/** Reserved label prefix — labels starting with this are system-managed. */
|
|
74
|
+
export declare const RESERVED_LABEL_PREFIX = "kici:";
|
|
75
|
+
/** Role label prefix — used to generate role-specific labels. */
|
|
76
|
+
export declare const ROLE_LABEL_PREFIX = "kici:role:";
|
|
77
|
+
/**
|
|
78
|
+
* Convert a role name to its corresponding label.
|
|
79
|
+
*/
|
|
80
|
+
export declare function roleToLabel(role: AgentRole): string;
|
|
81
|
+
/**
|
|
82
|
+
* Resolve a roles configuration into role labels.
|
|
83
|
+
*
|
|
84
|
+
* - undefined → all roles (backward compat: existing agents get all capabilities)
|
|
85
|
+
* - [] → no roles (execution-only agent)
|
|
86
|
+
* - ['all'] → all roles (explicit opt-in to all)
|
|
87
|
+
* - ['builder'] → specific role labels only
|
|
88
|
+
*/
|
|
89
|
+
export declare function resolveRoleLabels(roles: readonly string[] | undefined): string[];
|
|
90
|
+
/**
|
|
91
|
+
* Validate that no labels use the reserved kici: prefix.
|
|
92
|
+
* Throws if any reserved labels are found (case-insensitive check).
|
|
93
|
+
*/
|
|
94
|
+
export declare function validateNoReservedLabels(labels: string[], source: string): void;
|
|
95
|
+
/**
|
|
96
|
+
* Check if a label is an auto-generated system label (has the kici: prefix).
|
|
97
|
+
*/
|
|
98
|
+
export declare function isAutoLabel(label: string): boolean;
|
|
99
|
+
/**
|
|
100
|
+
* Separate labels into user-defined and auto-generated (kici: prefixed) groups.
|
|
101
|
+
*/
|
|
102
|
+
export declare function separateLabels(labels: string[]): {
|
|
103
|
+
userLabels: string[];
|
|
104
|
+
autoLabels: string[];
|
|
105
|
+
};
|
|
106
|
+
//# sourceMappingURL=labels.d.ts.map
|