@floless/app 0.116.0 → 0.117.1

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,263 @@
1
+ {
2
+ "schemaId": "https://floless.app/schemas/steel.takeoff/v1",
3
+ "propertyPaths": [
4
+ "$.$defs.callout.properties.disp",
5
+ "$.$defs.callout.properties.kind",
6
+ "$.$defs.callout.properties.target",
7
+ "$.$defs.callout.properties.target.properties.number",
8
+ "$.$defs.callout.properties.target.properties.sheet",
9
+ "$.$defs.callout.properties.text",
10
+ "$.$defs.col.properties.bos",
11
+ "$.$defs.col.properties.conn",
12
+ "$.$defs.col.properties.connVerified",
13
+ "$.$defs.col.properties.detail",
14
+ "$.$defs.col.properties.note",
15
+ "$.$defs.col.properties.tos",
16
+ "$.$defs.connection.properties.detail",
17
+ "$.$defs.connection.properties.id",
18
+ "$.$defs.connection.properties.image",
19
+ "$.$defs.connection.properties.notes",
20
+ "$.$defs.connection.properties.notes.items.properties.source",
21
+ "$.$defs.connection.properties.notes.items.properties.text",
22
+ "$.$defs.connection.properties.recipe",
23
+ "$.$defs.connection.properties.source",
24
+ "$.$defs.connection.properties.targets",
25
+ "$.$defs.connection.properties.type",
26
+ "$.$defs.connectionRecipe.properties.kind",
27
+ "$.$defs.connectionRecipe.properties.params",
28
+ "$.$defs.connectionRecipe.properties.schedule",
29
+ "$.$defs.connectionScheduleRow.properties.match",
30
+ "$.$defs.connectionScheduleRow.properties.match.properties.depth",
31
+ "$.$defs.connectionScheduleRow.properties.match.properties.depth.properties.max",
32
+ "$.$defs.connectionScheduleRow.properties.match.properties.depth.properties.min",
33
+ "$.$defs.connectionScheduleRow.properties.match.properties.depth.properties.unit",
34
+ "$.$defs.connectionScheduleRow.properties.match.properties.profile",
35
+ "$.$defs.connectionScheduleRow.properties.match.properties.profilePrefix",
36
+ "$.$defs.connectionScheduleRow.properties.match.properties.role",
37
+ "$.$defs.connectionScheduleRow.properties.params",
38
+ "$.$defs.detail.properties.disp",
39
+ "$.$defs.detail.properties.text",
40
+ "$.$defs.detailPlacement.properties.anchorId",
41
+ "$.$defs.detailPlacement.properties.detailName",
42
+ "$.$defs.detailPlacement.properties.id",
43
+ "$.$defs.detailPlacement.properties.n",
44
+ "$.$defs.detailPlacement.properties.opacity",
45
+ "$.$defs.detailPlacement.properties.pos",
46
+ "$.$defs.detailPlacement.properties.rotZ",
47
+ "$.$defs.detailPlacement.properties.sheet",
48
+ "$.$defs.detailPlacement.properties.size",
49
+ "$.$defs.detailPlacement.properties.u",
50
+ "$.$defs.dim.properties.a",
51
+ "$.$defs.dim.properties.aRef",
52
+ "$.$defs.dim.properties.axis",
53
+ "$.$defs.dim.properties.b",
54
+ "$.$defs.dim.properties.bRef",
55
+ "$.$defs.dim.properties.id",
56
+ "$.$defs.dim.properties.off",
57
+ "$.$defs.dim.properties.pin",
58
+ "$.$defs.dim.properties.rot",
59
+ "$.$defs.dim3.properties.a",
60
+ "$.$defs.dim3.properties.axis",
61
+ "$.$defs.dim3.properties.axisDir",
62
+ "$.$defs.dim3.properties.b",
63
+ "$.$defs.dim3.properties.id",
64
+ "$.$defs.dimRef.properties.g",
65
+ "$.$defs.dimRef.properties.m",
66
+ "$.$defs.dimRef.properties.pt",
67
+ "$.$defs.end.properties.conn",
68
+ "$.$defs.end.properties.connVerified",
69
+ "$.$defs.end.properties.detail",
70
+ "$.$defs.end.properties.note",
71
+ "$.$defs.end.properties.tos",
72
+ "$.$defs.end.properties.tosDef",
73
+ "$.$defs.filter.properties.active",
74
+ "$.$defs.filter.properties.colors",
75
+ "$.$defs.filter.properties.colors.items.properties.count",
76
+ "$.$defs.filter.properties.colors.items.properties.hex",
77
+ "$.$defs.filter.properties.colors.items.properties.on",
78
+ "$.$defs.filter.properties.elements",
79
+ "$.$defs.filter.properties.elements.items.properties.bbox",
80
+ "$.$defs.filter.properties.elements.items.properties.color",
81
+ "$.$defs.filter.properties.elements.items.properties.cx",
82
+ "$.$defs.filter.properties.elements.items.properties.cy",
83
+ "$.$defs.filter.properties.elements.items.properties.d",
84
+ "$.$defs.filter.properties.elements.items.properties.dashed",
85
+ "$.$defs.filter.properties.elements.items.properties.kind",
86
+ "$.$defs.filter.properties.elements.items.properties.layer",
87
+ "$.$defs.filter.properties.elements.items.properties.r",
88
+ "$.$defs.filter.properties.elements.items.properties.text",
89
+ "$.$defs.filter.properties.elements.items.properties.w",
90
+ "$.$defs.filter.properties.hide_title_block",
91
+ "$.$defs.filter.properties.layers",
92
+ "$.$defs.filter.properties.layers.items.properties.count",
93
+ "$.$defs.filter.properties.layers.items.properties.drawable",
94
+ "$.$defs.filter.properties.layers.items.properties.name",
95
+ "$.$defs.filter.properties.layers.items.properties.on",
96
+ "$.$defs.filter.properties.layers.items.properties.steel",
97
+ "$.$defs.filter.properties.mode",
98
+ "$.$defs.filter.properties.page",
99
+ "$.$defs.filter.properties.page.properties.bg_b64",
100
+ "$.$defs.filter.properties.page.properties.h",
101
+ "$.$defs.filter.properties.page.properties.rect",
102
+ "$.$defs.filter.properties.page.properties.w",
103
+ "$.$defs.filter.properties.sheets",
104
+ "$.$defs.filter.properties.steelBbox",
105
+ "$.$defs.filter.properties.thicknesses",
106
+ "$.$defs.filter.properties.thicknesses.items.properties.count",
107
+ "$.$defs.filter.properties.thicknesses.items.properties.on",
108
+ "$.$defs.filter.properties.thicknesses.items.properties.w",
109
+ "$.$defs.filterSheet.properties.elements",
110
+ "$.$defs.filterSheet.properties.elements.items.properties.bbox",
111
+ "$.$defs.filterSheet.properties.elements.items.properties.color",
112
+ "$.$defs.filterSheet.properties.elements.items.properties.cx",
113
+ "$.$defs.filterSheet.properties.elements.items.properties.cy",
114
+ "$.$defs.filterSheet.properties.elements.items.properties.d",
115
+ "$.$defs.filterSheet.properties.elements.items.properties.dashed",
116
+ "$.$defs.filterSheet.properties.elements.items.properties.kind",
117
+ "$.$defs.filterSheet.properties.elements.items.properties.layer",
118
+ "$.$defs.filterSheet.properties.elements.items.properties.r",
119
+ "$.$defs.filterSheet.properties.elements.items.properties.text",
120
+ "$.$defs.filterSheet.properties.elements.items.properties.w",
121
+ "$.$defs.filterSheet.properties.page",
122
+ "$.$defs.filterSheet.properties.page.properties.bg_b64",
123
+ "$.$defs.filterSheet.properties.page.properties.h",
124
+ "$.$defs.filterSheet.properties.page.properties.rect",
125
+ "$.$defs.filterSheet.properties.page.properties.w",
126
+ "$.$defs.filterSheet.properties.sheet",
127
+ "$.$defs.filterSheet.properties.steelBbox",
128
+ "$.$defs.filterSheet.properties.title",
129
+ "$.$defs.frame.properties.o",
130
+ "$.$defs.frame.properties.u",
131
+ "$.$defs.grid.properties.ends_x",
132
+ "$.$defs.grid.properties.ends_y",
133
+ "$.$defs.grid.properties.ext",
134
+ "$.$defs.grid.properties.hidden_z",
135
+ "$.$defs.grid.properties.labels_x",
136
+ "$.$defs.grid.properties.labels_y",
137
+ "$.$defs.grid.properties.labels_z",
138
+ "$.$defs.grid.properties.lines",
139
+ "$.$defs.grid.properties.on",
140
+ "$.$defs.grid.properties.origin",
141
+ "$.$defs.grid.properties.x",
142
+ "$.$defs.grid.properties.y",
143
+ "$.$defs.grid.properties.z",
144
+ "$.$defs.gridLine.properties.a",
145
+ "$.$defs.gridLine.properties.b",
146
+ "$.$defs.gridLine.properties.id",
147
+ "$.$defs.gridLine.properties.label",
148
+ "$.$defs.joint.properties.at",
149
+ "$.$defs.joint.properties.conn",
150
+ "$.$defs.joint.properties.geometry",
151
+ "$.$defs.joint.properties.id",
152
+ "$.$defs.joint.properties.kind",
153
+ "$.$defs.joint.properties.main",
154
+ "$.$defs.joint.properties.name",
155
+ "$.$defs.joint.properties.params",
156
+ "$.$defs.joint.properties.place",
157
+ "$.$defs.joint.properties.secondaries",
158
+ "$.$defs.joint.properties.source",
159
+ "$.$defs.joint.properties.verified",
160
+ "$.$defs.label.properties.disp",
161
+ "$.$defs.label.properties.text",
162
+ "$.$defs.member.properties.angle",
163
+ "$.$defs.member.properties.brace",
164
+ "$.$defs.member.properties.brace.properties.floor",
165
+ "$.$defs.member.properties.brace.properties.lowerEnd",
166
+ "$.$defs.member.properties.brace.properties.offset",
167
+ "$.$defs.member.properties.brace.properties.type",
168
+ "$.$defs.member.properties.col",
169
+ "$.$defs.member.properties.ends",
170
+ "$.$defs.member.properties.id",
171
+ "$.$defs.member.properties.material",
172
+ "$.$defs.member.properties.memberType",
173
+ "$.$defs.member.properties.mf",
174
+ "$.$defs.member.properties.position",
175
+ "$.$defs.member.properties.profile",
176
+ "$.$defs.member.properties.rfi",
177
+ "$.$defs.member.properties.role",
178
+ "$.$defs.member.properties.wp",
179
+ "$.$defs.meshPart.properties.id",
180
+ "$.$defs.meshPart.properties.indices",
181
+ "$.$defs.meshPart.properties.positions",
182
+ "$.$defs.meshPart.properties.role",
183
+ "$.$defs.plan.properties.callouts",
184
+ "$.$defs.plan.properties.clip",
185
+ "$.$defs.plan.properties.default_tos",
186
+ "$.$defs.plan.properties.details",
187
+ "$.$defs.plan.properties.dims",
188
+ "$.$defs.plan.properties.frame",
189
+ "$.$defs.plan.properties.grid",
190
+ "$.$defs.plan.properties.labels",
191
+ "$.$defs.plan.properties.members",
192
+ "$.$defs.plan.properties.pt_per_ft",
193
+ "$.$defs.plan.properties.raster_b64",
194
+ "$.$defs.plan.properties.segments",
195
+ "$.$defs.plan.properties.sheet",
196
+ "$.$defs.plan.properties.title",
197
+ "$.$defs.plan.properties.tos_callouts",
198
+ "$.$defs.segment.properties.a",
199
+ "$.$defs.segment.properties.b",
200
+ "$.$defs.segment.properties.id",
201
+ "$.$defs.segment.properties.o",
202
+ "$.$defs.tos_callout.properties.disp",
203
+ "$.$defs.tos_callout.properties.elev_in",
204
+ "$.$defs.tos_callout.properties.type",
205
+ "$.properties.active",
206
+ "$.properties.connections",
207
+ "$.properties.custom_details",
208
+ "$.properties.detail_bubbles",
209
+ "$.properties.detail_placements",
210
+ "$.properties.dims3d",
211
+ "$.properties.filter",
212
+ "$.properties.joints",
213
+ "$.properties.member_styles",
214
+ "$.properties.member_styles.additionalProperties.properties.dash",
215
+ "$.properties.member_styles.additionalProperties.properties.weight",
216
+ "$.properties.moment_frames",
217
+ "$.properties.palette",
218
+ "$.properties.plans",
219
+ "$.properties.profile_colors",
220
+ "$.properties.prop_labels",
221
+ "$.properties.prop_labels.properties.ids",
222
+ "$.properties.prop_labels.properties.placement",
223
+ "$.properties.prop_labels.properties.props",
224
+ "$.properties.prop_labels.properties.selected_only",
225
+ "$.properties.read_notes",
226
+ "$.properties.sheet_previews",
227
+ "$.properties.source",
228
+ "$.properties.source.properties.name",
229
+ "$.properties.source.properties.path",
230
+ "$.properties.source.properties.read_at",
231
+ "$.properties.source.properties.sha256",
232
+ "$.properties.source.properties.sheet",
233
+ "$.properties.target_confidence",
234
+ "$.properties.type",
235
+ "$.properties.views",
236
+ "$.properties.views.items.properties.camera",
237
+ "$.properties.views.items.properties.clips",
238
+ "$.properties.views.items.properties.generated",
239
+ "$.properties.views.items.properties.generated.oneOf[0].properties.ahead",
240
+ "$.properties.views.items.properties.generated.oneOf[0].properties.at",
241
+ "$.properties.views.items.properties.generated.oneOf[0].properties.behind",
242
+ "$.properties.views.items.properties.generated.oneOf[0].properties.kind",
243
+ "$.properties.views.items.properties.generated.oneOf[0].properties.label",
244
+ "$.properties.views.items.properties.generated.oneOf[0].properties.look",
245
+ "$.properties.views.items.properties.generated.oneOf[0].properties.sheet",
246
+ "$.properties.views.items.properties.generated.oneOf[0].properties.v",
247
+ "$.properties.views.items.properties.generated.oneOf[1].properties.above",
248
+ "$.properties.views.items.properties.generated.oneOf[1].properties.at",
249
+ "$.properties.views.items.properties.generated.oneOf[1].properties.below",
250
+ "$.properties.views.items.properties.generated.oneOf[1].properties.kind",
251
+ "$.properties.views.items.properties.generated.oneOf[1].properties.label",
252
+ "$.properties.views.items.properties.generated.oneOf[1].properties.look",
253
+ "$.properties.views.items.properties.generated.oneOf[1].properties.sheet",
254
+ "$.properties.views.items.properties.generated.oneOf[1].properties.v",
255
+ "$.properties.views.items.properties.id",
256
+ "$.properties.views.items.properties.mode",
257
+ "$.properties.views.items.properties.name",
258
+ "$.properties.views.items.properties.objects",
259
+ "$.properties.views.items.properties.order",
260
+ "$.properties.views.items.properties.projection",
261
+ "$.properties.weights"
262
+ ]
263
+ }
@@ -1,8 +1,8 @@
1
1
  ---
