@floless/app 0.169.0 → 0.170.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.
Files changed (59) hide show
  1. package/dist/floless-server.cjs +71580 -59849
  2. package/dist/schemas/drawing-check.profile.v1.schema.json +12 -2
  3. package/dist/schemas/steel.model.v2.schema.json +2 -1
  4. package/dist/skills/floless-app-knowledge/SKILL.md +43 -13
  5. package/dist/skills/floless-app-new-workflow/SKILL.md +8 -1
  6. package/dist/skills/floless-app-routines/SKILL.md +2 -2
  7. package/dist/skills/floless-app-routines/references/routines-api.md +20 -8
  8. package/dist/skills/floless-app-steel-model/SKILL.md +8 -5
  9. package/dist/skills/floless-app-steel-takeoff/SKILL.md +31 -1
  10. package/dist/skills/floless-app-workflows/SKILL.md +22 -3
  11. package/dist/skills/floless-app-workflows/references/agent-steps.md +40 -6
  12. package/dist/skills/floless-app-workflows/references/exec-contract.md +27 -0
  13. package/dist/skills/floless-app-workflows/references/script-runner.md +105 -0
  14. package/dist/web/agent-steps.js +89 -18
  15. package/dist/web/agents.js +32 -22
  16. package/dist/web/app.css +223 -1
  17. package/dist/web/app.js +24 -3
  18. package/dist/web/aware.js +877 -189
  19. package/dist/web/chat.js +184 -95
  20. package/dist/web/checkpoint-standard.js +5 -3
  21. package/dist/web/commands-drawing-check.js +1 -0
  22. package/dist/web/commands-shell.js +440 -11
  23. package/dist/web/commands-steel.js +60 -1
  24. package/dist/web/drawing-check-editor.js +352 -88
  25. package/dist/web/failure-copy.js +32 -2
  26. package/dist/web/filter-ai-proposal.js +11 -8
  27. package/dist/web/flo-3d.js +1 -1
  28. package/dist/web/guide.js +33 -26
  29. package/dist/web/index.html +69 -1
  30. package/dist/web/instructor.js +99 -15
  31. package/dist/web/left-pane.js +4 -1
  32. package/dist/web/local-discovery.js +8 -7
  33. package/dist/web/missed-routines.js +239 -0
  34. package/dist/web/model-measure.js +6 -0
  35. package/dist/web/model-spatial-panel.js +19 -4
  36. package/dist/web/model-spatial-tools.js +3 -3
  37. package/dist/web/model-viewport-revit-adapter.js +3 -3
  38. package/dist/web/origin-rule.js +155 -0
  39. package/dist/web/project-access.js +1 -1
  40. package/dist/web/project-modules.js +2 -2
  41. package/dist/web/project-rfis.js +6 -1
  42. package/dist/web/project-workflows.js +2 -2
  43. package/dist/web/revit-editor.js +22 -8
  44. package/dist/web/run-history.js +12 -1
  45. package/dist/web/steel-3d-core.js +39 -9
  46. package/dist/web/steel-3d-flo.js +26 -4
  47. package/dist/web/steel-3d-view.js +8 -3
  48. package/dist/web/steel-ai-marks.js +3 -1
  49. package/dist/web/steel-editor.html +455 -122
  50. package/dist/web/steel-environments.js +297 -0
  51. package/dist/web/steel-filter.html +3 -2
  52. package/dist/web/steel-model-v2-client-validation.js +8 -1
  53. package/dist/web/steel-model-v2-commands.js +23 -9
  54. package/dist/web/steel-model-v2-projection.js +1 -1
  55. package/dist/web/step-rename.js +3 -2
  56. package/dist/web/terminal-requests.js +1 -1
  57. package/dist/web/tool-updates.js +7 -6
  58. package/dist/web/workspaces.js +1714 -119
  59. package/package.json +4 -1
