fluidcad 0.0.34 → 0.0.36
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 +69 -0
- package/bin/commands/login.js +148 -0
- package/bin/commands/mcp.js +3 -2
- package/bin/commands/pack.js +49 -0
- package/bin/commands/publish.js +231 -0
- package/bin/fluidcad.js +6 -0
- package/bin/lib/api-client.js +48 -0
- package/bin/lib/browser.js +16 -0
- package/bin/lib/config.js +39 -0
- package/bin/lib/model-config.js +61 -0
- package/bin/lib/prompt.js +97 -0
- package/bin/lib/workspace.js +57 -0
- 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/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 +25 -24
- 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 +10 -8
- 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.js +5 -5
- 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.js +5 -1
- 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-to-point-tangent.js +3 -0
- package/lib/dist/features/2d/tarc-to-point.js +3 -0
- package/lib/dist/features/2d/tarc-with-tangent.js +3 -0
- package/lib/dist/features/2d/tarc.js +3 -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 +4 -3
- package/lib/dist/features/extrude-base.js +10 -3
- 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 +6 -5
- package/lib/dist/features/repeat-circular.js +3 -6
- package/lib/dist/features/repeat-linear.d.ts +7 -7
- package/lib/dist/features/repeat-linear.js +3 -6
- package/lib/dist/index.d.ts +5 -0
- package/lib/dist/index.js +8 -1
- 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 +5 -0
- package/lib/dist/math/lazy-matrix.js +78 -10
- package/lib/dist/oc/boolean-ops.d.ts +2 -2
- package/lib/dist/param-registry.d.ts +34 -0
- package/lib/dist/param-registry.js +60 -0
- package/lib/dist/rendering/mesh-builder.js +2 -1
- 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/tsconfig.tsbuildinfo +1 -1
- package/llm-docs/api/bezier.md +10 -11
- package/llm-docs/api/index.json +1 -1
- package/llm-docs/api/types/arc-points.md +2 -2
- package/llm-docs/api/types/cut.md +10 -10
- package/llm-docs/api/types/extrude.md +10 -10
- package/llm-docs/api/types/loft.md +6 -6
- package/llm-docs/api/types/revolve.md +6 -6
- package/llm-docs/api/types/rib.md +2 -2
- package/llm-docs/api/types/slot.md +2 -2
- package/llm-docs/api/types/sweep.md +10 -10
- package/llm-docs/api/types/transformable.md +14 -14
- package/llm-docs/index.json +12 -12
- package/mcp/dist/client.d.ts +1 -0
- package/mcp/dist/client.js +8 -1
- package/mcp/dist/server.js +14 -1
- package/mcp/dist/tools/engine.d.ts +16 -0
- package/mcp/dist/tools/engine.js +45 -0
- package/package.json +9 -3
- package/server/dist/api.d.ts +37 -0
- package/server/dist/api.js +44 -0
- package/server/dist/code-editor.d.ts +64 -0
- package/server/dist/code-editor.js +520 -2
- package/server/dist/fluidcad-server.d.ts +87 -1
- package/server/dist/fluidcad-server.js +254 -88
- 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 +24 -117
- 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 +230 -0
- package/server/dist/model-package/types.d.ts +79 -0
- package/server/dist/model-package/types.js +17 -0
- package/server/dist/routes/hit-test.d.ts +3 -0
- package/server/dist/routes/hit-test.js +17 -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/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 +101 -2
- 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-BdqrMDRu.js +0 -4946
- package/ui/dist/assets/index-DR7c2Qk9.css +0 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fluidcad",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.36",
|
|
4
4
|
"description": "Parametric CAD modeling library using javascript",
|
|
5
5
|
"author": "Marwan Aouida <contact@marwan.dev>",
|
|
6
6
|
"homepage": "https://fluidcad.io",
|
|
@@ -39,6 +39,7 @@
|
|
|
39
39
|
"./filters": "./lib/dist/filters/index.js",
|
|
40
40
|
"./constraints": "./lib/dist/features/2d/constraints/geometry-qualifier.js",
|
|
41
41
|
"./server": "./server/dist/index.js",
|
|
42
|
+
"./server/api": "./server/dist/api.js",
|
|
42
43
|
"./math": "./lib/dist/math/index.js"
|
|
43
44
|
},
|
|
44
45
|
"scripts": {
|
|
@@ -58,15 +59,20 @@
|
|
|
58
59
|
"typecheck": "tsc -b",
|
|
59
60
|
"test": "vitest",
|
|
60
61
|
"test:features": "vitest run lib/tests/features/",
|
|
61
|
-
"
|
|
62
|
+
"bump": "npx bumpp patch package.json extension/vscode/package.json --no-tag --no-push",
|
|
63
|
+
"release": "git tag -a \"v$npm_package_version\" -m \"chore: release v$npm_package_version\" && git push --follow-tags"
|
|
62
64
|
},
|
|
63
65
|
"dependencies": {
|
|
64
66
|
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
65
67
|
"chokidar": "^5.0.0",
|
|
66
68
|
"color-name": "^2.1.0",
|
|
67
69
|
"commander": "^14.0.3",
|
|
70
|
+
"esbuild": "^0.27.7",
|
|
68
71
|
"express": "^5.2.1",
|
|
69
|
-
"
|
|
72
|
+
"ignore": "^5.3.2",
|
|
73
|
+
"jszip": "^3.10.1",
|
|
74
|
+
"iconoir": "^7.11.0",
|
|
75
|
+
"occjs-wrapper": "npm:occjs-fluidcad@9.0.0",
|
|
70
76
|
"open": "^11.0.0",
|
|
71
77
|
"stacktrace-parser": "^0.1.11",
|
|
72
78
|
"tree-sitter-wasms": "^0.1.13",
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Programmatic API surface, published as `fluidcad/server/api`.
|
|
3
|
+
*
|
|
4
|
+
* This is the ONLY entry point downstream consumers (the private hub repo,
|
|
5
|
+
* future tooling) are meant to import from. It re-exports the engine wrapper,
|
|
6
|
+
* the SceneHost extension seam, the HTTP/WS plumbing, the read-only route
|
|
7
|
+
* factories, the wire protocol types, and the model-package packer + types.
|
|
8
|
+
*
|
|
9
|
+
* Note: `fluidcad/server` (no `/api`) still resolves to the desktop server
|
|
10
|
+
* BINARY (`./index.ts`), which boots Express + a WebSocket server at import
|
|
11
|
+
* time — the editor extensions `fork()` that. THIS module, by contrast, has
|
|
12
|
+
* NO side effects; import it freely from a library context.
|
|
13
|
+
*
|
|
14
|
+
* Anything a consumer needs that isn't exported here is a deliberate decision:
|
|
15
|
+
* either add it to this surface on purpose, or reimplement it downstream. Keep
|
|
16
|
+
* hub-specific concerns OUT of this file and out of the public repo.
|
|
17
|
+
*/
|
|
18
|
+
export { FluidCadServer } from './fluidcad-server.ts';
|
|
19
|
+
export type { SceneRenderedData, SceneSummary, SceneSummaryObject, ShapeList, ShapeListEntry, } from './fluidcad-server.ts';
|
|
20
|
+
export type { SceneHost } from './host/scene-host.ts';
|
|
21
|
+
export { LocalSceneHost } from './host/local-scene-host.ts';
|
|
22
|
+
export { BLOCKED_NODE_MODULES, getBlockedNodeModule } from './host/blocked-imports.ts';
|
|
23
|
+
export { createServerCore } from './server-core.ts';
|
|
24
|
+
export type { ServerCore, UIClient } from './server-core.ts';
|
|
25
|
+
export { createHealthRouter } from './routes/health.ts';
|
|
26
|
+
export type { HealthInfo } from './routes/health.ts';
|
|
27
|
+
export { createSceneRouter } from './routes/scene.ts';
|
|
28
|
+
export type { CameraStateGetter } from './routes/scene.ts';
|
|
29
|
+
export { createHitTestRouter } from './routes/hit-test.ts';
|
|
30
|
+
export { createScreenshotRouter } from './routes/screenshot.ts';
|
|
31
|
+
export { createPreferencesRouter } from './routes/preferences.ts';
|
|
32
|
+
export type * from './ws-protocol.ts';
|
|
33
|
+
export { packModel } from './model-package/pack.ts';
|
|
34
|
+
export type { PackInputs, PackResult } from './model-package/pack.ts';
|
|
35
|
+
export { captureParamDefinitions } from './model-package/capture-params.ts';
|
|
36
|
+
export type { ModelPackageManifest, ModelPackageCamera, ParamValue, } from './model-package/types.ts';
|
|
37
|
+
export { MANIFEST_FILENAME, BUNDLE_FILENAME, ASSETS_PREFIX, FILES_PREFIX, } from './model-package/types.ts';
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Programmatic API surface, published as `fluidcad/server/api`.
|
|
3
|
+
*
|
|
4
|
+
* This is the ONLY entry point downstream consumers (the private hub repo,
|
|
5
|
+
* future tooling) are meant to import from. It re-exports the engine wrapper,
|
|
6
|
+
* the SceneHost extension seam, the HTTP/WS plumbing, the read-only route
|
|
7
|
+
* factories, the wire protocol types, and the model-package packer + types.
|
|
8
|
+
*
|
|
9
|
+
* Note: `fluidcad/server` (no `/api`) still resolves to the desktop server
|
|
10
|
+
* BINARY (`./index.ts`), which boots Express + a WebSocket server at import
|
|
11
|
+
* time — the editor extensions `fork()` that. THIS module, by contrast, has
|
|
12
|
+
* NO side effects; import it freely from a library context.
|
|
13
|
+
*
|
|
14
|
+
* Anything a consumer needs that isn't exported here is a deliberate decision:
|
|
15
|
+
* either add it to this surface on purpose, or reimplement it downstream. Keep
|
|
16
|
+
* hub-specific concerns OUT of this file and out of the public repo.
|
|
17
|
+
*/
|
|
18
|
+
// --- Engine -----------------------------------------------------------------
|
|
19
|
+
export { FluidCadServer } from "./fluidcad-server.js";
|
|
20
|
+
export { LocalSceneHost } from "./host/local-scene-host.js";
|
|
21
|
+
export { BLOCKED_NODE_MODULES, getBlockedNodeModule } from "./host/blocked-imports.js";
|
|
22
|
+
// --- Server plumbing --------------------------------------------------------
|
|
23
|
+
export { createServerCore } from "./server-core.js";
|
|
24
|
+
// --- Read-only route factories ---------------------------------------------
|
|
25
|
+
// The subset a viewer-style server may safely mount. Mutating routers
|
|
26
|
+
// (params, timeline, sketch-edits, editor, render, lint, export, pack) are
|
|
27
|
+
// intentionally NOT exported — a read-only host should not be able to reach
|
|
28
|
+
// for them by accident.
|
|
29
|
+
export { createHealthRouter } from "./routes/health.js";
|
|
30
|
+
export { createSceneRouter } from "./routes/scene.js";
|
|
31
|
+
export { createHitTestRouter } from "./routes/hit-test.js";
|
|
32
|
+
export { createScreenshotRouter } from "./routes/screenshot.js";
|
|
33
|
+
export { createPreferencesRouter } from "./routes/preferences.js";
|
|
34
|
+
// --- Model package: packer + types -----------------------------------------
|
|
35
|
+
// `packModel` is already public via the `fluidcad pack` CLI; exposing it here
|
|
36
|
+
// lets a hub backend pack uploads programmatically instead of shelling out.
|
|
37
|
+
// NOTE: there is no `unpackModel` here on purpose — unpacking is a hub concern
|
|
38
|
+
// and lives in the private repo.
|
|
39
|
+
export { packModel } from "./model-package/pack.js";
|
|
40
|
+
// Renders a model once to capture its full param schema for the manifest
|
|
41
|
+
// (`fluidcad publish`); boots OC wasm, so it lives behind this side-effect-free
|
|
42
|
+
// surface rather than being called at import time.
|
|
43
|
+
export { captureParamDefinitions } from "./model-package/capture-params.js";
|
|
44
|
+
export { MANIFEST_FILENAME, BUNDLE_FILENAME, ASSETS_PREFIX, FILES_PREFIX, } from "./model-package/types.js";
|
|
@@ -54,4 +54,68 @@ export declare function addPick(code: string, sourceLine: number): Promise<CodeE
|
|
|
54
54
|
export declare function removePick(code: string, sourceLine: number): Promise<CodeEditResult>;
|
|
55
55
|
export declare function removePoint(code: string, sourceLine: number, point: [number, number]): Promise<CodeEditResult>;
|
|
56
56
|
export declare function setPickPoints(code: string, sourceLine: number, points: [number, number][]): Promise<CodeEditResult>;
|
|
57
|
+
/**
|
|
58
|
+
* Insert a new geometry call expression at the end of a sketch's callback body.
|
|
59
|
+
*
|
|
60
|
+
* @param code - Full source code
|
|
61
|
+
* @param sketchSourceLine - 1-indexed line where the sketch() call starts
|
|
62
|
+
* @param statement - The call to insert, e.g. "line([5, 10], [20, 30])"
|
|
63
|
+
*/
|
|
64
|
+
export declare function insertGeometryCall(code: string, sketchSourceLine: number, statement: string): Promise<CodeEditResult>;
|
|
65
|
+
/**
|
|
66
|
+
* Update a point argument of a geometry call.
|
|
67
|
+
*
|
|
68
|
+
* @param code - Full source code
|
|
69
|
+
* @param sourceLine - 1-indexed line of the geometry call
|
|
70
|
+
* @param newPosition - New [x, y] position
|
|
71
|
+
* @param pointIndex - Which point argument to update (0 = first, -1 = last)
|
|
72
|
+
*/
|
|
73
|
+
export declare function updateGeometryPosition(code: string, sourceLine: number, newPosition: [number, number], pointIndex?: number): Promise<CodeEditResult>;
|
|
74
|
+
/**
|
|
75
|
+
* Update both point arguments of a `line(start, end)` call atomically.
|
|
76
|
+
* Used by body-drag of unconstrained two-point lines, where the whole line
|
|
77
|
+
* is translated and both endpoints change in a single edit.
|
|
78
|
+
*/
|
|
79
|
+
export declare function setLinePosition(code: string, sourceLine: number, newStart: [number, number], newEnd: [number, number]): Promise<CodeEditResult>;
|
|
80
|
+
/**
|
|
81
|
+
* Update multiple point arguments of a geometry call chain atomically.
|
|
82
|
+
* Point indices refer to the collected chain points (innermost call first).
|
|
83
|
+
*/
|
|
84
|
+
export declare function setChainPositions(code: string, sourceLine: number, updates: {
|
|
85
|
+
pointIndex: number;
|
|
86
|
+
position: [number, number];
|
|
87
|
+
}[]): Promise<CodeEditResult>;
|
|
88
|
+
/**
|
|
89
|
+
* Update the last non-array argument of a geometry call (e.g. distance or diameter).
|
|
90
|
+
* Replaces whatever expression is there (literal, variable, binary expression)
|
|
91
|
+
* with the new numeric literal.
|
|
92
|
+
*/
|
|
93
|
+
export declare function updateDimension(code: string, sourceLine: number, newValue: number): Promise<CodeEditResult>;
|
|
94
|
+
export declare function getDimensionExpression(code: string, sourceLine: number): Promise<{
|
|
95
|
+
expression: string;
|
|
96
|
+
} | null>;
|
|
97
|
+
export declare function updateDimensionExpression(code: string, sourceLine: number, expression: string, dimensionOffset?: number): Promise<CodeEditResult>;
|
|
98
|
+
/**
|
|
99
|
+
* Insert `const name = initializer;` at the top of the sketch arrow-function
|
|
100
|
+
* body. Returns the new code and how many lines were added (for callers that
|
|
101
|
+
* need to re-anchor subsequent sourceLine-based edits).
|
|
102
|
+
*/
|
|
103
|
+
export declare function declareSketchVariable(code: string, sketchSourceLine: number, name: string, initializer: string): Promise<{
|
|
104
|
+
newCode: string;
|
|
105
|
+
linesAdded: number;
|
|
106
|
+
} | null>;
|
|
107
|
+
export declare function insertGeometryCallWithVariable(code: string, sketchSourceLine: number, statement: string, newVariable: {
|
|
108
|
+
name: string;
|
|
109
|
+
initializer: string;
|
|
110
|
+
} | null): Promise<CodeEditResult>;
|
|
111
|
+
export declare function updateDimensionExpressionWithVariable(code: string, sourceLine: number, expression: string, sketchSourceLine: number, newVariable: {
|
|
112
|
+
name: string;
|
|
113
|
+
initializer: string;
|
|
114
|
+
} | null, dimensionOffset?: number): Promise<CodeEditResult>;
|
|
115
|
+
export type VariableInfo = {
|
|
116
|
+
name: string;
|
|
117
|
+
initializer?: string;
|
|
118
|
+
};
|
|
119
|
+
export declare function extractVariablesInScope(code: string, sketchSourceLine: number): Promise<VariableInfo[]>;
|
|
120
|
+
export declare function setRectDimensions(code: string, sourceLine: number, startPoint: [number, number] | null, width: number, height: number): Promise<CodeEditResult>;
|
|
57
121
|
export {};
|