@floless/app 0.111.2 → 0.112.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.
@@ -77,6 +77,16 @@
77
77
  },
78
78
  "point2": { "type": "array", "items": { "type": "number" }, "minItems": 2, "maxItems": 2, "description": "An [x,y] pair. Frame stated per use site — display px on a plan, world mm on the model grid." },
79
79
  "point3": { "type": "array", "items": { "type": "number" }, "minItems": 3, "maxItems": 3, "description": "An [x,y,z] point in world mm (Z-up)." },
80
+ "intersectionRef": {
81
+ "type": "object",
82
+ "required": ["axis_x", "axis_y"],
83
+ "additionalProperties": false,
84
+ "description": "A labelled grid intersection, naming each axis BY DIRECTION — `axis_x` is the label of the line running in X (from the grid's labels_x), `axis_y` the Y-direction line. Never inferred from whether a label looks like a letter or a number: real sets invert the convention — this project's own demo labels X `K J H G F.2 F D C B A` and Y `1.1 2 3 4 5 5.1 6`, letters running in X and numbers in Y, the opposite of the editor default. This object is the ONE spelling stored v2 holds. v1 documents may also carry the legacy positional string \"<x-label>-<y-label>\", which migration and the pre-read verb canonicalise on the way in; it is refused here because that form cannot express a label containing a hyphen, and because two spellings of one fact would make a re-read propose a change that changes nothing.",
85
+ "properties": {
86
+ "axis_x": { "type": "string", "minLength": 1, "description": "Label of the X-direction grid line." },
87
+ "axis_y": { "type": "string", "minLength": 1, "description": "Label of the Y-direction grid line." }
88
+ }
89
+ },
80
90
  "member": {
81
91
  "type": "object",
82
92
  "required": ["id", "profile", "from", "to", "provenance"],
@@ -153,9 +163,9 @@
153
163
  "elevation_in": { "type": "number", "description": "This sheet's CUT elevation, inches. NOT v1's `default_tos` — that was the fallback top-of-steel for blank ends, which happens to carry the same number on a typical framing plan. Conflating them is easy and wrong, so v1's default_tos is materialized into explicit member elevations at migration and does not survive here." },
154
164
  "pt_per_ft": { "type": "number", "description": "Display points per foot (the drawing scale). Still needed: observations record local geometry in display px." },
155
165
  "datum_at": { "$ref": "#/$defs/point2", "description": "Display-space point of the grid intersection that is the model origin on this sheet (authored by the takeoff skill — never chosen by it)." },
156
- "datum_ref": { "type": "string", "description": "Labelled intersection this sheet's datum names, e.g. \"1-A\", when the sheet cannot print the model origin." },
166
+ "datum_ref": { "$ref": "#/$defs/intersectionRef", "description": "Which labelled intersection `datum_at` is, when the sheet cannot print the model origin. ABSENT is a statement, not a gap: the takeoff skill omits it precisely when the sheet's datum IS the model origin." },
157
167
  "control2_at": { "$ref": "#/$defs/point2", "description": "A SECOND, non-coincident control point, display space. One point fixes only WHERE a sheet sits; the vector between two carries rotation, mirroring and scale (epic §6.2)." },
158
- "control2_ref": { "type": "string", "description": "Labelled intersection the second control names." },
168
+ "control2_ref": { "$ref": "#/$defs/intersectionRef", "description": "Which labelled intersection `control2_at` is. Required alongside `control2_at` — unlike `datum_ref` it is never omitted, because a second control is never the model origin, so its labels always have to be stated. NOT expressible here (this repo's validator implements no `dependentRequired`), so it is enforced by `checkModelReferences` as `control-pair-incomplete` rather than by this schema." },
159
169
  "clip": { "type": "array", "items": { "type": "number" }, "minItems": 4, "maxItems": 4, "description": "[x0,y0,x1,y1] display-space crop of the framing area." },
160
170
  "raster_b64": { "type": "string", "description": "Base64 raster of the framing area. CONFIDENTIAL — never committed." },
161
171
  "segments": { "type": "array", "items": { "type": "object", "additionalProperties": true } },
@@ -55,7 +55,7 @@ each learned from a real failure:
55
55
  mark / grid) or as **per-column size tags at each base**. That sheet is the biggest candidate; make
56
56
  reading it for column sizes a REQUIRED step, not an afterthought. (Designers occasionally put the
57
57
  schedule elsewhere — a general/schedule sheet, or sections/details through the column, or a general
58
- note like "ALL COLS HSS6×6×3/8 UON" — so if the foundation plan doesn't have it, keep looking there.)
58
+ note like "ALL COLS HSS6X6X3/8 UON" — so if the foundation plan doesn't have it, keep looking there.)
59
59
  Match each plan column to its size by **grid mark** (+ story). Only when the size is genuinely
60
60
  nowhere in the entire set — foundation plan checked FIRST — does the column stay `rfi:true`.
61
61
  - **Column ROTATION (`rot`) is MANDATORY — and derive it from the FLANGE-SEGMENT INK, not the bounding
@@ -261,8 +261,31 @@ native/display coords):
261
261
  refused, because this verb patches the document you read and `*` cannot detect a write that landed
