@floless/app 0.135.1 → 0.136.0

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.
@@ -563,14 +563,14 @@ var require_time_tree = __commonJS({
563
563
  * @param {number} start
564
564
  * @returns {TimeTreeNode["id"]}
565
565
  */
566
- [kAddNode](parent, label2, start2) {
566
+ [kAddNode](parent, label, start2) {
567
567
  const parentNode = this[kGetParent](parent);
568
568
  const isRoot = parentNode === null;
569
569
  if (isRoot) {
570
570
  this.root = {
571
571
  parent: null,
572
572
  id: "root",
573
- label: label2,
573
+ label,
574
574
  nodes: [],
575
575
  start: start2,
576
576
  stop: null,
@@ -579,11 +579,11 @@ var require_time_tree = __commonJS({
579
579
  this[kTrackNode](this.root);
580
580
  return this.root.id;
581
581
  }
582
- const nodeId = `${label2}-${Math.random()}`;
582
+ const nodeId = `${label}-${Math.random()}`;
583
583
  const childNode = {
584
584
  parent,
585
585
  id: nodeId,
586
- label: label2,
586
+ label,
587
587
  nodes: [],
588
588
  start: start2,
589
589
  stop: null,
@@ -599,8 +599,8 @@ var require_time_tree = __commonJS({
599
599
  * @param {number|undefined} start
600
600
  * @returns {TimeTreeNode["id"]}
601
601
  */
602
- start(parent, label2, start2 = Date.now()) {
603
- return this[kAddNode](parent, label2, start2);
602
+ start(parent, label, start2 = Date.now()) {
603
+ return this[kAddNode](parent, label, start2);
604
604
  }
605
605
  /**
606
606
  * @param {string} nodeId
@@ -6622,9 +6622,9 @@ var require_levels = __commonJS({
6622
6622
  const formatter = instance[formattersSym].level;
6623
6623
  const { labels } = instance.levels;
6624
6624
  const cache2 = {};
6625
- for (const label2 in labels) {
6626
- const level = formatter(labels[label2], Number(label2));
6627
- cache2[label2] = JSON.stringify(level).slice(0, -1);
6625
+ for (const label in labels) {
6626
+ const level = formatter(labels[label], Number(label));
6627
+ cache2[label] = JSON.stringify(level).slice(0, -1);
6628
6628
  }
6629
6629
  instance[lsCacheSym] = cache2;
6630
6630
  return instance;
@@ -7839,7 +7839,7 @@ var require_pino = __commonJS({
7839
7839
  bindings(bindings) {
7840
7840
  return bindings;
7841
7841
  },
7842
- level(label2, number) {
7842
+ level(label, number) {
7843
7843
  return { level: number };
7844
7844
  }
7845
7845
  }),
@@ -12777,9 +12777,9 @@ var require_codegen = __commonJS({
12777
12777
  }
12778
12778
  };
12779
12779
  var Label = class extends Node {
12780
- constructor(label2) {
12780
+ constructor(label) {
12781
12781
  super();
12782
- this.label = label2;
12782
+ this.label = label;
12783
12783
  this.names = {};
12784
12784
  }
12785
12785
  render({ _n }) {
@@ -12787,14 +12787,14 @@ var require_codegen = __commonJS({
12787
12787
  }
12788
12788
  };
12789
12789
  var Break = class extends Node {
12790
- constructor(label2) {
12790
+ constructor(label) {
12791
12791
  super();
12792
- this.label = label2;
12792
+ this.label = label;
12793
12793
  this.names = {};
12794
12794
  }
12795
12795
  render({ _n }) {
12796
- const label2 = this.label ? ` ${this.label}` : "";
12797
- return `break${label2};` + _n;
12796
+ const label = this.label ? ` ${this.label}` : "";
12797
+ return `break${label};` + _n;
12798
12798
  }
12799
12799
  };
12800
12800
  var Throw = class extends Node {
@@ -13206,12 +13206,12 @@ var require_codegen = __commonJS({
13206
13206
  return this._endBlockNode(For);
13207
13207
  }
13208
13208
  // `label` statement
13209
- label(label2) {
13210
- return this._leafNode(new Label(label2));
13209
+ label(label) {
13210
+ return this._leafNode(new Label(label));
13211
13211
  }
13212
13212
  // `break` statement
13213
- break(label2) {
13214
- return this._leafNode(new Break(label2));
13213
+ break(label) {
13214
+ return this._leafNode(new Break(label));
13215
13215
  }
13216
13216
  // `return` statement
13217
13217
  return(value) {
@@ -28554,9 +28554,9 @@ var require_node = __commonJS({
28554
28554
  }
28555
28555
  return staticChild.createStaticChild(path.slice(i));
28556
28556
  }
28557
- const label2 = path.charAt(0);
28558
- this.staticChildren[label2] = new StaticNode(path);
28559
- return this.staticChildren[label2];
28557
+ const label = path.charAt(0);
28558
+ this.staticChildren[label] = new StaticNode(path);
28559
+ return this.staticChildren[label];
28560
28560
  }
28561
28561
  };
28562
28562
  var StaticNode = class _StaticNode extends ParentNode {
@@ -51122,9 +51122,9 @@ var import_node_perf_hooks = require("node:perf_hooks");
51122
51122
  var MAX_EXPECTED_MS = 2 * 60 * 6e4;
51123
51123
  var MAX_LABEL_LENGTH = 60;
51124
51124
  function busyMeta(owner2) {
51125
- const label2 = typeof owner2.label === "string" && owner2.label.trim() && owner2.label.length <= MAX_LABEL_LENGTH ? owner2.label.trim() : null;
51125
+ const label = typeof owner2.label === "string" && owner2.label.trim() && owner2.label.length <= MAX_LABEL_LENGTH ? owner2.label.trim() : null;
51126
51126
  const expectedMs = typeof owner2.expectedMs === "number" && Number.isFinite(owner2.expectedMs) && owner2.expectedMs > 0 && owner2.expectedMs <= MAX_EXPECTED_MS ? owner2.expectedMs : null;
51127
- return { label: label2, expectedMs };
51127
+ return { label, expectedMs };
51128
51128
  }
51129
51129
  var LifecycleLockBusyError = class extends Error {
51130
51130
  constructor(message, busy) {
@@ -51146,7 +51146,7 @@ function remainingPhrase(remainingMs) {
51146
51146
  return `about ${minutes} minute${minutes === 1 ? "" : "s"} left`;
51147
51147
  }
51148
51148
  function busyDetail(kind, key2, owner2) {
51149
- const { label: label2, expectedMs } = busyMeta(owner2);
51149
+ const { label, expectedMs } = busyMeta(owner2);
51150
51150
  const startedMs = Date.parse(owner2.acquiredAt);
51151
51151
  const elapsedMs = Number.isFinite(startedMs) ? Math.max(0, Date.now() - startedMs) : 0;
51152
51152
  const usableEta = expectedMs != null && Number.isFinite(startedMs) ? expectedMs : null;
@@ -51154,7 +51154,7 @@ function busyDetail(kind, key2, owner2) {
51154
51154
  return {
51155
51155
  kind,
51156
51156
  key: key2,
51157
- label: label2,
51157
+ label,
51158
51158
  startedAt: owner2.acquiredAt,
51159
51159
  expectedMs: usableEta,
51160
51160
  elapsedMs,
@@ -51195,8 +51195,8 @@ var held = new import_node_async_hooks.AsyncLocalStorage();
51195
51195
  var localTails = /* @__PURE__ */ new Map();
51196
51196
  var localIntents = /* @__PURE__ */ new Map();
51197
51197
  function registerIntent(token2, options) {
51198
- const { label: label2, expectedMs } = busyMeta(options);
51199
- const intent = { label: label2, expectedMs, acquiredAt: null };
51198
+ const { label, expectedMs } = busyMeta(options);
51199
+ const intent = { label, expectedMs, acquiredAt: null };
51200
51200
  const set2 = localIntents.get(token2) ?? /* @__PURE__ */ new Set();
51201
51201
  set2.add(intent);
51202
51202
  localIntents.set(token2, set2);
@@ -55058,7 +55058,7 @@ function appVersion() {
55058
55058
  return resolveVersion({
55059
55059
  isSea: isSea2(),
55060
55060
  sqVersionXml: readSqVersionXml(),
55061
- define: true ? "0.135.1" : void 0,
55061
+ define: true ? "0.136.0" : void 0,
55062
55062
  pkgVersion: readPkgVersion()
55063
55063
  });
55064
55064
  }
@@ -55074,7 +55074,7 @@ function resolveChannel(s) {
55074
55074
  function appChannel() {
55075
55075
  return resolveChannel({
55076
55076
  isSea: isSea2(),
55077
- define: true ? "0.135.1" : void 0,
55077
+ define: true ? "0.136.0" : void 0,
55078
55078
  // argv[1] is the entry the runtime actually loaded (…/dist/floless-server.cjs), which is what
55079
55079
  // carries the npx cache prefix. Absent under the SEA exe, which never reaches the npx branch.
55080
55080
  modulePath: process.argv[1]
@@ -55877,9 +55877,9 @@ function partFrame(from, to, up = [0, 0, 1], upX = [1, 0, 0]) {
55877
55877
  const len = Math.sqrt(dSq);
55878
55878
  if (!(len > 0) || !isFinite(len)) return null;
55879
55879
  const x = [d[0] / len, d[1] / len, d[2] / len];
55880
- const unit2 = (v, label2, min = 0) => {
55880
+ const unit2 = (v, label, min = 0) => {
55881
55881
  const l = Math.hypot(v[0], v[1], v[2]);
55882
- if (!(l > min) || !isFinite(l)) throw new Error(`partFrame ${label2} must be finite and non-degenerate`);
55882
+ if (!(l > min) || !isFinite(l)) throw new Error(`partFrame ${label} must be finite and non-degenerate`);
55883
55883
  return [v[0] / l, v[1] / l, v[2] / l];
55884
55884
  };
55885
55885
  const u = unit2(up, "up");
@@ -55939,6 +55939,25 @@ var SUPPORT_CENTERLINE_V1 = Object.freeze({
55939
55939
  minCrossingAngleDeg: 15,
55940
55940
  absoluteReachCapMm: 914.4,
55941
55941
  geometryReviewToleranceMm: 6.35,
55942
+ /**
55943
+ * How far a reader's submitted endpoint may sit from the server-derived drawing observation before
55944
+ * the read is refused (world mm — one micron).
55945
+ *
55946
+ * The comparison used to be exact JSON equality, which asked an independent reader to reproduce a
55947
+ * trig-laden similarity transform and land on the same side of `clean()`'s 1e-9 rounding boundary for
55948
+ * every endpoint. Nothing can hold that: a 250-member read was refused because three endpoints out of
55949
+ * 430 landed one 1e-9 quantum away, while the worst geometric disagreement across all 430 was
55950
+ * 6.77e-10 mm (#934). Quantising both sides does not help — it only relocates the same cliff — so the
55951
+ * comparison has to be a DISTANCE.
55952
+ *
55953
+ * 1e-3 mm is ~6 orders above the observed float noise and ~4 orders below the smallest thing the
55954
+ * check must still catch. A pre-extended endpoint hides the outward intersection by a drawing
55955
+ * setback, and this policy's own floor for a meaningful endpoint distance is
55956
+ * `geometryReviewToleranceMm` (6.35 mm) — 3.8 orders above this tolerance — so nothing the check
55957
+ * exists to catch fits inside it. Anything in 1e-5..1e-2 works; the point of the number is that it
55958
+ * sits in the middle of a very wide safe band, not that it is tuned.
55959
+ */
55960
+ literalEvidenceToleranceMm: 1e-3,
55942
55961
  maxSubjectEnds: 2e4,
55943
55962
  maxObservationsPerEnd: 16,
55944
55963
  maxMemberIdsPerTarget: 16,
@@ -56194,14 +56213,25 @@ function checkModelReferences(doc) {
56194
56213
  });
56195
56214
  arr(p.memberRefs).forEach((id, ri) => memberRef(str(id), `$.plans[${pi}].memberRefs[${ri}]`, "member-ref-unresolved"));
56196
56215
  const has = (k) => p[k] !== void 0 && p[k] !== null;
56197
- if (has("control2_at") && !has("control2_ref")) {
56198
- add(`$.plans[${pi}]`, "control-pair-incomplete", `sheet "${sheet ?? pi}" has control2_at with no control2_ref; a second control is never the model origin, so the intersection it names must be stated`);
56199
- }
56200
- for (const side2 of ["datum", "control2"]) {
56201
- if (has(`${side2}_ref`) && !has(`${side2}_at`)) {
56202
- add(`$.plans[${pi}]`, "control-pair-incomplete", `sheet "${sheet ?? pi}" has ${side2}_ref with no ${side2}_at; naming an intersection without its point on the sheet registers nothing`);
56216
+ if (p.viewKind === "plan") {
56217
+ if (has("control2_at") && !has("control2_ref")) {
56218
+ add(`$.plans[${pi}]`, "control-pair-incomplete", `sheet "${sheet ?? pi}" has control2_at with no control2_ref; a second control is never the model origin, so the intersection it names must be stated`);
56219
+ }
56220
+ for (const side2 of ["datum", "control2"]) {
56221
+ if (has(`${side2}_ref`) && !has(`${side2}_at`)) {
56222
+ add(`$.plans[${pi}]`, "control-pair-incomplete", `sheet "${sheet ?? pi}" has ${side2}_ref with no ${side2}_at; naming an intersection without its point on the sheet registers nothing`);
56223
+ }
56203
56224
  }
56204
56225
  }
56226
+ const planStyleControls = ["datum_at", "datum_ref", "control2_at", "control2_ref"].filter((k) => has(k));
56227
+ if (p.viewKind !== "plan" && !isObj(p.sourceRegistration) && planStyleControls.length) {
56228
+ const kind = str(p.viewKind) ?? "";
56229
+ add(
56230
+ `$.plans[${pi}]`,
56231
+ "plan-controls-on-non-plan-view",
56232
+ `sheet "${sheet ?? pi}" is ${kind === "elevation" ? "an elevation" : kind ? `a ${kind}` : "an unclassified"} view carrying ${planStyleControls.map((k) => `$.${k}`).join(", ")} and nothing else; those register a PLAN and are ignored here \u2014 an elevation or section registers through $.sourceRegistration`
56233
+ );
56234
+ }
56205
56235
  const registration = isObj(p.sourceRegistration) ? p.sourceRegistration : null;
56206
56236
  if (registration) {
56207
56237
  const rp = `$.plans[${pi}].sourceRegistration`;
@@ -56503,6 +56533,29 @@ function checkModelReferences(doc) {
56503
56533
  else compare("z", parsed.levels.length);
56504
56534
  }
56505
56535
  const axisIds = new Set(axes.map((a) => isObj(a) ? str(a.id) : null).filter((v) => !!v));
56536
+ const axisDir = /* @__PURE__ */ new Map();
56537
+ for (const a of axes) {
56538
+ if (isObj(a)) {
56539
+ const id = str(a.id), dir = str(a.dir);
56540
+ if (id && dir) axisDir.set(id, dir);
56541
+ }
56542
+ }
56543
+ plans.forEach((p, pi) => {
56544
+ if (!isObj(p)) return;
56545
+ for (const key2 of ["datum_ref", "control2_ref"]) {
56546
+ const ref = isObj(p[key2]) ? p[key2] : null;
56547
+ if (!ref) continue;
56548
+ for (const [field, want] of [["xAxisId", "x"], ["yAxisId", "y"]]) {
56549
+ const id = str(ref[field]);
56550
+ const path = `$.plans[${pi}].${key2}.${field}`;
56551
+ if (!id || !axisIds.has(id)) {
56552
+ add(path, "control-ref-unresolved", `${field} "${id ?? ""}" does not name a $.grid.axes[].id \u2014 registration controls resolve against stable axis IDS, never the editable display label`);
56553
+ } else if (axisDir.get(id) !== want) {
56554
+ add(path, "control-ref-direction", `${field} names axis "${id}", which runs in ${axisDir.get(id) ?? "no"} \u2014 ${field} must name a ${want}-direction axis`);
56555
+ }
56556
+ }
56557
+ }
56558
+ });
56506
56559
  if (isObj(grid.ends)) {
56507
56560
  for (const [key2, span] of Object.entries(grid.ends)) {
56508
56561
  if (!axisIds.has(key2)) {
@@ -56583,12 +56636,12 @@ function checkModelReferences(doc) {
56583
56636
  if (gen) {
56584
56637
  const sheet = str(gen.sheet);
56585
56638
  if (sheet && !planSheets.has(sheet)) add(`$.views[${vi}].generated.sheet`, "view-generated-unresolved", `"${sheet}" does not name a plan`);
56586
- const axisId = str(gen.axisId);
56639
+ const axisId2 = str(gen.axisId);
56587
56640
  const wantDir = gen.kind === "level" ? "z" : gen.kind === "grid-x" ? "x" : gen.kind === "grid-y" ? "y" : null;
56588
56641
  if (wantDir === null) add(`$.views[${vi}].generated.kind`, "view-generated-unresolved", `unknown generated kind "${str(gen.kind)}"`);
56589
- const axis = arr(grid?.axes).find((a) => isObj(a) && str(a.id) === axisId);
56590
- if (axisId && (!axis || axis.dir !== wantDir)) {
56591
- add(`$.views[${vi}].generated.axisId`, "view-generated-unresolved", `"${axisId}" does not name a grid axis with dir "${wantDir}"`);
56642
+ const axis = arr(grid?.axes).find((a) => isObj(a) && str(a.id) === axisId2);
56643
+ if (axisId2 && (!axis || axis.dir !== wantDir)) {
56644
+ add(`$.views[${vi}].generated.axisId`, "view-generated-unresolved", `"${axisId2}" does not name a grid axis with dir "${wantDir}"`);
56592
56645
  }
56593
56646
  }
56594
56647
  });
@@ -60221,12 +60274,12 @@ function writePhase(txnDir, journal) {
60221
60274
  }
60222
60275
  }
60223
60276
  }
60224
- function validateProof(value, label2) {
60277
+ function validateProof(value, label) {
60225
60278
  if (!value || typeof value !== "object" || Array.isArray(value)) {
60226
- throw new IfcPublicationError(`${label2} proof is invalid.`);
60279
+ throw new IfcPublicationError(`${label} proof is invalid.`);
60227
60280
  }
60228
60281
  const p = value;
60229
- if (typeof p.exists !== "boolean" || typeof p.bytes !== "number" || !Number.isSafeInteger(p.bytes) || p.bytes < 0 || !(p.exists && typeof p.sha256 === "string" && /^[a-f0-9]{64}$/i.test(p.sha256) && p.bytes > 0 || !p.exists && p.sha256 === null && p.bytes === 0)) throw new IfcPublicationError(`${label2} proof is invalid.`);
60282
+ if (typeof p.exists !== "boolean" || typeof p.bytes !== "number" || !Number.isSafeInteger(p.bytes) || p.bytes < 0 || !(p.exists && typeof p.sha256 === "string" && /^[a-f0-9]{64}$/i.test(p.sha256) && p.bytes > 0 || !p.exists && p.sha256 === null && p.bytes === 0)) throw new IfcPublicationError(`${label} proof is invalid.`);
60230
60283
  return p;
60231
60284
  }
60232
60285
  function validateJournal(raw, txnDir, expectedTxnId) {
@@ -60952,9 +61005,9 @@ var navLeaf = (family) => ({
60952
61005
  families: [family],
60953
61006
  count: PROFILE_FAMILY_COUNTS[family]
60954
61007
  });
60955
- var navParent = (id, label2, families) => ({
61008
+ var navParent = (id, label, families) => ({
60956
61009
  id,
60957
- label: label2,
61010
+ label,
60958
61011
  families,
60959
61012
  count: families.reduce((sum, family) => sum + PROFILE_FAMILY_COUNTS[family], 0),
60960
61013
  children: families.map(navLeaf)
@@ -62493,14 +62546,14 @@ function durableReplace2(path, text5) {
62493
62546
  function safeLease(value) {
62494
62547
  if (!SAFE_LEASE.test(value)) throw new Error("invalid Codex lease id");
62495
62548
  }
62496
- function rejectLink(path, label2) {
62549
+ function rejectLink(path, label) {
62497
62550
  let st;
62498
62551
  try {
62499
62552
  st = (0, import_node_fs30.lstatSync)(path);
62500
62553
  } catch {
62501
- throw new Error(`${label2} not found`);
62554
+ throw new Error(`${label} not found`);
62502
62555
  }
62503
- if (st.isSymbolicLink()) throw new Error(`${label2} is a filesystem link/reparse point`);
62556
+ if (st.isSymbolicLink()) throw new Error(`${label} is a filesystem link/reparse point`);
62504
62557
  }
62505
62558
  var ps = (value) => value.replace(/'/g, "''");
62506
62559
  var sh = (value) => value.replace(/'/g, `'"'"'`);
@@ -64459,20 +64512,20 @@ var INTERNAL_VISIBLE_WORDS = /\b(?:schema|api|manifest|ledger|registration|bindi
64459
64512
  var ITEM_STATES = /* @__PURE__ */ new Set(["pending", "done", "now", "blocked", "waiting", "provisional"]);
64460
64513
  var STATUSES = /* @__PURE__ */ new Set(["active", "waiting", "blocked", "complete", "cancelled"]);
64461
64514
  var SOURCE_SKILLS = new Set(STEEL_PROGRESS_SOURCE_SKILLS);
64462
- function exactKeys(value, allowed, label2) {
64515
+ function exactKeys(value, allowed, label) {
64463
64516
  const unexpected = Object.keys(value).filter((key2) => !allowed.includes(key2));
64464
- if (unexpected.length) throw new SteelProgressError(`${label2} contains unsupported fields`);
64517
+ if (unexpected.length) throw new SteelProgressError(`${label} contains unsupported fields`);
64465
64518
  }
64466
- function boundedText(value, label2, max2, nullable = false) {
64519
+ function boundedText(value, label, max2, nullable = false) {
64467
64520
  if (nullable && value === null) return null;
64468
64521
  if (typeof value !== "string" || !value.trim() || value.length > max2 || /[\u0000-\u0008\u000B\u000C\u000E-\u001F]/.test(value)) {
64469
- throw new SteelProgressError(`${label2} must be plain text within ${max2} characters`);
64522
+ throw new SteelProgressError(`${label} must be plain text within ${max2} characters`);
64470
64523
  }
64471
64524
  return value.trim();
64472
64525
  }
64473
- function rejectInternalVisibleTerms(value, label2) {
64526
+ function rejectInternalVisibleTerms(value, label) {
64474
64527
  if (value && INTERNAL_VISIBLE_WORDS.test(value)) {
64475
- throw new SteelProgressError(`${label2} must use plain English without internal terms`);
64528
+ throw new SteelProgressError(`${label} must use plain English without internal terms`);
64476
64529
  }
64477
64530
  }
64478
64531
  function validateSteelProgressInput(value, requestId) {
@@ -66679,7 +66732,7 @@ function expandCustom(joint, review) {
66679
66732
  positions[k + 2] = g.positions[k + 2] + dz;
66680
66733
  }
66681
66734
  const role = typeof g.role === "string" ? g.role : void 0;
66682
- const label2 = role ? role.charAt(0).toUpperCase() + role.slice(1) : "Imported part";
66735
+ const label = role ? role.charAt(0).toUpperCase() + role.slice(1) : "Imported part";
66683
66736
  const lift = review && review.get(joint.id);
66684
66737
  out.push({
66685
66738
  id: `${joint.id}:${g.id || `m${i}`}`,
@@ -66687,7 +66740,7 @@ function expandCustom(joint, review) {
66687
66740
  kind: "mesh",
66688
66741
  positions,
66689
66742
  indices: g.indices.slice(),
66690
- meta: { label: label2, role, ...lift ? { connReview: lift } : {} }
66743
+ meta: { label, role, ...lift ? { connReview: lift } : {} }
66691
66744
  });
66692
66745
  });
66693
66746
  return out;
@@ -67445,18 +67498,18 @@ function buildManifest(scene) {
67445
67498
  if (ref.axes.length === 0) fail2(`the scene's grid "${id}" must state at least one axis.`);
67446
67499
  for (const axisRaw of ref.axes) {
67447
67500
  const axis = obj2(axisRaw);
67448
- const label2 = typeof axis.label === "string" ? axis.label : str2(axis.id);
67501
+ const label = typeof axis.label === "string" ? axis.label : str2(axis.id);
67449
67502
  const direction = axis.direction;
67450
67503
  if (direction !== "x" && direction !== "y") {
67451
- fail2(`the scene's grid axis "${label2}" direction must be exactly "x" or "y".`);
67504
+ fail2(`the scene's grid axis "${label}" direction must be exactly "x" or "y".`);
67452
67505
  }
67453
67506
  const offset = axis.offsetMm;
67454
- if (typeof offset !== "number" || !Number.isFinite(offset)) fail2(`the scene's grid axis "${label2}" states no offsetMm, so the checker cannot say where it belongs.`);
67507
+ if (typeof offset !== "number" || !Number.isFinite(offset)) fail2(`the scene's grid axis "${label}" states no offsetMm, so the checker cannot say where it belongs.`);
67455
67508
  const finiteEnd = (key2, fallback2) => {
67456
67509
  const value = axis[key2];
67457
67510
  if (value === void 0) return fallback2;
67458
67511
  if (typeof value !== "number" || !Number.isFinite(value)) {
67459
- fail2(`the scene's grid axis "${label2}" ${key2} must be a finite number when stated.`);
67512
+ fail2(`the scene's grid axis "${label}" ${key2} must be a finite number when stated.`);
67460
67513
  }
67461
67514
  return value;
67462
67515
  };
@@ -67464,7 +67517,7 @@ function buildManifest(scene) {
67464
67517
  const lo = finiteEnd("startMm", bound(isU ? "minY" : "minX"));
67465
67518
  const hi = finiteEnd("endMm", bound(isU ? "maxY" : "maxX"));
67466
67519
  const o = offset;
67467
- (isU ? u : v).push(isU ? { label: label2, p0: [o, lo], p1: [o, hi] } : { label: label2, p0: [lo, o], p1: [hi, o] });
67520
+ (isU ? u : v).push(isU ? { label, p0: [o, lo], p1: [o, hi] } : { label, p0: [lo, o], p1: [hi, o] });
67468
67521
  }
67469
67522
  gridAxes.push({ sceneId: id, gridGuid: guid, origin, u, v });
67470
67523
  for (const levelRaw of arr2(ref.levels)) {
@@ -67845,9 +67898,9 @@ function checkGridAxes(index, manifest) {
67845
67898
  }
67846
67899
  }
67847
67900
  function checkSpatialStructure(index, manifest) {
67848
- for (const [type, label2] of [["IFCPROJECT", "project"], ["IFCSITE", "site"], ["IFCBUILDING", "building"], ["IFCBUILDINGSTOREY", "storey"]]) {
67901
+ for (const [type, label] of [["IFCPROJECT", "project"], ["IFCSITE", "site"], ["IFCBUILDING", "building"], ["IFCBUILDINGSTOREY", "storey"]]) {
67849
67902
  const found = index.byType(type).length;
67850
- if (found !== 1) fail2(`the IFC has ${found} ${label2} records, expected exactly 1.`);
67903
+ if (found !== 1) fail2(`the IFC has ${found} ${label} records, expected exactly 1.`);
67851
67904
  }
67852
67905
  const aggregates = index.byType("IFCRELAGGREGATES");
67853
67906
  if (aggregates.length !== 3) fail2(`the IFC has ${aggregates.length} spatial aggregations, expected 3.`);
@@ -67984,9 +68037,9 @@ function checkIfcArtifact(sceneInput, receipt, emitted, index, bytes2) {
67984
68037
  }
67985
68038
 
67986
68039
  // export-receipt.ts
67987
- function record2(value, label2) {
68040
+ function record2(value, label) {
67988
68041
  if (!value || typeof value !== "object" || Array.isArray(value)) {
67989
- throw new ReceiptReconciliationError(`${label2} must be an object.`);
68042
+ throw new ReceiptReconciliationError(`${label} must be an object.`);
67990
68043
  }
67991
68044
  return value;
67992
68045
  }
@@ -68945,8 +68998,8 @@ function modelGridRecords(grid) {
68945
68998
  const axes = [];
68946
68999
  X.offsets.forEach((offsetMm, index) => {
68947
69000
  const axis = xAxes[index];
68948
- const label2 = labelX[index] || "";
68949
- if (!label2) throw new SceneContractError("The model grid has a blank X-axis label.");
69001
+ const label = labelX[index] || "";
69002
+ if (!label) throw new SceneContractError("The model grid has a blank X-axis label.");
68950
69003
  const span = ends[axis.id];
68951
69004
  const start2 = span ? Math.min(span[0], span[1]) - oy : bounds.minY;
68952
69005
  const end = span ? Math.max(span[0], span[1]) - oy : bounds.maxY;
@@ -68954,15 +69007,15 @@ function modelGridRecords(grid) {
68954
69007
  id: `${root6}:${axis.id}`,
68955
69008
  direction: "x",
68956
69009
  offsetMm,
68957
- label: label2,
69010
+ label,
68958
69011
  ...Math.abs(start2 - bounds.minY) > 0.5 ? { startMm: start2 } : {},
68959
69012
  ...Math.abs(end - bounds.maxY) > 0.5 ? { endMm: end } : {}
68960
69013
  });
68961
69014
  });
68962
69015
  Y.offsets.forEach((offsetMm, index) => {
68963
69016
  const axis = yAxes[index];
68964
- const label2 = labelY[index] || "";
68965
- if (!label2) throw new SceneContractError("The model grid has a blank Y-axis label.");
69017
+ const label = labelY[index] || "";
69018
+ if (!label) throw new SceneContractError("The model grid has a blank Y-axis label.");
68966
69019
  const span = ends[axis.id];
68967
69020
  const start2 = span ? Math.min(span[0], span[1]) - ox : bounds.minX;
68968
69021
  const end = span ? Math.max(span[0], span[1]) - ox : bounds.maxX;
@@ -68970,7 +69023,7 @@ function modelGridRecords(grid) {
68970
69023
  id: `${root6}:${axis.id}`,
68971
69024
  direction: "y",
68972
69025
  offsetMm,
68973
- label: label2,
69026
+ label,
68974
69027
  ...Math.abs(start2 - bounds.minX) > 0.5 ? { startMm: start2 } : {},
68975
69028
  ...Math.abs(end - bounds.maxX) > 0.5 ? { endMm: end } : {}
68976
69029
  });
@@ -68980,9 +69033,9 @@ function modelGridRecords(grid) {
68980
69033
  [...parsedLevels].sort((a, b) => a.sourceIndex - b.sourceIndex).forEach((level, index) => axisBySourceIndex.set(level.sourceIndex, zAxes[index]));
68981
69034
  const levels = parsedLevels.map((level) => {
68982
69035
  const axis = axisBySourceIndex.get(level.sourceIndex);
68983
- const label2 = (axis.label ?? "").trim() || level.label;
68984
- if (!label2) throw new SceneContractError("The model grid has a blank elevation label.");
68985
- return { id: `${root6}:${axis.id}`, elevationMm: level.mm, label: label2 };
69036
+ const label = (axis.label ?? "").trim() || level.label;
69037
+ if (!label) throw new SceneContractError("The model grid has a blank elevation label.");
69038
+ return { id: `${root6}:${axis.id}`, elevationMm: level.mm, label };
68986
69039
  });
68987
69040
  const record4 = {
68988
69041
  id: root6,
@@ -69845,6 +69898,8 @@ var clean = (n) => {
69845
69898
  return Object.is(q, -0) ? 0 : q;
69846
69899
  };
69847
69900
  var finite2 = (p) => Array.isArray(p) && p.length === 2 && p.every(Number.isFinite);
69901
+ var round2 = (n) => Math.round(n * 100) / 100;
69902
+ var REGISTRATION_SPAN_TOLERANCE_PT = 2;
69848
69903
  var PlanTransformError = class extends Error {
69849
69904
  constructor(code, message, viewKind = null) {
69850
69905
  super(message);
@@ -69881,25 +69936,26 @@ function gridIntersection(grid, ref, plan, field) {
69881
69936
  plan
69882
69937
  );
69883
69938
  }
69884
- if (!ref || typeof ref !== "object" || typeof ref.axis_x !== "string" || typeof ref.axis_y !== "string") {
69885
- return refuse("control-ref-invalid", `sheet "${quote(plan.sheet)}" has an unreadable ${field}: a registration control needs string axis_x and axis_y labels`, plan);
69939
+ if (!ref || typeof ref !== "object" || typeof ref.xAxisId !== "string" || typeof ref.yAxisId !== "string") {
69940
+ return refuse("control-ref-invalid", `sheet "${quote(plan.sheet)}" has an unreadable ${field}: a registration control needs string xAxisId and yAxisId grid axis ids`, plan);
69886
69941
  }
69887
69942
  const X = parseSpacings(grid.x), Y = parseSpacings(grid.y);
69888
69943
  if (X.err || Y.err) {
69889
69944
  const bad = X.err ? "$.grid.x" : "$.grid.y";
69890
69945
  return refuse("grid-spacing-invalid", `sheet "${quote(plan.sheet)}" cannot use ${bad}: ${quote(X.err || Y.err)}`, plan);
69891
69946
  }
69892
- const xs = axisLabelsFor(grid, "x", "num", X.offsets.length);
69893
- const ys = axisLabelsFor(grid, "y", "alpha", Y.offsets.length);
69894
- const uniqueIndex = (labels, wanted) => {
69895
- const hits = labels.map((label2, i) => label2 === wanted ? i : -1).filter((i) => i >= 0);
69947
+ const idsFor = (dir) => (Array.isArray(grid.axes) ? grid.axes.filter((a) => a && a.dir === dir) : []).map((a) => typeof a.id === "string" ? a.id : null);
69948
+ const xs = idsFor("x"), ys = idsFor("y");
69949
+ const uniqueIndex = (ids, wanted, count2) => {
69950
+ if (ids.length !== count2) return -1;
69951
+ const hits = ids.map((id, i) => id === wanted ? i : -1).filter((i) => i >= 0);
69896
69952
  return hits.length === 1 ? hits[0] : -1;
69897
69953
  };
69898
- const xi = uniqueIndex(xs, ref.axis_x), yi = uniqueIndex(ys, ref.axis_y);
69954
+ const xi = uniqueIndex(xs, ref.xAxisId, X.offsets.length), yi = uniqueIndex(ys, ref.yAxisId, Y.offsets.length);
69899
69955
  if (xi < 0 || yi < 0) {
69900
69956
  return refuse(
69901
69957
  "control-ref-unresolved",
69902
- `sheet "${quote(plan.sheet)}" ${field} names ${quote(ref.axis_x)}/${quote(ref.axis_y)}, which is not exactly one x and one y label on the model grid`,
69958
+ `sheet "${quote(plan.sheet)}" ${field} names ${quote(ref.xAxisId)}/${quote(ref.yAxisId)}, which is not exactly one x and one y axis id on the model grid`,
69903
69959
  plan
69904
69960
  );
69905
69961
  }
@@ -69944,6 +70000,15 @@ function planTransform(plan) {
69944
70000
  const datum = plan.datum_ref ? "$.datum_ref and $.control2_ref resolve to the same grid intersection" : "$.control2_ref resolves to the model origin, which is where an absent $.datum_ref already puts the datum";
69945
70001
  return refuse("registration-degenerate", `sheet "${quote(plan.sheet)}" has coincident registration controls: ${datum}`, plan);
69946
70002
  }
70003
+ const actualSpanPt = localLen / scale;
70004
+ const expectedSpanPt = worldLen / scale;
70005
+ if (Math.abs(actualSpanPt - expectedSpanPt) > REGISTRATION_SPAN_TOLERANCE_PT) {
70006
+ return refuse(
70007
+ "registration-span-mismatch",
70008
+ `sheet "${quote(plan.sheet)}" registration controls span ${round2(actualSpanPt)} pt on the sheet, but ${plan.datum_ref ? "$.datum_ref" : "the model origin"} and $.control2_ref are ${round2(worldLen)} mm apart, which at ${plan.pt_per_ft} pt/ft is ${round2(expectedSpanPt)} pt \u2014 a difference of ${round2(Math.abs(actualSpanPt - expectedSpanPt))} pt, past the ${REGISTRATION_SPAN_TOLERANCE_PT} pt allowed. Either a control names the wrong grid axis or $.pt_per_ft is wrong`,
70009
+ plan
70010
+ );
70011
+ }
69947
70012
  const fitScale = worldLen / localLen;
69948
70013
  const rotation = Math.atan2(worldDelta[1], worldDelta[0]) - Math.atan2(local1[1], local1[0]);
69949
70014
  const c = Math.cos(rotation) * fitScale;
@@ -70427,6 +70492,17 @@ var EvidenceNotes = class _EvidenceNotes {
70427
70492
  static key(memberId, end, reason) {
70428
70493
  return `${memberId}\0${end}\0${reason}`;
70429
70494
  }
70495
+ /**
70496
+ * What `publish` collapses duplicates ON — the note text unless a caller supplies something coarser.
70497
+ *
70498
+ * #925's whole property is that ONE shared defect states itself once however many endpoints it
70499
+ * blocks, and that worked because a shared defect produced a byte-identical sentence. A note carrying
70500
+ * a per-endpoint MEASUREMENT breaks it: 500 endpoints on one wrong-scale sheet became 500 distinct
70501
+ * notes and an audit line reading "2 diagnoses; and 498 further distinct diagnoses" for one fault.
70502
+ * So a note whose text varies per endpoint names the part that does NOT — the reason and the
70503
+ * allowance — and one exemplar is published carrying its own numbers.
70504
+ */
70505
+ dedupeKeys = /* @__PURE__ */ new Map();
70430
70506
  /**
70431
70507
  * First note wins for an endpoint+reason — it is the first failure the reader has to fix anyway —
70432
70508
  * EXCEPT when `comprehensive` says this one accounts for every offender at once. A scope-level
@@ -70434,9 +70510,10 @@ var EvidenceNotes = class _EvidenceNotes {
70434
70510
  * sheet that observation came from; publishing the narrower of the two is true but sends the author
70435
70511
  * round the repair-and-re-audit loop once per sheet, which is what #925 is about.
70436
70512
  */
70437
- record(memberId, end, reason, note, comprehensive = false) {
70513
+ record(memberId, end, reason, note, comprehensive = false, dedupeKey) {
70438
70514
  const key2 = _EvidenceNotes.key(memberId, end, reason);
70439
70515
  if (this.byEndpoint.has(key2) && !comprehensive) return;
70516
+ this.dedupeKeys.set(key2, dedupeKey ?? note);
70440
70517
  let text5 = note;
70441
70518
  while (text5.length > 0 && Buffer.byteLength(JSON.stringify(text5), "utf8") > MAX_EVIDENCE_NOTE_JSON_BYTES) {
70442
70519
  text5 = clipQuoted(text5, text5.length - 1);
@@ -70454,27 +70531,33 @@ var EvidenceNotes = class _EvidenceNotes {
70454
70531
  publish(findings, retainedMemberIds) {
70455
70532
  const byReason = /* @__PURE__ */ new Map();
70456
70533
  const seen = /* @__PURE__ */ new Map();
70534
+ const kept = /* @__PURE__ */ new Set();
70457
70535
  for (const finding of findings) {
70458
70536
  if (retainedMemberIds.has(finding.memberId)) continue;
70459
70537
  for (const reason of finding.reasonCodes) {
70460
70538
  if (!ENDPOINT_EVIDENCE_BLOCKING_REASONS.has(reason)) continue;
70461
- const note = this.byEndpoint.get(_EvidenceNotes.key(finding.memberId, finding.end, reason));
70539
+ const endpointKey = _EvidenceNotes.key(finding.memberId, finding.end, reason);
70540
+ const note = this.byEndpoint.get(endpointKey);
70462
70541
  if (note === void 0) continue;
70542
+ const dedupeKey = this.dedupeKeys.get(endpointKey) ?? note;
70463
70543
  let all = seen.get(reason);
70464
70544
  if (!all) {
70465
70545
  all = /* @__PURE__ */ new Set();
70466
70546
  seen.set(reason, all);
70467
70547
  }
70468
- all.add(note);
70548
+ all.add(dedupeKey);
70469
70549
  let notes2 = byReason.get(reason);
70470
70550
  if (!notes2) {
70471
70551
  notes2 = /* @__PURE__ */ new Set();
70472
70552
  byReason.set(reason, notes2);
70473
70553
  }
70474
- if (notes2.size < MAX_NOTES_PER_REASON) notes2.add(note);
70554
+ if (!kept.has(dedupeKey) && notes2.size < MAX_NOTES_PER_REASON) {
70555
+ kept.add(dedupeKey);
70556
+ notes2.add(note);
70557
+ }
70475
70558
  }
70476
70559
  }
70477
- const notes = [...byReason].flatMap(([reason, kept]) => [...kept].sort().map((note) => ({ reason, note }))).sort((a, b) => a.reason.localeCompare(b.reason) || a.note.localeCompare(b.note));
70560
+ const notes = [...byReason].flatMap(([reason, kept2]) => [...kept2].sort().map((note) => ({ reason, note }))).sort((a, b) => a.reason.localeCompare(b.reason) || a.note.localeCompare(b.note));
70478
70561
  const distinct = [...seen.values()].reduce((total, all) => total + all.size, 0);
70479
70562
  return { notes, omitted: distinct - notes.length };
70480
70563
  }
@@ -70531,25 +70614,42 @@ function finalizedEvidence(accumulator) {
70531
70614
  if (unique.length > SUPPORT_CENTERLINE_V1.maxObservationsPerEnd) {
70532
70615
  throw new MemberEndAnalysisWorkLimitError("Member-end analysis exceeded the per-end drawing-observation budget.");
70533
70616
  }
70534
- const points = new Set(unique.map((origin) => JSON.stringify(origin.observedPoint)));
70535
70617
  const strictest = tolerances.length ? Math.min(...tolerances.map((item) => item.faceToleranceMm)) : void 0;
70618
+ const thresholds = strictest === void 0 ? void 0 : {
70619
+ faceToleranceMm: strictest,
70620
+ targetSpanToleranceMm: strictest,
70621
+ clusterToleranceMm: Math.min(strictest, 25.4),
70622
+ ambiguityMarginMm: 2 * strictest,
70623
+ viewAgreementToleranceMm: strictest
70624
+ };
70536
70625
  const elevation2 = scopes.find((item) => item.kind === "elevation");
70537
70626
  const selectedScope = elevation2 ?? scopes.find((item) => item.kind === "plan");
70627
+ const spread2 = observedSpreadMm(unique);
70538
70628
  return {
70539
70629
  ...unique.length ? { basis: { kind: "drawing", origins: unique, originSetHash: drawingOriginSetHash(unique) } } : {},
70540
- ...strictest !== void 0 ? { thresholds: {
70541
- faceToleranceMm: strictest,
70542
- targetSpanToleranceMm: strictest,
70543
- clusterToleranceMm: Math.min(strictest, 25.4),
70544
- ambiguityMarginMm: 2 * strictest,
70545
- viewAgreementToleranceMm: strictest
70546
- } } : {},
70630
+ ...thresholds ? { thresholds } : {},
70547
70631
  ...selectedScope ? { analysisScope: selectedScope } : {},
70548
70632
  hasLineage,
70549
70633
  failures: sortedReasons(failures),
70550
- conflict: points.size > 1
70634
+ conflict: spread2 > viewAgreementToleranceOf(thresholds) + AGREEMENT_EPS_MM,
70635
+ spreadMm: spread2
70551
70636
  };
70552
70637
  }
70638
+ function observedSpreadMm(origins) {
70639
+ let worst = 0;
70640
+ for (let i = 0; i < origins.length; i += 1) {
70641
+ for (let j = i + 1; j < origins.length; j += 1) {
70642
+ const a = origins[i].observedPoint, b = origins[j].observedPoint;
70643
+ const gap = Math.hypot(a.x - b.x, a.y - b.y, a.z.known - b.z.known);
70644
+ if (gap > worst) worst = gap;
70645
+ }
70646
+ }
70647
+ return worst;
70648
+ }
70649
+ function viewAgreementToleranceOf(thresholds) {
70650
+ return thresholds ? thresholds.viewAgreementToleranceMm : 0;
70651
+ }
70652
+ var AGREEMENT_EPS_MM = 1e-7;
70553
70653
  function buildEvidenceIndex(model, plans, deadlineMs, diagnoses) {
70554
70654
  const accumulators = /* @__PURE__ */ new Map();
70555
70655
  for (const plan of plans) for (const observation of plan.memberObservations ?? []) {
@@ -70671,12 +70771,17 @@ function recordDerivedNotes(plans, analysis, evidence, subjectReasons, memberId,
70671
70771
  diagnoses.record(memberId, end, "view-unregistered", unregisteredScopeNote(plans), true);
70672
70772
  }
70673
70773
  if (evidence.conflict) {
70674
- const points = new Set((evidence.basis?.origins ?? []).map((origin) => JSON.stringify(origin.observedPoint)));
70774
+ const spread2 = evidence.spreadMm ?? 0;
70775
+ const allowed = viewAgreementToleranceOf(evidence.thresholds);
70675
70776
  diagnoses.record(
70676
70777
  memberId,
70677
70778
  end,
70678
70779
  "cross-view-conflict",
70679
- `a member endpoint's drawing observations disagree \u2014 they place it at ${points.size} different world points, so no single drawing-backed point exists`
70780
+ `a member endpoint's drawing observations disagree \u2014 its ${(evidence.basis?.origins ?? []).length} readings span ${spread2} mm, past the ${allowed} mm two views of one point may differ by, so no single drawing-backed point exists`,
70781
+ false,
70782
+ // Collapsed on the ALLOWANCE, not on the sentence: the spread is this endpoint's own measurement
70783
+ // and would otherwise split one systemic defect into one note per endpoint.
70784
+ `cross-view-conflict\0${allowed}`
70680
70785
  );
70681
70786
  }
70682
70787
  }
@@ -70859,6 +70964,35 @@ function analyzeSteelMemberEnds(model, scope, retainedMemberIds = /* @__PURE__ *
70859
70964
  ...omitted > 0 ? { evidenceNotesOmitted: omitted } : {}
70860
70965
  };
70861
70966
  }
70967
+ var coords = (point3) => `(${point3.x}, ${point3.y}, ${point3.z.known})`;
70968
+ var NAMED_MISMATCHES = 3;
70969
+ var LiteralEvidenceMismatches = class {
70970
+ count = 0;
70971
+ worst = [];
70972
+ record(row) {
70973
+ this.count += 1;
70974
+ const at = this.worst.findIndex((seen) => row.gapMm > seen.gapMm);
70975
+ if (at >= 0) this.worst.splice(at, 0, row);
70976
+ else if (this.worst.length < NAMED_MISMATCHES) this.worst.push(row);
70977
+ if (this.worst.length > NAMED_MISMATCHES) this.worst.pop();
70978
+ }
70979
+ /**
70980
+ * One refusal for ALL mismatched ends, carrying the numbers a reader needs to act.
70981
+ *
70982
+ * The old refusal named a single member end and nothing else: no expected value, no submitted
70983
+ * value, no gap and no count. A reader could not tell one bad endpoint from all 430, could not see
70984
+ * that the true cause was three layers upstream in their grid, and spent days on it (#934). Count
70985
+ * first, then the worst offenders with both points and the distance between them.
70986
+ */
70987
+ error() {
70988
+ const named = this.worst.map((row) => `member "${quote2(row.memberId)}" end ${row.end + 1} ` + (row.submitted ? `is ${row.gapMm} mm away \u2014 submitted ${coords(row.submitted)}, drawing ${coords(row.expected)}` : `has no finite point with a known elevation \u2014 drawing ${coords(row.expected)}`));
70989
+ const rest = this.count - named.length;
70990
+ return new ContractPolicyError(
70991
+ `${this.count} reader member ${this.count === 1 ? "end does not match its" : "ends do not match their"} immutable drawing observation by more than ${SUPPORT_CENTERLINE_V1.literalEvidenceToleranceMm} mm: ${named.join("; ")}${rest > 0 ? `; and ${rest} more` : ""}`,
70992
+ "member-end-literal-evidence-mismatch"
70993
+ );
70994
+ }
70995
+ };
70862
70996
  function normalizeSteelMemberEndsForRead(literal, existingMemberIds = /* @__PURE__ */ new Set(), currentModel) {
70863
70997
  const sanitized = cloneModel(literal);
70864
70998
  const currentMembers = currentModel ? new Map(currentModel.members.map((member) => [member.id, member])) : null;
@@ -70897,21 +71031,38 @@ function normalizeSteelMemberEndsForRead(literal, existingMemberIds = /* @__PURE
70897
71031
  // observation. Nothing is published from here — `analyzeSteelMemberEnds` below builds the report.
70898
71032
  new EvidenceNotes()
70899
71033
  );
71034
+ const evidenceMismatches = new LiteralEvidenceMismatches();
70900
71035
  for (const member of sanitized.members) {
70901
71036
  if (existingMemberIds.has(member.id) || !roleOf(member)) continue;
70902
71037
  for (const end of [0, 1]) {
70903
71038
  const evidence = evidenceForEnd(evidenceIndex, member.id, end);
70904
71039
  if (!evidence.basis || evidence.conflict || evidence.failures.length) continue;
70905
- const expected = evidence.basis.origins[0]?.observedPoint;
70906
71040
  const literalPoint = known(end === 0 ? member.from : member.to);
70907
- if (expected && JSON.stringify(literalPoint) !== JSON.stringify(expected)) {
70908
- throw new ContractPolicyError(
70909
- `reader member ${member.id} end ${end + 1} does not match its immutable drawing observation`,
70910
- "member-end-literal-evidence-mismatch"
70911
- );
71041
+ const gapTo = (origin) => literalPoint ? Math.hypot(
71042
+ literalPoint.x - origin.observedPoint.x,
71043
+ literalPoint.y - origin.observedPoint.y,
71044
+ literalPoint.z.known - origin.observedPoint.z.known
71045
+ ) : Number.POSITIVE_INFINITY;
71046
+ let matched = evidence.basis.origins[0];
71047
+ let gapMm = matched ? gapTo(matched) : Number.POSITIVE_INFINITY;
71048
+ for (const origin of evidence.basis.origins) {
71049
+ const candidate = gapTo(origin);
71050
+ if (candidate < gapMm) {
71051
+ matched = origin;
71052
+ gapMm = candidate;
71053
+ }
71054
+ }
71055
+ const expected = matched?.observedPoint;
71056
+ if (!expected) continue;
71057
+ if (!(gapMm <= SUPPORT_CENTERLINE_V1.literalEvidenceToleranceMm)) {
71058
+ evidenceMismatches.record({ memberId: member.id, end, expected, submitted: literalPoint, gapMm });
71059
+ continue;
70912
71060
  }
71061
+ if (end === 0) member.from = expected;
71062
+ else member.to = expected;
70913
71063
  }
70914
71064
  }
71065
+ if (evidenceMismatches.count) throw evidenceMismatches.error();
70915
71066
  const conversion = analyzeSteelMemberEnds(sanitized, conversionScope, existingMemberIds);
70916
71067
  const model = cloneModel(sanitized);
70917
71068
  for (const finding of conversion.findings) {
@@ -78808,7 +78959,7 @@ function registerConnectionRoutes(app) {
78808
78959
  }
78809
78960
 
78810
78961
  // steel-intersection-ref.ts
78811
- var label = (v) => {
78962
+ var axisId = (v) => {
78812
78963
  if (typeof v !== "string") return null;
78813
78964
  const t = v.trim();
78814
78965
  return t.length > 0 ? t : null;
@@ -78817,19 +78968,19 @@ var isObj7 = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
78817
78968
  function intersectionRef(v) {
78818
78969
  if (v === void 0 || v === null) return { state: "absent" };
78819
78970
  if (isObj7(v)) {
78820
- const unknown = Object.keys(v).filter((k) => k !== "axis_x" && k !== "axis_y");
78971
+ const unknown = Object.keys(v).filter((k) => k !== "xAxisId" && k !== "yAxisId");
78821
78972
  if (unknown.length) {
78822
- return { state: "invalid", why: `an intersection has only \`axis_x\` and \`axis_y\` \u2014 ${unknown.map((k) => `\`${k}\``).join(", ")} ${unknown.length > 1 ? "are" : "is"} not recognised` };
78973
+ return { state: "invalid", why: `an intersection has only \`xAxisId\` and \`yAxisId\` \u2014 ${unknown.map((k) => `\`${k}\``).join(", ")} ${unknown.length > 1 ? "are" : "is"} not recognised${unknown.some((k) => k === "axis_x" || k === "axis_y") ? "; registration names grid axis IDS now, never labels" : ""}` };
78823
78974
  }
78824
- const x = label(v.axis_x), y = label(v.axis_y);
78975
+ const x = axisId(v.xAxisId), y = axisId(v.yAxisId);
78825
78976
  if (x && y) return { state: "valid", x, y };
78826
- const missing = [!x ? "axis_x" : null, !y ? "axis_y" : null].filter(Boolean).join(" and ");
78827
- return { state: "invalid", why: `${missing} must each be a non-blank label` };
78977
+ const missing = [!x ? "xAxisId" : null, !y ? "yAxisId" : null].filter(Boolean).join(" and ");
78978
+ return { state: "invalid", why: `${missing} must each be a non-blank grid axis id` };
78828
78979
  }
78829
- return { state: "invalid", why: `a ${Array.isArray(v) ? "list" : typeof v} names no grid intersection; expected { axis_x, axis_y }` };
78980
+ return { state: "invalid", why: `a ${Array.isArray(v) ? "list" : typeof v} names no grid intersection; expected { xAxisId, yAxisId }` };
78830
78981
  }
78831
78982
  function canonicalRef(r) {
78832
- return { axis_x: r.x, axis_y: r.y };
78983
+ return { xAxisId: r.x, yAxisId: r.y };
78833
78984
  }
78834
78985
 
78835
78986
  // steel-prepass-route.ts
@@ -78905,6 +79056,13 @@ function registerSteelPrepassRoute(app, deps) {
78905
79056
  const sheet = String(plan.sheet ?? "");
78906
79057
  const patch2 = sheets[sheet];
78907
79058
  if (!isObj8(patch2)) continue;
79059
+ if (plan.viewKind !== "plan" && PLAN_KEYS.some((key2) => patch2[key2] !== void 0)) {
79060
+ return reply.status(400).send({
79061
+ ok: false,
79062
+ code: "prepass-plan-controls-on-non-plan-view",
79063
+ error: `sheet "${sheet}" is a ${String(plan.viewKind ?? "unclassified")} view; ${PLAN_KEYS.filter((key2) => patch2[key2] !== void 0).join(", ")} register a plan and do nothing here \u2014 a non-plan view registers through sourceRegistration`
79064
+ });
79065
+ }
78908
79066
  for (const key2 of PLAN_KEYS) {
78909
79067
  if (patch2[key2] === void 0) continue;
78910
79068
  if (key2 === "datum_ref" || key2 === "control2_ref") {
@@ -78924,7 +79082,7 @@ function registerSteelPrepassRoute(app, deps) {
78924
79082
  return reply.status(400).send({
78925
79083
  ok: false,
78926
79084
  code: "prepass-ref-unreadable",
78927
- error: `Grid references must use { axis_x, axis_y }: ${refErrors.join(", ")}. Nothing was written.`
79085
+ error: `Grid references must use { xAxisId, yAxisId }: ${refErrors.join(", ")}. Nothing was written.`
78928
79086
  });
78929
79087
  }
78930
79088
  if (request) {
@@ -84863,8 +85021,8 @@ function bomTable(bom, selection = DEFAULT_BOM_COLUMNS) {
84863
85021
  cells[m.label] = priced.reduce((t, r) => t + (Number(r.cells[m.label]) || 0), 0);
84864
85022
  }
84865
85023
  if (columns.some((c) => c.id === "length")) {
84866
- const label2 = BOM_COLUMNS.find((c) => c.id === "length").label;
84867
- cells[label2] = round1(Number(cells[label2]) || 0);
85024
+ const label = BOM_COLUMNS.find((c) => c.id === "length").label;
85025
+ cells[label] = round1(Number(cells[label]) || 0);
84868
85026
  }
84869
85027
  rows2.push({ kind: "total", cells });
84870
85028
  }
@@ -84872,7 +85030,7 @@ function bomTable(bom, selection = DEFAULT_BOM_COLUMNS) {
84872
85030
  if (!rfi.length) return { columns: labels, rows: rows2 };
84873
85031
  const profileLabel = BOM_COLUMNS.find((c) => c.id === "profile").label;
84874
85032
  const qtyLabel = BOM_COLUMNS.find((c) => c.id === "qty").label;
84875
- const locators = [["profile", profileLabel], ["qty", qtyLabel]].filter(([id]) => !selection.includes(id)).map(([, label2]) => label2);
85033
+ const locators = [["profile", profileLabel], ["qty", qtyLabel]].filter(([id]) => !selection.includes(id)).map(([, label]) => label);
84876
85034
  const unionColumns = [...locators, ...RFI_COLUMNS];
84877
85035
  const blanks = Object.fromEntries(unionColumns.map((c) => [c, ""]));
84878
85036
  return {
@@ -86756,9 +86914,9 @@ function assertSameVolume(a, b) {
86756
86914
  }
86757
86915
  if (aDev !== bDev) throw new FilePublicationError("publication paths are not on the same volume", "different-volume", [a, b]);
86758
86916
  }
86759
- function uniqueArtifact(dir, label2, livePath) {
86917
+ function uniqueArtifact(dir, label, livePath) {
86760
86918
  (0, import_node_fs56.mkdirSync)(dir, { recursive: true });
86761
- return (0, import_node_path49.join)(dir, `.floless-${label2}-${(0, import_node_crypto39.randomUUID)()}-${(0, import_node_path49.basename)(livePath)}`);
86919
+ return (0, import_node_path49.join)(dir, `.floless-${label}-${(0, import_node_crypto39.randomUUID)()}-${(0, import_node_path49.basename)(livePath)}`);
86762
86920
  }
86763
86921
  function publishFileExclusive(input) {
86764
86922
  const { livePath, stagedPath, expectedLive, artifactDir } = input;
@@ -86844,7 +87002,7 @@ function activeCodexJournal(appId) {
86844
87002
  }
86845
87003
  return null;
86846
87004
  }
86847
- function withAppSourceLock(appId, label2, fn, options = {}) {
87005
+ function withAppSourceLock(appId, label, fn, options = {}) {
86848
87006
  return withLifecycleLock("app", appId, () => {
86849
87007
  const active2 = activeApprovalTransaction(appId);
86850
87008
  if (active2 && active2 !== options.approvalTransactionId) throw new AppSourcePublicationBusyError();
@@ -86853,7 +87011,7 @@ function withAppSourceLock(appId, label2, fn, options = {}) {
86853
87011
  throw new AppSourcePublicationBusyError();
86854
87012
  }
86855
87013
  return fn();
86856
- }, { label: label2 });
87014
+ }, { label });
86857
87015
  }
86858
87016
 
86859
87017
  // app-publication-manifest.ts
@@ -89634,7 +89792,7 @@ async function hostReadiness(host, deps = DEFAULT_DEPS3, targetPid) {
89634
89792
  return withAwareShared(() => withSidecarRead(() => hostReadinessUnlocked(host, deps, targetPid)));
89635
89793
  }
89636
89794
  async function hostReadinessUnlocked(host, deps, targetPid) {
89637
- const label2 = HOST_LABELS[host];
89795
+ const label = HOST_LABELS[host];
89638
89796
  const floor = HOST_BAKE_AWARE_FLOORS[host];
89639
89797
  const awareVersion = deps.npmVersion();
89640
89798
  const awareCurrent = !!awareVersion && compareDotted(awareVersion, floor) >= 0;
@@ -89660,8 +89818,8 @@ async function hostReadinessUnlocked(host, deps, targetPid) {
89660
89818
  ...base,
89661
89819
  ok: false,
89662
89820
  state: "bridge-missing",
89663
- message: `Couldn\u2019t send \u2014 the connection to ${label2} isn\u2019t installed yet. Install it, then try again.`,
89664
- recovery: { action: "install-bridge", label: `Install ${label2} bridge` }
89821
+ message: `Couldn\u2019t send \u2014 the connection to ${label} isn\u2019t installed yet. Install it, then try again.`,
89822
+ recovery: { action: "install-bridge", label: `Install ${label} bridge` }
89665
89823
  };
89666
89824
  }
89667
89825
  if (!bridgeCurrent) {
@@ -89669,8 +89827,8 @@ async function hostReadinessUnlocked(host, deps, targetPid) {
89669
89827
  ...base,
89670
89828
  ok: false,
89671
89829
  state: "bridge-update-required",
89672
- message: `Couldn\u2019t send \u2014 the connection to ${label2} is stale (${bridge.version || "unversioned"}, needs ${awareVersion}). Update it, then try again.`,
89673
- recovery: { action: "install-bridge", label: `Update ${label2} bridge` }
89830
+ message: `Couldn\u2019t send \u2014 the connection to ${label} is stale (${bridge.version || "unversioned"}, needs ${awareVersion}). Update it, then try again.`,
89831
+ recovery: { action: "install-bridge", label: `Update ${label} bridge` }
89674
89832
  };
89675
89833
  }
89676
89834
  let probe;
@@ -89681,7 +89839,7 @@ async function hostReadinessUnlocked(host, deps, targetPid) {
89681
89839
  ...base,
89682
89840
  ok: false,
89683
89841
  state: "error",
89684
- message: error instanceof Error ? error.message : `Couldn\u2019t check whether ${label2} is ready.`,
89842
+ message: error instanceof Error ? error.message : `Couldn\u2019t check whether ${label} is ready.`,
89685
89843
  recovery: { action: "retry", label: "Check again" }
89686
89844
  };
89687
89845
  }
@@ -89691,7 +89849,7 @@ async function hostReadinessUnlocked(host, deps, targetPid) {
89691
89849
  ...base,
89692
89850
  ok: false,
89693
89851
  state: "error",
89694
- message: `Couldn\u2019t send \u2014 the ${label2} connection isn\u2019t responding${probe.error ? ` (${probe.error.slice(0, 120)})` : ""}. Try again, and reinstall the ${label2} bridge if it keeps happening.`,
89852
+ message: `Couldn\u2019t send \u2014 the ${label} connection isn\u2019t responding${probe.error ? ` (${probe.error.slice(0, 120)})` : ""}. Try again, and reinstall the ${label} bridge if it keeps happening.`,
89695
89853
  recovery: { action: "retry", label: "Check again" }
89696
89854
  };
89697
89855
  }
@@ -89700,8 +89858,8 @@ async function hostReadinessUnlocked(host, deps, targetPid) {
89700
89858
  ...base,
89701
89859
  ok: false,
89702
89860
  state: "host-closed",
89703
- message: probe.instances.length ? `Couldn\u2019t send \u2014 that ${label2} window isn\u2019t open any more. Try the drag again.` : `Couldn\u2019t send \u2014 ${label2} isn\u2019t open. Start it and try again.`,
89704
- recovery: probe.instances.length ? { action: "retry", label: "Check again" } : { action: "open-host", label: `Open ${label2}` }
89861
+ message: probe.instances.length ? `Couldn\u2019t send \u2014 that ${label} window isn\u2019t open any more. Try the drag again.` : `Couldn\u2019t send \u2014 ${label} isn\u2019t open. Start it and try again.`,
89862
+ recovery: probe.instances.length ? { action: "retry", label: "Check again" } : { action: "open-host", label: `Open ${label}` }
89705
89863
  };
89706
89864
  }
89707
89865
  if (!probe.ok || !session) {
@@ -89715,7 +89873,7 @@ async function hostReadinessUnlocked(host, deps, targetPid) {
89715
89873
  ...base,
89716
89874
  ok: false,
89717
89875
  state: "error",
89718
- message: `Couldn\u2019t send \u2014 ${label2} is running, but FloLess can\u2019t reach it. Restart ${label2} so its FloLess connection reloads, then try again.`,
89876
+ message: `Couldn\u2019t send \u2014 ${label} is running, but FloLess can\u2019t reach it. Restart ${label} so its FloLess connection reloads, then try again.`,
89719
89877
  recovery: { action: "retry", label: "Check again" }
89720
89878
  };
89721
89879
  }
@@ -89723,8 +89881,8 @@ async function hostReadinessUnlocked(host, deps, targetPid) {
89723
89881
  ...base,
89724
89882
  ok: false,
89725
89883
  state: "host-closed",
89726
- message: `Couldn\u2019t send \u2014 ${label2} isn\u2019t open. Start it and try again.`,
89727
- recovery: { action: "open-host", label: `Open ${label2}` }
89884
+ message: `Couldn\u2019t send \u2014 ${label} isn\u2019t open. Start it and try again.`,
89885
+ recovery: { action: "open-host", label: `Open ${label}` }
89728
89886
  };
89729
89887
  }
89730
89888
  const found = { open: true, version: session.version, pid: session.pid, rhinoId: session.rhinoId ?? null };
@@ -89733,7 +89891,7 @@ async function hostReadinessUnlocked(host, deps, targetPid) {
89733
89891
  ...base,
89734
89892
  ok: false,
89735
89893
  state: "ambiguous-session",
89736
- message: `Couldn\u2019t send \u2014 ${probe.instances.length} ${label2} windows are open and there\u2019s no way to tell which model you meant. Close all but one, or drag the members onto the window you want.`,
89894
+ message: `Couldn\u2019t send \u2014 ${probe.instances.length} ${label} windows are open and there\u2019s no way to tell which model you meant. Close all but one, or drag the members onto the window you want.`,
89737
89895
  recovery: { action: "retry", label: "Check again" }
89738
89896
  };
89739
89897
  }
@@ -89793,7 +89951,7 @@ async function hostReadinessUnlocked(host, deps, targetPid) {
89793
89951
  bakeEnv: probe.env,
89794
89952
  ok: true,
89795
89953
  state: "ready",
89796
- message: `Ready to send to ${label2}${session.version ? ` ${session.version}` : ""}.`,
89954
+ message: `Ready to send to ${label}${session.version ? ` ${session.version}` : ""}.`,
89797
89955
  recovery: null
89798
89956
  };
89799
89957
  }
@@ -94838,14 +94996,14 @@ function safeLease2(value) {
94838
94996
  if (!/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/.test(value)) throw new RunFileRelayError("unsafe lease id");
94839
94997
  return value;
94840
94998
  }
94841
- function rejectLink2(path, label2) {
94999
+ function rejectLink2(path, label) {
94842
95000
  let st;
94843
95001
  try {
94844
95002
  st = (0, import_node_fs75.lstatSync)(path);
94845
95003
  } catch {
94846
- throw new RunFileRelayError(`${label2} does not exist`);
95004
+ throw new RunFileRelayError(`${label} does not exist`);
94847
95005
  }
94848
- if (st.isSymbolicLink()) throw new RunFileRelayError(`${label2} is a filesystem link/reparse point`);
95006
+ if (st.isSymbolicLink()) throw new RunFileRelayError(`${label} is a filesystem link/reparse point`);
94849
95007
  }
94850
95008
  function sameIdentity(a, b) {
94851
95009
  return a.dev === b.dev && a.ino === b.ino && a.size === b.size && a.mtimeMs === b.mtimeMs;
@@ -94860,11 +95018,11 @@ function structural(value) {
94860
95018
  function hash2(value) {
94861
95019
  return (0, import_node_crypto45.createHash)("sha256").update(value).digest("hex");
94862
95020
  }
94863
- function readRegularFile(path, maxBytes, label2) {
94864
- rejectLink2(path, label2);
95021
+ function readRegularFile(path, maxBytes, label) {
95022
+ rejectLink2(path, label);
94865
95023
  const st = (0, import_node_fs75.statSync)(path);
94866
- if (!st.isFile()) throw new RunFileRelayError(`${label2} is not a regular file`);
94867
- if (st.size > maxBytes) throw new RunFileRelayError(`${label2} is too large`);
95024
+ if (!st.isFile()) throw new RunFileRelayError(`${label} is not a regular file`);
95025
+ if (st.size > maxBytes) throw new RunFileRelayError(`${label} is too large`);
94868
95026
  return (0, import_node_fs75.readFileSync)(path);
94869
95027
  }
94870
95028
  function durableWrite3(path, value) {
@@ -95130,25 +95288,25 @@ function createRunSkillReader(options) {
95130
95288
  };
95131
95289
  return { skillName: options.skillName, read: (resource) => readPacket(resource).text, readPacket };
95132
95290
  }
95133
- function checkedDirectory(path, label2) {
95134
- rejectLink3(path, label2);
95291
+ function checkedDirectory(path, label) {
95292
+ rejectLink3(path, label);
95135
95293
  let real;
95136
95294
  try {
95137
95295
  real = import_node_fs77.realpathSync.native(path);
95138
95296
  } catch {
95139
- throw new RunSkillRelayError(`${label2} not found`);
95297
+ throw new RunSkillRelayError(`${label} not found`);
95140
95298
  }
95141
- if (!(0, import_node_fs77.statSync)(real).isDirectory()) throw new RunSkillRelayError(`${label2} is not a directory`);
95299
+ if (!(0, import_node_fs77.statSync)(real).isDirectory()) throw new RunSkillRelayError(`${label} is not a directory`);
95142
95300
  return real;
95143
95301
  }
95144
- function rejectLink3(path, label2) {
95302
+ function rejectLink3(path, label) {
95145
95303
  let st;
95146
95304
  try {
95147
95305
  st = (0, import_node_fs77.lstatSync)(path);
95148
95306
  } catch {
95149
- throw new RunSkillRelayError(`${label2} not found`);
95307
+ throw new RunSkillRelayError(`${label} not found`);
95150
95308
  }
95151
- if (st.isSymbolicLink()) throw new RunSkillRelayError(`${label2} is a filesystem link/reparse point`);
95309
+ if (st.isSymbolicLink()) throw new RunSkillRelayError(`${label} is a filesystem link/reparse point`);
95152
95310
  }
95153
95311
 
95154
95312
  // terminal-run.ts