@neat.is/core 0.10.6-dev.20261008 → 0.10.6-dev.20261009
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-ECBRGTB2.js} +2 -2
- 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 +109 -3
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +4 -3
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +107 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +2 -2
- package/dist/neatd.cjs +107 -2
- 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 → chunk-ECBRGTB2.js.map} +0 -0
package/dist/index.cjs
CHANGED
|
@@ -17996,10 +17996,11 @@ function locusOf(graph, ev) {
|
|
|
17996
17996
|
const rawLine = ev.attributes?.[CODE_LINENO_ATTR2];
|
|
17997
17997
|
const line = typeof rawLine === "number" ? rawLine : Number(rawLine);
|
|
17998
17998
|
const node = graph.hasNode(ev.affectedNode) ? graph.getNodeAttributes(ev.affectedNode) : void 0;
|
|
17999
|
+
const symbol = node?.type === "SymbolNode" ? node.qualname : void 0;
|
|
17999
18000
|
return {
|
|
18000
18001
|
file,
|
|
18001
18002
|
...Number.isFinite(line) ? { lineStart: line, lineEnd: line } : {},
|
|
18002
|
-
...
|
|
18003
|
+
...symbol ? { symbol } : {},
|
|
18003
18004
|
service: node?.service ?? ev.service,
|
|
18004
18005
|
provenance: import_types61.Provenance.OBSERVED
|
|
18005
18006
|
};
|
|
@@ -18095,7 +18096,8 @@ function buildIncidentCard(graph, errorEvent, incidents, policies) {
|
|
|
18095
18096
|
const policyCards = applicable.map((p) => ({
|
|
18096
18097
|
policyName: p.policyName,
|
|
18097
18098
|
severity: p.severity,
|
|
18098
|
-
message: p.reason
|
|
18099
|
+
message: p.reason,
|
|
18100
|
+
onViolation: p.onViolation
|
|
18099
18101
|
}));
|
|
18100
18102
|
const divergences = inGraph ? computeDivergences(graph, { node: affected, incidents }).divergences.map((d) => ({
|
|
18101
18103
|
type: d.type,
|
|
@@ -18122,8 +18124,111 @@ function buildIncidentCard(graph, errorEvent, incidents, policies) {
|
|
|
18122
18124
|
...divergences.length > 0 ? { divergence: divergences } : {},
|
|
18123
18125
|
headline: renderHeadline(graph, errorEvent, locus, rootCause?.node ?? null)
|
|
18124
18126
|
};
|
|
18127
|
+
card.grade = gradeIncidentCard(card);
|
|
18125
18128
|
return import_types61.IncidentCardSchema.parse(card);
|
|
18126
18129
|
}
|
|
18130
|
+
var GRADE_PRIORS_VERSION = "sniper-architecture-priors-2026-10-08";
|
|
18131
|
+
var GRADE_WEIGHTS = {
|
|
18132
|
+
evidence: 3,
|
|
18133
|
+
locus: 2,
|
|
18134
|
+
tests: 2,
|
|
18135
|
+
reach: 1.5,
|
|
18136
|
+
kind: 1.5,
|
|
18137
|
+
chain: 1,
|
|
18138
|
+
recur: 1,
|
|
18139
|
+
div: 1
|
|
18140
|
+
};
|
|
18141
|
+
var PROVENANCE_WEIGHT = {
|
|
18142
|
+
OBSERVED: 1,
|
|
18143
|
+
EXTRACTED: 0.8,
|
|
18144
|
+
INFERRED: 0.4,
|
|
18145
|
+
FRONTIER: 0.3,
|
|
18146
|
+
STALE: 0.2
|
|
18147
|
+
};
|
|
18148
|
+
var REACH_NODES_MAX = 50;
|
|
18149
|
+
var TIMEOUT = /timeout|timed out|deadline/i;
|
|
18150
|
+
var round2 = (n) => Math.round(n * 1e4) / 1e4;
|
|
18151
|
+
function factor(name, value, evidence, reason) {
|
|
18152
|
+
return {
|
|
18153
|
+
value: value === null ? null : round2(value),
|
|
18154
|
+
weight: GRADE_WEIGHTS[name],
|
|
18155
|
+
evidence,
|
|
18156
|
+
...reason ? { reason } : {}
|
|
18157
|
+
};
|
|
18158
|
+
}
|
|
18159
|
+
function gradeIncidentCard(card) {
|
|
18160
|
+
const rc = card.rootCause;
|
|
18161
|
+
const chain = rc?.chain ?? [];
|
|
18162
|
+
const gates = {
|
|
18163
|
+
policyNotBlock: {
|
|
18164
|
+
passed: !(card.policies ?? []).some((p) => p.onViolation === "block"),
|
|
18165
|
+
evidence: ["policies[].onViolation"]
|
|
18166
|
+
},
|
|
18167
|
+
notSymptomOnly: {
|
|
18168
|
+
passed: rc?.classification !== "symptom-only",
|
|
18169
|
+
evidence: ["rootCause.classification"]
|
|
18170
|
+
},
|
|
18171
|
+
locusResolves: { passed: card.locus !== null, evidence: ["locus"] }
|
|
18172
|
+
};
|
|
18173
|
+
const gamma = Object.values(gates).every((g) => g.passed) ? 1 : 0;
|
|
18174
|
+
const carrying = chain.some((h) => h.carriesSignal === true) ? chain.filter((h) => h.carriesSignal === true) : chain;
|
|
18175
|
+
const hopWeights = carrying.map((h) => PROVENANCE_WEIGHT[h.provenance]);
|
|
18176
|
+
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"]);
|
|
18177
|
+
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)");
|
|
18178
|
+
const tests = factor(
|
|
18179
|
+
"tests",
|
|
18180
|
+
null,
|
|
18181
|
+
[],
|
|
18182
|
+
"the card carries no test-file classification or test-to-symbol edges"
|
|
18183
|
+
);
|
|
18184
|
+
const reach = card.blastRadius ? factor(
|
|
18185
|
+
"reach",
|
|
18186
|
+
Math.max(0, 1 - card.blastRadius.totalAffected / REACH_NODES_MAX),
|
|
18187
|
+
["blastRadius.totalAffected"],
|
|
18188
|
+
`nodes in the blast radius against a prior bound of ${REACH_NODES_MAX}`
|
|
18189
|
+
) : factor("reach", null, ["blastRadius"], "no blast radius on the card");
|
|
18190
|
+
const timeout = TIMEOUT.test(`${card.exceptionType ?? ""} ${card.message}`);
|
|
18191
|
+
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;
|
|
18192
|
+
const kind = factor("kind", kindValue, ["incidentKind", "exceptionType", "message"]);
|
|
18193
|
+
const chainFactor = rc ? factor(
|
|
18194
|
+
"chain",
|
|
18195
|
+
1 / (1 + 0.25 * (Math.max(1, chain.length - 1) - 1)),
|
|
18196
|
+
["rootCause.chain"]
|
|
18197
|
+
) : factor("chain", null, ["rootCause"], "no root cause on the card");
|
|
18198
|
+
const occurrences = card.count ?? 1;
|
|
18199
|
+
const recurValue = Math.min(1, Math.log(1 + occurrences) / Math.log(11));
|
|
18200
|
+
const recur = factor(
|
|
18201
|
+
"recur",
|
|
18202
|
+
recurValue,
|
|
18203
|
+
["count"],
|
|
18204
|
+
card.count === void 0 ? "no coalesced count; one recorded occurrence" : void 0
|
|
18205
|
+
);
|
|
18206
|
+
const div = factor("div", (card.divergence ?? []).length > 0 ? 1 : 0.7, ["divergence"]);
|
|
18207
|
+
const factors = { evidence, locus, tests, reach, kind, chain: chainFactor, recur, div };
|
|
18208
|
+
let weighted = 0;
|
|
18209
|
+
let total = 0;
|
|
18210
|
+
for (const f of Object.values(factors)) {
|
|
18211
|
+
if (f.value === null) continue;
|
|
18212
|
+
weighted += f.weight * f.value;
|
|
18213
|
+
total += f.weight;
|
|
18214
|
+
}
|
|
18215
|
+
const C = round2(weighted / total);
|
|
18216
|
+
const G = round2(gamma * C);
|
|
18217
|
+
const band = gamma === 0 || G < 0.5 ? "out" : G >= 0.75 ? "full" : "diagnose-only";
|
|
18218
|
+
return {
|
|
18219
|
+
G,
|
|
18220
|
+
gamma,
|
|
18221
|
+
gates,
|
|
18222
|
+
C,
|
|
18223
|
+
factors,
|
|
18224
|
+
band,
|
|
18225
|
+
urgency: {
|
|
18226
|
+
value: null,
|
|
18227
|
+
reason: "f_fresh needs the time of the last OBSERVED signal at the node, which the card does not carry"
|
|
18228
|
+
},
|
|
18229
|
+
priorsVersion: GRADE_PRIORS_VERSION
|
|
18230
|
+
};
|
|
18231
|
+
}
|
|
18127
18232
|
|
|
18128
18233
|
// src/ask.ts
|
|
18129
18234
|
init_cjs_shims();
|