262
262
  since your GET. On a re-read, preserve any existing per-facet `on` flags.
263
263
 
264
+ **On a `steel.model/v2` model it takes less — `filter` plus per-sheet `{ datum_at, datum_ref,
265
+ control2_at, control2_ref, elevation_in }`, and no grid or datum at all.** Check the `type` in the
266
+ document you just GET-ed. A v2 model keeps ONE grid for the whole model instead of one per sheet, and
267
+ that grid is not writable from THIS verb: the human moves it in the editor's Grid panel, and a
268
+ re-read proposes a move through its own contract (§1c). Sending a
269
+ `grid` or a `datum` HERE earns a `400` that says so. So on v2: **skip §1c's pre-read part, and in §1d skip only
270
+ the root `datum` block — the per-sheet registration in §1d is still yours to write**, and a migrated
271
+ model usually has none of it yet. Everything else in this section is unchanged.
272
+
264
273
  ### 1c. Grid lines — read the printed grid (quick, per sheet)
265
274
 
275
+ > **`steel.model/v2` models: SKIP this section for the PRE-READ pass — but carry the grid in the
276
+ > contract you re-read.** Two different endpoints, and the difference matters:
277
+ >
278
+ > - **The pre-read verb (`/steel-prepass`) still refuses a grid.** A v2 model keeps ONE grid for the
279
+ > whole model, so there is no per-sheet `grid` to send. You will get a `400` saying so.
280
+ > - **The re-read contract (`POST /revision-read`) carries the model grid, at the root, as `grid`.**
281
+ > Copy the CURRENT model's `grid` through unchanged — do not drop the key. If the revised set
282
+ > genuinely shows the printed grid in a new place, write the new grid there instead: it is staged as
283
+ > a **proposal the user accepts** in the review, never a silent write.
284
+ >
285
+ > **Never omit `grid` to mean "I did not change it".** Omitting a key is not how you say that — copy
286
+ > it through. (A read that drops it is refused and reported, precisely so an omission can never be
287
+ > mistaken for "delete the model grid".) Removing the grid is a human edit in the editor, not a read.
288
+
266
289
  With the filter elements in hand, populate each plan's **`plan.grid`** (Tekla-style grid lines the
267
290
  editor renders in 2D + 3D and snaps to). The geometry is deterministic — the editor's Grid panel has
268
291
  a "From drawing" button running the same detector (`web/grid-core.js` `gridFromDrawing`: grid lines
@@ -291,6 +314,15 @@ Skip silently only when the sheet genuinely has no grid bubbles (rare for framin
291
314
 
292
315
  ### 1d. Model datum — ASK which grid intersection is global 0,0,0
293
316
 
317
+ > **`steel.model/v2` models: the root `datum` part is SKIPPED, the per-sheet part is not.** A v2 model
318
+ > has no root `datum`: the "which intersection is 0,0,0" question was answered when the model was
319
+ > migrated, and the answer lives in the model grid's origin, which the pre-read verb may not move (a
320
+ > re-read may PROPOSE a new grid — see §1c). **The per-sheet
321
+ > registration below is still yours to write** — `datum_at`, `datum_ref`, `control2_at`, `control2_ref`
322
+ > — because those say something different: where that already-chosen origin falls on THIS sheet. A
323
+ > migrated model usually has none of them yet, so this is real work, not a no-op. Send them under
324
+ > `sheets`, exactly as below, and just omit the root `"datum"` block.
325
+
294
326
  Every sheet is traced in its **own** display space, and nothing ties two sheets to a common frame. The
295
327
  same physical grid read from three sheets therefore lands in three different places — measured on a real
296
328
  project: **443 mm apart**. That silently mis-registers every member read from those sheets — columns that
@@ -383,9 +415,19 @@ PUT /api/projects/<projectId>/steel-prepass If-Match: <the current ETag>
383
415
  "control2_at": [x, y], "control2_ref": …, "elevation_in": 144 } } }
