dsh-cad-harness 0.1.1-preview.1 → 0.1.2-preview.2
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.en.md +13 -4
- package/README.md +9 -0
- package/docs/TOOL-CONTRACTS.md +125 -13
- package/lib/client.js +589 -319
- package/lib/client.js.map +4 -4
- package/lib/contract-cli.js +159 -13
- package/lib/contract-cli.js.map +3 -3
- package/lib/import-run.js +4 -4
- package/lib/import-run.js.map +3 -3
- package/lib/index.js +22858 -31458
- package/lib/index.js.map +4 -4
- package/lib/types/client/heat.d.ts +6 -1
- package/lib/types/client/i18n.d.ts +6 -0
- package/lib/types/client/lighting.d.ts +1 -1
- package/lib/types/client/theme.d.ts +26 -0
- package/lib/types/client/tokens.d.ts +129 -3
- package/lib/types/host/analyze.d.ts +17 -0
- package/lib/types/host/assembly-check.d.ts +42 -22
- package/lib/types/host/assembly.d.ts +9 -37
- package/lib/types/host/delivery-audit.d.ts +53 -0
- package/lib/types/host/inspect.d.ts +19 -15
- package/lib/types/host/joint-graph.d.ts +1 -0
- package/lib/types/host/manifest.d.ts +11 -0
- package/lib/types/host/measure.d.ts +0 -44
- package/lib/types/host/motion.d.ts +97 -7
- package/lib/types/host/process-profile.d.ts +2 -0
- package/lib/types/host/project.d.ts +15 -0
- package/lib/types/host/runs.d.ts +18 -0
- package/lib/types/host/solidify.d.ts +2 -0
- package/lib/types/host/tools.d.ts +15 -0
- package/lib/types/host/turning.d.ts +9 -0
- package/lib/types/host/version.d.ts +10 -1
- package/lib/types/host/write-assembly.d.ts +11 -1
- package/lib/types/shared/types.d.ts +9 -0
- package/lib/verify.js +165 -27
- package/lib/verify.js.map +3 -3
- package/library/README.md +16 -6
- package/library/parts/din2098.0.8x8x20/part.json +10 -0
- package/library/parts/din2098.1.2x12x30/part.json +10 -0
- package/library/parts/din2098.1.5x16x40/part.json +10 -0
- package/library/parts/din2098.1x10x25/part.json +10 -0
- package/library/parts/din2098.2.5x25x60/part.json +10 -0
- package/library/parts/din2098.2x20x50/part.json +10 -0
- package/package.json +24 -5
- package/python/cad_worker/worker.py +548 -25
- package/scripts/doctor.mjs +2 -2
- package/skills/cad-assembly/SKILL.md +3 -1
- package/skills/cad-manufacturing/SKILL.md +4 -0
- package/skills/cad-modeling-measure/SKILL.md +11 -0
- package/skills/cad-simulation/SKILL.md +2 -1
- package/skills/cad-toolbox/SKILL.md +6 -5
package/README.en.md
CHANGED
|
@@ -12,7 +12,7 @@ library.
|
|
|
12
12
|
Tarball release (no build; `lib/` is included):
|
|
13
13
|
|
|
14
14
|
```bash
|
|
15
|
-
tar -xzf dsh-cad-harness-0.1.
|
|
15
|
+
tar -xzf dsh-cad-harness-0.1.2-preview.2.tgz
|
|
16
16
|
dsh plugin --profile <profile> add -w "$PWD/package"
|
|
17
17
|
cd package
|
|
18
18
|
node scripts/setup.mjs # writes this machine's skill path into the preset
|
|
@@ -73,8 +73,17 @@ The `dsh-cad-*` binaries are declared in `package.json`; they are on `PATH` when
|
|
|
73
73
|
the package is linked into a profile/tool installation. From an unpacked tarball,
|
|
74
74
|
`node scripts/*.mjs` is the reliable form.
|
|
75
75
|
|
|
76
|
+
## What's new in 0.1.2-preview.2
|
|
77
|
+
|
|
78
|
+
- `generate` takes `dryRun` (compile + measure, save nothing) and `preflight` (save only watertight single-body meshes).
|
|
79
|
+
- `cad_check` `sweep` screens a declared joint range before a motion run; revolute joints can declare `overlapEnvelope` / `fit`; motion supports a `gear` ratio.
|
|
80
|
+
- Print overhang is a support cost reported as a finding; only a process profile with `overhangDeg.hard: true` lowers the verdict.
|
|
81
|
+
- Heat-map layers (fused / thickness / overhang / von Mises) and a host-following light/dark theme.
|
|
82
|
+
- New sewing-rotary-hook and 3-speed-derailleur examples (each with a CadQuery variant); older examples move to the history index without being deleted.
|
|
83
|
+
- Full notes and known issues: `docs/dev/RELEASE-NOTES-0.1.2.md` in the source repository.
|
|
84
|
+
|
|
76
85
|
## Documentation
|
|
77
86
|
|
|
78
|
-
The
|
|
79
|
-
|
|
80
|
-
|
|
87
|
+
The full user, agent and maintainer docs live in the source repository under
|
|
88
|
+
`docs/` (`docs/user/` with English mirrors, `docs/llm/`, `docs/dev/`); the
|
|
89
|
+
maintainer docs remain Chinese for this preview.
|
package/README.md
CHANGED
|
@@ -42,6 +42,15 @@ does not appear at all — no error, just a missing mode. `npx dsh-cad-doctor` r
|
|
|
42
42
|
- BOSL2 optional, under `lib/BOSL2/` in the source checkout
|
|
43
43
|
- Python runtime is provisioned on first use (about 400 MB)
|
|
44
44
|
|
|
45
|
+
## What's new in 0.1.2-preview.2
|
|
46
|
+
|
|
47
|
+
- `generate` takes `dryRun` (compile + measure, save nothing) and `preflight` (save only watertight single-body meshes).
|
|
48
|
+
- `cad_check` `sweep` screens a declared joint range before a motion run; revolute joints can declare `overlapEnvelope` / `fit`; motion supports a `gear` ratio.
|
|
49
|
+
- Print overhang is a support cost reported as a finding; only a process profile with `overhangDeg.hard: true` lowers the verdict.
|
|
50
|
+
- Heat-map layers (fused / thickness / overhang / von Mises) and a host-following light/dark theme.
|
|
51
|
+
- New sewing-rotary-hook and 3-speed-derailleur examples (each with a CadQuery variant); older examples move to the history index without being deleted.
|
|
52
|
+
- Full notes and known issues: `docs/dev/RELEASE-NOTES-0.1.2.md` in the source repository.
|
|
53
|
+
|
|
45
54
|
## Documentation
|
|
46
55
|
|
|
47
56
|
The user guide, Agent reference, and maintainer notes live in the source
|
package/docs/TOOL-CONTRACTS.md
CHANGED
|
@@ -4,11 +4,28 @@
|
|
|
4
4
|
|
|
5
5
|
> **Call surface:** production exposes 9 surfaces; each section below documents an internal op. Call the `Model-facing call` surface/action, not the section heading.
|
|
6
6
|
|
|
7
|
+
## `affected_checks`
|
|
8
|
+
|
|
9
|
+
Model-facing call: `cad_deliver` action `affected` (this section documents the internal op).
|
|
10
|
+
|
|
11
|
+
Return, per changed/newest version, which part-level checks already cite it (fresh) and which only cite an older version (stale), plus the atomic calls that would refresh it. This is the INCREMENTAL half of delivery_audit: the audit says the corpus is incoherent, this says which checks the change actually invalidated. Manifest-level checks (assembly/motion) stay in deliver plan — their freshness depends on the contract, not one version.
|
|
12
|
+
|
|
13
|
+
| parameter | type | default | meaning |
|
|
14
|
+
|---|---|---|---|
|
|
15
|
+
| `changed` | array | — | Version ids that changed. Omit to use the newest version of every part. |
|
|
16
|
+
|
|
17
|
+
```js
|
|
18
|
+
cad_deliver({ action: "affected", args: { changed: [] } })
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
returns: `changedVersionIds`, `parts`, `summary`
|
|
22
|
+
|
|
23
|
+
|
|
7
24
|
## `analyze`
|
|
8
25
|
|
|
9
26
|
Model-facing call: `cad_inspect` action `analyze` (this section documents the internal op).
|
|
10
27
|
|
|
11
|
-
EXPERIMENTAL — do not base a delivery claim on this yet. The POINT map is thin-wall (lower side) + reentrant corners + (when `stressRunId` is given) STRENGTH from that stress run; PRINT overhang and thick-wall are PER-PART facts (area / thickness), never points — scoring them per sample painted whole rims red and buried the real corner signals (fixed 2026-10-21). The remaining caveats: the print-overhang fact is AREA-based, not mass-based; `support` is a mass-based estimate not verified on real prints; the |u| bands are declared, not calibrated. Build the risk map for a version and say where to LOOK: reentrant corners + mesh health (multi-body / non-manifold / degenerate) + non-planar boolean seams (scan_attention) + measured wall thickness (thin side), each normalised to |u| in [0,1] against its own DECLARED band (dead band + saturating scales; a one-sided quantity is an open band), then fused as max|u| plus an agreement count. When `stressRunId` is given, that run's local stress peaks also enter as `strength-concentration` at |u|=0.5 (a LOOK, not a risk); the absolute `strength` layer may be silent. Overhang area / thick-wall are reported once per part in `partNotes`; the mass-based unsupported regions are in `support`. It never gates and never returns a verdict: a peak means "look here", not "this will break". Comfortable regions are dropped, so an empty peak list means "nothing stands out", NOT "safe".
|
|
28
|
+
EXPERIMENTAL — do not base a delivery claim on this yet. The POINT map is thin-wall (lower side) + reentrant corners + (when `stressRunId` is given) STRENGTH from that stress run; PRINT overhang and thick-wall are PER-PART facts (area / thickness), never points — scoring them per sample painted whole rims red and buried the real corner signals (fixed 2026-10-21). The remaining caveats: the print-overhang fact is AREA-based, not mass-based; `support` is a mass-based estimate not verified on real prints; the |u| bands are declared, not calibrated. Build the risk map for a version and say where to LOOK: reentrant corners + mesh health (multi-body / non-manifold / degenerate) + non-planar boolean seams (scan_attention) + measured wall thickness (thin side), each normalised to |u| in [0,1] against its own DECLARED band (dead band + saturating scales; a one-sided quantity is an open band), then fused as max|u| plus an agreement count. When `stressRunId` is given, that run's local stress peaks also enter as `strength-concentration` at |u|=0.5 (a LOOK, not a risk); the absolute `strength` layer may be silent. Overhang area / thick-wall are reported once per part in `partNotes`; the mass-based unsupported regions are in `support`. It never gates and never returns a verdict: a peak means "look here", not "this will break". Every peak carries a runnable `probe` (measure section) and `look` (render_part section) at its Z — a coordinate without a next action is not attention guidance. Comfortable regions are dropped, so an empty peak list means "nothing stands out", NOT "safe".
|
|
12
29
|
|
|
13
30
|
| parameter | type | default | meaning |
|
|
14
31
|
|---|---|---|---|
|
|
@@ -117,15 +134,15 @@ CNC 3-AXIS ACCESS SCREEN: sample the mesh and test visibility from ±X/±Y/±Z;
|
|
|
117
134
|
| parameter | type | default | meaning |
|
|
118
135
|
|---|---|---|---|
|
|
119
136
|
| `versionId` | string | **required** | Saved version to screen, e.g. "v012". |
|
|
120
|
-
| `maxSetups` | integer |
|
|
137
|
+
| `maxSetups` | integer | — | Declared maximum number of principal setups. Default 6 (the six principal directions); declare fewer only if that is a real machine/fixture limit — exceeding it then excludes, which is a declared capability, not a geometric impossibility. |
|
|
121
138
|
| `requireAllAccessible` | boolean | — | true = any inaccessible area is a witness; false = warning. Default false. |
|
|
122
139
|
| `sampleLimit` | integer | — | Max sampled triangles; default 300, capped at 600 (each sample is 6 ray casts). |
|
|
123
140
|
|
|
124
141
|
```js
|
|
125
|
-
cad_check({ action: "cnc", args: { versionId: "…"
|
|
142
|
+
cad_check({ action: "cnc", args: { versionId: "…" } })
|
|
126
143
|
```
|
|
127
144
|
|
|
128
|
-
returns: `versionId`, `verdict`, `witnesses`, `findings`, `unevaluable`, `metrics`, `params`, `runId`
|
|
145
|
+
returns: `versionId`, `verdict`, `witnesses`, `findings`, `unevaluable`, `metrics`, `params`, `sealedCavities`, `runId`
|
|
129
146
|
|
|
130
147
|
|
|
131
148
|
## `check_edm_access`
|
|
@@ -158,7 +175,9 @@ Screen up to 12 saved versions in ONE call: per version, the measure half (water
|
|
|
158
175
|
|---|---|---|---|
|
|
159
176
|
| `versionIds` | array | **required** | Versions to screen, e.g. ["v031","v032","v033"]. Duplicates are removed; at most 12 are screened per call. |
|
|
160
177
|
| `checks` | array | — | Which halves to run: "measure" and/or "printability". Default both. |
|
|
161
|
-
| `profileIds` | array | — |
|
|
178
|
+
| `profileIds` | array | — | Process profiles for the printability half: shipped ids, or a project-local profiles/<id>.json. Omit to use the built-in fallback (which downgrades a pass, as in check_printability). |
|
|
179
|
+
| `profilesJson` | string | — | Inline JSON array of process profiles for the batch — the batch used to accept only shipped ids, forcing N single calls for a custom CNC profile. |
|
|
180
|
+
| `edgeOnlyThinPct` | number | — | Printability half: thin area at or below this % is a sharp-edge artefact, not a shell. Default 1.0; 0 disables. |
|
|
162
181
|
| `wallMinMm` | number | — | Wall thinner than this is reported (printability half). Default 1.2. |
|
|
163
182
|
| `overhangDeg` | number | — | Down-facing faces steeper than this count as print-overhang (FDM support, printability half; NOT structural overhang/self-weight stress). Default 45. |
|
|
164
183
|
| `printOrientationDeg` | array | — | G6 (2026-10-29): the PRINT orientation as [rx,ry,rz] degrees (Rz·Ry·Rx), applied before the overhang/wall analysis. The modelling pose is not the printing pose — declare it; the reply's overhang/witness numbers are then in the printed frame. |
|
|
@@ -175,15 +194,17 @@ returns: `parts`, `failures`, `summary`
|
|
|
175
194
|
|
|
176
195
|
Model-facing call: `cad_check` action `printability` (this section documents the internal op).
|
|
177
196
|
|
|
178
|
-
Manufacturability screen for a saved version: sampled wall thickness (ray to the opposite wall along the inward normal) plus exact print-overhang area (FDM support; NOT structural overhang/self-weight stress) steeper than the print-overhang angle. The wall half is SAMPLED (a thin feature between samples is missed); the print-overhang area is exact. If wallMeasured is false the ray half measured nothing, so the verdict is never "ok". Run it before delivering and after any wall/angle-changing edit. Judge against a DECLARED process via `profileIds` (e.g. ["fdm-pla-0.4"]) or `profilesJson`: each profile returns "excluded" (with a witness: rule, location, measured vs required) or "not-excluded" — NOT-EXCLUDED IS NOT "CAN BE MADE". It never ranks or recommends. With no profile it uses a named built-in fallback (all numbers `assumed`) and downgrades ok to check. Authoring a profile: cad-manufacturing skill. JUDGEMENT vs DETECTION: this tool produces both halves; pass `mode` to get one. A green verdict says nothing about where to look, and the attention field is not a verdict (DESIGN §25.7).
|
|
197
|
+
Manufacturability screen for a saved version: sampled wall thickness (ray to the opposite wall along the inward normal) plus exact print-overhang area (FDM support; NOT structural overhang/self-weight stress) steeper than the print-overhang angle. The wall half is SAMPLED (a thin feature between samples is missed); the print-overhang area is exact. PRINT overhang is a support COST, reported as a finding: it gates the verdict only when the process profile declares `overhangDeg.hard: true` (no supports / visible surface / trapped cavity); otherwise a supported FDM part can be not-excluded. If wallMeasured is false the ray half measured nothing, so the verdict is never "ok". Run it before delivering and after any wall/angle-changing edit. Judge against a DECLARED process via `profileIds` (e.g. ["fdm-pla-0.4"]) or `profilesJson`: each profile returns "excluded" (with a witness: rule, location, measured vs required) or "not-excluded" — NOT-EXCLUDED IS NOT "CAN BE MADE". It never ranks or recommends. With no profile it uses a named built-in fallback (all numbers `assumed`) and downgrades ok to check. Authoring a profile: cad-manufacturing skill. JUDGEMENT vs DETECTION: this tool produces both halves; pass `mode` to get one. A green verdict says nothing about where to look, and the attention field is not a verdict (DESIGN §25.7).
|
|
179
198
|
|
|
180
199
|
| parameter | type | default | meaning |
|
|
181
200
|
|---|---|---|---|
|
|
182
201
|
| `mode` | string (judge \| scan \| both) | — | "judge" (default) returns ONLY the judgement half (verdict / findings / profiles, no attention field); "scan" returns ONLY the attention field and NO verdict, because a risk map must never be read as a gate; "both" returns the two halves as separate keys. The run ALWAYS records both halves (report.json + attention.json) — the mode trims the reply, not the record (DESIGN §25.7). |
|
|
183
202
|
| `versionId` | string | **required** | Saved version id to screen, e.g. "v012". |
|
|
184
203
|
| `wallMinMm` | number | — | Wall thinner than this is reported. Default 1.2 (≈2× a 0.4mm nozzle line width). |
|
|
185
|
-
| `overhangDeg` | number | — | A down-facing face tilted more than this many degrees from vertical counts as print-overhang (FDM support, NOT structural overhang/self-weight stress). Default 45. |
|
|
204
|
+
| `overhangDeg` | number | — | A down-facing face tilted more than this many degrees from vertical counts as print-overhang (FDM support, NOT structural overhang/self-weight stress). Default 45. The area is reported as a support-cost finding; only a process profile with overhangDeg.hard=true lets it gate the verdict. |
|
|
205
|
+
| `printOrientationDeg` | array | — | The PRINT orientation as [rx,ry,rz] degrees (Rz·Ry·Rx), applied before the overhang/wall analysis. The modelling pose is not the printing pose — declare it (e.g. [180,0,0] for a part printed upside down); the reply's overhang/witness numbers are then in the printed frame. Absent = modelling pose. |
|
|
186
206
|
| `samples` | number | — | Approximate surface samples. Default 600; raise for big meshes, lower for quick passes. |
|
|
207
|
+
| `edgeOnlyThinPct` | number | — | Thin area at or below this % of surface is classified as a solid sharp-edge artefact, not a thin shell (default 1.0; 0 disables). A shell is sustained area; a deburring edge is a strip. |
|
|
187
208
|
| `profileIds` | array | — | Shipped process profiles to judge against, e.g. ["fdm-pla-0.4"]. Each yields its own two-valued verdict. Omit (with profilesJson) to use the built-in fallback, which the report then names. |
|
|
188
209
|
| `profilesJson` | string | — | An inline JSON array of process profiles (schema: schemas/process-profile.schema.json). Use for a profile you authored; an invalid one is REFUSED with the offending rule named. |
|
|
189
210
|
|
|
@@ -191,7 +212,7 @@ Manufacturability screen for a saved version: sampled wall thickness (ray to the
|
|
|
191
212
|
cad_check({ action: "printability", args: { versionId: "…" } })
|
|
192
213
|
```
|
|
193
214
|
|
|
194
|
-
returns: `versionId`, `nextLook`, `verdict`, `minWallMm`, `wallMeasured`, `thinSamples`, `sampled`, `thinAreaMm2`, `thinAreaPct`, `surfaceAreaMm2`, `overhangAreaMm2`, `printOrientationDeg`, `overhangZRange`, `findings`, `minWallAtMm`, `watertight`, `attention`, `profileSource`, `profiles`
|
|
215
|
+
returns: `versionId`, `nextLook`, `verdict`, `minWallMm`, `wallMeasured`, `thinSamples`, `sampled`, `thinAreaMm2`, `thinAreaPct`, `edgeOnlyThinPct`, `surfaceAreaMm2`, `overhangAreaMm2`, `printOrientationDeg`, `overhangZRange`, `findings`, `minWallAtMm`, `watertight`, `attention`, `profileSource`, `profiles`
|
|
195
216
|
|
|
196
217
|
|
|
197
218
|
## `check_sheet2d`
|
|
@@ -222,6 +243,28 @@ cad_check({ action: "sheet2d", args: { versionId: "…", kerfMm: 0, minHoleMm: 0
|
|
|
222
243
|
returns: `versionId`, `axisMm`, `atMm`, `uAxisMm`, `vAxisMm`, `verdict`, `witnesses`, `findings`, `unevaluable`, `metrics`, `params`, `section`, `runId`
|
|
223
244
|
|
|
224
245
|
|
|
246
|
+
## `check_sweep`
|
|
247
|
+
|
|
248
|
+
Model-facing call: `cad_check` action `sweep` (this section documents the internal op).
|
|
249
|
+
|
|
250
|
+
Early sweep screen for ONE moving version against static versions over a DECLARED joint range. A continuous swept AABB envelope drops pairs that cannot touch; coarse closest-point clearance samples are then refined where clearance is below 2×minFeature, until the arc step is <= minFeature/2 or the sample budget is exhausted (then UNCOVERED, never clean). Returns SUSPECTS, not a delivery verdict: a positive clearance is not a pass, and simulate_motion remains the pass/fail evidence. Use it before building a motion run to find a swing/stroke collision early.
|
|
251
|
+
|
|
252
|
+
| parameter | type | default | meaning |
|
|
253
|
+
|---|---|---|---|
|
|
254
|
+
| `versionId` | string | **required** | The MOVING part (saved version id). |
|
|
255
|
+
| `againstVersionIds` | array | **required** | Static versions to screen against (at least one). |
|
|
256
|
+
| `joint` | object | **required** | The declared sweep: revolute (degrees) or prismatic (mm) about/along a world axis and anchor. |
|
|
257
|
+
| `minFeatureMm` | number | — | The smallest feature that must not be stepped over. Default 0.5. The refinement target is half of it. |
|
|
258
|
+
| `maxSamples` | number | — | Sample budget per pair. Default 48; when exhausted the pair is UNCOVERED, not clean. |
|
|
259
|
+
| `clearanceThresholdMm` | number | — | Clearance at or below this is a collision. Default 0 (touching). |
|
|
260
|
+
|
|
261
|
+
```js
|
|
262
|
+
cad_check({ action: "sweep", args: { versionId: "…", againstVersionIds: [], joint: {} } })
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
returns: `moving`, `joint`, `rows`, `overall`, `rule`, `notes`
|
|
266
|
+
|
|
267
|
+
|
|
225
268
|
## `check_turning`
|
|
226
269
|
|
|
227
270
|
Model-facing call: `cad_check` action `turning` (this section documents the internal op).
|
|
@@ -303,7 +346,7 @@ returns: `verdict`, `judgement`, `findings`, `summary`, `versions`, `parts`, `ru
|
|
|
303
346
|
|
|
304
347
|
Model-facing call: `cad_part` action `generate` (this section documents the internal op).
|
|
305
348
|
|
|
306
|
-
Compile a part into a new version. Pass EITHER `scadCode` (OpenSCAD) OR `code` (CadQuery Python); exactly one is required. CadQuery scripts must leave a `result` (Workplane/Shape) or call `show_object(...)`; declare anchors with datum/datum_axis/datum_plane/datum_cyl (point first, same schema as OpenSCAD). OpenSCAD code is self-contained with $fn=64 (BOSL2 available); declare datum("name",[x,y,z]) at top level in final world coordinates. G2: datum_axis/datum_plane/datum_cyl are (name, point, dir) — POINT FIRST; a swapped OpenSCAD positional call compiles silently and corrupts the contract. Renders are attached by default; trim with `views` on numeric iterations. CadQuery renders are produced by the shared STL→OpenSCAD path, never by VTK. The FIRST version of a part also gets a sampled wall screen (minWallMm + warning) — when several parts share a new feature (a slot, a snap, a thread), generate ONE representative, fix its screen, then generate the family; regenerating N parts after a shared defect costs N rounds.
|
|
349
|
+
Compile a part into a new version. Pass EITHER `scadCode` (OpenSCAD) OR `code` (CadQuery Python); exactly one is required. CadQuery scripts must leave a `result` (Workplane/Shape) or call `show_object(...)`; declare anchors with datum/datum_axis/datum_plane/datum_cyl (point first, same schema as OpenSCAD). OpenSCAD code is self-contained with $fn=64 (BOSL2 available when installed); declare datum("name",[x,y,z]) at top level in final world coordinates. G2: datum_axis/datum_plane/datum_cyl are (name, point, dir) — POINT FIRST; a swapped OpenSCAD positional call compiles silently and corrupts the contract. Renders are attached by default; trim with `views` on numeric iterations. CadQuery renders are produced by the shared STL→OpenSCAD path, never by VTK. The FIRST version of a part also gets a sampled wall screen (minWallMm + warning) — when several parts share a new feature (a slot, a snap, a thread), generate ONE representative, fix its screen, then generate the family; regenerating N parts after a shared defect costs N rounds.
|
|
307
350
|
|
|
308
351
|
| parameter | type | default | meaning |
|
|
309
352
|
|---|---|---|---|
|
|
@@ -314,12 +357,14 @@ Compile a part into a new version. Pass EITHER `scadCode` (OpenSCAD) OR `code` (
|
|
|
314
357
|
| `part` | string | — | Which part this version belongs to — the name the user would call it, e.g. "调焦轴". ALWAYS pass this when iterating: it is what groups versions into one part in the panel. Omit only for a brand-new part with no parentVersion (a name is then derived from userIntent), or to inherit the parentVersion's part. |
|
|
315
358
|
| `views` | array | — | Which render views to ATTACH (each attached image spends context image budget): subset of ["top","front","side","iso"]. Default: all four — right for a new shape or a shape change you need to SEE. For an iteration that only changes a number you will verify by measurement (a hole Ø, a length), pass ["iso"]. Pass [] to register the version with NO images attached — the panel still shows the geometry, so the human is not blinded. |
|
|
316
359
|
| `step` | boolean | — | CadQuery only: also write model.step and record BRepCheck provenance (optional; adds ~tens of KB and a STEP/STL consistency check). |
|
|
360
|
+
| `dryRun` | boolean | — | Compile + check WITHOUT saving: no version, no images, no part row. Reports watertight / bodies / bbox / min-wall (600 samples) and refuses to create anything. Use it when you want to probe geometry before spending a version. |
|
|
361
|
+
| `preflight` | boolean | — | Compile + check BEFORE saving: a version is written only when the mesh is watertight AND a single connected body; a sub-1.2mm wall is reported as a warning (legitimate thin ears must not be blocked). A refusal writes no version and no image. Default false preserves the current "failed rounds land in history" behavior. |
|
|
317
362
|
|
|
318
363
|
```js
|
|
319
364
|
cad_part({ action: "generate", args: { userIntent: "…" } })
|
|
320
365
|
```
|
|
321
366
|
|
|
322
|
-
returns: `versionId`, `success`, `errors`, `warnings`, `durationMs`, `views`, `sizeMm`, `bboxMin`, `bboxMax`, `watertight`, `triangles`, `shells`, `kernel`, `step`, `errorCode`, `fix`, `minWallMm`, `minWallAtMm`, `part`
|
|
367
|
+
returns: `versionId`, `saved`, `dryRun`, `preflight`, `success`, `errors`, `warnings`, `durationMs`, `views`, `sizeMm`, `bboxMin`, `bboxMax`, `watertight`, `triangles`, `shells`, `kernel`, `step`, `errorCode`, `fix`, `minWallMm`, `minWallAtMm`, `part`
|
|
323
368
|
|
|
324
369
|
|
|
325
370
|
## `import_part`
|
|
@@ -418,6 +463,11 @@ All measurements are mm, z-up, and read the SAVED version: the answer is about t
|
|
|
418
463
|
| `bPoint` | array | — | gap: side b as a point. |
|
|
419
464
|
| `bDatum` | string | — | gap: side b as a datum name. |
|
|
420
465
|
| `bOn` | string | — | gap: which side the reported distance is measured TO ("a" \| "b"); default both witness pairs. |
|
|
466
|
+
| `runId` | string | — | gap: measure two parts of a saved run at one trajectory pose (needs aPart/bPart + timeSec or step). |
|
|
467
|
+
| `timeSec` | number | — | gap run mode: trajectory time, s. |
|
|
468
|
+
| `step` | number | — | gap run mode: simulation step, looked up in the run report. |
|
|
469
|
+
| `aPart` | string | — | gap run mode: part A name in the run. |
|
|
470
|
+
| `bPart` | string | — | gap run mode: part B name in the run. |
|
|
421
471
|
| `snap` | boolean | — | gap: snap a bare point onto the nearest surface of its version before measuring. Default true. |
|
|
422
472
|
| `from` | array | — | thickness: starting point [x,y,z]. |
|
|
423
473
|
| `fromDatum` | string | — | thickness: start from a datum instead of a point. |
|
|
@@ -592,6 +642,26 @@ cad_session({ action: "review", args: { items: [] } })
|
|
|
592
642
|
returns: `queued`, `merged`, `dropped`, `unread`, `rateLimited`
|
|
593
643
|
|
|
594
644
|
|
|
645
|
+
## `retire_run`
|
|
646
|
+
|
|
647
|
+
Model-facing call: `cad_deliver` action `retire` (this section documents the internal op).
|
|
648
|
+
|
|
649
|
+
Retire (or un-retire) a run: keep all artifacts and history, but stop counting it as current evidence. Use it for a failure/screen whose geometry a later version replaced, or a declaration error that a re-run fixed. A retirement REQUIRES a reason; it is written to the run index and the run's own run.json, and delivery_audit excludes retired runs from failing/latest/stale verdicts (they still appear in runs.retired). This is not deletion: nothing is moved or removed. Prefer a fresh run with the same subject when the geometry is still current; retire only when the run can never become current again.
|
|
650
|
+
|
|
651
|
+
| parameter | type | default | meaning |
|
|
652
|
+
|---|---|---|---|
|
|
653
|
+
| `runId` | string | **required** | Run id, e.g. "r006". |
|
|
654
|
+
| `reason` | string | **required** | Why this run is history, e.g. "v017 washer face overlap; fixed in v026". |
|
|
655
|
+
| `by` | string | — | Who/what approved the retirement (default: the calling session). |
|
|
656
|
+
| `undo` | boolean | — | true = clear an existing retirement (the artifacts were never changed). |
|
|
657
|
+
|
|
658
|
+
```js
|
|
659
|
+
cad_deliver({ action: "retire", args: { runId: "…", reason: "…" } })
|
|
660
|
+
```
|
|
661
|
+
|
|
662
|
+
returns: `runId`, `kind`, `status`, `retiredAt`, `reason`, `retiredCount`, `activeCount`
|
|
663
|
+
|
|
664
|
+
|
|
595
665
|
## `review_visual`
|
|
596
666
|
|
|
597
667
|
Model-facing call: `cad_see` action `review` (this section documents the internal op).
|
|
@@ -689,6 +759,24 @@ cad_part({ action: "role", args: { part: "…", role: "…" } })
|
|
|
689
759
|
returns: `partId`, `name`, `role`, `previousRole`, `effect`
|
|
690
760
|
|
|
691
761
|
|
|
762
|
+
## `set_project_kernel`
|
|
763
|
+
|
|
764
|
+
Model-facing call: `cad_session` action `kernel` (this section documents the internal op).
|
|
765
|
+
|
|
766
|
+
Change the project-level authoring kernel in place (openscad <-> cadquery). Existing versions keep their own backend pin and source file; only NEW generate_part calls follow the new default. The session prompt updates on the next turn. Use this instead of creating a second project just to switch engines — the previous design and its evidence stay in one corpus.
|
|
767
|
+
|
|
768
|
+
| parameter | type | default | meaning |
|
|
769
|
+
|---|---|---|---|
|
|
770
|
+
| `kernel` | string (openscad \| cadquery) | **required** | New default kernel for this project. |
|
|
771
|
+
| `dir` | string | — | Project directory; default the session's bound project (or live cwd). |
|
|
772
|
+
|
|
773
|
+
```js
|
|
774
|
+
cad_session({ action: "kernel", args: { kernel: "openscad" } })
|
|
775
|
+
```
|
|
776
|
+
|
|
777
|
+
returns: `root`, `key`, `previous`, `kernel`, `note`
|
|
778
|
+
|
|
779
|
+
|
|
692
780
|
## `simulate_fluid`
|
|
693
781
|
|
|
694
782
|
Model-facing call: `cad_simulate` action `fluid` (this section documents the internal op).
|
|
@@ -737,21 +825,22 @@ returns: `overallStatus`, `metrics`
|
|
|
737
825
|
|
|
738
826
|
Model-facing call: `cad_simulate` action `motion` (this section documents the internal op).
|
|
739
827
|
|
|
740
|
-
Assembled-mechanism kinematics: a constant-speed crank AND/OR prescribed sinusoidal movers (no crank is required when every mover is an oscillator), revolute/prismatic followers, optionally parts on prescribed sinusoidal paths. Returns stroke/period, an exact interference timeline at >=24 sampled poses per run (final pose included; fewer means check, never pass), joint anchor drift, keyframes. Gravity is off.
|
|
828
|
+
Assembled-mechanism kinematics: a constant-speed crank AND/OR prescribed sinusoidal movers (no crank is required when every mover is an oscillator), revolute/prismatic followers, optionally parts on prescribed sinusoidal paths. Returns stroke/period, an exact interference timeline at >=24 sampled poses per run (final pose included; fewer means check, never pass), joint anchor drift, keyframes. Gravity is off. A revolute joint may declare `overlapEnvelope` (the fit capsule along its axis) and `fit`: overlap inside the capsule is listed in `jointExemptions` and, until `fit` is declared, keeps the run at check (`jointFitsUnresolved`); overlap outside it is interference. A joint may also be `type:"gear"` with a signed `ratio` (turns of B per turn of A) and each body's own `axisA`/`axisB`: the coupling is prescribed (rapier has no gear constraint), transfers no torque, and `metrics.gears` reports declared vs measured turns. Every interference event carries `overlapBboxMm` (min XYZ + max XYZ of the intersection), so a swept clash can be located without replaying the run.
|
|
741
829
|
|
|
742
830
|
| parameter | type | default | meaning |
|
|
743
831
|
|---|---|---|---|
|
|
744
832
|
| `parts` | array | **required** | Parts of the mechanism. The crank should be bodyType "kinematic". |
|
|
745
|
-
| `joints` | array | **required** | Joints between parts. |
|
|
833
|
+
| `joints` | array | **required** | Joints between parts. A revolute joint may carry overlapEnvelope + fit (the declared fit capsule); with scanJointPairs those pairs enter the timeline instead of being excluded. |
|
|
746
834
|
| `drive` | object | — | The constant-speed crank drive. Omit it when every mover is a prescribed oscillator (a guide/valve following a sinusoid): the time base is then the oscillator period. A run with neither a drive nor an oscillator is refused — nothing would move. |
|
|
747
835
|
| `oscillators` | array | — | Prescribed sinusoidal movers (valves). bodyType must be "kinematic". |
|
|
836
|
+
| `scanJointPairs` | boolean | — | Also boolean-test revolute-linked pairs. Off by default: those pairs are then listed in excludedJointPairs. Turn it on when a motion-clearance interface needs evidence over a hinge pair — without it that pair is never in the timeline. |
|
|
748
837
|
| `cycles` | number | — | Drive cycles to simulate. Default 2. FRACTIONAL values are meaningful and are honoured: a balance whose design range is ±14° sweeps 0.078 of a turn, and asking for a whole turn instead answers a different question (the beam becomes a windmill and every part of it collides). |
|
|
749
838
|
|
|
750
839
|
```js
|
|
751
840
|
cad_simulate({ action: "motion", args: { parts: [], joints: [] } })
|
|
752
841
|
```
|
|
753
842
|
|
|
754
|
-
returns: `overallStatus`, `followers`, `interferenceCount`, `interferenceEvents`, `interferenceChecks`, `candidatePairs`, `interferencePairChecks`, `samplingSatisfied`, `maxSampleGapDeg`, `blocking`, `deliverability`, `maxJointDriftMm`, `closedLoop`, `loopJoints`, `geometrySuspects`, `geometrySuspectRule`, `hasCrank`, `initialJointGaps`, `jointToleranceMm`, `jointViolations`, `pivots`, `keyframes`, `runId`, `playback`, `stepsRun`, `durationSec`
|
|
843
|
+
returns: `overallStatus`, `followers`, `gears`, `interferenceCount`, `interferenceEvents`, `interferenceChecks`, `candidatePairs`, `interferencePairChecks`, `excludedJointPairs`, `jointPairScan`, `jointFitsUnresolved`, `jointExemptions`, `jointExemptRule`, `samplingSatisfied`, `maxSampleGapDeg`, `blocking`, `deliverability`, `maxJointDriftMm`, `closedLoop`, `loopJoints`, `geometrySuspects`, `geometrySuspectRule`, `hasCrank`, `initialJointGaps`, `jointToleranceMm`, `jointViolations`, `pivots`, `keyframes`, `runId`, `playback`, `stepsRun`, `durationSec`
|
|
755
844
|
|
|
756
845
|
|
|
757
846
|
## `simulate_physics`
|
|
@@ -810,6 +899,25 @@ cad_simulate({ action: "stress", args: { versionId: "…" } })
|
|
|
810
899
|
returns: `versionId`, `nextLook`, `verdict`, `delivery`, `material`, `loadCase`, `selfWeight`, `method`, `checks`, `resultants`, `capability`, `attention`
|
|
811
900
|
|
|
812
901
|
|
|
902
|
+
## `suggest_interfaces`
|
|
903
|
+
|
|
904
|
+
Model-facing call: `cad_assembly` action `suggest` (this section documents the internal op).
|
|
905
|
+
|
|
906
|
+
Turn undeclared near-contact pairs into READY-TO-EDIT interface templates. The assembly check reports "52 undeclared" but not which datums to use, so every contact had to be hand-written. This runs the same adjacency pass, reads each part's datums, and proposes a distance interface with the measured gap and a symmetric tolerance. The template is a STARTING POINT: it uses the first point datum (or first axis/plane/cylinder) on each part, so review the chosen datums — it never writes the contract.
|
|
907
|
+
|
|
908
|
+
| parameter | type | default | meaning |
|
|
909
|
+
|---|---|---|---|
|
|
910
|
+
| `manifestPath` | string | — | Assembly manifest; default assembly/assembly.json. |
|
|
911
|
+
| `adjacencyThresholdMm` | number | — | Near-contact gap below which a pair is proposed. Default 0.75. |
|
|
912
|
+
| `maxSuggestions` | integer | — | Cap the reply. Default 20, max 60. |
|
|
913
|
+
|
|
914
|
+
```js
|
|
915
|
+
cad_assembly({ action: "suggest", args: { manifestPath: "…" } })
|
|
916
|
+
```
|
|
917
|
+
|
|
918
|
+
returns: `manifest`, `thresholdMm`, `undeclared`, `suggestions`, `skipped`
|
|
919
|
+
|
|
920
|
+
|
|
813
921
|
## `validate_assembly`
|
|
814
922
|
|
|
815
923
|
Model-facing call: `cad_assembly` action `validate` (this section documents the internal op).
|
|
@@ -844,6 +952,10 @@ Write or update the assembly contract. This is the ONLY write entry: the contrac
|
|
|
844
952
|
| `reason` | string | **required** | Why this change is made. Recorded in the change log; empty is refused. |
|
|
845
953
|
| `dryRun` | boolean | — | Validate and return the diff without writing or appending a change record. |
|
|
846
954
|
| `root` | object | — | Assembly root (create/replace) or patch (merge). Merge upserts children/interfaces by id and preserves unspecified fields. |
|
|
955
|
+
| `rootPath` | string | — | Workspace-relative JSON file containing the root object. Use this for a large assembly instead of inlining ~20k characters; root wins if both are given. |
|
|
956
|
+
| `patch` | object | — | JSON-merge patch of the WHOLE manifest (root / manufacturing / claims). Arrays and scalars replace; null deletes. Applied before the root merge. |
|
|
957
|
+
| `manufacturing` | object | — | Top-level manufacturing policy: {allowed:[{id,note?}], approvedBy?, approvedAt?, mixApprovedBy?, mixApprovedAt?, delegate?}. Lives beside root; omitting it preserves the file's existing policy. |
|
|
958
|
+
| `claims` | array | — | Declared delivery claims persisted with the contract: [{kind, statement}]. delivery_audit reads them back, so no-claims-declared is avoidable. |
|
|
847
959
|
| `remove` | object | — | Explicit root-level deletions; omitted ids are preserved, never deleted implicitly. |
|
|
848
960
|
|
|
849
961
|
```js
|