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.
Files changed (69) hide show
  1. package/API-BUILD-MANIFEST.txt +339 -0
  2. package/API-SERVER.md +535 -0
  3. package/Architecture-Deck.pptx +0 -0
  4. package/CLAUDE.md +172 -11
  5. package/CLI-BUILD-SUMMARY.md +504 -0
  6. package/CLI-INDEX.md +356 -0
  7. package/CLI-README.md +466 -0
  8. package/COLLABORATION-INTEGRATION-GUIDE.md +325 -0
  9. package/CONNECTED_FABS_GUIDE.md +612 -0
  10. package/CONNECTED_FABS_README.md +310 -0
  11. package/DELIVERABLES.md +343 -0
  12. package/DFM-ANALYZER-INTEGRATION.md +368 -0
  13. package/DFM-QUICK-START.js +253 -0
  14. package/Dockerfile +69 -0
  15. package/IMPLEMENTATION.md +327 -0
  16. package/LICENSE +31 -0
  17. package/MARKETPLACE_QUICK_REFERENCE.txt +294 -0
  18. package/MCP-INDEX.md +264 -0
  19. package/QUICKSTART-API.md +388 -0
  20. package/QUICKSTART-CLI.md +211 -0
  21. package/QUICKSTART-MCP.md +196 -0
  22. package/README-MCP.md +208 -0
  23. package/TEST-TOKEN-ENGINE.md +319 -0
  24. package/TOKEN-ENGINE-SUMMARY.md +266 -0
  25. package/TOKENS-README.md +263 -0
  26. package/TOOLS-REFERENCE.md +254 -0
  27. package/app/index.html +168 -3
  28. package/app/js/TOKEN-INTEGRATION.md +391 -0
  29. package/app/js/agent-api.js +3 -3
  30. package/app/js/ai-copilot.js +1435 -0
  31. package/app/js/cam-pipeline.js +840 -0
  32. package/app/js/collaboration-ui.js +995 -0
  33. package/app/js/collaboration.js +1116 -0
  34. package/app/js/connected-fabs-example.js +404 -0
  35. package/app/js/connected-fabs.js +1449 -0
  36. package/app/js/dfm-analyzer.js +1760 -0
  37. package/app/js/marketplace.js +1994 -0
  38. package/app/js/material-library.js +2115 -0
  39. package/app/js/token-dashboard.js +563 -0
  40. package/app/js/token-engine.js +743 -0
  41. package/app/test-agent.html +1801 -0
  42. package/bin/cyclecad-cli.js +662 -0
  43. package/bin/cyclecad-mcp +2 -0
  44. package/bin/server.js +242 -0
  45. package/cycleCAD-Architecture.pptx +0 -0
  46. package/cycleCAD-Investor-Deck.pptx +0 -0
  47. package/demo-mcp.sh +60 -0
  48. package/docs/API-SERVER-SUMMARY.md +375 -0
  49. package/docs/API-SERVER.md +667 -0
  50. package/docs/CAM-EXAMPLES.md +344 -0
  51. package/docs/CAM-INTEGRATION.md +612 -0
  52. package/docs/CAM-QUICK-REFERENCE.md +199 -0
  53. package/docs/CLI-INTEGRATION.md +510 -0
  54. package/docs/CLI.md +872 -0
  55. package/docs/MARKETPLACE-API-SCHEMA.json +564 -0
  56. package/docs/MARKETPLACE-INTEGRATION.md +467 -0
  57. package/docs/MARKETPLACE-SETUP.html +439 -0
  58. package/docs/MCP-SERVER.md +403 -0
  59. package/examples/api-client-example.js +488 -0
  60. package/examples/api-client-example.py +359 -0
  61. package/examples/batch-manufacturing.txt +28 -0
  62. package/examples/batch-simple.txt +26 -0
  63. package/model-marketplace.html +1273 -0
  64. package/package.json +14 -3
  65. package/server/api-server.js +1120 -0
  66. package/server/mcp-server.js +1161 -0
  67. package/test-api-server.js +432 -0
  68. package/test-mcp.js +198 -0
  69. package/~$cycleCAD-Investor-Deck.pptx +0 -0