384
416
  ```
385
417
 
386
- Those six per-sheet keys and `datum` are the complete set the verb accepts alongside `filter`; anything
387
- else — `members`, `memberRefs`, `title`, `raster_b64` — is refused **by name** with a `400`, so a write
388
- that thinks it saved the model will hear about it rather than silently succeeding.
418
+ **On a `steel.model/v2` model, the same call without the two the verb refuses** — no root `datum`, no
419
+ per-sheet `grid`:
420
+
421
+ ```
422
+ PUT /api/projects/<projectId>/steel-prepass If-Match: <the current ETag>
423
+ { "sheets": { "<sheet>": { "datum_at": [x, y], "datum_ref": …,
424
+ "control2_at": [x, y], "control2_ref": …, "elevation_in": 144 } } }
425
+ ```
426
+
427
+ Those six per-sheet keys and `datum` are the complete set the verb accepts alongside `filter` **on
428
+ `steel.takeoff/v1`**; on `steel.model/v2` it is the five per-sheet registration keys and `filter`.
429
+ Anything else — `members`, `memberRefs`, `title`, `raster_b64` — is refused **by name** with a `400`, so
430
+ a write that thinks it saved the model will hear about it rather than silently succeeding.
389
431
 
390
432
  **Then STOP and hand off — checkpoint before the member read.** Tell the user to open the **Filter**
391
433
  node, flip through the sheets, narrow to the steel, and **Save**. The saved `on` flags + `mode` are
@@ -998,6 +1040,7 @@ Key field rules:
998
1040
  | you are writing | route |
999
1041
  |---|---|
1000
1042
  | the pre-read blocks — §1b `filter`, §1c `grid`, §1d `datum` + the per-sheet registration keys | **`PUT /api/projects/<projectId>/steel-prepass`** |
1043
+ | the same, on a **`steel.model/v2`** model — `filter` + the per-sheet registration keys ONLY, no `grid`, no `datum` | the same verb; it refuses the other two by name |
1001
1044
  | the finished takeoff (§4's whole document: `members`, profiles, elevations) | `PUT /api/contract/steel-model` |
1002
1045
  | a project's FIRST document, when the `GET` returned nothing at all | `PUT /api/contract/steel-model` with `If-None-Match: *` |
1003
1046
 
@@ -1005,7 +1048,10 @@ The prepass verb exists because the pre-read pass used to GET the contract and P
1005
1048
  back. That is a full-document replacement: it can overwrite members, joints and connections that the
1006
1049
  user has already reviewed, and an ETag does not stop it — an ETag makes a write not *stale*, not not
1007
1050
  *canonical*. The verb accepts `filter`, `datum` and per-sheet `{ grid, datum_at, datum_ref, control2_at,
1008
- control2_ref, elevation_in }`, and refuses everything else **by name** with a `400`. It cannot create a
1051
+ control2_ref, elevation_in }`, and refuses everything else **by name** with a `400`. **On a
1052
+ `steel.model/v2` model the accepted set is narrower** — `filter` plus the per-sheet registration keys,
1053
+ with `grid` and `datum` refused (§1c, §1d), because a v2 grid is model-global canonical structure rather
1054
+ than a pre-read block. It cannot create a
1009
1055
  document and it cannot add a sheet (an unknown sheet is a `400`, never a new plan), so the create case
1010
1056
  above genuinely does belong to the contract route.
1011
1057
 
@@ -1092,6 +1138,12 @@ their `id`, scoped per `sheet`. So the re-read must keep identity stable:
1092
1138
  3. Then compose the updated `steel.takeoff/v1` and `POST /api/projects/<projectId>/revision-read
1093
1139
  { contract, message, requestId }` (that POST clears the request — do **not** DELETE it).
1094
1140
 
1141
+ > **On a `steel.model/v2` project compose a `steel.model/v2` document instead** — check the `type`
1142
+ > of the contract you GET-ed in step 1. Members live in one root `members[]` in world millimetres,
1143
+ > and the root **`grid` comes across unchanged** unless the revised set shows the printed grid in a
1144
+ > new place, in which case write the new one and it becomes a proposal the user accepts (§1c).
1145
+ > Never drop the `grid` key to mean "unchanged" — a read that omits it is refused.
1146
+
1095
1147
  If you renumber everything, the diff shows a misleading "all removed + all added" and the app warns
1096
1148
  **"identity not preserved."** Carrying ids forward is what makes *"beam B12 was upsized"* come out
1097
1149
  exact instead of a churn of the whole model.
@@ -265,7 +265,15 @@ any external count.
265
265
  label ~20 px.
266
266
  - Place each member by the **grid lines it spans** + its level. Read its size label; **confirm size
267
267
  against the schedule** (column schedule = authoritative per tier/splice; beam schedule maps marks).
268
- Map W18×35 = wide-flange, 18" nominal depth, 35 lb/ft, etc.
268
+ Map W18X35 = wide-flange, 18" nominal depth, 35 lb/ft, etc.
269
+ - **Transcribe the designation as ASCII.** Drawing text and OCR routinely emit typographic
270
+ lookalikes — the multiplication sign in place of `X`, en/em dashes for the hyphen, primes for
271
+ inch marks, non-breaking spaces, Cyrillic characters that render identically. Downstream
272
+ lookups match the literal string, so ONE lookalike turns a known section into an unknown one:
273
+ no real dimensions, a placeholder solid in 3D/IFC/the host model, and a size that still reads
274
+ correct to a human on screen. Fold to ASCII at the point of extraction, then confirm the
275
+ normalised designation actually resolves against the section table — a designation that "looks
276
+ right" is not evidence it matched.
269
277
  - **Use a structured schema that enforces the order** (vision agent or your own): fill
270
278
  `coordinate_system → buildings(+roof) → grids_per_building → members`, every value carrying
271
279
  `source_view`, `evidence_bbox`, `confidence`, plus mandatory `unreadable[]` and `contradictions[]`.
@@ -302,6 +310,8 @@ Only then build the scene / overlay / IFC. If unsure, present the **massing + gr
302
310
  - [ ] A member spanning two levels emitted on both plans (doubles the tonnage).
303
311
  - [ ] A size left as an RFI when the set does show it — a lazy RFI is as wrong as a fabricated number.
304
312
  - [ ] A built-up shape (double angle, etc.) taken off as its single component (half the steel).
313
+ - [ ] A designation carrying a typographic lookalike (multiplication sign for `X`, en-dash for `-`,
314
+ prime for `"`) — it renders correctly and silently fails every downstream size lookup.
305
315
  - [ ] Vector coordinates compared against a render without applying the page rotation — silently transposed
