@neat.is/core 0.10.6-dev.20261008 → 0.10.6-dev.20261010
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/{chunk-EMFX3V77.js → chunk-52SCEPEW.js} +219 -9
- package/dist/chunk-52SCEPEW.js.map +1 -0
- package/dist/{chunk-6QMWJAWR.js → chunk-H2BAPN33.js} +108 -3
- package/dist/{chunk-6QMWJAWR.js.map → chunk-H2BAPN33.js.map} +1 -1
- package/dist/cli.cjs +358 -11
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +35 -4
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +325 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +2 -2
- package/dist/neatd.cjs +325 -9
- package/dist/neatd.cjs.map +1 -1
- package/dist/neatd.js +2 -2
- package/dist/server.cjs +107 -2
- package/dist/server.cjs.map +1 -1
- package/dist/server.js +1 -1
- package/package.json +2 -2
- package/dist/chunk-EMFX3V77.js.map +0 -1
package/dist/neatd.js
CHANGED
package/dist/server.cjs
CHANGED
|
@@ -17640,10 +17640,11 @@ function locusOf(graph, ev) {
|
|
|
17640
17640
|
const rawLine = ev.attributes?.[CODE_LINENO_ATTR2];
|
|
17641
17641
|
const line = typeof rawLine === "number" ? rawLine : Number(rawLine);
|
|
17642
17642
|
const node = graph.hasNode(ev.affectedNode) ? graph.getNodeAttributes(ev.affectedNode) : void 0;
|
|
17643
|
+
const symbol = node?.type === "SymbolNode" ? node.qualname : void 0;
|
|
17643
17644
|
return {
|
|
17644
17645
|
file,
|
|
17645
17646
|
...Number.isFinite(line) ? { lineStart: line, lineEnd: line } : {},
|
|
17646
|
-
...
|
|
17647
|
+
...symbol ? { symbol } : {},
|
|
17647
17648
|
service: node?.service ?? ev.service,
|
|
17648
17649
|
provenance: import_types60.Provenance.OBSERVED
|
|
17649
17650
|
};
|
|
@@ -17739,7 +17740,8 @@ function buildIncidentCard(graph, errorEvent, incidents, policies) {
|
|
|
17739
17740
|
const policyCards = applicable.map((p) => ({
|
|
17740
17741
|
policyName: p.policyName,
|
|
17741
17742
|
severity: p.severity,
|
|
17742
|
-
message: p.reason
|
|
17743
|
+
message: p.reason,
|
|
17744
|
+
onViolation: p.onViolation
|
|
17743
17745
|
}));
|
|
17744
17746
|
const divergences = inGraph ? computeDivergences(graph, { node: affected, incidents }).divergences.map((d) => ({
|
|
17745
17747
|
type: d.type,
|
|
@@ -17766,8 +17768,111 @@ function buildIncidentCard(graph, errorEvent, incidents, policies) {
|
|
|
17766
17768
|
...divergences.length > 0 ? { divergence: divergences } : {},
|
|
17767
17769
|
headline: renderHeadline(graph, errorEvent, locus, rootCause?.node ?? null)
|
|
17768
17770
|
};
|
|
17771
|
+
card.grade = gradeIncidentCard(card);
|
|
17769
17772
|
return import_types60.IncidentCardSchema.parse(card);
|
|
17770
17773
|
}
|
|
17774
|
+
var GRADE_PRIORS_VERSION = "sniper-architecture-priors-2026-10-08";
|
|
17775
|
+
var GRADE_WEIGHTS = {
|
|
17776
|
+
evidence: 3,
|
|
17777
|
+
locus: 2,
|
|
17778
|
+
tests: 2,
|
|
17779
|
+
reach: 1.5,
|
|
17780
|
+
kind: 1.5,
|
|
17781
|
+
chain: 1,
|
|
17782
|
+
recur: 1,
|
|
17783
|
+
div: 1
|
|
17784
|
+
};
|
|
17785
|
+
var PROVENANCE_WEIGHT = {
|
|
17786
|
+
OBSERVED: 1,
|
|
17787
|
+
EXTRACTED: 0.8,
|
|
17788
|
+
INFERRED: 0.4,
|
|
17789
|
+
FRONTIER: 0.3,
|
|
17790
|
+
STALE: 0.2
|
|
17791
|
+
};
|
|
17792
|
+
var REACH_NODES_MAX = 50;
|
|
17793
|
+
var TIMEOUT = /timeout|timed out|deadline/i;
|
|
17794
|
+
var round2 = (n) => Math.round(n * 1e4) / 1e4;
|
|
17795
|
+
function factor(name, value, evidence, reason) {
|
|
17796
|
+
return {
|
|
17797
|
+
value: value === null ? null : round2(value),
|
|
17798
|
+
weight: GRADE_WEIGHTS[name],
|
|
17799
|
+
evidence,
|
|
17800
|
+
...reason ? { reason } : {}
|
|
17801
|
+
};
|
|
17802
|
+
}
|
|
17803
|
+
function gradeIncidentCard(card) {
|
|
17804
|
+
const rc = card.rootCause;
|
|
17805
|
+
const chain = rc?.chain ?? [];
|
|
17806
|
+
const gates = {
|
|
17807
|
+
policyNotBlock: {
|
|
17808
|
+
passed: !(card.policies ?? []).some((p) => p.onViolation === "block"),
|
|
17809
|
+
evidence: ["policies[].onViolation"]
|
|
17810
|
+
},
|
|
17811
|
+
notSymptomOnly: {
|
|
17812
|
+
passed: rc?.classification !== "symptom-only",
|
|
17813
|
+
evidence: ["rootCause.classification"]
|
|
17814
|
+
},
|
|
17815
|
+
locusResolves: { passed: card.locus !== null, evidence: ["locus"] }
|
|
17816
|
+
};
|
|
17817
|
+
const gamma = Object.values(gates).every((g) => g.passed) ? 1 : 0;
|
|
17818
|
+
const carrying = chain.some((h) => h.carriesSignal === true) ? chain.filter((h) => h.carriesSignal === true) : chain;
|
|
17819
|
+
const hopWeights = carrying.map((h) => PROVENANCE_WEIGHT[h.provenance]);
|
|
17820
|
+
const evidence = hopWeights.length === 0 ? factor("evidence", null, ["rootCause.chain[].provenance"], "no root-cause chain on the card") : hopWeights.some((w) => w === void 0) ? factor("evidence", null, ["rootCause.chain[].provenance"], "a chain hop has a provenance with no weight") : factor("evidence", Math.min(...hopWeights), ["rootCause.chain[].provenance"]);
|
|
17821
|
+
const locus = card.locus ? factor("locus", card.locus.symbol ? 1 : 0.6, ["locus.symbol", "locus.file"]) : factor("locus", null, ["locus"], "no locus on the card (the locus gate fails)");
|
|
17822
|
+
const tests = factor(
|
|
17823
|
+
"tests",
|
|
17824
|
+
null,
|
|
17825
|
+
[],
|
|
17826
|
+
"the card carries no test-file classification or test-to-symbol edges"
|
|
17827
|
+
);
|
|
17828
|
+
const reach = card.blastRadius ? factor(
|
|
17829
|
+
"reach",
|
|
17830
|
+
Math.max(0, 1 - card.blastRadius.totalAffected / REACH_NODES_MAX),
|
|
17831
|
+
["blastRadius.totalAffected"],
|
|
17832
|
+
`nodes in the blast radius against a prior bound of ${REACH_NODES_MAX}`
|
|
17833
|
+
) : factor("reach", null, ["blastRadius"], "no blast radius on the card");
|
|
17834
|
+
const timeout = TIMEOUT.test(`${card.exceptionType ?? ""} ${card.message}`);
|
|
17835
|
+
const kindValue = timeout ? 0.3 : card.incidentKind === "exception" ? 1 : card.incidentKind === "5xx" || card.incidentKind === "status-error" ? 0.7 : card.incidentKind === "connector" ? 0.6 : 0.4;
|
|
17836
|
+
const kind = factor("kind", kindValue, ["incidentKind", "exceptionType", "message"]);
|
|
17837
|
+
const chainFactor = rc ? factor(
|
|
17838
|
+
"chain",
|
|
17839
|
+
1 / (1 + 0.25 * (Math.max(1, chain.length - 1) - 1)),
|
|
17840
|
+
["rootCause.chain"]
|
|
17841
|
+
) : factor("chain", null, ["rootCause"], "no root cause on the card");
|
|
17842
|
+
const occurrences = card.count ?? 1;
|
|
17843
|
+
const recurValue = Math.min(1, Math.log(1 + occurrences) / Math.log(11));
|
|
17844
|
+
const recur = factor(
|
|
17845
|
+
"recur",
|
|
17846
|
+
recurValue,
|
|
17847
|
+
["count"],
|
|
17848
|
+
card.count === void 0 ? "no coalesced count; one recorded occurrence" : void 0
|
|
17849
|
+
);
|
|
17850
|
+
const div = factor("div", (card.divergence ?? []).length > 0 ? 1 : 0.7, ["divergence"]);
|
|
17851
|
+
const factors = { evidence, locus, tests, reach, kind, chain: chainFactor, recur, div };
|
|
17852
|
+
let weighted = 0;
|
|
17853
|
+
let total = 0;
|
|
17854
|
+
for (const f of Object.values(factors)) {
|
|
17855
|
+
if (f.value === null) continue;
|
|
17856
|
+
weighted += f.weight * f.value;
|
|
17857
|
+
total += f.weight;
|
|
17858
|
+
}
|
|
17859
|
+
const C = round2(weighted / total);
|
|
17860
|
+
const G = round2(gamma * C);
|
|
17861
|
+
const band = gamma === 0 || G < 0.5 ? "out" : G >= 0.75 ? "full" : "diagnose-only";
|
|
17862
|
+
return {
|
|
17863
|
+
G,
|
|
17864
|
+
gamma,
|
|
17865
|
+
gates,
|
|
17866
|
+
C,
|
|
17867
|
+
factors,
|
|
17868
|
+
band,
|
|
17869
|
+
urgency: {
|
|
17870
|
+
value: null,
|
|
17871
|
+
reason: "f_fresh needs the time of the last OBSERVED signal at the node, which the card does not carry"
|
|
17872
|
+
},
|
|
17873
|
+
priorsVersion: GRADE_PRIORS_VERSION
|
|
17874
|
+
};
|
|
17875
|
+
}
|
|
17771
17876
|
|
|
17772
17877
|
// src/ask.ts
|
|
17773
17878
|
init_cjs_shims();
|