@floless/app 0.123.2 → 0.124.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.
@@ -68,6 +68,16 @@
68
68
  "override": { "type": ["string", "null"], "description": "Set only when the user overrode a file that LIES about its units." }
69
69
  }
70
70
  },
71
+ "filter": {
72
+ "type": "object",
73
+ "additionalProperties": false,
74
+ "minProperties": 1,
75
+ "description": "The SUBSET of the file this reference was read from — ABSENT means the whole file. Stored so a re-read reproduces the same reference: without it, \"Reload its geometry\" would silently replace one storey with the whole building, from the one action a user takes when something already looks wrong. An empty list is never stored, and neither is an empty object: the reader treats an empty list as selecting NOTHING, so \"no filter\" is this key being absent. The two filters INTERSECT — storeys L1 plus type IFCBEAM means the beams on L1, not both sets.",
76
+ "properties": {
77
+ "storeys": { "type": "array", "minItems": 1, "items": { "type": "string", "minLength": 1 }, "description": "Storey names as `probe` reported them. Matched case-insensitively by the reader." },
78
+ "ifcTypes": { "type": "array", "minItems": 1, "items": { "type": "string", "minLength": 1 }, "description": "IFC entity names, e.g. IFCBEAM. Subtypes are included, so a supertype does not select nothing." }
79
+ }
80
+ },
71
81
  "display": {
72
82
  "type": "object",
73
83
  "additionalProperties": false,
@@ -312,7 +312,7 @@
312
312
  "additionalProperties": true,
313
313
  "description": "A placed connection the connection engine expands into real 3D parts. A parametric RECIPE kind (base-plate, shear-plate) derives all geometry from its `params` + the live member positions, so it moves/re-solves with its members. A 'custom' kind is an imported connection (read from IFC via AWARE's connection-reader) that carries its own opaque tessellated `geometry` and a `place` point — move / replace only, no per-dimension edit. Distinct from the `connections[]` library (vendor-neutral type/detail/targets identities a joint can cite). v1 kinds: base-plate, shear-plate, custom.",
314
314
  "properties": {
315
- "id": { "type": "string", "description": "Stable joint id, e.g. j-bp-1 / sp-b3-e0 / cx-<id>." },
315
+ "id": { "type": "string", "minLength": 1, "description": "Stable joint id, e.g. j-bp-1 / sp-b3-e0 / cx-<id>. NON-EMPTY, matching steel.model/v2: every connection part's scene id is derived as `${joint.id}:…`, so a blank id yields parts named `:plate` / `:rod0` and the joint is recorded as the positional `joint#<i>` instead — a specified connection that reaches neither the model, IFC nor Tekla, while the inventory gate still reports ok. `required` alone permitted \"\"." },
316
316
  "kind": { "type": "string", "description": "Connection kind: base-plate, shear-plate (parametric recipes the engine expands), or custom (imported IFC geometry). end-plate / cap-plate / … follow." },
317
317
  "main": { "type": "string", "description": "Id of the host member this joint hangs off. For a base-plate this is the column; for a shear-plate this is the SUPPORTED BEAM (the joint sits at one of the beam's ends — see `at`). Required for the recipe kinds; optional for 'custom' (an imported connection carries its own geometry rather than deriving it from a member)." },
318
318
  "secondaries": { "type": "array", "items": { "type": "string" }, "description": "Ids of the other members this joint binds — e.g. the SUPPORT a shear-plate frames into. Optional and inferred by geometry; the shear-plate engine does not require it (the fin plate is placed off the beam end + beam axis). Empty for a base-plate." },
@@ -2,7 +2,7 @@
2
2
  name: floless-app-approval
3
3
  description: Review and act on FloLess Workspace approval state through the local server API. Use when the user asks what changed or is pending, wants to approve selected changes, leave changes pending, discard a change, inspect approved history or saved checkpoints, start from an older approved version, resume or move saved work forward, or export the latest approved version, an older version, the working DRAFT, or a checkpoint DRAFT.
4
4
  metadata:
5
- version: 0.1.0
5
+ version: 0.2.0
6
6
  ---
7
7
 
8
8
  # FloLess Workspace approval
@@ -24,6 +24,12 @@ This is informational telemetry, not proof of identity.
24
24
  ## Review and approve
25
25
 
26
26
  1. Fetch `GET /api/projects/:id/approval-review`.
27
+ **If the body has `reviewable: false`, there is nothing to review.** Report its `message` to the
28
+ user and stop — do not present a review and do not submit one. The route answers 200 for the two
29
+ states that are a standing condition of the project rather than a fault (`reason: "no-contract"`,
30
+ nothing read in yet; `reason: "no-incarnation"`, a project too old to carry the identity approval
31
+ proves against). Such a body has no `summary`, no `groups`, and no `reviewId`, so presenting it
32
+ would tell the user "nothing needs approval" about a project that cannot be approved at all.
27
33
  2. Present the server's baseline/head, summary, cautions, and every change ID with its headline and
28
34
  detail. If `moveForward` is present, state its old base, current approved head, and every reported
29
35
  overlap. Do this before any mutation, even when this AI authored the changes.
@@ -1,15 +1,16 @@
1
1
  ---
2
2
  name: floless-app-queue
3
- description: This skill should be used when the user has MULTIPLE floless.app requests queued from the Dashboard and wants to see them and choose which to process, rather than the AI just picking up the oldest one. Use it when the user says things like "what's in my floless queue", "list my queued floless requests", "show me the pending requests and let me pick", "I queued a few tweaks — which should I apply?", "let me choose what to process", or "pick from the floless queue". It lists the pending requests from GET /api/requests in plain language (type, which app/node, the instruction), asks the user which one(s) to apply, then hands each chosen request to the owning skill (floless-app-workflows / -tweak-contract / -ui / -rebake) which applies it and clears it. It is the interactive picker that sits in front of floless-app-bridge (which is the actual pull-apply-clear engine).
3
+ description: This skill should be used when the user has MULTIPLE floless.app requests queued from the Dashboard and wants to see them and choose which to process, rather than the AI just picking up the oldest one. Use it when the user says things like "what's in my floless queue", "list my queued floless requests", "show me the pending requests and let me pick", "I queued a few tweaks — which should I apply?", "let me choose what to process", or "pick from the floless queue". It lists the pending requests from GET /api/requests in plain language (type, which app/node/project, the instruction), asks the user which one(s) to apply, then hands each chosen request to the owning skill (floless-app-workflows / -tweak-contract / -ui / -rebake / -onboarding / -new-workflow / -steel-takeoff / -vectorize / -knowledge) which applies it and clears it. It is the interactive picker that sits in front of floless-app-bridge (which is the actual pull-apply-clear engine).
4
4
  metadata:
5
- version: 0.1.1
5
+ version: 0.2.0
6
6
  ---
7
7
 
8
8
  # floless.app queue picker
9
9
 
10
10
  floless.app is the **thin web UI**; the **terminal AI (you) is the brain**. The UI cannot edit
11
- `.flo` files — it **queues requests** (Tweak / use-template / customize-UI / rebake / edit-contract)
12
- to a local API. The **`floless-app-bridge`** skill pulls those and applies them, but it processes
11
+ `.flo` files — it **queues requests** (Tweak / use-template / customize-UI / rebake / edit-contract /
12
+ walk-me-through / new-workflow / read-this-drawing / organize-or-adjust-the-knowledge-base) to a
13
+ local API. The **`floless-app-bridge`** skill pulls those and applies them, but it processes
13
14
  the queue **oldest-first with no choice step**. This skill adds the missing affordance: **list the
14
15
  whole queue in plain English and let the user pick which one(s) to process** — then route each pick
15
16
  through the normal bridge flow.
@@ -27,14 +28,22 @@ curl -s http://127.0.0.1:4317/api/health # → {"ok":true,...}; if down, user
27
28
  curl -s http://127.0.0.1:4317/api/requests # → { "ok": true, "requests": [ ... ] }
28
29
  ```
29
30
 
30
- `requests` is every **pending** request, oldest first. If it's empty, tell the user the queue is
31
+ `requests` is the whole queue, oldest first. If it's empty, tell the user the queue is
31
32
  empty and stop — there is nothing to pick.
32
33
 
34
+ **Read each row's `status`.** The route applies no filter, so a non-`pending` row comes back with the
35
+ rest and is not pickable here: a `failed` revision-read is the UI's error card (the user re-attaches the
36
+ set to retry). `staged` is the same rule for the steel.model/v2 read described in §4 — a finished read
37
+ waiting on the user's review in the app; nothing shipped sets it yet, so expect it rather than look for
38
+ it. Listing them is fine; offering them as work is not.
39
+
33
40
  ## 2. Present the queue in plain language
34
41
 
35
42
  Render a **numbered list** the user can choose from. For each request show the index, a short id
36
- (first 8 chars), and a one-line plain-English summary by `type` — never raw JSON. The fields are
37
- documented in `floless-app-bridge`; the five types map to:
43
+ (first 8 chars), and a one-line plain-English summary by `type` — never raw JSON. (`floless-app-bridge`
44
+ documents the field shapes for `tweak` and `use-template`; for the rest, read the `FlolessRequest`
45
+ interface in `server/floless-store.ts` — its comments say which type each field belongs to.) The types
46
+ map to:
38
47
 
39
48
  | `type` | Plain-English line | Owning skill |
40
49
  |---|---|---|
@@ -43,6 +52,16 @@ documented in `floless-app-bridge`; the five types map to:
43
52
  | `tweak-contract` | "Edit the Steel Model contract for **`<appId>`** — *<instruction>* (+N screenshot(s))" | `floless-app-tweak-contract` |
44
53
  | `ui-customize` | "Customize the Dashboard (optionally `panel <panelId>`) — *<instruction>*" | `floless-app-ui` |
45
54
  | `rebake` | "Re-read the **<inputName>** drawing (<sourceName>) in **`<appId>`** — *<instruction>*" | `floless-app-rebake` |
55
+ | `guide` | "Walk me through **`<appId>`** — what it does and how to run it. **Read-only**, it changes nothing" | `floless-app-onboarding` |
56
+ | `new-workflow` | "Build a brand-new workflow from scratch" (workspace-level — carries no `appId`, none exists yet) | `floless-app-new-workflow` |
57
+ | `revision-read` | "Read the attached drawing(s) into project **`<project>`** as a new version (+N file(s))" — the **initial** read when `baseVersion` is absent or ≤ 0, otherwise a **re-read** of a revised set | `floless-app-steel-takeoff` — but `floless-app-vectorize` when the app's lineage root (`appTemplateId`, falling back to `appId`) is `vectorize` |
58
+ | `knowledge-organize` | "Organize the Project Knowledge Base for project **`<project>`**" | `floless-app-knowledge` |
59
+ | `knowledge-adjust` | "Reshape the Project Knowledge Base for project **`<project>`** — *<instruction>*" | `floless-app-knowledge` |
60
+
61
+ The type union itself is `FlolessRequest` in `server/floless-store.ts` — a type in the union with no row
62
+ above means this table is stale, and the union is right. The routing is `REQUEST_SKILL` in
63
+ `web/aware.js`, with the `revision-read` app-aware override right below it; it now covers every member
64
+ of the union, so if it and this table disagree, the code is right and this table is stale — say so.
46
65
 
47
66
  Note the count of screenshots for requests that carry `snapshots`. If a request has an unfamiliar
48
67
  `type`, show it verbatim and flag it rather than guessing what it does.
@@ -56,7 +75,7 @@ touching any `.flo`, contract, or panel.
56
75
  ## 4. Process each chosen request — route to the owning skill
57
76
 
58
77
  For each pick, hand it to the skill in the table above (the type→skill routing
59
- `floless-app-bridge` uses for pasted markers, extended here to also cover `tweak-contract`).
78
+ `floless-app-bridge` uses for pasted markers, extended here to cover the whole union).
60
79
  That skill does the real work — read the app's
61
80
  current `.flo`/contract/panel, apply the change, recompile if needed — **and clears the request**:
62
81
 
@@ -64,14 +83,36 @@ current `.flo`/contract/panel, apply the change, recompile if needed — **and c
64
83
  curl -s -X DELETE http://127.0.0.1:4317/api/requests/<id> # the UI's "requests" badge updates live over SSE
65
84
  ```
66
85
 
86
+ **Two types are LIFECYCLE-OWNED — never `DELETE` them.** They are resolved by their own POST, so a
87
+ `DELETE` doesn't complete them, it breaks them:
88
+
89
+ | `type` | What resolves it | What a stray `DELETE` costs |
90
+ |---|---|---|
91
+ | `revision-read` | `POST /api/projects/<project>/revision-read` (that POST clears it), or `POST /api/projects/<project>/revision-requests/<id>/fail` when the set can't be read. A `steel.model/v2` project answers **202 and stages** the read instead — the request stays `staged` until the user confirms it in the app (`…/revision-read/confirm`, which is theirs to trigger, not yours), and that is not a failure. | the completion POST is refused **400** ("a valid queued revision-read requestId … is required") and the finished read is thrown away |
92
+ | `knowledge-organize` | `POST /api/projects/<project>/knowledge/requests/<id>/finish` (or `…/fail`) — after claiming the pass with `…/start` | the lock you took at `…/start` is only reclaimable after `LOCK_STALE_MS` (**10 minutes**) — and the leftover `organize.json`, which only finish/fail removes, leaves the Knowledge pane showing "Organizing…" with Organize **disabled indefinitely**, so the user cannot even re-queue |
93
+
94
+ Every other type is applied-then-`DELETE`d as above. This is the same per-type rule the UI encodes in
95
+ `markedInstruction()`'s `clears` branch (`web/aware.js`) — check there if a type's ending is unclear.
96
+
67
97
  Process the picks in the order the user gave (or oldest-first if they said "all"). Re-run the
68
98
  owning skill's normal verification before reporting each one done.
69
99
 
70
100
  ## 5. The un-picked rest
71
101
 
72
102
  Leave any request the user did **not** pick in the queue — do nothing to it. If the user wants to
73
- **discard** one without processing, `DELETE /api/requests/<id>`; to drop the whole queue at once
74
- the UI's "Clear all" maps to `DELETE /api/requests`. Only delete on an explicit ask.
103
+ **discard** one without processing, `DELETE /api/requests/<id>` — that is a genuine discard, and it's
104
+ what the ✕ in the Requests panel does. Two carve-outs:
105
+
106
+ - **`knowledge-organize` is never discarded by `DELETE`.** The UI hides its ✕ for exactly this reason.
107
+ A pass you already `…/start`ed is released with its `…/fail` POST. One that was only ever *queued*
108
+ has a purpose-built cancel: `DELETE /api/projects/<project>/knowledge/requests/<id>`, which refuses
109
+ with **409** the moment an organize is actually in flight — that guard is the whole difference from
110
+ the generic verb.
111
+ - **`DELETE /api/requests` ("Clear all") is a blunt server-side bulk delete** that takes a queued
112
+ `knowledge-organize` with it. The UI avoids that by deleting the others one id at a time and keeping
113
+ every organize; do the same rather than reaching for the bulk verb while one is pending.
114
+
115
+ Only delete on an explicit ask.
75
116
 
76
117
  When you're done, tell the user what was processed and **what is still queued**, so the picker can
77
118
  be re-run for the remainder.
@@ -82,7 +123,10 @@ be re-run for the remainder.
82
123
  triages the queue and delegates each pick to the owning authoring skill.
83
124
  - **Choose, don't bulk-apply.** Listing is non-destructive; only act on the user's explicit picks.
84
125
  Never silently process the whole queue without an explicit "all".
85
- - **Always clear a processed request** (the owning skill does the `DELETE`) so the UI's count
86
- reflects reality; only `DELETE` an *un*-processed request when the user asks to discard it.
87
- - **Don't invent request types** — only the five real ones exist; surface anything else rather than
88
- guessing. This is the picker; **`floless-app-bridge`** is the puller/applier it sits in front of.
126
+ - **Always resolve a processed request** so the UI's count reflects reality — by `DELETE` for most
127
+ types, by the lifecycle POST for `revision-read` and `knowledge-organize` (§4). Only `DELETE` an
128
+ *un*-processed request when the user asks to discard it.
129
+ - **Don't invent request types** — the real set is the `FlolessRequest` union in
130
+ `server/floless-store.ts`, listed in §2. Every type in that table is legitimate and shipped;
131
+ surface anything *outside* it rather than guessing. This is the picker; **`floless-app-bridge`** is
132
+ the puller/applier it sits in front of.
@@ -2,7 +2,7 @@
2
2
  name: floless-app-steel-model
3
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.6.0
5
+ version: 0.7.0
6
6
  ---
7
7
 
8
8
  # Steel Model — guide a steel drawing set into an editable model
@@ -288,6 +288,35 @@ it lands on. Member ends are usually placed at WORK POINTS, which sit on the sup
288
288
  inside it — so a member must be trimmed back to the support's actual face plus its erection gap, and that
289
289
  distance grows with the skew of the crossing. Verify the trim, not just the joint.
290
290
 
291
+ **Count what you built against what you specified.** Every check above scores a connection that *exists*.
292
+ None of them can see the two failures that leave nothing behind to measure: a connection you specified and
293
+ never built, and two connections that collapsed into one part. Both survive every dimensional check by
294
+ default — the first because there is no geometry to fault, the second because a fused part measures as one
295
+ correct-looking body. Both models open, render and export without complaint.
296
+
297
+ So reconcile the inventory each time you build, and treat two of the four outcomes as failures:
298
+
299
+ - **FAIL — specified, never built.** Every row in `joints[]` — the PLACED connections, not the
300
+ `connections[]` library they cite — owns at least one part in the model. A row that produced nothing is
301
+ a detail you read, reported and priced, and did not deliver. (Judge the placed rows: a library row that
302
+ is referenced for spec and pricing but never placed owns no parts and is not a failure.)
303
+ - **FAIL — two specified, one built.** No two rows share a part. A pair of plates modelled as a single
304
+ body has the right total area and the right weight, and cannot be fabricated as drawn.
305
+ - **WARN — read, never specified.** A detail callout found on the drawings that never became a
306
+ `connections[]` row. Not necessarily wrong — you may have refused it under stage 7 — but it gets named,
307
+ never silently dropped.
308
+ - **WARN — built, unnamed.** A part belonging to no connection. Usually debris left by an earlier build;
309
+ occasionally the only evidence that a recipe is emitting geometry nobody asked for.
310
+
311
+ Decide what counts as ONE part once, and make the count and the model share that definition. If the two
312
+ disagree about where a connection ends, both are wrong — and the disagreement will read as a coverage
313
+ failure on a model that is actually fine, which is the fastest way to get the gate switched off.
314
+
315
+ **Say what this gate does not prove, every time you report it: it proves you built what you specified,
316
+ never that you specified enough.** It is the only check in this stage that scores the INVENTORY — every
317
+ other one scores the dimensions of a connection that is already there. An inventory missing half the
318
+ details on the sheet passes all of them, and passes this one too.
319
+
291
320
  **Where this class of bug hides: nominal-vs-real section data.** A designation carries its thickness
292
321
  (an angle's leg, a tube's wall) and that token is easy to drop on the way to geometry — leaving a guessed
293
322
  or zero thickness behind, which silently misplaces everything that references it. If a placement depends
@@ -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.16.0
5
+ version: 0.16.1
6
6
  ---
7
7
 
8
8
  # Steel Takeoff — read a drawing into a steel.takeoff/v1 contract
@@ -300,8 +300,12 @@ native/display coords):
300
300
  (**title block excluded** — CONFIDENTIAL, machine-local, never committed). **`page.rect` = the exact
301
301
  clip `[x0,y0,x1,y1]` you rendered `bg_b64` from, in the SAME display-space coords as the element `d`
302
302
  paths** — the viewer registers the raster to `rect` (not the whole page), so it aligns 1:1 with the
303
- linework. `w`/`h` stay the full display-space page size (the vectors' coordinate frame). `steelBbox`
304
- = the bbox of this sheet's steel-layer elements (Zoom-to-steel).
303
+ linework. `w`/`h` stay the full display-space page size (the vectors' coordinate frame). Pass that
304
+ same display-space rect to `page.get_pixmap(clip=…)` **unchanged** — do NOT run it back through
305
+ `page.derotation_matrix` on the theory that PyMuPDF wants native coords. `get_pixmap` is the one
306
+ exception to that habit, and derotating its clip renders the wrong region of the sheet (see
307
+ "Hard-won gotchas" below). `steelBbox` = the bbox of this sheet's steel-layer elements
308
+ (Zoom-to-steel).
305
309
  4. **Global facets (union across sheets)** — aggregate distinct `layers` / `thicknesses` / `colors`
306
310
  with a summed `count` each, ACROSS all sheets, into the top-level `filter.layers/thicknesses/colors`
307
311
  (NOT per-sheet). Round each element's `w` and the facet `w` the **same** way (matching is
@@ -836,6 +840,20 @@ Follow the methodology condensed here (full detail + every gotcha in
836
840
  - **Pages may be rotated (e.g. 270°).** Work entirely in display space via
837
841
  `page.rotation_matrix`. Never mix native/display coords — this is the single biggest source of
838
842
  misplaced members.
843
+ - **`page.get_pixmap(clip=…)` is the ONE call that wants the rect already in DISPLAY space — do
844
+ NOT derotate it first.** Every *extraction* (`get_drawings()`, `get_text()`, `search_for()`)
845
+ hands back **native** coordinates you push through `page.rotation_matrix` to reach display space,
846
+ so "always transform" becomes muscle memory — and it is wrong here. `clip` is interpreted in the
847
+ same rotated frame as PyMuPDF's `Page.rect` attribute and the element `d`/`bbox`/`cx,cy` coords you
848
+ already hold, so the display-space crop goes in **verbatim**; that same rect is also what you write
849
+ into the sheet entry's `page.rect` field (step 3 above). Running it through `derotation_matrix`
850
+ first silently renders a *different region* of the sheet. At 90°/270° that usually swaps the crop's
851
+ width and height, so an
852
+ **exact** expected-dimensions assert often does catch it — but at 180°, or on a square or
853
+ symmetrically-clipped region, the pixel size comes back plausible, so dimensions alone cannot
854
+ reliably rule it out. The symptom is a `bg_b64` backdrop shifted and rescaled under
855
+ correctly-placed linework; the check that always settles it is a pixel-diff of the crop against the
856
+ same region of a full-page render.
839
857
  - **When a subagent reports a POSITION — the scan-only fallback of step 4 — it must be normalized
840
858
  fractions, one pass, no sub-cropping.** Pixel coords from a subagent collapse after downscaling.
841
859
  The live-text and montage branches of step 4 are exempt: neither asks a reader for a position at
@@ -2,7 +2,7 @@
2
2
  name: floless-app-tweak-contract
3
3
  description: This skill should be used when there is a pending floless `tweak-contract` request — the user typed an instruction in the Steel Model contract editor and clicked Send (Ask AI). Also triggers on asks like "edit the steel takeoff contract via AI", "adjust the steel takeoff in the contract editor", "the user asked me to change the steel contract", "pick up my tweak-contract request", "update the member profile in the contract". It teaches the host AI to read the request, fetch the current steel.takeoff/v1 contract, apply the instruction (and any pasted screenshots), PUT the updated contract back, and resolve the request.
4
4
  metadata:
5
- version: 0.3.0
5
+ version: 0.4.0
6
6
  ---
7
7
 
8
8
  # Handle a `tweak-contract` request (Slice 2 AI round-trip)
@@ -15,10 +15,24 @@ member as moment-frame") and optionally pastes screenshots, then clicks **Send**
15
15
  a `tweak-contract` request in the reverse channel. You pick it up here, edit the contract
16
16
  document, write it back, and the editor reloads it.
17
17
 
18
- The contract is `~/.floless/contracts/<appId>.json`, a `steel.takeoff/v1` document. It is the
19
- single source of truth — the editor is its view, and the exporters (IFC/Tekla/viewer-3d) consume
20
- server-resolved export sources. A PUT writeback is schema-validated on the server; a 400
21
- means invalid — fix and retry.
18
+ The contract is the single source of truth — the editor is its view, and the exporters
19
+ (IFC/Tekla/viewer-3d) consume server-resolved export sources. A PUT writeback is schema-validated on
20
+ the server; a 400 means invalid — fix and retry.
21
+
22
+ **Two things about WHICH document you are editing. Get both wrong and you edit the wrong file.**
23
+
24
+ 1. **The shape is not always `steel.takeoff/v1`.** A migrated project holds **`steel.model/v2`**, whose
25
+ members live in ONE root `members[]` array in world millimetres — it has no `plans[i].members[j]`,
26
+ so the v1 field map in §4 does not apply to it. **Read the document's own `type` field in step 2
27
+ and write back that SAME shape.** Never convert one into the other: this verb patches the document
28
+ it just read, and a shape change is refused. For v2 the field reference is
29
+ `schemas/steel.model.v2.schema.json`; for v1 it is `schemas/steel.takeoff.v1.schema.json`.
30
+ 2. **The store is project-keyed when the request carries a `project`.** A workspace project's document
31
+ lives at `~/.floless/projects/<project>/contract.json` and is reached with
32
+ `?project=<project>` on both the GET and the PUT. Only a request with **no** `project` targets the
33
+ legacy app-keyed `~/.floless/contracts/<appId>.json`. Omit the query on a project request and you
34
+ read (and may CREATE) an app-scoped contract while the user's project document is never touched —
35
+ they will see no change and have no idea why.
22
36
 
23
37
  > **Pasted a request?** If the user pastes a message with a `[floless-request type=tweak-contract id=…]`
24
38
  > marker, that is a request **copied from the FloLess Dashboard**. Resolve it via
@@ -31,23 +45,41 @@ means invalid — fix and retry.
31
45
  `type: "tweak-contract"`. It carries:
32
46
  - `id` — the request id (used to DELETE it when done)
33
47
  - `appId` — which app's contract to edit
48
+ - `project` — **present on a workspace request**; when it is there, every GET and PUT below takes
49
+ `?project=<project>`. Absent means the legacy app-keyed store. Never guess it.
34
50
  - `instruction` — the user's plain-English ask
35
51
  - `snapshots` — absolute paths to screenshot files saved under
36
52
  `~/.floless/requests/<id>/` (PNG/JPEG/WebP). These are the key input — the user
37
53
  pasted them to show you exactly which region or member they mean.
54
+ - `intent` + `target` — present only on an **insert-a-detail** request from the editor's detailing
55
+ flow. `intent` is `"create"` (place a new detail) or `"modify"` (change one already placed), and
56
+ `target` is `{ sheet, ids }` naming the sheet and the host member / placed-detail ids to act
57
+ against. They exist so you do not have to infer create-vs-edit from the prose — honour them.
38
58
 
39
59
  The port is the same base URL the floless.app server is on (check `/api/health` or use
40
60
  the port the skill context provides — typically 4317 for the installed app, 4318 for the
41
61
  dev server).
42
62
 
43
- 2. **Read the current contract.** `GET http://localhost:<port>/api/contract/<appId>` returns
44
- the full `steel.takeoff/v1` JSON document. **Keep the `ETag` response header** — step 5 sends it
63
+ 2. **Read the current contract.** `GET http://localhost:<port>/api/contract/<appId>` — **plus
64
+ `?project=<project>` when the request carries one** — returns the full JSON document. **Read its
65
+ `type` field**: `steel.takeoff/v1` or `steel.model/v2` decides which field map in step 4 applies,
66
+ and step 5 writes back that same shape. **Keep the `ETag` response header** — step 5 sends it
45
67
  back so your write cannot silently overwrite someone else's.
46
- You can also read it directly from `~/.floless/contracts/<appId>.json`, but then you have no
68
+ You can also read the file off disk (`~/.floless/projects/<project>/contract.json`, or
69
+ `~/.floless/contracts/<appId>.json` when there is no project), but then you have no
47
70
  ETag and **the write in step 5 will be REFUSED (`428`)** — the server requires a precondition.
48
71
  Use the HTTP read whenever you intend to write.
49
72
 
50
- The schema is at `schemas/steel.takeoff.v1.schema.json` (in the floless.app repo) and the
73
+ **If `type` is `steel.model/v2`**, the shapes below do NOT apply. Read
74
+ `schemas/steel.model.v2.schema.json` instead: members are one root `members[]` array in world
75
+ millimetres and ids are model-global rather than sheet-scoped. `from`/`to` are `{x, y, z}` — but
76
+ **`z` is a tagged union, not a bare number**: a known elevation is `z: { known: 3000 }` and one the
77
+ drawing never gave is `z: { unknown: true }`. The schema sets `additionalProperties: false`, so a
78
+ bare `z: 3000` is refused with a 400. Never substitute a default for an unknown elevation — a
79
+ fabricated elevation moves steel. Everything else in this loop (ETag, preconditions, preserve what
80
+ you are not changing, never auto-approve) is identical.
81
+
82
+ **If `type` is `steel.takeoff/v1`**, the schema is at `schemas/steel.takeoff.v1.schema.json` and the
51
83
  field reference is `docs/superpowers/specs/2026-06-17-steel-takeoff-agent-guidance.md` §3.
52
84
  Key shapes you'll edit:
53
85
  - Top-level: `type` (const `"steel.takeoff/v1"`), `active`, `palette`, `weights{profile→plf}`,
@@ -66,7 +98,8 @@ means invalid — fix and retry.
66
98
  beam") only resolves with the visual context ("this beam" = the one circled in red on the
67
99
  screenshot).
68
100
 
69
- 4. **Produce the edit.** Modify the contract JSON to satisfy the instruction:
101
+ 4. **Produce the edit.** Modify the contract JSON to satisfy the instruction. The bullets below are
102
+ the **`steel.takeoff/v1`** field map; for `steel.model/v2` work from its own schema per step 2:
70
103
  - Profile changes: update `members[j].profile`; if the new profile resolves in the AISC
71
104
  table update `weights` too (plf from the AISC designation). Set `rfi: false` when you
72
105
  assign a real AISC size; `rfi: true` for marks (`MF`, `BF`) or unknowns.
@@ -77,19 +110,22 @@ means invalid — fix and retry.
77
110
  `tosDef: false` means the value came from the drawing, not the plan default.
78
111
  - Connection notes / detail refs: update `ends[].note` or `ends[].detail` (e.g. `"5-S504"`).
79
112
  - Flag adjustments: `mf: true` for moment-frame members; `rfi: true` for unresolved sizes.
80
- - **Preserve everything you're not changing** — v1 is a full-document writeback; partial
113
+ - **Preserve everything you're not changing** — both shapes are a full-document writeback; partial
81
114
  objects are not supported.
82
115
 
83
- 5. **Write it back.** `PUT http://localhost:<port>/api/contract/<appId>` with the full updated
84
- document (Content-Type: application/json) **and a precondition header**:
116
+ 5. **Write it back.** `PUT http://localhost:<port>/api/contract/<appId>` — **with the same
117
+ `?project=<project>` you read with** — carrying the full updated document
118
+ (Content-Type: application/json) **and a precondition header**:
85
119
  - **`If-Match: <the ETag from step 2>`** — the usual case, replacing a contract you read.
86
120
  - **`If-None-Match: *`** — ONLY when the GET returned **no** ETag at all. That happens on an app
87
121
  whose contract is still the baked example with no saved draft yet; it means "I believe this
88
122
  store is empty" and is refused if a draft appeared meanwhile.
89
123
 
90
124
  A PUT carrying neither is refused with **`428`** — the server never accepts a blind write.
91
- - **400** — schema-invalid. Read the error, fix the structure against
92
- `schemas/steel.takeoff.v1.schema.json`, and retry.
125
+ - **400** — schema-invalid, or a refused shape transition. Read the error and fix the structure
126
+ against the schema for the `type` you read in step 2 (`schemas/steel.takeoff.v1.schema.json` or
127
+ `schemas/steel.model.v2.schema.json`), then retry. A `contract-transition-refused` means you
128
+ changed the document's shape — write back the shape you read.
93
129
  - **412** — someone else (the user in the editor, another tool, a workflow run) wrote to this
94
130
  contract after you read it. **Do NOT retry the same body**: that would destroy their change.
95
131
  Re-read from step 2, re-apply your edit to the NEW document, and write again.
@@ -114,9 +150,10 @@ means invalid — fix and retry.
114
150
  - **Preserve unedited data.** Coordinates, rasters (`raster_b64`), detail bubbles, sheet
115
151
  previews — if you're not changing them, copy them through unchanged. Dropping fields silently
116
152
  corrupts the contract.
117
- - **Coordinates are display space, elevations are decimal inches.** Don't confuse them. Member
118
- geometry (`wp`, `segments`) is in display-space points (not feet, not native PDF coords).
119
- `tos` / `bos` / `elev_in` fields are always decimal inches (`16.5` = 16½ inches).
153
+ - **Units differ by shape — check `type` before you trust a number.** In `steel.takeoff/v1` member
154
+ geometry (`wp`, `segments`) is display-space points (not feet, not native PDF coords) and
155
+ `tos` / `bos` / `elev_in` are decimal inches (`16.5` = 16½ inches). In `steel.model/v2` members are
156
+ world **millimetres**. Reading a v2 coordinate as if it were v1 display space moves steel.
120
157
  - **Screenshots don't lie; instructions generalize.** If the screenshot shows a specific member
121
158
  and the instruction says "this beam", resolve "this" from the visual, not a guess.
122
159
  - **Never auto-approve.** Writing the contract back is the AI act. If the user asks what changed,
package/dist/web/app.js CHANGED
@@ -244,7 +244,7 @@ function renderTopology() {
244
244
  function renderLinearTopology(p) {
245
245
  const ports = computePorts(p);
246
246
  p.nodes.forEach((id, i) => {
247
- if (i > 0) $topology.appendChild(wireEl(i - 1, p.wires[i - 1]));
247
+ if (i > 0) $topology.appendChild(wireEl(p.wires[i - 1]));
248
248
  $topology.appendChild(cardEl(id, ports[id]));
249
249
  });
250
250
  }
@@ -395,12 +395,12 @@ function cardEl(id, ports) {
395
395
  return div;
396
396
  }
397
397
 
398
- function wireEl(idx, label) {
398
+ function wireEl(label) {
399
399
  const wrap = document.createElement('div');
400
400
  wrap.className = 'wire-wrap';
401
401
  wrap.innerHTML = `
402
402
  <div class="wire-label">${label || ''}</div>
403
- <div class="wire" data-wire-idx="${idx}"><div class="pulse"></div></div>
403
+ <div class="wire"><div class="pulse"></div></div>
404
404
  `;
405
405
  return wrap;
406
406
  }