306
316
  at 90/270, silently point-reflected at 180 (where the page shape gives no hint at all).
307
317
  - [ ] Sheets identified by extracting text, on a set whose text layer is boilerplate only.
package/dist/web/app.css CHANGED
@@ -4009,6 +4009,71 @@ table.hist tr.current td { background:var(--accent-soft); }
4009
4009
  .rev-issue:last-child { border-bottom:none; }
4010
4010
  .rev-issue-path { font-family:var(--mono); font-size:10.5px; color:var(--text-dim); display:block; margin-top:2px; }
4011
4011
 
4012
+ /* ── Convert to the model (steel.takeoff/v1 → steel.model/v2, unit 5, P7e) ────────────────────────
4013
+ `.migreview` rides on `.modal.revreview` and adds only the genuine deltas. Everything visual — the
4014
+ width, the themed inner scrollbar, the rows, the custom checkboxes at .rev-check — is inherited, so
4015
+ there is no second vocabulary to keep in step. */
4016
+
4017
+ /* The offer banner. Reuses `.ws-exports-gate` wholesale (neutral accent-dim rail, never --warn/--err:
4018
+ an older format is not an error) and only re-homes it, since it sits in the project column rather
4019
+ than the exports pane. */
4020
+ .ws-migrate-gate { margin:12px 20px 0; }
4021
+ /* `[hidden]` DOES NOTHING WITHOUT THIS, and the banner was visible on every project as a result.
4022
+ `.ws-exports-gate` sets `display:flex`, an author-origin rule that beats the UA's
4023
+ `[hidden] { display:none }` — and this stylesheet has no global `[hidden]` rule, only per-class ones
4024
+ (`.ws-drawings-bar[hidden]`, `.ws-revision-card[hidden]`, the `!important` list at :3551). Without it
4025
+ every `$migGate.hidden = true` was a no-op: an empty bordered strip painted under the step tabs for
4026
+ EVERY workspace project, a v1 project's banner followed the user onto Drawings and History, and it
4027
+ survived a successful conversion still offering to convert. Caught by review measuring computed
4028
+ `display`; the browser pass asserted the `hidden` PROPERTY, which was true the whole time. */
4029
+ .ws-migrate-gate[hidden] { display:none; }
4030
+
4031
+ /* AN UNTICKED BOX INSIDE A ROW WAS INVISIBLE, and this is a contrast fix, not a restyle.
4032
+ `.rev-check input` sets `border: var(--border-strong)` on `background: var(--surface-2)` — and those
4033
+ two tokens are THE SAME COLOUR (both hsl(217.2 32.6% 17.5%)). On `.modal-check` that is harmless,
4034
+ because the fork-consent checkbox sits on the darker modal surface where the fill itself reads as the
4035
+ box. Inside `.rev-row`, whose background is ALSO --surface-2, all three match: measured
4036
+ rgb(30,41,59) for the row, the fill and the border alike. The result is a 16×16 invisible square that
4037
+ only appears once focused.
4038
+ Pre-existing and shared with the revision-review modal, so this fixes that surface too — scoped to
4039
+ the row context, which is the only place the collision happens, rather than restyling every consent
4040
+ checkbox in the app. Found by measuring computed styles in the browser pass; a screenshot alone
4041
+ showed "a row with no checkbox" and could not say why. */
4042
+ .rev-row .rev-check input[type="checkbox"] { border-color: var(--text-dim); }
4043
+ .rev-row .rev-check input[type="checkbox"]:hover { border-color: var(--text-muted); }
4044
+ .rev-row .rev-check input[type="checkbox"]:checked { border-color: var(--accent); }
4045
+
4046
+ /* The kind heading — the OUTER grouping axis, above the topic groups. Load-bearing rather than
4047
+ decorative: a topic can carry decisions of both kinds ("Saved views" does), so without this the same
4048
+ title appears twice, one block with a bulk control and one without, and nothing says why. */
4049
+ .mig-section { display:flex; align-items:baseline; gap:8px; flex-wrap:wrap;
4050
+ margin:14px 0 6px; padding-bottom:5px; border-bottom:1px solid var(--border); }
4051
+ .mig-section:first-child { margin-top:2px; }
4052
+ .mig-section-title { font-size:12px; font-weight:600; color:var(--text); letter-spacing:0.01em; }
4053
+ .mig-section-sub { font-size:11px; color:var(--text-dim); }
4054
+
4055
+ /* The tick progress, distinct from `.rev-counts` above the body: that line says what you GET, this one
4056
+ says what is LEFT. Sits tight to the actions it gates, and right-aligned so the eye finds it on the
4057
+ way to the button rather than having to come back up the modal. */
4058
+ .mig-progress { margin:2px 0 8px; text-align:right; }
4059
+ .mig-progress[hidden] { display:none; }
4060
+
4061
+ /* Confirm while anything is unticked. `aria-disabled`, NEVER the `disabled` attribute — the same
4062
+ recipe `.kb-organize` and `.ecard .e-act` use, and for the same reason: a disabled button is neither
4063
+ hoverable nor focusable, so the `data-tip` saying WHY it will not go would never reach the person who
4064
+ needs it. Reads as inert to assistive tech; `confirmMigrate` checks the same attribute, so the gate
4065
+ is behaviour rather than styling. */
4066
+ .migreview .modal-actions button.primary[aria-disabled="true"] {
4067
+ opacity:0.55; cursor:default;
4068
+ background:var(--surface-2); border-color:var(--border-strong); color:var(--text-dim);
4069
+ }
4070
+ .migreview .modal-actions button.primary[aria-disabled="true"]:hover {
4071
+ background:var(--surface-2); border-color:var(--border-strong); color:var(--text-dim);
4072
+ }
4073
+ /* A REFUSED conversion renders no Confirm at all, so the attribute has to actually take: `.modal-actions
4074
+ button` sets a display, which beats the UA's `[hidden]` rule on its own. */
4075
+ .migreview .modal-actions button[hidden] { display:none; }
4076
+
4012
4077
  /* ── Workspaces: revision re-read (Slice 4b) — attach band + pending/failed card ── */
