opentakeoff-mcp 0.9.100 → 0.9.116

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +69 -17
  2. package/dist/server-core.js +8226 -993
  3. package/package.json +2 -2
package/README.md CHANGED
@@ -44,9 +44,9 @@ what's missing where rendering isn't available.
44
44
  engine is re-validated against a wider plan corpus: `tools/list` never names them, the
45
45
  initialize `instructions` say so and point at `measure_polygon`, and no other tool's
46
46
  description sends an agent to a verb that is not there. A default build registers
47
- **<!--tool-count-->58<!--/tool-count--> tools**. Everything else — sweeps, counts, `derive_base`, `derive_transitions`, the
47
+ **<!--tool-count-->70<!--/tool-count--> tools**. Everything else — sweeps, counts, `derive_base`, `derive_transitions`, the
48
48
  exports — is unchanged. Set `OPENTAKEOFF_ONE_CLICK=1` in the server's environment to
49
- register both verbs (<!--tool-count-all-->60<!--/tool-count-all--> tools); the parity, conformance and e2e tests run that way, and
49
+ register both verbs (<!--tool-count-all-->72<!--/tool-count-all--> tools); the parity, conformance and e2e tests run that way, and
50
50
  `test/gate.test.ts` pins both surfaces. The rows and examples below that use `one_click`
51
51
  describe the lifted build. Design note: [`docs/design/ONE_CLICK_GATE.md`](../docs/design/ONE_CLICK_GATE.md).
52
52
 
@@ -123,7 +123,7 @@ includes document text, shape vertices, or result payload content.
123
123
 
124
124
  ### Staged tool exposure (opt-in)
125
125
 
126
- By default every client gets all <!--tool-count-->58<!--/tool-count--> tool schemas on `tools/list`—the flat
126
+ By default every client gets all <!--tool-count-->70<!--/tool-count--> tool schemas on `tools/list`—the flat
127
127
  contract every published client already expects. Fifty-two descriptions is real
128
128
  token weight for an agent session that may never touch half of them, so the
129
129
  server can instead stage the surface along the workflow it already teaches:
@@ -132,7 +132,7 @@ server can instead stage the surface along the workflow it already teaches:
132
132
  OPENTAKEOFF_MCP_STAGED_TOOLS=1 npx -y opentakeoff-mcp
