cyclecad 3.9.20 → 3.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,99 @@
1
+ # AI Copilot — multi-step CAD generation from natural language
2
+
3
+ > *"create a Raspberry Pi 4B case with port cutouts and 3mm fillet"* → Claude writes a 14-step plan → cycleCAD executes it live in the viewport.
4
+
5
+ AI Copilot is cycleCAD's answer to Onshape's Adam AI Tools. It lets you describe a mechanical part in plain English; the LLM plans a sequence of Agent API calls; each call executes against the live 3D scene; on step failure, the LLM is asked for a recovery plan (up to 2 retries).
6
+
7
+ ## Quick start
8
+
9
+ 1. **Tools menu → AI Copilot (multi-step)** (or `Ctrl+Shift+A` if bound)
10
+ 2. Click **🔑** and paste a provider key — Anthropic Claude, Google Gemini (free tier), or Groq (free tier)
11
+ 3. Pick a model in the dropdown (Claude Sonnet 4.6 is the default when you have an Anthropic key)
12
+ 4. Type a prompt in the textarea
13
+ 5. Click **⚡ Generate** — you'll see the plan arrive, then each step execute live
14
+
15
+ ### Try these prompts
16
+
17
+ | Prompt | What Claude builds |
18
+ |---|---|
19
+ | `box 100x50x20 with 3mm fillet` | Simple box, extrude, fillet, iso view |
20
+ | `create a Raspberry Pi 4B case with port cutouts` | Case base → shell → 4 mounting posts → USB/HDMI/Ethernet cutouts → vent slots → fillet |
21
+ | `design a 50mm mounting bracket with 4 holes on 40mm PCD` | Circular sketch → extrude → pattern-hole at PCD |
22
+ | `M10 hex nut, 8mm thick, with chamfered edges` | Hex sketch → extrude → through-hole M10 → chamfer both faces |
23
+ | `L-bracket 100×60×5mm with 4 M5 mounting holes` | L-profile sketch → extrude → 4 holes |
24
+
25
+ ## Models supported
26
+
27
+ | Model | Provider | Best for | Cost |
28
+ |---|---|---|---|
29
+ | **Claude Sonnet 4.6** | Anthropic | Balanced — the default | Paid |
30
+ | Claude Haiku 4.5 | Anthropic | Fastest, cheap | Paid |
31
+ | Claude Opus 4.6 | Anthropic | Highest quality for hard designs | Paid (higher) |
32
+ | Gemini 2.0 Flash | Google | Free tier available | Free |
33
+ | Groq Llama 3.1 70B | Groq | Fast + free | Free |
34
+
35
+ Get Anthropic key at [console.anthropic.com](https://console.anthropic.com), Gemini at [aistudio.google.com/apikey](https://aistudio.google.com/apikey), Groq at [console.groq.com/keys](https://console.groq.com/keys). Keys are stored locally in `localStorage['cyclecad_api_keys']` — never sent to our servers.
36
+
37
+ ## What the copilot can do
38
+
39
+ The LLM is primed with the full Agent API surface:
40
+
41
+ | Namespace | Commands |
42
+ |---|---|
43
+ | `sketch.*` | `start`, `line`, `circle`, `rect`, `end` |
44
+ | `ops.*` | `extrude`, `revolve`, `fillet`, `chamfer`, `shell`, `hole`, `pattern` |
45
+ | `view.*` | `set` (isometric/top/front/etc.), `fit` |
46
+ | `query.*` | `features`, `bbox` |
47
+ | `validate.*` | `cost`, `mass` |
48
+
49
+ It also knows real board specifications:
50
+ - **Raspberry Pi 4B**: 85 × 56 × 1.4 mm, mounting holes at `(3.5,3.5), (61.5,3.5), (3.5,52.5), (61.5,52.5)`, Ø2.7
51
+ - **Arduino Uno**: 68.6 × 53.4 × 1.6 mm
52
+ - **Arduino Nano**: 45 × 18 mm
53
+
54
+ ## Error recovery
55
+
56
+ When a step fails (e.g., `ops.extrude` called without an active sketch), the copilot:
57
+
58
+ 1. Logs `✗ step N: <method>: <error>`
59
+ 2. Sends back to LLM: failed step + error + remaining steps + original goal
60
+ 3. LLM returns a replacement sequence that recovers and continues
61
+ 4. Logs `ℹ Inserted N recovery steps`
62
+
63
+ You get two recovery attempts per prompt. After that the run stops and you see a warning.
64
+
65
+ ## Module API
66
+
67
+ ```js
68
+ window.CycleCAD.AICopilot = {
69
+ init: () => true,
70
+ getUI: () => HTMLElement, // the sidebar panel
71
+ execute: (cmd, params) => ..., // programmatic: "generate" or "stop"
72
+ go: () => Promise<void>, // run the current prompt
73
+ abort: () => void, // stop mid-run
74
+ getState: () => ({ running, stepIndex, results, errors })
75
+ }
76
+ ```
77
+
78
+ To run a prompt programmatically:
79
+ ```js
80
+ window.CycleCAD.AICopilot.execute('generate', { prompt: 'create a 50mm cube with 3mm fillet' });
81
+ ```
82
+
83
+ ## Keyboard shortcuts (in the panel)
84
+
85
+ | Shortcut | Action |
86
+ |---|---|
87
+ | `Cmd/Ctrl + Enter` | Generate (same as ⚡ button) |
88
+ | `⏹ Stop` button | Abort mid-run |
89
+
90
+ ## Known limitations
91
+
92
+ - **LLM accuracy**: complex geometry (sweeps, lofts, assemblies) sometimes confuses the planner. Try breaking into simpler prompts and chaining results.
93
+ - **Units**: always millimeters. Saying "make a 2 inch cylinder" gets parsed as 2 mm. Convert before prompting.
94
+ - **No undo of plan**: once executed, the model is built. Undo individual steps with Ctrl+Z if the feature tree supports it; otherwise start fresh.
95
+ - **API cost**: an enclosure plan uses ~1000-2000 input tokens + ~2000-3000 output tokens. On Sonnet 4.6 that's a few cents per design; on Gemini free tier it's $0.
96
+
97
+ ## Inspired by
98
+
99
+ [Adam AI Tools for Onshape](https://www.adam.new) — their FeatureScript-generating copilot is the inspiration for this module. cycleCAD's version runs natively against the Three.js viewport and works against any of Claude / Gemini / Groq.
@@ -1421,3 +1421,20 @@ async function reviewAndExport() {
1421
1421
  ---
1422
1422
 
1423
1423
  End of API Reference
1424
+
1425
+ ## AI Copilot (v3.10.0+)
1426
+
1427
+ Multi-step CAD generation from natural language. See `docs/AI-COPILOT.md` for full docs.
1428
+
1429
+ ```js
1430
+ window.CycleCAD.AICopilot.execute('generate', {
1431
+ prompt: 'create a Raspberry Pi 4B case with port cutouts'
1432
+ });
1433
+ // Observe state
1434
+ window.CycleCAD.AICopilot.getState();
1435
+ // → { running: true, stepIndex: 3, results: 4, errors: 0 }
1436
+ // Stop mid-run
1437
+ window.CycleCAD.AICopilot.abort();
1438
+ ```
1439
+
1440
+ The copilot uses the Agent API (`window.cycleCAD.execute`) as its execution substrate, so every Agent API command above is reachable from a prompt.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cyclecad",
3
- "version": "3.9.20",
3
+ "version": "3.10.1",
4
4
  "description": "Browser-based parametric 3D CAD modeler with AI-powered tools, native Inventor file parsing, and smart assembly management. No install required.",
5
5
  "main": "index.html",
6
6
  "bin": {