4013
4078
  .ws-drawings-bar { flex:none; display:flex; align-items:center; gap:10px; padding:8px 14px; border-bottom:1px solid var(--border); background:var(--surface); }
4014
4079
  .ws-drawings-bar[hidden] { display:none !important; }
package/dist/web/aware.js CHANGED
@@ -5905,6 +5905,24 @@
5905
5905
  }
5906
5906
  return `In floless project "${req.project}" (app "${req.appId}"), a REVISED drawing was attached — re-read (vectorize) it into the SAME project as a new version (do NOT create a new project). Vectorize the drawing per the floless-app-vectorize skill into a drawing.vector/v1 contract: emit clean, editable 2D vector geometry (sheets → elements: lines / polylines / curves / text, each on its layer), NOT steel members or a takeoff. A vector PDF is read deterministically (exact geometry, no guessing); a photo, scan or hand sketch is traced by a fenced vision extraction that flags every uncertain stroke (low confidence) for the user's review. ${post}${snaps}${note}`;
5907
5907
  }
5908
+ // A MIGRATED project holds steel.model/v2, and that changes the document the AI must compose —
5909
+ // not merely its wording. The store only accepts v2, so asking for a v1 take-off would have the
5910
+ // whole read refused at the gateway AFTER it was done, which is the most expensive place to find
5911
+ // out. `contractType` is what the store actually holds today (see requestContractType); it is
5912
+ // absent on an older server, and absent falls through to the v1 branches below, unchanged.
5913
+ //
5914
+ // A revision-read against a v2 project is always a RE-read: v2 is reached by migrating a project
5915
+ // that already held a model, so there is no "initial" case to distinguish. What differs from v1 is
5916
+ // structural and is spelled out rather than left to be inferred, because every one of these is a
5917
+ // place a v1-shaped answer would look plausible: members live at the document ROOT in world
5918
+ // millimetres rather than per sheet in display pixels; ids are model-global, so the v1 rule
5919
+ // "preserve the id AND its sheet label" does not apply and a bare id is the identity; an elevation
5920
+ // the drawing does not give is `{ unknown: true }`, never a substituted default, because a
5921
+ // fabricated elevation silently relocates steel; and what each SHEET showed is recorded as
5922
+ // evidence on that plan's `memberObservations` instead of by owning the member.
5923
+ if (req.contractType === 'steel.model/v2') {
5924
+ return `In floless project "${req.project}" (app "${req.appId}"), a REVISED drawing set was attached — re-read it into the SAME project as a new version (do NOT create a new project). This project holds a steel.model/v2 model, so compose a steel.model/v2 document, NOT a steel.takeoff/v1: members live in ONE root \`members[]\` array in WORLD MILLIMETRES (each with \`from\`/\`to\` as { x, y, z }), not per sheet in display pixels. Member ids are MODEL-GLOBAL — preserve the id of every member the revision still shows and mint a new one only for a genuinely new member; there is no sheet label to preserve alongside it. Where the drawing does not give an elevation, write \`{ unknown: true }\` for that z — never a substituted default, because a fabricated elevation moves steel. Record what each SHEET actually showed as evidence on that plan's \`memberObservations\` (with its \`binding.memberIds\`), and use \`plans[].memberRefs\` for members a sheet displays but never observed. COPY THE CURRENT MODEL'S ROOT \`grid\` THROUGH UNCHANGED into the document you post to /revision-read — never omit the key, because omitting it is not how you say "unchanged" and a read that drops it is refused. If the revised set genuinely shows the printed grid in a NEW place, write the new grid there instead: it is staged as a proposal the user accepts in the review, never a silent write. (The pre-read verb below still refuses a grid — that is a different endpoint.) Follow the floless-app-steel-takeoff skill's mandatory two-phase gate exactly as for v1: FIRST GET /api/contract/${req.appId}?project=${req.project} to read the CURRENT model and KEEP its ETag, do the deterministic PyMuPDF steel-filter pass only, send ONLY the pre-read blocks to PUT /api/projects/${req.project}/steel-prepass with { filter } and If-Match: <that ETag> — never the whole contract — then STOP and tell me to open Drawings → Steel Filter, review the facets, and Save. Do NOT read members, build the model, open 3D, or POST /revision-read until I explicitly come back after saving the filter. ${post}${snaps}${note}`;
5925
+ }
5908
5926
  if (isInitialRead) {
5909
5927
  return `In floless project "${req.project}" (app "${req.appId}"), an initial drawing set was attached — read it into this project as its first steel model version (do NOT create a new project). Follow the floless-app-steel-takeoff skill's mandatory two-phase gate. FIRST, GET /api/contract/${req.appId}?project=${req.project} and KEEP its ETag response header. A 404 "no contract for this app yet" here is NORMAL and not an error — a project created by dropping a drawing starts empty; it simply means this is the create case, so you will send If-None-Match: * instead of an ETag. (A project seeded from an existing model does return a contract and an ETag.) Then do the deterministic PyMuPDF steel-filter pass only: identify the framing-plan sheets, enumerate the drawing elements by layer/thickness/color into contract.filter.sheets/facets, write it back — if that GET returned NO contract this is the create case, so PUT the whole document to /api/contract/${req.appId}?project=${req.project} with If-None-Match: * ; if it DID return one, send only the pre-read blocks to PUT /api/projects/${req.project}/steel-prepass with { filter } and If-Match: <that ETag>. The prepass verb takes filter, datum and per-sheet { grid, datum_at, datum_ref, control2_at, control2_ref, elevation_in } and REFUSES members, connections and joints by name, so it cannot replace the model you are about to read. Either write is refused with 428 if it carries no precondition, and If-Match must be the exact ETag — If-Match: * is refused, because this verb patches the document you read. On 412 re-GET, re-apply your changes to the new document, and retry rather than repeating the same body. Then STOP and tell me to open Drawings → Steel Filter, review/narrow the steel facets, and Save. Do NOT read members, build the model, open 3D, or POST /revision-read until I explicitly come back after saving the filter. AFTER that saved-filter checkpoint, read members from the saved filter selection and compose the steel.takeoff/v1 contract. ${post}${snaps}${note}`;
5910
5928
  }
