@floless/app 0.111.1 → 0.111.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -10699,10 +10699,10 @@ var require_proxy_addr = __commonJS({
10699
10699
  }
10700
10700
  return compileTrust(compileRangeSubnets(trust));
10701
10701
  }
10702
- function compileRangeSubnets(arr4) {
10703
- const rangeSubnets = new Array(arr4.length);
10704
- for (let i = 0; i < arr4.length; i++) {
10705
- rangeSubnets[i] = parseipNotation(arr4[i]);
10702
+ function compileRangeSubnets(arr5) {
10703
+ const rangeSubnets = new Array(arr5.length);
10704
+ for (let i = 0; i < arr5.length; i++) {
10705
+ rangeSubnets[i] = parseipNotation(arr5[i]);
10706
10706
  }
10707
10707
  return rangeSubnets;
10708
10708
  }
@@ -13184,9 +13184,9 @@ var require_codegen = __commonJS({
13184
13184
  forOf(nameOrPrefix, iterable, forBody, varKind = scope_1.varKinds.const) {
13185
13185
  const name = this._scope.toName(nameOrPrefix);
13186
13186
  if (this.opts.es5) {
13187
- const arr4 = iterable instanceof code_1.Name ? iterable : this.var("_arr", iterable);
13188
- return this.forRange("_i", 0, (0, code_1._)`${arr4}.length`, (i) => {
13189
- this.var(name, (0, code_1._)`${arr4}[${i}]`);
13187
+ const arr5 = iterable instanceof code_1.Name ? iterable : this.var("_arr", iterable);
13188
+ return this.forRange("_i", 0, (0, code_1._)`${arr5}.length`, (i) => {
13189
+ this.var(name, (0, code_1._)`${arr5}[${i}]`);
13190
13190
  forBody(name);
13191
13191
  });
13192
13192
  }
@@ -13385,9 +13385,9 @@ var require_util = __commonJS({
13385
13385
  exports2.checkStrictMode = exports2.getErrorPath = exports2.Type = exports2.useFunc = exports2.setEvaluated = exports2.evaluatedPropsToName = exports2.mergeEvaluated = exports2.eachItem = exports2.unescapeJsonPointer = exports2.escapeJsonPointer = exports2.escapeFragment = exports2.unescapeFragment = exports2.schemaRefOrVal = exports2.schemaHasRulesButRef = exports2.schemaHasRules = exports2.checkUnknownRules = exports2.alwaysValidSchema = exports2.toHash = void 0;
13386
13386
  var codegen_1 = require_codegen();
13387
13387
  var code_1 = require_code();
13388
- function toHash(arr4) {
13388
+ function toHash(arr5) {
13389
13389
  const hash2 = {};
13390
- for (const item of arr4)
13390
+ for (const item of arr5)
13391
13391
  hash2[item] = true;
13392
13392
  return hash2;
13393
13393
  }
@@ -41036,14 +41036,14 @@ var require_dist5 = __commonJS({
41036
41036
  var DAY = HOUR * 24;
41037
41037
  var YEAR = DAY * 365.25;
41038
41038
  function parse(val) {
41039
- var num6, arr4 = val.toLowerCase().match(RGX);
41040
- if (arr4 != null && (num6 = parseFloat(arr4[1]))) {
41041
- if (arr4[3] != null) return num6 * SEC2;
41042
- if (arr4[4] != null) return num6 * MIN;
41043
- if (arr4[5] != null) return num6 * HOUR;
41044
- if (arr4[6] != null) return num6 * DAY;
41045
- if (arr4[7] != null) return num6 * DAY * 7;
41046
- if (arr4[8] != null) return num6 * YEAR;
41039
+ var num6, arr5 = val.toLowerCase().match(RGX);
41040
+ if (arr5 != null && (num6 = parseFloat(arr5[1]))) {
41041
+ if (arr5[3] != null) return num6 * SEC2;
41042
+ if (arr5[4] != null) return num6 * MIN;
41043
+ if (arr5[5] != null) return num6 * HOUR;
41044
+ if (arr5[6] != null) return num6 * DAY;
41045
+ if (arr5[7] != null) return num6 * DAY * 7;
41046
+ if (arr5[8] != null) return num6 * YEAR;
41047
41047
  return num6;
41048
41048
  }
41049
41049
  }
@@ -53792,7 +53792,7 @@ function appVersion() {
53792
53792
  return resolveVersion({
53793
53793
  isSea: isSea2(),
53794
53794
  sqVersionXml: readSqVersionXml(),
53795
- define: true ? "0.111.1" : void 0,
53795
+ define: true ? "0.111.2" : void 0,
53796
53796
  pkgVersion: readPkgVersion()
53797
53797
  });
53798
53798
  }
@@ -53808,7 +53808,7 @@ function resolveChannel(s) {
53808
53808
  function appChannel() {
53809
53809
  return resolveChannel({
53810
53810
  isSea: isSea2(),
53811
- define: true ? "0.111.1" : void 0,
53811
+ define: true ? "0.111.2" : void 0,
53812
53812
  // argv[1] is the entry the runtime actually loaded (…/dist/floless-server.cjs), which is what
53813
53813
  // carries the npx cache prefix. Absent under the SEA exe, which never reaches the npx branch.
53814
53814
  modulePath: process.argv[1]
@@ -60092,16 +60092,43 @@ function applyStagedRevision(current, staged, selection = SELECT_NOTHING) {
60092
60092
  }
60093
60093
 
60094
60094
  // revision-envelope.ts
60095
- function canonicalEnvelope(staged) {
60095
+ var arr2 = (v) => Array.isArray(v) ? v : [];
60096
+ function removedMemberFacts(staged, current) {
60097
+ const out = /* @__PURE__ */ new Map();
60098
+ for (const p of staged.proposals) if (p.kind === "member-removed") out.set(p.memberId, { members: [], sheets: [] });
60099
+ if (!out.size) return out;
60100
+ for (const m of arr2(current.members)) out.get(m?.id)?.members.push(m);
60101
+ const sheets = new Map([...out.keys()].map((id) => [id, /* @__PURE__ */ new Set()]));
60102
+ for (const plan of arr2(current.plans)) {
60103
+ if (typeof plan?.sheet !== "string") continue;
60104
+ for (const id of arr2(plan.memberRefs)) sheets.get(id)?.add(plan.sheet);
60105
+ for (const obs of arr2(plan.memberObservations)) {
60106
+ if (obs?.binding?.status !== "active") continue;
60107
+ for (const id of arr2(obs.binding.memberIds)) sheets.get(id)?.add(plan.sheet);
60108
+ }
60109
+ }
60110
+ for (const [id, facts] of out) {
60111
+ facts.members.sort((a, b) => cmp(canonicalJson(a), canonicalJson(b)));
60112
+ facts.sheets = [...sheets.get(id) ?? []].sort(cmp);
60113
+ }
60114
+ return out;
60115
+ }
60116
+ function canonicalEnvelope(staged, current) {
60117
+ const facts = removedMemberFacts(staged, current);
60096
60118
  return {
60097
60119
  accepted: staged.accepted,
60098
60120
  bindingUpdates: staged.bindingUpdates,
60099
60121
  bindingProposals: staged.bindingProposals,
60100
- proposals: staged.proposals.map(withSortedFields),
60122
+ proposals: staged.proposals.map((p) => hashedProposal(p, facts)),
60101
60123
  issues: [...staged.issues].sort(byIssue)
60102
60124
  };
60103
60125
  }
60104
- var envelopeHashOf = (staged) => hashOf(canonicalEnvelope(staged));
60126
+ function hashedProposal(p, facts) {
60127
+ if (p.kind !== "member-removed") return withSortedFields(p);
60128
+ const f = facts.get(p.memberId);
60129
+ return { ...p, members: f?.members ?? [], sheets: f?.sheets ?? [] };
60130
+ }
60131
+ var envelopeHashOf = (staged, current) => hashOf(canonicalEnvelope(staged, current));
60105
60132
  function withSortedFields(p) {
60106
60133
  if (p.kind !== "member-changed" && p.kind !== "plan-changed") return p;
60107
60134
  return { ...p, fields: [...p.fields].sort((a, b) => cmp(a.key, b.key)) };
@@ -60142,18 +60169,25 @@ function selectionOrError(staged, accept) {
60142
60169
  return { selection: out };
60143
60170
  }
60144
60171
  var PLAN_BULK_KEYS = ["raster_b64", "segments", "labels"];
60145
- function stagedSummary(staged, record2) {
60172
+ function stagedSummary(staged, record2, current) {
60173
+ const facts = removedMemberFacts(staged, current);
60146
60174
  return {
60147
60175
  stageId: record2.stageId,
60148
60176
  requestId: record2.requestId,
60149
60177
  accepted: staged.accepted.length,
60150
60178
  bindingUpdates: staged.bindingUpdates.length,
60151
- proposals: staged.proposals.map(viewOf),
60179
+ proposals: staged.proposals.map((p) => viewOf(p, facts)),
60152
60180
  bindingProposals: staged.bindingProposals,
60153
60181
  issues: staged.issues
60154
60182
  };
60155
60183
  }
60156
- function viewOf(p) {
60184
+ function viewOf(p, facts) {
60185
+ if (p.kind === "member-removed") {
60186
+ const f = facts.get(p.memberId);
60187
+ const members = f?.members ?? [];
60188
+ const sheets = f?.sheets ?? [];
60189
+ return members.length === 1 ? { ...p, member: members[0], matches: 1, sheets } : { ...p, member: null, matches: members.length, sheets };
60190
+ }
60157
60191
  if (p.kind !== "plan-added") return p;
60158
60192
  const plan = p.plan;
60159
60193
  const shown = {};
@@ -61367,7 +61401,7 @@ function guidOf(index, id, what) {
61367
61401
  function obj(value) {
61368
61402
  return value && typeof value === "object" && !Array.isArray(value) ? value : {};
61369
61403
  }
61370
- function arr2(value) {
61404
+ function arr3(value) {
61371
61405
  return Array.isArray(value) ? value : [];
61372
61406
  }
61373
61407
  function str2(value) {
@@ -61419,22 +61453,22 @@ function buildManifest(scene) {
61419
61453
  if (p.contained) containment.add(p.guid);
61420
61454
  };
61421
61455
  const componentOf = /* @__PURE__ */ new Map();
61422
- for (const raw of arr2(scene.operations)) {
61456
+ for (const raw of arr3(scene.operations)) {
61423
61457
  const op = obj(raw);
61424
61458
  if (str2(op.kind) !== "bolt-array") continue;
61425
- for (const instRaw of arr2(op.instances)) {
61459
+ for (const instRaw of arr3(op.instances)) {
61426
61460
  const inst = obj(instRaw);
61427
- for (const id of [str2(inst.shankId), str2(inst.headId), ...arr2(inst.nutIds).map(str2), ...arr2(inst.washerIds).map(str2)]) {
61461
+ for (const id of [str2(inst.shankId), str2(inst.headId), ...arr3(inst.nutIds).map(str2), ...arr3(inst.washerIds).map(str2)]) {
61428
61462
  if (id) componentOf.set(id, str2(op.id));
61429
61463
  }
61430
61464
  }
61431
61465
  }
61432
- for (const raw of arr2(scene.elements)) {
61466
+ for (const raw of arr3(scene.elements)) {
61433
61467
  const el = obj(raw);
61434
61468
  const id = str2(el.id);
61435
61469
  const kind = str2(el.kind) || "member";
61436
61470
  if (kind === "plate") {
61437
- const holes = arr2(el.holes);
61471
+ const holes = arr3(el.holes);
61438
61472
  const guid = ifcRecordGuid("element", id);
61439
61473
  addProduct({
61440
61474
  sceneId: id,
@@ -61487,7 +61521,7 @@ function buildManifest(scene) {
61487
61521
  contained: true
61488
61522
  });
61489
61523
  }
61490
- for (const raw of arr2(scene.operations)) {
61524
+ for (const raw of arr3(scene.operations)) {
61491
61525
  const op = obj(raw);
61492
61526
  const id = str2(op.id);
61493
61527
  const kind = str2(op.kind);
@@ -61509,10 +61543,10 @@ function buildManifest(scene) {
61509
61543
  contained: true,
61510
61544
  bodyItems: components
61511
61545
  });
61512
- for (const instRaw of arr2(op.instances)) {
61546
+ for (const instRaw of arr3(op.instances)) {
61513
61547
  const inst = obj(instRaw);
61514
61548
  aliases.set(str2(inst.id), { ownerGuid: guid, realizedBy: id });
61515
- for (const effectRaw of arr2(inst.holeEffects)) {
61549
+ for (const effectRaw of arr3(inst.holeEffects)) {
61516
61550
  const effect = obj(effectRaw);
61517
61551
  const effectId = str2(effect.id);
61518
61552
  const targetId = str2(effect.targetId);
@@ -61585,7 +61619,7 @@ function buildManifest(scene) {
61585
61619
  });
61586
61620
  }
61587
61621
  }
61588
- for (const raw of arr2(scene.referenceSystems)) {
61622
+ for (const raw of arr3(scene.referenceSystems)) {
61589
61623
  const ref = obj(raw);
61590
61624
  if (str2(ref.kind) !== "structural-grid") continue;
61591
61625
  const id = str2(ref.id);
@@ -61593,13 +61627,13 @@ function buildManifest(scene) {
61593
61627
  addProduct({ sceneId: id, role: "grid", guid, entityType: "IFCGRID", representationExempt: true, contained: true });
61594
61628
  const u = [];
61595
61629
  const v = [];
61596
- for (const axisRaw of arr2(ref.axes)) {
61630
+ for (const axisRaw of arr3(ref.axes)) {
61597
61631
  const axis = obj(axisRaw);
61598
61632
  const label = typeof axis.label === "string" ? axis.label : str2(axis.id);
61599
61633
  (str2(axis.direction) === "x" ? u : v).push(label);
61600
61634
  }
61601
61635
  gridAxes.push({ gridGuid: guid, u, v });
61602
- for (const levelRaw of arr2(ref.levels)) {
61636
+ for (const levelRaw of arr3(ref.levels)) {
61603
61637
  const level = obj(levelRaw);
61604
61638
  const levelId = str2(level.id);
61605
61639
  addProduct({
@@ -63643,10 +63677,11 @@ async function stageForReview(reply, project, requestId, candidate) {
63643
63677
  });
63644
63678
  }
63645
63679
  const stagingKey = await getOrCreateProjectStagingId(project.id);
63646
- const staged = stageRevisionRead(current, candidate);
63680
+ const cur = current;
63681
+ const staged = stageRevisionRead(cur, candidate);
63647
63682
  const record2 = stageCandidate(stagingKey, candidate, {
63648
63683
  requestId,
63649
- envelopeHash: envelopeHashOf(staged),
63684
+ envelopeHash: envelopeHashOf(staged, cur),
63650
63685
  // Carried only so a 409 can say the contract moved. Never a gate — an ordinary editor autosave
63651
63686
  // moves it constantly and must not starve a review.
63652
63687
  baseContractHash: etagOf(current),
@@ -63654,7 +63689,7 @@ async function stageForReview(reply, project, requestId, candidate) {
63654
63689
  });
63655
63690
  const request = patchRequest(requestId, { status: "staged" });
63656
63691
  broadcast({ type: "request-added", request: requestView(request) });
63657
- return reply.status(202).send({ ok: true, staged: stagedSummary(staged, record2) });
63692
+ return reply.status(202).send({ ok: true, staged: stagedSummary(staged, record2, cur) });
63658
63693
  }
63659
63694
  function registerRevisionRoutes(app) {
63660
63695
  app.post(
@@ -63789,8 +63824,19 @@ function registerRevisionRoutes(app) {
63789
63824
  }
63790
63825
  throw e;
63791
63826
  }
63792
- const fresh = stageRevisionRead(current, candidate);
63793
- return { ok: true, staged: stagedSummary(fresh, st.record) };
63827
+ const cur = current;
63828
+ let fresh;
63829
+ try {
63830
+ fresh = stageRevisionRead(cur, candidate);
63831
+ } catch (e) {
63832
+ req.log.error({ err: e, projectId: project.id, requestId }, "revision review: the current contract could not be read");
63833
+ return reply.status(409).send({
63834
+ ok: false,
63835
+ code: "contract-unreadable",
63836
+ error: "this project's model cannot be read, so the review cannot be shown \u2014 restore the last good version from History, then read the revised set again"
63837
+ });
63838
+ }
63839
+ return { ok: true, staged: stagedSummary(fresh, st.record, cur) };
63794
63840
  }
63795
63841
  );
63796
63842
  app.post(
@@ -63840,11 +63886,12 @@ function registerRevisionRoutes(app) {
63840
63886
  }
63841
63887
  throw e;
63842
63888
  }
63843
- const fresh = stageRevisionRead(current, candidate);
63844
- if (envelopeHashOf(fresh) !== st.record.envelopeHash) {
63889
+ const cur = current;
63890
+ const fresh = stageRevisionRead(cur, candidate);
63891
+ if (envelopeHashOf(fresh, cur) !== st.record.envelopeHash) {
63845
63892
  const restaged = stageCandidate(stagingKey, candidate, {
63846
63893
  requestId: st.record.requestId,
63847
- envelopeHash: envelopeHashOf(fresh),
63894
+ envelopeHash: envelopeHashOf(fresh, cur),
63848
63895
  baseContractHash: etagOf(current),
63849
63896
  stagedAt: (/* @__PURE__ */ new Date()).toISOString()
63850
63897
  });
@@ -63852,7 +63899,7 @@ function registerRevisionRoutes(app) {
63852
63899
  ok: false,
63853
63900
  error: "the model changed while you were reviewing, so this read means something different now \u2014 here is the current review",
63854
63901
  code: "stage-restaged",
63855
- staged: stagedSummary(fresh, restaged)
63902
+ staged: stagedSummary(fresh, restaged, cur)
63856
63903
  });
63857
63904
  }
63858
63905
  const sel = selectionOrError(fresh, req.body?.accept);
@@ -64648,7 +64695,7 @@ function remapJoints(v1, ctx) {
64648
64695
  const issues = [];
64649
64696
  const joints = [];
64650
64697
  if (!isObj4(v1)) return { joints, issues };
64651
- for (const j of arr3(v1.joints).filter(isObj4)) {
64698
+ for (const j of arr4(v1.joints).filter(isObj4)) {
64652
64699
  const id = str3(j.id) ?? "";
64653
64700
  const kind = str3(j.kind) ?? "";
64654
64701
  const out = { id, kind };
@@ -64667,7 +64714,7 @@ function remapJoints(v1, ctx) {
64667
64714
  });
64668
64715
  }
64669
64716
  const secondaries = [];
64670
- for (const s of arr3(j.secondaries)) {
64717
+ for (const s of arr4(j.secondaries)) {
64671
64718
  const sid = str3(s);
64672
64719
  const r = resolveMember(ctx, null, sid);
64673
64720
  if (r.id) secondaries.push(r.id);
@@ -64694,7 +64741,7 @@ function remapPlanDims(plan, ctx) {
64694
64741
  const dims = [];
64695
64742
  const sheet = str3(plan.sheet) ?? "";
64696
64743
  const gridMap = ctx.gridIds[sheet] ?? {};
64697
- for (const d of arr3(plan.dims).filter(isObj4)) {
64744
+ for (const d of arr4(plan.dims).filter(isObj4)) {
64698
64745
  const out = {
64699
64746
  id: str3(d.id) ?? "",
64700
64747
  a: clone(d.a),
@@ -64752,7 +64799,7 @@ function remapPropLabels(v1, ctx) {
64752
64799
  if (placement) out.placement = placement;
64753
64800
  if (typeof p.selected_only === "boolean") out.selected_only = p.selected_only;
64754
64801
  const ids = [];
64755
- for (const raw of arr3(p.ids)) {
64802
+ for (const raw of arr4(p.ids)) {
64756
64803
  const id = str3(raw);
64757
64804
  const r = resolveMember(ctx, null, id);
64758
64805
  if (r.id) ids.push(r.id);
@@ -64782,7 +64829,7 @@ function remapViews(v1, ctx, planSheets) {
64782
64829
  const issues = [];
64783
64830
  const views = [];
64784
64831
  if (!isObj4(v1)) return { views, issues };
64785
- for (const v of arr3(v1.views).filter(isObj4)) {
64832
+ for (const v of arr4(v1.views).filter(isObj4)) {
64786
64833
  const id = str3(v.id) ?? "";
64787
64834
  const out = { id, name: str3(v.name) ?? "" };
64788
64835
  if (num3(v.v) !== null) out.v = num3(v.v);
@@ -64844,7 +64891,7 @@ function remapViews(v1, ctx, planSheets) {
64844
64891
  const dir = kind === "level" ? "z" : kind === "grid-x" ? "x" : kind === "grid-y" ? "y" : null;
64845
64892
  const label = str3(gen.label) ?? "";
64846
64893
  const sheet = str3(gen.sheet) ?? "";
64847
- const matches = dir ? arr3(ctx.grid?.axes).filter((a) => a.dir === dir && a.label === label) : [];
64894
+ const matches = dir ? arr4(ctx.grid?.axes).filter((a) => a.dir === dir && a.label === label) : [];
64848
64895
  if (matches.length > 1) {
64849
64896
  issues.push({ code: "view-generated-ambiguous", severity: "block", message: `generated view "${id}" names ${kind} "${label}", which matches ${matches.length} model grid axes; binding it to an arbitrary one would silently relocate the view` });
64850
64897
  views.push(out);
@@ -64896,13 +64943,13 @@ function axisCoordinate(ctx, id) {
64896
64943
  if (parsed.err) return null;
64897
64944
  const off = num3(parsed.offsets[i]);
64898
64945
  if (off === null) return null;
64899
- const originOf = num3(arr3(g.origin)[dir === "x" ? 0 : 1]) ?? 0;
64946
+ const originOf = num3(arr4(g.origin)[dir === "x" ? 0 : 1]) ?? 0;
64900
64947
  return originOf + off;
64901
64948
  }
64902
64949
  function remapDetailPlacements(v1) {
64903
64950
  const issues = [];
64904
64951
  if (!isObj4(v1)) return { placements: [], issues };
64905
- for (const d of arr3(v1.detail_placements).filter(isObj4)) {
64952
+ for (const d of arr4(v1.detail_placements).filter(isObj4)) {
64906
64953
  const id = str3(d.id) ?? "", sheet = str3(d.sheet) ?? "";
64907
64954
  issues.push({
64908
64955
  code: str3(d.anchorId) ? "detail-placement-unmigrated" : "detail-unanchored",
@@ -64915,7 +64962,7 @@ function remapDetailPlacements(v1) {
64915
64962
  }
64916
64963
  function remapDims3d(v1) {
64917
64964
  const issues = [];
64918
- const entries2 = isObj4(v1) ? arr3(v1.dims3d).filter(isObj4) : [];
64965
+ const entries2 = isObj4(v1) ? arr4(v1.dims3d).filter(isObj4) : [];
64919
64966
  if (entries2.length) {
64920
64967
  issues.push({ code: "dims3d-ownerless", severity: "block", message: `${entries2.length} 3D dimension(s) carry world coordinates in the OLD scene frame and have no owner to recompute from; assign a frame, confirm keep-as-world, or discard them before migrating (epic \xA710)` });
64921
64968
  }
@@ -64924,7 +64971,7 @@ function remapDims3d(v1) {
64924
64971
 
64925
64972
  // steel-model-migrate.ts
64926
64973
  var isObj4 = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
64927
- var arr3 = (v) => Array.isArray(v) ? v : [];
64974
+ var arr4 = (v) => Array.isArray(v) ? v : [];
64928
64975
  var str3 = (v) => typeof v === "string" ? v : null;
64929
64976
  var num3 = (v) => typeof v === "number" && Number.isFinite(v) ? v : null;
64930
64977
  var clone = (v) => structuredClone(v);
@@ -64955,7 +65002,7 @@ function sheetAxes(plan, issues) {
64955
65002
  issues.push({ code: "grid-missing", severity: "block", sheet, message: `sheet "${sheet}" has no grid, so it cannot be registered` });
64956
65003
  return null;
64957
65004
  }
64958
- const origin = arr3(g.origin);
65005
+ const origin = arr4(g.origin);
64959
65006
  const out = { x: [], y: [], z: [], originPx: [num3(origin[0]) ?? 0, num3(origin[1]) ?? 0] };
64960
65007
  for (const dir of ["x", "y"]) {
64961
65008
  const parsed = parseSpacings(str3(g[dir]) ?? "");
@@ -64966,7 +65013,7 @@ function sheetAxes(plan, issues) {
64966
65013
  const labels = labelsFor(g[`labels_${dir}`], dir === "x" ? "num" : "alpha", parsed.offsets.length);
64967
65014
  out[dir] = parsed.offsets.map((mm, i) => ({ label: String(labels[i]), mm }));
64968
65015
  }
64969
- const levels = parseLevels(str3(g.z) ?? "", arr3(g.labels_z));
65016
+ const levels = parseLevels(str3(g.z) ?? "", arr4(g.labels_z));
64970
65017
  if (levels.err) issues.push({ code: "grid-levels-invalid", severity: "block", sheet, message: `z grid string is unparseable: ${levels.err}` });
64971
65018
  else out.z = levels.levels.map((l, i) => ({ mm: l.mm, label: String(l.label ?? ""), sourceIndex: typeof l.sourceIndex === "number" ? l.sourceIndex : i }));
64972
65019
  return out;
@@ -64978,7 +65025,7 @@ function bootstrapGrid(v1) {
64978
65025
  issues.push({ code: "not-an-object", severity: "block", message: "contract must be an object" });
64979
65026
  return empty;
64980
65027
  }
64981
- const plans = arr3(v1.plans).filter(isObj4);
65028
+ const plans = arr4(v1.plans).filter(isObj4);
64982
65029
  if (!plans.length) {
64983
65030
  issues.push({ code: "no-plans", severity: "block", message: "contract has no plans" });
64984
65031
  return empty;
@@ -65042,7 +65089,7 @@ function bootstrapGrid(v1) {
65042
65089
  for (const p of plans) {
65043
65090
  const g = isObj4(p.grid) ? p.grid : {};
65044
65091
  const zSheet = str3(p.sheet) ?? "";
65045
- const authoredLabels = arr3(g.labels_z).map(str3);
65092
+ const authoredLabels = arr4(g.labels_z).map(str3);
65046
65093
  for (const l of parsed.get(zSheet)?.z ?? []) {
65047
65094
  const key = gridLevelKey(l.mm);
65048
65095
  if (key === null) continue;
@@ -65065,7 +65112,7 @@ function bootstrapGrid(v1) {
65065
65112
  const canonicalZ = new Map(zUnion.map((l) => [gridLevelKey(l.mm), l.mm]));
65066
65113
  const hiddenPerSheet = plans.map((p) => ({
65067
65114
  sheet: str3(p.sheet) ?? "",
65068
- hidden: new Set(arr3((isObj4(p.grid) ? p.grid : {}).hidden_z).map(num3).filter((v) => v !== null).map((mm) => canonicalZ.get(gridLevelKey(mm))).filter((v) => v !== void 0))
65115
+ hidden: new Set(arr4((isObj4(p.grid) ? p.grid : {}).hidden_z).map(num3).filter((v) => v !== null).map((mm) => canonicalZ.get(gridLevelKey(mm))).filter((v) => v !== void 0))
65069
65116
  }));
65070
65117
  const hiddenZ = [...new Set(hiddenPerSheet.flatMap((h) => [...h.hidden]))].sort((a, b) => a - b);
65071
65118
  for (const mm of hiddenZ) {
@@ -65132,8 +65179,8 @@ function bootstrapGrid(v1) {
65132
65179
  }
65133
65180
  function sheetPointsLocalMm(plan, f) {
65134
65181
  const pts = [];
65135
- for (const m of arr3(plan.members).filter(isObj4)) {
65136
- for (const p of arr3(m.wp)) {
65182
+ for (const m of arr4(plan.members).filter(isObj4)) {
65183
+ for (const p of arr4(m.wp)) {
65137
65184
  const q = toLocalMm(f, p);
65138
65185
  if (q) pts.push(q);
65139
65186
  }
@@ -65144,7 +65191,7 @@ function registerSheets(v1, boot) {
65144
65191
  const issues = [];
65145
65192
  const registrations = [];
65146
65193
  if (!isObj4(v1)) return { registrations, issues };
65147
- for (const p of arr3(v1.plans).filter(isObj4)) {
65194
+ for (const p of arr4(v1.plans).filter(isObj4)) {
65148
65195
  const sheet = str3(p.sheet) ?? "";
65149
65196
  const f = boot.frames[sheet];
65150
65197
  const samples = boot.samples[sheet] ?? [];
@@ -65234,10 +65281,10 @@ function materializeMembers(v1, boot, regs) {
65234
65281
  let skipped = 0;
65235
65282
  if (!isObj4(v1)) return { members, pendingColMetadata, skipped, issues };
65236
65283
  const bySheet = new Map(regs.map((r) => [r.sheet, r]));
65237
- arr3(v1.plans).filter(isObj4).forEach((p, pi) => {
65284
+ arr4(v1.plans).filter(isObj4).forEach((p, pi) => {
65238
65285
  const sheet = str3(p.sheet) ?? "";
65239
65286
  const reg2 = bySheet.get(sheet), f = boot.frames[sheet];
65240
- const planMembers = arr3(p.members).filter(isObj4);
65287
+ const planMembers = arr4(p.members).filter(isObj4);
65241
65288
  if (!reg2?.transform || !f) {
65242
65289
  skipped += planMembers.length;
65243
65290
  return;
@@ -65246,7 +65293,7 @@ function materializeMembers(v1, boot, regs) {
65246
65293
  planMembers.forEach((m, mi) => {
65247
65294
  const path = `$.plans[${pi}].members[${mi}]`;
65248
65295
  const v1Id = str3(m.id) ?? "";
65249
- const wp = arr3(m.wp);
65296
+ const wp = arr4(m.wp);
65250
65297
  const la = toLocalMm(f, wp[0]), lb = toLocalMm(f, wp[1]);
65251
65298
  if (!la || !lb) {
65252
65299
  skipped++;
@@ -65256,7 +65303,7 @@ function materializeMembers(v1, boot, regs) {
65256
65303
  const a = applySimilarity(reg2.transform, la), b = applySimilarity(reg2.transform, lb);
65257
65304
  const col = isObj4(m.col) ? m.col : null;
65258
65305
  const role = str3(m.role);
65259
- const srcEnds = arr3(m.ends);
65306
+ const srcEnds = arr4(m.ends);
65260
65307
  const ends = [clone(srcEnds[0] ?? {}), clone(srcEnds[1] ?? {})];
65261
65308
  let fromZ, toZ;
65262
65309
  if (role === "column" && col) {
@@ -65574,22 +65621,22 @@ function enumerateDispositions(v1) {
65574
65621
  };
65575
65622
  walk2(v1, "$");
65576
65623
  walk2(isObj4(v1.prop_labels) ? v1.prop_labels : {}, "$.prop_labels");
65577
- for (const j of arr3(v1.joints).filter(isObj4)) walk2(j, "$.joints[]");
65578
- for (const v of arr3(v1.views).filter(isObj4)) {
65624
+ for (const j of arr4(v1.joints).filter(isObj4)) walk2(j, "$.joints[]");
65625
+ for (const v of arr4(v1.views).filter(isObj4)) {
65579
65626
  walk2(v, "$.views[]");
65580
65627
  walk2(v.camera, "$.views[].camera");
65581
65628
  walk2(v.objects, "$.views[].objects");
65582
65629
  walk2(v.clips, "$.views[].clips");
65583
65630
  }
65584
- for (const d of arr3(v1.detail_placements).filter(isObj4)) walk2(d, "$.detail_placements[]");
65585
- for (const p of arr3(v1.plans).filter(isObj4)) {
65631
+ for (const d of arr4(v1.detail_placements).filter(isObj4)) walk2(d, "$.detail_placements[]");
65632
+ for (const p of arr4(v1.plans).filter(isObj4)) {
65586
65633
  walk2(p, "$.plans[]");
65587
65634
  if (isObj4(p.grid)) walk2(p.grid, "$.plans[].grid");
65588
- for (const d of arr3(p.dims).filter(isObj4)) walk2(d, "$.plans[].dims[]");
65589
- for (const m of arr3(p.members).filter(isObj4)) {
65635
+ for (const d of arr4(p.dims).filter(isObj4)) walk2(d, "$.plans[].dims[]");
65636
+ for (const m of arr4(p.members).filter(isObj4)) {
65590
65637
  walk2(m, "$.plans[].members[]");
65591
65638
  if (isObj4(m.col)) walk2(m.col, "$.plans[].members[].col");
65592
- for (const e of arr3(m.ends).filter(isObj4)) walk2(e, "$.plans[].members[].ends[]");
65639
+ for (const e of arr4(m.ends).filter(isObj4)) walk2(e, "$.plans[].members[].ends[]");
65593
65640
  }
65594
65641
  }
65595
65642
  return [...counts.values()].sort((a, b) => a.path.localeCompare(b.path) || a.key.localeCompare(b.key));
@@ -65687,13 +65734,13 @@ function previewMigration(v1, ctx) {
65687
65734
  let provisionalLocators = 0;
65688
65735
  const obsBySheet = /* @__PURE__ */ new Map();
65689
65736
  const obsIds = /* @__PURE__ */ new Set();
65690
- const planByS = new Map(arr3(doc.plans).filter(isObj4).map((p) => [str3(p.sheet) ?? "", p]));
65737
+ const planByS = new Map(arr4(doc.plans).filter(isObj4).map((p) => [str3(p.sheet) ?? "", p]));
65691
65738
  for (const { rec, memberId } of contributions) {
65692
65739
  const src = isObj4(rec.raw.source) ? rec.raw.source : {};
65693
65740
  const kind = str3(src.kind);
65694
65741
  if (!kind || !KNOWN_READ_KINDS.has(kind)) legacyProvenance++;
65695
65742
  const ppf = num3(planByS.get(rec.sheet)?.pt_per_ft) ?? 0;
65696
- const wp = arr3(rec.raw.wp);
65743
+ const wp = arr4(rec.raw.wp);
65697
65744
  const sourceElementId = str3(src.elementId);
65698
65745
  if (!sourceElementId) provisionalLocators++;
65699
65746
  const source = sourceElementId ? { sourceHash: drawingHash, sheet: rec.sheet, elementId: sourceElementId } : { contractHash: docHash, sheet: rec.sheet, recordId: rec.v1Id, geometryHash: shortHash(JSON.stringify(wp)) };
@@ -65737,7 +65784,7 @@ function previewMigration(v1, ctx) {
65737
65784
  if (legacyProvenance) {
65738
65785
  issues.push({ code: "legacy-provenance-assumed", severity: "decision", message: `${legacyProvenance} record(s) carry no recognised source.kind; their observations are recorded as 'auto-read' because a steel.takeoff/v1 document is by definition reader output, but that assumption must be confirmed before commit` });
65739
65786
  }
65740
- const plans = arr3(doc.plans).filter(isObj4).map((p) => {
65787
+ const plans = arr4(doc.plans).filter(isObj4).map((p) => {
65741
65788
  const sheet = str3(p.sheet) ?? "";
65742
65789
  const out = { sheet, memberObservations: obsBySheet.get(sheet) ?? [] };
65743
65790
  if (str3(p.title)) out.title = str3(p.title);
@@ -65762,15 +65809,15 @@ function previewMigration(v1, ctx) {
65762
65809
  if (str3(p.control2_ref)) out.control2_ref = str3(p.control2_ref);
65763
65810
  return out;
65764
65811
  });
65765
- for (const p of arr3(doc.plans).filter(isObj4)) {
65812
+ for (const p of arr4(doc.plans).filter(isObj4)) {
65766
65813
  const g = isObj4(p.grid) ? p.grid : {};
65767
65814
  const sheet = str3(p.sheet) ?? "";
65768
- if (arr3(g.lines).length) issues.push({ code: "grid-lines-unmigrated", severity: "block", sheet, message: `sheet "${sheet}" carries ${arr3(g.lines).length} free grid line(s); migrating them onto the model grid is not implemented in this unit, so the contract refuses rather than losing them` });
65815
+ if (arr4(g.lines).length) issues.push({ code: "grid-lines-unmigrated", severity: "block", sheet, message: `sheet "${sheet}" carries ${arr4(g.lines).length} free grid line(s); migrating them onto the model grid is not implemented in this unit, so the contract refuses rather than losing them` });
65769
65816
  for (const k of ["ends_x", "ends_y"]) {
65770
65817
  if (isObj4(g[k]) && Object.keys(g[k]).length) issues.push({ code: "grid-ends-unmigrated", severity: "block", sheet, message: `sheet "${sheet}" carries per-axis grid extents (${k}); converting them to v2 world-mm grid.ends is not implemented in this unit` });
65771
65818
  }
65772
65819
  }
65773
- const scratch = arr3(doc.plans).filter(isObj4).reduce((n, p) => n + arr3(p.undo).length + arr3(p.redo).length, 0);
65820
+ const scratch = arr4(doc.plans).filter(isObj4).reduce((n, p) => n + arr4(p.undo).length + arr4(p.redo).length, 0);
65774
65821
  if (scratch) issues.push({ code: "scratch-history-discarded", severity: "decision", message: `${scratch} undo/redo entries are discarded: the undo snapshot shape changes with this migration (epic \xA710), so the history cannot carry` });
65775
65822
  const remap = {
65776
65823
  v: 1,
@@ -65799,7 +65846,7 @@ function previewMigration(v1, ctx) {
65799
65846
  const labelsOut = remapPropLabels(doc, refCtx);
65800
65847
  const dims3dOut = remapDims3d(doc);
65801
65848
  issues.push(...jointsOut.issues, ...placementsOut.issues, ...viewsOut.issues, ...labelsOut.issues, ...dims3dOut.issues);
65802
- arr3(doc.plans).filter(isObj4).forEach((p, i) => {
65849
+ arr4(doc.plans).filter(isObj4).forEach((p, i) => {
65803
65850
  const r = remapPlanDims(p, refCtx);
65804
65851
  issues.push(...r.issues);
65805
65852
  if (r.dims.length && plans[i]) plans[i].dims = r.dims;
@@ -65855,7 +65902,7 @@ function previewMigration(v1, ctx) {
65855
65902
  fields,
65856
65903
  unmapped,
65857
65904
  counts: {
65858
- v1Records: arr3(doc.plans).filter(isObj4).reduce((n, p) => n + arr3(p.members).length, 0),
65905
+ v1Records: arr4(doc.plans).filter(isObj4).reduce((n, p) => n + arr4(p.members).length, 0),
65859
65906
  materialized: mat.members.length,
65860
65907
  skipped: mat.skipped,
65861
65908
  canonicalMembers: members.length,
@@ -66306,8 +66353,8 @@ function indexJoints(contract, lib, mapRef) {
66306
66353
  const secondaries = mapRef ? [...new Set(raw.filter(Boolean).map(mapRef))].sort() : raw.sort();
66307
66354
  const sig = `${str4(j?.kind)}@${str4(j?.at)}:${connIdentity(j, lib)}:${stable(j?.params)}:${stable(secondaries)}:${stable(j?.place)}`;
66308
66355
  for (const ref of [str4(j?.main), ...asArray(j?.secondaries).map(str4)].filter(Boolean)) {
66309
- const arr4 = idx.get(ref);
66310
- if (arr4) arr4.push(sig);
66356
+ const arr5 = idx.get(ref);
66357
+ if (arr5) arr5.push(sig);
66311
66358
  else idx.set(ref, [sig]);
66312
66359
  }
66313
66360
  }
@@ -73557,8 +73604,8 @@ function parseProcessList(json2) {
73557
73604
  } catch {
73558
73605
  return [];
73559
73606
  }
73560
- const arr4 = Array.isArray(parsed) ? parsed : [parsed];
73561
- return arr4.filter((p) => p && p.ProcessId != null).map((p) => ({ pid: Number(p.ProcessId), cmd: String(p.CommandLine ?? "") }));
73607
+ const arr5 = Array.isArray(parsed) ? parsed : [parsed];
73608
+ return arr5.filter((p) => p && p.ProcessId != null).map((p) => ({ pid: Number(p.ProcessId), cmd: String(p.CommandLine ?? "") }));
73562
73609
  }
73563
73610
  function enumerateProcesses() {
73564
73611
  if (!isWin2) return [];
@@ -3466,8 +3466,11 @@
3466
3466
  'member-added': 'k-added', 'member-removed': 'k-removed', 'member-changed': 'k-changed',
3467
3467
  'plan-added': 'k-added', 'plan-changed': 'k-changed',
3468
3468
  };
3469
- /** The 2–3 headline fields worth showing for an added member — not the whole record. */
3469
+ /** The 2–3 headline fields worth showing for a member — not the whole record. */
3470
3470
  const MEMBER_HEADLINE = ['profile', 'role', 'material'];
3471
+ /** Shared by `member-added` and `member-removed`, so the two member rows cannot drift apart. */
3472
+ const memberHeadline = (m) =>
3473
+ MEMBER_HEADLINE.map((k) => m[k]).filter((v) => v != null && v !== '').map(shortVal).join(' · ');
3471
3474
 
3472
3475
  function proposalRow(p, idx, bucket) {
3473
3476
  const row = revEl('div', 'rev-row ' + (KIND_CLASS[p.kind] || 'k-changed'));
@@ -3485,22 +3488,83 @@
3485
3488
  head.appendChild(title);
3486
3489
  main.appendChild(head);
3487
3490
 
3491
+ // WHAT THIS ROW SAYS BEYOND ITS ID — collected rather than appended straight to `main`, so the
3492
+ // checkbox can be wired to it with `aria-describedby` below. Without that wiring a sighted reader
3493
+ // decides with the profile, the role and the sheets while a screen-reader user gets an id: the
3494
+ // same "most consequential row, least to judge by" defect this change exists to fix, for fewer
3495
+ // people. (The kind BADGE is still outside every row's accessible name — pre-existing, uniform
3496
+ // across all four kinds, and deliberately left to one follow-up rather than patched asymmetrically
3497
+ // here.)
3498
+ const desc = [];
3488
3499
  if (p.kind === 'member-changed' || p.kind === 'plan-changed') {
3489
3500
  const fields = revEl('div', 'rev-fields');
3490
3501
  for (const f of p.fields || []) fields.appendChild(fieldLine(f.key, f.before, f.after));
3491
- main.appendChild(fields);
3502
+ desc.push(fields);
3492
3503
  } else if (p.kind === 'member-added' && p.member) {
3493
- const sub = MEMBER_HEADLINE.map((k) => p.member[k]).filter((v) => v != null && v !== '').map(shortVal).join(' · ');
3494
- if (sub) main.appendChild(revEl('div', 'rev-row-sub', sub));
3504
+ const sub = memberHeadline(p.member);
3505
+ if (sub) desc.push(revEl('div', 'rev-row-sub', sub));
3506
+ } else if (p.kind === 'member-removed') {
3507
+ // WHAT is being deleted, then WHERE it is on record — two lines, not one dot-run. " · " already
3508
+ // means "peer scalar attributes of one subject" in the line above; a clause with its own verb is
3509
+ // not a fourth attribute, and splicing it in would blur a grammar this modal already has.
3510
+ if (p.member) {
3511
+ const sub = memberHeadline(p.member);
3512
+ if (sub) desc.push(revEl('div', 'rev-row-sub', sub));
3513
+ } else if (p.matches > 1) {
3514
+ // Only the COUNT is emphasised, reusing the one idiom this modal already has for exactly that
3515
+ // (the counts line above wraps its two figures in a bare <b> inside muted prose). No colour,
3516
+ // icon or background: the row is already `k-removed`, which carries the strongest token in the
3517
+ // set, and alarming chrome on a decision the user must still make invites a reflexive no.
3518
+ const note = revEl('div', 'rev-row-note');
3519
+ note.appendChild(revEl('b', null, String(p.matches)));
3520
+ note.appendChild(document.createTextNode(' members in the model share this id, and accepting this removes every one of them.'));
3521
+ desc.push(note);
3522
+ } else if (p.matches === 0) {
3523
+ // NOT "accepting this removes nothing", which is what it looks like and is false:
3524
+ // `applyStagedRevision` REFUSES a removal whose target is absent, and confirm answers 400 for
3525
+ // the WHOLE selection. And not an instruction either — the first version said "close and
3526
+ // reopen the review", which review showed is a ritual that cannot help: this state needs the
3527
+ // facts and the proposals to have come from different documents, so reopening recomputes the
3528
+ // same row. A statement of what is true, and what it means for this checkbox.
3529
+ desc.push(revEl('div', 'rev-row-note', 'This id is not in the model this review was computed against, so this row cannot be applied.'));
3530
+ }
3531
+ // INDEPENDENT of `matches`, because the sheets are looked up from the ID and not from the
3532
+ // resolved record: they stay true when it is missing, and when it is ambiguous.
3533
+ if (!(p.sheets || []).length && p.matches > 0) {
3534
+ // THE ONE FIELD THAT WOULD OTHERWISE DEGRADE IN SILENCE, which review caught: an unreadable
3535
+ // `memberRefs` yields `sheets: []`, the line below simply does not render, and the row looks
3536
+ // like an ordinary confident removal that happens to be referenced nowhere. Those are opposite
3537
+ // conclusions — "referenced nowhere" argues FOR deleting, "we could not read where it is
3538
+ // referenced" argues against — and a screen whose whole job is informed consent must not let
3539
+ // them render identically.
3540
+ //
3541
+ // Safe to say outright because the empty case is IMPOSSIBLE for a sound document:
3542
+ // `checkModelReferences` raises `member-unpresented` unless a member has an active observation
3543
+ // or a `memberRefs` entry, which is exactly the union the server computes here.
3544
+ desc.push(revEl('div', 'rev-row-note', 'This model does not record where this member appears — it may be referenced on sheets this review cannot list.'));
3545
+ }
3546
+ if ((p.sheets || []).length) {
3547
+ // "Referenced", never "shown" — span containment is deliberately not in this list, so a column
3548
+ // can appear on sheets that never name it. Any verb implying "you would SEE it there" would be
3549
+ // false; one implying "it is on record here" is not. The tooltip carries the full caveat so the
3550
+ // visible line does not have to.
3551
+ const on = revEl('div', 'rev-row-sub', `Referenced on ${shortVal(p.sheets)}`);
3552
+ on.setAttribute('data-tip', 'Sheets that list this member or supply its evidence. A column can also appear on other sheets whose level its span crosses.');
3553
+ desc.push(on);
3554
+ }
3495
3555
  } else if (p.kind === 'plan-added') {
3496
3556
  const keys = Object.keys(p.plan || {}).filter((k) => k !== 'sheet');
3497
- main.appendChild(revEl('div', 'rev-row-sub', keys.length ? `${keys.length} field${keys.length > 1 ? 's' : ''}: ${keys.slice(0, 6).map(prettyKey).join(', ')}${keys.length > 6 ? '…' : ''}` : 'a new sheet'));
3557
+ desc.push(revEl('div', 'rev-row-sub', keys.length ? `${keys.length} field${keys.length > 1 ? 's' : ''}: ${keys.slice(0, 6).map(prettyKey).join(', ')}${keys.length > 6 ? '…' : ''}` : 'a new sheet'));
3498
3558
  // The omission is NAMED. A reviewer who cannot see the page image should be told it comes with
3499
3559
  // the sheet, rather than left to read the field list as complete.
3500
3560
  if ((p.omitted || []).length) {
3501
- main.appendChild(revEl('div', 'rev-row-note', `The page image and traced linework come with this sheet (${p.omitted.map(prettyKey).join(', ')}).`));
3561
+ desc.push(revEl('div', 'rev-row-note', `The page image and traced linework come with this sheet (${p.omitted.map(prettyKey).join(', ')}).`));
3502
3562
  }
3503
3563
  }
3564
+ if (desc.length) {
3565
+ desc.forEach((n, i) => { n.id = `${id}-desc-${i}`; main.appendChild(n); });
3566
+ box.setAttribute('aria-describedby', desc.map((n) => n.id).join(' '));
3567
+ }
3504
3568
  row.appendChild(label);
3505
3569
  row.appendChild(main);
3506
3570
  return row;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@floless/app",
3
- "version": "0.111.1",
3
+ "version": "0.111.2",
4
4
  "type": "module",
5
5
  "description": "Thin localhost host for floless.app \u00e2\u20ac\u201d serves web/ and shells the aware CLI. No engine, no LLM.",
6
6
  "bin": {