133
133
  ```
134
134
 
135
- Staged, only the **setup** stage (load, scale, read the set—<!--tool-count-setup-->11<!--/tool-count-setup--> tools) starts
135
+ Staged, only the **setup** stage (load, scale, read the set—<!--tool-count-setup-->22<!--/tool-count-setup--> tools) starts
136
136
  enabled, plus one opener: `open_tool_stage`. Calling it with `"measure"`,
137
137
  `"revise"`, or `"handoff"` enables that stage's tools and fires
138
138
  `tools/list_changed`, so any client that supports dynamic tool lists (Claude
@@ -201,6 +201,7 @@ The [generated tool index](../docs/MCP_TOOL_INDEX.md) lists stages and required
201
201
  | `delete_rfi` | Withdraw an RFI. A **tombstone, never a renumber**: the number stays reserved, the register and the marked set keep printing a gap where it was, and the next RFI takes the next number. Linked markups keep their note and lose the link (the canvas's own delete rule). `undo_last` puts the record and its links back. |
202
202
  | `set_pricing` | Price one condition for the estimate (the canvas **Estimate** panel's row): `unit` (SF / SY / LF / EA), `material` and `labor` $ per unit, and `materials` [{name, price}] for its supporting-material rows per their own unit. Material prices the **order** quantity (waste applied), labor the **measured** one. `null` clears a price to *not entered*; `0` is an explicit $0. Prices come from the estimator, never from the agent. One `undo_last` step restores the condition's prices verbatim; they ride `export_takeoff` into the app. |
203
203
  | `set_estimate_settings` | The project's **markups** (`tax_pct` on material, `overhead_pct`, `profit_pct` as a `markup` or a `margin`), **proposal** text and layout (`itemized`, `scope_note`, `inclusions`, `exclusions`, `terms`, `valid_days`) and **client** (name, address, reference): the canvas's `estimate_settings`, `bid_proposal` and `client_info`. Only what you pass changes; `undo_last` restores all three. |
204
+ | `compare_sheets` | Visual revision comparison of two sheets (or revisions of a sheet): discovers what moved between them. Automatically aligns vector linework, computes segment differences, groups modified/added/removed ink into changed region bounding hulls, and returns existing takeoff shape IDs on `sheet_a` that intersect changed ink so an agent can re-check only what moved. |
204
205
  | `read_sheet_text` | Positioned page text (image px), optionally restricted to a region—title blocks, room labels, finish schedules. |
205
206
  | `find_text` | **Locate** a known string—the complement to `read_sheet_text` (which returns what a region *says*; this finds *where* a string sits). Case-insensitive substring match per pdf.js text run; each hit's center feeds straight into `one_click`'s seed. |
206
207
  | `sheet_graph` | The plan-set INDEX (#87): every sheet's role with evidence, the schedule tables found, every room tag with its stacked name, the detail callouts, and every revision marker (text `Δ2`/`REV 2` tags AND drawn deltas—a bare digit inside a triangle of linework, proven from the sheet's vector geometry—in `revisions`)—how an agent decides WHAT to measure without a human enumerating rooms. |
@@ -209,6 +210,59 @@ The [generated tool index](../docs/MCP_TOOL_INDEX.md) lists stages and required
209
210
  | `sheet_context` | The region's STRUCTURE in one frame: classified vector segments (endpoints as drawn, meta byte per segment), text spans with bboxes, and hatch-family instances with content-derived ids—same pattern spec ⇒ same id anywhere on the sheet, so plan↔legend matching is `id === id`. Decimation is declared and counted on every reply: `kept + dropped === total_in_region`, cap applies longest-first so walls survive. |
210
211
  | `get_sheet_vectors` | The STROKES (#367): the sheet's vector layer exactly as the engine is fed it—flat `[x1, y1, x2, y2, …]` points in image px, one meta byte per segment (curve / clip / fill-only / polyline-arc flags, pen width in the high nibble), per-segment stroke luminance, the drawn figure each segment belongs to, the placed-image area, and the PDF layer table with a per-segment layer index. Nothing classified, decimated, or merged—so a reader can run its own room finder, symbol matcher, or wall classifier against the same array and commit through the existing verbs. Paged (default 20,000 segments, ceiling 100,000) with `offset + returned + dropped === total` on every page; `next_cursor` recovers exactly what `dropped` counts. Read-only and stateless. Refuses on a scan and names `view_sheet` as the path. |
211
212
  | `view_sheet` | The agent's eyes: render the sheet (or an image-px crop) to PNG. `overlay` burns committed shapes in (solid = human-affirmed, dashed = unreviewed) to verify geometry landed; `grid` burns in a calibrated 1-ft/5-ft measuring grid with foot labels (`"auto"` from the set scale, or the drawing scale like `"1/4"`) so dimensions are counted off cells, not guessed; `marks` (#297) burns disclosure layers in — `question` (withheld placements, orange ?-circle), `struck` (rejections, magenta struck ×), `ring` (the sweep's seed, violet double ring) — in colors off the common CAD pens, so what a reply names, the picture shows. |
213
+ | `stitch_sheets` | Stitch 2–4 plan sheets together into a composite working surface across match-lines (#161)—the browser canvas's Stitched Sheets feature. Shapes traced on the returned stitch reference bind to the composite key (`stitch:<uid>`) and measure continuously across seam boundaries once aligned. By default sheets create in auto-butt layout (`aligned: false`). Member sheets must have calibrated, matching scales. |
214
+ | `align_stitch` | Align member sheets of a composite stitch surface using anchor and moving reference points across a match line. Performs automated seam linework analysis, calculating displacement and leftover rotation across the seam, and withholds the stitch if tolerances are exceeded (0.50" / 0.25°). |
215
+ | `list_stitches` | List all existing composite stitched sheet surfaces in the current session, including dimensions, member sheet placements, inherited scale, alignment status, seam check results, and shape counts. |
216
+ | `rotate_page` | Rotate a sheet's page in the PDF (90, 180, or 270 degrees clockwise) before measuring. Transforms all existing takeoff shapes, markups, and calibrations on that sheet to remain locked to the drawing. |
217
+ | `reorder_pages` | Reorder pages in a loaded PDF document. Remaps all takeoff sheet keys so measurements and annotations follow their pages. |
218
+ | `extract_pages` | Extract a subset of pages from a loaded PDF into a new PDF file on disk. Carries all takeoff shapes and annotations on those pages into the new document (mapped to pages 1..N). |
219
+ | `merge_documents` | Merge multiple PDF files into one combined PDF document on disk. Combines the pages and remaps takeoff keys from all source documents. |
220
+
221
+ ### The Assistant window — talk to your AI from inside the canvas
222
+
223
+ | Tool | What it does |
224
+ |---|---|
225
+ | `assistant_open` | Starts a private link on `127.0.0.1` (ports 47615–47619; only the OpenTakeoff app's origin may use it, and only after pairing) and returns a one-time `code` and a `link` that opens the canvas already paired. The canvas's Assistant window then shows which AI app is answering ("Powered by Claude Code", "Claude Desktop", "Codex", …) from the name the client announced at initialize. |
226
+ | `assistant_listen` | Waits (default 45 s, max 240 s, with progress pings) for what the person types in the window. `message` → do the work and answer with `assistant_say`; `timeout` → listen again; `sleep` after 10 idle minutes → stop and tell them to say "listen" when they want you back. Every other tool call is mirrored into the window live while you work. |
227
+ | `assistant_say` | Puts your Markdown reply in the window. |
228
+
229
+ ### Trade suites, opened one trade at a time
230
+
231
+ | Tool | What it does |
232
+ |---|---|
233
+ | `open_suite` | Opens a trade suite: enables that trade's tools and returns its method (the steps, in order, naming the tools) and the condition tags its tools default to. No arguments returns the catalog. `division: "07"` opens every suite of a CSI division. Idempotent; never closes anything. |
234
+
235
+ Each suite's tools are registered **disabled**, so they are not in `tools/list`
236
+ until `open_suite` enables them and fires `tools/list_changed`. An agent doing a
237
+ roof never carries the plumbing schemas, and a suite's method is handed over
238
+ once, at open time, instead of riding every turn. The long form is the
239
+ `takeoff://wiki/suites` resource.
240
+
241
+ | Suite | Divisions | Tool it adds |
242
+ |---|---|---|
243
+ | finishes | 09 | none: core tools (`measure_polygon`, `derive_base`, `derive_transitions`, `measure_surface`) |
244
+ | acoustical_ceilings | 09 | `ceiling_takeoff`: from lay-in areas on the reflected ceiling plan and the module (2x2, 2x4, or 600x600 / 600x1200 in metric): tiles before and with waste, main runners, long and short cross tees, hanger wires at the spec spacing, all as material rows; each area's perimeter committed as a wall angle run. |
245
+ | roofing | 07 | `roof_takeoff`: sloped SF and squares from plan-view planes and a stated pitch, true rake/hip/valley LF, drip edge, starter, ridge cap, underlayment, ice & water. Writes the slope factors onto the conditions so every total reads true. |
246
+ | siding | 07 | `siding_takeoff`: net wall SF and squares from elevation faces minus openings, opening trim (doors 3 sides), starter along wall bottoms, corner LF, lap pieces. |
247
+ | soffit_fascia | 07 | `soffit_takeoff`: soffit SF (eave/rake LF × depth from the wall section), fascia LF, wall receiver, attic intake vent area. |
248
+ | glazing | 08 | `glazing_takeoff`: per frame: lites, daylight opening size, glass SF, mullion LF (committed as lines), perimeter sealant. |
249
+ | doors | 08 | none: core tools (`find_schedule`, `sweep_schedule_row`, `count_marks`) |
250
+ | plumbing | 22 | `plumbing_rollup`: fixture counts checked against the schedule QTY, pipe LF with hangers, fittings allowance, insulation. |
251
+ | electrical | 26, 27, 28 | `electrical_rollup`: wire LF per run by conductors and sets, couplings, straps, a box and plate per device, fixture whips. |
252
+
253
+ The suite tools are derives: they read what is already committed and commit
254
+ what follows as unreviewed shapes or material rows, one `undo_last` step per
255
+ write (each reply says how many). They never measure the drawing themselves and
256
+ never invent a document value: pitch, soffit depth, grid and hanger spacing are
257
+ arguments, and every allowance is reported as an allowance. Each takes
258
+ `units: "metric"` for arguments and a reply in mm, mm², m and m², and names
259
+ any argument it does not take, in `unknown_args` or in its refusal.
260
+
261
+ A client that reads the tool list only once can pre-open suites:
262
+
263
+ ```bash
264
+ OPENTAKEOFF_MCP_SUITES=roofing,siding npx -y opentakeoff-mcp # or =all
265
+ ```
212
266
 
