@nudojs/core 1.14.1 → 1.15.2

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.
@@ -2,6 +2,7 @@ import {
2
2
  $invoke,
3
3
  $new,
4
4
  CONSTRAINT_BUILDERS,
5
+ DIAG,
5
6
  abs,
6
7
  andC,
7
8
  anyAbs,
@@ -47,7 +48,7 @@ import {
47
48
  withEvalBudgetOverride,
48
49
  withExecPhi,
49
50
  withFnBudgetOverride
50
- } from "./chunk-JMOQEJTD.js";
51
+ } from "./chunk-WKIRPUHZ.js";
51
52
 
52
53
  // src/algebra/directive-scan.ts
53
54
  function cleanDirectiveLine(raw, kind) {
@@ -823,12 +824,12 @@ function diagnoseMalformedNudoImports(source) {
823
824
  for (const bad of scanMalformedNudoImports(source)) {
824
825
  if (bad === "malformed-default") {
825
826
  collectDiag({
826
- code: "nudo:contract-syntax",
827
+ code: DIAG.contractSyntax,
827
828
  message: `Default @nudo:import is not supported (use named { a, b } or namespace * as ns)`
828
829
  });
829
830
  } else {
830
831
  collectDiag({
831
- code: "nudo:contract-syntax",
832
+ code: DIAG.contractSyntax,
832
833
  message: `Unrecognized @nudo:import form (expected { names } from "path" or * as ns from "path")`
833
834
  });
834
835
  }
@@ -896,7 +897,7 @@ function rewriteSidecarSource(src, fromFile) {
896
897
  const DEFAULT_LOCAL = "__nudoDefault";
897
898
  const badExport = (what) => {
898
899
  collectDiag({
899
- code: "nudo:interface-load",
900
+ code: DIAG.interfaceLoad,
900
901
  message: `sidecar ${what}; recognized export forms are 'export const <name> = \u2026' and 'export default <constraint|fn>'`,
901
902
  file: fromFile
902
903
  });
@@ -1195,7 +1196,7 @@ function execSidecar(src, opts, chain, preloaded) {
1195
1196
  for (const n of imp.names) {
1196
1197
  if (n.ns) {
1197
1198
  collectDiag({
1198
- code: "nudo:interface-load",
1199
+ code: DIAG.interfaceLoad,
1199
1200
  message: `sidecar namespace import '${n.local}' from '${imp.spec}' is not supported (import named builders only)`,
1200
1201
  file: fromFile
1201
1202
  });
@@ -1204,7 +1205,7 @@ function execSidecar(src, opts, chain, preloaded) {
1204
1205
  const hasOwnInject = Object.hasOwn(sidecarInjects, n.imported);
1205
1206
  if (!hasOwnInject) {
1206
1207
  collectDiag({
1207
- code: "nudo:interface-load",
1208
+ code: DIAG.interfaceLoad,
1208
1209
  message: `sidecar import '{ ${n.imported} }' from '${imp.spec}' is not an injected builder`,
1209
1210
  file: fromFile
1210
1211
  });
@@ -1214,7 +1215,7 @@ function execSidecar(src, opts, chain, preloaded) {
1214
1215
  }
1215
1216
  } else {
1216
1217
  collectDiag({
1217
- code: "nudo:interface-load",
1218
+ code: DIAG.interfaceLoad,
1218
1219
  message: `sidecar default import '${n.local}' from '${imp.spec}' has no default export to bind (sidecars export named constraints only)`,
1219
1220
  file: fromFile
1220
1221
  });
@@ -1226,7 +1227,7 @@ function execSidecar(src, opts, chain, preloaded) {
1226
1227
  const load = opts?.loadModule;
1227
1228
  if (!load || !fromFile) {
1228
1229
  collectDiag({
1229
- code: "nudo:interface-load",
1230
+ code: DIAG.interfaceLoad,
1230
1231
  message: `sidecar import '${imp.spec}' is unresolvable (no loadModule for relative specifier)`,
1231
1232
  file: fromFile
1232
1233
  });
@@ -1235,7 +1236,7 @@ function execSidecar(src, opts, chain, preloaded) {
1235
1236
  }
1236
1237
  if (!isSidecarSpec(imp.spec)) {
1237
1238
  collectDiag({
1238
- code: "nudo:interface-load",
1239
+ code: DIAG.interfaceLoad,
1239
1240
  message: `sidecar import '${imp.spec}' unsupported: relative imports must target .nudo.js/.nudo.ts`,
1240
1241
  file: fromFile
1241
1242
  });
@@ -1245,7 +1246,7 @@ function execSidecar(src, opts, chain, preloaded) {
1245
1246
  const canonical = resolveDepPath(fromFile, imp.spec);
1246
1247
  if (isNodeModulesPath(canonical)) {
1247
1248
  collectDiag({
1248
- code: "nudo:interface-load",
1249
+ code: DIAG.interfaceLoad,
1249
1250
  message: `sidecar import '${imp.spec}' resolves into node_modules (${canonical}); ambient sidecar loading never crosses node_modules`,
1250
1251
  file: fromFile
1251
1252
  });
@@ -1254,14 +1255,14 @@ function execSidecar(src, opts, chain, preloaded) {
1254
1255
  }
1255
1256
  if (chain.includes(canonical)) {
1256
1257
  throw new NudoSidecarError(
1257
- "nudo:interface-cycle",
1258
+ DIAG.interfaceCycle,
1258
1259
  `sidecar import cycle: ${[...chain, canonical].join(" \u2192 ")}`
1259
1260
  );
1260
1261
  }
1261
1262
  const depSrc = preloaded.has(canonical) ? preloaded.get(canonical) : load(imp.spec, fromFile);
1262
1263
  if (depSrc === void 0) {
1263
1264
  collectDiag({
1264
- code: "nudo:interface-load",
1265
+ code: DIAG.interfaceLoad,
1265
1266
  message: `sidecar import '${imp.spec}' is unresolvable (loadModule returned no source)`,
1266
1267
  file: fromFile
1267
1268
  });
@@ -1283,7 +1284,7 @@ function execSidecar(src, opts, chain, preloaded) {
1283
1284
  deps[n.local] = depExports[n.imported];
1284
1285
  } else {
1285
1286
  collectDiag({
1286
- code: "nudo:interface-load",
1287
+ code: DIAG.interfaceLoad,
1287
1288
  message: `sidecar '${imp.spec}' has no export '${n.imported}'`,
1288
1289
  file: fromFile
1289
1290
  });
@@ -1291,7 +1292,7 @@ function execSidecar(src, opts, chain, preloaded) {
1291
1292
  }
1292
1293
  } else {
1293
1294
  collectDiag({
1294
- code: "nudo:interface-load",
1295
+ code: DIAG.interfaceLoad,
1295
1296
  message: `sidecar default import '${n.local}' from '${imp.spec}' has no default export (sidecars export named constraints only)`,
1296
1297
  file: fromFile
1297
1298
  });
@@ -1430,7 +1431,7 @@ function collectConstraints(source, opts) {
1430
1431
  for (const imp of imports) {
1431
1432
  if (!opts.loadModule || !opts.fromFile) {
1432
1433
  collectDiag({
1433
- code: "nudo:interface-load",
1434
+ code: DIAG.interfaceLoad,
1434
1435
  message: `sidecar '${imp.spec}' not loaded: loadModule/fromFile missing from host options`,
1435
1436
  file: opts.fromFile
1436
1437
  });
@@ -1441,7 +1442,7 @@ function collectConstraints(source, opts) {
1441
1442
  src = opts.loadModule(imp.spec, opts.fromFile);
1442
1443
  } catch (e) {
1443
1444
  collectDiag({
1444
- code: "nudo:interface-load",
1445
+ code: DIAG.interfaceLoad,
1445
1446
  message: `sidecar '${imp.spec}' failed to load from '${opts.fromFile}': ${e instanceof Error ? e.message : String(e)}`,
1446
1447
  file: opts.fromFile
1447
1448
  });
@@ -1449,7 +1450,7 @@ function collectConstraints(source, opts) {
1449
1450
  }
1450
1451
  if (src === void 0) {
1451
1452
  collectDiag({
1452
- code: "nudo:interface-load",
1453
+ code: DIAG.interfaceLoad,
1453
1454
  message: `sidecar '${imp.spec}' failed to load from '${opts.fromFile}'`,
1454
1455
  file: opts.fromFile
1455
1456
  });
@@ -1464,7 +1465,7 @@ function collectConstraints(source, opts) {
1464
1465
  collectDiag({ code: e.code, message: e.message, file: opts.fromFile });
1465
1466
  } else {
1466
1467
  collectDiag({
1467
- code: "nudo:interface-load",
1468
+ code: DIAG.interfaceLoad,
1468
1469
  message: `sidecar '${imp.spec}' failed to execute: ${e instanceof Error ? e.message : String(e)}`,
1469
1470
  file: opts.fromFile
1470
1471
  });
@@ -1487,13 +1488,13 @@ function collectConstraints(source, opts) {
1487
1488
  map.set(name, v2);
1488
1489
  } else if (v2 === void 0) {
1489
1490
  collectDiag({
1490
- code: "nudo:interface-load",
1491
+ code: DIAG.interfaceLoad,
1491
1492
  message: `sidecar '${imp.spec}' has no export '${imported}'`,
1492
1493
  file: opts.fromFile
1493
1494
  });
1494
1495
  } else {
1495
1496
  collectDiag({
1496
- code: "nudo:interface-load",
1497
+ code: DIAG.interfaceLoad,
1497
1498
  message: `sidecar '${imp.spec}' export '${imported}' is not a Nudo constraint`,
1498
1499
  file: opts.fromFile
1499
1500
  });
@@ -1580,7 +1581,7 @@ function extractRefinesFromSource(source, fnName, opts = {}) {
1580
1581
  if (!m) {
1581
1582
  if (/^return\b/.test(part)) continue;
1582
1583
  collectDiag({
1583
- code: "nudo:contract-syntax",
1584
+ code: DIAG.contractSyntax,
1584
1585
  message: `Malformed @nudo:contract segment '${part}' (expected <param> <constraintName> or return <constraintName>; e.g. @nudo:contract x positive)`
1585
1586
  });
1586
1587
  continue;
@@ -1590,7 +1591,7 @@ function extractRefinesFromSource(source, fnName, opts = {}) {
1590
1591
  const c = constraints.get(cName);
1591
1592
  if (!c) {
1592
1593
  collectDiag({
1593
- code: "nudo:contract-syntax",
1594
+ code: DIAG.contractSyntax,
1594
1595
  message: `Unknown constraint name '${cName}' in @nudo:contract (expected a name bound by @nudo:import)`
1595
1596
  });
1596
1597
  continue;
@@ -1624,7 +1625,7 @@ function extractRefineReturnFromSource(source, fnName, opts = {}) {
1624
1625
  if (!m) {
1625
1626
  if (/^return\b/.test(part) && !/^return\s+[\w.]+$/.test(part)) {
1626
1627
  collectDiag({
1627
- code: "nudo:contract-syntax",
1628
+ code: DIAG.contractSyntax,
1628
1629
  message: `Malformed @nudo:contract return segment '${part}' (expected return <constraintName>)`
1629
1630
  });
1630
1631
  }
@@ -1634,7 +1635,7 @@ function extractRefineReturnFromSource(source, fnName, opts = {}) {
1634
1635
  const c = constraints.get(cName);
1635
1636
  if (!c) {
1636
1637
  collectDiag({
1637
- code: "nudo:contract-syntax",
1638
+ code: DIAG.contractSyntax,
1638
1639
  message: `Unknown constraint name '${cName}' in @nudo:contract return (expected a name bound by @nudo:import)`
1639
1640
  });
1640
1641
  continue;
@@ -2010,7 +2011,7 @@ function loadSidecarBinding(source, fnName, opts) {
2010
2011
  const reason = e instanceof Error ? e.message : String(e);
2011
2012
  if (noteSidecarLoadFailure(sidecarPath, reason)) {
2012
2013
  collectDiag2({
2013
- code: "nudo:interface-load",
2014
+ code: DIAG.interfaceLoad,
2014
2015
  message: `sidecar '${spec}' failed to load: ${reason}`,
2015
2016
  file: sidecarPath
2016
2017
  });
@@ -2026,7 +2027,7 @@ function loadSidecarBinding(source, fnName, opts) {
2026
2027
  exports = execNudoModule(sidecarSrc, { loadModule, fromFile: sidecarPath });
2027
2028
  } catch (e) {
2028
2029
  const reason = e instanceof Error ? e.message : String(e);
2029
- const code = e instanceof NudoSidecarError ? e.code : "nudo:interface-load";
2030
+ const code = e instanceof NudoSidecarError ? e.code : DIAG.interfaceLoad;
2030
2031
  if (noteSidecarLoadFailure(sidecarPath, reason)) {
2031
2032
  let affected = 1;
2032
2033
  if (scNames && scNames.size > 0) {
@@ -2073,7 +2074,7 @@ function loadSidecarBinding(source, fnName, opts) {
2073
2074
  }
2074
2075
  if (binding === void 0 && method !== void 0 && Object.hasOwn(exports, method)) {
2075
2076
  collectDiag2({
2076
- code: "nudo:interface-load",
2077
+ code: DIAG.interfaceLoad,
2077
2078
  message: `sidecar key '${method}' does not bind '${fnName}' \u2014 use '${cls}.${method}', '${cls}_${method}', or nested { ${cls}: { ${method}: \u2026 } }`,
2078
2079
  file: sidecarPath
2079
2080
  });
@@ -2082,7 +2083,7 @@ function loadSidecarBinding(source, fnName, opts) {
2082
2083
  if (binding === void 0) return { ok: false };
2083
2084
  if (!isNudoConstraint(binding)) {
2084
2085
  collectDiag2({
2085
- code: "nudo:interface-load",
2086
+ code: DIAG.interfaceLoad,
2086
2087
  message: `sidecar '${spec}' export '${fnName}' is not a Nudo constraint`,
2087
2088
  file: sidecarPath
2088
2089
  });
@@ -2090,7 +2091,7 @@ function loadSidecarBinding(source, fnName, opts) {
2090
2091
  }
2091
2092
  if (!binding.fn) {
2092
2093
  collectDiag2({
2093
- code: "nudo:interface-load",
2094
+ code: DIAG.interfaceLoad,
2094
2095
  message: `sidecar '${spec}' binding '${fnName}' is not fn() form (Phase 1 consumes only fn({ \u2026 }, \u2026) bindings)`,
2095
2096
  file: sidecarPath
2096
2097
  });
@@ -4298,7 +4299,7 @@ function checkInjectedDomainEvidence(fnName, source, records, opts) {
4298
4299
  return [
4299
4300
  {
4300
4301
  severity: "warning",
4301
- code: "nudo:interface-load",
4302
+ code: DIAG.interfaceLoad,
4302
4303
  message: `${fnName}: effective interface load failed (${e instanceof Error ? e.message : String(e)}); skipping domain-exceeds check`,
4303
4304
  fn: fnName,
4304
4305
  line: opts.loc?.line,
@@ -4322,7 +4323,7 @@ function checkInjectedDomainEvidence(fnName, source, records, opts) {
4322
4323
  const shown = [...new Set(failures)].map(evidenceToString).join(", ");
4323
4324
  out.push({
4324
4325
  severity: "error",
4325
- code: "nudo:interface-domain-exceeds",
4326
+ code: DIAG.interfaceDomainExceeds,
4326
4327
  message: `${fnName}[${param}]: cross-file call-site domain evidence ${shown} exceeds handwritten contract`,
4327
4328
  actual: shown,
4328
4329
  expected: formatConstraint(constraint),
@@ -4848,7 +4849,7 @@ function scanLiteralCalls(source, knownFns, phi, opts) {
4848
4849
  const field = fieldPath.join(".");
4849
4850
  out.push({
4850
4851
  severity: "error",
4851
- code: "nudo:constraint-violated",
4852
+ code: DIAG.constraintViolated,
4852
4853
  message: `${displayName}[${paramName}]: argument \u22AD precondition`,
4853
4854
  actual: formatAbs(arg),
4854
4855
  expected: `missing field ${field}`,
@@ -4875,7 +4876,7 @@ function scanLiteralCalls(source, knownFns, phi, opts) {
4875
4876
  if (actualPrim !== void 0 && actualPrim !== expected) {
4876
4877
  out.push({
4877
4878
  severity: "error",
4878
- code: "nudo:constraint-violated",
4879
+ code: DIAG.constraintViolated,
4879
4880
  message: `${displayName}[${paramName}]: argument \u22AD precondition`,
4880
4881
  actual: formatAbs(arg),
4881
4882
  expected: `typeof ${paramName} = "${expected}"`,
@@ -4891,7 +4892,7 @@ function scanLiteralCalls(source, knownFns, phi, opts) {
4891
4892
  if (p.op === "gt" || p.op === "ge" || p.op === "lt" || p.op === "le" || p.op === "eq" || p.op === "or") {
4892
4893
  out.push({
4893
4894
  severity: "error",
4894
- code: "nudo:constraint-violated",
4895
+ code: DIAG.constraintViolated,
4895
4896
  message: `${displayName}[${paramName}]: argument \u22AD precondition`,
4896
4897
  actual: formatAbs(arg),
4897
4898
  expected: predToString(p),
@@ -4910,7 +4911,7 @@ function scanLiteralCalls(source, knownFns, phi, opts) {
4910
4911
  if (v2 !== void 0 && lv !== v2) {
4911
4912
  out.push({
4912
4913
  severity: "error",
4913
- code: "nudo:constraint-violated",
4914
+ code: DIAG.constraintViolated,
4914
4915
  message: `${displayName}[${paramName}]: argument \u22AD precondition`,
4915
4916
  actual: formatAbs(arg),
4916
4917
  expected: predToString(p),
@@ -4936,7 +4937,7 @@ function scanLiteralCalls(source, knownFns, phi, opts) {
4936
4937
  if (!pass && !unknown2) {
4937
4938
  out.push({
4938
4939
  severity: "error",
4939
- code: "nudo:constraint-violated",
4940
+ code: DIAG.constraintViolated,
4940
4941
  message: `${displayName}[${paramName}]: argument \u22AD precondition`,
4941
4942
  actual: formatAbs(arg),
4942
4943
  expected: predToString(p),
@@ -4961,7 +4962,7 @@ function scanLiteralCalls(source, knownFns, phi, opts) {
4961
4962
  if (!ok2) {
4962
4963
  out.push({
4963
4964
  severity: "error",
4964
- code: "nudo:constraint-violated",
4965
+ code: DIAG.constraintViolated,
4965
4966
  message: `${displayName}[${paramName}]: argument \u22AD precondition`,
4966
4967
  actual: formatAbs(arg),
4967
4968
  expected: `length(${paramName}) ${opSym} ${n}`,
@@ -4976,7 +4977,7 @@ function scanLiteralCalls(source, knownFns, phi, opts) {
4976
4977
  if (typeof lv === "boolean" || lv === null) {
4977
4978
  out.push({
4978
4979
  severity: "error",
4979
- code: "nudo:constraint-violated",
4980
+ code: DIAG.constraintViolated,
4980
4981
  message: `${displayName}[${paramName}]: argument \u22AD precondition`,
4981
4982
  actual: formatAbs(arg),
4982
4983
  expected: predToString(p),
@@ -4996,7 +4997,7 @@ function scanLiteralCalls(source, knownFns, phi, opts) {
4996
4997
  if (!ok) {
4997
4998
  out.push({
4998
4999
  severity: "error",
4999
- code: "nudo:constraint-violated",
5000
+ code: DIAG.constraintViolated,
5000
5001
  message: `${displayName}[${paramName}]: argument \u22AD precondition`,
5001
5002
  actual: formatAbs(arg),
5002
5003
  expected: predToString(p),
@@ -5018,7 +5019,7 @@ function scanLiteralCalls(source, knownFns, phi, opts) {
5018
5019
  if (absArg.shape.k !== "unknown" && absArg.shape.k !== "never" && absArg.shape.k !== "any") {
5019
5020
  out.push({
5020
5021
  severity: "error",
5021
- code: "nudo:constraint-violated",
5022
+ code: DIAG.constraintViolated,
5022
5023
  message: `${displayName}[${paramName}]: argument \u22AD precondition`,
5023
5024
  actual: formatAbs(absArg),
5024
5025
  expected: `object shape at ${path}`,
@@ -5037,7 +5038,7 @@ function scanLiteralCalls(source, knownFns, phi, opts) {
5037
5038
  if (!field.optional && !field.constraint.isOptional) {
5038
5039
  out.push({
5039
5040
  severity: "error",
5040
- code: "nudo:constraint-violated",
5041
+ code: DIAG.constraintViolated,
5041
5042
  message: `${displayName}[${paramName}]: argument \u22AD precondition`,
5042
5043
  actual: formatAbs(absArg),
5043
5044
  expected: `missing field ${fieldPath}`,
@@ -5059,7 +5060,7 @@ function scanLiteralCalls(source, knownFns, phi, opts) {
5059
5060
  if (actualPrim !== constraint.prim) {
5060
5061
  out.push({
5061
5062
  severity: "error",
5062
- code: "nudo:constraint-violated",
5063
+ code: DIAG.constraintViolated,
5063
5064
  message: `${displayName}[${paramName}]: argument \u22AD precondition`,
5064
5065
  actual: formatAbs(fieldAbs),
5065
5066
  expected: `typeof ${fieldPath} = "${constraint.prim}"`,
@@ -5077,7 +5078,7 @@ function scanLiteralCalls(source, knownFns, phi, opts) {
5077
5078
  if (typeof iv === "number" && !Number.isInteger(iv)) {
5078
5079
  out.push({
5079
5080
  severity: "error",
5080
- code: "nudo:constraint-violated",
5081
+ code: DIAG.constraintViolated,
5081
5082
  message: `${displayName}[${paramName}]: argument \u22AD precondition`,
5082
5083
  actual: formatAbs(fieldAbs),
5083
5084
  expected: `${fieldPath} is int`,
@@ -5135,7 +5136,7 @@ function scanLiteralCalls(source, knownFns, phi, opts) {
5135
5136
  if (!ok2) {
5136
5137
  out.push({
5137
5138
  severity: "error",
5138
- code: "nudo:constraint-violated",
5139
+ code: DIAG.constraintViolated,
5139
5140
  message: `${displayName}[${paramName}]: argument \u22AD precondition`,
5140
5141
  actual: formatAbs(fieldAbs),
5141
5142
  expected: `length(${fieldPath}) ${opSym} ${n}`,
@@ -5156,7 +5157,7 @@ function scanLiteralCalls(source, knownFns, phi, opts) {
5156
5157
  if (!ok) {
5157
5158
  out.push({
5158
5159
  severity: "error",
5159
- code: "nudo:constraint-violated",
5160
+ code: DIAG.constraintViolated,
5160
5161
  message: `${displayName}[${paramName}]: argument \u22AD precondition`,
5161
5162
  actual: formatAbs(fieldAbs),
5162
5163
  expected: `${fieldPath} ${opSym} ${n}`,
@@ -5174,7 +5175,7 @@ function scanLiteralCalls(source, knownFns, phi, opts) {
5174
5175
  if (fieldIsLit && (typeof fieldLit === "number" || typeof fieldLit === "string" || typeof fieldLit === "boolean" || fieldLit === null || fieldLit === void 0) && ((constraint.members?.length ?? 0) > 0 || constraint.preds.some((p) => p.op === "eq")) && !literalMeetsConstraint(fieldLit, constraint)) {
5175
5176
  out.push({
5176
5177
  severity: "error",
5177
- code: "nudo:constraint-violated",
5178
+ code: DIAG.constraintViolated,
5178
5179
  message: `${displayName}[${paramName}]: argument \u22AD precondition`,
5179
5180
  actual: formatAbs(fieldAbs),
5180
5181
  expected: `${fieldPath} \u2208 ${formatConstraint(constraint)}`,
@@ -5202,7 +5203,7 @@ function scanLiteralCalls(source, knownFns, phi, opts) {
5202
5203
  const field = fieldPath.join(".");
5203
5204
  out.push({
5204
5205
  severity: "error",
5205
- code: "nudo:constraint-violated",
5206
+ code: DIAG.constraintViolated,
5206
5207
  message: `${displayName}[${paramName}]: argument \u22AD precondition`,
5207
5208
  actual: formatAbs(arg),
5208
5209
  expected: `missing field ${field}`,
@@ -5244,7 +5245,7 @@ function scanLiteralCalls(source, knownFns, phi, opts) {
5244
5245
  } else if (isExactUndef(arg) || arg.shape.k !== "unknown" && arg.shape.k !== "any") {
5245
5246
  out.push({
5246
5247
  severity: "error",
5247
- code: "nudo:constraint-violated",
5248
+ code: DIAG.constraintViolated,
5248
5249
  message: `${displayName}[${paramName}]: argument \u22AD precondition`,
5249
5250
  actual: formatAbs(arg),
5250
5251
  expected: `array at ${paramName}`,
@@ -5261,7 +5262,7 @@ function scanLiteralCalls(source, knownFns, phi, opts) {
5261
5262
  if (typeof iv === "number" && !Number.isInteger(iv)) {
5262
5263
  out.push({
5263
5264
  severity: "error",
5264
- code: "nudo:constraint-violated",
5265
+ code: DIAG.constraintViolated,
5265
5266
  message: `${displayName}[${paramName}]: argument \u22AD precondition`,
5266
5267
  actual: formatAbs(arg),
5267
5268
  expected: `${paramName} is int`,
@@ -5450,7 +5451,7 @@ function scanLiteralCalls(source, knownFns, phi, opts) {
5450
5451
  } catch {
5451
5452
  out.push({
5452
5453
  severity: "warning",
5453
- code: "nudo:no-signature",
5454
+ code: DIAG.noSignature,
5454
5455
  message: `${displayName}: external callee contract could not be resolved; skipping call-site precondition check`,
5455
5456
  fn: displayName,
5456
5457
  line: loc?.start.line,
@@ -5493,7 +5494,7 @@ function scanLiteralCalls(source, knownFns, phi, opts) {
5493
5494
  const isPromote = rel.source === "promote";
5494
5495
  out.push({
5495
5496
  severity: isPromote ? "warning" : "error",
5496
- code: "nudo:arg-structure",
5497
+ code: DIAG.argStructure,
5497
5498
  message: `${displayName}[${pname}]: argument is not a callable fn`,
5498
5499
  actual: formatAbs(absArg),
5499
5500
  expected: formatShape(expected),
@@ -5527,7 +5528,7 @@ function scanLiteralCalls(source, knownFns, phi, opts) {
5527
5528
  } catch (e) {
5528
5529
  out.push({
5529
5530
  severity: "warning",
5530
- code: "nudo:no-signature",
5531
+ code: DIAG.noSignature,
5531
5532
  message: `${displayName ?? fnName}: signature recovery failed (${e instanceof Error ? e.message : String(e)}); skipping call-site checks`,
5532
5533
  fn: displayName ?? fnName,
5533
5534
  line: loc?.start.line,
@@ -5578,7 +5579,7 @@ function actionsForIssue(i) {
5578
5579
  label: "emit a sidecar draft you can edit"
5579
5580
  };
5580
5581
  switch (i.code) {
5581
- case "nudo:constraint-violated":
5582
+ case DIAG.constraintViolated:
5582
5583
  return [
5583
5584
  {
5584
5585
  kind: "callsite",
@@ -5592,7 +5593,7 @@ function actionsForIssue(i) {
5592
5593
  },
5593
5594
  draft
5594
5595
  ];
5595
- case "nudo:assign-mismatch":
5596
+ case DIAG.assignMismatch:
5596
5597
  return [
5597
5598
  {
5598
5599
  kind: "callsite",
@@ -5601,7 +5602,7 @@ function actionsForIssue(i) {
5601
5602
  },
5602
5603
  draft
5603
5604
  ];
5604
- case "nudo:entry-may-throw":
5605
+ case DIAG.entryMayThrow:
5605
5606
  return [
5606
5607
  {
5607
5608
  kind: "draft",
@@ -5624,7 +5625,7 @@ function actionsForIssue(i) {
5624
5625
  label: "migration switch: ignore this throw class on L2"
5625
5626
  }
5626
5627
  ];
5627
- case "nudo:unproven-return":
5628
+ case DIAG.unprovenReturn:
5628
5629
  return [
5629
5630
  {
5630
5631
  kind: "relax",
@@ -5637,48 +5638,48 @@ function actionsForIssue(i) {
5637
5638
  label: "or narrow the return expression / add a precondition so the bound is implied"
5638
5639
  }
5639
5640
  ];
5640
- case "nudo:unknown-inference":
5641
- case "nudo:opaque-result":
5641
+ case DIAG.unknownInference:
5642
+ case DIAG.opaqueResult:
5642
5643
  return [
5643
5644
  { kind: "mock", label: "pin the native/unknown face with @nudo:mock" },
5644
5645
  { kind: "assume", command: "nudo check --assume", label: "state preconditions via --assume" },
5645
5646
  { kind: "info", label: "or add a call site / @nudo:case for evidence" }
5646
5647
  ];
5647
- case "nudo:arg-opaque":
5648
- case "nudo:constraint-unproven":
5648
+ case DIAG.argOpaque:
5649
+ case DIAG.constraintUnproven:
5649
5650
  return [
5650
5651
  { kind: "assume", command: "nudo check --assume", label: "state preconditions via --assume" },
5651
5652
  { kind: "info", label: "add a call site or @nudo:case" }
5652
5653
  ];
5653
- case "nudo:fork-truncated":
5654
- case "nudo:promise-micro-truncated":
5655
- case "nudo:promise-micro-error":
5654
+ case DIAG.forkTruncated:
5655
+ case DIAG.promiseMicroTruncated:
5656
+ case DIAG.promiseMicroError:
5656
5657
  return [
5657
5658
  {
5658
5659
  kind: "info",
5659
5660
  label: "results widened to unknown \u2014 raise budget (@nudo:budget forks/calls/depth on the function) or narrow control flow"
5660
5661
  }
5661
5662
  ];
5662
- case "nudo:loop-truncated":
5663
+ case DIAG.loopTruncated:
5663
5664
  return [
5664
5665
  {
5665
5666
  kind: "info",
5666
5667
  label: "loop state widened \u2014 the exit condition stayed concrete-true past the iteration cap; make the bound data-dependent (abstract) or pin the result with @nudo:case / @nudo:contract"
5667
5668
  }
5668
5669
  ];
5669
- case "nudo:recursion-truncated":
5670
+ case DIAG.recursionTruncated:
5670
5671
  return [
5671
5672
  {
5672
5673
  kind: "info",
5673
5674
  label: i.reason === "cycle" ? "call cycle: same abstract arguments already on the stack \u2014 raising @nudo:budget cannot lift it; make the arguments vary per recursion level or declare @nudo:contract" : i.reason === "depth" || i.reason === "calls" || i.reason === "budget" ? `results widened to unknown \u2014 raise budget (@nudo:budget ${i.reason === "depth" ? "depth" : i.reason === "calls" ? "calls" : "calls/depth"} on the function) or narrow the recursion` : "results widened to unknown \u2014 raise budget (@nudo:budget calls/depth on the function) or narrow control flow"
5674
5675
  }
5675
5676
  ];
5676
- case "nudo:host-effect-blocked":
5677
+ case DIAG.hostEffectBlocked:
5677
5678
  return [
5678
5679
  { kind: "mock", label: "pin the host API with @nudo:mock / @nudo:env" },
5679
5680
  { kind: "info", label: "results widened to unknown \u2014 or feed the value in from a call site" }
5680
5681
  ];
5681
- case "nudo:interface-drift":
5682
+ case DIAG.interfaceDrift:
5682
5683
  return [
5683
5684
  {
5684
5685
  kind: "emit",
@@ -5686,7 +5687,7 @@ function actionsForIssue(i) {
5686
5687
  label: "refresh the @generated segment"
5687
5688
  }
5688
5689
  ];
5689
- case "nudo:dual-entry":
5690
+ case DIAG.dualEntry:
5690
5691
  return [
5691
5692
  {
5692
5693
  kind: "info",
@@ -5821,12 +5822,12 @@ function serializeCheckJsonMulti(reports) {
5821
5822
  };
5822
5823
  }
5823
5824
  var CONTRACT_FIX_CODES = /* @__PURE__ */ new Set([
5824
- "nudo:constraint-violated",
5825
- "nudo:assign-mismatch",
5826
- "nudo:arg-structure",
5827
- "nudo:interface-domain-exceeds",
5828
- "nudo:entry-may-throw",
5829
- "nudo:missing-slot"
5825
+ DIAG.constraintViolated,
5826
+ DIAG.assignMismatch,
5827
+ DIAG.argStructure,
5828
+ DIAG.interfaceDomainExceeds,
5829
+ DIAG.entryMayThrow,
5830
+ DIAG.missingSlot
5830
5831
  ]);
5831
5832
  function budgetAttributionSegs(b) {
5832
5833
  const segs = [];