dsh-cad 0.13.0 → 0.13.1
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.
|
@@ -12,6 +12,7 @@ const { parentPort } = require('node:worker_threads')
|
|
|
12
12
|
const path = require('node:path')
|
|
13
13
|
const fs = require('node:fs')
|
|
14
14
|
const { createRequire } = require('node:module')
|
|
15
|
+
const { pathToFileURL } = require('node:url')
|
|
15
16
|
const { createAdapter } = require('./occt-adapter.cjs')
|
|
16
17
|
const { createOcctTsAdapter } = require('./occtts-adapter.cjs')
|
|
17
18
|
const { createOcctBridge, loadSharedOcctModule } = require('./occt-bridge.cjs')
|
|
@@ -20,10 +21,6 @@ const require3 = createRequire(__filename)
|
|
|
20
21
|
// The ES6 emscripten build reads a global __dirname when its factory runs.
|
|
21
22
|
if (typeof globalThis.__dirname === 'undefined') globalThis.__dirname = __dirname
|
|
22
23
|
|
|
23
|
-
const loaderPath = require3.resolve('opencascade.js/dist/opencascade.wasm.js')
|
|
24
|
-
const loaderModule = require3(loaderPath)
|
|
25
|
-
const wasmBinary = fs.readFileSync(path.join(path.dirname(loaderPath), 'opencascade.wasm.wasm'))
|
|
26
|
-
|
|
27
24
|
// Kernel selection: occt.ts is the PRIMARY backend (single-kernel modeling,
|
|
28
25
|
// true B-splines, shell/draft native, direct HLR); opencascade.js stays as
|
|
29
26
|
// the fallback when occt.ts cannot load. `adapter` carries whichever.
|
|
@@ -455,6 +452,15 @@ async function boot() {
|
|
|
455
452
|
kernelName = 'occt.ts'
|
|
456
453
|
} else {
|
|
457
454
|
console.warn('[dsh-cad] occt.ts unavailable — falling back to the opencascade.js backend')
|
|
455
|
+
// Load the fallback kernel lazily: a top-level require() of the
|
|
456
|
+
// emscripten loader crashes the whole worker at module scope when the
|
|
457
|
+
// resolved opencascade.js build is ESM (ERR_REQUIRE_ESM) — boot() never
|
|
458
|
+
// runs and the main thread hangs waiting for ready. Dynamic import()
|
|
459
|
+
// accepts both module formats and confines a broken fallback build to
|
|
460
|
+
// this branch (surfaced as a clean init error via boot().catch).
|
|
461
|
+
const loaderPath = require3.resolve('opencascade.js/dist/opencascade.wasm.js')
|
|
462
|
+
const loaderModule = await import(pathToFileURL(loaderPath).href)
|
|
463
|
+
const wasmBinary = fs.readFileSync(path.join(path.dirname(loaderPath), 'opencascade.wasm.wasm'))
|
|
458
464
|
const initOpenCascade = loaderModule.default ?? loaderModule
|
|
459
465
|
occt = await initOpenCascade({ wasmBinary })
|
|
460
466
|
adapter = createAdapter(occt)
|
|
@@ -78,6 +78,9 @@ let sharedModule = null
|
|
|
78
78
|
/** Load (once) and return the shared occt.ts raw module, or null when absent. */
|
|
79
79
|
async function loadSharedOcctModule() {
|
|
80
80
|
if (sharedModule !== null && sharedModule !== undefined) return sharedModule
|
|
81
|
+
// DSH_CAD_KERNEL=opencascade.js forces the fallback backend (diagnostics
|
|
82
|
+
// and regression tests — compare kernel behavior on a real model).
|
|
83
|
+
if (process.env.DSH_CAD_KERNEL === 'opencascade.js') return null
|
|
81
84
|
const distDir = resolveDistDir()
|
|
82
85
|
if (distDir === null) return null
|
|
83
86
|
try {
|
package/package.json
CHANGED
|
@@ -1,93 +1,93 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "dsh-cad",
|
|
3
|
-
"description": "CAD visualization plugin for DeepSeek Harness: cad_view / cad_info tools with an embedded 3D (STL/OBJ/STEP/IGES) and 2D (DXF/SVG) viewer card in the Web UI",
|
|
4
|
-
"version": "0.13.
|
|
5
|
-
"type": "module",
|
|
6
|
-
"license": "MIT",
|
|
7
|
-
"author": "LAU-MARS",
|
|
8
|
-
"homepage": "https://lau-mars.github.io/dsh-cad/",
|
|
9
|
-
"repository": {
|
|
10
|
-
"type": "git",
|
|
11
|
-
"url": "git+https://github.com/LAU-MARS/dsh-cad.git"
|
|
12
|
-
},
|
|
13
|
-
"bugs": {
|
|
14
|
-
"url": "https://github.com/LAU-MARS/dsh-cad/issues"
|
|
15
|
-
},
|
|
16
|
-
"keywords": [
|
|
17
|
-
"deepseek-harness",
|
|
18
|
-
"dsh",
|
|
19
|
-
"dsh-plugin",
|
|
20
|
-
"cad",
|
|
21
|
-
"3d",
|
|
22
|
-
"2d",
|
|
23
|
-
"occt",
|
|
24
|
-
"opencascade",
|
|
25
|
-
"threejs",
|
|
26
|
-
"step",
|
|
27
|
-
"iges",
|
|
28
|
-
"dxf",
|
|
29
|
-
"svg"
|
|
30
|
-
],
|
|
31
|
-
"engines": {
|
|
32
|
-
"node": ">=22",
|
|
33
|
-
"dsh": ">=0.1.0-rc.7"
|
|
34
|
-
},
|
|
35
|
-
"main": "lib/index.js",
|
|
36
|
-
"types": "lib/types/index.d.ts",
|
|
37
|
-
"exports": {
|
|
38
|
-
".": {
|
|
39
|
-
"types": "./lib/types/index.d.ts",
|
|
40
|
-
"default": "./lib/index.js"
|
|
41
|
-
},
|
|
42
|
-
"./client": {
|
|
43
|
-
"default": "./lib/client.js"
|
|
44
|
-
},
|
|
45
|
-
"./package.json": "./package.json"
|
|
46
|
-
},
|
|
47
|
-
"dsh": {
|
|
48
|
-
"bundle": {
|
|
49
|
-
"patch": "./cordis.patch.yml"
|
|
50
|
-
},
|
|
51
|
-
"client": {
|
|
52
|
-
"inject": [
|
|
53
|
-
"@deepseek-ai/dsh-client-runtime",
|
|
54
|
-
"@deepseek-ai/dsh-client-ui-conversation"
|
|
55
|
-
],
|
|
56
|
-
"platform": "web"
|
|
57
|
-
}
|
|
58
|
-
},
|
|
59
|
-
"files": [
|
|
60
|
-
"lib",
|
|
61
|
-
"README.md",
|
|
62
|
-
"cordis.patch.yml"
|
|
63
|
-
],
|
|
64
|
-
"scripts": {
|
|
65
|
-
"build": "tsc -p tsconfig.json && node esbuild.client.mjs && node -e \"const fs=require('fs'); fs.copyFileSync('src/convert/step-worker.mjs','lib/convert/step-worker.mjs'); fs.mkdirSync('lib/modeling',{recursive:true}); fs.copyFileSync('src/modeling/occt-adapter.cjs','lib/modeling/occt-adapter.cjs'); fs.copyFileSync('src/modeling/modeling-worker.cjs','lib/modeling/modeling-worker.cjs'); fs.copyFileSync('src/modeling/occt-bridge.cjs','lib/modeling/occt-bridge.cjs'); fs.copyFileSync('src/modeling/occtts-adapter.cjs','lib/modeling/occtts-adapter.cjs'); for (const part of ['bracket','flange','shaft']) fs.copyFileSync('assets/demo-'+part+'.brep','lib/demo-'+part+'.brep')\"",
|
|
66
|
-
"watch": "tsc -p tsconfig.json --watch & node esbuild.client.mjs --watch",
|
|
67
|
-
"test": "vitest run --no-file-parallelism",
|
|
68
|
-
"test:watch": "vitest"
|
|
69
|
-
},
|
|
70
|
-
"dependencies": {
|
|
71
|
-
"ansatz-wasm": "^0.2.0",
|
|
72
|
-
"dxf-parser": "^1.1.2",
|
|
73
|
-
"occt-import-js": "^0.0.23",
|
|
74
|
-
"occt.ts": "^0.7.0",
|
|
75
|
-
"opencascade.js": "^1.1.1",
|
|
76
|
-
"three": "^0.185.1"
|
|
77
|
-
},
|
|
78
|
-
"peerDependencies": {
|
|
79
|
-
"@deepseek-ai/cordis": "^4.0.1-rc.1",
|
|
80
|
-
"@deepseek-ai/dsh-tools": ">=0.0.1-rc.1",
|
|
81
|
-
"react": "^18.2.0"
|
|
82
|
-
},
|
|
83
|
-
"devDependencies": {
|
|
84
|
-
"@deepseek-ai/dsh-tools": "^0.1.7-rc.2",
|
|
85
|
-
"@types/node": "^22.10.0",
|
|
86
|
-
"@types/react": "^18.3.1",
|
|
87
|
-
"esbuild": "^0.28.2",
|
|
88
|
-
"react": "^18.2.0",
|
|
89
|
-
"react-dom": "^18.3.1",
|
|
90
|
-
"typescript": "^5.7.0",
|
|
91
|
-
"vitest": "^4.1.10"
|
|
92
|
-
}
|
|
93
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "dsh-cad",
|
|
3
|
+
"description": "CAD visualization plugin for DeepSeek Harness: cad_view / cad_info tools with an embedded 3D (STL/OBJ/STEP/IGES) and 2D (DXF/SVG) viewer card in the Web UI",
|
|
4
|
+
"version": "0.13.1",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"author": "LAU-MARS",
|
|
8
|
+
"homepage": "https://lau-mars.github.io/dsh-cad/",
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "git+https://github.com/LAU-MARS/dsh-cad.git"
|
|
12
|
+
},
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/LAU-MARS/dsh-cad/issues"
|
|
15
|
+
},
|
|
16
|
+
"keywords": [
|
|
17
|
+
"deepseek-harness",
|
|
18
|
+
"dsh",
|
|
19
|
+
"dsh-plugin",
|
|
20
|
+
"cad",
|
|
21
|
+
"3d",
|
|
22
|
+
"2d",
|
|
23
|
+
"occt",
|
|
24
|
+
"opencascade",
|
|
25
|
+
"threejs",
|
|
26
|
+
"step",
|
|
27
|
+
"iges",
|
|
28
|
+
"dxf",
|
|
29
|
+
"svg"
|
|
30
|
+
],
|
|
31
|
+
"engines": {
|
|
32
|
+
"node": ">=22",
|
|
33
|
+
"dsh": ">=0.1.0-rc.7"
|
|
34
|
+
},
|
|
35
|
+
"main": "lib/index.js",
|
|
36
|
+
"types": "lib/types/index.d.ts",
|
|
37
|
+
"exports": {
|
|
38
|
+
".": {
|
|
39
|
+
"types": "./lib/types/index.d.ts",
|
|
40
|
+
"default": "./lib/index.js"
|
|
41
|
+
},
|
|
42
|
+
"./client": {
|
|
43
|
+
"default": "./lib/client.js"
|
|
44
|
+
},
|
|
45
|
+
"./package.json": "./package.json"
|
|
46
|
+
},
|
|
47
|
+
"dsh": {
|
|
48
|
+
"bundle": {
|
|
49
|
+
"patch": "./cordis.patch.yml"
|
|
50
|
+
},
|
|
51
|
+
"client": {
|
|
52
|
+
"inject": [
|
|
53
|
+
"@deepseek-ai/dsh-client-runtime",
|
|
54
|
+
"@deepseek-ai/dsh-client-ui-conversation"
|
|
55
|
+
],
|
|
56
|
+
"platform": "web"
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
"files": [
|
|
60
|
+
"lib",
|
|
61
|
+
"README.md",
|
|
62
|
+
"cordis.patch.yml"
|
|
63
|
+
],
|
|
64
|
+
"scripts": {
|
|
65
|
+
"build": "tsc -p tsconfig.json && node esbuild.client.mjs && node -e \"const fs=require('fs'); fs.copyFileSync('src/convert/step-worker.mjs','lib/convert/step-worker.mjs'); fs.mkdirSync('lib/modeling',{recursive:true}); fs.copyFileSync('src/modeling/occt-adapter.cjs','lib/modeling/occt-adapter.cjs'); fs.copyFileSync('src/modeling/modeling-worker.cjs','lib/modeling/modeling-worker.cjs'); fs.copyFileSync('src/modeling/occt-bridge.cjs','lib/modeling/occt-bridge.cjs'); fs.copyFileSync('src/modeling/occtts-adapter.cjs','lib/modeling/occtts-adapter.cjs'); for (const part of ['bracket','flange','shaft']) fs.copyFileSync('assets/demo-'+part+'.brep','lib/demo-'+part+'.brep')\"",
|
|
66
|
+
"watch": "tsc -p tsconfig.json --watch & node esbuild.client.mjs --watch",
|
|
67
|
+
"test": "vitest run --no-file-parallelism",
|
|
68
|
+
"test:watch": "vitest"
|
|
69
|
+
},
|
|
70
|
+
"dependencies": {
|
|
71
|
+
"ansatz-wasm": "^0.2.0",
|
|
72
|
+
"dxf-parser": "^1.1.2",
|
|
73
|
+
"occt-import-js": "^0.0.23",
|
|
74
|
+
"occt.ts": "^0.7.0",
|
|
75
|
+
"opencascade.js": "^1.1.1",
|
|
76
|
+
"three": "^0.185.1"
|
|
77
|
+
},
|
|
78
|
+
"peerDependencies": {
|
|
79
|
+
"@deepseek-ai/cordis": "^4.0.1-rc.1",
|
|
80
|
+
"@deepseek-ai/dsh-tools": ">=0.0.1-rc.1",
|
|
81
|
+
"react": "^18.2.0"
|
|
82
|
+
},
|
|
83
|
+
"devDependencies": {
|
|
84
|
+
"@deepseek-ai/dsh-tools": "^0.1.7-rc.2",
|
|
85
|
+
"@types/node": "^22.10.0",
|
|
86
|
+
"@types/react": "^18.3.1",
|
|
87
|
+
"esbuild": "^0.28.2",
|
|
88
|
+
"react": "^18.2.0",
|
|
89
|
+
"react-dom": "^18.3.1",
|
|
90
|
+
"typescript": "^5.7.0",
|
|
91
|
+
"vitest": "^4.1.10"
|
|
92
|
+
}
|
|
93
|
+
}
|