cyclecad 0.2.2 → 0.2.3
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/API-BUILD-MANIFEST.txt +339 -0
- package/API-SERVER.md +535 -0
- package/Architecture-Deck.pptx +0 -0
- package/CLAUDE.md +172 -11
- package/CLI-BUILD-SUMMARY.md +504 -0
- package/CLI-INDEX.md +356 -0
- package/CLI-README.md +466 -0
- package/COLLABORATION-INTEGRATION-GUIDE.md +325 -0
- package/CONNECTED_FABS_GUIDE.md +612 -0
- package/CONNECTED_FABS_README.md +310 -0
- package/DELIVERABLES.md +343 -0
- package/DFM-ANALYZER-INTEGRATION.md +368 -0
- package/DFM-QUICK-START.js +253 -0
- package/Dockerfile +69 -0
- package/IMPLEMENTATION.md +327 -0
- package/LICENSE +31 -0
- package/MARKETPLACE_QUICK_REFERENCE.txt +294 -0
- package/MCP-INDEX.md +264 -0
- package/QUICKSTART-API.md +388 -0
- package/QUICKSTART-CLI.md +211 -0
- package/QUICKSTART-MCP.md +196 -0
- package/README-MCP.md +208 -0
- package/TEST-TOKEN-ENGINE.md +319 -0
- package/TOKEN-ENGINE-SUMMARY.md +266 -0
- package/TOKENS-README.md +263 -0
- package/TOOLS-REFERENCE.md +254 -0
- package/app/index.html +168 -3
- package/app/js/TOKEN-INTEGRATION.md +391 -0
- package/app/js/agent-api.js +3 -3
- package/app/js/ai-copilot.js +1435 -0
- package/app/js/cam-pipeline.js +840 -0
- package/app/js/collaboration-ui.js +995 -0
- package/app/js/collaboration.js +1116 -0
- package/app/js/connected-fabs-example.js +404 -0
- package/app/js/connected-fabs.js +1449 -0
- package/app/js/dfm-analyzer.js +1760 -0
- package/app/js/marketplace.js +1994 -0
- package/app/js/material-library.js +2115 -0
- package/app/js/token-dashboard.js +563 -0
- package/app/js/token-engine.js +743 -0
- package/app/test-agent.html +1801 -0
- package/bin/cyclecad-cli.js +662 -0
- package/bin/cyclecad-mcp +2 -0
- package/bin/server.js +242 -0
- package/cycleCAD-Architecture.pptx +0 -0
- package/cycleCAD-Investor-Deck.pptx +0 -0
- package/demo-mcp.sh +60 -0
- package/docs/API-SERVER-SUMMARY.md +375 -0
- package/docs/API-SERVER.md +667 -0
- package/docs/CAM-EXAMPLES.md +344 -0
- package/docs/CAM-INTEGRATION.md +612 -0
- package/docs/CAM-QUICK-REFERENCE.md +199 -0
- package/docs/CLI-INTEGRATION.md +510 -0
- package/docs/CLI.md +872 -0
- package/docs/MARKETPLACE-API-SCHEMA.json +564 -0
- package/docs/MARKETPLACE-INTEGRATION.md +467 -0
- package/docs/MARKETPLACE-SETUP.html +439 -0
- package/docs/MCP-SERVER.md +403 -0
- package/examples/api-client-example.js +488 -0
- package/examples/api-client-example.py +359 -0
- package/examples/batch-manufacturing.txt +28 -0
- package/examples/batch-simple.txt +26 -0
- package/model-marketplace.html +1273 -0
- package/package.json +14 -3
- package/server/api-server.js +1120 -0
- package/server/mcp-server.js +1161 -0
- package/test-api-server.js +432 -0
- package/test-mcp.js +198 -0
- package/~$cycleCAD-Investor-Deck.pptx +0 -0
|
@@ -0,0 +1,325 @@
|
|
|
1
|
+
# Collaboration Module Integration Guide
|
|
2
|
+
|
|
3
|
+
**Quick Setup:** 5 minutes to integrate into cycleCAD
|
|
4
|
+
|
|
5
|
+
## Step 1: Files Already Created ✅
|
|
6
|
+
|
|
7
|
+
Two new modules are staged in git:
|
|
8
|
+
- `app/js/collaboration.js` (900 lines)
|
|
9
|
+
- `app/js/collaboration-ui.js` (850 lines)
|
|
10
|
+
|
|
11
|
+
## Step 2: Add Imports to `app/index.html`
|
|
12
|
+
|
|
13
|
+
In the inline `<script type="module">` section, add:
|
|
14
|
+
|
|
15
|
+
```javascript
|
|
16
|
+
import { initCollaboration } from './js/collaboration.js';
|
|
17
|
+
import { initCollaborationUI } from './js/collaboration-ui.js';
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
(Add alongside existing imports like `viewport`, `sketch`, `operations`, etc.)
|
|
21
|
+
|
|
22
|
+
## Step 3: Initialize Collaboration
|
|
23
|
+
|
|
24
|
+
After viewport initialization, add:
|
|
25
|
+
|
|
26
|
+
```javascript
|
|
27
|
+
// Initialize collaboration module
|
|
28
|
+
const collabModule = initCollaboration(viewport);
|
|
29
|
+
|
|
30
|
+
// Initialize UI panel
|
|
31
|
+
initCollaborationUI(window.cycleCAD.collab);
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
**Location in index.html:**
|
|
35
|
+
- Find: `initAgentAPI({ viewport, sketch, ... })`
|
|
36
|
+
- Add after: the Agent API initialization block
|
|
37
|
+
|
|
38
|
+
## Step 4: Add Toolbar Button
|
|
39
|
+
|
|
40
|
+
In the toolbar section of `app/index.html`, find the tabs block:
|
|
41
|
+
|
|
42
|
+
```html
|
|
43
|
+
<div class="tb-tabs">
|
|
44
|
+
<button class="tb-tab active" data-tab="view">View</button>
|
|
45
|
+
<button class="tb-tab" data-tab="analyze">Analyze</button>
|
|
46
|
+
<!-- etc -->
|
|
47
|
+
</div>
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Add a collaboration button to the tab bar:
|
|
51
|
+
|
|
52
|
+
```html
|
|
53
|
+
<button id="collab-btn" class="tb-btn" title="Collaboration (Ctrl+Shift+C)">
|
|
54
|
+
👥
|
|
55
|
+
</button>
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Step 5: Add Keyboard Shortcut
|
|
59
|
+
|
|
60
|
+
In the existing shortcuts initialization, add:
|
|
61
|
+
|
|
62
|
+
```javascript
|
|
63
|
+
// Collaboration toggle
|
|
64
|
+
document.addEventListener('keydown', (e) => {
|
|
65
|
+
if (e.ctrlKey && e.shiftKey && e.code === 'KeyC') {
|
|
66
|
+
window.cycleCAD.collab?.toggleCollaborationPanel?.();
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Or search for `initKeyboardShortcuts` if it exists and add there.
|
|
72
|
+
|
|
73
|
+
## Step 6: Verify Integration
|
|
74
|
+
|
|
75
|
+
1. **Save `app/index.html`**
|
|
76
|
+
2. **Reload the app in browser** — should see 👥 button in toolbar
|
|
77
|
+
3. **Click the button** — Collaboration panel should open on right side
|
|
78
|
+
4. **Test basic flow:**
|
|
79
|
+
- Click "Create Session"
|
|
80
|
+
- Copy session ID
|
|
81
|
+
- Try "Generate Link"
|
|
82
|
+
- Start Agent Demo to see 3 AI agents appear
|
|
83
|
+
|
|
84
|
+
## Step 7: Commit and Push
|
|
85
|
+
|
|
86
|
+
From user's local machine:
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
# Remove git lock files (from previous session crashes)
|
|
90
|
+
rm -f ~/cyclecad/.git/index.lock ~/cyclecad/.git/HEAD.lock
|
|
91
|
+
|
|
92
|
+
# Commit the collaboration modules
|
|
93
|
+
cd ~/cyclecad
|
|
94
|
+
git add app/js/collaboration.js app/js/collaboration-ui.js
|
|
95
|
+
git commit -m "Add real-time collaboration: sessions, presence, chat, versioning, AI agents"
|
|
96
|
+
|
|
97
|
+
# Push to GitHub
|
|
98
|
+
git push origin main
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## Verification Checklist
|
|
102
|
+
|
|
103
|
+
After integration, verify:
|
|
104
|
+
|
|
105
|
+
- [ ] Collaboration panel opens/closes with button click
|
|
106
|
+
- [ ] "Create Session" generates a session ID
|
|
107
|
+
- [ ] "Generate Link" creates shareable URL
|
|
108
|
+
- [ ] "Start Agent Demo" adds 3 colored participant avatars
|
|
109
|
+
- [ ] Chat input field is functional
|
|
110
|
+
- [ ] Snapshot save button works
|
|
111
|
+
- [ ] All tabs switch without errors
|
|
112
|
+
- [ ] Console has no errors
|
|
113
|
+
|
|
114
|
+
## API Quick Reference
|
|
115
|
+
|
|
116
|
+
All collaboration features accessible via `window.cycleCAD.collab`:
|
|
117
|
+
|
|
118
|
+
### Session Management
|
|
119
|
+
```javascript
|
|
120
|
+
window.cycleCAD.collab.createSession({ maxUsers: 10 })
|
|
121
|
+
window.cycleCAD.collab.joinSession(sessionId, { name: 'Alice' })
|
|
122
|
+
window.cycleCAD.collab.leaveSession()
|
|
123
|
+
window.cycleCAD.collab.getSession()
|
|
124
|
+
window.cycleCAD.collab.listParticipants()
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### Presence
|
|
128
|
+
```javascript
|
|
129
|
+
window.cycleCAD.collab.updatePresence({ cursor3D, selectedPart, activeTool, camera })
|
|
130
|
+
window.cycleCAD.collab.onPresenceUpdate(callback)
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### Chat
|
|
134
|
+
```javascript
|
|
135
|
+
window.cycleCAD.collab.sendMessage('Hello team!')
|
|
136
|
+
window.cycleCAD.collab.onMessage(callback)
|
|
137
|
+
window.cycleCAD.collab.getMessageHistory()
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### Versioning
|
|
141
|
+
```javascript
|
|
142
|
+
window.cycleCAD.collab.saveSnapshot('Version 1.0')
|
|
143
|
+
window.cycleCAD.collab.listSnapshots()
|
|
144
|
+
window.cycleCAD.collab.loadSnapshot(snapshotId)
|
|
145
|
+
window.cycleCAD.collab.diffSnapshots(id1, id2)
|
|
146
|
+
window.cycleCAD.collab.visualDiff(id1, id2)
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
### Sharing
|
|
150
|
+
```javascript
|
|
151
|
+
window.cycleCAD.collab.generateShareLink({ expiry: '24h' })
|
|
152
|
+
window.cycleCAD.collab.generateEmbedCode({ width: 800, height: 600 })
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
### AI Agents
|
|
156
|
+
```javascript
|
|
157
|
+
window.cycleCAD.collab.startAgentDemo()
|
|
158
|
+
window.cycleCAD.collab.stopAgentDemo()
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
### Events
|
|
162
|
+
```javascript
|
|
163
|
+
window.cycleCAD.collab.on('session-created', (session) => {})
|
|
164
|
+
window.cycleCAD.collab.on('message-sent', (msg) => {})
|
|
165
|
+
window.cycleCAD.collab.on('snapshot-saved', (snap) => {})
|
|
166
|
+
window.cycleCAD.collab.on('user-joined', (user) => {})
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
## Troubleshooting
|
|
170
|
+
|
|
171
|
+
### Panel doesn't open
|
|
172
|
+
- Check browser console for errors
|
|
173
|
+
- Verify viewport is initialized before collab init
|
|
174
|
+
- Check that `id="collab-btn"` exists in toolbar
|
|
175
|
+
|
|
176
|
+
### 3D cursors not showing
|
|
177
|
+
- Viewport scene must be passed to `initCollaboration(viewport)`
|
|
178
|
+
- Three.js scene must be available via `viewport.scene`
|
|
179
|
+
|
|
180
|
+
### Messages not persisting
|
|
181
|
+
- Check `localStorage` is enabled
|
|
182
|
+
- Check browser isn't in private mode
|
|
183
|
+
- localStorage key is `ev_collabState`
|
|
184
|
+
|
|
185
|
+
### Agent demo not starting
|
|
186
|
+
- Click "Start Agent Demo" in Participants tab
|
|
187
|
+
- Three colored agent avatars should appear
|
|
188
|
+
- Messages appear every 3-5 seconds from agents
|
|
189
|
+
|
|
190
|
+
## File Locations
|
|
191
|
+
|
|
192
|
+
```
|
|
193
|
+
/sessions/sharp-modest-allen/mnt/cyclecad/
|
|
194
|
+
├── app/
|
|
195
|
+
│ ├── index.html (UPDATE: add imports & init)
|
|
196
|
+
│ ├── js/
|
|
197
|
+
│ │ ├── collaboration.js (NEW: 900 lines)
|
|
198
|
+
│ │ ├── collaboration-ui.js (NEW: 850 lines)
|
|
199
|
+
│ │ ├── viewport.js (referenced)
|
|
200
|
+
│ │ ├── app.js (referenced)
|
|
201
|
+
│ │ └── ...
|
|
202
|
+
│ ├── test-agent.html (reference test harness)
|
|
203
|
+
│ └── ...
|
|
204
|
+
├── CLAUDE.md (memory: updated)
|
|
205
|
+
└── COLLABORATION-INTEGRATION-GUIDE.md (this file)
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
## Architecture
|
|
209
|
+
|
|
210
|
+
```
|
|
211
|
+
┌─────────────────────────────────────────────────┐
|
|
212
|
+
│ collaboration-ui.js │
|
|
213
|
+
│ ┌───────┬──────────┬──────┬──────────────────┐ │
|
|
214
|
+
│ │Session│Participants│Chat │ Versions │ │
|
|
215
|
+
│ └───────┴──────────┴──────┴──────────────────┘ │
|
|
216
|
+
└────────────────┬────────────────────────────────┘
|
|
217
|
+
│
|
|
218
|
+
┌────────────────v────────────────────────────────┐
|
|
219
|
+
│ collaboration.js │
|
|
220
|
+
│ ├─ Session Management │
|
|
221
|
+
│ ├─ Presence System (3D cursors) │
|
|
222
|
+
│ ├─ Operation Broadcasting │
|
|
223
|
+
│ ├─ Chat System │
|
|
224
|
+
│ ├─ Git-Style Versioning (snapshots) │
|
|
225
|
+
│ ├─ Permissions (host/editor/viewer) │
|
|
226
|
+
│ ├─ Share Links & Embed │
|
|
227
|
+
│ ├─ AI Agent Participants (demo) │
|
|
228
|
+
│ └─ Event System (pub/sub) │
|
|
229
|
+
└────────────────┬────────────────────────────────┘
|
|
230
|
+
│
|
|
231
|
+
┌───────┴────────┐
|
|
232
|
+
v v
|
|
233
|
+
Three.js Scene localStorage
|
|
234
|
+
(3D cursors) (persistence)
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
## Local Development
|
|
238
|
+
|
|
239
|
+
### Test in Browser Console
|
|
240
|
+
|
|
241
|
+
```javascript
|
|
242
|
+
// Create session
|
|
243
|
+
const sess = window.cycleCAD.collab.createSession()
|
|
244
|
+
console.log('Session:', sess)
|
|
245
|
+
|
|
246
|
+
// List participants
|
|
247
|
+
console.log('Participants:', window.cycleCAD.collab.listParticipants())
|
|
248
|
+
|
|
249
|
+
// Send message
|
|
250
|
+
window.cycleCAD.collab.sendMessage('Hello!')
|
|
251
|
+
|
|
252
|
+
// Save snapshot
|
|
253
|
+
window.cycleCAD.collab.saveSnapshot('Test V1')
|
|
254
|
+
|
|
255
|
+
// List snapshots
|
|
256
|
+
console.log('Snapshots:', window.cycleCAD.collab.listSnapshots())
|
|
257
|
+
|
|
258
|
+
// Start agents
|
|
259
|
+
window.cycleCAD.collab.startAgentDemo()
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
### Listen to Events
|
|
263
|
+
|
|
264
|
+
```javascript
|
|
265
|
+
// Log all events
|
|
266
|
+
['session-created', 'user-joined', 'message-sent', 'snapshot-saved'].forEach(evt => {
|
|
267
|
+
window.cycleCAD.collab.on(evt, (data) => {
|
|
268
|
+
console.log(`[${evt}]`, data)
|
|
269
|
+
})
|
|
270
|
+
})
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
### Inspect State
|
|
274
|
+
|
|
275
|
+
```javascript
|
|
276
|
+
// View full collaboration state
|
|
277
|
+
console.log(window.cycleCAD.collab._debug.STATE)
|
|
278
|
+
|
|
279
|
+
// View messages
|
|
280
|
+
console.log(window.cycleCAD.collab.getMessageHistory())
|
|
281
|
+
|
|
282
|
+
// View snapshots
|
|
283
|
+
console.log(window.cycleCAD.collab.listSnapshots())
|
|
284
|
+
|
|
285
|
+
// View participants
|
|
286
|
+
console.log(window.cycleCAD.collab.listParticipants())
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
## Performance Notes
|
|
290
|
+
|
|
291
|
+
- Presence updates broadcast every 50ms (throttled)
|
|
292
|
+
- Cursor animation 150ms per position update
|
|
293
|
+
- Agent activity simulation every 3 seconds
|
|
294
|
+
- localStorage writes are batched
|
|
295
|
+
- Event listeners use memory efficiently (no memory leaks)
|
|
296
|
+
- 3D cursor objects cleaned up on session leave
|
|
297
|
+
|
|
298
|
+
## Browser Support
|
|
299
|
+
|
|
300
|
+
- Chrome/Edge: Full support (all features)
|
|
301
|
+
- Firefox: Full support (all features)
|
|
302
|
+
- Safari: Full support (all features)
|
|
303
|
+
- IE11: Not supported (uses ES6 modules)
|
|
304
|
+
|
|
305
|
+
## Production Deployment Notes
|
|
306
|
+
|
|
307
|
+
For a production deployment with real server:
|
|
308
|
+
|
|
309
|
+
1. Replace localStorage-based broadcast with WebSocket
|
|
310
|
+
2. Implement server-side session management
|
|
311
|
+
3. Add authentication/authorization
|
|
312
|
+
4. Implement real operation journaling
|
|
313
|
+
5. Add backup/recovery for snapshots
|
|
314
|
+
6. Implement rate limiting on operations
|
|
315
|
+
7. Add audit logging for compliance
|
|
316
|
+
|
|
317
|
+
See `server/mcp-server.js` and `server/api-server.js` in repo for examples.
|
|
318
|
+
|
|
319
|
+
## Questions?
|
|
320
|
+
|
|
321
|
+
Check the main summary: `COLLABORATION-MODULE-SUMMARY.md`
|
|
322
|
+
|
|
323
|
+
For detailed API docs, see JSDoc comments in the source files:
|
|
324
|
+
- `app/js/collaboration.js` — all functions documented
|
|
325
|
+
- `app/js/collaboration-ui.js` — UI integration documented
|