2
2
  name: floless-app-steel-model
3
- description: The front-door guide for turning a structural steel drawing SET into an editable model in floless.app — the "Steel Model" flow. This skill orchestrates the whole pipeline — set up a project folder, learn the set into plain-English knowledge files, provision the right AWARE agents (region-specific steel detailer plus any bake targets), confirm which sheets are plans / elevations / details, then hand off to the Steel Takeoff reader to read each plan into a steel.takeoff/v1 contract — with explicit confirm gates between stages. Use it when a user wants to model steel from a drawing SET or asks things like "model this steel job from the drawings", "take off this whole set", "start a steel takeoff project", "turn these structural drawings into a model", "I have a PDF set of framing plans", or "/floless-app-steel-model". It is re-runnable — resume at any stage. For a single already-isolated framing plan the Steel Takeoff reader (floless-app-steel-takeoff) can be used directly; this guide is for driving a real job end to end.
3
+ description: The front-door guide for turning a structural steel drawing SET into an editable steel.model/v2 model in floless.app — the "Steel Model" flow. This skill orchestrates the whole pipeline — set up a project folder, learn the set into plain-English knowledge files, provision the right AWARE agents (region-specific steel detailer plus any bake targets), confirm which sheets are plans / elevations / details, then hand off to the Steel Takeoff reader. The reader composes steel.takeoff/v1 only as internal first-read staging; floless.app converts it transactionally so a new project is born steel.model/v2. Use it when a user wants to model steel from a drawing SET or asks things like "model this steel job from the drawings", "take off this whole set", "start a steel takeoff project", "turn these structural drawings into a model", "I have a PDF set of framing plans", or "/floless-app-steel-model". It is re-runnable — resume at any stage. For a single already-isolated framing plan the Steel Takeoff reader (floless-app-steel-takeoff) can be used directly; this guide is for driving a real job end to end.
4
4
  metadata:
5
- version: 0.4.0
5
+ version: 0.5.0
6
6
  ---
7
7
 
8
8
  # Steel Model — guide a steel drawing set into an editable model
@@ -12,7 +12,7 @@ metadata:
12
12
  The **front door** to floless.app's steel pipeline. A real steel job arrives as a *set* of PDFs
13
13
  (framing plans, elevations, sections, details, schedules) plus firm conventions — not a single
14
14
  clean plan. This guide drives that whole job: project setup → learn the set → provision agents →
15
- classify the sheets → read each framing plan into an editable **steel.takeoff/v1 contract**, then
15
+ classify the sheets → read each framing plan into an editable **steel.model/v2 model**, then
16
16
  point the user at the on-canvas tools (filter, 3D, IFC/Tekla export, BOM, the connection library,
17
17
  clickable callouts).
18
18
 
@@ -142,9 +142,12 @@ the user at the editor:
142
142
 
143
143
  - **Read each framing plan** via **`floless-app-steel-takeoff`** — it runs the filter pre-stage
144
144
  (isolate the steel linework by layer/thickness/colour), the vision read, the AISC/EN/BS lookup
145
- via the detailer, honors `target_confidence`, writes the `steel.takeoff/v1` contract, and opens
146
- the overlay editor. One contract per `steel-model` app; multi-sheet sets ride the filter's
147
- `sheets[]` + the editor's plan switcher.
145
+ via the detailer, authors the model datum plus two labelled registration controls per plan,
146
+ honors `target_confidence`, composes the internal `steel.takeoff/v1` reader staging document, and
147
+ submits it through the project revision-read endpoint. The server converts and atomically
148
+ publishes **`steel.model/v2`** — so a new project is *born* v2, not migrated into it later. The
149
+ filter-only pre-read state is provisional; the completed model is v2. One contract per
150
+ `steel-model` app; multi-sheet sets ride the model's plan views and switcher.
148
151
  - **Pre-fill the connection library** from `company-rules.md` (stage 2): emit the firm's rows into