213
267
  ### The agent revises its own work
214
268
 
@@ -379,19 +433,17 @@ sheet number (`A-101`) wherever a sheet is named.
379
433
  has nothing for `detect_rooms`/`sheet_graph`/`resolve_tag` to read: seeds
380
434
  come from you (`view_sheet`, then `one_click`). The raster path needs the
381
435
  same optional `@napi-rs/canvas` as `view_sheet`.
382
- - **Stitching is human-only—deliberately, not a gap.** The canvas can join
383
- 2–4 sheets split at a match line into one composite surface (#200), but no
384
- MCP verb creates, aligns, or addresses a stitch. Joining the match line
385
- means clicking the same drawn wall junction on both halves—a judgment
386
- call with a worse blast radius than a bad scale, because a sloppy align
387
- silently skews every quantity that crosses the seam. That stays behind
388
- human eyes; it is not staged for later exposure. For a split floor: a
389
- human stitches and aligns in the canvas, and over MCP you work each member
390
- sheet as its own surface—a seam-crossing room belongs to the canvas.
391
- This server also doesn't read the app's additive `stitches` payload field,
392
- so a stitched takeoff round-tripped through `import_takeoff` →
393
- `export_takeoff` comes back without its stitches—when a stitch is in
394
- play, the app's own save is the one to keep.
436
+ - **Stitching is gated by a seam check.** `stitch_sheets` joins 2–4 sheets
437
+ split at a match line into one composite surface (`stitch:<uid>`), and
438
+ `align_stitch` places them from a point both sheets draw. A sloppy join
439
+ skews every quantity that crosses the seam, so the server compares the two
440
+ sheets' linework after each alignment and refuses to measure across a seam
441
+ while the stitch is unaligned or the check is withheld (maximum miss over
442
+ 0.5 in by default, any leftover rotation, or no linework at the seam).
443
+ When it withholds, measure each member sheet on its own and tell the user.
444
+ `export_takeoff` and `import_takeoff` carry stitch records. The steps,
445
+ the numbers in the check and a run on a real split pair are in
446
+ [Stitching sheets over MCP](../docs/MCP_STITCHING.md).
395
447
  - `load_plan` replaces the session by default; `merge: true` builds a multi-document working set (#152). Reloading a merged file is refused—reload = replace, deliberately.
396
448
  - The takeoff lives in memory. `export_takeoff` (the app's exact save payload,
397
449
  nothing lost in translation) and `export_marked_pdf` (the reviewable marked