3D engine that AI agents drive
Let a mesh boolean take another recipe geometry ID as its cutter
Nguyen Xuan And3192bf50556
diff --git a/changes/730.md b/changes/730.mdnew file mode 100644index 00000000..c257a55f--- /dev/null+++ b/changes/730.md@@ -0,0 +1 @@+- A mesh boolean `cutter` can be `{ "geometry": "<id>" }`, another recipe geometry, so cuts form a bounded DAG with cycle and missing-ID errors (#730)diff --git a/changes/730.size.md b/changes/730.size.mdnew file mode 100644index 00000000..2aba2e9d--- /dev/null+++ b/changes/730.size.md@@ -0,0 +1,3 @@+- scene:agent-scene: cutter geometry references add cycle, depth, missing-ID and work checks with errors that name the chain, an agent-facing modeling capability (about 1 KB gzip).+- scene:agent-scene+lazy: the same code, counted in the lazy bundle.+- goal:agent-scene: the scene is already over its goal; the growth is one functional capability (CSG DAG) whose errors agents read, and no part of it can move to a lazy module because recipe checking runs in the core.diff --git a/docs/mesh.md b/docs/mesh.mdindex 620ef51c..81406e5a 100644--- a/docs/mesh.md+++ b/docs/mesh.md@@ -165,6 +165,14 @@ space. Faces from the mesh keep their tags; faces the cutter contributes (the waunion) get `<name>.cut`. Flat faces come back as polygons; faces with holes come back as triangles, joined into quadswhere flat pairs allow.+A `cutter` can also be `{ "geometry": "<id>" }`, naming another geometry in the recipe's `geometries`: a `mesh` with its+own edits and stack, or any primitive record. Meshes then form a directed acyclic graph of cuts, and editing the+cutter rebuilds only the meshes that name it (its record joins their cache key). Put `translation`, `rotation` and+`scale` on the boolean edit; the reference takes no other field. The cutter geometry needs no node; it can stay unseen.+Limits: a chain of at most 4 cutter geometries, and at most 250,000 estimated vertices across the cutters a mesh names.+A self-reference, a cycle (`a -> b -> a`) or an unknown ID fails when the recipe is checked, with the chain and the IDs+that exist. Imported-part edits take inline records only. The same recipe always gives the same bytes.+Both inputs must be closed and consistently wound. A boolean on an open mesh fails with the lint counts and a fix.A difference that leaves a hollow inside the mesh is valid; `lintMesh` reports it under `parts.cavities` instead of asan inverted part.diff --git a/src/agent-scene-capabilities.js b/src/agent-scene-capabilities.jsindex 646b005a..7ba1b465 100644--- a/src/agent-scene-capabilities.js+++ b/src/agent-scene-capabilities.js@@ -186,6 +186,11 @@ export const MESH_SCULPT_NOTES = Object.freeze({shrinkwrap: 'target is a primitive record placed by translation, rotation and scale. mode nearest (default) moves each selected vertex to the closest point; project moves it along direction (needed) to the first hit. offset (0) stands it off along the normal. maxDistance limits the search; onMiss error (default) or keep. For a decal, use enough grid cells, then solidify.',});+// Boolean cutters on a recipe mesh. Details stay here so the tool schemas stay small.+export const MESH_BOOLEAN_NOTES = Object.freeze({+ cutter: 'A primitive or profile record such as { type: "cylinder" }, or { geometry: "<id>" } naming another recipe geometry (a mesh with its own edits and stack, or a primitive). Put translation, rotation and scale on the edit. References form a DAG: a cycle or an unknown ID fails with the chain; at most 4 cutter geometries deep and 250000 estimated cutter vertices per mesh. Editing the cutter geometry rebuilds only the meshes that name it. Imported-part edits take inline records only.',+});+export const AGENT_SCENE_CAPABILITIES = Object.freeze({format: '67js.scene', schemaVersion: 1,geometryTypes: Object.freeze(['box', 'cylinder', 'sphere', 'cone', 'icoSphere', 'torus', 'lathe', 'extrude', 'tube', 'curve', 'sdf', 'text', 'grid', 'plane', 'circle', 'line', 'terrain', 'mesh']),@@ -199,6 +204,7 @@ export const AGENT_SCENE_CAPABILITIES = Object.freeze({meshSculpt: MESH_SCULPT_NOTES,meshAttributes: MESH_ATTRIBUTE_NOTES,meshUv: MESH_UV_NOTES,+ meshBoolean: MESH_BOOLEAN_NOTES,meshShapeKeys: MESH_SHAPE_KEY_NOTES,fieldExpressions: Object.freeze({operators: FIELD_OPERATOR_NAMES, attributes: FIELD_ATTRIBUTES,diff --git a/src/agent-scene.js b/src/agent-scene.jsindex d32d1de7..e3be67fe 100644--- a/src/agent-scene.js+++ b/src/agent-scene.js@@ -29,6 +29,12 @@ export {const DEFAULT_LIMITS = AGENT_SCENE_DEFAULT_LIMITS;const MAX_MESH_REPORTS = 16;+// A boolean cutter may name another recipe geometry, which may itself cut with a third. Both bounds are static, so they+// do not depend on what the evaluation cache holds.+const MAX_CUTTER_DEPTH = 4;+const MAX_CUTTER_WORK_VERTICES = 250_000;+// Where a geometry is checked before the whole recipe is known: references stay unresolved and count nothing.+const PENDING_CUTTER_SCOPE = Object.freeze({ definitions: null, chain: Object.freeze([]) });// Terrain meshes carry one more float for each vertex (sky visibility) than the 56 bytes the budget estimates.const TERRAIN_SKY_VISIBILITY_BYTES = 4;const CAMERA_DEFAULTS = Object.freeze({ eye: [4, 3, 5], target: [0, 0, 0], up: [0, 1, 0], fov: 45, near: 0.1, far: 1000 });@@ -469,7 +475,7 @@ function lineEnds(value) {return ends;}-function geometryEstimate(value) {+function geometryEstimate(value, scope = PENDING_CUTTER_SCOPE) {if (!Object.hasOwn(GEOMETRY_FIELDS, value.type)) {throw invalidField('type', value.type, `one of ${Object.keys(GEOMETRY_FIELDS).join(', ')}`, TypeError);}@@ -563,8 +569,16 @@ function geometryEstimate(value) {throw invalidField('base', base, 'a primitive or profile record without an id, such as { "type": "box" } (box, cylinder, sphere, torus, lathe, extrude or tube)', TypeError);}let estimate = geometryEstimate({ id: 'base', ...base });+ const cutterScope = meshCutterScope(value, scope);+ let referencedWork = 0;for (const edit of agentSceneModule('mesh').normalizeMeshEdits(value.edits ?? [])) {- if (edit.op === 'boolean') estimate += cutterEstimate(edit.cutter);+ if (edit.op !== 'boolean') continue;+ const cutterVertices = cutterEstimate(edit.cutter, cutterScope);+ estimate += cutterVertices;+ if (isCutterReference(edit.cutter)) referencedWork += cutterVertices;+ }+ if (referencedWork > MAX_CUTTER_WORK_VERTICES) {+ throw invalidField('cutter.geometry', `${referencedWork} estimated cutter vertices in ${cutterScope.chain.join(' -> ')}`, `cutter geometries that total at most ${MAX_CUTTER_WORK_VERTICES} estimated vertices; use fewer segments or fewer referenced cutters`);}// Stack nodes multiply the mesh: arrays by their count, mirror and solidify at most by two.for (const node of agentSceneModule('mesh').normalizeMeshStack(value.stack ?? [])) estimate *= node.op === 'array' ? node.count : 2;@@ -582,20 +596,88 @@ function hasInstancedNodes(nodes) {return !Array.isArray(nodes) || nodes.some(node => node && typeof node === 'object' && Object.hasOwn(node, 'instances'));}-function cutterEstimate(cutter) {+function isCutterReference(cutter) {+ return Object.hasOwn(cutter, 'geometry');+}++function meshCutterScope(meshDefinition, scope) {+ return scope && { definitions: scope.definitions, chain: scope.chain.length ? scope.chain : [meshDefinition.id] };+}++function cutterEstimate(cutter, scope) {+ if (isCutterReference(cutter)) return referencedCutterEstimate(cutter, scope);if (cutter.type === 'mesh' || Object.hasOwn(cutter, 'id')) {- throw invalidField('cutter', cutter, 'a primitive or profile record without an id, such as { "type": "box" } (box, cylinder, sphere, torus, lathe, extrude or tube)', TypeError);+ throw invalidField('cutter', cutter, 'a primitive or profile record without an id, such as { "type": "box" } (box, cylinder, sphere, torus, lathe, extrude or tube), or { "geometry": "<recipe geometry id>" }', TypeError);}return geometryEstimate({ id: 'cutter', ...cutter });}+// A cutter naming a recipe geometry. scope.chain lists the meshes on the way here, the first being the mesh being built.+function referencedCutterEstimate(cutter, scope) {+ if (Object.keys(cutter).length !== 1 || typeof cutter.geometry !== 'string') {+ throw invalidField('cutter', cutter, 'only { "geometry": "<recipe geometry id>" }; put translation, rotation and scale on the boolean edit', TypeError);+ }+ if (!scope) {+ throw invalidField('cutter.geometry', cutter.geometry, 'a primitive or profile record such as { "type": "box" }; only recipe meshes can name another geometry');+ }+ const chain = [...scope.chain, cutter.geometry];+ if (chain.indexOf(cutter.geometry) !== chain.length - 1) {+ throw invalidField('cutter.geometry', chain.join(' -> '), `a geometry that does not cut with itself; remove ${cutter.geometry} from the cutters of ${scope.chain[scope.chain.length - 1]} or give it another cutter`);+ }+ if (chain.length - 1 > MAX_CUTTER_DEPTH) {+ throw invalidField('cutter.geometry', chain.join(' -> '), `a chain of at most ${MAX_CUTTER_DEPTH} cutter geometries; build the inner cutters into one geometry`);+ }+ if (!scope.definitions) return 0;+ const definition = scope.definitions.get(cutter.geometry);+ if (!definition) {+ throw invalidField('cutter.geometry', chain.join(' -> '), `the ID of a geometry in geometries, one of ${[...scope.definitions.keys()].join(', ') || 'none yet'}; add ${cutter.geometry} or pick one of them`);+ }+ return geometryEstimate(definition, { definitions: scope.definitions, chain });+}++function namesCutterGeometry(edit) {+ return edit?.op === 'boolean' && typeof edit.cutter?.geometry === 'string';+}++// The records of the cutter geometries a mesh names, nested ones included: what its result depends on beyond its own record.+function cutterDependencySignature(meshDefinition, definitions) {+ const parts = [];+ for (const edit of meshDefinition.edits ?? []) {+ if (!namesCutterGeometry(edit)) continue;+ const definition = definitions.get(edit.cutter.geometry);+ parts.push(JSON.stringify(definition), cutterDependencySignature(definition, definitions));+ }+ return parts.join('|');+}++// Validates the cutter chain (cycles, depth, missing IDs, work) before returning its signature, so the signature walk ends.+function checkedCutterDependencies(meshDefinition, definitions) {+ if (!(meshDefinition.edits ?? []).some(namesCutterGeometry)) return '';+ geometryEstimate(meshDefinition, { definitions, chain: [] });+ return cutterDependencySignature(meshDefinition, definitions);+}++/** Cache identity of a geometry record: its own fields plus the cutter geometries it depends on. */+function geometrySignature(definition, definitions) {+ const dependencies = definition.type === 'mesh' ? checkedCutterDependencies(definition, definitions) : '';+ return dependencies ? `${JSON.stringify(definition)}|cutters|${dependencies}` : JSON.stringify(definition);+}++function geometryDefinitions(geometries) {+ return new Map(geometries.map(definition => [definition.id, definition]));+}++function cutterScopeOf(geometries) {+ return { definitions: geometryDefinitions(geometries), chain: [] };+}+/** Render geometry of a boolean cutter record, checked like the cutters of recipe meshes. Used by imported-part edits. */export function generateCutterGeometry(cutter, maxVertices) {cutterEstimate(cutter);return generateGeometry(cutter, maxVertices);}-function generateGeometry(value, maxVertices) {+function generateGeometry(value, maxVertices, scope) {switch (value.type) {case 'box':return box(value.bevel, value.subdivisions);@@ -630,15 +712,22 @@ function generateGeometry(value, maxVertices) {return agentSceneModule('text').text(value.text, { ...value, maxVertices });case 'terrain':return agentSceneModule('terrain').generateTerrainGeometry(value, maxVertices);- case 'mesh':+ case 'mesh': {+ const cutterScope = meshCutterScope(value, scope);+ const dependencies = scope ? checkedCutterDependencies(value, scope.definitions) : '';return agentSceneModule('mesh').generateMeshGeometry(() => generateGeometry(value.base, maxVertices), value.edits ?? [], {maxVertices, smoothAngle: value.smoothAngle ?? MESH_SMOOTH_ANGLE_DEFAULT,- stack: value.stack ?? [], cacheKey: JSON.stringify(value.base), shapeKeys: value.shapeKeys ?? [],+ stack: value.stack ?? [], shapeKeys: value.shapeKeys ?? [],+ // The edits only name a cutter geometry, so that geometry's own record joins the key: editing it changes the key.+ cacheKey: dependencies ? `${JSON.stringify(value.base)}|cutters|${dependencies}` : JSON.stringify(value.base),resolveCutter: cutter => {- cutterEstimate(cutter);- return generateGeometry(cutter, maxVertices);+ cutterEstimate(cutter, cutterScope);+ if (!isCutterReference(cutter)) return generateGeometry(cutter, maxVertices);+ const chain = [...cutterScope.chain, cutter.geometry];+ return generateGeometry(scope.definitions.get(cutter.geometry), maxVertices, { definitions: scope.definitions, chain });},});+ }}}@@ -712,7 +801,7 @@ function addArmatures(recipe, limits) {throw invalidField(`armatures.${armature.id}.fit`, nodeId, 'the ID of a mesh node with a geometry, such as one scene_inspect lists');}const definition = recipe.geometries.find(geometry => geometry.id === node.geometry);- const bounds = boundsFor(generateGeometry(definition, Math.min(limits.maxVertices, 1_000_000)), mat4.create());+ const bounds = boundsFor(generateGeometry(definition, Math.min(limits.maxVertices, 1_000_000), cutterScopeOf(recipe.geometries)), mat4.create());const toArmature = mat4.invert(mat4.create(), restWorldMatrix(armature.id, userNodes, [armature]));const toWorld = restWorldMatrix(node.id, userNodes);return transformedBounds(bounds, mat4.multiply(mat4.create(), toArmature, toWorld));@@ -811,6 +900,11 @@ function normalizeRecipe(input, limits) {}return definition;});+ // Every geometry exists now, so cutter IDs, cycles, depth and work can be checked.+ const definitionsById = geometryDefinitions(recipe.geometries);+ recipe.geometries.forEach((definition, index) => {+ if (definition.type === 'mesh') withFieldPrefix(`geometries[${index}]`, () => checkedCutterDependencies(definition, definitionsById));+ });recipe.materials = resources(withDefaultMaterial(recipe), limits.maxMaterials, 'materials', materialFrom);const distinctPatterns = new Set(recipe.materials.filter(material => material.pattern).map(material => JSON.stringify(material.pattern)));if (distinctPatterns.size > MAX_MATERIAL_PATTERNS) {@@ -822,7 +916,7 @@ function normalizeRecipe(input, limits) {resolveSurface: id => {const definition = recipe.geometries.find(geometry => geometry.id === id);if (!definition) throw invalidField('instances.surface', id, `the ID of a geometry in geometries, such as ${recipe.geometries[0]?.id ?? 'ground'}`);- return generateGeometry(definition, Math.min(limits.maxVertices, 1_000_000));+ return generateGeometry(definition, Math.min(limits.maxVertices, 1_000_000), cutterScopeOf(recipe.geometries));},}, recipe.geometries);recipe.nodes = resources(recipe.nodes, limits.maxNodes, 'nodes', nodeFrom);@@ -1250,6 +1344,7 @@ export function createAgentScene(input, inputLimits = {}, options = {}) {if (state) {retainedMatrices(state.parts);}+ const definitionsById = geometryDefinitions(recipe.geometries);const planGeometry = () => {const ownedRecords = ownedGeometryRecords();const availableRecords = new Map();@@ -1257,12 +1352,12 @@ export function createAgentScene(input, inputLimits = {}, options = {}) {availableRecords.set(record.signature, record);}const plans = recipe.geometries.map(definition => {- const signature = JSON.stringify(definition);+ const signature = geometrySignature(definition, definitionsById);const preferredRecord = preferred?.geometryRecords.get(definition.id);const activeRecord = state?.geometryRecords.get(definition.id);const existing = [preferredRecord, activeRecord, availableRecords.get(signature)].find(record => record?.signature === signature);- return { definition, signature, existing, estimatedVertices: definition.type === 'asset' ? 0 : geometryEstimate(definition) };+ return { definition, signature, existing, estimatedVertices: definition.type === 'asset' ? 0 : geometryEstimate(definition, { definitions: definitionsById, chain: [] }) };});const residentStats = geometryStats(ownedRecords);const pendingVertices = plans.filter(plan => !plan.existing).reduce((total, plan) => total + plan.estimatedVertices, 0);@@ -1299,7 +1394,7 @@ export function createAgentScene(input, inputLimits = {}, options = {}) {const geometry = assetRuntime.geometryParts.get(plan.definition.id);record = Object.freeze({ signature: plan.signature, geometry, bounds: boundsFor(geometry, mat4.create()), vertices: 0, geometryBytes: 0, estimatedVertices: 0 });} else if (!record) {- const geometry = Object.freeze(generateGeometry(plan.definition, Math.min(limits.maxVertices, 1_000_000)));+ const geometry = Object.freeze(generateGeometry(plan.definition, Math.min(limits.maxVertices, 1_000_000), { definitions: definitionsById, chain: [] }));const geometryBytes = Object.values(geometry).reduce((total, array) => total + array.byteLength, 0);const vertices = geometry.positions.length / 3;if (plan.definition.type === 'mesh') {diff --git a/src/mesh-recipe.js b/src/mesh-recipe.jsindex d19f0a3d..9eac6397 100644--- a/src/mesh-recipe.js+++ b/src/mesh-recipe.js@@ -171,8 +171,10 @@ export function normalizeMeshEdits(edits) {case 'boolean': {if (!BOOLEAN_OPERATIONS.includes(edit.operation)) throw editField(index, 'operation', edit.operation, `one of ${BOOLEAN_OPERATIONS.join(', ')}`);normalized.operation = edit.operation;- if (!edit.cutter || typeof edit.cutter !== 'object' || Array.isArray(edit.cutter) || typeof edit.cutter.type !== 'string') {- throw editField(index, 'cutter', edit.cutter, 'a primitive record such as { "type": "cylinder", "segments": 32 }');+ const isRecord = edit.cutter && typeof edit.cutter === 'object' && !Array.isArray(edit.cutter);+ const namesGeometry = isRecord && Object.hasOwn(edit.cutter, 'geometry');+ if (!isRecord || (!namesGeometry && typeof edit.cutter.type !== 'string')) {+ throw editField(index, 'cutter', edit.cutter, 'a primitive record such as { "type": "cylinder", "segments": 32 } or a recipe geometry such as { "geometry": "tool" }');}normalized.cutter = edit.cutter;normalizePlacement(edit, normalized, index);diff --git a/tests/mesh-boolean-geometry-cutter.test.js b/tests/mesh-boolean-geometry-cutter.test.jsnew file mode 100644index 00000000..667d50db--- /dev/null+++ b/tests/mesh-boolean-geometry-cutter.test.js@@ -0,0 +1,112 @@+import './support/load-agent-scene-modules.mjs';+import test from 'node:test';+import assert from 'node:assert/strict';+import { createAgentScene } from '../src/agent-scene.js';+import { loadMeshBooleans } from '../src/mesh-boolean.js';+import { meshCacheStats } from '../src/agent-mesh.js';++await loadMeshBooleans();++const materials = [{ id: 'steel', color: [0.7, 0.7, 0.72] }];++function bore(cutter, name = 'bore') {+ return { op: 'boolean', operation: 'difference', name, cutter, scale: [0.3, 2, 0.3] };+}++function recipeWith(geometries) {+ return { format: '67js.scene', schemaVersion: 1, geometries, materials, nodes: [{ id: 'block', geometry: geometries[0].id, material: 'steel' }] };+}++function meshReport(geometries) {+ const scene = createAgentScene(recipeWith(geometries));+ return { scene, report: scene.inspectMeshes().meshes[0] };+}++function drilled(id, cutterId) {+ return { id, type: 'mesh', base: { type: 'box', bevel: 0 }, edits: [bore({ geometry: cutterId })] };+}++test('a boolean cuts with another recipe geometry named by ID', () => {+ const { report } = meshReport([+ drilled('block', 'tool'),+ { id: 'tool', type: 'mesh', base: { type: 'cylinder', segments: 24, bevel: 0 }, edits: [] },+ ]);+ assert.equal(report.ok, true, JSON.stringify(report.problems));+ assert.ok(report.edits[0].tags['bore.cut'] > 0);+});++test('an ID cutter gives the same result as the inline record it names', () => {+ const inline = { id: 'block', type: 'mesh', base: { type: 'box', bevel: 0 }, edits: [bore({ type: 'cylinder', segments: 24, bevel: 0 })] };+ const named = meshReport([drilled('block', 'tool'), { id: 'tool', type: 'cylinder', segments: 24, bevel: 0 }]);+ const reference = meshReport([inline]);+ assert.deepEqual(named.report.bounds, reference.report.bounds);+ assert.equal(named.report.parts.closed, reference.report.parts.closed);+});++test('a chain of two cutter geometries resolves, and the result is repeatable', () => {+ const geometries = () => [+ drilled('block', 'drill'),+ { id: 'drill', type: 'mesh', base: { type: 'cylinder', segments: 24, bevel: 0 }, edits: [bore({ geometry: 'slot' }, 'slotted')] },+ { id: 'slot', type: 'box' },+ ];+ const first = meshReport(geometries());+ assert.equal(first.report.ok, true, JSON.stringify(first.report.problems));+ const second = meshReport(geometries());+ assert.deepEqual(second.report, first.report);+});++test('editing the cutter geometry changes the dependent mesh, and unchanged cutters hit the cache', () => {+ const build = segments => meshReport([+ drilled('block', 'tool'),+ { id: 'tool', type: 'cylinder', segments, bevel: 0 },+ ]);+ const vertexCount = built => JSON.stringify(built.report.counts);+ assert.notEqual(vertexCount(build(6)), vertexCount(build(48)));+ const before = meshCacheStats();+ build(48);+ assert.ok(meshCacheStats().hits > before.hits, 'an unchanged cutter and mesh reuse the evaluation cache');+});++test('a cycle is refused with the chain', () => {+ assert.throws(() => createAgentScene(recipeWith([drilled('a', 'b'), drilled('b', 'a')])), /cutter\.geometry: got "a -> b -> a"; expected a geometry that does not cut with itself/);+ assert.throws(() => createAgentScene(recipeWith([drilled('a', 'a')])), /got "a -> a"/);+});++test('a missing ID is refused with the chain and the IDs that exist', () => {+ assert.throws(() => createAgentScene(recipeWith([drilled('a', 'nope')])), /geometries\[0\]\.cutter\.geometry: got "a -> nope"; expected the ID of a geometry in geometries, one of a;/);+});++test('the chain depth is bounded', () => {+ const ids = ['g0', 'g1', 'g2', 'g3', 'g4', 'g5'];+ const geometries = ids.map((id, index) => index < ids.length - 1 ? drilled(id, ids[index + 1]) : { id, type: 'box' });+ assert.throws(() => createAgentScene(recipeWith(geometries)), /got "g0 -> g1 -> g2 -> g3 -> g4 -> g5"; expected a chain of at most 4 cutter geometries/);+ assert.doesNotThrow(() => createAgentScene(recipeWith(geometries.slice(1))));+});++test('the total cutter work is bounded', () => {+ const heavy = { id: 'tool', type: 'sphere', segments: 512, rings: 256 };+ const twice = { ...drilled('block', 'tool'), edits: [bore({ geometry: 'tool' }), bore({ geometry: 'tool' }, 'second')] };+ assert.throws(() => createAgentScene(recipeWith([twice, heavy])), /expected cutter geometries that total at most 250000/);+});++test('replacing the cutter geometry in a live scene rebuilds the mesh that names it', () => {+ const scene = createAgentScene(recipeWith([drilled('block', 'tool'), { id: 'tool', type: 'cylinder', segments: 6, bevel: 0 }]));+ const before = JSON.stringify(scene.inspectMeshes().meshes[0].counts);+ scene.apply([+ { type: 'remove-geometry', id: 'tool' },+ { type: 'add-geometry', geometry: { id: 'tool', type: 'cylinder', segments: 48, bevel: 0 } },+ ], { expectedRevision: 0 });+ assert.notEqual(JSON.stringify(scene.inspectMeshes().meshes[0].counts), before);+});++test('removing a cutter geometry that a mesh names fails with the chain', () => {+ const scene = createAgentScene(recipeWith([drilled('block', 'tool'), { id: 'tool', type: 'box' }]));+ assert.throws(() => scene.apply([{ type: 'remove-geometry', id: 'tool' }], { expectedRevision: 0 }), /got "block -> tool"/);+});++test('a cutter record takes only the geometry field', () => {+ assert.throws(() => createAgentScene(recipeWith([+ { id: 'block', type: 'mesh', base: { type: 'box' }, edits: [bore({ geometry: 'tool', type: 'box' })] },+ { id: 'tool', type: 'box' },+ ])), /put translation, rotation and scale on the boolean edit/);+});