@floless/app 0.104.2 → 0.105.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.
@@ -0,0 +1,652 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://floless.app/schemas/steel.model/v2",
4
+ "title": "steel.model/v2",
5
+ "description": "Model-level successor to steel.takeoff/v1. THE ONE CHANGE THAT MATTERS: a sheet no longer OWNS its members or its grid. Members are model-level, in WORLD MM, each carrying its own elevations; a plan is a horizontal CUT PLANE that displays members and records evidence about them; there is ONE model grid. v1 stored the same physical column once per sheet and exported the copies ~443 mm apart, because each sheet's members tracked that sheet's own grid — see docs/superpowers/specs/2026-07-18-steel-model-level-epic.md §1. INACTIVE as of unit 2: no supported path persists or opens a v2 contract (validateContract deliberately does NOT dispatch this type; see server/contract-schema.ts), so this file is the contract's definition, not yet its runtime. Objects this epic defines are CLOSED (additionalProperties:false) — unlike v1, which is deliberately open — so migration must enumerate every v1 property and report every unmapped one (§5.4).",
6
+ "type": "object",
7
+ "required": ["type", "origin", "members", "plans"],
8
+ "additionalProperties": false,
9
+ "properties": {
10
+ "type": { "const": "steel.model/v2", "description": "Renderer-registry discriminator." },
11
+ "origin": {
12
+ "enum": ["native", "migrated"],
13
+ "description": "Where this contract came from. 'migrated' REQUIRES the `migration` provenance block and permits members with provenance 'migrated'; 'native' forbids both. Without this discriminator a migrated contract could drop its provenance block and lose its v1 lineage silently. Enforced in server/steel-model-v2.ts (the validator has no conditionals)."
14
+ },
15
+ "members": {
16
+ "type": "array",
17
+ "items": { "$ref": "#/$defs/member" },
18
+ "description": "MODEL-LEVEL physical members in world mm — the v1 per-plan `plan.members` arrays collapse into this one list. Ids are model-GLOBALLY unique here (in v1 they were only sheet-unique, which is why contract-to-scene needs contractWithExportScopedMemberIds)."
19
+ },
20
+ "plans": { "type": "array", "items": { "$ref": "#/$defs/plan" }, "description": "Framing sheets, each a horizontal cut plane. A plan DISPLAYS members and records observations about them; it does not own them." },
21
+ "grid": { "$ref": "#/$defs/modelGrid", "description": "The ONE model grid, in world mm. Nullable/absent: the model grid activates with persisted v2 (epic §13), so v2 must be able to hold one before anything builds it." },
22
+ "migration": { "$ref": "#/$defs/migration", "description": "Durable v1→v2 provenance. Required when `origin` is 'migrated', forbidden when 'native'." },
23
+ "target_confidence": { "type": "number", "minimum": 0, "maximum": 100, "description": "User's per-read confidence target (%). Same meaning as v1." },
24
+ "active": { "type": "integer", "description": "Index into plans of the active sheet." },
25
+ "palette": { "type": "array", "items": { "type": "string" }, "description": "Default per-index profile colours." },
26
+ "weights": { "type": "object", "additionalProperties": { "type": ["number", "null"] }, "description": "profile -> plf, from the AISC lookup. null for an unresolved profile." },
27
+ "profile_colors": { "type": "object", "additionalProperties": { "type": "string" }, "description": "profile -> #hex user overrides." },
28
+ "member_styles": { "type": "object", "additionalProperties": true, "description": "Draft-only 2D display state: member-TYPE -> line {weight,dash}. Keyed by type, not id, so identity migration never touches it." },
29
+ "sheet_previews": { "type": "object", "additionalProperties": { "type": "string" }, "description": "sheet -> base64 JPEG full-sheet preview. CONFIDENTIAL — never committed." },
30
+ "custom_details": { "type": "object", "additionalProperties": { "type": "string" }, "description": "user-created detail name -> base64 JPEG. detailPlacement.detailName keys into this." },
31
+ "moment_frames": { "type": "array", "description": "Moment-frame schedule from the frame-elevation sheets." },
32
+ "read_notes": { "type": "array", "items": { "type": "string" }, "description": "Plain-English notes about what the read could NOT resolve. Rebuilt from source on every read." },
33
+ "detail_bubbles": { "type": "object", "additionalProperties": true, "description": "sheet -> { detail number -> normalized [fx,fy] bubble anchor }." },
34
+ "source": { "type": "object", "additionalProperties": true, "description": "Provenance: where this takeoff was read from (name/path/sheet/sha256/read_at)." },
35
+ "filter": { "type": "object", "additionalProperties": true, "description": "Layer/thickness/colour filter pre-stage, unchanged from v1. Carries no member ids and no world coordinates, so identity migration does not touch it — hence still open (epic §5.4 enumeration is scoped to the objects this epic defines)." },
36
+ "connections": { "type": "array", "items": { "type": "object", "required": ["id"], "additionalProperties": true, "properties": { "id": { "type": "string", "minLength": 1 } } }, "description": "Vendor-neutral connection library. `ends[].conn` and `joints[].conn` reference a row's `id`, so the id is required and non-empty here; every other field stays open (the library's shape is not what this epic changes)." },
37
+ "joints": { "type": "array", "items": { "$ref": "#/$defs/joint" }, "description": "Placed connections the connection engine expands into real 3D parts." },
38
+ "dims3d": { "type": "array", "items": { "$ref": "#/$defs/dim3" }, "description": "Draft-only 3D dimensions, world mm. Model-global. NOT baked into the lock / IFC / BOM." },
39
+ "detail_placements": { "type": "array", "items": { "$ref": "#/$defs/detailPlacement" }, "description": "Draft-only placed 2D detail images. Ids are SHEET-unique, not global." },
40
+ "views": { "type": "array", "items": { "$ref": "#/$defs/view" }, "description": "Draft-only saved views. Editor state, model-global. NOT baked." },
41
+ "prop_labels": { "$ref": "#/$defs/propLabels", "description": "Draft-only display state: which member properties render as text chips. CLOSED because `ids` holds member ids." },
42
+ "dim_overlays": { "type": "object", "additionalProperties": true, "description": "Draft-only per-overlay toggles (bolt_pitch, edge_clearance, …). Booleans only, no ids." },
43
+ "dim_style": { "type": "object", "additionalProperties": true, "description": "Draft-only dimension style (end/bg/place). No ids." },
44
+ "member_types": { "type": "array", "description": "User-defined member-type registry rows. No member ids." }
45
+ },
46
+ "$defs": {
47
+ "elevation": {
48
+ "description": "An endpoint elevation. Unknown is part of the TYPE, never an overloaded null: v1's null meant 'follow this plan's default_tos', which migration materializes, leaving a genuine unknown with nowhere honest to live. A member with an unknown endpoint is RETAINED and surfaced as an RFI, and REFUSES to export rather than substituting a default (epic §5.2a) — see membersBlockingExport in server/steel-model-v2.ts. `rfiRef` is optional on purpose: 'unknown' is an engineering fact while 'an RFI exists' is workflow state, and no RFI registry exists to reference — the export refusal, not the ref, is what enforces honesty.",
49
+ "oneOf": [
50
+ {
51
+ "type": "object",
52
+ "required": ["known"],
53
+ "additionalProperties": false,
54
+ "properties": { "known": { "type": "number", "description": "Elevation in world mm (Z-up), matching contract-to-scene's scene space." } }
55
+ },
56
+ {
57
+ "type": "object",
58
+ "required": ["unknown"],
59
+ "additionalProperties": false,
60
+ "properties": {
61
+ "unknown": { "const": true },
62
+ "rfiRef": { "type": "string", "minLength": 1, "description": "Optional reference to the RFI raised for this unknown. Named rfiRef, never rfi — `member.rfi` is v1's size-unresolved BOOLEAN and the collision would invite generic mishandling." }
63
+ }
64
+ }
65
+ ]
66
+ },
67
+ "workPoint": {
68
+ "type": "object",
69
+ "required": ["x", "y", "z"],
70
+ "additionalProperties": false,
71
+ "description": "A member end work-point in WORLD mm. An object rather than the repo's `point3` array because `z` is a union (see elevation); x/y stay plain numbers.",
72
+ "properties": {
73
+ "x": { "type": "number", "description": "World mm, +X." },
74
+ "y": { "type": "number", "description": "World mm, +Y. (contract-to-scene flips display Y; world coordinates here are already flipped.)" },
75
+ "z": { "$ref": "#/$defs/elevation" }
76
+ }
77
+ },
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
+ "point3": { "type": "array", "items": { "type": "number" }, "minItems": 3, "maxItems": 3, "description": "An [x,y,z] point in world mm (Z-up)." },
80
+ "member": {
81
+ "type": "object",
82
+ "required": ["id", "profile", "from", "to", "provenance"],
83
+ "additionalProperties": false,
84
+ "description": "One PHYSICAL member, world mm. Geometry is UNIFORM for every role — `from`/`to` work-points, never role-discriminated (epic §15.2): a common shape simplifies length, scene generation, IFC placement, snapping, connections and transforms, where a discriminated one would make every consumer branch. `role`/`memberType` remain AUTHORED semantic truth and are NEVER derived from geometry — vertical braces, near-vertical members and tolerance make 'column = vertical' unsafe. ENDPOINT ORDER: a `role:'column'` is stored base->top (from = base), so v1's column-level metadata has an unambiguous end; every other role keeps its authored order, because forcing low-first on beams would silently reorder sloped beams and break ends[] index correspondence, dimRef.pt and brace.lowerEnd.",
85
+ "properties": {
86
+ "id": { "type": "string", "minLength": 1, "description": "Model-GLOBALLY unique id (v1's were only sheet-unique)." },
87
+ "profile": { "type": "string", "description": "AISC designation (e.g. W16X26) or an unresolved mark (e.g. MF). Empty string allowed for an unprofiled member." },
88
+ "from": { "$ref": "#/$defs/workPoint", "description": "Start work-point. For a column this is the BASE (see the ordering rule above)." },
89
+ "to": { "$ref": "#/$defs/workPoint", "description": "End work-point. For a column this is the TOP." },
90
+ "provenance": {
91
+ "enum": ["read", "revision-read", "manual", "migrated"],
92
+ "description": "How this canonical member came to exist. A MANUALLY authored member is legal with no observation at all and carries 'manual' here — it must never be given fabricated drawing evidence to satisfy a scorer (epic §4.1). 'migrated' is only legal when the contract's `origin` is 'migrated'."
93
+ },
94
+ "material": { "type": "string", "description": "ASTM grade, e.g. A992 / A572-50 / A500. Absent = derive from the section family." },
95
+ "role": { "enum": ["beam", "column"], "description": "Authored role. Defaults to beam when absent. NOT derived from geometry." },
96
+ "memberType": { "type": "string", "description": "Member category driving the legend (beam, ledger, brace, …). 'brace' is excluded from every beam-only path." },
97
+ "position": { "enum": ["top", "middle", "bottom"], "description": "Profile placement relative to the work-line — the section's depth position." },
98
+ "rot": { "type": "number", "description": "Section rotation about the member axis, degrees. Present on real v1 contracts but never declared by the v1 schema — enumerated here so migration cannot silently drop it." },
99
+ "section": {
100
+ "type": "object",
101
+ "additionalProperties": false,
102
+ "description": "Explicit section box override (display/bake), when the profile lookup has none. Undeclared in v1, present in real contracts.",
103
+ "properties": { "w": { "type": "number" }, "d": { "type": "number" } }
104
+ },
105
+ "bf": { "type": "boolean", "description": "Bottom-flange flag. Undeclared in v1, present in real contracts." },
106
+ "rfi": { "type": "boolean", "description": "True when the SIZE is unresolved (excluded from the BOM). A boolean about the profile — unrelated to elevation.rfiRef." },
107
+ "mf": { "type": "boolean", "description": "Moment-frame member (persistent flag)." },
108
+ "verified": { "type": "boolean", "description": "True = a human confirmed this member." },
109
+ "source": {
110
+ "type": "object",
111
+ "additionalProperties": true,
112
+ "description": "How the member was created (e.g. {kind:'steel-filter-segment', layer:'S-BEAM-STEL'}). Undeclared in v1, present on 169/209 real members."
113
+ },
114
+ "brace": {
115
+ "type": "object",
116
+ "additionalProperties": false,
117
+ "description": "Brace symbology — present only when memberType is 'brace'. `floor`/`offset` are 2D-PLAN DISPLAY ONLY; the 3D bake, IFC and Tekla export always use the true work-points.",
118
+ "properties": {
119
+ "type": { "enum": ["lateral", "vertical"] },
120
+ "floor": { "enum": ["above", "below"] },
121
+ "offset": { "type": "number", "description": "Signed perpendicular distance (INCHES) from the work-line to the DRAWN symbol line. Display-only." },
122
+ "lowerEnd": { "enum": [0, 1], "description": "Optional override of which work-point is the lower (double-arrowhead) end." }
123
+ }
124
+ },
125
+ "ends": {
126
+ "type": "array",
127
+ "items": { "$ref": "#/$defs/end" },
128
+ "minItems": 2,
129
+ "maxItems": 2,
130
+ "description": "Per-end CONNECTION metadata; index 0 matches `from`, index 1 matches `to`. Uniform across roles — v1's separate `col` object is gone, and for a column ends[0] is the base by the ordering rule. Elevations are NOT here: they live in from.z / to.z."
131
+ }
132
+ }
133
+ },
134
+ "end": {
135
+ "type": "object",
136
+ "additionalProperties": false,
137
+ "description": "One end's connection metadata. v1's `tos` / `tosDef` are absent by design — elevation moved into the work-point, so there is no second place for it to disagree.",
138
+ "properties": {
139
+ "note": { "type": "string", "description": "Connection note (e.g. moment, shear, braced)." },
140
+ "detail": { "type": "string", "description": "Connection detail reference, e.g. \"5-S504\"." },
141
+ "conn": { "type": "string", "minLength": 1, "description": "Connection-library row id (references connections[].id). Absent = fall back to note/detail (v1 used an empty string for this; v2 requires the key to be absent, so a present ref always means something)." },
142
+ "connVerified": { "type": "boolean", "description": "True = a human confirmed this end's connection." }
143
+ }
144
+ },
145
+ "plan": {
146
+ "type": "object",
147
+ "required": ["sheet"],
148
+ "additionalProperties": false,
149
+ "description": "One framing sheet, as a horizontal CUT PLANE. It no longer owns members: `elevation_in` fixes it in height, the authored controls fix it in plan, `memberObservations` records what its drawing actually showed, and `memberRefs` assigns presentation for members it displays but never observed. Ownership and observation are different things and only ownership disappears (epic §4) — a sheet whose drawing supplied 2 column observations must still DISPLAY the 20 columns crossing its elevation.",
150
+ "properties": {
151
+ "sheet": { "type": "string", "minLength": 1, "description": "Sheet number, e.g. S-202. Unique across plans." },
152
+ "title": { "type": "string" },
153
+ "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
+ "pt_per_ft": { "type": "number", "description": "Display points per foot (the drawing scale). Still needed: observations record local geometry in display px." },
155
+ "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." },
157
+ "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." },
159
+ "clip": { "type": "array", "items": { "type": "number" }, "minItems": 4, "maxItems": 4, "description": "[x0,y0,x1,y1] display-space crop of the framing area." },
160
+ "raster_b64": { "type": "string", "description": "Base64 raster of the framing area. CONFIDENTIAL — never committed." },
161
+ "segments": { "type": "array", "items": { "type": "object", "additionalProperties": true } },
162
+ "labels": { "type": "array", "items": { "type": "object", "additionalProperties": true } },
163
+ "details": { "type": "array", "items": { "type": "object", "additionalProperties": true } },
164
+ "callouts": { "type": "array", "items": { "type": "object", "additionalProperties": true }, "description": "Drawing cross-references drawn ON this plan that point to another sheet." },
165
+ "tos_callouts": { "type": "array", "items": { "type": "object", "additionalProperties": true } },
166
+ "read_notes": { "type": "array", "items": { "type": "string" }, "description": "Per-sheet read notes. Undeclared in v1, present in real contracts." },
167
+ "autofilled": { "type": "boolean", "description": "The reader auto-filled blank ends on this sheet. Undeclared in v1, present in real contracts." },
168
+ "deduped": { "type": "boolean", "description": "The editor's first-load de-duplication has run on this sheet. Undeclared in v1, present in real contracts." },
169
+ "dims": { "type": "array", "items": { "$ref": "#/$defs/dim" }, "description": "Draft-only on-drawing dimensions. Coordinates stay LOCAL to this sheet (epic §10); only the member and grid REFERENCES are remapped." },
170
+ "frame": { "$ref": "#/$defs/frame", "description": "Optional per-plan local coordinate frame for skewed framing. Local coordinates, retained as-is." },
171
+ "memberObservations": { "type": "array", "items": { "$ref": "#/$defs/memberObservation" }, "description": "What THIS sheet's drawing showed about members. Evidence, not ownership." },
172
+ "memberRefs": { "type": "array", "items": { "type": "string", "minLength": 1 }, "description": "Explicit presentation assignment: member ids this sheet displays without having observed them (manual/unobserved members). Observations imply presentation on their own source sheet; beams and braces are NEVER projected by proximity — 'nearest sheet' changes when sheets are added and can be structurally false (epic §5.3)." }
173
+ }
174
+ },
175
+ "memberObservation": {
176
+ "type": "object",
177
+ "required": ["id", "evidence", "binding"],
178
+ "additionalProperties": false,
179
+ "description": "One sheet's evidence about a member. SPLIT IN TWO ON PURPOSE: `evidence` is written once at read time and never rewritten, `binding` is the only mutable part. That makes epic §5.2's 'evidence is immutable' a SHAPE rather than a promise — a canonical edit cannot silently rewrite the historical trace that supposedly proves it, a split binds one observation to both results without cloning evidence, a merge rebinds to the survivor, and a delete archives to zero bindings instead of leaving a dangling ref. A re-read mints a NEW observation carrying `supersedes`; it never edits old evidence in place.",
180
+ "properties": {
181
+ "id": { "type": "string", "minLength": 1, "description": "Stable observation id, unique model-wide." },
182
+ "evidence": { "$ref": "#/$defs/observationEvidence" },
183
+ "binding": { "$ref": "#/$defs/observationBinding" }
184
+ }
185
+ },
186
+ "observationEvidence": {
187
+ "type": "object",
188
+ "required": ["source", "local", "provenance"],
189
+ "additionalProperties": false,
190
+ "description": "IMMUTABLE. Written once when the observation is read; nothing in the canonical lifecycle rewrites it.",
191
+ "properties": {
192
+ "source": { "$ref": "#/$defs/observationSource" },
193
+ "local": {
194
+ "type": "object",
195
+ "required": ["wp", "pt_per_ft"],
196
+ "additionalProperties": false,
197
+ "description": "The observed geometry AND ITS UNITS — display px plus the sheet scale needed to interpret them. Recording px without the scale is what made v1 geometry un-relocatable.",
198
+ "properties": {
199
+ "wp": { "type": "array", "items": { "$ref": "#/$defs/point2" }, "minItems": 2, "maxItems": 2, "description": "Work-point endpoints in THIS sheet's display space." },
200
+ "pt_per_ft": { "type": "number", "exclusiveMinimum": 0, "description": "The sheet scale the px above are measured in." }
201
+ }
202
+ },
203
+ "provenance": { "enum": ["auto-read", "revision-read", "manual"], "description": "How this evidence was produced." },
204
+ "observed": {
205
+ "type": "object",
206
+ "additionalProperties": false,
207
+ "description": "What the drawing showed, PER FIELD, each with its own confidence. Value and confidence are one object so they cannot drift apart. Never average observations across sheets: many weak traces must not dilute a strong one, and ten agreeing weak traces must not manufacture certainty (epic §4.1).",
208
+ "properties": {
209
+ "role": { "$ref": "#/$defs/observedField" },
210
+ "profile": { "$ref": "#/$defs/observedField" },
211
+ "mark": { "$ref": "#/$defs/observedField" },
212
+ "memberType": { "$ref": "#/$defs/observedField" },
213
+ "material": { "$ref": "#/$defs/observedField" },
214
+ "fromZ": { "$ref": "#/$defs/observedElevationField" },
215
+ "toZ": { "$ref": "#/$defs/observedElevationField" }
216
+ }
217
+ },
218
+ "supersedes": {
219
+ "type": "array",
220
+ "items": { "type": "string", "minLength": 1 },
221
+ "description": "Observation ids this re-read supersedes. Lives in EVIDENCE, not binding: a re-read's ancestry is a historical fact recorded once, not mutable lifecycle state."
222
+ }
223
+ }
224
+ },
225
+ "observedField": {
226
+ "type": "object",
227
+ "required": ["value", "confidence"],
228
+ "additionalProperties": false,
229
+ "properties": {
230
+ "value": { "type": "string", "description": "The observed value as read." },
231
+ "confidence": { "type": "number", "minimum": 0, "maximum": 100, "description": "Per-field confidence, 0-100 — the same scale as target_confidence." }
232
+ }
233
+ },
234
+ "observedElevationField": {
235
+ "type": "object",
236
+ "required": ["value", "confidence"],
237
+ "additionalProperties": false,
238
+ "properties": {
239
+ "value": { "$ref": "#/$defs/elevation", "description": "Observed elevation, WORLD MM — the same unit as canonical geometry, so no consumer has to guess whether an observation is in inches, px or mm." },
240
+ "confidence": { "type": "number", "minimum": 0, "maximum": 100 }
241
+ }
242
+ },
243
+ "observationSource": {
244
+ "description": "Where the evidence came from. THREE non-overlapping locator forms, because filter elements do not consistently carry ids today (the revision fixture contains un-id'd line elements): NEW reads mint a stable `elementId`; LEGACY evidence pins position + geometry hash instead; and a MIGRATED record, whose evidence is a v1 contract record rather than a drawing element, uses the `contractHash` form. Exactly one form — a locator-less {sourceHash, sheet} would be evidence pointing at nothing. Note the namespaces do not mix: the first two are DRAWING locators keyed by `sourceHash`, the third is a CONTRACT locator keyed by `contractHash`, and combining fields across them would produce a locator whose parts reference different sources.",
245
+ "oneOf": [
246
+ {
247
+ "type": "object",
248
+ "required": ["sourceHash", "sheet", "elementId"],
249
+ "additionalProperties": false,
250
+ "properties": {
251
+ "sourceHash": { "type": "string", "minLength": 1, "description": "Hash of the source document this was read from." },
252
+ "sheet": { "type": "string", "minLength": 1, "description": "Sheet the evidence was read from. Must equal the owning plan's `sheet`." },
253
+ "elementId": { "type": "string", "minLength": 1, "description": "Stable source element id (new reads)." }
254
+ }
255
+ },
256
+ {
257
+ "type": "object",
258
+ "required": ["sourceHash", "sheet", "elementIndex", "geometryHash"],
259
+ "additionalProperties": false,
260
+ "properties": {
261
+ "sourceHash": { "type": "string", "minLength": 1 },
262
+ "sheet": { "type": "string", "minLength": 1 },
263
+ "elementIndex": { "type": "integer", "minimum": 0, "description": "Position in the source sheet's element list (legacy, un-id'd elements)." },
264
+ "geometryHash": { "type": "string", "minLength": 1, "description": "Hash of the element geometry, so a re-ordered element list is detectable." }
265
+ }
266
+ },
267
+ {
268
+ "type": "object",
269
+ "required": ["contractHash", "sheet", "recordId", "geometryHash"],
270
+ "additionalProperties": false,
271
+ "description": "MIGRATED evidence: a v1 contract record, not a drawing element. A migrated member has no known position in the source sheet's element list, so neither drawing form fits — using `elementIndex` for the record's ordinal would put an unrelated number in a field defined as a filter-element position, and stuffing a prefixed value into `elementId` would pair a contract identity with a drawing `sourceHash`. Re-binding these to real source elements is a later unit's job; until then this form states plainly that the evidence is a contract record.",
272
+ "properties": {
273
+ "contractHash": { "type": "string", "minLength": 1, "description": "Canonical hash of the v1 document this record came from (the same value as `migration.from.hash`)." },
274
+ "sheet": { "type": "string", "minLength": 1, "description": "Plan the record lived on. Must equal the owning plan's `sheet`." },
275
+ "recordId": { "type": "string", "minLength": 1, "description": "The v1 member record's id, sheet-scoped by `sheet` above." },
276
+ "geometryHash": { "type": "string", "minLength": 1, "description": "Hash of the record's work points, so an edited record is detectable." }
277
+ }
278
+ }
279
+ ]
280
+ },
281
+ "observationBinding": {
282
+ "type": "object",
283
+ "required": ["memberIds", "status"],
284
+ "additionalProperties": false,
285
+ "description": "MUTABLE. The only part the canonical lifecycle rewrites. Cardinality is tied to status and is CHECKED (server/steel-model-v2.ts): active needs at least one binding; archived needs exactly zero, which is how a deleted member's evidence survives as audit provenance instead of a dangling ref; superseded may carry any number, since epic §5.2 makes it non-scoring UNTIL explicitly rebound.",
286
+ "properties": {
287
+ "memberIds": {
288
+ "type": "array",
289
+ "items": { "type": "string", "minLength": 1 },
290
+ "description": "Canonical members this evidence is bound to, 0..n. Plural because a SPLIT rebinds one observation to both results without cloning its evidence."
291
+ },
292
+ "status": { "enum": ["active", "superseded", "archived"] },
293
+ "verified": { "type": "boolean", "description": "True = a human confirmed this trace against its source." }
294
+ }
295
+ },
296
+ "modelGrid": {
297
+ "type": ["object", "null"],
298
+ "additionalProperties": false,
299
+ "description": "THE model grid — one, in world mm, displayed on every sheet. v1 had one grid PER PLAN in that plan's display space, which is half of why sheets were never registered to a common frame. Authoring notation is unchanged (relative X/Y spacing strings, absolute Z levels; web/grid-core.js is the parser source of truth), but every coordinate here is world mm.",
300
+ "properties": {
301
+ "on": { "type": "boolean", "description": "Grid visible (2D + 3D). Default true." },
302
+ "origin": { "$ref": "#/$defs/point2", "description": "The [1,A] corner in WORLD MM (v1's was display space)." },
303
+ "x": { "type": "string", "description": "Relative spacings along +X, comma-separated, e.g. \"0'-0\\\", 3*25'-0\\\"\"." },
304
+ "y": { "type": "string", "description": "Relative spacings along +Y, comma-separated." },
305
+ "z": { "type": "string", "description": "Absolute level elevations, comma-separated." },
306
+ "labels_x": { "type": "string", "description": "Whitespace-separated label overrides for X lines; blank = auto 1,2,3…" },
307
+ "labels_y": { "type": "string", "description": "Whitespace-separated label overrides for Y lines; blank = auto A,B,C…" },
308
+ "labels_z": { "type": "array", "items": { "type": "string", "maxLength": 40 }, "description": "Editable level labels aligned to the authored Z entries." },
309
+ "hidden_z": { "type": "array", "items": { "type": "number" }, "description": "Canonical level elevations, in MM, whose grid plane and tag are hidden in 3D." },
310
+ "ext": { "type": "number", "description": "How far lines run past the outermost line, in MM." },
311
+ "axes": {
312
+ "type": "array",
313
+ "items": { "$ref": "#/$defs/gridAxis" },
314
+ "description": "STABLE ids for the parsed axes, in authored order per direction. v1 referenced axes as 'gv:<i>'/'gh:<i>' — index-based, so an insert or re-space changed what a reference meant (v1's own dimRef doc calls out the resulting safe-freeze). A canonical grid cannot be referenced that way. `dir:'z'` covers LEVELS by the same mechanism, so a generated level view references an id rather than a mutable label."
315
+ },
316
+ "ends": {
317
+ "type": "object",
318
+ "additionalProperties": { "type": "array", "items": { "type": "number" }, "minItems": 2, "maxItems": 2 },
319
+ "description": "Per-axis extent overrides: { \"<axis id>\": [loMm, hiMm] } in WORLD MM. Replaces v1's ends_x/ends_y, which held display PIXELS — meaningless on a model-global grid that has no owning plan scale."
320
+ },
321
+ "lines": { "type": "array", "items": { "$ref": "#/$defs/gridLine" }, "description": "Standalone free-angle grid/reference lines, world mm." }
322
+ }
323
+ },
324
+ "gridAxis": {
325
+ "type": "object",
326
+ "required": ["id", "dir"],
327
+ "additionalProperties": false,
328
+ "properties": {
329
+ "id": { "type": "string", "minLength": 1, "description": "Stable axis id, unique across axes AND lines." },
330
+ "dir": { "enum": ["x", "y", "z"], "description": "Which authored string this axis was parsed from. 'z' = a level." },
331
+ "label": { "type": "string", "maxLength": 40, "description": "Display text. NOT an identity — it is editable." }
332
+ }
333
+ },
334
+ "gridLine": {
335
+ "type": "object",
336
+ "required": ["id", "label", "a", "b"],
337
+ "additionalProperties": false,
338
+ "description": "One standalone grid/reference line, including skewed or partial lines outside the orthogonal X/Y family. World mm.",
339
+ "properties": {
340
+ "id": { "type": "string", "minLength": 1 },
341
+ "label": { "type": "string", "description": "Bubble text shown at both ends." },
342
+ "a": { "$ref": "#/$defs/point2", "description": "First endpoint, world mm." },
343
+ "b": { "$ref": "#/$defs/point2", "description": "Second endpoint, world mm." }
344
+ }
345
+ },
346
+ "frame": {
347
+ "type": ["object", "null"],
348
+ "required": ["o", "u"],
349
+ "additionalProperties": false,
350
+ "description": "Optional per-plan local coordinate frame for skewed framing, in that plan's DISPLAY space (epic §10 keeps plan frame/dims local). Affects only editor ortho-snapping + X/Y dimensions.",
351
+ "properties": {
352
+ "o": { "$ref": "#/$defs/point2", "description": "Frame origin, display space." },
353
+ "u": { "$ref": "#/$defs/point2", "description": "Unit local-X direction. Local-Y = [uy,-ux]." }
354
+ }
355
+ },
356
+ "dim": {
357
+ "type": "object",
358
+ "required": ["id", "a", "b", "axis", "off"],
359
+ "additionalProperties": false,
360
+ "description": "One on-drawing dimension. Coordinates stay in the owning plan's DISPLAY space; only its references are model-wide.",
361
+ "properties": {
362
+ "id": { "type": "string", "minLength": 1 },
363
+ "a": { "$ref": "#/$defs/point2", "description": "First snapped anchor, display space." },
364
+ "b": { "$ref": "#/$defs/point2", "description": "Second snapped anchor, display space." },
365
+ "axis": { "enum": ["free", "x", "y"] },
366
+ "off": { "type": "number", "description": "Dimension-line offset in the dim's own (rot-rotated) frame." },
367
+ "rot": { "type": "number", "description": "Local-frame bearing (radians) baked at creation." },
368
+ "aRef": { "$ref": "#/$defs/dimRef", "description": "Magnetic dim: optional link from anchor a to a member work-point or a grid axis." },
369
+ "bRef": { "$ref": "#/$defs/dimRef", "description": "As aRef, for anchor b." },
370
+ "pin": { "type": "boolean", "description": "false = the link is DORMANT (user unpinned it); absent/true = magnetic." }
371
+ }
372
+ },
373
+ "dimRef": {
374
+ "description": "One of TWO shapes — a MEMBER ref {m, pt} or a GRID ref {g}. v1 could not express this as a union (its `oneOf` support post-dates that schema) and left both keys optional, pushing the real invariant into an editor-side sanitizer; v2 states it.",
375
+ "oneOf": [
376
+ {
377
+ "type": "object",
378
+ "required": ["m", "pt"],
379
+ "additionalProperties": false,
380
+ "properties": {
381
+ "m": { "type": "string", "minLength": 1, "description": "A MODEL-WIDE member id (v1's was same-plan-only, because ids were sheet-scoped)." },
382
+ "pt": { "enum": ["a", "b", "mid"], "description": "Which of the member's drawn points the anchor tracks." }
383
+ }
384
+ },
385
+ {
386
+ "type": "object",
387
+ "required": ["g"],
388
+ "additionalProperties": false,
389
+ "properties": { "g": { "type": "string", "minLength": 1, "description": "A STABLE grid id — grid.axes[].id or grid.lines[].id, never an index-derived 'gv:<i>'." } }
390
+ }
391
+ ]
392
+ },
393
+ "dim3": {
394
+ "type": "object",
395
+ "required": ["id", "a", "b", "axis"],
396
+ "additionalProperties": false,
397
+ "description": "Draft-only 3D dimension, world mm. Ownerless — epic §10 requires migration to assign it a frame, confirm keep-as-world, or block.",
398
+ "properties": {
399
+ "id": { "type": "string", "minLength": 1 },
400
+ "a": { "$ref": "#/$defs/point3" },
401
+ "b": { "$ref": "#/$defs/point3" },
402
+ "axis": { "enum": ["free", "x", "y", "z"] },
403
+ "axisDir": { "type": "array", "items": { "type": "number" }, "minItems": 3, "maxItems": 3, "description": "Optional world direction an x|y measurement runs along; normalized on read." }
404
+ }
405
+ },
406
+ "joint": {
407
+ "type": "object",
408
+ "required": ["id", "kind"],
409
+ "additionalProperties": false,
410
+ "description": "A placed connection the engine expands into real 3D parts. `main` is required for the parametric RECIPE kinds and optional for 'custom' — an imported connection carries its own geometry and `place`, which makes free-air customs the one legal exported free-floating world-space record (epic §9). The validator cannot express that conditional (it ignores allOf/if/then entirely), so server/steel-model-v2.ts enforces it.",
411
+ "properties": {
412
+ "id": { "type": "string", "minLength": 1 },
413
+ "kind": { "type": "string", "minLength": 1, "description": "base-plate, shear-plate (parametric recipes) or custom (imported IFC geometry)." },
414
+ "main": { "type": "string", "minLength": 1, "description": "Host member id. Required unless kind is 'custom'." },
415
+ "secondaries": { "type": "array", "items": { "type": "string", "minLength": 1 }, "description": "Other member ids this joint binds." },
416
+ "at": { "type": "string", "description": "Where on the main member the joint sits (base | end0 | end1)." },
417
+ "conn": { "type": "string", "minLength": 1, "description": "Optional connections[] row id this joint cites." },
418
+ "params": { "type": "object", "additionalProperties": true, "description": "Geometry settings (mm) with engine defaults. Open: engine-owned, carries no ids." },
419
+ "source": { "enum": ["auto", "user"] },
420
+ "verified": { "type": "boolean" },
421
+ "name": { "type": "string", "description": "custom only: display label carried from the source IFC." },
422
+ "place": { "$ref": "#/$defs/point3", "description": "custom only: the world-mm point the LOCAL geometry is translated by." },
423
+ "geometry": { "type": "array", "items": { "type": "object", "additionalProperties": true }, "description": "custom only: imported mesh parts in the connection's LOCAL mm frame. Shape is AWARE-owned (connection-reader `extract`), so it stays open here." }
424
+ }
425
+ },
426
+ "detailPlacement": {
427
+ "type": "object",
428
+ "required": ["id", "sheet"],
429
+ "additionalProperties": false,
430
+ "description": "A placed 2D detail image. `id` is SHEET-unique, not model-global — uniqueness is checked as (sheet, id), and a detail reference carries both.",
431
+ "properties": {
432
+ "id": { "type": "string", "minLength": 1 },
433
+ "detailName": { "type": "string", "minLength": 1, "description": "Key into custom_details for the image bytes." },
434
+ "sheet": { "type": "string", "minLength": 1, "description": "Sheet the detail was placed against. REQUIRED: placement ids are sheet-unique, so a placement with no sheet cannot be referenced by a detail sceneRef." },
435
+ "anchorId": { "type": ["string", "null"], "minLength": 1, "description": "Host MEMBER id, or null (free placement). Restricted to members in v2: every consumer already resolves it against the member list, so a member id is what it has always meant. Migration must BLOCK a legacy anchor that resolves to nothing rather than carry it forward." },
436
+ "pos": { "$ref": "#/$defs/point3", "description": "World mm centre of the plane. Epic §10: recomputed from the transformed anchor when anchored; an UNANCHORED placement blocks migration until a frame is assigned or world coordinates are confirmed." },
437
+ "u": { "$ref": "#/$defs/point3", "description": "In-plane x-axis basis." },
438
+ "n": { "$ref": "#/$defs/point3", "description": "Plane-normal basis." },
439
+ "rotZ": { "type": "number" },
440
+ "size": { "type": "number", "description": "Plane width in mm." },
441
+ "opacity": { "type": "number", "minimum": 0, "maximum": 1 }
442
+ }
443
+ },
444
+ "sceneRef": {
445
+ "description": "A TAGGED reference to something shown in the 3D scene. v1 stored raw renderer mesh ids here — `${joint.id}:${part}` for connection parts, `det:<placementId>` for details, bare ids for members — which are neither member nor joint ids and freeze renderer implementation detail into contract truth. Tagging costs nothing now (v2 cannot be opened, so no renderer changes) and lets unit 4's adapter translate to runtime ids.",
446
+ "oneOf": [
447
+ { "type": "object", "required": ["kind", "id"], "additionalProperties": false, "properties": { "kind": { "const": "member" }, "id": { "type": "string", "minLength": 1 } } },
448
+ { "type": "object", "required": ["kind", "id", "part"], "additionalProperties": false, "properties": { "kind": { "const": "joint-part" }, "id": { "type": "string", "minLength": 1, "description": "Joint id." }, "part": { "type": "string", "minLength": 1, "description": "Part within the joint (a recipe part name, or a custom mesh part id)." } } },
449
+ { "type": "object", "required": ["kind", "sheet", "id"], "additionalProperties": false, "properties": { "kind": { "const": "detail" }, "sheet": { "type": "string", "minLength": 1 }, "id": { "type": "string", "minLength": 1, "description": "Detail-placement id — sheet-unique, hence the sheet." } } }
450
+ ]
451
+ },
452
+ "jointPartRef": {
453
+ "type": "object",
454
+ "required": ["kind", "id", "part"],
455
+ "additionalProperties": false,
456
+ "description": "A sceneRef narrowed to a connection part — the only kind a per-part connection hide can meaningfully name.",
457
+ "properties": { "kind": { "const": "joint-part" }, "id": { "type": "string", "minLength": 1 }, "part": { "type": "string", "minLength": 1 } }
458
+ },
459
+ "view": {
460
+ "type": "object",
461
+ "required": ["id", "name"],
462
+ "additionalProperties": false,
463
+ "description": "One saved 3D view. Draft-only editor state, model-global, NOT baked.",
464
+ "properties": {
465
+ "v": { "type": "integer" },
466
+ "id": { "type": "string", "minLength": 1 },
467
+ "name": { "type": "string" },
468
+ "order": { "type": "number" },
469
+ "camera": { "$ref": "#/$defs/viewCamera" },
470
+ "mode": { "enum": ["solid", "wire", "xray"] },
471
+ "clips": { "$ref": "#/$defs/viewClips" },
472
+ "objects": { "$ref": "#/$defs/viewObjects" },
473
+ "generated": { "$ref": "#/$defs/viewGenerated" }
474
+ }
475
+ },
476
+ "viewCamera": {
477
+ "type": "object",
478
+ "additionalProperties": false,
479
+ "description": "Camera snapshot, world mm. v1 also stored a separate `view.projection`; v2 drops it because the runtime treats `camera.proj` as authoritative whenever a camera exists — two homes for one fact is one home too many.",
480
+ "properties": {
481
+ "v": { "type": "integer" },
482
+ "pos": { "$ref": "#/$defs/point3" },
483
+ "target": { "$ref": "#/$defs/point3" },
484
+ "proj": { "enum": ["persp", "ortho"] },
485
+ "orthoH": { "type": "number" },
486
+ "zoom": { "type": "number" }
487
+ }
488
+ },
489
+ "viewClips": {
490
+ "type": "object",
491
+ "additionalProperties": false,
492
+ "description": "Clip boxes/planes + work area, world mm. Epic §10 requires migration to assign these a frame, confirm keep-as-world, or discard them — they are world coordinates in the OLD accidental scene frame.",
493
+ "properties": {
494
+ "clips": { "type": "array", "items": { "oneOf": [{ "$ref": "#/$defs/clipBox" }, { "$ref": "#/$defs/clipPlane" }] } },
495
+ "workArea": { "$ref": "#/$defs/workArea" },
496
+ "selected": { "type": "array", "items": { "type": "string", "minLength": 1 }, "description": "Selected clip ids." },
497
+ "seq": { "type": "number" }
498
+ }
499
+ },
500
+ "clipBox": {
501
+ "type": "object",
502
+ "required": ["id", "kind", "box"],
503
+ "additionalProperties": false,
504
+ "properties": {
505
+ "id": { "type": "string", "minLength": 1 },
506
+ "kind": { "const": "box" },
507
+ "enabled": { "type": "boolean" },
508
+ "label": { "type": "string" },
509
+ "box": { "$ref": "#/$defs/boundsBox" }
510
+ }
511
+ },
512
+ "clipPlane": {
513
+ "type": "object",
514
+ "required": ["id", "kind", "n", "point"],
515
+ "additionalProperties": false,
516
+ "properties": {
517
+ "id": { "type": "string", "minLength": 1 },
518
+ "kind": { "const": "plane" },
519
+ "enabled": { "type": "boolean" },
520
+ "label": { "type": "string" },
521
+ "n": { "$ref": "#/$defs/point3", "description": "Plane normal." },
522
+ "point": { "$ref": "#/$defs/point3", "description": "A point on the plane, world mm." }
523
+ }
524
+ },
525
+ "workArea": {
526
+ "type": ["object", "null"],
527
+ "required": ["box"],
528
+ "additionalProperties": false,
529
+ "description": "Nullable — the serializer emits null when there is no work area.",
530
+ "properties": {
531
+ "enabled": { "type": "boolean" },
532
+ "whole": { "type": "boolean" },
533
+ "box": { "$ref": "#/$defs/boundsBox" }
534
+ }
535
+ },
536
+ "boundsBox": {
537
+ "type": "object",
538
+ "required": ["min", "max"],
539
+ "additionalProperties": false,
540
+ "properties": { "min": { "$ref": "#/$defs/point3" }, "max": { "$ref": "#/$defs/point3" } }
541
+ },
542
+ "viewObjects": {
543
+ "type": "object",
544
+ "additionalProperties": false,
545
+ "description": "The objects-pane's persistent visibility state. NOTE the two different namespaces: `hidden`/`solo` are profile/legend GROUP KEYS (not ids, and deliberately not reference-checked), while `isolated`/`connHidden` are references and are tagged.",
546
+ "properties": {
547
+ "v": { "type": "integer" },
548
+ "hidden": { "type": "array", "items": { "type": "string" }, "description": "Profile/legend group keys hidden via the legend." },
549
+ "solo": { "type": "array", "items": { "type": "string" }, "description": "Profile/legend group keys isolated via the legend." },
550
+ "isolated": { "type": ["array", "null"], "items": { "$ref": "#/$defs/sceneRef" }, "description": "Isolate-selected set, or null for off." },
551
+ "connHidden": { "type": "array", "items": { "$ref": "#/$defs/jointPartRef" }, "description": "Explicit per-PART connection hides." }
552
+ }
553
+ },
554
+ "viewGenerated": {
555
+ "description": "Provenance for an F11-generated grid elevation or level plan, so its cut depths stay editable. References the grid by STABLE AXIS ID; `label` and `at` are display text and a cache, not identity.",
556
+ "oneOf": [
557
+ {
558
+ "type": "object",
559
+ "required": ["v", "kind", "sheet", "axisId", "at", "look", "ahead", "behind"],
560
+ "additionalProperties": false,
561
+ "properties": {
562
+ "v": { "const": 1 },
563
+ "kind": { "enum": ["grid-x", "grid-y"] },
564
+ "sheet": { "type": "string", "minLength": 1 },
565
+ "axisId": { "type": "string", "minLength": 1, "description": "grid.axes[].id of the matching direction." },
566
+ "label": { "type": "string", "description": "Display text cache." },
567
+ "at": { "type": "number" },
568
+ "look": { "enum": ["positive", "negative"] },
569
+ "ahead": { "type": "number", "exclusiveMinimum": 0 },
570
+ "behind": { "type": "number", "exclusiveMinimum": 0 }
571
+ }
572
+ },
573
+ {
574
+ "type": "object",
575
+ "required": ["v", "kind", "sheet", "axisId", "at", "look", "above", "below"],
576
+ "additionalProperties": false,
577
+ "properties": {
578
+ "v": { "const": 1 },
579
+ "kind": { "const": "level" },
580
+ "sheet": { "type": "string", "minLength": 1 },
581
+ "axisId": { "type": "string", "minLength": 1, "description": "grid.axes[].id with dir 'z'." },
582
+ "label": { "type": "string" },
583
+ "at": { "type": "number" },
584
+ "look": { "const": "down" },
585
+ "above": { "type": "number", "exclusiveMinimum": 0 },
586
+ "below": { "type": "number", "exclusiveMinimum": 0 }
587
+ }
588
+ }
589
+ ]
590
+ },
591
+ "propLabels": {
592
+ "type": "object",
593
+ "additionalProperties": false,
594
+ "description": "Draft-only display state. CLOSED because `ids` holds member ids that identity migration must remap.",
595
+ "properties": {
596
+ "props": { "type": "array", "items": { "type": "string" }, "description": "Checked property registry keys to show as labels." },
597
+ "placement": { "enum": ["start", "mid", "end"] },
598
+ "selected_only": { "type": "boolean" },
599
+ "ids": { "type": "array", "items": { "type": "string", "minLength": 1 }, "description": "Member ids the labels pin to, used only when selected_only is true." }
600
+ }
601
+ },
602
+ "migration": {
603
+ "type": "object",
604
+ "required": ["v", "from", "members"],
605
+ "additionalProperties": false,
606
+ "description": "DURABLE v1->v2 provenance (epic §9) — not a migration-time variable. It must support arbitrary v1<->v2 version comparisons, and rolling a migrated project back to a historical v1 version and migrating it again. Keyed by (sheet, id) because bare v1 ids are not globally unique.",
607
+ "properties": {
608
+ "v": { "const": 1 },
609
+ "from": {
610
+ "type": "object",
611
+ "required": ["type"],
612
+ "additionalProperties": false,
613
+ "description": "The source contract this was migrated from.",
614
+ "properties": {
615
+ "type": { "type": "string", "minLength": 1, "description": "e.g. steel.takeoff/v1." },
616
+ "hash": { "type": "string", "description": "Hash of the source document." },
617
+ "version": { "type": "string", "description": "Project history version the source came from." }
618
+ }
619
+ },
620
+ "members": {
621
+ "type": "array",
622
+ "description": "(v1 sheet, v1 id) -> v2 member id.",
623
+ "items": {
624
+ "type": "object",
625
+ "required": ["sheet", "id", "memberId"],
626
+ "additionalProperties": false,
627
+ "properties": {
628
+ "sheet": { "type": "string", "minLength": 1 },
629
+ "id": { "type": "string", "minLength": 1 },
630
+ "memberId": { "type": "string", "minLength": 1 }
631
+ }
632
+ }
633
+ },
634
+ "retired": {
635
+ "type": "array",
636
+ "description": "v1 members that did NOT survive (de-duplicated into a survivor, or deleted). Disjoint from `members`.",
637
+ "items": {
638
+ "type": "object",
639
+ "required": ["sheet", "id"],
640
+ "additionalProperties": false,
641
+ "properties": {
642
+ "sheet": { "type": "string", "minLength": 1 },
643
+ "id": { "type": "string", "minLength": 1 },
644
+ "reason": { "type": "string" }
645
+ }
646
+ }
647
+ },
648
+ "remigratedFrom": { "type": "string", "description": "The prior v2 version this contract was re-migrated from, when a project was rolled back to v1 and migrated again." }
649
+ }
650
+ }
651
+ }
652
+ }