@@ -288,15 +288,26 @@ export function gridLines(g) {
288
288
  }
289
289
 
290
290
  /**
291
- * The grid resolved to display-space plan geometry.
291
+ * The grid resolved to plan geometry.
292
292
  * v = vertical lines (spaced along +X, labels 1,2,3…): { x, label }
293
- * h = horizontal lines (spaced UP the sheet = -Y, labels A,B,C…): { y, label }
293
+ * h = horizontal lines (spaced along the Y axis, labels A,B,C…): { y, label }
294
294
  * lines = standalone free-angle lines: { id, label, a, b }
295
- * zs = levels: { mm, label, sourceIndex } (sorted, deduped). ext/extents are display px.
295
+ * zs = levels: { mm, label, sourceIndex } (sorted, deduped). ext/extents share the output's units.
296
296
  * errX/errY/errZ carry per-axis parse errors; warningsZ reports duplicate/orphan level labels;
297
297
  * lines of a failed axis are [].
298
+ *
299
+ * `opts.yUp` — WHICH GRID THIS IS, and it is the only structural difference between the two (unit 5, P7d).
300
+ * Default false is v1: the grid lives in one sheet's DISPLAY space, so Y grows DOWN the page and the
301
+ * spacings run UP it (`oy - off`). True is `steel.model/v2`'s ONE model grid, already in world mm with Y
302
+ * up, so the spacings run along +Y and `ptPerFt` should be FT_MM (k = 1, the identity). Passing a v2 grid
303
+ * without this does not throw — it draws the whole grid mirrored about the origin's Y, plausibly, which is
304
+ * the silent-wrong-space failure this epic exists to prevent.
305
+ *
306
+ * It also selects which per-line EXTENT vocabulary is read: v1's index-keyed `ends_x`/`ends_y` in display
307
+ * px, or v2's single `ends` map keyed by stable AXIS ID in world mm — see the block at the end.
298
308
  */
