@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.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(),
@@ -1443,6 +1454,10 @@ var ObservedFailingDivergenceSchema = z9.object({
1443
1454
  spanCount: z9.number().int().nonnegative().optional(),
1444
1455
  errorCount: z9.number().int().nonnegative().optional(),
1445
1456
  errorRate: z9.number().min(0).max(1).optional(),
1457
+ // The failing edge's bounded last-error exemplar (ADR-236) — WHAT failed,
1458
+ // alongside the error-rate evidence. Edge locus only; absent when the edge
1459
+ // carried no exception/status detail.
1460
+ lastError: EdgeErrorExemplarSchema.optional(),
1446
1461
  // Incident locus (the declared external call whose incident shows a failure).
1447
1462
  location: z9.string().optional(),
1448
1463
  incidentId: z9.string().optional(),
@@ -1701,6 +1716,36 @@ function extractedPrecisionFloor() {
1701
1716
  function passesExtractedFloor(confidence) {
1702
1717
  return confidence >= extractedPrecisionFloor();
1703
1718
  }
1719
+
1720
+ // src/pr-verdict.ts
1721
+ import { z as z11 } from "zod";
1722
+ var SHA = /^[0-9a-f]{40}$/;
1723
+ var SLUG = /^[A-Za-z0-9](?:[A-Za-z0-9._-]*[A-Za-z0-9_])?$/;
1724
+ var PrVerdictBodySchema = z11.object({
1725
+ owner: z11.string().regex(SLUG, "not a GitHub account name"),
1726
+ name: z11.string().regex(SLUG, "not a GitHub repository name"),
1727
+ baseSha: z11.string().regex(SHA, "must be a full 40-character lowercase commit SHA"),
1728
+ headSha: z11.string().regex(SHA, "must be a full 40-character lowercase commit SHA"),
1729
+ cloneUrl: z11.string().url(),
1730
+ // Repo-relative paths the PR changes. Optional; capped by the daemon.
1731
+ changedFiles: z11.array(z11.string()).optional(),
1732
+ tone: z11.enum(["loud", "professional"]).optional()
1733
+ }).superRefine((body, ctx) => {
1734
+ let url;
1735
+ try {
1736
+ url = new URL(body.cloneUrl);
1737
+ } catch {
1738
+ return;
1739
+ }
1740
+ if (url.protocol !== "https:" || url.hostname !== "github.com" || url.port !== "") {
1741
+ ctx.addIssue({ code: z11.ZodIssueCode.custom, path: ["cloneUrl"], message: "must be an https://github.com URL" });
1742
+ return;
1743
+ }
1744
+ const repoPath = url.pathname.replace(/\.git$/, "").replace(/\/+$/, "");
1745
+ if (repoPath.toLowerCase() !== `/${body.owner}/${body.name}`.toLowerCase()) {
1746
+ ctx.addIssue({ code: z11.ZodIssueCode.custom, path: ["cloneUrl"], message: "does not point at owner/name" });
1747
+ }
1748
+ });
1704
1749
  export {
1705
1750
  ApplicablePoliciesResponseSchema,
1706
1751
  ApplicablePolicySchema,
@@ -1739,6 +1784,7 @@ export {
1739
1784
  EMPTY_REGISTRY,
1740
1785
  EXTRACTED_CONFIDENCE,
1741
1786
  EdgeAnomalySchema,
1787
+ EdgeErrorExemplarSchema,
1742
1788
  EdgeEvidenceSchema,
1743
1789
  EdgeSignalSchema,
1744
1790
  EdgeType,
@@ -1796,6 +1842,7 @@ export {
1796
1842
  PolicySchema,
1797
1843
  PolicySeveritySchema,
1798
1844
  PolicyViolationSchema,
1845
+ PrVerdictBodySchema,
1799
1846
  ProjectListEntrySchema,
1800
1847
  ProjectServedBySchema,
1801
1848
  Provenance,