@floless/app 0.124.0 → 0.125.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.
@@ -54611,7 +54611,7 @@ function appVersion() {
54611
54611
  return resolveVersion({
54612
54612
  isSea: isSea2(),
54613
54613
  sqVersionXml: readSqVersionXml(),
54614
- define: true ? "0.124.0" : void 0,
54614
+ define: true ? "0.125.0" : void 0,
54615
54615
  pkgVersion: readPkgVersion()
54616
54616
  });
54617
54617
  }
@@ -54627,7 +54627,7 @@ function resolveChannel(s) {
54627
54627
  function appChannel() {
54628
54628
  return resolveChannel({
54629
54629
  isSea: isSea2(),
54630
- define: true ? "0.124.0" : void 0,
54630
+ define: true ? "0.125.0" : void 0,
54631
54631
  // argv[1] is the entry the runtime actually loaded (…/dist/floless-server.cjs), which is what
54632
54632
  // carries the npx cache prefix. Absent under the SEA exe, which never reaches the npx branch.
54633
54633
  modulePath: process.argv[1]
@@ -55000,8 +55000,26 @@ function loadDrawingVectorSchema() {
55000
55000
  function loadSteelModelSchema() {
55001
55001
  return loadContractSchema("steel.model.v2.schema.json");
55002
55002
  }
55003
+ function duplicateJointIds(doc) {
55004
+ if (!doc || typeof doc !== "object") return [];
55005
+ const joints = doc.joints;
55006
+ if (!Array.isArray(joints)) return [];
55007
+ const counts = /* @__PURE__ */ new Map();
55008
+ for (const j of joints) {
55009
+ const id = j && typeof j === "object" ? j.id : void 0;
55010
+ if (typeof id !== "string" || !id) continue;
55011
+ counts.set(id, (counts.get(id) ?? 0) + 1);
55012
+ }
55013
+ return [...counts].filter(([, n]) => n > 1).map(([id, n]) => ({
55014
+ path: "$.joints",
55015
+ message: `joint id "${id}" occurs ${n} times; a connection part's id is derived from it, so duplicates collide in the built scene`
55016
+ }));
55017
+ }
55003
55018
  function validateSteelTakeoff(doc) {
55004
- return validate(doc, loadSteelTakeoffSchema());
55019
+ const base = validate(doc, loadSteelTakeoffSchema());
55020
+ const dupes = duplicateJointIds(doc);
55021
+ if (!dupes.length) return base;
55022
+ return { valid: false, errors: [...dupes, ...base.errors] };
55005
55023
  }
55006
55024
  function validateDrawingVector(doc) {
55007
55025
  return validate(doc, loadDrawingVectorSchema());
@@ -61550,15 +61568,26 @@ function materializeMembers(v1, boot, regs) {
61550
61568
  const coincidentXY = Math.hypot(from.x - to.x, from.y - to.y) <= MODEL_V2_TOL.DEDUP_MM;
61551
61569
  const zeroHeight = za !== null && zb !== null && Math.abs(zb - za) <= MODEL_V2_TOL.CUT_PLANE_MM;
61552
61570
  const marker = role === "column" && zeroHeight && coincidentXY;
61553
- if (role === "column" && zeroHeight && !coincidentXY) {
61571
+ if (role === "column" && !coincidentXY) {
61554
61572
  const spanMm = Math.hypot(from.x - to.x, from.y - to.y);
61555
- issues.push({
61556
- code: "column-zero-height",
61557
- severity: "decision",
61558
- sheet,
61559
- path,
61560
- message: `column "${v1Id}" reads with its base and its top at the same elevation, so it has no height \u2014 but it spans ${spanMm.toFixed(0)} mm in plan, so it is not a foundation footprint and is kept as a member rather than turned into evidence. A column of zero height cannot be built: confirm the reading, or give it a real top elevation, before commit`
61561
- });
61573
+ const spanTxt = spanMm.toFixed(spanMm < 10 ? 1 : 0);
61574
+ if (zeroHeight) {
61575
+ issues.push({
61576
+ code: "column-zero-height",
61577
+ severity: "decision",
61578
+ sheet,
61579
+ path,
61580
+ message: `column "${v1Id}" reads with its base and its top at the same elevation, so it has no height \u2014 but it spans ${spanTxt} mm in plan, so it is not a foundation footprint and is kept as a member rather than turned into evidence. A column of zero height cannot be built: confirm the reading, or give it a real top elevation, before commit`
61581
+ });
61582
+ } else {
61583
+ issues.push({
61584
+ code: "column-plan-offset",
61585
+ severity: "decision",
61586
+ sheet,
61587
+ path,
61588
+ message: `column "${v1Id}" has its two ends ${spanTxt} mm apart in plan, so it does not stand over a single point the way a column must. Usually that means a beam or brace was read as a column; less often it is a genuine raking column. Confirm which this is, or correct the member, before commit`
61589
+ });
61590
+ }
61562
61591
  }
61563
61592
  members.push({ sheet, v1Id, v1Index: mi, role, from, to, kind: marker ? "footprint-marker" : "physical", fromKind, toKind, ends, raw: m });
61564
61593
  });
@@ -61568,7 +61597,7 @@ function materializeMembers(v1, boot, regs) {
61568
61597
  var memberKey = (m) => JSON.stringify([m.sheet, m.v1Id]);
61569
61598
  var zOf = (e) => "known" in e ? e.known : null;
61570
61599
  var same = (a, b) => JSON.stringify(a ?? null) === JSON.stringify(b ?? null);
61571
- var MEMBER_FIELDS = ["material", "rot", "position", "section", "bf", "mf", "rfi", "verified"];
61600
+ var MEMBER_FIELDS = ["material", "rot", "position", "positionH", "section", "bf", "mf", "rfi", "verified"];
61572
61601
  var END_FIELDS = ["conn", "connVerified", "note", "detail"];
61573
61602
  function crossingDistance(marker, span) {
61574
61603
  const mz = zOf(marker.from.z), lo = zOf(span.from.z), hi = zOf(span.to.z);
@@ -61787,6 +61816,7 @@ var DISPOSITIONS = {
61787
61816
  material: "copied",
61788
61817
  memberType: "copied",
61789
61818
  position: "copied",
61819
+ positionH: "copied",
61790
61820
  rot: "copied",
61791
61821
  section: "copied",
61792
61822
  bf: "copied",
@@ -61953,6 +61983,8 @@ function previewMigration(v1, ctx) {
61953
61983
  if (isObj2(r.brace)) out.brace = clone(r.brace);
61954
61984
  const position = enumOr(r.position, ["top", "middle", "bottom"], `$.members[${m.sheet}/${m.v1Id}].position`, issues, m.sheet);
61955
61985
  if (position) out.position = position;
61986
+ const positionH = enumOr(r.positionH, ["left", "middle", "right"], `$.members[${m.sheet}/${m.v1Id}].positionH`, issues, m.sheet);
61987
+ if (positionH) out.positionH = positionH;
61956
61988
  const ends = m.ends.map((e) => {
61957
61989
  const o = {};
61958
61990
  for (const k of ["note", "detail"]) if (str2(e[k])) o[k] = str2(e[k]);
@@ -62423,6 +62455,42 @@ function planBlockerSummary(candidate, cap = 8) {
62423
62455
  return `plan-uneditable:${code} on ${sheets.length === 1 ? "sheet" : "sheets"} ${shown}${more}`;
62424
62456
  });
62425
62457
  }
62458
+ function blockingIssueDetails(report, cap = 8) {
62459
+ const byLine = /* @__PURE__ */ new Map();
62460
+ const order = [];
62461
+ for (const issue of report.issues) {
62462
+ if (issue.severity !== "block") continue;
62463
+ const sheet = typeof issue.sheet === "string" && issue.sheet.trim() ? issue.sheet.trim() : null;
62464
+ const path = typeof issue.path === "string" && issue.path.trim() ? issue.path.trim() : null;
62465
+ const parts = [sheet ? `sheet ${sheet}` : null, path].filter(Boolean);
62466
+ const at = parts.length ? ` [${parts.join(" \xB7 ")}]` : "";
62467
+ const line = issue.message ? `${issue.code}${at}: ${issue.message}` : `${issue.code}${at} (no detail available)`;
62468
+ const row = byLine.get(line);
62469
+ if (row) {
62470
+ row.count += 1;
62471
+ continue;
62472
+ }
62473
+ byLine.set(line, { code: issue.code, line, count: 1 });
62474
+ order.push(line);
62475
+ }
62476
+ const rows2 = order.map((line) => byLine.get(line));
62477
+ const firstPerCode = /* @__PURE__ */ new Set();
62478
+ const ordered = [];
62479
+ const rest = [];
62480
+ for (const row of rows2) {
62481
+ if (firstPerCode.has(row.code)) {
62482
+ rest.push(row);
62483
+ continue;
62484
+ }
62485
+ firstPerCode.add(row.code);
62486
+ ordered.push(row);
62487
+ }
62488
+ ordered.push(...rest);
62489
+ const render = (row) => row.count > 1 ? `${row.line} (\xD7${row.count})` : row.line;
62490
+ if (ordered.length <= cap) return ordered.map(render);
62491
+ const cut = ordered.slice(cap).reduce((n, row) => n + row.count, 0);
62492
+ return [...ordered.slice(0, cap).map(render), `and ${cut} more blocking issue(s)`];
62493
+ }
62426
62494
  function migrationBlockingCodes(report, candidate) {
62427
62495
  const projectionCodes = planBlockers(candidate).map((b) => `plan-uneditable:${b.code}`);
62428
62496
  return [.../* @__PURE__ */ new Set(
@@ -62478,12 +62546,24 @@ function v1CarriesAuthoredModel(doc) {
62478
62546
  // contract-transaction.ts
62479
62547
  var ContractTransactionError = class extends Error {
62480
62548
  code;
62481
- constructor(message, code = "contract-transaction-failed") {
62549
+ /**
62550
+ * The UNCAPPED evidence behind this refusal, for the log — never for the response body.
62551
+ *
62552
+ * `message` is capped so a human can read it, and until this existed the capped copy was the ONLY
62553
+ * surviving record: the full report is a local in `runInitialReadToV2`, destroyed by the throw, and
62554
+ * the route logs nothing. A support question of the form "why did my read fail" then had no
62555
+ * server-side artefact to consult at all — no log line, no journal (the journal is written after the
62556
+ * refusal), nothing but an HTTP body the user may not have kept.
62557
+ */
62558
+ details;
62559
+ constructor(message, code = "contract-transaction-failed", details) {
62482
62560
  super(message);
62483
62561
  this.name = "ContractTransactionError";
62484
62562
  this.code = code;
62563
+ if (details !== void 0) this.details = details;
62485
62564
  }
62486
62565
  };
62566
+ var DETAIL_LOG_CAP = 200;
62487
62567
  function contractAuthorityFor(appId) {
62488
62568
  try {
62489
62569
  return resolveContractAuthorityId(appId);
@@ -62764,10 +62844,32 @@ async function runInitialReadToV2(opts) {
62764
62844
  const codes = migrationBlockingCodes(report, candidate);
62765
62845
  if (!candidate || codes.length) {
62766
62846
  const where = planBlockerSummary(candidate);
62767
- const nonPlan = codes.filter((c) => !c.startsWith("plan-uneditable:"));
62847
+ const why = blockingIssueDetails(report);
62848
+ const items = [...where, ...why];
62849
+ const blocking = report.issues.filter((issue) => issue.severity === "block");
62850
+ if (items.length === 0) {
62851
+ throw new ContractTransactionError(
62852
+ "the migration refused this read but produced no blocking issue and no unprojectable plan, so the refusal cannot say why \u2014 that is a bug in previewMigration, not a problem with the drawing set",
62853
+ "v1-staging-exit-indeterminate",
62854
+ { codes, issueCodes: report.issues.map((issue) => `${issue.severity}:${issue.code}`), candidate: candidate !== null }
62855
+ );
62856
+ }
62768
62857
  throw new ContractTransactionError(
62769
- `v1 reader staging must end because this fresh read cannot become ${STEEL_V2}: ${[...nonPlan, ...where].join(", ") || "candidate unavailable"}`,
62770
- "v1-staging-exit"
62858
+ `v1 reader staging must end because this fresh read cannot become ${STEEL_V2}:
62859
+ ${items.map((item) => ` \u2022 ${item}`).join("\n")}`,
62860
+ "v1-staging-exit",
62861
+ {
62862
+ // CAPPED, with the true total beside it. `member-geometry-unusable` emits one issue per member,
62863
+ // bounded only by the v1's member count — 20,000 of them serialise to a 3.1 MB single log line.
62864
+ // Truncation in the log is stated the same way it is in the message, never implied.
62865
+ blocking: blocking.slice(0, DETAIL_LOG_CAP),
62866
+ totalBlocking: blocking.length,
62867
+ // PREFIXED, so support greps ONE spelling. `planBlockers` returns the raw
62868
+ // `registration-incomplete` while both the message and `migrationBlockingCodes` say
62869
+ // `plan-uneditable:registration-incomplete`; leaving the raw form here would reintroduce, in
62870
+ // the artefact, the "one reason, two spellings" defect the message half already fixed.
62871
+ planBlockers: planBlockers(candidate).map((b) => ({ ...b, code: `plan-uneditable:${b.code}` }))
62872
+ }
62771
62873
  );
62772
62874
  }
62773
62875
  const uuid = getProject(projectId)?.uuid ?? null;
@@ -64208,6 +64310,7 @@ var REGISTRY = /* @__PURE__ */ new Map([
64208
64310
  ["$.members[].memberType", { disposition: "propose" }],
64209
64311
  ["$.members[].rot", { disposition: "propose" }],
64210
64312
  ["$.members[].position", { disposition: "propose" }],
64313
+ ["$.members[].positionH", { disposition: "propose" }],
64211
64314
  ["$.members[].from", { disposition: "propose" }],
64212
64315
  ["$.members[].to", { disposition: "propose" }],
64213
64316
  ["$.members[].section", { disposition: "propose" }],
@@ -65044,6 +65147,22 @@ function cutToBooleanCut(part) {
65044
65147
  }
65045
65148
  return { id: part.id, kind: "boolean-cut", targetId: part.member, tool: box };
65046
65149
  }
65150
+ function connectionsFromParts(parts) {
65151
+ const byId = /* @__PURE__ */ new Map();
65152
+ const order = [];
65153
+ for (const p of parts ?? []) {
65154
+ if (!p || !p.conn) continue;
65155
+ let c = byId.get(p.conn);
65156
+ if (!c) {
65157
+ c = { id: p.conn, kind: p.connKind, memberIds: [], childIds: [] };
65158
+ byId.set(p.conn, c);
65159
+ order.push(p.conn);
65160
+ }
65161
+ if (p.id) c.childIds.push(p.id);
65162
+ if (p.kind === "cut" && p.member && !c.memberIds.includes(p.member)) c.memberIds.push(p.member);
65163
+ }
65164
+ return order.map((id) => byId.get(id));
65165
+ }
65047
65166
  var GROUPS = {
65048
65167
  "base-plate": { key: "base-plate", label: "Base plates", color: "#6b7a8d" },
65049
65168
  // darkest plate grey
@@ -65323,12 +65442,14 @@ function inferSupport(beam, end, memberGeo) {
65323
65442
  best = m;
65324
65443
  }
65325
65444
  }
65326
- return best && supportReaches(end, best) ? best : void 0;
65445
+ return best && supportReaches(end, best, latSlack(beam)) ? best : void 0;
65327
65446
  }
65328
- function supportReaches(end, support) {
65447
+ function supportReaches(end, support, latSlackMm = 0) {
65329
65448
  if (!finite3(support.from) || !finite3(support.to) || !support.dims) return false;
65330
- return distPointSeg(end, support.from, support.to) <= Math.max(support.dims.w, support.dims.d);
65449
+ const slack = isFinite(latSlackMm) ? Math.abs(latSlackMm) : 0;
65450
+ return distPointSeg(end, support.from, support.to) <= Math.max(support.dims.w, support.dims.d) + slack;
65331
65451
  }
65452
+ var latSlack = (m) => m && typeof m.latOffset === "number" && isFinite(m.latOffset) ? Math.abs(m.latOffset) : 0;
65332
65453
  function flangeThk(profile, d) {
65333
65454
  return profileKind(profile) === "I" ? Math.min(d * 0.5, Math.max(d * 0.1, 6)) : d / 2;
65334
65455
  }
@@ -65939,7 +66060,7 @@ function expandJoints(joints, memberGeo) {
65939
66060
  return;
65940
66061
  }
65941
66062
  const beamEnd = j.at === "end1" ? beam.to : beam.from;
65942
- if (nativeSupport && !supportReaches(beamEnd, nativeSupport)) {
66063
+ if (nativeSupport && !supportReaches(beamEnd, nativeSupport, latSlack(beam))) {
65943
66064
  skipped.push(j.id);
65944
66065
  return;
65945
66066
  }
@@ -65987,7 +66108,7 @@ function expandJoints(joints, memberGeo) {
65987
66108
  refuseBrace("named-support-unusable", { supportId: nativeSupport.id });
65988
66109
  return;
65989
66110
  }
65990
- if (nativeSupport && !supportReaches(braceEnd, nativeSupport)) {
66111
+ if (nativeSupport && !supportReaches(braceEnd, nativeSupport, latSlack(braceMember))) {
65991
66112
  refuseBrace("named-support-out-of-reach", { supportId: nativeSupport.id });
65992
66113
  return;
65993
66114
  }
@@ -66016,6 +66137,63 @@ function expandJoints(joints, memberGeo) {
66016
66137
  return { elements, operations, viewOperations, memberTrims, groups, skipped, diagnostics };
66017
66138
  }
66018
66139
 
66140
+ // steel-part-coverage.ts
66141
+ function coverageOk(c) {
66142
+ return c.fail.neverBuilt.length === 0 && c.fail.fused.length === 0 && c.fail.duplicatePartIds.length === 0;
66143
+ }
66144
+ var specifiedId = (j, i) => j && j.id ? j.id : `joint#${i}`;
66145
+ function partCoverage(joints, built) {
66146
+ const rows2 = joints ?? [];
66147
+ const elements = built.elements ?? [];
66148
+ const skipped = new Set(built.skippedJointIds ?? []);
66149
+ const claims = /* @__PURE__ */ new Map();
66150
+ const order = [];
66151
+ rows2.forEach((j, i) => {
66152
+ const id = specifiedId(j, i);
66153
+ if (!claims.has(id)) order.push(id);
66154
+ claims.set(id, (claims.get(id) ?? 0) + 1);
66155
+ });
66156
+ const builtIds = new Set(connectionsFromParts(elements).map((c) => c.id));
66157
+ const neverBuilt = order.filter((id) => !builtIds.has(id) && !skipped.has(id));
66158
+ const fused = order.filter((id) => (claims.get(id) ?? 0) > 1 && builtIds.has(id));
66159
+ const orphanedParts = [];
66160
+ const unattributedParts = [];
66161
+ for (const p of elements) {
66162
+ if (!p) continue;
66163
+ if (!p.conn) {
66164
+ unattributedParts.push(p.id || "<anonymous>");
66165
+ continue;
66166
+ }
66167
+ if (!claims.has(p.conn)) orphanedParts.push({ partId: p.id ?? null, conn: p.conn });
66168
+ }
66169
+ const seen = /* @__PURE__ */ new Set();
66170
+ const dupes = /* @__PURE__ */ new Set();
66171
+ for (const p of elements) {
66172
+ const id = p?.id;
66173
+ if (!id) continue;
66174
+ if (seen.has(id)) dupes.add(id);
66175
+ seen.add(id);
66176
+ }
66177
+ return {
66178
+ specified: rows2.length,
66179
+ builtOfSpecified: order.filter((id) => builtIds.has(id)).length,
66180
+ fail: { neverBuilt, fused, duplicatePartIds: [...dupes] },
66181
+ warn: { orphanedParts, unattributedParts }
66182
+ };
66183
+ }
66184
+ function describeCoverage(c) {
66185
+ const fails = [];
66186
+ if (c.fail.neverBuilt.length) fails.push(`${c.fail.neverBuilt.length} specified but never built (${c.fail.neverBuilt.join(", ")})`);
66187
+ if (c.fail.fused.length) fails.push(`${c.fail.fused.length} fused onto one connection (${c.fail.fused.join(", ")})`);
66188
+ if (c.fail.duplicatePartIds.length) fails.push(`${c.fail.duplicatePartIds.length} duplicate part id(s)`);
66189
+ const warns = [];
66190
+ if (c.warn.orphanedParts.length) warns.push(`${c.warn.orphanedParts.length} part(s) name a connection that was never specified`);
66191
+ if (c.warn.unattributedParts.length) warns.push(`${c.warn.unattributedParts.length} part(s) belong to no connection at all`);
66192
+ const head = coverageOk(c) ? c.specified === 0 ? "coverage: no connections specified \u2014 nothing to reconcile" : `coverage ok \u2014 ${c.builtOfSpecified}/${c.specified} specified connection(s) built` : `coverage FAILED \u2014 ${fails.join("; ")}`;
66193
+ const warned = warns.length ? `${head} (warning: ${warns.join("; ")})` : head;
66194
+ return `${warned}. Proves what was built matches what was specified, never that enough was specified.`;
66195
+ }
66196
+
66019
66197
  // export-identity.ts
66020
66198
  var import_node_crypto20 = require("node:crypto");
66021
66199
  function deriveExportSourceId(kind, ownerId, installation = installId()) {
@@ -67288,6 +67466,24 @@ function depthPosition(explicit, dzMm, horizMm, isVerticalBrace = false) {
67288
67466
  if (isVerticalBrace) return "middle";
67289
67467
  return dzMm > horizMm * 0.5774 ? "middle" : "top";
67290
67468
  }
67469
+ function planePosition(explicit) {
67470
+ return explicit === "left" || explicit === "right" ? explicit : "middle";
67471
+ }
67472
+ function lateralHalfExtent(dims, rotDeg, round) {
67473
+ if (round) return dims.w / 2;
67474
+ const th = (typeof rotDeg === "number" && isFinite(rotDeg) ? rotDeg : 0) * Math.PI / 180;
67475
+ return Math.abs(dims.w / 2 * Math.cos(th)) + Math.abs(dims.d / 2 * Math.sin(th));
67476
+ }
67477
+ var NO_PLANE_OFFSET = { dx: 0, dy: 0, signed: 0 };
67478
+ function planeOffset(positionH, ax, ay, bx, by, dims, rotDeg, standardSection) {
67479
+ const pos2 = planePosition(positionH);
67480
+ if (pos2 === "middle" || !standardSection) return NO_PLANE_OFFSET;
67481
+ const planLen = Math.hypot(bx - ax, by - ay);
67482
+ if (!(planLen >= DEGENERATE_MM)) return NO_PLANE_OFFSET;
67483
+ const half = lateralHalfExtent(dims, rotDeg, dims.round === true);
67484
+ const signed = pos2 === "left" ? -half : half;
67485
+ return { dx: -(by - ay) / planLen * signed, dy: (bx - ax) / planLen * signed, signed };
67486
+ }
67291
67487
  function contractWithExportScopedMemberIds(contract) {
67292
67488
  const occurrences = /* @__PURE__ */ new Map();
67293
67489
  (contract.plans ?? []).forEach((plan, planIndex) => {
@@ -67355,26 +67551,26 @@ function profileDimsIn(profile) {
67355
67551
  const nums = m[2].split("X").map(parseDim).filter((n) => n != null);
67356
67552
  if (nums.length === 0) return null;
67357
67553
  if ((prefix === "HSS" || prefix === "TUBE" || prefix === "L") && nums.length >= 3) {
67358
- return { d: nums[0], w: nums[1], approx: false };
67554
+ return { d: nums[0], w: nums[1], approx: false, round: false };
67359
67555
  }
67360
67556
  if (prefix === "HSS" || prefix === "PIPE") {
67361
67557
  const dia = nums[0];
67362
- return { d: dia, w: dia, approx: false };
67558
+ return { d: dia, w: dia, approx: false, round: true };
67363
67559
  }
67364
67560
  if (/^(W|S|M|HP|C|MC|WT|ST|MT)$/.test(prefix)) {
67365
67561
  const actual = sectionDimsIn(p);
67366
- if (actual) return { d: actual.d, w: actual.bf, approx: false };
67562
+ if (actual) return { d: actual.d, w: actual.bf, approx: false, round: false };
67367
67563
  const d = nums[0];
67368
67564
  const bf = BF_IN[p.replace(/\s+/g, "")];
67369
- if (bf !== void 0) return { d, w: bf, approx: false };
67565
+ if (bf !== void 0) return { d, w: bf, approx: false, round: false };
67370
67566
  const ratio = prefix === "C" || prefix === "MC" ? 0.28 : 0.42;
67371
- return { d, w: d * ratio, approx: true };
67567
+ return { d, w: d * ratio, approx: true, round: false };
67372
67568
  }
67373
67569
  return null;
67374
67570
  }
67375
67571
  function profileDims(profile) {
67376
67572
  const din = profileDimsIn(profile);
67377
- return din ? { w: din.w * IN_TO_MM2, d: din.d * IN_TO_MM2, approx: din.approx } : null;
67573
+ return din ? { w: din.w * IN_TO_MM2, d: din.d * IN_TO_MM2, approx: din.approx, round: din.round } : null;
67378
67574
  }
67379
67575
  var SCENE_DEFAULT_PAL = ["#60a5fa", "#94a3b8", "#f59e0b", "#34d399", "#f472b6", "#a78bfa", "#fb7185", "#22d3ee", "#facc15", "#4ade80"];
67380
67576
  function pickColor(profile, idx, contract) {
@@ -67486,7 +67682,8 @@ function contractToScene(contractInput) {
67486
67682
  const defaultTosMm = (plan.default_tos ?? 0) * IN_TO_MM2;
67487
67683
  for (const m of plan.members ?? []) {
67488
67684
  const explicit = m.section && typeof m.section.w === "number" && m.section.w > 0 && typeof m.section.d === "number" && m.section.d > 0 ? { w: m.section.w, d: m.section.d, approx: false } : null;
67489
- const dims = profileDims(m.profile) ?? explicit;
67685
+ const stdDims = profileDims(m.profile);
67686
+ const dims = stdDims ?? explicit;
67490
67687
  if (!dims || !Array.isArray(m.wp) || m.wp.length < 2) {
67491
67688
  skipped.push(m.id);
67492
67689
  continue;
@@ -67504,6 +67701,7 @@ function contractToScene(contractInput) {
67504
67701
  let workFrom;
67505
67702
  let workTo;
67506
67703
  let posOffset = 0;
67704
+ let lat = NO_PLANE_OFFSET;
67507
67705
  if (m.role === "column") {
67508
67706
  const bos = m.col?.bos != null ? m.col.bos * IN_TO_MM2 : 0;
67509
67707
  const tos = m.col?.tos != null ? m.col.tos * IN_TO_MM2 : defaultTosMm;
@@ -67514,13 +67712,14 @@ function contractToScene(contractInput) {
67514
67712
  } else {
67515
67713
  const z0 = m.ends?.[0]?.tos != null ? m.ends[0].tos * IN_TO_MM2 : defaultTosMm;
67516
67714
  const z1 = m.ends?.[1]?.tos != null ? m.ends[1].tos * IN_TO_MM2 : defaultTosMm;
67517
- workFrom = [ax, ay, z0];
67518
- workTo = [bx, by, z1];
67519
67715
  const pos2 = depthPosition(m.position, Math.abs(z1 - z0), Math.hypot(bx - ax, by - ay), mIsBrace && m.brace?.type === "vertical");
67520
67716
  const zoff = pos2 === "top" ? -dims.d / 2 : pos2 === "bottom" ? dims.d / 2 : 0;
67521
67717
  posOffset = zoff;
67522
- from = [ax, ay, z0 + zoff];
67523
- to = [bx, by, z1 + zoff];
67718
+ lat = planeOffset(m.positionH, ax, ay, bx, by, dims, m.rot, stdDims !== null);
67719
+ workFrom = [ax + lat.dx, ay + lat.dy, z0];
67720
+ workTo = [bx + lat.dx, by + lat.dy, z1];
67721
+ from = [ax + lat.dx, ay + lat.dy, z0 + zoff];
67722
+ to = [bx + lat.dx, by + lat.dy, z1 + zoff];
67524
67723
  }
67525
67724
  if (m.role === "column" && Math.abs(to[2] - from[2]) < 1) {
67526
67725
  skipped.push(m.id);
@@ -67530,7 +67729,7 @@ function contractToScene(contractInput) {
67530
67729
  skipped.push(m.id);
67531
67730
  continue;
67532
67731
  }
67533
- memberGeo.set(m.id, { id: m.id, role: m.role === "column" ? "column" : "beam", from: workFrom, to: workTo, dims: { w: dims.w, d: dims.d }, profile, posOffset, isBrace: mIsBrace, ...typeof m.rot === "number" ? { rot: -m.rot } : {} });
67732
+ memberGeo.set(m.id, { id: m.id, role: m.role === "column" ? "column" : "beam", from: workFrom, to: workTo, dims: { w: dims.w, d: dims.d }, profile, posOffset, isBrace: mIsBrace, ...lat.signed ? { latOffset: lat.signed } : {}, ...typeof m.rot === "number" ? { rot: -m.rot } : {} });
67534
67733
  const role = mIsBrace ? "brace" : m.role === "column" ? "column" : "beam";
67535
67734
  const material = m.material && m.material.trim() || inferMaterial(profile);
67536
67735
  elements.push({
@@ -67562,6 +67761,8 @@ function contractToScene(contractInput) {
67562
67761
  color: pickColor(profile, paletteRank.indexOf(profile), contract)
67563
67762
  }));
67564
67763
  const joints = expandJoints(contract.joints, memberGeo);
67764
+ const coverage = partCoverage(contract.joints, { elements: joints.elements, skippedJointIds: joints.skipped });
67765
+ if (!coverageOk(coverage)) console.warn(`[steel] ${describeCoverage(coverage)}`);
67565
67766
  applyBeamClearance(elements, beamClears, refusedJointIds(contract.joints, joints.skipped));
67566
67767
  for (const id of applyMemberTrims(elements, joints.memberTrims)) skipped.push(`trim:${id}`);
67567
67768
  for (const part of joints.elements) {
@@ -67585,7 +67786,8 @@ function contractToScene(contractInput) {
67585
67786
  scene: { meta: { name: contract.title || "Steel Model", units: "mm", up: "z" }, groups, elements, ...weldOperations.length ? { operations: weldOperations } : {} },
67586
67787
  skipped,
67587
67788
  operations: joints.operations,
67588
- diagnostics: joints.diagnostics
67789
+ diagnostics: joints.diagnostics,
67790
+ coverage
67589
67791
  };
67590
67792
  }
67591
67793
  var SceneContractError = class extends Error {
@@ -67857,7 +68059,7 @@ function contractToAwareScene(contractInput, sourceId) {
67857
68059
  referenceSystems: grids.referenceSystems
67858
68060
  };
67859
68061
  scene.meta.sceneHash = sceneHash(scene);
67860
- return { scene, skipped: legacy.skipped, producerUnsupported };
68062
+ return { scene, skipped: legacy.skipped, producerUnsupported, coverage: legacy.coverage };
67861
68063
  }
67862
68064
  function sceneFromModel(view) {
67863
68065
  const blocked = membersBlockingExport(view.doc);
@@ -67875,7 +68077,8 @@ function sceneFromModel(view) {
67875
68077
  for (const vm of view.members) {
67876
68078
  const m = vm.raw;
67877
68079
  const explicit = m.section && typeof m.section.w === "number" && m.section.w > 0 && typeof m.section.d === "number" && m.section.d > 0 ? { w: m.section.w, d: m.section.d, approx: false } : null;
67878
- const dims = profileDims(m.profile) ?? explicit;
68080
+ const stdDims = profileDims(m.profile);
68081
+ const dims = stdDims ?? explicit;
67879
68082
  if (!dims) {
67880
68083
  skipped.push(m.id);
67881
68084
  continue;
@@ -67898,19 +68101,21 @@ function sceneFromModel(view) {
67898
68101
  let workFrom;
67899
68102
  let workTo;
67900
68103
  let posOffset = 0;
68104
+ let lat = NO_PLANE_OFFSET;
67901
68105
  if (m.role === "column") {
67902
68106
  from = [ax, ay, z0];
67903
68107
  to = [bx, by, z1];
67904
68108
  workFrom = from;
67905
68109
  workTo = to;
67906
68110
  } else {
67907
- workFrom = [ax, ay, z0];
67908
- workTo = [bx, by, z1];
67909
68111
  const pos2 = depthPosition(m.position, Math.abs(z1 - z0), Math.hypot(bx - ax, by - ay), mIsBrace && braceType === "vertical");
67910
68112
  const zoff = pos2 === "top" ? -dims.d / 2 : pos2 === "bottom" ? dims.d / 2 : 0;
67911
68113
  posOffset = zoff;
67912
- from = [ax, ay, z0 + zoff];
67913
- to = [bx, by, z1 + zoff];
68114
+ lat = planeOffset(m.positionH, ax, ay, bx, by, dims, m.rot, stdDims !== null);
68115
+ workFrom = [ax + lat.dx, ay + lat.dy, z0];
68116
+ workTo = [bx + lat.dx, by + lat.dy, z1];
68117
+ from = [ax + lat.dx, ay + lat.dy, z0 + zoff];
68118
+ to = [bx + lat.dx, by + lat.dy, z1 + zoff];
67914
68119
  }
67915
68120
  if (Math.hypot(workTo[0] - workFrom[0], workTo[1] - workFrom[1], workTo[2] - workFrom[2]) < DEGENERATE_MM) {
67916
68121
  skipped.push(m.id);
@@ -67925,6 +68130,7 @@ function sceneFromModel(view) {
67925
68130
  profile,
67926
68131
  posOffset,
67927
68132
  isBrace: mIsBrace,
68133
+ ...lat.signed ? { latOffset: lat.signed } : {},
67928
68134
  ...typeof m.rot === "number" ? { rot: m.rot } : {}
67929
68135
  });
67930
68136
  const role = mIsBrace ? "brace" : m.role === "column" ? "column" : "beam";
@@ -67952,6 +68158,8 @@ function sceneFromModel(view) {
67952
68158
  color: pickColor(profile, paletteRank.indexOf(profile), view.doc)
67953
68159
  }));
67954
68160
  const joints = expandJoints(view.doc.joints, memberGeo);
68161
+ const coverage = partCoverage(view.doc.joints, { elements: joints.elements, skippedJointIds: joints.skipped });
68162
+ if (!coverageOk(coverage)) console.warn(`[steel] ${describeCoverage(coverage)}`);
67955
68163
  applyBeamClearance(elements, beamClears, refusedJointIds(view.doc.joints, joints.skipped));
67956
68164
  for (const id of applyMemberTrims(elements, joints.memberTrims)) skipped.push(`trim:${id}`);
67957
68165
  for (const part of joints.elements) elements.push(part);
@@ -67963,7 +68171,8 @@ function sceneFromModel(view) {
67963
68171
  scene: { meta: { name: "Steel Model", units: "mm", up: "z" }, groups, elements },
67964
68172
  skipped,
67965
68173
  operations: joints.operations,
67966
- diagnostics: joints.diagnostics
68174
+ diagnostics: joints.diagnostics,
68175
+ coverage
67967
68176
  };
67968
68177
  }
67969
68178
  function modelGridRecords(grid) {
@@ -68099,7 +68308,7 @@ function awareSceneFromModel(contractInput, sourceId) {
68099
68308
  };
68100
68309
  assertExportIdentityNamespace(scene, producerUnsupported);
68101
68310
  scene.meta.sceneHash = sceneHash(scene);
68102
- return { scene, skipped: legacy.skipped, producerUnsupported };
68311
+ return { scene, skipped: legacy.skipped, producerUnsupported, coverage: legacy.coverage };
68103
68312
  }
68104
68313
 
68105
68314
  // ../web/steel-detail-refs.js
@@ -68757,6 +68966,17 @@ function registerRevisionRoutes(app) {
68757
68966
  return { ok: true, version: version2, contractType: STEEL_V2 };
68758
68967
  } catch (error) {
68759
68968
  if (error instanceof ContractTransactionError) {
68969
+ const expectedRace = error.code === "contract-changed" || error.code === "history-already-exists";
68970
+ req.log[expectedRace ? "warn" : "error"](
68971
+ {
68972
+ projectId: project.id,
68973
+ requestId: request.id,
68974
+ code: error.code,
68975
+ reason: error.message,
68976
+ ...error.details === void 0 ? {} : { details: error.details }
68977
+ },
68978
+ `initial read refused: ${error.code}`
68979
+ );
68760
68980
  return reply.status(400).send({ ok: false, error: error.message, code: error.code });
68761
68981
  }
68762
68982
  throw error;
@@ -85192,11 +85412,24 @@ async function startServer() {
85192
85412
  if (getProject(r.project)?.app !== r.appId) return void 0;
85193
85413
  return storedContractType(r.appId, r.project, memo);
85194
85414
  };
85195
- const requestView2 = (r) => r === null ? null : { ...r, appTemplateId: r.appId ? resolveTemplateId(r.appId) : void 0, contractType: requestContractType(r) };
85415
+ const requestProjectName = (r, memo) => {
85416
+ if (!r.project) return void 0;
85417
+ if (memo?.has(r.project)) return memo.get(r.project);
85418
+ const name = getProject(r.project)?.name;
85419
+ memo?.set(r.project, name);
85420
+ return name;
85421
+ };
85422
+ const requestView2 = (r) => r === null ? null : { ...r, appTemplateId: r.appId ? resolveTemplateId(r.appId) : void 0, contractType: requestContractType(r), projectName: requestProjectName(r) };
85196
85423
  const requestViews = (list) => {
85197
85424
  const root5 = templateIdResolver();
85198
85425
  const typeMemo = /* @__PURE__ */ new Map();
85199
- return list.map((r) => ({ ...r, appTemplateId: r.appId ? root5(r.appId) : void 0, contractType: requestContractType(r, typeMemo) }));
85426
+ const nameMemo = /* @__PURE__ */ new Map();
85427
+ return list.map((r) => ({
85428
+ ...r,
85429
+ appTemplateId: r.appId ? root5(r.appId) : void 0,
85430
+ contractType: requestContractType(r, typeMemo),
85431
+ projectName: requestProjectName(r, nameMemo)
85432
+ }));
85200
85433
  };
85201
85434
  app.get("/api/projects", async () => ({ ok: true, projects: projectViews(listProjects()) }));
85202
85435
  app.post(
@@ -160,6 +160,7 @@
160
160
  "role": { "enum": ["beam", "column"], "description": "Authored role. Defaults to beam when absent. NOT derived from geometry." },
161
161
  "memberType": { "type": "string", "description": "Member category driving the legend (beam, ledger, brace, …). 'brace' is excluded from every beam-only path." },
162
162
  "position": { "enum": ["top", "middle", "bottom"], "description": "Profile placement relative to the work-line — the section's depth position." },
163
+ "positionH": { "enum": ["left", "middle", "right"], "description": "Profile placement ACROSS the work-line — the section's plan position, the horizontal companion to `position`. Named for where the LINE sits on the section, exactly as `position` is: left = the section's left face is on the line (so the steel is to its right), right = the mirror, middle = centred (the default, and what every member did before this field existed). Left/right are read looking from `from` to `to` with Z up — the same sense as reading the plan from above. Absent = middle. Ignored for a member with no plan direction (a plumb column or brace has no left or right) and for one with no resolved AISC designation (a CUSTOM / traced `section` box, whose section axes the viewer does not align to the plan). A width the section tables did not supply — a per-series ratio estimate — is NOT ignored: the member is already drawn and exported at that width, so flushing to the face it actually has is self-consistent, and the editor says the width is estimated." },
163
164
  "rot": { "type": "number", "description": "Section rotation about the member axis, degrees. Present on real v1 contracts but never declared by the v1 schema — enumerated here so migration cannot silently drop it." },
164
165
  "section": {
165
166
  "type": "object",
@@ -312,7 +312,7 @@
312
312
  "additionalProperties": true,
313
313
  "description": "A placed connection the connection engine expands into real 3D parts. A parametric RECIPE kind (base-plate, shear-plate) derives all geometry from its `params` + the live member positions, so it moves/re-solves with its members. A 'custom' kind is an imported connection (read from IFC via AWARE's connection-reader) that carries its own opaque tessellated `geometry` and a `place` point — move / replace only, no per-dimension edit. Distinct from the `connections[]` library (vendor-neutral type/detail/targets identities a joint can cite). v1 kinds: base-plate, shear-plate, custom.",
314
314
  "properties": {
315
- "id": { "type": "string", "description": "Stable joint id, e.g. j-bp-1 / sp-b3-e0 / cx-<id>." },
315
+ "id": { "type": "string", "minLength": 1, "description": "Stable joint id, e.g. j-bp-1 / sp-b3-e0 / cx-<id>. NON-EMPTY, matching steel.model/v2: every connection part's scene id is derived as `${joint.id}:…`, so a blank id yields parts named `:plate` / `:rod0` and the joint is recorded as the positional `joint#<i>` instead — a specified connection that reaches neither the model, IFC nor Tekla, while the inventory gate still reports ok. `required` alone permitted \"\"." },
316
316
  "kind": { "type": "string", "description": "Connection kind: base-plate, shear-plate (parametric recipes the engine expands), or custom (imported IFC geometry). end-plate / cap-plate / … follow." },
317
317
  "main": { "type": "string", "description": "Id of the host member this joint hangs off. For a base-plate this is the column; for a shear-plate this is the SUPPORTED BEAM (the joint sits at one of the beam's ends — see `at`). Required for the recipe kinds; optional for 'custom' (an imported connection carries its own geometry rather than deriving it from a member)." },
318
318
  "secondaries": { "type": "array", "items": { "type": "string" }, "description": "Ids of the other members this joint binds — e.g. the SUPPORT a shear-plate frames into. Optional and inferred by geometry; the shear-plate engine does not require it (the fin plate is placed off the beam end + beam axis). Empty for a base-plate." },