opentakeoff-mcp 0.9.32 → 0.9.33
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.
- package/README.md +3 -3
- package/dist/server-core.js +95 -24
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -121,13 +121,13 @@ includes document text, shape vertices, or result payload content.
|
|
|
121
121
|
| `takeoff_summary` | Per-condition totals + grand totals, computed by the Report's rules. |
|
|
122
122
|
| `export_takeoff` | The full `opentakeoff.takeoff_canvas.v1` payload — exactly what the app autosaves. Inline, and to disk with `path`. |
|
|
123
123
|
| `delete_shape` | Remove a committed shape by id. |
|
|
124
|
-
| `edit_shape` | **Revise** a committed shape instead of redoing it: new `verts`, a different `condition`, a different `role`, or any combination — quantities recomputed from the result. Refuses shapes a human affirmed. |
|
|
125
|
-
| `edit_materials` | Add/remove/patch supporting-materials rows on a condition — the coverage-rate lines (adhesive at N sf/gal, grout at N lf/bag, …) that turn a measured quantity into an order quantity, matching the canvas's Supporting Materials panel. `condition` mints on first touch, like `one_click`/`measure_polygon`. No review gate (materials rows are quantity config, not traced geometry) — edits directly, reversible with `undo_last`. |
|
|
124
|
+
| `edit_shape` | **Revise** a committed shape instead of redoing it: new `verts`, a different `condition`, a different `role`, a `label` (the room it belongs to — what per-room reporting groups by; `""` clears it), or any combination — quantities recomputed from the result. Refuses shapes a human affirmed. |
|
|
125
|
+
| `edit_materials` | Add/remove/patch supporting-materials rows on a condition — the coverage-rate lines (adhesive at N sf/gal, grout at N lf/bag, …) that turn a measured quantity into an order quantity, matching the canvas's Supporting Materials panel. `basis` is `area` \| `linear` \| `count` \| **`seam_lf`** — the last is the *figured* roll-layout seam length a weld rod or seam tape is bought by (set `roll_setup` on the condition first; without one it reads 0, because nothing has decided how that floor gets cut). `condition` mints on first touch, like `one_click`/`measure_polygon`. No review gate (materials rows are quantity config, not traced geometry) — edits directly, reversible with `undo_last`. |
|
|
126
126
|
| `edit_condition` | Set a condition's **waste %**, **×N multiplier**, **height_ft** (the H knob `measure_surface` quantifies against), and **roll_setup** (the roll-goods opt-in: seams figured, cuts packed, the reply echoes the order — cuts, `order_lf`, rolls, `order_qty` — and `export_report`'s `roll_goods` block carries the same rows; `null` opts out) — the knobs that turn measured quantities into order quantities. Resolves an **existing** finish tag or errors — a typo must not mint an empty condition. No review gate; one `undo_last` step restores the knobs verbatim. |
|
|
127
127
|
| `export_report` | The **computed Report document** — `opentakeoff.report.v1`, the same JSON the canvas Report exports: gross + waste-adjusted quantities, the computed materials **buy list** per condition plus the project-wide roll-up, per-sheet base subtotals, and scale provenance. The contract for pricing consumers — `export_takeoff` carries materials as config rows, `takeoff_summary` strips them. Inline, and to disk with `path`. |
|
|
128
128
|
| `import_takeoff` | **The way back in**: load a `takeoff_canvas.v1` file (a prior `export_takeoff`, or the app's own save) through the SAME merge rules as the app's Sheet-menu import — finish-tag identity joins conditions (this session's knobs win), new ids append, duplicates skip (idempotent re-import), this session's calibration wins per sheet. Resume, extend, or audit. |
|
|
129
129
|
| `export_marked_pdf` | The **marked-up planset** — the deliverable. Writes a distribution-ready PDF: a legend cover (per-condition totals, swatches, by-sheet breakdown) plus every sheet that carries work, vector-copied from the source with shapes, hatches, per-shape quantity chips, and annotations burned in — built by the same module as the canvas's MARKED SET button. Machine-traced shapes are disclosed as pending human review on the document itself, and the cover states where the finish tags came from (`Finish assignment: N schedule-resolved · N agent-asserted · …`, plus any rooms the last assign run withheld). Default path: `<plan> - marked set.pdf` next to the plan. Works without `@napi-rs/canvas`. |
|
|
130
|
-
| `list_shapes` | The **mid-session inventory**: every committed shape's id, sheet, condition, role, quantities, review state, and assignment verdict (`schedule` \| `asserted` — where its finish tag came from) in one compact read — the ids `edit_shape`/`delete_shape` assume you have, without pulling the whole `export_takeoff` payload. Filters by sheet/condition narrow; empty is a result, not an error. |
|
|
130
|
+
| `list_shapes` | The **mid-session inventory**: every committed shape's id, sheet, condition, role, quantities, room `label`, review state, and assignment verdict (`schedule` \| `asserted` — where its finish tag came from) in one compact read — the ids `edit_shape`/`delete_shape` assume you have, without pulling the whole `export_takeoff` payload. Filters by sheet/condition narrow; empty is a result, not an error. |
|
|
131
131
|
| `undo_last` | Step back over your own last `n` mutations, newest first. Exact inverses: a commit is removed, an edit restored verbatim, a delete re-inserted where it was, a materials edit's whole array restored, a condition edit's waste/multiplier pair restored. A whole `detect_rooms` sweep is **one** step. |
|
|
132
132
|
| `annotate` | Place a note ABOUT the work — cloud/highlight (`rect`), text (`at`), callout (`at` + `target`), **arrow** (`from` + `to` — plank/seam direction), **bubble** (`at` + optional `r` — keynote circle, centered text), **dimension** (`from` + `to` — a dimension line with end ticks, labelled with the measured length at the sheet's scale; the one annotation the scale gate applies to — an unscaled sheet refuses like the measure tools). Attach to a condition and it wears that scope's colour on the canvas and in the marked set. No review gate: notes are not geometry. |
|
|
133
133
|
| `list_annotations` | Every annotation with its condition RESOLVED to a finish tag, coordinates back in image px; filter by sheet/condition. `unattached` counts the link_annotation candidates. `verdicts[]` is the approval family's inventory — every mark with its actor stated, a condition filter reaching a verdict through its target shape. |
|
package/dist/server-core.js
CHANGED
|
@@ -3884,7 +3884,8 @@ function accumulateRole(acc, s) {
|
|
|
3884
3884
|
break;
|
|
3885
3885
|
}
|
|
3886
3886
|
}
|
|
3887
|
-
function conditionTotals(conditions, shapes) {
|
|
3887
|
+
function conditionTotals(conditions, shapes, ctx = null) {
|
|
3888
|
+
const seamByShape = ctx?.seamByShape instanceof Map ? ctx.seamByShape : null;
|
|
3888
3889
|
return conditions.map((c) => {
|
|
3889
3890
|
const mult = c.multiplier || 1;
|
|
3890
3891
|
const waste = Math.max(0, Number(c.waste_pct) || 0);
|
|
@@ -3893,15 +3894,17 @@ function conditionTotals(conditions, shapes) {
|
|
|
3893
3894
|
const acc = { floor: 0, wall: 0, border: 0, lf: 0, ea: 0 };
|
|
3894
3895
|
for (const s of cs) accumulateRole(acc, s);
|
|
3895
3896
|
let { floor, wall, border, lf, ea } = acc;
|
|
3897
|
+
let seam = seamByShape ? cs.reduce((n, s) => n + (seamByShape.get(s.id) || 0), 0) : 0;
|
|
3896
3898
|
floor *= mult;
|
|
3897
3899
|
wall *= mult;
|
|
3898
3900
|
border *= mult;
|
|
3899
3901
|
lf *= mult;
|
|
3900
3902
|
ea *= mult;
|
|
3903
|
+
seam *= mult;
|
|
3901
3904
|
const total = floor + wall + border;
|
|
3902
3905
|
const materials = (c.materials || []).filter((m) => m && m.name).map((m) => {
|
|
3903
3906
|
const per = Math.max(0, Number(m.per) || 0);
|
|
3904
|
-
const basisVal = m.basis === "linear" ? lf : m.basis === "count" ? ea : total;
|
|
3907
|
+
const basisVal = m.basis === "linear" ? lf : m.basis === "count" ? ea : m.basis === "seam_lf" ? seam : total;
|
|
3905
3908
|
let qty = per > 0 ? basisVal / per : 0;
|
|
3906
3909
|
qty = m.round === false ? round22(qty) : Math.ceil(qty - 1e-9);
|
|
3907
3910
|
return { name: m.name, unit: m.unit || "", per, basis: m.basis || "area", round: m.round !== false, note: m.note || "", basis_qty: round22(basisVal), qty };
|
|
@@ -4240,6 +4243,32 @@ function layoutRingStrips(item, direction, config) {
|
|
|
4240
4243
|
function sumStripLengthsFt(strips) {
|
|
4241
4244
|
return strips.reduce((s, st) => s + Math.max(0, st.runMax - st.runMin), 0);
|
|
4242
4245
|
}
|
|
4246
|
+
function seamLfBySrc(strips) {
|
|
4247
|
+
const bySrc = /* @__PURE__ */ new Map();
|
|
4248
|
+
for (const st of strips || []) {
|
|
4249
|
+
if (!bySrc.has(st.srcId)) bySrc.set(st.srcId, []);
|
|
4250
|
+
bySrc.get(st.srcId).push(st);
|
|
4251
|
+
}
|
|
4252
|
+
const out = /* @__PURE__ */ new Map();
|
|
4253
|
+
for (const [srcId, lanes] of bySrc) {
|
|
4254
|
+
lanes.sort((a, b) => (a.laneIndex || 0) - (b.laneIndex || 0));
|
|
4255
|
+
let total = 0;
|
|
4256
|
+
for (let i = 0; i + 1 < lanes.length; i++) {
|
|
4257
|
+
const a = lanes[i], b = lanes[i + 1];
|
|
4258
|
+
if ((b.laneIndex || 0) !== (a.laneIndex || 0) + 1) continue;
|
|
4259
|
+
const aLo = a.runMin + (a.minOverageFt || 0), aHi = a.runMax - (a.maxOverageFt || 0);
|
|
4260
|
+
const bLo = b.runMin + (b.minOverageFt || 0), bHi = b.runMax - (b.maxOverageFt || 0);
|
|
4261
|
+
total += Math.max(0, Math.min(aHi, bHi) - Math.max(aLo, bLo));
|
|
4262
|
+
}
|
|
4263
|
+
if (total > 0) out.set(srcId, Math.round(total * 100) / 100);
|
|
4264
|
+
}
|
|
4265
|
+
return out;
|
|
4266
|
+
}
|
|
4267
|
+
function seamLfForStrips(strips) {
|
|
4268
|
+
let total = 0;
|
|
4269
|
+
for (const v of seamLfBySrc(strips).values()) total += v;
|
|
4270
|
+
return Math.round(total * 100) / 100;
|
|
4271
|
+
}
|
|
4243
4272
|
function assignDefaultCutPositions(strips, rollWidthFt, seqById, rollLenFt = 0) {
|
|
4244
4273
|
const EPS = 1e-6;
|
|
4245
4274
|
const L = rollLenFt > 0 ? rollLenFt : Infinity;
|
|
@@ -4471,7 +4500,9 @@ function computeRollTakeoff(conditions, shapes, dimsFor, uppFor) {
|
|
|
4471
4500
|
oversize: layout.strips.some((s) => s.overRoll),
|
|
4472
4501
|
qty: round22(rollQtyForUnit(orderFt, config.rollWidthFt, unit)),
|
|
4473
4502
|
unit,
|
|
4474
|
-
cutCount: layout.strips.length
|
|
4503
|
+
cutCount: layout.strips.length,
|
|
4504
|
+
seamLf: seamLfForStrips(layout.strips),
|
|
4505
|
+
seamByShape: seamLfBySrc(layout.strips)
|
|
4475
4506
|
});
|
|
4476
4507
|
for (const strip of layout.strips) {
|
|
4477
4508
|
const src = shapeById.get(strip.srcId);
|
|
@@ -4524,11 +4555,25 @@ function rollReportRows(rollByCond, rows) {
|
|
|
4524
4555
|
rolls: ri.rollCount * mult,
|
|
4525
4556
|
order_qty: round22(ri.qty * mult),
|
|
4526
4557
|
order_unit: ri.unit,
|
|
4527
|
-
oversize: ri.oversize
|
|
4558
|
+
oversize: ri.oversize,
|
|
4559
|
+
// seam_lf APPENDS last (the additive-only convention the roll_goods
|
|
4560
|
+
// block already follows): the figured weld-rod / seam-tape length, ×N
|
|
4561
|
+
// like every other reported quantity. 0 is a real answer — a layout
|
|
4562
|
+
// whose rooms each fit one strip has no seams to weld.
|
|
4563
|
+
seam_lf: round22((ri.seamLf || 0) * mult)
|
|
4528
4564
|
});
|
|
4529
4565
|
}
|
|
4530
4566
|
return out;
|
|
4531
4567
|
}
|
|
4568
|
+
function seamLfByShape(rollByCond) {
|
|
4569
|
+
const out = /* @__PURE__ */ new Map();
|
|
4570
|
+
if (!rollByCond || typeof rollByCond.forEach !== "function") return out;
|
|
4571
|
+
rollByCond.forEach((ri) => {
|
|
4572
|
+
if (!ri || !(ri.seamByShape instanceof Map)) return;
|
|
4573
|
+
ri.seamByShape.forEach((lf, shapeId) => out.set(shapeId, (out.get(shapeId) || 0) + lf));
|
|
4574
|
+
});
|
|
4575
|
+
return out;
|
|
4576
|
+
}
|
|
4532
4577
|
|
|
4533
4578
|
// src/view.ts
|
|
4534
4579
|
var INK = "#d91a1a";
|
|
@@ -5483,13 +5528,15 @@ var Session = class _Session {
|
|
|
5483
5528
|
}
|
|
5484
5529
|
let shape_id;
|
|
5485
5530
|
if (tag) {
|
|
5486
|
-
|
|
5531
|
+
const shape = this.commit(s, tag, opts.role, c.ring, { area_sf, perimeter_lf }, {
|
|
5487
5532
|
method: "one_click_v1",
|
|
5488
5533
|
actor: "agent",
|
|
5489
5534
|
seed_norm: [c.seed[0] / s.widthPx, c.seed[1] / s.heightPx],
|
|
5490
5535
|
reviewed: false,
|
|
5491
5536
|
...assignment ? { assignment } : {}
|
|
5492
|
-
}, c.ev)
|
|
5537
|
+
}, c.ev);
|
|
5538
|
+
shape.label = c.label;
|
|
5539
|
+
shape_id = shape.id;
|
|
5493
5540
|
}
|
|
5494
5541
|
return { ...common, area_sf, perimeter_lf, ...shape_id ? { shape_id, condition: tag } : {} };
|
|
5495
5542
|
}).filter((r) => r !== null);
|
|
@@ -6248,6 +6295,7 @@ var Session = class _Session {
|
|
|
6248
6295
|
...x.computed.perimeter_lf !== void 0 ? { perimeter_lf: x.computed.perimeter_lf } : {},
|
|
6249
6296
|
...x.computed.count !== void 0 ? { count: x.computed.count } : {},
|
|
6250
6297
|
...x.height_ft !== void 0 ? { height_ft: x.height_ft } : {},
|
|
6298
|
+
...x.label ? { label: x.label } : {},
|
|
6251
6299
|
nverts: x.verts_norm.length,
|
|
6252
6300
|
reviewed: x.origin?.reviewed === true,
|
|
6253
6301
|
...x.origin?.assignment ? { assignment: x.origin.assignment.source } : {},
|
|
@@ -6257,7 +6305,7 @@ var Session = class _Session {
|
|
|
6257
6305
|
};
|
|
6258
6306
|
}
|
|
6259
6307
|
summary() {
|
|
6260
|
-
const rows = conditionTotals(this.conditions, this.shapes);
|
|
6308
|
+
const rows = conditionTotals(this.conditions, this.shapes, this.seamCtx());
|
|
6261
6309
|
const lean = rows.map(({ color, fill, hatch, materials, ...rest }) => rest);
|
|
6262
6310
|
return { conditions: lean, totals: grandTotals(rows) };
|
|
6263
6311
|
}
|
|
@@ -6280,6 +6328,11 @@ var Session = class _Session {
|
|
|
6280
6328
|
* makes this surface portable to a host that DOES have a review gate, and it
|
|
6281
6329
|
* belongs in the code rather than in a host's good intentions.
|
|
6282
6330
|
*
|
|
6331
|
+
* `label` is the room (or phase, or area) the shape belongs to — the same
|
|
6332
|
+
* per-shape field the canvas groups the Report by. A visible string sets it,
|
|
6333
|
+
* "" clears it, and the whole shape is snapshotted before the write, so undo
|
|
6334
|
+
* restores a cleared label as exactly as it restores geometry.
|
|
6335
|
+
*
|
|
6283
6336
|
* Provenance: agent self-revision bumps origin.agent_edits and touches
|
|
6284
6337
|
* NOTHING in the human-correction vocabulary (edited / edits /
|
|
6285
6338
|
* proposed_verts_norm — see web/src/lib/provenance.js). Those fields grade a
|
|
@@ -6295,8 +6348,8 @@ var Session = class _Session {
|
|
|
6295
6348
|
if (cur.origin?.reviewed === true) {
|
|
6296
6349
|
throw new UserError(`Shape ${JSON.stringify(id)} was affirmed by a human \u2014 reviewed work is ink, not pencil, and cannot be edited by an agent.`);
|
|
6297
6350
|
}
|
|
6298
|
-
if (patch.verts === void 0 && patch.condition === void 0 && patch.role === void 0) {
|
|
6299
|
-
throw new UserError("Nothing to change \u2014 pass at least one of verts, condition, role.");
|
|
6351
|
+
if (patch.verts === void 0 && patch.condition === void 0 && patch.role === void 0 && patch.label === void 0) {
|
|
6352
|
+
throw new UserError("Nothing to change \u2014 pass at least one of verts, condition, role, label.");
|
|
6300
6353
|
}
|
|
6301
6354
|
const s = this.sheet(cur.sheet_id);
|
|
6302
6355
|
const role = patch.role ?? cur.measure_role;
|
|
@@ -6323,12 +6376,14 @@ var Session = class _Session {
|
|
|
6323
6376
|
})();
|
|
6324
6377
|
const before = structuredClone(cur);
|
|
6325
6378
|
const condition_id = patch.condition !== void 0 ? this.conditionFor(patch.condition).id : cur.condition_id;
|
|
6379
|
+
const nextLabel = patch.label !== void 0 ? patch.label.trim() : cur.label ?? "";
|
|
6326
6380
|
this.shapes[i] = {
|
|
6327
6381
|
...cur,
|
|
6328
6382
|
condition_id,
|
|
6329
6383
|
measure_role: role,
|
|
6330
6384
|
verts_norm: vertsPx.map(([x, y]) => [x / s.widthPx, y / s.heightPx]),
|
|
6331
6385
|
computed,
|
|
6386
|
+
...nextLabel ? { label: nextLabel } : {},
|
|
6332
6387
|
...role === "surface_area" ? { height_ft: Number(cur.height_ft) || heightFor() } : {},
|
|
6333
6388
|
...cur.origin ? { origin: {
|
|
6334
6389
|
...cur.origin,
|
|
@@ -6338,11 +6393,13 @@ var Session = class _Session {
|
|
|
6338
6393
|
...patch.condition !== void 0 && cur.origin.assignment?.source === "schedule" ? { assignment: { source: "asserted" } } : {}
|
|
6339
6394
|
} } : {}
|
|
6340
6395
|
};
|
|
6396
|
+
if (!nextLabel) delete this.shapes[i].label;
|
|
6341
6397
|
this.record({ op: "edit", tool: "edit_shape", before });
|
|
6342
6398
|
const changed = [
|
|
6343
6399
|
...patch.verts !== void 0 ? ["verts"] : [],
|
|
6344
6400
|
...patch.condition !== void 0 ? ["condition"] : [],
|
|
6345
|
-
...patch.role !== void 0 ? ["role"] : []
|
|
6401
|
+
...patch.role !== void 0 ? ["role"] : [],
|
|
6402
|
+
...patch.label !== void 0 ? ["label"] : []
|
|
6346
6403
|
];
|
|
6347
6404
|
return {
|
|
6348
6405
|
shape_id: id,
|
|
@@ -6350,6 +6407,7 @@ var Session = class _Session {
|
|
|
6350
6407
|
measure_role: role,
|
|
6351
6408
|
nverts: vertsPx.length,
|
|
6352
6409
|
...computed,
|
|
6410
|
+
...nextLabel ? { label: nextLabel } : {},
|
|
6353
6411
|
agent_edits: this.shapes[i].origin?.agent_edits ?? 0
|
|
6354
6412
|
};
|
|
6355
6413
|
}
|
|
@@ -6477,6 +6535,16 @@ var Session = class _Session {
|
|
|
6477
6535
|
uppFor: (sheetId) => this.sheets.get(sheetId)?.upp ?? null
|
|
6478
6536
|
};
|
|
6479
6537
|
}
|
|
6538
|
+
/** The figured seam length per SHAPE, as conditionTotals wants it — the
|
|
6539
|
+
* basis a materials row with basis "seam_lf" (weld rod, seam tape) divides
|
|
6540
|
+
* against. computeRollTakeoff returns immediately when no condition carries
|
|
6541
|
+
* a roll setup, so this costs nothing on a job that has none, and every
|
|
6542
|
+
* seam_lf row on such a job reads 0 rather than guessing. */
|
|
6543
|
+
seamCtx() {
|
|
6544
|
+
const { dimsFor, uppFor } = this.rollInputs();
|
|
6545
|
+
const { byCond } = computeRollTakeoff(this.conditions, this.shapes, dimsFor, uppFor);
|
|
6546
|
+
return { seamByShape: seamLfByShape(byCond) };
|
|
6547
|
+
}
|
|
6480
6548
|
editCondition(tag, opts) {
|
|
6481
6549
|
if (opts.waste_pct === void 0 && opts.multiplier === void 0 && opts.height_ft === void 0 && opts.roll_setup === void 0) {
|
|
6482
6550
|
throw new UserError("Nothing to change \u2014 pass at least one of waste_pct, multiplier, height_ft, roll_setup.");
|
|
@@ -6991,9 +7059,9 @@ var Session = class _Session {
|
|
|
6991
7059
|
* document carries the computed order quantities. */
|
|
6992
7060
|
exportReport(projectName = "") {
|
|
6993
7061
|
if (!this.docs.size) throw new UserError("No plan loaded \u2014 call load_plan first.");
|
|
6994
|
-
const rows = conditionTotals(this.conditions, this.shapes).filter((r) => r.shape_count > 0);
|
|
6995
7062
|
const { dimsFor, uppFor } = this.rollInputs();
|
|
6996
7063
|
const { byCond } = computeRollTakeoff(this.conditions, this.shapes, dimsFor, uppFor);
|
|
7064
|
+
const rows = conditionTotals(this.conditions, this.shapes, { seamByShape: seamLfByShape(byCond) }).filter((r) => r.shape_count > 0);
|
|
6997
7065
|
return reportJson({
|
|
6998
7066
|
projectName,
|
|
6999
7067
|
rows,
|
|
@@ -7489,6 +7557,7 @@ var listShapesOutput = {
|
|
|
7489
7557
|
perimeter_lf: z.number().optional(),
|
|
7490
7558
|
count: z.number().optional(),
|
|
7491
7559
|
height_ft: z.number().optional().describe("surface_area shapes \u2014 the height they were quantified at"),
|
|
7560
|
+
label: z.string().optional().describe("The room (or phase/area) this shape belongs to \u2014 detect_rooms stamps the room number it traced from; edit_shape sets or clears it. Absent when unlabeled"),
|
|
7492
7561
|
nverts: z.number().int(),
|
|
7493
7562
|
reviewed: z.boolean().describe("true = human-affirmed ink, refused by every agent mutation"),
|
|
7494
7563
|
assignment: z.enum(["schedule", "asserted"]).optional().describe(`Where the finish tag came from: "schedule" = resolved from the room's own schedule row, "asserted" = the agent chose it. origin.assignment in export_takeoff carries the citation. Absent on human canvas shapes`),
|
|
@@ -7502,12 +7571,13 @@ var deleteShapeOutput = {
|
|
|
7502
7571
|
};
|
|
7503
7572
|
var editShapeOutput = {
|
|
7504
7573
|
shape_id: z.string(),
|
|
7505
|
-
changed: z.array(z.enum(["verts", "condition", "role"])).describe("Which fields this call actually changed"),
|
|
7574
|
+
changed: z.array(z.enum(["verts", "condition", "role", "label"])).describe("Which fields this call actually changed"),
|
|
7506
7575
|
measure_role: z.enum(["floor_area", "deduct", "linear", "surface_area", "count"]),
|
|
7507
7576
|
nverts: z.number().int(),
|
|
7508
7577
|
area_sf: z.number().optional().describe("0 for linear shapes; LF \xD7 height for surface_area; absent for count"),
|
|
7509
7578
|
perimeter_lf: z.number().optional().describe("Length for linear/surface runs, perimeter for closed ones; absent for count"),
|
|
7510
7579
|
count: z.number().optional().describe("count shapes only \u2014 the marker's EA (preserved across the edit)"),
|
|
7580
|
+
label: z.string().optional().describe("The shape's room/phase label after this call \u2014 absent when it carries none (a cleared label reports as absent, not as an empty string)"),
|
|
7511
7581
|
agent_edits: z.number().int().describe("How many times the agent has revised this shape \u2014 separate from the human-correction tally")
|
|
7512
7582
|
};
|
|
7513
7583
|
var undoLastOutput = {
|
|
@@ -7537,7 +7607,7 @@ var materialRow = z.object({
|
|
|
7537
7607
|
id: z.string(),
|
|
7538
7608
|
name: z.string(),
|
|
7539
7609
|
per: z.number().describe("Coverage rate: basis \xF7 per = order quantity"),
|
|
7540
|
-
basis: z.enum(["area", "linear", "count"]).describe("Which of the condition's totals this row's quantity is computed against"),
|
|
7610
|
+
basis: z.enum(["area", "linear", "count", "seam_lf"]).describe("Which of the condition's totals this row's quantity is computed against \u2014 'seam_lf' is the FIGURED roll-layout seam length (weld rod, seam tape), 0 until the condition carries a roll_setup"),
|
|
7541
7611
|
unit: z.string(),
|
|
7542
7612
|
round: z.boolean().describe("true = round up to whole purchase units (the default \u2014 you buy whole bags/buckets)"),
|
|
7543
7613
|
note: z.string().optional(),
|
|
@@ -7558,9 +7628,9 @@ var reportMaterialLine = z.object({
|
|
|
7558
7628
|
name: z.string(),
|
|
7559
7629
|
unit: z.string().describe("Purchase unit, e.g. 'gal', 'bag'"),
|
|
7560
7630
|
per: z.number().describe("Coverage rate \u2014 basis units per purchase unit"),
|
|
7561
|
-
basis: z.enum(["area", "linear", "count"]),
|
|
7631
|
+
basis: z.enum(["area", "linear", "count", "seam_lf"]),
|
|
7562
7632
|
round: z.boolean(),
|
|
7563
|
-
basis_qty: z.number().describe("The condition total this row divides (SF, LF, or
|
|
7633
|
+
basis_qty: z.number().describe("The condition total this row divides (SF, LF, EA, or figured seam LF \u2014 multiplier applied, waste not)"),
|
|
7564
7634
|
qty: z.number().describe("Computed order quantity")
|
|
7565
7635
|
}).passthrough();
|
|
7566
7636
|
var exportReportOutput = {
|
|
@@ -9293,7 +9363,7 @@ function registerTools(server, session) {
|
|
|
9293
9363
|
outputSchema: oneClickOutput
|
|
9294
9364
|
}, run("one_click", (a) => session.oneClick(a.sheet, a.x, a.y, { condition: a.condition, role: a.role, returnVerts: a.return_verts, sensitivity: a.sensitivity, layers: a.layers })));
|
|
9295
9365
|
server.registerTool("detect_rooms", {
|
|
9296
|
-
description: `Batch room detection: reads every room-number label off the sheet's text layer (e.g. "134", "OFFICE 101") and runs One-Click at each \u2014 one call instead of read_sheet_text + reasoning + N one_click calls. An OCR'd scan (text layer, no vector linework) floods the rendered pixels instead (#154), disclosed per room and on origin as raster_traced. A seed is only reported as a room once it survives three gates, and everything skipped is counted and reasoned in \`withheld\` \u2014 never dropped silently, because a room the tool tells you it skipped is a question you can ask, while one it hides is a hole in a bid. The gates: a flood that leaked or landed in dense linework never becomes a region; two labels flooding the SAME region commit once (the extra labels ride on \`merged_labels\` \u2014 double-counting an area is the worst failure an estimating tool has); and a flood that is enclosed and clean but smaller than min_area_sf is a room-number bubble, a door swing, or a wall cavity rather than a room. Every room floods through the SAME sealed engine a single one_click runs (RFC #60 \u2014 feet-true gap sealing, door-swing wedges, the minimum-passage rule), so a batch detection and a click at the same seed measure the same square footage; each room carries the engine's account of its own trace (confidence + confidence_factors, gap_sealed_px, door_wedges, min_pass_px/min_pass_delta), and the same account rides origin on everything committed. Confidence is a review prioritizer, never a verification \u2014 a low-confidence room is a view_sheet {overlay: true} audit prompt, not a fact to bid from. With the sheet's scale set, returns area_sf/perimeter_lf per room. TO COMMIT, choose the honest source of the finish tag: assign_from_schedule: true routes every room through its OWN room-finish schedule row and commits each under the FLOOR finish that row states \u2014 when a schedule exists in the set, THIS is the default move, because one agent-chosen tag across N rooms flattens real finish variety into a wrong bid; condition commits every room under that one stated tag (only right when the rooms genuinely share it; role "deduct" makes them subtract). Without a scale, returns px-only quantities per room and commits nothing \u2014 the plausibility floor needs real units, so it only applies once a scale is set. A batch commit is NOT finished until you have LOOKED at it: view_sheet {overlay: true}, audit every ring against the walls, fix misses with edit_shape / delete_shape \u2014 before the totals mean anything. ${COORDS}`,
|
|
9366
|
+
description: `Batch room detection: reads every room-number label off the sheet's text layer (e.g. "134", "OFFICE 101") and runs One-Click at each \u2014 one call instead of read_sheet_text + reasoning + N one_click calls. An OCR'd scan (text layer, no vector linework) floods the rendered pixels instead (#154), disclosed per room and on origin as raster_traced. A seed is only reported as a room once it survives three gates, and everything skipped is counted and reasoned in \`withheld\` \u2014 never dropped silently, because a room the tool tells you it skipped is a question you can ask, while one it hides is a hole in a bid. The gates: a flood that leaked or landed in dense linework never becomes a region; two labels flooding the SAME region commit once (the extra labels ride on \`merged_labels\` \u2014 double-counting an area is the worst failure an estimating tool has); and a flood that is enclosed and clean but smaller than min_area_sf is a room-number bubble, a door swing, or a wall cavity rather than a room. Every room floods through the SAME sealed engine a single one_click runs (RFC #60 \u2014 feet-true gap sealing, door-swing wedges, the minimum-passage rule), so a batch detection and a click at the same seed measure the same square footage; each room carries the engine's account of its own trace (confidence + confidence_factors, gap_sealed_px, door_wedges, min_pass_px/min_pass_delta), and the same account rides origin on everything committed. Confidence is a review prioritizer, never a verification \u2014 a low-confidence room is a view_sheet {overlay: true} audit prompt, not a fact to bid from. With the sheet's scale set, returns area_sf/perimeter_lf per room. Every committed room carries the room number it was traced from as the shape's \`label\`, so a sweep arrives already sliced by room \u2014 that field is what the Report's per-room grouping and the workbook's floor \xD7 room tab read, and it is the one thing about a batch that cannot be recovered downstream if it is dropped. TO COMMIT, choose the honest source of the finish tag: assign_from_schedule: true routes every room through its OWN room-finish schedule row and commits each under the FLOOR finish that row states \u2014 when a schedule exists in the set, THIS is the default move, because one agent-chosen tag across N rooms flattens real finish variety into a wrong bid; condition commits every room under that one stated tag (only right when the rooms genuinely share it; role "deduct" makes them subtract). Without a scale, returns px-only quantities per room and commits nothing \u2014 the plausibility floor needs real units, so it only applies once a scale is set. A batch commit is NOT finished until you have LOOKED at it: view_sheet {overlay: true}, audit every ring against the walls, fix misses with edit_shape / delete_shape \u2014 before the totals mean anything. ${COORDS}`,
|
|
9297
9367
|
inputSchema: {
|
|
9298
9368
|
sheet: z2.string(),
|
|
9299
9369
|
condition: z2.string().optional().describe("Finish tag to commit every detected room under (minted on first use). Mutually exclusive with assign_from_schedule"),
|
|
@@ -9468,7 +9538,7 @@ All-or-nothing, like derive_base: an unknown tag, a transition landing on either
|
|
|
9468
9538
|
outputSchema: exportMarkedPdfOutput
|
|
9469
9539
|
}, run("export_marked_pdf", (a) => exportMarkedPdf(session, a)));
|
|
9470
9540
|
server.registerTool("list_shapes", {
|
|
9471
|
-
description: `The mid-session shape inventory (#149): every committed shape's id, sheet, condition tag, role, quantities, vertex count, and review state in one compact read \u2014 the ids edit_shape and delete_shape assume you have, without pulling the whole export_takeoff payload to find one shape. Filter by sheet, by condition, or both; filters narrow, an empty list is a result, not an error.`,
|
|
9541
|
+
description: `The mid-session shape inventory (#149): every committed shape's id, sheet, condition tag, role, quantities, room label, vertex count, and review state in one compact read \u2014 the ids edit_shape and delete_shape assume you have, without pulling the whole export_takeoff payload to find one shape. Filter by sheet, by condition, or both; filters narrow, an empty list is a result, not an error.`,
|
|
9472
9542
|
inputSchema: {
|
|
9473
9543
|
sheet: z2.string().optional().describe("Only shapes on this sheet"),
|
|
9474
9544
|
condition: z2.string().optional().describe("Only shapes under this finish tag (must exist)")
|
|
@@ -9491,23 +9561,24 @@ All-or-nothing, like derive_base: an unknown tag, a transition landing on either
|
|
|
9491
9561
|
outputSchema: sheetContextOutput
|
|
9492
9562
|
}, run("sheet_context", (a) => session.sheetContext(a.sheet, { region: a.region, min_len_px: a.min_len_px, max_segments: a.max_segments })));
|
|
9493
9563
|
server.registerTool("edit_shape", {
|
|
9494
|
-
description: `REVISE a shape you already committed, instead of deleting it and starting over: pass new verts to move the geometry, condition to reassign it to a different finish tag, role to switch between floor_area / deduct / linear, or any combination. Quantities are recomputed from the result \u2014 a role flip alone re-measures (closed area vs open length). The loop this is for: one_click or measure_polygon to commit, view_sheet with overlay:true to LOOK at what landed, then edit_shape to fix the two vertices that overshot into the corridor. Shapes a human affirmed (origin.reviewed) are ink and are refused \u2014 an agent revises its own pencil and nothing else. Agent self-revision is tallied on origin.agent_edits, kept deliberately separate from the human-correction fields. ${COORDS}`,
|
|
9564
|
+
description: `REVISE a shape you already committed, instead of deleting it and starting over: pass new verts to move the geometry, condition to reassign it to a different finish tag, role to switch between floor_area / deduct / linear, label to name the room it belongs to, or any combination. Quantities are recomputed from the result \u2014 a role flip alone re-measures (closed area vs open length). The loop this is for: one_click or measure_polygon to commit, view_sheet with overlay:true to LOOK at what landed, then edit_shape to fix the two vertices that overshot into the corridor. label is the per-room reporting seam: detect_rooms already stamps the room number it traced from, so this is how a shape traced by hand \u2014 or one whose room number the sweep read wrong \u2014 joins the same per-room breakdown the Report and the workbook's floor \xD7 room tab group by. Shapes a human affirmed (origin.reviewed) are ink and are refused \u2014 an agent revises its own pencil and nothing else. Agent self-revision is tallied on origin.agent_edits, kept deliberately separate from the human-correction fields. ${COORDS}`,
|
|
9495
9565
|
inputSchema: {
|
|
9496
9566
|
shape_id: z2.string().describe("Id returned when the shape was committed"),
|
|
9497
9567
|
verts: z2.array(pointSchema).optional().describe("Replacement geometry (image px): \u22653 vertices for an area shape, \u22652 points for a linear/surface run, \u22651 for a count marker"),
|
|
9498
9568
|
condition: z2.string().optional().describe("Reassign to this finish tag (minted on first use)"),
|
|
9499
|
-
role: z2.enum(["floor_area", "deduct", "linear", "surface_area", "count"]).optional().describe("Switch what the shape measures \u2014 flipping INTO surface_area needs a height on the shape or its condition")
|
|
9569
|
+
role: z2.enum(["floor_area", "deduct", "linear", "surface_area", "count"]).optional().describe("Switch what the shape measures \u2014 flipping INTO surface_area needs a height on the shape or its condition"),
|
|
9570
|
+
label: z2.string().optional().describe('The room (or phase/area) this shape belongs to, e.g. "134" or "OFFICE 101" \u2014 what per-room reporting groups by. Pass "" to clear it')
|
|
9500
9571
|
},
|
|
9501
9572
|
outputSchema: editShapeOutput
|
|
9502
|
-
}, run("edit_shape", (a) => session.editShape(a.shape_id, { verts: a.verts, condition: a.condition, role: a.role })));
|
|
9573
|
+
}, run("edit_shape", (a) => session.editShape(a.shape_id, { verts: a.verts, condition: a.condition, role: a.role, label: a.label })));
|
|
9503
9574
|
server.registerTool("edit_materials", {
|
|
9504
|
-
description: `Add, remove, or patch supporting-materials rows on a condition \u2014 the coverage-rate lines that turn a measured area/length/count into an order quantity (adhesive at N sf/gal, grout at N lf/bag, \u2026), matching the canvas's per-condition Supporting Materials panel. Each row is {name, per, basis, unit, round, note}: quantity = the condition's basis total (area/linear/count) \xF7 per, rounded up to whole purchase units unless round:false. condition names an existing OR NEW finish tag (minted on first touch, same as one_click/measure_polygon) \u2014 add alone is enough to seed materials on a condition before you've traced anything. remove/patch target existing row ids from this reply or export_takeoff (takeoff_summary strips materials for a compact quantities-only reply); a bad id 404s the WHOLE call before anything is written, and referencing an id on a tag with no condition yet errors rather than silently minting an empty one. No review gate here \u2014 materials rows are quantity config, not traced geometry, so this edits directly; undo_last reverses a call in one step (the condition's whole materials array, snapshotted before the write, restored verbatim).`,
|
|
9575
|
+
description: `Add, remove, or patch supporting-materials rows on a condition \u2014 the coverage-rate lines that turn a measured area/length/count into an order quantity (adhesive at N sf/gal, grout at N lf/bag, \u2026), matching the canvas's per-condition Supporting Materials panel. Each row is {name, per, basis, unit, round, note}: quantity = the condition's basis total (area/linear/count/seam_lf) \xF7 per, rounded up to whole purchase units unless round:false. basis "seam_lf" is the one basis that is FIGURED rather than measured: it is the length where two cuts meet on the floor, read off the condition's roll layout (set roll_setup with edit_condition), which is what a heat-weld rod or a carpet seam tape is bought by. A 20-ft-wide room off a 12-ft roll seams once down its length; the same square footage as two 10-ft rooms seams not at all, and no percentage of the area or the perimeter can tell those two jobs apart. Without a roll_setup \u2014 or with no committed floor shapes to lay out \u2014 a seam_lf row reads 0, which is the honest state rather than a guess. condition names an existing OR NEW finish tag (minted on first touch, same as one_click/measure_polygon) \u2014 add alone is enough to seed materials on a condition before you've traced anything. remove/patch target existing row ids from this reply or export_takeoff (takeoff_summary strips materials for a compact quantities-only reply); a bad id 404s the WHOLE call before anything is written, and referencing an id on a tag with no condition yet errors rather than silently minting an empty one. No review gate here \u2014 materials rows are quantity config, not traced geometry, so this edits directly; undo_last reverses a call in one step (the condition's whole materials array, snapshotted before the write, restored verbatim).`,
|
|
9505
9576
|
inputSchema: {
|
|
9506
9577
|
condition: z2.string().describe("Finish tag, e.g. 'CPT-1'"),
|
|
9507
9578
|
add: z2.array(z2.object({
|
|
9508
9579
|
name: z2.string().min(1),
|
|
9509
9580
|
per: z2.number().min(0).optional().describe("Coverage rate \u2014 basis units per purchase unit, e.g. 250 for 1 gal / 250 sf. Default 0 (quantity 0 until set)"),
|
|
9510
|
-
basis: z2.enum(["area", "linear", "count"]).optional().describe("Which of the condition's totals this row divides against \u2014 default 'area' (total SF)"),
|
|
9581
|
+
basis: z2.enum(["area", "linear", "count", "seam_lf"]).optional().describe("Which of the condition's totals this row divides against \u2014 default 'area' (total SF). 'seam_lf' is the figured roll-layout seam length (weld rod, seam tape), 0 until the condition carries a roll_setup"),
|
|
9511
9582
|
unit: z2.string().optional().describe("Purchase unit, e.g. 'gal', 'bag', 'roll'"),
|
|
9512
9583
|
round: z2.boolean().optional().describe("Round up to whole purchase units \u2014 default true"),
|
|
9513
9584
|
note: z2.string().optional()
|
|
@@ -9759,7 +9830,7 @@ function registerResources(server, session) {
|
|
|
9759
9830
|
// package.json
|
|
9760
9831
|
var package_default = {
|
|
9761
9832
|
name: "opentakeoff-mcp",
|
|
9762
|
-
version: "0.9.
|
|
9833
|
+
version: "0.9.33",
|
|
9763
9834
|
mcpName: "io.github.Kentucky-ai/opentakeoff",
|
|
9764
9835
|
type: "module",
|
|
9765
9836
|
description: "OpenTakeoff MCP server \u2014 drive the takeoff engine from your MCP client over stdio.",
|
|
@@ -9775,7 +9846,7 @@ var package_default = {
|
|
|
9775
9846
|
mcpb: "npm run build && node scripts/build-mcpb.mjs",
|
|
9776
9847
|
prepublishOnly: "npm run typecheck && npm test && npm run build",
|
|
9777
9848
|
typecheck: "tsc --noEmit",
|
|
9778
|
-
test: "node --import tsx --test test/conformance.test.ts test/context.test.ts test/e2e.test.ts test/parity.test.ts test/raster.test.ts test/resources.test.ts test/scalewarn.test.ts test/session.test.ts test/tools.test.ts test/transitions.test.ts test/twins.test.ts test/view.test.ts"
|
|
9849
|
+
test: "node --import tsx --test test/conformance.test.ts test/context.test.ts test/e2e.test.ts test/labels.test.ts test/parity.test.ts test/raster.test.ts test/resources.test.ts test/scalewarn.test.ts test/session.test.ts test/tools.test.ts test/transitions.test.ts test/twins.test.ts test/view.test.ts"
|
|
9779
9850
|
},
|
|
9780
9851
|
dependencies: {
|
|
9781
9852
|
"@modelcontextprotocol/sdk": "^1.12.0",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opentakeoff-mcp",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.33",
|
|
4
4
|
"mcpName": "io.github.Kentucky-ai/opentakeoff",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "OpenTakeoff MCP server — drive the takeoff engine from your MCP client over stdio.",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"mcpb": "npm run build && node scripts/build-mcpb.mjs",
|
|
17
17
|
"prepublishOnly": "npm run typecheck && npm test && npm run build",
|
|
18
18
|
"typecheck": "tsc --noEmit",
|
|
19
|
-
"test": "node --import tsx --test test/conformance.test.ts test/context.test.ts test/e2e.test.ts test/parity.test.ts test/raster.test.ts test/resources.test.ts test/scalewarn.test.ts test/session.test.ts test/tools.test.ts test/transitions.test.ts test/twins.test.ts test/view.test.ts"
|
|
19
|
+
"test": "node --import tsx --test test/conformance.test.ts test/context.test.ts test/e2e.test.ts test/labels.test.ts test/parity.test.ts test/raster.test.ts test/resources.test.ts test/scalewarn.test.ts test/session.test.ts test/tools.test.ts test/transitions.test.ts test/twins.test.ts test/view.test.ts"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@modelcontextprotocol/sdk": "^1.12.0",
|