299
- export function gridGeometry(g, ptPerFt) {
309
+ export function gridGeometry(g, ptPerFt, opts = {}) {
310
+ const yUp = !!opts.yUp;
300
311
  const k = mmPerPx(ptPerFt);
301
312
  const px = (mm) => mm / k;
302
313
  const X = parseSpacings(g && g.x), Y = parseSpacings(g && g.y);
@@ -305,7 +316,7 @@ export function gridGeometry(g, ptPerFt) {
305
316
  const lx = labelsFor(g && g.labels_x, 'num', X.offsets.length);
306
317
  const ly = labelsFor(g && g.labels_y, 'alpha', Y.offsets.length);
307
318
  const v = X.offsets.map((off, i) => ({ x: ox + px(off), label: lx[i] }));
308
- const h = Y.offsets.map((off, i) => ({ y: oy - px(off), label: ly[i] })); // up the sheet = -Y (scene +Y)
319
+ const h = Y.offsets.map((off, i) => ({ y: yUp ? oy + px(off) : oy - px(off), label: ly[i] })); // v1: up the sheet = -Y (scene +Y). v2: world mm, already Y-up.
309
320
  // Z levels are absolute, sorted/deduped, and retain their authored label source index.
310
321
  const resolvedZ = parseLevels(g && g.z, g && g.labels_z);
311
322
  const levelsZ = resolvedZ.err ? [] : resolvedZ.levels;
@@ -325,16 +336,27 @@ export function gridGeometry(g, ptPerFt) {
325
336
  y0: Math.min((ys.length ? Math.min(...ys) : oy), ly0) - ext,
326
337
  y1: Math.max((ys.length ? Math.max(...ys) : oy), ly1) + ext,
327
338
  };
328
- // per-line extent overrides (g.ends_x / g.ends_y: { "<index>": [lo|null, hi|null] } display px along
329
- // the line — a real sheet has partial lines like a 5.1 covering one wing). null / absent = the auto
330
- // full span. Every consumer (2D render, snapping, 3D) reads l.lo / l.hi.
339
+ // per-line extent overrides. v1 keys them by INDEX (g.ends_x / g.ends_y: { "<index>": [lo|null, hi|null] }
340
+ // in display px along the line — a real sheet has partial lines like a 5.1 covering one wing). v2
341
+ // replaced BOTH with one `ends` map keyed by stable AXIS ID in world mm, precisely because index keys
342
+ // meant "an insert or re-space changed what a reference meant" ($defs.modelGrid). null / absent = the
343
+ // auto full span. Every consumer (2D render, snapping, 3D) reads l.lo / l.hi.
344
+ //
345
+ // Reading the v2 map is not optional politeness: a line the model says covers one wing, drawn full
346
+ // span, is a WRONG drawing rather than an absent one.
347
+ const axisIds = (dir) => (yUp && g && Array.isArray(g.axes)) ? g.axes.filter((a) => a && a.dir === dir).map((a) => a.id) : [];
348
+ const override = (dir, i, legacy) => {
349
+ if (!yUp) return (g && g[legacy] && g[legacy][i]) || [];
350
+ const id = axisIds(dir)[i];
351
+ return (id != null && g && g.ends && g.ends[id]) || [];
352
+ };
331
353
  for (const [i, l] of v.entries()) {
332
- const o = (g && g.ends_x && g.ends_x[i]) || [];
354
+ const o = override('x', i, 'ends_x');
333
355
  l.lo = o[0] != null && isFinite(o[0]) ? +o[0] : geo.y0;
334
356
  l.hi = o[1] != null && isFinite(o[1]) ? +o[1] : geo.y1;
335
357
  }
336
358
  for (const [i, l] of h.entries()) {
337
- const o = (g && g.ends_y && g.ends_y[i]) || [];
359
+ const o = override('y', i, 'ends_y');
338
360
  l.lo = o[0] != null && isFinite(o[0]) ? +o[0] : geo.x0;
339
361
  l.hi = o[1] != null && isFinite(o[1]) ? +o[1] : geo.x1;
340
362
  }
@@ -394,16 +416,19 @@ export function gridSnapGeom(geo) {
394
416
  * Emitted PLAN-ONLY on purpose: 'grid-line' / 'grid-int' snap X/Y and keep the dragged Z, so a grid
395
417
  * can never yank a member off its elevation (candidatePoint in steel-3d-core honors that).
396
418
  */
397
- export function gridCandidates3d(g, ptPerFt) {
419
+ export function gridCandidates3d(g, ptPerFt, opts = {}) {
398
420
  if (!g || !g.on) return [];
399
- const geo = gridGeometry(g, ptPerFt);
421
+ const geo = gridGeometry(g, ptPerFt, opts);
400
422
  const k = mmPerPx(ptPerFt);
423
+ // The SAME reflection the 3D view applies to the drawn grid, and it must stay the same one or the snap
424
+ // targets sit mirrored away from the lines the user is aiming at. `yUp` (v2, world mm) means none.
425
+ const sy = opts.yUp ? k : -k;
401
426
  const out = [];
402
- for (const l of geo.v) out.push({ type: 'grid-line', a: [l.x * k, -l.hi * k, 0], b: [l.x * k, -l.lo * k, 0], fromId: 'grid-' + l.label });
403
- for (const l of geo.h) out.push({ type: 'grid-line', a: [l.lo * k, -l.y * k, 0], b: [l.hi * k, -l.y * k, 0], fromId: 'grid-' + l.label });
404
- for (const l of geo.lines || []) out.push({ type: 'grid-line', a: [l.a[0] * k, -l.a[1] * k, 0], b: [l.b[0] * k, -l.b[1] * k, 0], fromId: 'grid-line-' + l.id });
427
+ for (const l of geo.v) out.push({ type: 'grid-line', a: [l.x * k, l.hi * sy, 0], b: [l.x * k, l.lo * sy, 0], fromId: 'grid-' + l.label });
428
+ for (const l of geo.h) out.push({ type: 'grid-line', a: [l.lo * k, l.y * sy, 0], b: [l.hi * k, l.y * sy, 0], fromId: 'grid-' + l.label });
429
+ for (const l of geo.lines || []) out.push({ type: 'grid-line', a: [l.a[0] * k, l.a[1] * sy, 0], b: [l.b[0] * k, l.b[1] * sy, 0], fromId: 'grid-line-' + l.id });
405
430
  for (const a of geo.v) for (const b of geo.h) {
406
- if (b.y >= a.lo && b.y <= a.hi && a.x >= b.lo && a.x <= b.hi) out.push({ type: 'grid-int', p: [a.x * k, -b.y * k, 0], fromId: 'grid-' + a.label + '/' + b.label });
431
+ if (b.y >= a.lo && b.y <= a.hi && a.x >= b.lo && a.x <= b.hi) out.push({ type: 'grid-int', p: [a.x * k, b.y * sy, 0], fromId: 'grid-' + a.label + '/' + b.label });
407
432
  }
408
433
  return out;
409
434
  }
@@ -193,6 +193,12 @@
193
193
  <input type="file" id="ws-revision-file" accept=".pdf,image/*" multiple hidden>
194
194
  </div>
195
195
  <div class="ws-revision-card" id="ws-revision-card" hidden></div>
196
+ <!-- The v1 → v2 conversion offer (unit 5, P7e). A thin NEUTRAL gate-banner, the same register
197
+ .ws-exports-gate and .hist-working use for "there is a forward step you have not taken" —
198
+ deliberately not a card like #ws-revision-card above: that one is Drawings-scoped and
199
+ revision-shaped, and borrowing its weight for a one-time act would both misstate the
200
+ frequency and compete with an actual pending read on the same project. Model-step only. -->
201
+ <div class="ws-exports-gate ws-migrate-gate" id="ws-migrate-gate" hidden></div>
196
202
  <!-- Two lazily-srced iframes so switching steps never reloads the editor's 3D state.
197
203
  Same-origin like #contract-editor-frame (they call /api/contract directly). -->
198
204
  <iframe id="ws-frame-model" class="ws-frame" title="Project model editor" hidden></iframe>
@@ -576,6 +582,32 @@
576
582
  </div>
577
583
  </div>
578
584
 
585
+ <!-- Convert to the model (steel.takeoff/v1 → steel.model/v2, unit 5, P7e).
586
+ A SEPARATE element from #revreview-modal rather than a reuse of it: the two have different
587
+ titles, different sub-copy and materially different Confirm semantics — that one applies a
588
+ SELECTION and is legitimately clickable with nothing ticked, this one is all-or-nothing. Sharing
589
+ the element would mean one Confirm handler with two meanings. It carries `revreview` so it
590
+ inherits the whole .rev-* vocabulary (width, scroll, rows, themed checkboxes) for free, and
591
+ `migreview` carries only the genuine deltas. -->
592
+ <div class="modal-backdrop" id="migrate-modal" role="dialog" aria-modal="true" aria-labelledby="migrate-title">
593
+ <div class="modal revreview migreview">
594
+ <div class="modal-title" id="migrate-title">Convert to the 3D model</div>
595
+ <div class="modal-sub" id="migrate-sub"></div>
596
+ <div class="rev-changed" id="migrate-changed" role="status" aria-live="polite" hidden></div>
597
+ <div class="rev-counts" id="migrate-counts"></div>
598
+ <div class="revreview-body" id="migrate-body"></div>
599
+ <!-- The tick progress, separate from the counts line above it: that one says what you GET, this
600
+ one says what is left to do. Live region so the count reaches a screen reader as it moves. -->
601
+ <div class="rev-counts mig-progress" id="migrate-progress" role="status" aria-live="polite" hidden></div>
602
+ <div class="modal-actions">
603
+ <button id="migrate-cancel">Cancel</button>
604
+ <!-- Hidden outright when the conversion is refused, never shown disabled: a blocked migration
605
+ is not something you can tick past, so an inert primary button would be an invitation. -->
606
+ <button id="migrate-confirm" class="primary">Convert</button>
607
+ </div>
608
+ </div>
609
+ </div>
610
+
579
611
  <!-- Save-on-switch confirmation — shown when switching workflows with unsaved
580
612
  input changes. Reuses the shared modal styling; no new backdrop look. -->
581
613
  <div class="modal-backdrop" id="confirm-modal">
@@ -17,6 +17,17 @@ window.CONTRACT_RENDERERS = {
17
17
  editorUrl: (appId) => '/steel-editor.html?app=' + encodeURIComponent(appId),
18
18
  scene: true,
19
19
  },
20
+ // The SAME editor page, deliberately — a migrated project is the same project, and sending its owner
21
+ // to a different URL would say otherwise. What the editor then offers is narrower (P7d opens v2 for
22
+ // viewing plus the model-grid edit); that is the editor's business, not the registry's.
23
+ //
24
+ // `scene: true` because the whole export chain reads v2: `contractToScene`, `contractToAwareScene` and
25
+ // `contractToBom` all have v2 arms, and P7b wired the routes behind View 3D / Export IFC / Export BOM /
26
+ // Send to Tekla to accept an activated store's v2. Marking it false would hide a group that works.
27
+ 'steel.model/v2': {
28
+ editorUrl: (appId) => '/steel-editor.html?app=' + encodeURIComponent(appId),
29
+ scene: true,
30
+ },
20
31
  'drawing.vector/v1': {
21
32
  editorUrl: (appId) => '/vector-editor.html?app=' + encodeURIComponent(appId),
22
33
  // Local read-only 3D reconstruction viewer (views-to-scene) — NOT the AWARE exporter chain