cyclecad 2.0.1 → 2.1.0

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 (33) hide show
  1. package/IMPLEMENTATION_GUIDE.md +502 -0
  2. package/INTEGRATION-GUIDE.md +377 -0
  3. package/MODULES_PHASES_6_7.md +780 -0
  4. package/app/index.html +106 -2
  5. package/app/js/brep-kernel.js +1353 -455
  6. package/app/js/help-module.js +1437 -0
  7. package/app/js/kernel.js +364 -40
  8. package/app/js/modules/animation-module.js +967 -0
  9. package/app/js/modules/assembly-module.js +47 -3
  10. package/app/js/modules/cam-module.js +1067 -0
  11. package/app/js/modules/collaboration-module.js +1102 -0
  12. package/app/js/modules/data-module.js +1656 -0
  13. package/app/js/modules/drawing-module.js +54 -8
  14. package/app/js/modules/formats-module.js +1173 -0
  15. package/app/js/modules/inspection-module.js +937 -0
  16. package/app/js/modules/mesh-module.js +968 -0
  17. package/app/js/modules/operations-module.js +40 -7
  18. package/app/js/modules/plugin-module.js +957 -0
  19. package/app/js/modules/rendering-module.js +1306 -0
  20. package/app/js/modules/scripting-module.js +955 -0
  21. package/app/js/modules/simulation-module.js +60 -3
  22. package/app/js/modules/sketch-module.js +1032 -90
  23. package/app/js/modules/step-module.js +47 -6
  24. package/app/js/modules/surface-module.js +728 -0
  25. package/app/js/modules/version-module.js +1410 -0
  26. package/app/js/modules/viewport-module.js +95 -8
  27. package/app/test-agent-v2.html +881 -1316
  28. package/docs/ARCHITECTURE.html +838 -1408
  29. package/docs/DEVELOPER-GUIDE.md +1504 -0
  30. package/docs/TUTORIAL.md +740 -0
  31. package/package.json +1 -1
  32. package/.github/scripts/cad-diff.js +0 -590
  33. package/.github/workflows/cad-diff.yml +0 -117
package/app/index.html CHANGED
@@ -1787,7 +1787,7 @@
1787
1787
  <!-- Module Loader -->
1788
1788
  <script type="module">
1789
1789
  import * as THREE from 'https://cdn.jsdelivr.net/npm/three@0.170.0/build/three.module.js';
1790
- const _v = '50';
1790
+ const _v = '51';
1791
1791
  import { initViewport, setView, addToScene, removeFromScene, getScene, getCamera, getControls, toggleGrid as vpToggleGrid, toggleWireframe as vpToggleWireframe, fitToObject } from './js/viewport.js?v=131';
1792
1792
  // fitAll defined locally to avoid import failures from cached viewport.js
1793
1793
  function fitAll(padding = 1.2) { const s = getScene(); if (s) fitToObject(s, padding); }
@@ -1810,6 +1810,110 @@
1810
1810
  import { initAgentAPI } from './js/agent-api.js?v=131';
1811
1811
  import { initTokenDashboard } from './js/token-dashboard.js?v=131';
1812
1812
 
