@neat.is/types 0.10.6-dev.20261007 → 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/index.js CHANGED
@@ -207,6 +207,12 @@ var EdgeAnomalySchema = z2.union([
207
207
  z2.object({ source: z2.string(), rule: z2.string() }),
208
208
  z2.boolean()
209
209
  ]);
210
+ var EdgeErrorExemplarSchema = z2.object({
211
+ exceptionType: z2.string().optional(),
212
+ message: z2.string().optional(),
213
+ at: z2.string().optional(),
214
+ httpStatusCode: z2.number().optional()
215
+ });
210
216
  var EdgeSignalSchema = z2.object({
211
217
  spanCount: z2.number().int().nonnegative(),
212
218
  errorCount: z2.number().int().nonnegative(),
@@ -222,7 +228,12 @@ var EdgeSignalSchema = z2.object({
222
228
  latencyHist: z2.record(z2.string(), z2.number().int().nonnegative()).optional(),
223
229
  // A pre-thresholded external alert riding on the edge (ADR-190). Optional and
224
230
  // empty until an alert source is wired.
225
- anomalous: EdgeAnomalySchema.optional()
231
+ anomalous: EdgeAnomalySchema.optional(),
232
+ // A bounded last-error exemplar (ADR-236) — the most recent failing
233
+ // observation's exception type/message/status, so the edge carries WHAT
234
+ // failed, not just how many times. Additive optional growth (ADR-031); absent
235
+ // on a clean edge, on a legacy edge, and on a connector edge with no detail.
236
+ lastError: EdgeErrorExemplarSchema.optional()
226
237
  });
227
238
  var GraphEdgeSchema = z2.object({
228
239
  id: z2.string(),
@@ -891,12 +902,54 @@ var IncidentBlastRadiusSchema = z6.object({
891
902
  var IncidentPolicySchema = z6.object({
892
903
  policyName: z6.string(),
893
904
  severity: z6.string(),
894
- message: z6.string().optional()
905
+ message: z6.string().optional(),
906
+ // What the policy does when violated, as the policy overlay already resolves it
907
+ // (explicit onViolation, else the severity default, ADR-044). The grade's
908
+ // policy gate reads it.
909
+ onViolation: z6.enum(["log", "alert", "block"]).optional()
895
910
  });
896
911
  var IncidentDivergenceSchema = z6.object({
897
912
  type: z6.string(),
898
913
  summary: z6.string()
899
914
  });
915
+ var GradeEvidenceSchema = z6.array(z6.string());
916
+ var IncidentGradeGateSchema = z6.object({
917
+ passed: z6.boolean(),
918
+ evidence: GradeEvidenceSchema
919
+ });
920
+ var IncidentGradeFactorSchema = z6.object({
921
+ value: z6.number().min(0).max(1).nullable(),
922
+ weight: z6.number().positive(),
923
+ // The card fields the value was computed from.
924
+ evidence: GradeEvidenceSchema,
925
+ // Why the value is null, or what it rests on when that isn't obvious.
926
+ reason: z6.string().optional()
927
+ });
928
+ var IncidentGradeBandSchema = z6.enum(["full", "diagnose-only", "out"]);
929
+ var IncidentGradeSchema = z6.object({
930
+ G: z6.number().min(0).max(1),
931
+ gamma: z6.union([z6.literal(0), z6.literal(1)]),
932
+ gates: z6.object({
933
+ policyNotBlock: IncidentGradeGateSchema,
934
+ notSymptomOnly: IncidentGradeGateSchema,
935
+ locusResolves: IncidentGradeGateSchema
936
+ }),
937
+ C: z6.number().min(0).max(1),
938
+ factors: z6.object({
939
+ evidence: IncidentGradeFactorSchema,
940
+ locus: IncidentGradeFactorSchema,
941
+ tests: IncidentGradeFactorSchema,
942
+ reach: IncidentGradeFactorSchema,
943
+ kind: IncidentGradeFactorSchema,
944
+ chain: IncidentGradeFactorSchema,
945
+ recur: IncidentGradeFactorSchema,
946
+ div: IncidentGradeFactorSchema
947
+ }),
948
+ band: IncidentGradeBandSchema,
949
+ // Orders incidents within a band; never raises or lowers a grade.
950
+ urgency: z6.object({ value: z6.number().min(0).max(1).nullable(), reason: z6.string().optional() }),
951
+ priorsVersion: z6.string()
952
+ });
900
953
  var IncidentCardSchema = z6.object({
901
954
  kind: z6.literal("incident"),
902
955
  id: z6.string(),
@@ -920,7 +973,9 @@ var IncidentCardSchema = z6.object({
920
973
  divergence: z6.array(IncidentDivergenceSchema).optional(),
921
974
  // The rendered one-line sentence — a human/loose-LLM read over the structured
922
975
  // body, never the wire format.
923
- headline: z6.string()
976
+ headline: z6.string(),
977
+ // Derived from the fields above (ADR-238). Optional so older cards still parse.
978
+ grade: IncidentGradeSchema.optional()
924
979
  });
925
980
  var IncidentEventPayloadSchema = z6.object({
926
981
  incidentId: z6.string(),
@@ -1443,6 +1498,10 @@ var ObservedFailingDivergenceSchema = z9.object({
1443
1498
  spanCount: z9.number().int().nonnegative().optional(),
1444
1499
  errorCount: z9.number().int().nonnegative().optional(),
1445
1500
  errorRate: z9.number().min(0).max(1).optional(),
1501
+ // The failing edge's bounded last-error exemplar (ADR-236) — WHAT failed,
1502
+ // alongside the error-rate evidence. Edge locus only; absent when the edge
1503
+ // carried no exception/status detail.
1504
+ lastError: EdgeErrorExemplarSchema.optional(),
1446
1505
  // Incident locus (the declared external call whose incident shows a failure).
1447
1506
  location: z9.string().optional(),
1448
1507
  incidentId: z9.string().optional(),
@@ -1769,6 +1828,7 @@ export {
1769
1828
  EMPTY_REGISTRY,
1770
1829
  EXTRACTED_CONFIDENCE,
1771
1830
  EdgeAnomalySchema,
1831
+ EdgeErrorExemplarSchema,
1772
1832
  EdgeEvidenceSchema,
1773
1833
  EdgeSignalSchema,
1774
1834
  EdgeType,
@@ -1795,6 +1855,10 @@ export {
1795
1855
  IncidentChainHopSchema,
1796
1856
  IncidentDivergenceSchema,
1797
1857
  IncidentEventPayloadSchema,
1858
+ IncidentGradeBandSchema,
1859
+ IncidentGradeFactorSchema,
1860
+ IncidentGradeGateSchema,
1861
+ IncidentGradeSchema,
1798
1862
  IncidentKindSchema,
1799
1863
  IncidentLocusSchema,
1800
1864
  IncidentPolicySchema,