@@ -0,0 +1,564 @@
1
+ {
2
+ "version": "1.0.0",
3
+ "name": "cycleCAD Model Marketplace API",
4
+ "description": "Token-based 3D model publishing, discovery, and purchase system",
5
+ "baseMethod": "window.cycleCAD.marketplace",
6
+ "endpoints": {
7
+ "publish": {
8
+ "method": "publish(modelData)",
9
+ "description": "Publish a new model to the marketplace",
10
+ "params": {
11
+ "name": {
12
+ "type": "string",
13
+ "required": true,
14
+ "description": "Model name (max 100 chars)"
15
+ },
16
+ "description": {
17
+ "type": "string",
18
+ "required": true,
19
+ "description": "Detailed description (max 1000 chars)"
20
+ },
21
+ "category": {
22
+ "type": "string",
23
+ "enum": ["Mechanical", "Structural", "Enclosure", "Fastener", "Custom", "Template"],
24
+ "required": true,
25
+ "description": "Model category"
26
+ },
27
+ "tags": {
28
+ "type": "string[]",
29
+ "default": [],
30
+ "description": "Search tags (e.g., ['metal', 'precision', 'oem'])"
31
+ },
32
+ "tiers": {
33
+ "type": "tier[]",
34
+ "default": [{"id": 1, "name": "Free Preview", "price": 0}],
35
+ "description": "Access tiers offered by creator"
36
+ },
37
+ "sourceGeometry": {
38
+ "type": "THREE.BufferGeometry|null",
39
+ "optional": true,
40
+ "description": "Three.js geometry for preview generation"
41
+ },
42
+ "parametricData": {
43
+ "type": "object|null",
44
+ "optional": true,
45
+ "description": "JSON parametric data for parametric tier"
46
+ },
47
+ "metadata": {
48
+ "type": "object",
49
+ "optional": true,
50
+ "properties": {
51
+ "material": "string",
52
+ "weight": "number (kg)",
53
+ "color": "string",
54
+ "dimensions": {"x": "number", "y": "number", "z": "number"}
55
+ }
56
+ },
57
+ "derivedFromModelId": {
58
+ "type": "string|null",
59
+ "optional": true,
60
+ "description": "Parent model ID if derivative"
61
+ }
62
+ },
63
+ "response": {
64
+ "ok": "boolean",
65
+ "modelId": "string (UUID)",
66
+ "model": "object",
67
+ "error": "string (if not ok)"
68
+ },
69
+ "example": {
70
+ "request": "publish({name: 'M8 Bolt', description: 'Steel fastener', category: 'Fastener', tags: ['metric']})",
71
+ "response": "{ok: true, modelId: 'abc-123', model: {...}}"
72
+ }
73
+ },
74
+ "search": {
75
+ "method": "search(query, filters)",
76
+ "description": "Full-text search models with optional filtering",
77
+ "params": {
78
+ "query": {
79
+ "type": "string",
80
+ "required": true,
81
+ "description": "Search terms (searches name, desc, tags, creator)"
82
+ },
83
+ "filters": {
84
+ "type": "object",
85
+ "optional": true,
86
+ "properties": {
87
+ "category": {"type": "string", "description": "Filter by category"},
88
+ "priceMin": {"type": "number", "description": "Minimum token price"},
89
+ "priceMax": {"type": "number", "description": "Maximum token price"},
90
+ "minRating": {"type": "number", "min": 0, "max": 5, "description": "Minimum rating (0-5)"},
91
+ "page": {"type": "number", "default": 0, "description": "Page number (0-indexed)"},
92
+ "pageSize": {"type": "number", "default": 20, "description": "Results per page (1-100)"}
93
+ }
94
+ }
95
+ },
96
+ "response": {
97
+ "ok": "boolean",
98
+ "results": "model[]",
99
+ "total": "number",
100
+ "page": "number",
101
+ "pageSize": "number",
102
+ "hasMore": "boolean"
103
+ }
104
+ },
105
+ "browse": {
106
+ "method": "browse(category, options)",
107
+ "description": "Browse models by category with sorting",
108
+ "params": {
109
+ "category": {
110
+ "type": "string|null",
111
+ "description": "Category to filter (null = all)"
112
+ },
113
+ "options": {
114
+ "type": "object",
115
+ "optional": true,
116
+ "properties": {
117
+ "sort": {
118
+ "type": "string",
119
+ "enum": ["newest", "popular", "price-low", "price-high", "rating"],
120
+ "default": "newest"
121
+ },
122
+ "page": {"type": "number", "default": 0},
123
+ "pageSize": {"type": "number", "default": 20}
124
+ }
125
+ }
126
+ },
127
+ "response": {
128
+ "ok": "boolean",
129
+ "results": "model[]",
130
+ "category": "string|null",
131
+ "sort": "string",
132
+ "total": "number",
133
+ "hasMore": "boolean"
134
+ }
135
+ },
136
+ "getDetails": {
137
+ "method": "getDetails(modelId)",
138
+ "description": "Get full details of a model including preview and reviews",
139
+ "params": {
140
+ "modelId": {
141
+ "type": "string (UUID)",
142
+ "required": true,
143
+ "description": "Model ID to fetch"
144
+ }
145
+ },
146
+ "response": {
147
+ "ok": "boolean",
148
+ "model": "object (full model data with stats)",
149
+ "creator": "object (creator profile)",
150
+ "canEdit": "boolean (user owns model)",
151
+ "canDownload": "boolean (user purchased)",
152
+ "averageRating": "number (0-5)",
153
+ "reviewCount": "number"
154
+ }
155
+ },
156
+ "getCreatorProfile": {
157
+ "method": "getCreatorProfile(creatorId)",
158
+ "description": "Get public profile of any creator",
159
+ "params": {
160
+ "creatorId": {
161
+ "type": "string (UUID)",
162
+ "required": true
163
+ }
164
+ },
165
+ "response": {
166
+ "ok": "boolean",
167
+ "profile": {
168
+ "creatorId": "string",
169
+ "name": "string",
170
+ "modelCount": "number",
171
+ "totalDownloads": "number",
172
+ "totalViews": "number",
173
+ "averageRating": "number",
174
+ "earnings": "number (total tokens earned)",
175
+ "topModels": "model[] (top 5 by downloads)"
176
+ }
177
+ }
178
+ },
179
+ "purchase": {
180
+ "method": "purchase(modelId, tierId)",
181
+ "description": "Purchase access to a model at a specific tier",
182
+ "params": {
183
+ "modelId": {"type": "string (UUID)", "required": true},
184
+ "tierId": {
185
+ "type": "number",
186
+ "enum": [1, 2, 3, 4, 5, 6, 7],
187
+ "description": "Access tier ID (1=Free, 2=Mesh, 3=Parametric, 4=Full IP, 5=Commercial, 6=Derivative, 7=Agent)"
188
+ }
189
+ },
190
+ "response": {
191
+ "ok": "boolean",
192
+ "purchaseId": "string (UUID)",
193
+ "accessUrl": "string (download URL)",
194
+ "expiryDate": "ISO string (1 year from purchase)",
195
+ "error": "string (insufficient balance, etc.)"
196
+ }
197
+ },
198
+ "download": {
199
+ "method": "download(modelId, format)",
200
+ "description": "Download a purchased model in requested format",
201
+ "params": {
202
+ "modelId": {"type": "string (UUID)", "required": true},
203
+ "format": {
204
+ "type": "string",
205
+ "enum": ["stl", "obj", "gltf", "json", "step"],
206
+ "default": "stl",
207
+ "description": "Export format"
208
+ }
209
+ },
210
+ "response": {
211
+ "ok": "boolean",
212
+ "data": "ArrayBuffer|string (file content)",
213
+ "filename": "string",
214
+ "mimeType": "string",
215
+ "error": "string (must purchase first, etc.)"
216
+ }
217
+ },
218
+ "getPurchaseHistory": {
219
+ "method": "getPurchaseHistory()",
220
+ "description": "Get list of models purchased by current user",
221
+ "response": [
222
+ {
223
+ "id": "string (purchase ID)",
224
+ "modelId": "string",
225
+ "modelName": "string",
226
+ "creatorName": "string",
227
+ "tierId": "number",
228
+ "tierName": "string",
229
+ "price": "number (tokens paid)",
230
+ "purchaseDate": "ISO string",
231
+ "expiryDate": "ISO string",
232
+ "downloadedTimes": "number"
233
+ }
234
+ ]
235
+ },
236
+ "getCreatorStats": {
237
+ "method": "getCreatorStats(period)",
238
+ "description": "Get creator dashboard statistics for current user",
239
+ "params": {
240
+ "period": {
241
+ "type": "string",
242
+ "enum": ["all", "day", "week", "month"],
243
+ "default": "all"
244
+ }
245
+ },
246
+ "response": {
247
+ "ok": "boolean",
248
+ "stats": {
249
+ "totalEarnings": "number (tokens)",
250
+ "totalDownloads": "number",
251
+ "totalViews": "number",
252
+ "modelCount": "number",
253
+ "averageRating": "number (0-5)",
254
+ "topModel": "model (highest downloads)",
255
+ "period": "string"
256
+ }
257
+ }
258
+ },
259
+ "listMyModels": {
260
+ "method": "listMyModels()",
261
+ "description": "List all models published by current user",
262
+ "response": "model[]"
263
+ },
264
+ "updateModel": {
265
+ "method": "updateModel(modelId, updates)",
266
+ "description": "Update a model (creator only)",
267
+ "params": {
268
+ "modelId": {"type": "string (UUID)", "required": true},
269
+ "updates": {
270
+ "type": "object",
271
+ "properties": {
272
+ "name": "string",
273
+ "description": "string",
274
+ "tags": "string[]",
275
+ "tiers": "tier[]",
276
+ "metadata": "object"
277
+ }
278
+ }
279
+ },
280
+ "response": {
281
+ "ok": "boolean",
282
+ "model": "object (updated)",
283
+ "error": "string"
284
+ }
285
+ },
286
+ "deleteModel": {
287
+ "method": "deleteModel(modelId)",
288
+ "description": "Delete a model (creator only, no undo)",
289
+ "params": {
290
+ "modelId": {"type": "string (UUID)", "required": true}
291
+ },
292
+ "response": {
293
+ "ok": "boolean",
294
+ "error": "string"
295
+ }
296
+ },
297
+ "addReview": {
298
+ "method": "addReview(modelId, rating, comment)",
299
+ "description": "Leave a review on a purchased model",
300
+ "params": {
301
+ "modelId": {"type": "string (UUID)", "required": true},
302
+ "rating": {
303
+ "type": "number",
304
+ "min": 1,
305
+ "max": 5,
306
+ "required": true,
307
+ "description": "Star rating"
308
+ },
309
+ "comment": {
310
+ "type": "string",
311
+ "optional": true,
312
+ "default": "",
313
+ "description": "Review text (max 500 chars)"
314
+ }
315
+ },
316
+ "response": {
317
+ "ok": "boolean",
318
+ "review": {
319
+ "id": "string (review ID)",
320
+ "rating": "number",
321
+ "comment": "string",
322
+ "date": "ISO string",
323
+ "helpful": "number (helpful count)"
324
+ },
325
+ "error": "string (must purchase first)"
326
+ }
327
+ },
328
+ "getReviews": {
329
+ "method": "getReviews(modelId, page, pageSize)",
330
+ "description": "Get paginated reviews for a model",
331
+ "params": {
332
+ "modelId": {"type": "string (UUID)", "required": true},
333
+ "page": {"type": "number", "default": 0},
334
+ "pageSize": {"type": "number", "default": 10}
335
+ },
336
+ "response": {
337
+ "ok": "boolean",
338
+ "reviews": "review[]",
339
+ "total": "number",
340
+ "page": "number",
341
+ "pageSize": "number",
342
+ "hasMore": "boolean",
343
+ "averageRating": "number",
344
+ "reviewCount": "number"
345
+ }
346
+ },
347
+ "getEarningsBreakdown": {
348
+ "method": "getEarningsBreakdown(period)",
349
+ "description": "Get earnings broken down by date period",
350
+ "params": {
351
+ "period": {
352
+ "type": "string",
353
+ "enum": ["daily", "weekly", "monthly"],
354
+ "default": "daily"
355
+ }
356
+ },
357
+ "response": {
358
+ "ok": "boolean",
359
+ "breakdown": {
360
+ "2026-03-25": "number (tokens earned)",
361
+ "2026-03-26": "number",
362
+ "[dateKey]": "number"
363
+ },
364
+ "period": "string",
365
+ "total": "number (sum of all earnings)"
366
+ }
367
+ },
368
+ "withdrawEarnings": {
369
+ "method": "withdrawEarnings(amount, method)",
370
+ "description": "Request payout of earned tokens (Stripe/crypto placeholder)",
371
+ "params": {
372
+ "amount": {
373
+ "type": "number",
374
+ "required": true,
375
+ "description": "Tokens to withdraw"
376
+ },
377
+ "method": {
378
+ "type": "string",
379
+ "enum": ["stripe", "crypto"],
380
+ "default": "stripe"
381
+ }
382
+ },
383
+ "response": {
384
+ "ok": "boolean",
385
+ "withdrawalId": "string (UUID)",
386
+ "status": "string (pending|processing|completed)",
387
+ "message": "string (user-friendly message)",
388
+ "error": "string (insufficient earnings)"
389
+ }
390
+ },
391
+ "on": {
392
+ "method": "on(eventName, callback)",
393
+ "description": "Listen to marketplace events",
394
+ "params": {
395
+ "eventName": {
396
+ "type": "string",
397
+ "enum": [
398
+ "modelPublished",
399
+ "modelUpdated",
400
+ "modelDeleted",
401
+ "modelPurchased",
402
+ "modelDownloaded",
403
+ "reviewAdded",
404
+ "withdrawalRequested"
405
+ ]
406
+ },
407
+ "callback": {
408
+ "type": "function",
409
+ "description": "Event handler function"
410
+ }
411
+ }
412
+ },
413
+ "off": {
414
+ "method": "off(eventName, callback)",
415
+ "description": "Unsubscribe from marketplace events",
416
+ "params": {
417
+ "eventName": {"type": "string"},
418
+ "callback": {"type": "function"}
419
+ }
420
+ }
421
+ },
422
+ "dataTypes": {
423
+ "model": {
424
+ "id": "string (UUID)",
425
+ "creatorId": "string (UUID)",
426
+ "creatorName": "string",
427
+ "name": "string",
428
+ "description": "string",
429
+ "category": "string (6 categories)",
430
+ "tags": "string[]",
431
+ "tiers": "tier[]",
432
+ "previewImage": "string (data URL)",
433
+ "metadata": {
434
+ "dimensions": {"x": "number", "y": "number", "z": "number"},
435
+ "polyCount": "number",
436
+ "material": "string",
437
+ "weight": "number"
438
+ },
439
+ "stats": {
440
+ "views": "number",
441
+ "downloads": "number",
442
+ "purchases": "number",
443
+ "rating": "number (0-5 avg)",
444
+ "reviewCount": "number"
445
+ },
446
+ "reviews": "review[]",
447
+ "publishedDate": "ISO string",
448
+ "updatedDate": "ISO string"
449
+ },
450
+ "tier": {
451
+ "id": "number (1-7)",
452
+ "name": "string",
453
+ "price": "number (tokens) or null",
454
+ "description": "string"
455
+ },
456
+ "review": {
457
+ "id": "string (UUID)",
458
+ "userId": "string (UUID)",
459
+ "userName": "string",
460
+ "rating": "number (1-5)",
461
+ "comment": "string",
462
+ "date": "ISO string",
463
+ "helpful": "number"
464
+ },
465
+ "purchase": {
466
+ "id": "string (UUID)",
467
+ "userId": "string (UUID)",
468
+ "modelId": "string (UUID)",
469
+ "tierId": "number",
470
+ "tierName": "string",
471
+ "price": "number (tokens paid)",
472
+ "purchaseDate": "ISO string",
473
+ "expiryDate": "ISO string",
474
+ "downloadedTimes": "number"
475
+ }
476
+ },
477
+ "constants": {
478
+ "categories": [
479
+ "Mechanical",
480
+ "Structural",
481
+ "Enclosure",
482
+ "Fastener",
483
+ "Custom",
484
+ "Template"
485
+ ],
486
+ "tiers": {
487
+ "FREE_PREVIEW": {"id": 1, "price": 0},
488
+ "MESH_DOWNLOAD": {"id": 2, "price": 50},
489
+ "PARAMETRIC": {"id": 3, "price": 200},
490
+ "FULL_IP": {"id": 4, "price": 1000},
491
+ "COMMERCIAL_USE": {"id": 5, "price": 2000},
492
+ "DERIVATIVE": {"id": 6, "price": "15% of parent"},
493
+ "AGENT_ACCESS": {"id": 7, "price": 5}
494
+ },
495
+ "formats": ["stl", "obj", "gltf", "json", "step"]
496
+ },
497
+ "examples": {
498
+ "publishFromUI": "Click Marketplace → Publish tab → Fill form",
499
+ "searchViaAPI": "marketplace.search('bolt', { minRating: 4.5 })",
500
+ "agentPurchase": "await cycleCAD.execute({ method: 'marketplace.purchase', params: {...} })",
501
+ "eventListening": "marketplace.on('modelPurchased', (data) => { ... })",
502
+ "creatorDashboard": "marketplace.getCreatorStats('month')"
503
+ },
504
+ "limits": {
505
+ "maxNameLength": 100,
506
+ "maxDescriptionLength": 1000,
507
+ "maxCommentLength": 500,
508
+ "maxModelsPerCreator": "unlimited",
509
+ "previewImageSize": "512x512 px",
510
+ "modelStorageLimit": "localStorage 50KB per 20 models (IndexedDB in Phase 2)"
511
+ },
512
+ "roadmap": {
513
+ "phase1": {
514
+ "status": "✅ COMPLETE",
515
+ "features": [
516
+ "Model publishing & discovery",
517
+ "Token-based purchasing",
518
+ "Creator dashboard",
519
+ "Review system",
520
+ "UI panel with 6 tabs"
521
+ ]
522
+ },
523
+ "phase2": {
524
+ "status": "Q2 2026",
525
+ "features": [
526
+ "Real file uploads (S3/CloudFlare R2)",
527
+ "Stripe payment gateway",
528
+ "Advanced search (Elasticsearch)",
529
+ "Creator reputation system",
530
+ "Model versioning"
531
+ ]
532
+ },
533
+ "phase3": {
534
+ "status": "Q3 2026",
535
+ "features": [
536
+ "Model licensing (CC0, CC-BY, proprietary)",
537
+ "Collaboration (co-creators, revenue split)",
538
+ "Marketplace curation",
539
+ "AI-generated descriptions",
540
+ "Model comparison"
541
+ ]
542
+ },
543
+ "phase4": {
544
+ "status": "Q4 2026",
545
+ "features": [
546
+ "Enterprise marketplace (SSO)",
547
+ "Private team libraries",
548
+ "Analytics dashboard",
549
+ "Quality checks (automated)",
550
+ "Platform integrations (MecAgent, etc.)"
551
+ ]
552
+ }
553
+ },
554
+ "authentication": {
555
+ "method": "In-browser (localStorage)",
556
+ "phase2": "OAuth2 with GitHub/Google",
557
+ "phase3": "Enterprise SSO (SAML)"
558
+ },
559
+ "storageBackend": {
560
+ "current": "localStorage (demo, 50KB limit)",
561
+ "phase2": "IndexedDB + backend API (100MB+)",
562
+ "production": "AWS S3 + PostgreSQL ledger"
563
+ }
564
+ }