149
152
  the contract's `connections[]` with `source:"company-rules"`; the user reviews/assigns them per
150
153
  member end in the editor's **Connections** panel (the per-end picker + confidence card).
@@ -2,7 +2,7 @@
2
2
  name: floless-app-steel-takeoff
3
3
  description: Read a structural steel drawing into an editable steel.takeoff/v1 contract in floless.app — the "Steel Takeoff" reader. Triggers on a pending floless `rebake` request for the `steel-model` app (queued from its "Re-read & re-bake ▸" button), or asks like "read this framing plan into a takeoff", "turn this structural drawing into a takeoff", "bake my drawing into steel-model", "extract members from this PDF". Teaches the host AI to READ a steel drawing (PDF/image) with its own vision at COMPOSE time, build a steel.takeoff/v1 contract (members + profiles + elevations + weights from AISC lookup), write it to the contract store, and hand control to the editor — no model in the run path, no API key.
4
4
  metadata:
5
- version: 0.11.0
5
+ version: 0.12.0
6
6
  ---
7
7
 
8
8
  # Steel Takeoff — read a drawing into a steel.takeoff/v1 contract
@@ -1069,7 +1069,9 @@ the contract against that `requestId`. §9 has the call shape and the identity r
1069
1069
  The one create that **is** the contract route's is the **pre-read** document in §1b — the prepass verb