@@ -0,0 +1,297 @@
1
+ /*
2
+ * steel-environments.js — the ONE registry of steel-environment TRAITS.
3
+ *
4
+ * A steel environment is the standard a project is built to: which section catalogue its designations
5
+ * resolve against, which units it speaks, which grade it defaults to, which scale grammar its sheets
6
+ * print. Before this file the answer to each of those questions was an id comparison scattered over
7
+ * ~40 sites (`environment === 'UK'`, `!== 'US'`), and every one of them was a two-arm switch: anything
8
+ * that was not the named id fell into the other arm. That is a binary, not a vocabulary, and a third
9
+ * environment had nowhere to stand — it would silently resolve against whichever arm its spelling
10
+ * happened to miss (EU epic #3197, §2.1 and §6).
11
+ *
12
+ * THE RULE THIS FILE EXISTS TO ENFORCE: a site that needs to know something about an environment reads
13
+ * a TRAIT from here. It never compares an id. `npm run verify:no-environment-id-compare` ratchets that
14
+ * (shrink-only), and the per-site tests in `server/steel-environment-traits.test.ts` are the proof; the
15
+ * guard is only the backstop.
16
+ *
17
+ * SHARED BY SERVER AND BROWSER. `server/*.ts` imports it by the established `../web/*.js` pattern, and
18
+ * the pages load it as a module. It therefore imports nothing but the unit constants' leaf module and
19
+ * touches no DOM, no `window`, no `process`.
20
+ *
21
+ * A `Map`, for the reason `checkpoint-standard.js` states about its label table: a plain object indexed
22
+ * by an untrusted value is two holes (`{UK:…}[['UK']]` resolves through array-to-string coercion, and
23
+ * `{…}['constructor']` returns a function). `Map.get` compares by identity and has no prototype chain.
24
+ *
25
+ * ONE OWNER PER FACT. Rows, payloads, aliases, resolution notes and suspect reasons belong to the
26
+ * server's `CatalogProvider`. What lives here is what BOTH sides need before any payload exists — most
27
+ * visibly the shapes route path, because the editor's first fetch happens before it holds a contract's
28
+ * catalogue. `CatalogProvider.shapesPath` READS it from here, so the path is one literal with two
29
+ * readers.
30
+ *
31
+ * TWO LOOKUPS, deliberately, because an absent environment and an unknown one are different facts:
32
+ * - `traitsOf(id)` strict. `undefined` for anything not registered. Use it where "was a standard
33
+ * STATED, and do we know it" is the question (scale grammar, the chip's sentence).
34
+ * - `traitsFor(id)` total. An unstated or unregistered id resolves as the compatibility fallback
35
+ * (US), exactly as `normalizeEnvironment` does on the server. Use it where a
36
+ * behaviour must be chosen anyway. The fallback is a MACHINE meaning, never a claim
37
+ * that US is the normal case (see `server/steel-environment.ts`).
38
+ */
39
+
40
+ import { FT_TO_MM, IN_TO_MM } from './steel-units.js';
41
+
42
+ /**
43
+ * How far BELOW a plan's cut level a column may end and still be drawn as "column below": one foot for
44
+ * an imperial standard, a round 300 mm for a metric one (owner ruling, Pawel, 2026-10-23 — a UK
45
+ * detailer read "Columns ending up to 304.8 mm under this level" off an artefact of a converted foot).
46
+ * Keyed on the ENVIRONMENT and not the display units: the view toggle flips at any time and the server
47
+ * decides what a sheet draws with no display preference at all.
48
+ */
49
+ export const COLUMN_BELOW_REACH_MM_IMPERIAL = FT_TO_MM;
50
+ export const COLUMN_BELOW_REACH_MM_METRIC = 300;
51
+
52
+ /** How far ABOVE the cut a column's base may sit and still be drawn (#2815): 2 in, or a round 50 mm. */
53
+ export const COLUMN_NEAR_CUT_MM_IMPERIAL = 2 * IN_TO_MM;
54
+ export const COLUMN_NEAR_CUT_MM_METRIC = 50;
55
+
56
+ /**
57
+ * Every environment this build can resolve. A tuple (not derived from the Map) so TypeScript sees the
58
+ * literal union `'US' | 'UK' | 'EU'`; `steel-environments` tests assert it equals the Map's keys, so adding an
59
+ * entry to one and not the other fails.
60
+ *
61
+ * @type {readonly ['US', 'UK', 'EU']}
62
+ */
63
+ export const STEEL_ENVIRONMENT_IDS = Object.freeze(['US', 'UK', 'EU']);
64
+
65
+ /**
66
+ * @typedef {object} DefaultGradeTraits
67
+ * @property {string} rolled the grade of an open (rolled) section
68
+ * @property {string} hollow the grade of a hollow section
69
+ * @property {ReadonlyArray<readonly [string, string]>} rolledByName [name pattern source, grade] — a
70
+ * rolled family with its own default (the US wide flange), checked after the hollow test
71
+ * @property {string} hollowNamePattern how a hollow section reads BY NAME — the fallback for a
72
+ * designation that resolved to no catalogue row
73
+ * @property {readonly string[] | null} hollowRowShapes a resolved row is hollow when its `sectionShape` is one of these
74
+ * @property {readonly string[] | null} hollowRowFamilies …or when its `family` is one of these
75
+ */
76
+
77
+ /**
78
+ * @typedef {object} SteelEnvironmentTraits
79
+ * @property {'US'|'UK'|'EU'} id
80
+ * @property {string} label how the standard names itself to a person ("US · AISC/ASTM")
81
+ * @property {string} subLabel the project-setup button's second line
82
+ * @property {'imperial'|'metric'} unitSystem
83
+ * @property {'ft-in'|'mm'} defaultDisplayUnits what the environment implies where an owner never chose
84
+ * @property {string} shapesPath the route serving this environment's catalogue to the browser
85
+ * @property {string} catalogueNoun what to CALL the section table when telling a person a designation is not in it
86
+ * @property {'metric'|'imperial'} scaleGrammar which drawing-scale grammar a sheet of this standard prints
87
+ * @property {number} columnBelowReachMm
88
+ * @property {number} columnNearCutMm
89
+ * @property {'in'|'mm'} designationTokenUnit the unit a designation's size tokens are written in — a double angle (the one shape no catalogue tabulates) is parsed from its name in every environment, and this is the unit of those tokens
90
+ * @property {boolean} aiscInchTable whether designations resolve through the legacy AISC INCHES table and its token heuristics (the US catalogue); false means the provider's own catalogue answers every shape
91
+ * @property {boolean} exportPrimarySpelling whether a host export sends the catalogue's PRIMARY spelling of a section (the host refuses the folded spelling) rather than the canonical folded one
92
+ * @property {DefaultGradeTraits} defaultGrade
93
+ * @property {string | null} foreignSectionPattern source of a case-insensitive pattern naming designations that are correctly spelled in ANOTHER environment's catalogue — the RFI reason uses it to say "not a typo, a different catalogue". null when this environment declares none
94
+ * @property {string} foreignSectionNoun what to CALL a designation that is correctly spelled in another environment's catalogue, in that RFI reason ("European/British section")
95
+ * @property {string} shapesHeldNote what this catalogue holds, for that RFI reason
96
+ * @property {string} chipTip the editor header chip's sentence for a project that states this standard
97
+ * @property {string} detailerAgent the AWARE detailing agent installed for a project of this standard
98
+ */
99
+
100
+ const US = {
101
+ id: 'US',
102
+ label: 'US · AISC/ASTM',
103
+ subLabel: 'AISC sections · A992 / A36',
104
+ unitSystem: 'imperial',
105
+ defaultDisplayUnits: 'ft-in',
106
+ shapesPath: '/api/aisc-shapes',
107
+ catalogueNoun: 'AISC',
108
+ scaleGrammar: 'imperial',
109
+ columnBelowReachMm: COLUMN_BELOW_REACH_MM_IMPERIAL,
110
+ columnNearCutMm: COLUMN_NEAR_CUT_MM_IMPERIAL,
111
+ designationTokenUnit: 'in',
112
+ aiscInchTable: true,
113
+ exportPrimarySpelling: false,
114
+ defaultGrade: {
115
+ rolled: 'A36',
116
+ hollow: 'A500-GR.B',
117
+ rolledByName: [['^W\\d', 'A992']],
118
+ hollowNamePattern: '^HSS',
119
+ // The US HSS family only. A `Pipe` row is also round, and its default has always been A36: deciding
120
+ // by SHAPE here would have moved 102 pipe rows to A500-GR.B and changed shipped US output.
121
+ hollowRowShapes: null,
122
+ hollowRowFamilies: ['HSS'],
123
+ },
124
+ foreignSectionPattern: '^(IPE|HE[ABM]?|UB|UC|UKB|UKC|UKA|PFC|UPN|UPE)\\s*\\d',
125
+ foreignSectionNoun: 'European/British section',
126
+ shapesHeldNote: 'AISC (US) shapes only',
127
+ chipTip: 'This model resolves every section against the US catalogue (AISC sections, A992/A36 default grade). Chosen when the project was created and fixed for its life.',
128
+ detailerAgent: 'steel-detailer-us',
129
+ };
130
+
131
+ const UK = {
132
+ id: 'UK',
133
+ label: 'UK · BS/EN',
134
+ subLabel: 'BS EN sections · S355',
135
+ unitSystem: 'metric',
136
+ defaultDisplayUnits: 'mm',
137
+ shapesPath: '/api/uk-shapes',
138
+ catalogueNoun: 'UK section',
139
+ scaleGrammar: 'metric',
140
+ columnBelowReachMm: COLUMN_BELOW_REACH_MM_METRIC,
141
+ columnNearCutMm: COLUMN_NEAR_CUT_MM_METRIC,
142
+ designationTokenUnit: 'mm',
143
+ aiscInchTable: false,
144
+ exportPrimarySpelling: true,
145
+ defaultGrade: {
146
+ rolled: 'S355',
147
+ hollow: 'S355J2H',
148
+ rolledByName: [],
149
+ hollowNamePattern: '^(CHS|SHS|RHS|EHS)',
150
+ // Decided by the catalogue ROW's `sectionShape`, with the name pattern as the fallback for a designation
151
+ // that resolved to no row. EU-0b (#3199) flipped this from name-only: 839 of the 5,963 UK designations
152
+ // and aliases are hollow sections spelled with the family as a SUFFIX (`450X150X16.0 RHS`), which the
153
+ // prefix pattern misses, so a UK member written that way got S355 where S355J2H is right.
154
+ hollowRowShapes: ['rhs', 'chs', 'ehs'],
155
+ hollowRowFamilies: null,
156
+ },
157
+ // The UK catalogue resolves BS and European names alike, so there is no family it would call foreign.
158
+ foreignSectionPattern: null,
159
+ foreignSectionNoun: 'section from another standard',
160
+ shapesHeldNote: 'UK sections only',
161
+ chipTip: 'This model resolves every section against the UK catalogue (BS EN sections, S355 default grade). Chosen when the project was created and fixed for its life.',
162
+ detailerAgent: 'steel-detailer-uk',
163
+ };
164
+
165
+ const EU = {
166
+ id: 'EU',
167
+ label: 'EU · EN',
168
+ subLabel: 'EN sections · S355',
169
+ unitSystem: 'metric',
170
+ defaultDisplayUnits: 'mm',
171
+ shapesPath: '/api/eu-shapes',
172
+ catalogueNoun: 'EU section',
173
+ scaleGrammar: 'metric',
174
+ columnBelowReachMm: COLUMN_BELOW_REACH_MM_METRIC,
175
+ columnNearCutMm: COLUMN_NEAR_CUT_MM_METRIC,
176
+ designationTokenUnit: 'mm',
177
+ aiscInchTable: false,
178
+ // The catalogue's PRIMARY spelling (`KK200/100/5`) is the name a host export sends. Whether Tekla accepts
179
+ // it needs a Tekla EU/NL environment this repo's machines lack, so the host bake is unverified (#3204).
180
+ exportPrimarySpelling: true,
181
+ defaultGrade: {
182
+ rolled: 'S355',
183
+ hollow: 'S355J2H',
184
+ rolledByName: [],
185
+ // A European hollow section is named `KK…` / `KW…` / `N…`, which no `RHS|SHS|CHS` test would catch, so
186
+ // the catalogue ROW decides (its shape). The pattern is the fallback for a designation the catalogue
187
+ // does not hold at all (`RHS160*100*4`, which the importer leaves unresolved on purpose).
188
+ hollowNamePattern: '^(CHS|SHS|RHS|EHS|KK\\d|KW\\d|N\\d)',
189
+ hollowRowShapes: ['rhs', 'chs', 'ehs'],
190
+ hollowRowFamilies: null,
191
+ },
192
+ // American and British names are correctly spelled in THEIR catalogues, not typos here.
193
+ foreignSectionPattern: '^((W|WWF|WRF|HP|HSS|WT|MT|ST|M|S|MC|C|PIPE)\\d|(UB|UC|UKB|UKBP|UKC|UKA|UKT|UKPFC|PFC|RSJ|RSA|RSC|JUMBO|TEE)\\s*-?\\d)',
194
+ foreignSectionNoun: 'American or British section',
195
+ shapesHeldNote: 'EU sections only',
196
+ chipTip: 'This model resolves every section against the EU catalogue (EN sections, S355 default grade). Chosen when the project was created and fixed for its life.',
197
+ detailerAgent: 'steel-detailer-eu',
198
+ };
199
+
200
+ /** @type {Readonly<Record<'US'|'UK'|'EU', Readonly<SteelEnvironmentTraits>>>} */
201
+ const BY_ID = { US: Object.freeze(US), UK: Object.freeze(UK), EU: Object.freeze(EU) };
202
+
203
+ /** @type {ReadonlyMap<string, Readonly<SteelEnvironmentTraits>>} */
204
+ export const STEEL_ENVIRONMENT_TRAITS = new Map(STEEL_ENVIRONMENT_IDS.map((id) => [id, BY_ID[id]]));
205
+
206
+ /**
207
+ * The environment an UNSTATED (or unregistered) one resolves as. A compatibility default so projects
208
+ * and contracts written before the field existed keep their behaviour — never a claim that US is the
209
+ * standard case. `server/steel-environment.ts` re-exports it.
210
+ *
211
+ * @type {'US'}
212
+ */
213
+ export const FALLBACK_ENVIRONMENT_ID = 'US';
214
+
215
+ /**
216
+ * Strict: the traits of a REGISTERED environment, else `undefined` (absent, unknown, or not a string).
217
+ *
218
+ * @param {unknown} id
219
+ * @returns {Readonly<SteelEnvironmentTraits> | undefined}
220
+ */
221
+ export function traitsOf(id) {
222
+ return STEEL_ENVIRONMENT_TRAITS.get(/** @type {string} */ (id));
223
+ }
224
+
225
+ /**
226
+ * Total: an unstated or unregistered id resolves as the compatibility fallback.
227
+ *
228
+ * @param {unknown} id
229
+ * @returns {Readonly<SteelEnvironmentTraits>}
230
+ */
231
+ export function traitsFor(id) {
232
+ return /** @type {Readonly<SteelEnvironmentTraits>} */ (
233
+ traitsOf(id) ?? STEEL_ENVIRONMENT_TRAITS.get(FALLBACK_ENVIRONMENT_ID));
234
+ }
235
+
236
+ /**
237
+ * The default material grade for a section — the SAME mechanism in every environment (a default per
238
+ * section family), with each environment's own grades.
239
+ *
240
+ * HOLLOW is decided by the catalogue ROW when one resolved (its `sectionShape` or `family`, per the
241
+ * environment's declaration), never by a name regex alone: a European hollow section is named `KK…` or
242
+ * `N…`, which no `RHS|SHS|CHS` pattern would catch. A designation that resolved to no row falls back to
243
+ * the environment's name pattern — the grade of a section the catalogue does not hold is still a
244
+ * labelled default, not a refusal.
245
+ *
246
+ * @param {unknown} id the project's stated environment (absent resolves as the fallback)
247
+ * @param {string} canonicalName the designation, already folded by `canonicalDesignation`
248
+ * @param {{ sectionShape?: string, family?: string } | null | undefined} row the catalogue row, when one resolved
249
+ * @returns {string}
250
+ */
251
+ export function defaultGradeFor(id, canonicalName, row) {
252
+ return gradeFromTraits(traitsFor(id).defaultGrade, canonicalName, row);
253
+ }
254
+
255
+ /**
256
+ * The mechanism behind `defaultGradeFor`, over an explicit declaration — so a rule no registered environment uses yet is still exercised.
257
+ *
258
+ * @param {DefaultGradeTraits} g
259
+ * @param {string} canonicalName
260
+ * @param {{ sectionShape?: string, family?: string } | null | undefined} row
261
+ * @returns {string}
262
+ */
263
+ export function gradeFromTraits(g, canonicalName, row) {
264
+ let hollow;
265
+ if (row && (g.hollowRowShapes || g.hollowRowFamilies)) {
266
+ hollow = (g.hollowRowShapes ? g.hollowRowShapes.includes(row.sectionShape) : false)
267
+ || (g.hollowRowFamilies ? g.hollowRowFamilies.includes(row.family) : false);
268
+ } else {
269
+ hollow = compiled(g.hollowNamePattern, '').test(canonicalName);
270
+ }
271
+ if (hollow) return g.hollow;
272
+ for (const [pattern, grade] of g.rolledByName) if (compiled(pattern, '').test(canonicalName)) return grade;
273
+ return g.rolled;
274
+ }
275
+
276
+ /** A pattern compiled once per source/flags: the scene bake asks per member, and none of these carry state (no `g`/`y` flag). */
277
+ const PATTERNS = new Map();
278
+ function compiled(source, flags) {
279
+ const key = `${flags}/${source}`;
280
+ let re = PATTERNS.get(key);
281
+ if (!re) { re = new RegExp(source, flags); PATTERNS.set(key, re); }
282
+ return re;
283
+ }
284
+
285
+ /**
286
+ * Whether a designation that THIS environment's catalogue has no row for is spelled like a section
287
+ * another environment's catalogue carries — "European/British section, correctly spelled, simply not
288
+ * in a US catalogue". The caller establishes the first half (no row); this answers the second.
289
+ *
290
+ * @param {unknown} id
291
+ * @param {unknown} designation
292
+ * @returns {boolean}
293
+ */
294
+ export function looksLikeForeignSection(id, designation) {
295
+ const pattern = traitsFor(id).foreignSectionPattern;
296
+ return pattern !== null && compiled(pattern, 'i').test(String(designation ?? '').trim());
297
+ }
@@ -1126,7 +1126,8 @@ function filterAiApplyCheck(record, proposal){
1126
1126
  return { ok:false, message:'This suggestion is out of date. Ask again to get a current one.' };
1127
1127
  let parsed;
1128
1128
  try { parsed = parseFilterAiProposal(JSON.stringify(proposal), F, record.allowed); }
1129
- catch(error) { return { ok:false, message:error instanceof Error ? error.message : 'This suggestion cannot be used with this filter. Ask again.' }; }
1129
+ // #3097: only the parser's own refusal is said; anything else that threw is logged and gets the plain sentence.
1130
+ catch(error) { if(!error?.forPerson) console.warn('steel-filter: the AI suggestion could not be read', error); return { ok:false, message:error?.forPerson ? error.message : 'This suggestion cannot be used with this filter. Ask again.' }; }
1130
1131
  if(filterAiTouchesUnreadLayer(parsed,F))
1131
1132
  return { ok:false, message:'This suggestion includes a layer FloLess did not read. Nothing was applied. Ask your terminal AI to inspect that source layer if it holds steel.' };
1132
1133
  // A suggestion is a three-way merge: leave every user edit made during the AI request alone.
@@ -1477,7 +1478,7 @@ function renderStandardStat(){
1477
1478
  note.className = 'sr-only';
1478
1479
  note.textContent = ' ' + line.note;
1479
1480
  el.append(note);
1480
- // A document that STATES an environment this build cannot resolve ('EU' today) lands in the same
1481
+ // A document that STATES an environment this build cannot resolve (a word the trait registry does not know) lands in the same
1481
1482
  // arm as one that states nothing. The sentence is deliberately written to be true of both, but the
1482
1483
  // two are different facts and only one of them is a data problem -- so it leaves a trace here rather
1483
1484
  // than being indistinguishable forever.
@@ -20,6 +20,13 @@ export const POSITION_BASIS_CLIENT_VALIDATION_VERSION=POSITION_BASIS_CAPABILITY_
20
20
  const rows = (v) => Array.isArray(v) ? v : [];
21
21
  const object = (v) => v && typeof v === 'object' && !Array.isArray(v);
22
22
 
23
+ /**
24
+ * How far a column's base may sit above its top and still count as level (#3208). Elevations read from a drawing carry
25
+ * float noise: on Adnoc two level beams were stored 5e-13 mm top-first, so retyping them to Column was refused as
26
+ * "top below bottom". The server's rule (`server/steel-model-v2.ts`) uses the same value; a test pins the two together.
27
+ */
28
+ export const COLUMN_LEVEL_TOLERANCE_MM = 0.001;
29
+
23
30
  /**
24
31
  * True when a refused command's validation issues are the column base→top rule and NOTHING else — the one
25
32
  * refusal the steel editor words for people instead of "would leave steel.model/v2 invalid" (#1933). When
@@ -160,7 +167,7 @@ export function validateClientSteelModelV2(doc, schema) {
160
167
  if (problem) issues.push(`${problem} at $.members[${i}].positionBasis`);
161
168
  }
162
169
  if (member?.role === 'column' && Number.isFinite(member.from?.z?.known)
163
- && Number.isFinite(member.to?.z?.known) && member.from.z.known > member.to.z.known) {
170
+ && Number.isFinite(member.to?.z?.known) && member.from.z.known - member.to.z.known > COLUMN_LEVEL_TOLERANCE_MM) {
164
171
  issues.push(`column-endpoint-order at $.members[${i}]`);
165
172
  }
166
173
  for (const end of rows(member?.ends)) if (end?.conn && !rows(doc.connections).some((c) => c?.id === end.conn)) {
@@ -15,6 +15,7 @@ import { sheetPxToWorld, worldToSheetPx } from './steel-plan-transform.js';
15
15
  import { memberPresence, projectionLink } from './steel-model-v2-projection.js';
16
16
  import { gridLabelPatch, parseSpacings } from './grid-core.js';
17
17
  import { IN_TO_MM as IN_MM } from './steel-units.js';
18
+ import { defaultGradeFor } from './steel-environments.js';
18
19
  import {
19
20
  basisFromAxes, endpointPlacementCompensation, effectiveDepthPosition, effectiveWidthPosition, outlineFor, partFrame,
20
21
  positionOffsetVector, reversePlacement, sectionExtents,
@@ -687,7 +688,12 @@ const vunit = (a) => { const n = vlen(a); return n > 0 ? a.map((v) => v / n) : n
687
688
  const vdist = (a, b) => vlen(vsub(a, b));
688
689
  const lex3 = (a, b) => a[0] - b[0] || a[1] - b[1] || a[2] - b[2];
689
690
  const canonProfile = (s) => String(s || '').trim().toUpperCase().replace(/×/g, 'X').replace(/\s*X\s*/g, 'X').replace(/^([A-Z]+)\s+/, '$1');
690
- const inferredMaterial = (profile) => profile.startsWith('HSS') ? 'A500-GR.B' : /^W\d/.test(profile) ? 'A992' : 'A36';
691
+ // The grade a member carries when it states none. A merge compares its sources by EFFECTIVE grade, so this
692
+ // has to be the SAME default the editor shows and the BOM prices: the environment's, hollow decided by the
693
+ // catalogue row (`profileDefaultMaterial` in the page). It used to be the US rule alone, which gave every
694
+ // UK member A36 here while the rest of the product said S355 (EU epic #3197, EU-0b #3199). A session built
695
+ // with no resolver keeps the US default - the compatibility fallback, byte-unchanged.
696
+ const inferredMaterial = (profile, defaultMaterial) => (defaultMaterial ? defaultMaterial(profile) : defaultGradeFor(undefined, profile, null));
691
697
  const effectiveMemberType = (m) => typeof m.memberType === 'string' && m.memberType.trim()
692
698
  ? m.memberType.trim().toLowerCase() : (m.role === 'column' ? 'column' : 'beam');
693
699
 
@@ -725,7 +731,7 @@ function mergePlacedSection(member, from, to, section) {
725
731
  };
726
732
  }
