@neat.is/types 0.10.5 → 0.10.6-dev.20261008

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.cjs CHANGED
@@ -57,6 +57,7 @@ __export(index_exports, {
57
57
  EMPTY_REGISTRY: () => EMPTY_REGISTRY,
58
58
  EXTRACTED_CONFIDENCE: () => EXTRACTED_CONFIDENCE,
59
59
  EdgeAnomalySchema: () => EdgeAnomalySchema,
60
+ EdgeErrorExemplarSchema: () => EdgeErrorExemplarSchema,
60
61
  EdgeEvidenceSchema: () => EdgeEvidenceSchema,
61
62
  EdgeSignalSchema: () => EdgeSignalSchema,
62
63
  EdgeType: () => EdgeType,
@@ -114,6 +115,7 @@ __export(index_exports, {
114
115
  PolicySchema: () => PolicySchema,
115
116
  PolicySeveritySchema: () => PolicySeveritySchema,
116
117
  PolicyViolationSchema: () => PolicyViolationSchema,
118
+ PrVerdictBodySchema: () => PrVerdictBodySchema,
117
119
  ProjectListEntrySchema: () => ProjectListEntrySchema,
118
120
  ProjectServedBySchema: () => ProjectServedBySchema,
119
121
  Provenance: () => Provenance,
@@ -392,6 +394,12 @@ var EdgeAnomalySchema = import_zod2.z.union([
392
394
  import_zod2.z.object({ source: import_zod2.z.string(), rule: import_zod2.z.string() }),
393
395
  import_zod2.z.boolean()
394
396
  ]);
397
+ var EdgeErrorExemplarSchema = import_zod2.z.object({
398
+ exceptionType: import_zod2.z.string().optional(),
399
+ message: import_zod2.z.string().optional(),
400
+ at: import_zod2.z.string().optional(),
401
+ httpStatusCode: import_zod2.z.number().optional()
402
+ });
395
403
  var EdgeSignalSchema = import_zod2.z.object({
396
404
  spanCount: import_zod2.z.number().int().nonnegative(),
397
405
  errorCount: import_zod2.z.number().int().nonnegative(),
@@ -407,7 +415,12 @@ var EdgeSignalSchema = import_zod2.z.object({
407
415
  latencyHist: import_zod2.z.record(import_zod2.z.string(), import_zod2.z.number().int().nonnegative()).optional(),
408
416
  // A pre-thresholded external alert riding on the edge (ADR-190). Optional and
409
417
  // empty until an alert source is wired.
410
- anomalous: EdgeAnomalySchema.optional()
418
+ anomalous: EdgeAnomalySchema.optional(),
419
+ // A bounded last-error exemplar (ADR-236) — the most recent failing
420
+ // observation's exception type/message/status, so the edge carries WHAT
421
+ // failed, not just how many times. Additive optional growth (ADR-031); absent
422
+ // on a clean edge, on a legacy edge, and on a connector edge with no detail.
423
+ lastError: EdgeErrorExemplarSchema.optional()
411
424
  });
412
425
  var GraphEdgeSchema = import_zod2.z.object({
413
426
  id: import_zod2.z.string(),
@@ -1628,6 +1641,10 @@ var ObservedFailingDivergenceSchema = import_zod9.z.object({
1628
1641
  spanCount: import_zod9.z.number().int().nonnegative().optional(),
1629
1642
  errorCount: import_zod9.z.number().int().nonnegative().optional(),
1630
1643
  errorRate: import_zod9.z.number().min(0).max(1).optional(),
1644
+ // The failing edge's bounded last-error exemplar (ADR-236) — WHAT failed,
1645
+ // alongside the error-rate evidence. Edge locus only; absent when the edge
1646
+ // carried no exception/status detail.
1647
+ lastError: EdgeErrorExemplarSchema.optional(),
1631
1648
  // Incident locus (the declared external call whose incident shows a failure).
1632
1649
  location: import_zod9.z.string().optional(),
1633
1650
  incidentId: import_zod9.z.string().optional(),
@@ -1886,6 +1903,36 @@ function extractedPrecisionFloor() {
1886
1903
  function passesExtractedFloor(confidence) {
1887
1904
  return confidence >= extractedPrecisionFloor();
1888
1905
  }
1906
+
1907
+ // src/pr-verdict.ts
1908
+ var import_zod11 = require("zod");
1909
+ var SHA = /^[0-9a-f]{40}$/;
1910
+ var SLUG = /^[A-Za-z0-9](?:[A-Za-z0-9._-]*[A-Za-z0-9_])?$/;
1911
+ var PrVerdictBodySchema = import_zod11.z.object({
1912
+ owner: import_zod11.z.string().regex(SLUG, "not a GitHub account name"),
1913
+ name: import_zod11.z.string().regex(SLUG, "not a GitHub repository name"),
1914
+ baseSha: import_zod11.z.string().regex(SHA, "must be a full 40-character lowercase commit SHA"),
1915
+ headSha: import_zod11.z.string().regex(SHA, "must be a full 40-character lowercase commit SHA"),
1916
+ cloneUrl: import_zod11.z.string().url(),
1917
+ // Repo-relative paths the PR changes. Optional; capped by the daemon.
1918
+ changedFiles: import_zod11.z.array(import_zod11.z.string()).optional(),
1919
+ tone: import_zod11.z.enum(["loud", "professional"]).optional()
1920
+ }).superRefine((body, ctx) => {
1921
+ let url;
1922
+ try {
1923
+ url = new URL(body.cloneUrl);
1924
+ } catch {
1925
+ return;
1926
+ }
1927
+ if (url.protocol !== "https:" || url.hostname !== "github.com" || url.port !== "") {
1928
+ ctx.addIssue({ code: import_zod11.z.ZodIssueCode.custom, path: ["cloneUrl"], message: "must be an https://github.com URL" });
1929
+ return;
1930
+ }
1931
+ const repoPath = url.pathname.replace(/\.git$/, "").replace(/\/+$/, "");
1932
+ if (repoPath.toLowerCase() !== `/${body.owner}/${body.name}`.toLowerCase()) {
1933
+ ctx.addIssue({ code: import_zod11.z.ZodIssueCode.custom, path: ["cloneUrl"], message: "does not point at owner/name" });
1934
+ }
1935
+ });
1889
1936
  // Annotate the CommonJS export names for ESM import in node:
1890
1937
  0 && (module.exports = {
1891
1938
  ApplicablePoliciesResponseSchema,
@@ -1925,6 +1972,7 @@ function passesExtractedFloor(confidence) {
1925
1972
  EMPTY_REGISTRY,
1926
1973
  EXTRACTED_CONFIDENCE,
1927
1974
  EdgeAnomalySchema,
1975
+ EdgeErrorExemplarSchema,
1928
1976
  EdgeEvidenceSchema,
1929
1977
  EdgeSignalSchema,
1930
1978
  EdgeType,
@@ -1982,6 +2030,7 @@ function passesExtractedFloor(confidence) {
1982
2030
  PolicySchema,
1983
2031
  PolicySeveritySchema,
1984
2032
  PolicyViolationSchema,
2033
+ PrVerdictBodySchema,
1985
2034
  ProjectListEntrySchema,
1986
2035
  ProjectServedBySchema,
1987
2036
  Provenance,