1070
1070
  cannot create a document, so a project whose `GET` returned nothing needs the contract PUT to bring the
1071
1071
  `filter` blocks into being. That is staging, not a read: it carries no members, and the member read that
1072
- follows still goes through `revision-read` and still mints v1.
1072
+ follows still goes through `revision-read`. **That read is what makes the project a `steel.model/v2`
1073
+ model** — the provisional filter-only v1 document at history head 0 is consumed by the conversion, not
1074
+ kept. See §9.
1073
1075
 
1074
1076
  The prepass verb exists because the pre-read pass used to GET the contract and PUT the **whole document**
1075
1077
  back. That is a full-document replacement: it can overwrite members, joints and connections that the
@@ -1182,10 +1184,26 @@ So the re-read must keep identity stable:
1182
1184
  existing `id` and keep it on the same `sheet` label (e.g. `S-201` stays `S-201`). Mint a NEW id
1183
1185
  only for a genuinely new member; simply drop the id of a member the revision deleted.
1184
1186
  3. Then compose the updated `steel.takeoff/v1` and `POST /api/projects/<projectId>/revision-read
1185
- { contract, message, requestId }`. On the **v1** arm that POST commits the version and clears the
1186
- request for you — do **not** DELETE it. On an already-migrated **v2** project it instead answers
1187
- `202` and stages the read for human confirmation; the request stays queued and must not be deleted
1188
- either (see "Notes that bite" below).
1187
+ { contract, message, requestId }`. **Which of three arms answers depends on the project's state, and
1188
+ they do not answer alike — read the STATUS and the `contractType`, never just `ok`:**
1189
+
1190
+ | project state | what the POST does | answer |
1191
+ |---|---|---|
1192
+ | **first read** — no versions yet, store empty or holding only the §1b filter-only pre-read | converts your v1 staging and atomically publishes the completed model + activation + version 1 | `200` `{ ok: true, version, contractType: "steel.model/v2" }` — the request is cleared for you |
1193
+ | **already a `steel.model/v2` model** | *stages* the read for human confirmation; nothing is written | `202` `{ ok: true, … }` — the request stays queued as `staged` |
1194
+ | **legacy v1** (has versions, never migrated) | commits a v1 version in one step | `200` — the request is cleared for you |
1195
+
1196
+ Do **not** DELETE the request in any of the three: the two committing arms clear it themselves, and
1197
+ the staged arm needs it to stay queued (see "Notes that bite" below).
1198
+
1199
+ > **A first read is where a project is BORN `steel.model/v2`.** You still compose
1200
+ > `steel.takeoff/v1` — that is the reader's internal staging shape, and the route requires a declared
1201
+ > v1 document on this arm — but what lands is v2: one root `members[]` in world millimetres, a
1202
+ > model-global `grid`, and the plans reduced to registered views. Confirm it by reading back
1203
+ > `contractType` (or `GET`-ing the contract) rather than assuming the shape you sent is the shape
1204
+ > that was stored. If the staging cannot be converted the answer is a `400` naming the reason
1205
+ > (`v1-staging-exit`, e.g. `grid-lines-unmigrated` or `plan-uneditable:registration-incomplete`) and
1206
+ > **nothing is published** — no contract, no activation, no version. Fix the read and re-post.
1189
1207
 
1190
1208
  > **On a `steel.model/v2` project compose a `steel.model/v2` document instead** — check the `type`
1191
1209
  > of the contract you GET-ed in step 1. Members live in one root `members[]` in world millimetres,
package/dist/web/app.css CHANGED
@@ -277,8 +277,6 @@
277
277
  }
278
278
  .host-line { color: var(--text-muted); }
279
279
  .host-line.host-ok { color: var(--ok); }
280
- .host-line.host-dim { color: var(--text-dim); }
281
- .host-dim { color: var(--text-dim); }
282
280
 
283
281
  .messages {
284
282
  flex: 1;
@@ -2171,8 +2169,6 @@
2171
2169
  .wf-act.act-edit:hover { color: var(--accent); background: var(--accent-soft); }
2172
2170
  .wf-act.act-dup:hover { color: var(--text); border-color: var(--border-strong); }
2173
2171
  .wf-act.act-del:hover { color: var(--err); background: rgba(248, 113, 113, 0.1); border-color: var(--err); }
2174
- /* Archive is non-destructive/recoverable (unlike Delete) — warn tint, not err. */
2175
- .wf-act.act-archive:hover { color: var(--warn); background: color-mix(in srgb, var(--warn) 10%, transparent); border-color: var(--warn); }
2176
2172
  .wf-empty-search { color: var(--text-dim); font-style: italic; font-size: 12px; padding: 16px 10px; text-align: center; }
2177
2173
  .wf-empty-search[hidden] { display: none; }
2178
2174
 
@@ -2356,7 +2352,6 @@
2356
2352
  padding: 1px 5px;
2357
2353
  border-radius: 3px;
2358
2354
  }
2359
- .menu-arrow { color: var(--text-dim); font-size: 14px; }
2360
2355
  .menu-divider {
2361
2356
  height: 1px;
2362
2357
  background: var(--border);
@@ -0,0 +1,72 @@
1
+ /* Browser twin of server/contract-schema.ts's dependency-free JSON Schema subset. */
2
+
3
+ const plain = (v) => typeof v === 'object' && v !== null && !Array.isArray(v);
4
+ const equal = (a, b) => a === b || (Array.isArray(a) && Array.isArray(b)
5
+ && a.length === b.length && a.every((v, i) => equal(v, b[i])));
6
+ const kind = (v) => v === null ? 'null' : Array.isArray(v) ? 'array' : typeof v;
7
+ const typeMatches = (v, t) => ({
8
+ object: plain(v), array: Array.isArray(v), string: typeof v === 'string',
9
+ number: typeof v === 'number' && Number.isFinite(v),
10
+ integer: typeof v === 'number' && Number.isInteger(v),
11
+ boolean: typeof v === 'boolean', null: v === null,
12
+ })[t] === true;
13
+
14
+ function walk(value, node, root, path, errors) {
15
+ if (node.$ref) {
16
+ const match = /^#\/\$defs\/(.+)$/.exec(node.$ref);
17
+ const target = match && root.$defs?.[match[1]];
18
+ if (!target) errors.push({ path, message: `unresolved $ref ${node.$ref}` });
19
+ else walk(value, target, root, path, errors);
20
+ return;
21
+ }
22
+ if (node.oneOf) {
23
+ const candidates = node.oneOf.map((candidate) => {
24
+ const found = []; walk(value, candidate, root, path, found); return found;
25
+ });
26
+ const matches = candidates.filter((found) => found.length === 0).length;
27
+ if (matches !== 1) {
28
+ errors.push({ path, message: `must match exactly one oneOf branch (matched ${matches})` });
29
+ if (matches === 0) errors.push(...candidates.sort((a, b) => a.length - b.length)[0]);
30
+ }
31
+ }
32
+ if ('const' in node && !equal(value, node.const)) errors.push({ path, message: `must equal ${JSON.stringify(node.const)}` });
33
+ if (node.enum && !node.enum.some((v) => equal(value, v))) errors.push({ path, message: `must be one of ${JSON.stringify(node.enum)}` });
34
+ if (node.type) {
35
+ const types = Array.isArray(node.type) ? node.type : [node.type];
36
+ if (!types.some((t) => typeMatches(value, t))) {
37
+ errors.push({ path, message: `expected ${types.join(' | ')}, got ${kind(value)}` });
38
+ return;
39
+ }
40
+ }
41
+ if (typeof value === 'number' && Number.isFinite(value)) {
42
+ if (typeof node.minimum === 'number' && value < node.minimum) errors.push({ path, message: `must be >= ${node.minimum}` });
43
+ if (typeof node.maximum === 'number' && value > node.maximum) errors.push({ path, message: `must be <= ${node.maximum}` });
44
+ if (typeof node.exclusiveMinimum === 'number' && value <= node.exclusiveMinimum) errors.push({ path, message: `must be > ${node.exclusiveMinimum}` });
45
+ if (typeof node.exclusiveMaximum === 'number' && value >= node.exclusiveMaximum) errors.push({ path, message: `must be < ${node.exclusiveMaximum}` });
46
+ }
47
+ if (typeof value === 'string') {
48
+ const length = Array.from(value).length;
49
+ if (typeof node.minLength === 'number' && length < node.minLength) errors.push({ path, message: `expected at least ${node.minLength} characters, got ${length}` });
50
+ if (typeof node.maxLength === 'number' && length > node.maxLength) errors.push({ path, message: `expected at most ${node.maxLength} characters, got ${length}` });
51
+ }
52
+ if (plain(value)) {
53
+ for (const required of node.required || []) if (!Object.hasOwn(value, required)) errors.push({ path: `${path}.${required}`, message: 'required' });
54
+ const properties = node.properties || {};
55
+ for (const key of Object.keys(value)) {
56
+ if (Object.hasOwn(properties, key)) walk(value[key], properties[key], root, `${path}.${key}`, errors);
57
+ else if (node.additionalProperties === false) errors.push({ path: `${path}.${key}`, message: 'additional property not allowed' });
58
+ else if (plain(node.additionalProperties)) walk(value[key], node.additionalProperties, root, `${path}.${key}`, errors);
59
+ }
60
+ }
61
+ if (Array.isArray(value)) {
62
+ if (typeof node.minItems === 'number' && value.length < node.minItems) errors.push({ path, message: `expected at least ${node.minItems} items, got ${value.length}` });
63
+ if (typeof node.maxItems === 'number' && value.length > node.maxItems) errors.push({ path, message: `expected at most ${node.maxItems} items, got ${value.length}` });
64
+ if (node.items) value.forEach((item, i) => walk(item, node.items, root, `${path}[${i}]`, errors));
65
+ }
66
+ }
67
+
68
+ export function validateSchemaSubset(value, schema) {
69
+ const errors = [];
70
+ walk(value, schema, schema, '$', errors);
71
+ return { valid: errors.length === 0, errors };
72
+ }