@kici-dev/engine 0.6.1 → 0.7.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/audit/access-log-policy.js +1 -0
- package/dist/audit/retention-policy.js +2 -0
- package/dist/billing/subscription-status.d.ts +38 -0
- package/dist/billing/subscription-status.js +63 -0
- package/dist/context/host-match.d.ts +25 -2
- package/dist/context/host-match.js +29 -7
- package/dist/index.d.ts +6 -1
- package/dist/index.js +10 -5
- package/dist/labels/compile.d.ts +3 -1
- package/dist/labels/compile.js +10 -5
- package/dist/labels-canonical.d.ts +36 -0
- package/dist/labels-canonical.js +21 -0
- package/dist/labels-match.d.ts +38 -7
- package/dist/labels-match.js +45 -9
- package/dist/metrics/catalog-policy.js +6 -1
- package/dist/metrics/metric-catalog.generated.d.ts +97 -2
- package/dist/metrics/metric-catalog.generated.js +116 -2
- package/dist/protocol/dashboard-write-operations.d.ts +17 -0
- package/dist/protocol/dashboard-write-operations.js +20 -3
- package/dist/protocol/messages/access-log.d.ts +5 -0
- package/dist/protocol/messages/access-log.js +1 -0
- package/dist/protocol/messages/config-paths.d.ts +20 -0
- package/dist/protocol/messages/config-paths.js +27 -0
- package/dist/protocol/messages/dashboard.d.ts +134 -0
- package/dist/protocol/messages/dashboard.js +68 -1
- package/dist/protocol/messages/event-log.d.ts +6 -0
- package/dist/protocol/messages/event-log.js +6 -0
- package/dist/protocol/messages/orchestrator-agent.d.ts +32 -0
- package/dist/protocol/messages/orchestrator-agent.js +52 -5
- package/dist/protocol/messages/peer.d.ts +3 -0
- package/dist/protocol/messages/peer.js +6 -1
- package/dist/protocol/messages/platform-orchestrator.d.ts +36 -0
- package/dist/protocol/messages/source-registration.d.ts +5 -0
- package/dist/protocol/messages/source-registration.js +8 -0
- package/dist/provenance/id-token-event-claims.d.ts +142 -0
- package/dist/provenance/id-token-event-claims.js +113 -0
- package/dist/provenance/statement-hash.d.ts +14 -5
- package/dist/provenance/statement-hash.js +14 -5
- package/dist/provenance/verify.d.ts +21 -0
- package/dist/provenance/verify.js +26 -16
- package/dist/regex-flags.d.ts +32 -0
- package/dist/regex-flags.js +43 -0
- package/dist/trigger/compiled-matchers.d.ts +9 -2
- package/dist/trigger/compiled-matchers.js +14 -5
- package/dist/trigger/decision-trace.d.ts +1 -1
- package/dist/trigger/decision-trace.js +1 -1
- package/dist/trigger/text-match.d.ts +8 -3
- package/dist/trigger/text-match.js +11 -5
- package/dist/trigger/trigger-event-type.d.ts +16 -0
- package/dist/trigger/trigger-event-type.js +25 -1
- package/dist/trigger/types.d.ts +55 -4
- package/dist/trigger/types.js +5 -1
- package/dist/ws/close-codes.d.ts +8 -0
- package/dist/ws/close-codes.js +9 -1
- package/package.json +1 -1
- package/sbom.spdx.json +5 -5
package/dist/labels-match.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import "./rolldown-runtime-ClRpJifh.js";
|
|
2
|
+
import { canonicalizeLabel } from "./labels-canonical.js";
|
|
3
|
+
import { stripStatefulRegexFlags } from "./regex-flags.js";
|
|
2
4
|
import { z } from "zod";
|
|
3
5
|
//#region src/labels-match.ts
|
|
4
6
|
/**
|
|
@@ -17,12 +19,21 @@ const LabelMatcher = z.discriminatedUnion("kind", [z.object({
|
|
|
17
19
|
flags: z.string()
|
|
18
20
|
})]);
|
|
19
21
|
const regexCache = /* @__PURE__ */ new Map();
|
|
20
|
-
/**
|
|
22
|
+
/**
|
|
23
|
+
* Compile (and cache) the `RegExp` for a regex matcher.
|
|
24
|
+
*
|
|
25
|
+
* `g` and `y` are stripped before compiling and before building the memo key.
|
|
26
|
+
* They are worse than useless here: `matcherSatisfiedBy` below loops `.test()`
|
|
27
|
+
* over a label *set*, so one successful match would leave `lastIndex` pointing
|
|
28
|
+
* into the middle of the next label. Stripping at the reader also tolerates a
|
|
29
|
+
* lock file written by a compiler that predates the producer-side strip.
|
|
30
|
+
*/
|
|
21
31
|
function compileRegexMatcher(m) {
|
|
22
|
-
const
|
|
32
|
+
const flags = stripStatefulRegexFlags(m.flags);
|
|
33
|
+
const key = `${flags} ${m.source}`;
|
|
23
34
|
let re = regexCache.get(key);
|
|
24
35
|
if (!re) {
|
|
25
|
-
re = new RegExp(m.source,
|
|
36
|
+
re = new RegExp(m.source, flags);
|
|
26
37
|
regexCache.set(key, re);
|
|
27
38
|
}
|
|
28
39
|
return re;
|
|
@@ -31,7 +42,32 @@ function compileRegexMatcher(m) {
|
|
|
31
42
|
function matcherMatches(m, label) {
|
|
32
43
|
return m.kind === "exact" ? label === m.value : compileRegexMatcher(m).test(label);
|
|
33
44
|
}
|
|
34
|
-
/**
|
|
45
|
+
/**
|
|
46
|
+
* Fold a matcher into the canonical matching domain.
|
|
47
|
+
*
|
|
48
|
+
* `exact` values lowercase directly. A regex source CANNOT be lowercased
|
|
49
|
+
* without corrupting the pattern (character classes, escapes, anchors), so the
|
|
50
|
+
* `i` flag carries the fold instead. This is the ONLY place `i` is added:
|
|
51
|
+
* `compileRegexMatcher` must stay flag-faithful because `matchHostPattern`
|
|
52
|
+
* uses it to match agent IDs, which are not labels.
|
|
53
|
+
*/
|
|
54
|
+
function canonicalizeMatcher(m) {
|
|
55
|
+
let folded;
|
|
56
|
+
if (m.kind === "exact") folded = {
|
|
57
|
+
kind: "exact",
|
|
58
|
+
value: canonicalizeLabel(m.value)
|
|
59
|
+
};
|
|
60
|
+
else {
|
|
61
|
+
const flags = stripStatefulRegexFlags(m.flags);
|
|
62
|
+
folded = {
|
|
63
|
+
kind: "regex",
|
|
64
|
+
source: m.source,
|
|
65
|
+
flags: flags.includes("i") ? flags : `${flags}i`
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
return folded;
|
|
69
|
+
}
|
|
70
|
+
/** Whether some label in the canonical set satisfies the canonical matcher. */
|
|
35
71
|
function matcherSatisfiedBy(m, labels) {
|
|
36
72
|
if (m.kind === "exact") return labels.has(m.value);
|
|
37
73
|
const re = compileRegexMatcher(m);
|
|
@@ -57,14 +93,14 @@ const HostTargetSelector = z.object({
|
|
|
57
93
|
* include matchers match and none of its exclude matchers match.
|
|
58
94
|
*/
|
|
59
95
|
function hostSatisfiesTarget(labels, target) {
|
|
60
|
-
return target.values.every((v) => v.include.every((m) => matcherSatisfiedBy(m, labels)) && !v.exclude.some((m) => matcherSatisfiedBy(m, labels)));
|
|
96
|
+
return target.values.every((v) => v.include.every((m) => matcherSatisfiedBy(canonicalizeMatcher(m), labels)) && !v.exclude.some((m) => matcherSatisfiedBy(canonicalizeMatcher(m), labels)));
|
|
61
97
|
}
|
|
62
|
-
/** Split a matcher list into exact
|
|
98
|
+
/** Split a matcher list into canonical exact labels and canonical regex matchers. */
|
|
63
99
|
function partitionMatchers(ms) {
|
|
64
100
|
const exact = [];
|
|
65
101
|
const regex = [];
|
|
66
|
-
for (const m of ms) if (m.kind === "exact") exact.push(m.value);
|
|
67
|
-
else if (m.kind === "regex") regex.push(m);
|
|
102
|
+
for (const m of ms) if (m.kind === "exact") exact.push(canonicalizeLabel(m.value));
|
|
103
|
+
else if (m.kind === "regex") regex.push(canonicalizeMatcher(m));
|
|
68
104
|
else throw new Error(`partitionMatchers: invalid label matcher ${JSON.stringify(m)} — expected { kind: 'exact', value } or { kind: 'regex', source, flags }. The lock file is likely stale or compiled by an older engine — recompile with \`kici compile\`.`);
|
|
69
105
|
return {
|
|
70
106
|
exact,
|
|
@@ -72,6 +108,6 @@ function partitionMatchers(ms) {
|
|
|
72
108
|
};
|
|
73
109
|
}
|
|
74
110
|
//#endregion
|
|
75
|
-
export { HostTargetSelector, HostTargetValue, LabelMatcher, compileRegexMatcher, hostSatisfiesTarget, matcherMatches, matcherSatisfiedBy, partitionMatchers };
|
|
111
|
+
export { HostTargetSelector, HostTargetValue, LabelMatcher, canonicalizeMatcher, compileRegexMatcher, hostSatisfiesTarget, matcherMatches, matcherSatisfiedBy, partitionMatchers };
|
|
76
112
|
|
|
77
113
|
//# sourceMappingURL=labels-match.js.map
|
|
@@ -191,6 +191,7 @@ const METRIC_LABEL_POLICY = {
|
|
|
191
191
|
provider: { values: ["static"] },
|
|
192
192
|
scope: { maxUniqueValues: 100 }
|
|
193
193
|
},
|
|
194
|
+
kici_orch_container_registry_auth_contributor_stripped_total: { trust_tier: { values: ["unknown", "known"] } },
|
|
194
195
|
kici_orch_install_secrets_contributor_stripped_total: { trust_tier: { values: ["unknown", "known"] } },
|
|
195
196
|
kici_orch_install_secrets_token_resolution_duration_seconds: { environment: { maxUniqueValues: 50 } },
|
|
196
197
|
kici_cross_source_errors_total: { reason: { values: ["clone_token", "bundle_missing"] } },
|
|
@@ -223,7 +224,11 @@ const METRIC_LABEL_POLICY = {
|
|
|
223
224
|
"dashboard_relay_org_mismatch",
|
|
224
225
|
"response_source_mismatch",
|
|
225
226
|
"payload_stream_source_mismatch",
|
|
226
|
-
"ack_source_mismatch"
|
|
227
|
+
"ack_source_mismatch",
|
|
228
|
+
"source_register_org_segment_mismatch",
|
|
229
|
+
"source_register_unknown_prefix",
|
|
230
|
+
"github_routing_key_multi_org_claim",
|
|
231
|
+
"unverified_delivery_id_claim"
|
|
227
232
|
] } },
|
|
228
233
|
kici_platform_orch_metrics_filtered_total: {
|
|
229
234
|
reason: { values: [
|