1813
+ // ═══════════════════════════════════════════════════════
1814
+ // LEGO MICROKERNEL BOOTSTRAP
1815
+ // ═══════════════════════════════════════════════════════
1816
+ // The kernel is the tiny heart of cycleCAD, managing modules, state,
1817
+ // events, and inter-module communication. This bootstrap section:
1818
+ // 1. Imports the kernel
1819
+ // 2. Imports all LEGO module definitions
1820
+ // 3. Registers modules with the kernel
1821
+ // 4. Activates core modules immediately
1822
+ // 5. Leaves heavy modules in standby (auto-load on first use)
1823
+ // 6. Bridges kernel state to legacy global variables
1824
+ // 7. Exposes kernel for console debugging
1825
+
1826
+ let kernel = null;
1827
+ let kernelBootstrapError = null;
1828
+
1829
+ try {
1830
+ const kernelModule = await import('./js/kernel.js?v=51');
1831
+ kernel = kernelModule.default || new kernelModule.Kernel();
1832
+
1833
+ // Import all LEGO module definitions
1834
+ const ViewportMod = await import('./js/modules/viewport-module.js?v=51');
1835
+ const SketchMod = await import('./js/modules/sketch-module.js?v=51');
1836
+ const OpsMod = await import('./js/modules/operations-module.js?v=51');
1837
+ const DrawingMod = await import('./js/modules/drawing-module.js?v=51');
1838
+ const AssemblyMod = await import('./js/modules/assembly-module.js?v=51');
1839
+ const SimulationMod = await import('./js/modules/simulation-module.js?v=51');
1840
+ const StepMod = await import('./js/modules/step-module.js?v=51');
1841
+ const BRepMod = await import('./js/modules/brep-module.js?v=51');
1842
+
1843
+ // Register all modules with the kernel
1844
+ const modules = [
1845
+ ViewportMod.default || ViewportMod,
1846
+ SketchMod.default || SketchMod,
1847
+ OpsMod.default || OpsMod,
1848
+ DrawingMod.default || DrawingMod,
1849
+ AssemblyMod.default || AssemblyMod,
1850
+ SimulationMod.default || SimulationMod,
1851
+ StepMod.default || StepMod,
1852
+ BRepMod.default || BRepMod
1853
+ ];
1854
+
1855
+ modules.forEach(mod => {
1856
+ if (mod && mod.id) {
1857
+ kernel.register(mod);
1858
+ console.log(`[Kernel] Registered module: ${mod.id}`);
1859
+ }
1860
+ });
1861
+
1862
+ // Activate core modules immediately (they should load quickly)
1863
+ // Heavy modules (simulation, step-io, brep-kernel) stay in standby
1864
+ try {
1865
+ await kernel.activate('viewport');
1866
+ console.log('[Kernel] Activated: viewport');
1867
+ } catch(e) {
1868
+ console.warn('[Kernel] Failed to activate viewport:', e.message);
1869
+ }
1870
+
1871
+ try {
1872
+ await kernel.activate('sketch');
1873
+ console.log('[Kernel] Activated: sketch');
1874
+ } catch(e) {
1875
+ console.warn('[Kernel] Failed to activate sketch:', e.message);
1876
+ }
1877
+
1878
+ try {
1879
+ await kernel.activate('operations');
1880
+ console.log('[Kernel] Activated: operations');
1881
+ } catch(e) {
1882
+ console.warn('[Kernel] Failed to activate operations:', e.message);
1883
+ }
1884
+
1885
+ try {
1886
+ await kernel.activate('drawing');
1887
+ console.log('[Kernel] Activated: drawing');
1888
+ } catch(e) {
1889
+ console.warn('[Kernel] Failed to activate drawing:', e.message);
1890
+ }
1891
+
1892
+ // Bridge kernel state to legacy globals (for backward compatibility)
1893
+ if (kernel.state) {
1894
+ kernel.state.watch('scene', (scene) => {
1895
+ if (scene) window._scene = scene;
1896
+ });
1897
+ kernel.state.watch('camera', (cam) => {
1898
+ if (cam) window._camera = cam;
1899
+ });
1900
+ kernel.state.watch('renderer', (r) => {
1901
+ if (r) window._renderer = r;
1902
+ });
1903
+ }
1904
+
1905
+ // Expose kernel globally for debugging and advanced use
1906
+ window.kernel = kernel;
1907
+ console.log('[Kernel Bootstrap] Ready. Type window.kernel.status() to check module states.');
1908
+ console.log('[Kernel Bootstrap] Heavy modules (simulation, step-io, brep-kernel) will auto-load on first command.');
1909
+
1910
+ } catch(err) {
1911
+ console.error('[Kernel Bootstrap] Failed to initialize LEGO microkernel:', err);
1912
+ kernelBootstrapError = err;
1913
+ // App continues to run with legacy monolith code
1914
+ // Kernel is optional — if it fails, the app still works
1915
+ }
1916
+
1813
1917
  // ========== Application State ==========
1814
1918
  const APP = {
1815
1919
  mode: 'idle',
@@ -5332,6 +5436,6 @@
5332
5436
  </div>
5333
5437
  </div>
5334
5438
 
5335
- <span id="version-badge" style="position:fixed;bottom:42px;left:50%;transform:translateX(-50%);z-index:999;font-size:0.9rem;color:rgba(255,255,255,0.9);letter-spacing:0.1em;white-space:nowrap;padding:6px 16px;user-select:all;pointer-events:auto;font-family:monospace;font-weight:700;background:rgba(0,0,0,0.7);border:1px solid rgba(88,166,255,0.4);border-radius:6px;text-shadow:0 1px 3px rgba(0,0,0,0.5);" title="cycleCAD version">cycleCAD v1.3.1</span>
5439
+ <span id="version-badge" style="position:fixed;bottom:42px;left:50%;transform:translateX(-50%);z-index:999;font-size:0.9rem;color:rgba(255,255,255,0.9);letter-spacing:0.1em;white-space:nowrap;padding:6px 16px;user-select:all;pointer-events:auto;font-family:monospace;font-weight:700;background:rgba(0,0,0,0.7);border:1px solid rgba(88,166,255,0.4);border-radius:6px;text-shadow:0 1px 3px rgba(0,0,0,0.5);" title="cycleCAD version">cycleCAD v1.3.2</span>
5336
5440
  </body>
5337
5441
  </html>