fluidcad 0.0.33 → 0.0.35
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.md +72 -2
- package/bin/commands/init.js +55 -0
- package/bin/commands/login.js +120 -0
- package/bin/commands/mcp.js +33 -0
- package/bin/commands/pack.js +49 -0
- package/bin/commands/publish.js +136 -0
- package/bin/commands/serve.js +77 -0
- package/bin/fluidcad.js +21 -107
- package/bin/lib/api-client.js +40 -0
- package/bin/lib/browser.js +16 -0
- package/bin/lib/config.js +39 -0
- package/bin/lib/model-config.js +38 -0
- package/bin/lib/workspace.js +57 -0
- package/lib/dist/common/scene-object.d.ts +2 -1
- package/lib/dist/common/scene-object.js +3 -2
- package/lib/dist/common/shape-factory.d.ts +2 -1
- package/lib/dist/common/shape-factory.js +4 -0
- package/lib/dist/common/transformable-primitive.d.ts +6 -5
- package/lib/dist/common/transformable-primitive.js +8 -7
- package/lib/dist/common/vertex.js +0 -1
- package/lib/dist/core/2d/aline.d.ts +4 -3
- package/lib/dist/core/2d/aline.js +3 -2
- package/lib/dist/core/2d/arc.d.ts +3 -2
- package/lib/dist/core/2d/arc.js +4 -3
- package/lib/dist/core/2d/bezier.d.ts +8 -6
- package/lib/dist/core/2d/circle.d.ts +4 -3
- package/lib/dist/core/2d/circle.js +3 -2
- package/lib/dist/core/2d/ellipse.d.ts +5 -4
- package/lib/dist/core/2d/ellipse.js +5 -4
- package/lib/dist/core/2d/hline.d.ts +4 -3
- package/lib/dist/core/2d/hline.js +5 -3
- package/lib/dist/core/2d/line.js +1 -0
- package/lib/dist/core/2d/offset.d.ts +3 -2
- package/lib/dist/core/2d/offset.js +6 -5
- package/lib/dist/core/2d/polygon.d.ts +5 -4
- package/lib/dist/core/2d/polygon.js +10 -9
- package/lib/dist/core/2d/rect.d.ts +4 -3
- package/lib/dist/core/2d/rect.js +10 -9
- package/lib/dist/core/2d/slot.d.ts +14 -6
- package/lib/dist/core/2d/slot.js +19 -8
- package/lib/dist/core/2d/tarc.d.ts +20 -2
- package/lib/dist/core/2d/tarc.js +24 -0
- package/lib/dist/core/2d/vline.d.ts +4 -3
- package/lib/dist/core/2d/vline.js +5 -3
- package/lib/dist/core/chamfer.d.ts +5 -4
- package/lib/dist/core/chamfer.js +7 -6
- package/lib/dist/core/color.d.ts +3 -2
- package/lib/dist/core/color.js +2 -1
- package/lib/dist/core/cut.d.ts +4 -3
- package/lib/dist/core/cut.js +5 -4
- package/lib/dist/core/cylinder.d.ts +2 -1
- package/lib/dist/core/cylinder.js +2 -1
- package/lib/dist/core/draft.d.ts +3 -2
- package/lib/dist/core/draft.js +3 -2
- package/lib/dist/core/extrude.d.ts +4 -3
- package/lib/dist/core/extrude.js +5 -4
- package/lib/dist/core/fillet.d.ts +5 -4
- package/lib/dist/core/fillet.js +6 -5
- package/lib/dist/core/index.d.ts +1 -0
- package/lib/dist/core/index.js +1 -0
- package/lib/dist/core/interfaces.d.ts +55 -25
- package/lib/dist/core/param.d.ts +74 -0
- package/lib/dist/core/param.js +147 -0
- package/lib/dist/core/repeat.d.ts +2 -1
- package/lib/dist/core/repeat.js +72 -54
- package/lib/dist/core/revolve.d.ts +2 -1
- package/lib/dist/core/revolve.js +3 -2
- package/lib/dist/core/rib.d.ts +3 -2
- package/lib/dist/core/rib.js +6 -2
- package/lib/dist/core/rotate.d.ts +5 -4
- package/lib/dist/core/rotate.js +4 -3
- package/lib/dist/core/shell.d.ts +3 -2
- package/lib/dist/core/shell.js +3 -2
- package/lib/dist/core/sphere.d.ts +3 -2
- package/lib/dist/core/sphere.js +2 -1
- package/lib/dist/core/translate.d.ts +7 -6
- package/lib/dist/core/translate.js +6 -5
- package/lib/dist/features/2d/arc.d.ts +8 -2
- package/lib/dist/features/2d/arc.js +94 -17
- package/lib/dist/features/2d/back.js +3 -2
- package/lib/dist/features/2d/bezier.js +16 -16
- package/lib/dist/features/2d/circle.js +4 -0
- package/lib/dist/features/2d/ellipse.js +4 -0
- package/lib/dist/features/2d/hline.d.ts +3 -0
- package/lib/dist/features/2d/hline.js +9 -2
- package/lib/dist/features/2d/line.d.ts +3 -0
- package/lib/dist/features/2d/line.js +11 -3
- package/lib/dist/features/2d/sketch.d.ts +4 -0
- package/lib/dist/features/2d/sketch.js +25 -0
- package/lib/dist/features/2d/slot.d.ts +5 -0
- package/lib/dist/features/2d/slot.js +52 -7
- package/lib/dist/features/2d/tarc-constrained.d.ts +2 -0
- package/lib/dist/features/2d/tarc-constrained.js +8 -0
- package/lib/dist/features/2d/tarc-radius-to-object.d.ts +16 -0
- package/lib/dist/features/2d/tarc-radius-to-object.js +58 -0
- package/lib/dist/features/2d/tarc-to-object.d.ts +18 -0
- package/lib/dist/features/2d/tarc-to-object.js +66 -0
- package/lib/dist/features/2d/tarc-to-point-tangent.d.ts +2 -0
- package/lib/dist/features/2d/tarc-to-point-tangent.js +6 -0
- package/lib/dist/features/2d/tarc-to-point.d.ts +2 -0
- package/lib/dist/features/2d/tarc-to-point.js +6 -0
- package/lib/dist/features/2d/tarc-with-tangent.d.ts +2 -0
- package/lib/dist/features/2d/tarc-with-tangent.js +6 -0
- package/lib/dist/features/2d/tarc.d.ts +2 -0
- package/lib/dist/features/2d/tarc.js +6 -0
- package/lib/dist/features/2d/vline.d.ts +3 -0
- package/lib/dist/features/2d/vline.js +9 -2
- package/lib/dist/features/copy-circular.d.ts +4 -3
- package/lib/dist/features/copy-circular.js +16 -9
- package/lib/dist/features/copy-circular2d.js +16 -9
- package/lib/dist/features/copy-linear.d.ts +4 -3
- package/lib/dist/features/copy-linear.js +18 -12
- package/lib/dist/features/copy-linear2d.js +18 -12
- package/lib/dist/features/extrude-base.d.ts +13 -3
- package/lib/dist/features/extrude-base.js +32 -3
- package/lib/dist/features/extrude-to-face.js +1 -5
- package/lib/dist/features/extrude-two-distances.js +1 -2
- package/lib/dist/features/extrude.js +1 -2
- package/lib/dist/features/mirror-feature.d.ts +3 -2
- package/lib/dist/features/mirror-feature.js +1 -1
- package/lib/dist/features/mirror-shape2d.js +2 -2
- package/lib/dist/features/repeat-base.d.ts +13 -0
- package/lib/dist/features/repeat-base.js +21 -0
- package/lib/dist/features/repeat-circular.d.ts +8 -7
- package/lib/dist/features/repeat-circular.js +7 -3
- package/lib/dist/features/repeat-linear.d.ts +9 -7
- package/lib/dist/features/repeat-linear.js +9 -3
- package/lib/dist/features/repeat-matrix.d.ts +3 -1
- package/lib/dist/features/repeat-matrix.js +7 -2
- package/lib/dist/features/shell.d.ts +4 -1
- package/lib/dist/features/shell.js +14 -3
- package/lib/dist/helpers/clone-transform.d.ts +2 -1
- package/lib/dist/index.d.ts +12 -1
- package/lib/dist/index.js +11 -4
- package/lib/dist/io/file-import.d.ts +7 -0
- package/lib/dist/io/file-import.js +30 -10
- package/lib/dist/math/lazy-matrix.d.ts +36 -0
- package/lib/dist/math/lazy-matrix.js +134 -0
- package/lib/dist/oc/boolean-ops.d.ts +2 -2
- package/lib/dist/oc/constraints/constraint-solver-adaptor.d.ts +5 -0
- package/lib/dist/oc/constraints/constraint-solver-adaptor.js +16 -0
- package/lib/dist/oc/constraints/constraint-solver.d.ts +4 -0
- package/lib/dist/oc/constraints/curve/curve-constraint-solver.d.ts +4 -0
- package/lib/dist/oc/constraints/curve/curve-constraint-solver.js +3 -0
- package/lib/dist/oc/constraints/geometric/geometric-constraint-solver.d.ts +6 -1
- package/lib/dist/oc/constraints/geometric/geometric-constraint-solver.js +4 -0
- package/lib/dist/oc/constraints/geometric/tangent-arc-from-point-tangent.d.ts +8 -0
- package/lib/dist/oc/constraints/geometric/tangent-arc-from-point-tangent.js +111 -0
- package/lib/dist/oc/constraints/geometric/tangent-arc-radius-to-object.d.ts +8 -0
- package/lib/dist/oc/constraints/geometric/tangent-arc-radius-to-object.js +161 -0
- package/lib/dist/oc/mesh.d.ts +9 -4
- package/lib/dist/oc/mesh.js +14 -13
- package/lib/dist/oc/shell-ops.d.ts +2 -1
- package/lib/dist/oc/shell-ops.js +5 -2
- package/lib/dist/param-registry.d.ts +34 -0
- package/lib/dist/param-registry.js +60 -0
- package/lib/dist/rendering/mesh-builder.d.ts +3 -0
- package/lib/dist/rendering/mesh-builder.js +10 -5
- package/lib/dist/rendering/render-edge.d.ts +2 -1
- package/lib/dist/rendering/render-edge.js +2 -2
- package/lib/dist/rendering/render-face.d.ts +2 -1
- package/lib/dist/rendering/render-face.js +2 -2
- package/lib/dist/rendering/render-solid.d.ts +2 -1
- package/lib/dist/rendering/render-solid.js +2 -2
- package/lib/dist/rendering/render-wire.d.ts +2 -1
- package/lib/dist/rendering/render-wire.js +2 -2
- package/lib/dist/rendering/render.d.ts +3 -0
- package/lib/dist/rendering/render.js +7 -2
- package/lib/dist/scene-manager.d.ts +4 -2
- package/lib/dist/scene-manager.js +12 -4
- package/lib/dist/tests/features/2d/arc.test.js +64 -0
- package/lib/dist/tests/features/2d/back.test.js +17 -1
- package/lib/dist/tests/features/2d/tarc.test.js +157 -0
- package/lib/dist/tests/features/copy-circular.test.js +1 -1
- package/lib/dist/tests/features/copy-linear.test.js +10 -10
- package/lib/dist/tests/features/repeat-user-repro-cache.test.d.ts +1 -0
- package/lib/dist/tests/features/repeat-user-repro-cache.test.js +97 -0
- package/lib/dist/tests/features/repeat-user-repro.test.d.ts +1 -0
- package/lib/dist/tests/features/repeat-user-repro.test.js +60 -0
- package/lib/dist/tests/features/shell.test.js +36 -0
- package/lib/dist/tests/global-setup.js +2 -1
- package/lib/dist/tests/helpers/extract-blocks.d.ts +9 -0
- package/lib/dist/tests/helpers/extract-blocks.js +56 -0
- package/lib/dist/tests/llm-docs-examples.test.d.ts +1 -0
- package/lib/dist/tests/llm-docs-examples.test.js +62 -0
- package/lib/dist/tests/setup.js +2 -1
- package/lib/dist/tsconfig.tsbuildinfo +1 -1
- package/llm-docs/.coverage-allowlist.txt +9 -0
- package/llm-docs/api/arc.md +48 -0
- package/llm-docs/api/axis.md +42 -0
- package/llm-docs/api/bezier.md +41 -0
- package/llm-docs/api/booleans.md +44 -0
- package/llm-docs/api/chamfer.md +40 -0
- package/llm-docs/api/circle.md +36 -0
- package/llm-docs/api/color.md +34 -0
- package/llm-docs/api/connect.md +41 -0
- package/llm-docs/api/constraint-qualifiers.md +48 -0
- package/llm-docs/api/copy.md +63 -0
- package/llm-docs/api/cursor-lines.md +50 -0
- package/llm-docs/api/cursor-move.md +61 -0
- package/llm-docs/api/cut.md +55 -0
- package/llm-docs/api/draft.md +36 -0
- package/llm-docs/api/edge-filter.md +57 -0
- package/llm-docs/api/ellipse.md +34 -0
- package/llm-docs/api/extrude.md +74 -0
- package/llm-docs/api/face-filter.md +61 -0
- package/llm-docs/api/fillet.md +51 -0
- package/llm-docs/api/index.json +139 -0
- package/llm-docs/api/line.md +42 -0
- package/llm-docs/api/load.md +37 -0
- package/llm-docs/api/local.md +38 -0
- package/llm-docs/api/loft.md +37 -0
- package/llm-docs/api/mirror.md +44 -0
- package/llm-docs/api/offset.md +36 -0
- package/llm-docs/api/part.md +40 -0
- package/llm-docs/api/plane.md +44 -0
- package/llm-docs/api/polygon.md +37 -0
- package/llm-docs/api/primitive-solids.md +39 -0
- package/llm-docs/api/project-intersect.md +48 -0
- package/llm-docs/api/rect.md +48 -0
- package/llm-docs/api/remove.md +32 -0
- package/llm-docs/api/repeat.md +79 -0
- package/llm-docs/api/revolve.md +38 -0
- package/llm-docs/api/rib.md +40 -0
- package/llm-docs/api/rotate.md +37 -0
- package/llm-docs/api/select.md +41 -0
- package/llm-docs/api/shell.md +41 -0
- package/llm-docs/api/sketch.md +76 -0
- package/llm-docs/api/slot.md +36 -0
- package/llm-docs/api/split-trim.md +42 -0
- package/llm-docs/api/sweep.md +43 -0
- package/llm-docs/api/tarc.md +45 -0
- package/llm-docs/api/tcircle.md +38 -0
- package/llm-docs/api/tline.md +42 -0
- package/llm-docs/api/translate.md +40 -0
- package/llm-docs/api/types/aline.md +35 -0
- package/llm-docs/api/types/arc-angles.md +29 -0
- package/llm-docs/api/types/arc-points.md +48 -0
- package/llm-docs/api/types/axis-like.md +38 -0
- package/llm-docs/api/types/axis.md +21 -0
- package/llm-docs/api/types/boolean-operation.md +50 -0
- package/llm-docs/api/types/circular-repeat-options.md +31 -0
- package/llm-docs/api/types/common.md +32 -0
- package/llm-docs/api/types/cut.md +125 -0
- package/llm-docs/api/types/draft.md +21 -0
- package/llm-docs/api/types/extrudable-geometry.md +23 -0
- package/llm-docs/api/types/extrude.md +194 -0
- package/llm-docs/api/types/geometry.md +51 -0
- package/llm-docs/api/types/hline.md +35 -0
- package/llm-docs/api/types/linear-repeat-options.md +31 -0
- package/llm-docs/api/types/loft.md +154 -0
- package/llm-docs/api/types/mirror.md +35 -0
- package/llm-docs/api/types/offset.md +31 -0
- package/llm-docs/api/types/plane-like.md +35 -0
- package/llm-docs/api/types/plane-transform-options.md +29 -0
- package/llm-docs/api/types/plane.md +21 -0
- package/llm-docs/api/types/point-like.md +22 -0
- package/llm-docs/api/types/point2dlike.md +26 -0
- package/llm-docs/api/types/polygon.md +46 -0
- package/llm-docs/api/types/rect.md +128 -0
- package/llm-docs/api/types/revolve.md +102 -0
- package/llm-docs/api/types/rib.md +133 -0
- package/llm-docs/api/types/scene-object.md +33 -0
- package/llm-docs/api/types/select.md +21 -0
- package/llm-docs/api/types/shell.md +54 -0
- package/llm-docs/api/types/slot.md +43 -0
- package/llm-docs/api/types/sweep.md +189 -0
- package/llm-docs/api/types/tangent-arc-two-objects.md +46 -0
- package/llm-docs/api/types/transformable.md +93 -0
- package/llm-docs/api/types/trim.md +27 -0
- package/llm-docs/api/types/two-objects-tangent-line.md +46 -0
- package/llm-docs/api/types/vertex.md +17 -0
- package/llm-docs/api/types/vline.md +35 -0
- package/llm-docs/concepts/coordinate-system.md +45 -0
- package/llm-docs/concepts/history-and-rollback.md +40 -0
- package/llm-docs/concepts/last-selection.md +49 -0
- package/llm-docs/concepts/scene-graph.md +37 -0
- package/llm-docs/index.json +1750 -0
- package/mcp/dist/client.d.ts +65 -0
- package/mcp/dist/client.js +255 -0
- package/mcp/dist/discovery.d.ts +11 -0
- package/mcp/dist/discovery.js +78 -0
- package/mcp/dist/docs-index.d.ts +81 -0
- package/mcp/dist/docs-index.js +261 -0
- package/mcp/dist/resources.d.ts +4 -0
- package/mcp/dist/resources.js +115 -0
- package/mcp/dist/server.d.ts +12 -0
- package/mcp/dist/server.js +502 -0
- package/mcp/dist/tools/coordination.d.ts +9 -0
- package/mcp/dist/tools/coordination.js +46 -0
- package/mcp/dist/tools/docs.d.ts +66 -0
- package/mcp/dist/tools/docs.js +122 -0
- package/mcp/dist/tools/engine.d.ts +72 -0
- package/mcp/dist/tools/engine.js +190 -0
- package/mcp/dist/tools/inspection.d.ts +75 -0
- package/mcp/dist/tools/inspection.js +121 -0
- package/mcp/dist/tools/screenshot.d.ts +63 -0
- package/mcp/dist/tools/screenshot.js +263 -0
- package/mcp/dist/tools/source.d.ts +84 -0
- package/mcp/dist/tools/source.js +434 -0
- package/mcp/dist/tools/workspaces.d.ts +13 -0
- package/mcp/dist/tools/workspaces.js +33 -0
- package/mcp/dist/types.d.ts +18 -0
- package/mcp/dist/types.js +11 -0
- package/package.json +27 -7
- package/server/dist/api.d.ts +37 -0
- package/server/dist/api.js +44 -0
- package/server/dist/code-editor.d.ts +100 -0
- package/server/dist/code-editor.js +528 -2
- package/server/dist/fluidcad-server.d.ts +118 -1
- package/server/dist/fluidcad-server.js +350 -62
- package/server/dist/global-registry.d.ts +30 -0
- package/server/dist/global-registry.js +126 -0
- package/server/dist/host/blocked-imports.d.ts +8 -0
- package/server/dist/host/blocked-imports.js +30 -0
- package/server/dist/{vite-manager.d.ts → host/local-scene-host.d.ts} +3 -1
- package/server/dist/{vite-manager.js → host/local-scene-host.js} +6 -26
- package/server/dist/host/scene-host.d.ts +19 -0
- package/server/dist/host/scene-host.js +1 -0
- package/server/dist/index.js +175 -123
- package/server/dist/instance-file.d.ts +31 -0
- package/server/dist/instance-file.js +73 -0
- package/server/dist/lint-fluid-js.d.ts +15 -0
- package/server/dist/lint-fluid-js.js +271 -0
- package/server/dist/model-package/capture-params.d.ts +19 -0
- package/server/dist/model-package/capture-params.js +42 -0
- package/server/dist/model-package/pack.d.ts +23 -0
- package/server/dist/model-package/pack.js +229 -0
- package/server/dist/model-package/types.d.ts +78 -0
- package/server/dist/model-package/types.js +17 -0
- package/server/dist/routes/editor.d.ts +24 -0
- package/server/dist/routes/editor.js +44 -0
- package/server/dist/routes/export.d.ts +1 -1
- package/server/dist/routes/export.js +45 -8
- package/server/dist/routes/health.d.ts +7 -0
- package/server/dist/routes/health.js +14 -0
- package/server/dist/routes/hit-test.d.ts +3 -0
- package/server/dist/routes/hit-test.js +17 -0
- package/server/dist/routes/lint.d.ts +10 -0
- package/server/dist/routes/lint.js +28 -0
- package/server/dist/routes/pack.d.ts +10 -0
- package/server/dist/routes/pack.js +47 -0
- package/server/dist/routes/params.d.ts +3 -0
- package/server/dist/routes/params.js +75 -0
- package/server/dist/routes/render.d.ts +33 -0
- package/server/dist/routes/render.js +34 -0
- package/server/dist/routes/scene.d.ts +5 -0
- package/server/dist/routes/scene.js +48 -0
- package/server/dist/routes/screenshot.js +68 -1
- package/server/dist/routes/sketch-edits.d.ts +3 -0
- package/server/dist/routes/sketch-edits.js +542 -0
- package/server/dist/routes/timeline.d.ts +3 -0
- package/server/dist/routes/timeline.js +49 -0
- package/server/dist/server-core.d.ts +53 -0
- package/server/dist/server-core.js +147 -0
- package/server/dist/ws-protocol.d.ts +156 -3
- package/ui/dist/assets/index-CDJmUpFI.css +2 -0
- package/ui/dist/assets/index-MRqwG9Vh.js +5417 -0
- package/ui/dist/index.html +2 -2
- package/server/dist/routes/actions.d.ts +0 -3
- package/server/dist/routes/actions.js +0 -309
- package/ui/dist/assets/index-CFi9p7wR.js +0 -4946
- package/ui/dist/assets/index-DR7c2Qk9.css +0 -2
package/ui/dist/index.html
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
<meta charset="UTF-8">
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
6
|
<title>FluidCAD Viewer</title>
|
|
7
|
-
<script type="module" crossorigin src="/assets/index-
|
|
8
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
7
|
+
<script type="module" crossorigin src="/assets/index-MRqwG9Vh.js"></script>
|
|
8
|
+
<link rel="stylesheet" crossorigin href="/assets/index-CDJmUpFI.css">
|
|
9
9
|
</head>
|
|
10
10
|
<body class="m-0 p-0 overflow-hidden w-full h-full bg-base-100 text-base-content">
|
|
11
11
|
<div id="fluidcad-viewer" class="relative w-full h-full"></div>
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { Router } from 'express';
|
|
2
|
-
import type { FluidCadServer } from '../fluidcad-server.ts';
|
|
3
|
-
export declare function createActionsRouter(fluidCadServer: FluidCadServer, sendToExtension: (msg: any) => void, broadcastToUI: (msg: any) => void, workspacePath: string): Router;
|
|
@@ -1,309 +0,0 @@
|
|
|
1
|
-
import { Router } from 'express';
|
|
2
|
-
import { addBreakpoint, removeBreakpoint, toggleBreakpoint, clearBreakpoints, insertPoint, removePoint, addPick, removePick, setPickPoints, } from "../code-editor.js";
|
|
3
|
-
export function createActionsRouter(fluidCadServer, sendToExtension, broadcastToUI, workspacePath) {
|
|
4
|
-
const router = Router();
|
|
5
|
-
router.post('/hit-test', (req, res) => {
|
|
6
|
-
const { shapeId, rayOrigin, rayDir, edgeThreshold } = req.body;
|
|
7
|
-
if (typeof shapeId !== 'string' ||
|
|
8
|
-
!Array.isArray(rayOrigin) || rayOrigin.length !== 3 ||
|
|
9
|
-
!Array.isArray(rayDir) || rayDir.length !== 3 ||
|
|
10
|
-
typeof edgeThreshold !== 'number') {
|
|
11
|
-
res.status(400).json({ error: 'Invalid request body' });
|
|
12
|
-
return;
|
|
13
|
-
}
|
|
14
|
-
const result = fluidCadServer.hitTest(shapeId, rayOrigin, rayDir, edgeThreshold);
|
|
15
|
-
res.json(result);
|
|
16
|
-
});
|
|
17
|
-
router.post('/insert-point', (req, res) => {
|
|
18
|
-
const { point, sourceLocation } = req.body;
|
|
19
|
-
if (!Array.isArray(point) || point.length !== 2 ||
|
|
20
|
-
!sourceLocation || typeof sourceLocation.line !== 'number' || typeof sourceLocation.column !== 'number') {
|
|
21
|
-
res.status(400).json({ error: 'Invalid request body' });
|
|
22
|
-
return;
|
|
23
|
-
}
|
|
24
|
-
sendToExtension({
|
|
25
|
-
type: 'insert-point',
|
|
26
|
-
point: point,
|
|
27
|
-
sourceLocation,
|
|
28
|
-
});
|
|
29
|
-
res.json({ success: true });
|
|
30
|
-
});
|
|
31
|
-
router.post('/remove-point', (req, res) => {
|
|
32
|
-
const { point, sourceLocation } = req.body;
|
|
33
|
-
if (!Array.isArray(point) || point.length !== 2 ||
|
|
34
|
-
!sourceLocation || typeof sourceLocation.line !== 'number' || typeof sourceLocation.column !== 'number') {
|
|
35
|
-
res.status(400).json({ error: 'Invalid request body' });
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
sendToExtension({
|
|
39
|
-
type: 'remove-point',
|
|
40
|
-
point: point,
|
|
41
|
-
sourceLocation,
|
|
42
|
-
});
|
|
43
|
-
res.json({ success: true });
|
|
44
|
-
});
|
|
45
|
-
router.post('/rollback', async (req, res) => {
|
|
46
|
-
const { index } = req.body;
|
|
47
|
-
if (typeof index !== 'number' || index < 0) {
|
|
48
|
-
res.status(400).json({ error: 'Invalid index' });
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
const data = await fluidCadServer.rollbackFromUI(index);
|
|
52
|
-
if (!data) {
|
|
53
|
-
res.status(404).json({ error: 'No active scene' });
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
sendToExtension({
|
|
57
|
-
type: 'scene-rendered',
|
|
58
|
-
absPath: data.absPath,
|
|
59
|
-
result: data.result,
|
|
60
|
-
rollbackStop: data.rollbackStop,
|
|
61
|
-
});
|
|
62
|
-
broadcastToUI({
|
|
63
|
-
type: 'scene-rendered',
|
|
64
|
-
result: data.result,
|
|
65
|
-
absPath: data.absPath,
|
|
66
|
-
rollbackStop: data.rollbackStop,
|
|
67
|
-
});
|
|
68
|
-
res.json({ success: true });
|
|
69
|
-
});
|
|
70
|
-
router.post('/recompute', async (_req, res) => {
|
|
71
|
-
const data = await fluidCadServer.recomputeCurrentFile();
|
|
72
|
-
if (!data) {
|
|
73
|
-
res.status(404).json({ error: 'No active scene' });
|
|
74
|
-
return;
|
|
75
|
-
}
|
|
76
|
-
sendToExtension({
|
|
77
|
-
type: 'scene-rendered',
|
|
78
|
-
absPath: data.absPath,
|
|
79
|
-
result: data.result,
|
|
80
|
-
rollbackStop: data.rollbackStop,
|
|
81
|
-
});
|
|
82
|
-
broadcastToUI({
|
|
83
|
-
type: 'scene-rendered',
|
|
84
|
-
result: data.result,
|
|
85
|
-
absPath: data.absPath,
|
|
86
|
-
breakpointHit: data.breakpointHit,
|
|
87
|
-
});
|
|
88
|
-
res.json({ success: true });
|
|
89
|
-
});
|
|
90
|
-
router.post('/clear-breakpoints', (_req, res) => {
|
|
91
|
-
sendToExtension({ type: 'clear-breakpoints' });
|
|
92
|
-
res.json({ success: true });
|
|
93
|
-
});
|
|
94
|
-
router.post('/add-breakpoint', (req, res) => {
|
|
95
|
-
const { sourceLocation } = req.body;
|
|
96
|
-
if (!sourceLocation ||
|
|
97
|
-
typeof sourceLocation.filePath !== 'string' ||
|
|
98
|
-
typeof sourceLocation.line !== 'number') {
|
|
99
|
-
res.status(400).json({ error: 'Invalid request body' });
|
|
100
|
-
return;
|
|
101
|
-
}
|
|
102
|
-
sendToExtension({
|
|
103
|
-
type: 'add-breakpoint',
|
|
104
|
-
filePath: sourceLocation.filePath,
|
|
105
|
-
line: sourceLocation.line,
|
|
106
|
-
});
|
|
107
|
-
res.json({ success: true });
|
|
108
|
-
});
|
|
109
|
-
router.post('/add-pick', (req, res) => {
|
|
110
|
-
const { sourceLocation } = req.body;
|
|
111
|
-
if (!sourceLocation || typeof sourceLocation.line !== 'number' || typeof sourceLocation.column !== 'number') {
|
|
112
|
-
res.status(400).json({ error: 'Invalid request body' });
|
|
113
|
-
return;
|
|
114
|
-
}
|
|
115
|
-
sendToExtension({
|
|
116
|
-
type: 'add-pick',
|
|
117
|
-
sourceLocation,
|
|
118
|
-
});
|
|
119
|
-
res.json({ success: true });
|
|
120
|
-
});
|
|
121
|
-
router.post('/remove-pick', (req, res) => {
|
|
122
|
-
const { sourceLocation } = req.body;
|
|
123
|
-
if (!sourceLocation || typeof sourceLocation.line !== 'number' || typeof sourceLocation.column !== 'number') {
|
|
124
|
-
res.status(400).json({ error: 'Invalid request body' });
|
|
125
|
-
return;
|
|
126
|
-
}
|
|
127
|
-
sendToExtension({
|
|
128
|
-
type: 'remove-pick',
|
|
129
|
-
sourceLocation,
|
|
130
|
-
});
|
|
131
|
-
res.json({ success: true });
|
|
132
|
-
});
|
|
133
|
-
router.post('/set-pick-points', (req, res) => {
|
|
134
|
-
const { points, sourceLocation } = req.body;
|
|
135
|
-
if (!Array.isArray(points) ||
|
|
136
|
-
!sourceLocation || typeof sourceLocation.line !== 'number' || typeof sourceLocation.column !== 'number') {
|
|
137
|
-
res.status(400).json({ error: 'Invalid request body' });
|
|
138
|
-
return;
|
|
139
|
-
}
|
|
140
|
-
sendToExtension({
|
|
141
|
-
type: 'set-pick-points',
|
|
142
|
-
points: points,
|
|
143
|
-
sourceLocation,
|
|
144
|
-
});
|
|
145
|
-
res.json({ success: true });
|
|
146
|
-
});
|
|
147
|
-
router.post('/import-file', async (req, res) => {
|
|
148
|
-
const { fileName, data } = req.body;
|
|
149
|
-
if (typeof fileName !== 'string' || typeof data !== 'string') {
|
|
150
|
-
res.status(400).json({ error: 'Invalid request body' });
|
|
151
|
-
return;
|
|
152
|
-
}
|
|
153
|
-
try {
|
|
154
|
-
await fluidCadServer.importFile(workspacePath, fileName, data);
|
|
155
|
-
}
|
|
156
|
-
catch (err) {
|
|
157
|
-
res.status(500).json({ error: err.message || String(err) });
|
|
158
|
-
return;
|
|
159
|
-
}
|
|
160
|
-
const loadName = fileName.replace(/\.(step|stp)$/i, '');
|
|
161
|
-
res.json({ success: true, fileName: loadName });
|
|
162
|
-
});
|
|
163
|
-
// ---------------------------------------------------------------------------
|
|
164
|
-
// /api/code/* — extensions send the current buffer text plus operation
|
|
165
|
-
// params; the server returns the fully edited text. All source-text
|
|
166
|
-
// manipulation lives here so VSCode and Neovim share one implementation.
|
|
167
|
-
// ---------------------------------------------------------------------------
|
|
168
|
-
router.post('/code/add-breakpoint', async (req, res) => {
|
|
169
|
-
const { code, referenceRow } = req.body;
|
|
170
|
-
if (typeof code !== 'string' || typeof referenceRow !== 'number') {
|
|
171
|
-
res.status(400).json({ error: 'Invalid request body' });
|
|
172
|
-
return;
|
|
173
|
-
}
|
|
174
|
-
try {
|
|
175
|
-
const result = await addBreakpoint(code, referenceRow);
|
|
176
|
-
res.json(result);
|
|
177
|
-
}
|
|
178
|
-
catch (err) {
|
|
179
|
-
res.status(500).json({ error: err?.message || String(err) });
|
|
180
|
-
}
|
|
181
|
-
});
|
|
182
|
-
router.post('/code/remove-breakpoint', async (req, res) => {
|
|
183
|
-
const { code, line } = req.body;
|
|
184
|
-
if (typeof code !== 'string' || typeof line !== 'number') {
|
|
185
|
-
res.status(400).json({ error: 'Invalid request body' });
|
|
186
|
-
return;
|
|
187
|
-
}
|
|
188
|
-
try {
|
|
189
|
-
const result = await removeBreakpoint(code, line);
|
|
190
|
-
res.json(result);
|
|
191
|
-
}
|
|
192
|
-
catch (err) {
|
|
193
|
-
res.status(500).json({ error: err?.message || String(err) });
|
|
194
|
-
}
|
|
195
|
-
});
|
|
196
|
-
router.post('/code/toggle-breakpoint', async (req, res) => {
|
|
197
|
-
const { code, cursorRow } = req.body;
|
|
198
|
-
if (typeof code !== 'string' || typeof cursorRow !== 'number') {
|
|
199
|
-
res.status(400).json({ error: 'Invalid request body' });
|
|
200
|
-
return;
|
|
201
|
-
}
|
|
202
|
-
try {
|
|
203
|
-
const result = await toggleBreakpoint(code, cursorRow);
|
|
204
|
-
res.json(result);
|
|
205
|
-
}
|
|
206
|
-
catch (err) {
|
|
207
|
-
res.status(500).json({ error: err?.message || String(err) });
|
|
208
|
-
}
|
|
209
|
-
});
|
|
210
|
-
router.post('/code/clear-breakpoints', async (req, res) => {
|
|
211
|
-
const { code } = req.body;
|
|
212
|
-
if (typeof code !== 'string') {
|
|
213
|
-
res.status(400).json({ error: 'Invalid request body' });
|
|
214
|
-
return;
|
|
215
|
-
}
|
|
216
|
-
try {
|
|
217
|
-
const result = await clearBreakpoints(code);
|
|
218
|
-
res.json(result);
|
|
219
|
-
}
|
|
220
|
-
catch (err) {
|
|
221
|
-
res.status(500).json({ error: err?.message || String(err) });
|
|
222
|
-
}
|
|
223
|
-
});
|
|
224
|
-
router.post('/code/insert-point', async (req, res) => {
|
|
225
|
-
const { code, sourceLine, point } = req.body;
|
|
226
|
-
if (typeof code !== 'string' || typeof sourceLine !== 'number' ||
|
|
227
|
-
!Array.isArray(point) || point.length !== 2) {
|
|
228
|
-
res.status(400).json({ error: 'Invalid request body' });
|
|
229
|
-
return;
|
|
230
|
-
}
|
|
231
|
-
try {
|
|
232
|
-
const result = await insertPoint(code, sourceLine, point);
|
|
233
|
-
res.json(result);
|
|
234
|
-
}
|
|
235
|
-
catch (err) {
|
|
236
|
-
res.status(500).json({ error: err?.message || String(err) });
|
|
237
|
-
}
|
|
238
|
-
});
|
|
239
|
-
router.post('/code/remove-point', async (req, res) => {
|
|
240
|
-
const { code, sourceLine, point } = req.body;
|
|
241
|
-
if (typeof code !== 'string' || typeof sourceLine !== 'number' ||
|
|
242
|
-
!Array.isArray(point) || point.length !== 2) {
|
|
243
|
-
res.status(400).json({ error: 'Invalid request body' });
|
|
244
|
-
return;
|
|
245
|
-
}
|
|
246
|
-
try {
|
|
247
|
-
const result = await removePoint(code, sourceLine, point);
|
|
248
|
-
res.json(result);
|
|
249
|
-
}
|
|
250
|
-
catch (err) {
|
|
251
|
-
res.status(500).json({ error: err?.message || String(err) });
|
|
252
|
-
}
|
|
253
|
-
});
|
|
254
|
-
router.post('/code/add-pick', async (req, res) => {
|
|
255
|
-
const { code, sourceLine } = req.body;
|
|
256
|
-
if (typeof code !== 'string' || typeof sourceLine !== 'number') {
|
|
257
|
-
res.status(400).json({ error: 'Invalid request body' });
|
|
258
|
-
return;
|
|
259
|
-
}
|
|
260
|
-
try {
|
|
261
|
-
const result = await addPick(code, sourceLine);
|
|
262
|
-
res.json(result);
|
|
263
|
-
}
|
|
264
|
-
catch (err) {
|
|
265
|
-
res.status(500).json({ error: err?.message || String(err) });
|
|
266
|
-
}
|
|
267
|
-
});
|
|
268
|
-
router.post('/code/remove-pick', async (req, res) => {
|
|
269
|
-
const { code, sourceLine } = req.body;
|
|
270
|
-
if (typeof code !== 'string' || typeof sourceLine !== 'number') {
|
|
271
|
-
res.status(400).json({ error: 'Invalid request body' });
|
|
272
|
-
return;
|
|
273
|
-
}
|
|
274
|
-
try {
|
|
275
|
-
const result = await removePick(code, sourceLine);
|
|
276
|
-
res.json(result);
|
|
277
|
-
}
|
|
278
|
-
catch (err) {
|
|
279
|
-
res.status(500).json({ error: err?.message || String(err) });
|
|
280
|
-
}
|
|
281
|
-
});
|
|
282
|
-
router.post('/code/goto-source', (req, res) => {
|
|
283
|
-
const { filePath, line, column } = req.body;
|
|
284
|
-
if (typeof filePath !== 'string' ||
|
|
285
|
-
typeof line !== 'number' ||
|
|
286
|
-
typeof column !== 'number') {
|
|
287
|
-
res.status(400).json({ error: 'Invalid request body' });
|
|
288
|
-
return;
|
|
289
|
-
}
|
|
290
|
-
sendToExtension({ type: 'goto-source', filePath, line, column });
|
|
291
|
-
res.json({ success: true });
|
|
292
|
-
});
|
|
293
|
-
router.post('/code/set-pick-points', async (req, res) => {
|
|
294
|
-
const { code, sourceLine, points } = req.body;
|
|
295
|
-
if (typeof code !== 'string' || typeof sourceLine !== 'number' ||
|
|
296
|
-
!Array.isArray(points)) {
|
|
297
|
-
res.status(400).json({ error: 'Invalid request body' });
|
|
298
|
-
return;
|
|
299
|
-
}
|
|
300
|
-
try {
|
|
301
|
-
const result = await setPickPoints(code, sourceLine, points);
|
|
302
|
-
res.json(result);
|
|
303
|
-
}
|
|
304
|
-
catch (err) {
|
|
305
|
-
res.status(500).json({ error: err?.message || String(err) });
|
|
306
|
-
}
|
|
307
|
-
});
|
|
308
|
-
return router;
|
|
309
|
-
}
|