727
733
 
728
- function physicalMergePreflight(sources, resolveSection) {
734
+ function physicalMergePreflight(sources, resolveSection, defaultMaterial) {
729
735
  const rows = sources.map((m) => ({ m, a: vec3(m.from, `${m.id}.from`), b: vec3(m.to, `${m.id}.to`) }));
730
736
  const points = rows.flatMap((r, ri) => [{ p: r.a, ri, end: 0 }, { p: r.b, ri, end: 1 }]).sort((a,b)=>lex3(a.p,b.p));
731
737
  const parent=points.map((_,i)=>i),find=i=>parent[i]===i?i:(parent[i]=find(parent[i])),join=(a,b)=>{a=find(a);b=find(b);if(a!==b)parent[b]=a;};
@@ -749,9 +755,9 @@ function physicalMergePreflight(sources, resolveSection) {
749
755
  const dir=vunit(vsub(forward?row.b:row.a,forward?row.a:row.b));const angle=Math.acos(Math.max(-1,Math.min(1,vdot(dir,chainDir))));if(angle>MERGE_RAD)throw new V2CommandError('merge-not-collinear','merge member direction exceeds the 0.000001 rad bound');
750
756
  ordered.push({row,forward,seamFrom:orderedClusters[cur].rep,seamTo:orderedClusters[edge.v].rep});prev=cur;cur=edge.v;}
751
757
  const profile=canonProfile(ordered[0].row.m.profile),role=ordered[0].row.m.role==='column'?'column':'beam',memberType=effectiveMemberType(ordered[0].row.m);
752
- const material=(ordered[0].row.m.material&&ordered[0].row.m.material.trim())||inferredMaterial(profile);
758
+ const material=(ordered[0].row.m.material&&ordered[0].row.m.material.trim())||inferredMaterial(profile, defaultMaterial);
753
759
  let reference=null;
754
- for(const item of ordered){const m=item.row.m,p=canonProfile(m.profile),r=m.role==='column'?'column':'beam',t=effectiveMemberType(m),mat=(m.material&&m.material.trim())||inferredMaterial(p);
760
+ for(const item of ordered){const m=item.row.m,p=canonProfile(m.profile),r=m.role==='column'?'column':'beam',t=effectiveMemberType(m),mat=(m.material&&m.material.trim())||inferredMaterial(p, defaultMaterial);
755
761
  if(p!==profile||r!==role||t!==memberType||mat!==material)throw new V2CommandError('merge-member-conflict','merge sources must agree on effective profile, material, role, and member type');
756
762
  let physicalMember=m,physicalFrom=item.row.a,physicalTo=item.row.b;
757
763
  if(!item.forward){const basis=m.positionBasis?basisFromAxes(m.positionBasis.x,m.positionBasis.y):{x:[1,0,0],y:[0,1,0],z:[0,0,1]};const sourceFrame=basis&&partFrame(item.row.a,item.row.b,basis.z,basis.x);
@@ -783,15 +789,18 @@ function physicalMergePreflight(sources, resolveSection) {
783
789
  }
784
790
  }
785
791
  let survivor=clone(ordered[0].row.m);if(!ordered[0].forward){const basis=survivor.positionBasis?basisFromAxes(survivor.positionBasis.x,survivor.positionBasis.y):{x:[1,0,0],y:[0,1,0],z:[0,0,1]};const f=basis&&partFrame(ordered[0].row.a,ordered[0].row.b,basis.z,basis.x);if(!f)throw new V2CommandError('merge-section-unresolved','cannot normalize the first member direction');Object.assign(survivor,reversePlacement(survivor,f.degenerate));}
792
+ // `profileBasis` is one source's account of its own section. The survivor keeps it only when EVERY source states the
793
+ // same words; otherwise it would present the first member's note as evidence for the whole merged member.
794
+ if(survivor.profileBasis!==undefined&&!ordered.every(o=>o.row.m.profileBasis===survivor.profileBasis))delete survivor.profileBasis;
786
795
  return {survivor,from:orderedClusters[start].rep,to:orderedClusters[finish].rep};
787
796
  }
788
797
 
789
- function mergeMemberGroup(doc, sheet, memberIds, mergedPx, mintId, resolveSection) {
798
+ function mergeMemberGroup(doc, sheet, memberIds, mergedPx, mintId, resolveSection, defaultMaterial) {
790
799
  const oldIds = new Set(memberIds);
791
800
  if (oldIds.size < 2) throw new V2CommandError('merge-needs-two', 'merge needs at least two members');
792
801
  assertNoWholeMemberRefs(doc, oldIds);
793
802
  const sources = [...oldIds].map((id) => memberById(doc, id));
794
- const physical=physicalMergePreflight(sources,resolveSection);
803
+ const physical=physicalMergePreflight(sources,resolveSection,defaultMaterial);
795
804
  const merged = physical.survivor;
796
805
  merged.id = mintId();
797
806
  // MERGE is split's inverse and needs the same rule: if either source end was placed rather than
@@ -894,12 +903,13 @@ const restoreCaptured = (holder, saved, keys) => {
894
903
  }
895
904
  };
896
905
 
897
- /** @param {any} model @param {{validate?: (doc: any) => any, mintId?: () => string, afterCommit?: (effect: any) => void, resolveSection?: (member:any) => any}} options */
906
+ /** @param {any} model @param {{validate?: (doc: any) => any, mintId?: () => string, afterCommit?: (effect: any) => void, resolveSection?: (member:any) => any, defaultMaterial?: (profile:string) => string}} options */
898
907
  export function createV2CommandSession(model, options = {}) {
899
908
  const {
900
909
  validate,
901
910
  afterCommit,
902
911
  resolveSection,
912
+ defaultMaterial,
903
913
  mintId = (() => { let n = 0; return () => `m-v2-${Date.now()}-${n++}`; })(),
904
914
  } = options;
905
915
  const projections = new Set();
@@ -1265,10 +1275,14 @@ export function createV2CommandSession(model, options = {}) {
1265
1275
  patchMember(memberId, patch) {
1266
1276
  return session.transact('patch member', (doc) => {
1267
1277
  const member = memberById(doc, memberId);
1278
+ // `profileBasis` is the reader's evidence for the profile this member HAD; a different profile
1279
+ // is not covered by it, so it goes unless the same patch restates it.
1280
+ const profileChanged = Object.prototype.hasOwnProperty.call(patch, 'profile') && patch.profile !== member.profile;
1268
1281
  for (const [key, value] of Object.entries(patch)) {
1269
1282
  if (value === undefined) delete member[key];
1270
1283
  else member[key] = clone(value);
1271
1284
  }
1285
+ if (profileChanged && !Object.prototype.hasOwnProperty.call(patch, 'profileBasis')) delete member.profileBasis;
1272
1286
  return { changedIds: [memberId] };
1273
1287
  });
1274
1288
  },
@@ -1612,14 +1626,14 @@ export function createV2CommandSession(model, options = {}) {
1612
1626
 
1613
1627
  mergeMembers(viewId, memberIds, mergedPx) {
1614
1628
  return session.transact('merge members', (doc) => {
1615
- const id = mergeMemberGroup(doc, viewId, memberIds, mergedPx, mintId, resolveSection);
1629
+ const id = mergeMemberGroup(doc, viewId, memberIds, mergedPx, mintId, resolveSection, defaultMaterial);
1616
1630
  return { changedIds: [id], structural: true, value: id };
1617
1631
  });
1618
1632
  },
1619
1633
 
1620
1634
  mergeMemberGroups(viewId, groups) {
1621
1635
  return session.transact('merge member groups', (doc) => {
1622
- const made = groups.map((group) => mergeMemberGroup(doc, viewId, group.memberIds, group.wp, mintId, resolveSection));
1636
+ const made = groups.map((group) => mergeMemberGroup(doc, viewId, group.memberIds, group.wp, mintId, resolveSection, defaultMaterial));
1623
1637
  return { changedIds: made, structural: true, value: made };
1624
1638
  });
1625
1639
  },
@@ -228,7 +228,7 @@ export function memberProperties(member) {
228
228
  role: member.role || 'beam',
229
229
  provenance: member.provenance,
230
230
  };
231
- for (const key of ['material', 'memberType', 'position', 'positionH', 'positionOffset', 'positionHOffset', 'positionBasis', 'rot', 'section', 'bf', 'rfi', 'mf', 'verified', 'source', 'brace']) {
231
+ for (const key of ['profileBasis', 'material', 'memberType', 'position', 'positionH', 'positionOffset', 'positionHOffset', 'positionBasis', 'rot', 'section', 'bf', 'rfi', 'mf', 'verified', 'source', 'brace']) {
232
232
  if (member[key] !== undefined) meta[key] = clone(member[key]);
233
233
  }
234
234
  const endMeta = Array.isArray(member.ends) ? member.ends : [{}, {}];
@@ -155,7 +155,7 @@
155
155
  pv.removeAttribute('aria-busy');
156
156
  const data = answer ? answer.data : {};
157
157
  if (answer && /^step-name-|^step-not-found$/.test(String(data.code))) {
158
- nameError(data.error || 'That name can’t be used here. Try another.', data.suggestedId);
158
+ nameError(personText(data) || 'That name can’t be used here. Try another.', data.suggestedId);
159
159
  pv.textContent = '';
160
160
  setReady(false, 'Choose a free name first.');
161
161
  return;
@@ -163,7 +163,8 @@
163
163
  // "Check again" only where trying again can help (a failed check, a lost connection); an older AWARE or a file FloLess
164
164
  // will not edit is answered with its sentence alone.
165
165
  const retryable = !answer || !data.code || ['step-rename-failed', 'step-names-unchecked', 'step-rename-preview-stale'].includes(String(data.code));
166
- pv.innerHTML = esc(data.error || 'FloLess couldn’t check the change just now.')
166
+ // #3097: the server's sentence only when it wrote one for the person, never a reply it marked diagnostic.
167
+ pv.innerHTML = esc(personText(data) || 'FloLess couldn’t check the change just now.')
167
168
  + (retryable ? ' <button type="button" class="sr-retry" data-sr-retry data-command-id="shell.step-rename-retry">Check again</button>' : '');
168
169
  setReady(false, retryable ? 'FloLess needs to check the change first.' : 'This rename can’t go ahead here.');
169
170
  }
@@ -539,7 +539,7 @@
539
539
  shown.set(body.fresh.id, { p: body.fresh, busy: '', error: '' });
540
540
  focusId = body.fresh.id;
541
541
  freshId = body.fresh.id;
542
- announce(restarted ? 'Request shown again as it works now. Nothing has run.' : body.error || 'It changed after your terminal asked. The current request is shown first.');
542
+ announce(restarted ? 'Request shown again as it works now. Nothing has run.' : personText(body) || 'It changed after your terminal asked. The current request is shown first.');
543
543
  } else {
544
544
  if (body.proposal) entry.p = body.proposal;
545
545
  entry.error = status === 404 ? 'FloLess no longer has that request. Ask your terminal to try again.'
@@ -347,7 +347,6 @@
347
347
  var error = new Error(said || callFailureText({ status: res.status, body: body }, readOnly));
348
348
  error.body = body;
349
349
  error.status = res.status;
350
- error.serverText = Boolean(said) && body.code !== 'response-unreadable';
351
350
  throw error;
352
351
  }
353
352
  return body;
@@ -489,7 +488,7 @@
489
488
  if (typeof bridge?.reviewWorkflowUpdate !== 'function') { $live.textContent = 'Workflow updates are still starting. Try again in a moment.'; return; }
490
489
  close();
491
490
  Promise.resolve(bridge.reviewWorkflowUpdate(item.id)).catch(function (error) {
492
- open($pill); $live.textContent = error.message;
491
+ open($pill); $live.textContent = errorText(error, { action: 'open the workflow update', retrySafe: true });
493
492
  });
494
493
  });
495
494
  row.appendChild(text); row.appendChild(button);
@@ -535,7 +534,7 @@
535
534
  console.warn('could not open the workflow', error);
536
535
  // Back to the dialog, with the reason in its live line (open() clears that line, so it is set after).
537
536
  open($pill.hidden ? null : $pill);
538
- $live.textContent = error.message;
537
+ $live.textContent = errorText(error, { action: 'open the workflow', retrySafe: true });
539
538
  });
540
539
  });
541
540
  row.appendChild(openButton);
@@ -588,8 +587,10 @@
588
587
  // #3097: "Nothing was removed" is the server's claim, so it follows only the server's own reason. A lost or
589
588
  // unexplained answer may follow a removal that went through, so it asks the person to check the list instead.
590
589
  console.warn('forget folder failed', error);
591
- $live.textContent = error.serverText
592
- ? error.message + ' Nothing was removed from the list.'
590
+ // The server's own sentence, worked out again from its reply (personText); never the error's message.
591
+ var said = error.body && error.body.code !== 'response-unreadable' && typeof personText === 'function' ? personText(error.body) : '';
592
+ $live.textContent = said
593
+ ? said + ' Nothing was removed from the list.'
593
594
  : (typeof failureCopy === 'function'
594
595
  ? failureCopy(error, { action: 'remove it from the list', unsure: 'Check whether it is still listed before trying again.' }).text
595
596
  : 'Couldn’t remove it from the list. Check whether it is still listed before trying again.');
@@ -1248,7 +1249,7 @@
1248
1249
  ? plural(moved, 'tool approval', 'tool approvals') + ' done. ' + (moved === 1 ? 'That workflow now runs' : 'Those workflows now run') + ' on the new tool versions.'
1249
1250
  : moved + ' of ' + plural(results.length, 'tool approval', 'tool approvals') + ' done. The others say why below.') + waitingSentence();
1250
1251
  } else {
1251
- $live.textContent = body.sentence || body.error || 'Nothing was moved. Review it again.';
1252
+ $live.textContent = body.sentence || (typeof personText === 'function' ? personText(body) : '') || 'Nothing was moved. Review it again.';
1252
1253
  }
1253
1254
  } catch (error) {
1254
1255
  // The answer was lost on the way back: the server may have moved some workflows. Ask again rather than guess.