commit
66e748bf01
348
package-lock.json
generated
348
package-lock.json
generated
@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "openmcp",
|
||||
"version": "0.1.5",
|
||||
"version": "0.1.6",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "openmcp",
|
||||
"version": "0.1.5",
|
||||
"version": "0.1.6",
|
||||
"workspaces": [
|
||||
"service",
|
||||
"renderer"
|
||||
@ -20,11 +20,16 @@
|
||||
"openai": "^5.0.1",
|
||||
"pako": "^2.1.0",
|
||||
"tesseract.js": "^6.0.1",
|
||||
"tslib": "^2.8.1",
|
||||
"uuid": "^11.1.0",
|
||||
"ws": "^8.18.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@rollup/plugin-commonjs": "^28.0.3",
|
||||
"@rollup/plugin-inject": "^5.0.5",
|
||||
"@rollup/plugin-json": "^6.1.0",
|
||||
"@rollup/plugin-node-resolve": "^16.0.1",
|
||||
"@rollup/plugin-typescript": "^12.1.2",
|
||||
"@types/node": "^22.15.29",
|
||||
"@types/pako": "^2.0.3",
|
||||
"@types/showdown": "^2.0.0",
|
||||
@ -32,6 +37,7 @@
|
||||
"copy-webpack-plugin": "^13.0.0",
|
||||
"fork-ts-checker-webpack-plugin": "^9.1.0",
|
||||
"null-loader": "^4.0.1",
|
||||
"rollup": "^4.43.0",
|
||||
"rollup-plugin-visualizer": "^6.0.1",
|
||||
"ts-loader": "^9.5.1",
|
||||
"turbo": "^2.5.3",
|
||||
@ -1360,6 +1366,33 @@
|
||||
"url": "https://opencollective.com/popperjs"
|
||||
}
|
||||
},
|
||||
"node_modules/@rollup/plugin-commonjs": {
|
||||
"version": "28.0.3",
|
||||
"resolved": "https://registry.npmmirror.com/@rollup/plugin-commonjs/-/plugin-commonjs-28.0.3.tgz",
|
||||
"integrity": "sha512-pyltgilam1QPdn+Zd9gaCfOLcnjMEJ9gV+bTw6/r73INdvzf1ah9zLIJBm+kW7R6IUFIQ1YO+VqZtYxZNWFPEQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@rollup/pluginutils": "^5.0.1",
|
||||
"commondir": "^1.0.1",
|
||||
"estree-walker": "^2.0.2",
|
||||
"fdir": "^6.2.0",
|
||||
"is-reference": "1.2.1",
|
||||
"magic-string": "^0.30.3",
|
||||
"picomatch": "^4.0.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=16.0.0 || 14 >= 14.17"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"rollup": "^2.68.0||^3.0.0||^4.0.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"rollup": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/@rollup/plugin-inject": {
|
||||
"version": "5.0.5",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/plugin-inject/-/plugin-inject-5.0.5.tgz",
|
||||
@ -1383,6 +1416,79 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/@rollup/plugin-json": {
|
||||
"version": "6.1.0",
|
||||
"resolved": "https://registry.npmmirror.com/@rollup/plugin-json/-/plugin-json-6.1.0.tgz",
|
||||
"integrity": "sha512-EGI2te5ENk1coGeADSIwZ7G2Q8CJS2sF120T7jLw4xFw9n7wIOXHo+kIYRAoVpJAN+kmqZSoO3Fp4JtoNF4ReA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@rollup/pluginutils": "^5.1.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14.0.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"rollup": "^1.20.0||^2.0.0||^3.0.0||^4.0.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"rollup": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/@rollup/plugin-node-resolve": {
|
||||
"version": "16.0.1",
|
||||
"resolved": "https://registry.npmmirror.com/@rollup/plugin-node-resolve/-/plugin-node-resolve-16.0.1.tgz",
|
||||
"integrity": "sha512-tk5YCxJWIG81umIvNkSod2qK5KyQW19qcBF/B78n1bjtOON6gzKoVeSzAE8yHCZEDmqkHKkxplExA8KzdJLJpA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@rollup/pluginutils": "^5.0.1",
|
||||
"@types/resolve": "1.20.2",
|
||||
"deepmerge": "^4.2.2",
|
||||
"is-module": "^1.0.0",
|
||||
"resolve": "^1.22.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14.0.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"rollup": "^2.78.0||^3.0.0||^4.0.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"rollup": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/@rollup/plugin-typescript": {
|
||||
"version": "12.1.2",
|
||||
"resolved": "https://registry.npmmirror.com/@rollup/plugin-typescript/-/plugin-typescript-12.1.2.tgz",
|
||||
"integrity": "sha512-cdtSp154H5sv637uMr1a8OTWB0L1SWDSm1rDGiyfcGcvQ6cuTs4MDk2BVEBGysUWago4OJN4EQZqOTl/QY3Jgg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@rollup/pluginutils": "^5.1.0",
|
||||
"resolve": "^1.22.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14.0.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"rollup": "^2.14.0||^3.0.0||^4.0.0",
|
||||
"tslib": "*",
|
||||
"typescript": ">=3.7.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"rollup": {
|
||||
"optional": true
|
||||
},
|
||||
"tslib": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/@rollup/pluginutils": {
|
||||
"version": "5.1.4",
|
||||
"dev": true,
|
||||
@ -1405,33 +1511,37 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@rollup/rollup-android-arm-eabi": {
|
||||
"version": "4.41.0",
|
||||
"resolved": "https://registry.npmmirror.com/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.41.0.tgz",
|
||||
"integrity": "sha512-KxN+zCjOYHGwCl4UCtSfZ6jrq/qi88JDUtiEFk8LELEHq2Egfc/FgW+jItZiOLRuQfb/3xJSgFuNPC9jzggX+A==",
|
||||
"version": "4.43.0",
|
||||
"resolved": "https://registry.npmmirror.com/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.43.0.tgz",
|
||||
"integrity": "sha512-Krjy9awJl6rKbruhQDgivNbD1WuLb8xAclM4IR4cN5pHGAs2oIMMQJEiC3IC/9TZJ+QZkmZhlMO/6MBGxPidpw==",
|
||||
"cpu": [
|
||||
"arm"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"android"
|
||||
]
|
||||
},
|
||||
"node_modules/@rollup/rollup-android-arm64": {
|
||||
"version": "4.41.0",
|
||||
"resolved": "https://registry.npmmirror.com/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.41.0.tgz",
|
||||
"integrity": "sha512-yDvqx3lWlcugozax3DItKJI5j05B0d4Kvnjx+5mwiUpWramVvmAByYigMplaoAQ3pvdprGCTCE03eduqE/8mPQ==",
|
||||
"version": "4.43.0",
|
||||
"resolved": "https://registry.npmmirror.com/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.43.0.tgz",
|
||||
"integrity": "sha512-ss4YJwRt5I63454Rpj+mXCXicakdFmKnUNxr1dLK+5rv5FJgAxnN7s31a5VchRYxCFWdmnDWKd0wbAdTr0J5EA==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"android"
|
||||
]
|
||||
},
|
||||
"node_modules/@rollup/rollup-darwin-arm64": {
|
||||
"version": "4.41.0",
|
||||
"version": "4.43.0",
|
||||
"resolved": "https://registry.npmmirror.com/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.43.0.tgz",
|
||||
"integrity": "sha512-eKoL8ykZ7zz8MjgBenEF2OoTNFAPFz1/lyJ5UmmFSz5jW+7XbH1+MAgCVHy72aG59rbuQLcJeiMrP8qP5d/N0A==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
@ -1443,208 +1553,238 @@
|
||||
]
|
||||
},
|
||||
"node_modules/@rollup/rollup-darwin-x64": {
|
||||
"version": "4.41.0",
|
||||
"resolved": "https://registry.npmmirror.com/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.41.0.tgz",
|
||||
"integrity": "sha512-gE5ACNSxHcEZyP2BA9TuTakfZvULEW4YAOtxl/A/YDbIir/wPKukde0BNPlnBiP88ecaN4BJI2TtAd+HKuZPQQ==",
|
||||
"version": "4.43.0",
|
||||
"resolved": "https://registry.npmmirror.com/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.43.0.tgz",
|
||||
"integrity": "sha512-SYwXJgaBYW33Wi/q4ubN+ldWC4DzQY62S4Ll2dgfr/dbPoF50dlQwEaEHSKrQdSjC6oIe1WgzosoaNoHCdNuMg==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"darwin"
|
||||
]
|
||||
},
|
||||
"node_modules/@rollup/rollup-freebsd-arm64": {
|
||||
"version": "4.41.0",
|
||||
"resolved": "https://registry.npmmirror.com/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.41.0.tgz",
|
||||
"integrity": "sha512-GSxU6r5HnWij7FoSo7cZg3l5GPg4HFLkzsFFh0N/b16q5buW1NAWuCJ+HMtIdUEi6XF0qH+hN0TEd78laRp7Dg==",
|
||||
"version": "4.43.0",
|
||||
"resolved": "https://registry.npmmirror.com/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.43.0.tgz",
|
||||
"integrity": "sha512-SV+U5sSo0yujrjzBF7/YidieK2iF6E7MdF6EbYxNz94lA+R0wKl3SiixGyG/9Klab6uNBIqsN7j4Y/Fya7wAjQ==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"freebsd"
|
||||
]
|
||||
},
|
||||
"node_modules/@rollup/rollup-freebsd-x64": {
|
||||
"version": "4.41.0",
|
||||
"resolved": "https://registry.npmmirror.com/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.41.0.tgz",
|
||||
"integrity": "sha512-KGiGKGDg8qLRyOWmk6IeiHJzsN/OYxO6nSbT0Vj4MwjS2XQy/5emsmtoqLAabqrohbgLWJ5GV3s/ljdrIr8Qjg==",
|
||||
"version": "4.43.0",
|
||||
"resolved": "https://registry.npmmirror.com/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.43.0.tgz",
|
||||
"integrity": "sha512-J7uCsiV13L/VOeHJBo5SjasKiGxJ0g+nQTrBkAsmQBIdil3KhPnSE9GnRon4ejX1XDdsmK/l30IYLiAaQEO0Cg==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"freebsd"
|
||||
]
|
||||
},
|
||||
"node_modules/@rollup/rollup-linux-arm-gnueabihf": {
|
||||
"version": "4.41.0",
|
||||
"resolved": "https://registry.npmmirror.com/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.41.0.tgz",
|
||||
"integrity": "sha512-46OzWeqEVQyX3N2/QdiU/CMXYDH/lSHpgfBkuhl3igpZiaB3ZIfSjKuOnybFVBQzjsLwkus2mjaESy8H41SzvA==",
|
||||
"version": "4.43.0",
|
||||
"resolved": "https://registry.npmmirror.com/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.43.0.tgz",
|
||||
"integrity": "sha512-gTJ/JnnjCMc15uwB10TTATBEhK9meBIY+gXP4s0sHD1zHOaIh4Dmy1X9wup18IiY9tTNk5gJc4yx9ctj/fjrIw==",
|
||||
"cpu": [
|
||||
"arm"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
]
|
||||
},
|
||||
"node_modules/@rollup/rollup-linux-arm-musleabihf": {
|
||||
"version": "4.41.0",
|
||||
"resolved": "https://registry.npmmirror.com/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.41.0.tgz",
|
||||
"integrity": "sha512-lfgW3KtQP4YauqdPpcUZHPcqQXmTmH4nYU0cplNeW583CMkAGjtImw4PKli09NFi2iQgChk4e9erkwlfYem6Lg==",
|
||||
"version": "4.43.0",
|
||||
"resolved": "https://registry.npmmirror.com/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.43.0.tgz",
|
||||
"integrity": "sha512-ZJ3gZynL1LDSIvRfz0qXtTNs56n5DI2Mq+WACWZ7yGHFUEirHBRt7fyIk0NsCKhmRhn7WAcjgSkSVVxKlPNFFw==",
|
||||
"cpu": [
|
||||
"arm"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
]
|
||||
},
|
||||
"node_modules/@rollup/rollup-linux-arm64-gnu": {
|
||||
"version": "4.41.0",
|
||||
"resolved": "https://registry.npmmirror.com/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.41.0.tgz",
|
||||
"integrity": "sha512-nn8mEyzMbdEJzT7cwxgObuwviMx6kPRxzYiOl6o/o+ChQq23gfdlZcUNnt89lPhhz3BYsZ72rp0rxNqBSfqlqw==",
|
||||
"version": "4.43.0",
|
||||
"resolved": "https://registry.npmmirror.com/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.43.0.tgz",
|
||||
"integrity": "sha512-8FnkipasmOOSSlfucGYEu58U8cxEdhziKjPD2FIa0ONVMxvl/hmONtX/7y4vGjdUhjcTHlKlDhw3H9t98fPvyA==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
]
|
||||
},
|
||||
"node_modules/@rollup/rollup-linux-arm64-musl": {
|
||||
"version": "4.41.0",
|
||||
"resolved": "https://registry.npmmirror.com/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.41.0.tgz",
|
||||
"integrity": "sha512-l+QK99je2zUKGd31Gh+45c4pGDAqZSuWQiuRFCdHYC2CSiO47qUWsCcenrI6p22hvHZrDje9QjwSMAFL3iwXwQ==",
|
||||
"version": "4.43.0",
|
||||
"resolved": "https://registry.npmmirror.com/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.43.0.tgz",
|
||||
"integrity": "sha512-KPPyAdlcIZ6S9C3S2cndXDkV0Bb1OSMsX0Eelr2Bay4EsF9yi9u9uzc9RniK3mcUGCLhWY9oLr6er80P5DE6XA==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
]
|
||||
},
|
||||
"node_modules/@rollup/rollup-linux-loongarch64-gnu": {
|
||||
"version": "4.41.0",
|
||||
"resolved": "https://registry.npmmirror.com/@rollup/rollup-linux-loongarch64-gnu/-/rollup-linux-loongarch64-gnu-4.41.0.tgz",
|
||||
"integrity": "sha512-WbnJaxPv1gPIm6S8O/Wg+wfE/OzGSXlBMbOe4ie+zMyykMOeqmgD1BhPxZQuDqwUN+0T/xOFtL2RUWBspnZj3w==",
|
||||
"version": "4.43.0",
|
||||
"resolved": "https://registry.npmmirror.com/@rollup/rollup-linux-loongarch64-gnu/-/rollup-linux-loongarch64-gnu-4.43.0.tgz",
|
||||
"integrity": "sha512-HPGDIH0/ZzAZjvtlXj6g+KDQ9ZMHfSP553za7o2Odegb/BEfwJcR0Sw0RLNpQ9nC6Gy8s+3mSS9xjZ0n3rhcYg==",
|
||||
"cpu": [
|
||||
"loong64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
]
|
||||
},
|
||||
"node_modules/@rollup/rollup-linux-powerpc64le-gnu": {
|
||||
"version": "4.41.0",
|
||||
"resolved": "https://registry.npmmirror.com/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.41.0.tgz",
|
||||
"integrity": "sha512-eRDWR5t67/b2g8Q/S8XPi0YdbKcCs4WQ8vklNnUYLaSWF+Cbv2axZsp4jni6/j7eKvMLYCYdcsv8dcU+a6QNFg==",
|
||||
"version": "4.43.0",
|
||||
"resolved": "https://registry.npmmirror.com/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.43.0.tgz",
|
||||
"integrity": "sha512-gEmwbOws4U4GLAJDhhtSPWPXUzDfMRedT3hFMyRAvM9Mrnj+dJIFIeL7otsv2WF3D7GrV0GIewW0y28dOYWkmw==",
|
||||
"cpu": [
|
||||
"ppc64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
]
|
||||
},
|
||||
"node_modules/@rollup/rollup-linux-riscv64-gnu": {
|
||||
"version": "4.41.0",
|
||||
"resolved": "https://registry.npmmirror.com/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.41.0.tgz",
|
||||
"integrity": "sha512-TWrZb6GF5jsEKG7T1IHwlLMDRy2f3DPqYldmIhnA2DVqvvhY2Ai184vZGgahRrg8k9UBWoSlHv+suRfTN7Ua4A==",
|
||||
"version": "4.43.0",
|
||||
"resolved": "https://registry.npmmirror.com/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.43.0.tgz",
|
||||
"integrity": "sha512-XXKvo2e+wFtXZF/9xoWohHg+MuRnvO29TI5Hqe9xwN5uN8NKUYy7tXUG3EZAlfchufNCTHNGjEx7uN78KsBo0g==",
|
||||
"cpu": [
|
||||
"riscv64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
]
|
||||
},
|
||||
"node_modules/@rollup/rollup-linux-riscv64-musl": {
|
||||
"version": "4.41.0",
|
||||
"resolved": "https://registry.npmmirror.com/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.41.0.tgz",
|
||||
"integrity": "sha512-ieQljaZKuJpmWvd8gW87ZmSFwid6AxMDk5bhONJ57U8zT77zpZ/TPKkU9HpnnFrM4zsgr4kiGuzbIbZTGi7u9A==",
|
||||
"version": "4.43.0",
|
||||
"resolved": "https://registry.npmmirror.com/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.43.0.tgz",
|
||||
"integrity": "sha512-ruf3hPWhjw6uDFsOAzmbNIvlXFXlBQ4nk57Sec8E8rUxs/AI4HD6xmiiasOOx/3QxS2f5eQMKTAwk7KHwpzr/Q==",
|
||||
"cpu": [
|
||||
"riscv64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
]
|
||||
},
|
||||
"node_modules/@rollup/rollup-linux-s390x-gnu": {
|
||||
"version": "4.41.0",
|
||||
"resolved": "https://registry.npmmirror.com/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.41.0.tgz",
|
||||
"integrity": "sha512-/L3pW48SxrWAlVsKCN0dGLB2bi8Nv8pr5S5ocSM+S0XCn5RCVCXqi8GVtHFsOBBCSeR+u9brV2zno5+mg3S4Aw==",
|
||||
"version": "4.43.0",
|
||||
"resolved": "https://registry.npmmirror.com/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.43.0.tgz",
|
||||
"integrity": "sha512-QmNIAqDiEMEvFV15rsSnjoSmO0+eJLoKRD9EAa9rrYNwO/XRCtOGM3A5A0X+wmG+XRrw9Fxdsw+LnyYiZWWcVw==",
|
||||
"cpu": [
|
||||
"s390x"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
]
|
||||
},
|
||||
"node_modules/@rollup/rollup-linux-x64-gnu": {
|
||||
"version": "4.41.0",
|
||||
"resolved": "https://registry.npmmirror.com/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.41.0.tgz",
|
||||
"integrity": "sha512-XMLeKjyH8NsEDCRptf6LO8lJk23o9wvB+dJwcXMaH6ZQbbkHu2dbGIUindbMtRN6ux1xKi16iXWu6q9mu7gDhQ==",
|
||||
"version": "4.43.0",
|
||||
"resolved": "https://registry.npmmirror.com/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.43.0.tgz",
|
||||
"integrity": "sha512-jAHr/S0iiBtFyzjhOkAics/2SrXE092qyqEg96e90L3t9Op8OTzS6+IX0Fy5wCt2+KqeHAkti+eitV0wvblEoQ==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
]
|
||||
},
|
||||
"node_modules/@rollup/rollup-linux-x64-musl": {
|
||||
"version": "4.41.0",
|
||||
"resolved": "https://registry.npmmirror.com/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.41.0.tgz",
|
||||
"integrity": "sha512-m/P7LycHZTvSQeXhFmgmdqEiTqSV80zn6xHaQ1JSqwCtD1YGtwEK515Qmy9DcB2HK4dOUVypQxvhVSy06cJPEg==",
|
||||
"version": "4.43.0",
|
||||
"resolved": "https://registry.npmmirror.com/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.43.0.tgz",
|
||||
"integrity": "sha512-3yATWgdeXyuHtBhrLt98w+5fKurdqvs8B53LaoKD7P7H7FKOONLsBVMNl9ghPQZQuYcceV5CDyPfyfGpMWD9mQ==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
]
|
||||
},
|
||||
"node_modules/@rollup/rollup-win32-arm64-msvc": {
|
||||
"version": "4.41.0",
|
||||
"resolved": "https://registry.npmmirror.com/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.41.0.tgz",
|
||||
"integrity": "sha512-4yodtcOrFHpbomJGVEqZ8fzD4kfBeCbpsUy5Pqk4RluXOdsWdjLnjhiKy2w3qzcASWd04fp52Xz7JKarVJ5BTg==",
|
||||
"version": "4.43.0",
|
||||
"resolved": "https://registry.npmmirror.com/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.43.0.tgz",
|
||||
"integrity": "sha512-wVzXp2qDSCOpcBCT5WRWLmpJRIzv23valvcTwMHEobkjippNf+C3ys/+wf07poPkeNix0paTNemB2XrHr2TnGw==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"win32"
|
||||
]
|
||||
},
|
||||
"node_modules/@rollup/rollup-win32-ia32-msvc": {
|
||||
"version": "4.41.0",
|
||||
"resolved": "https://registry.npmmirror.com/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.41.0.tgz",
|
||||
"integrity": "sha512-tmazCrAsKzdkXssEc65zIE1oC6xPHwfy9d5Ta25SRCDOZS+I6RypVVShWALNuU9bxIfGA0aqrmzlzoM5wO5SPQ==",
|
||||
"version": "4.43.0",
|
||||
"resolved": "https://registry.npmmirror.com/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.43.0.tgz",
|
||||
"integrity": "sha512-fYCTEyzf8d+7diCw8b+asvWDCLMjsCEA8alvtAutqJOJp/wL5hs1rWSqJ1vkjgW0L2NB4bsYJrpKkiIPRR9dvw==",
|
||||
"cpu": [
|
||||
"ia32"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"win32"
|
||||
]
|
||||
},
|
||||
"node_modules/@rollup/rollup-win32-x64-msvc": {
|
||||
"version": "4.43.0",
|
||||
"resolved": "https://registry.npmmirror.com/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.43.0.tgz",
|
||||
"integrity": "sha512-SnGhLiE5rlK0ofq8kzuDkM0g7FN1s5VYY+YSMTibP7CqShxCQvqtNxTARS4xX4PFJfHjG0ZQYX9iGzI3FQh5Aw==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"win32"
|
||||
@ -2040,6 +2180,13 @@
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@types/resolve": {
|
||||
"version": "1.20.2",
|
||||
"resolved": "https://registry.npmmirror.com/@types/resolve/-/resolve-1.20.2.tgz",
|
||||
"integrity": "sha512-60BCwRFOZCQhDncwQdxxeOEEkbc5dIMccYLwbxsS4TUNeVECQ/pBJ0j09mrHOl/JJvpRPGwO9SvE4nR2Nb/a4Q==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@types/send": {
|
||||
"version": "0.17.4",
|
||||
"dev": true,
|
||||
@ -3155,6 +3302,13 @@
|
||||
"node": ">= 12"
|
||||
}
|
||||
},
|
||||
"node_modules/commondir": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmmirror.com/commondir/-/commondir-1.0.1.tgz",
|
||||
"integrity": "sha512-W9pAhw0ja1Edb5GVdIF1mjZw/ASI0AlShXM83UUGe2DVr5TdAPEA1OA8m/g8zWp9x6On7gqufY+FatDbC3MDQg==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/compare-versions": {
|
||||
"version": "6.1.1",
|
||||
"resolved": "https://registry.npmjs.org/compare-versions/-/compare-versions-6.1.1.tgz",
|
||||
@ -4909,6 +5063,13 @@
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/is-module": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmmirror.com/is-module/-/is-module-1.0.0.tgz",
|
||||
"integrity": "sha512-51ypPSPCoTEIN9dy5Oy+h4pShgJmPCygKfyRCISBI+JoWT/2oJvK8QPxmwv7b/p239jXrm9M1mlQbyKJ5A152g==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/is-number": {
|
||||
"version": "7.0.0",
|
||||
"dev": true,
|
||||
@ -4943,6 +5104,16 @@
|
||||
"version": "4.0.0",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/is-reference": {
|
||||
"version": "1.2.1",
|
||||
"resolved": "https://registry.npmmirror.com/is-reference/-/is-reference-1.2.1.tgz",
|
||||
"integrity": "sha512-U82MsXXiFIrjCK4otLT+o2NA2Cd2g5MLoOVXUZjIOhLurrRxpEXzI8O0KZHr3IjLvlAH1kTPYSuqer5T9ZVBKQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@types/estree": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/is-regex": {
|
||||
"version": "1.2.1",
|
||||
"license": "MIT",
|
||||
@ -6533,7 +6704,9 @@
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/rollup": {
|
||||
"version": "4.41.0",
|
||||
"version": "4.43.0",
|
||||
"resolved": "https://registry.npmmirror.com/rollup/-/rollup-4.43.0.tgz",
|
||||
"integrity": "sha512-wdN2Kd3Twh8MAEOEJZsuxuLKCsBEo4PVNLK6tQWAn10VhsVewQLzcucMgLolRlhFybGxfclbPeEYBaP6RvUFGg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
@ -6547,26 +6720,26 @@
|
||||
"npm": ">=8.0.0"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"@rollup/rollup-android-arm-eabi": "4.41.0",
|
||||
"@rollup/rollup-android-arm64": "4.41.0",
|
||||
"@rollup/rollup-darwin-arm64": "4.41.0",
|
||||
"@rollup/rollup-darwin-x64": "4.41.0",
|
||||
"@rollup/rollup-freebsd-arm64": "4.41.0",
|
||||
"@rollup/rollup-freebsd-x64": "4.41.0",
|
||||
"@rollup/rollup-linux-arm-gnueabihf": "4.41.0",
|
||||
"@rollup/rollup-linux-arm-musleabihf": "4.41.0",
|
||||
"@rollup/rollup-linux-arm64-gnu": "4.41.0",
|
||||
"@rollup/rollup-linux-arm64-musl": "4.41.0",
|
||||
"@rollup/rollup-linux-loongarch64-gnu": "4.41.0",
|
||||
"@rollup/rollup-linux-powerpc64le-gnu": "4.41.0",
|
||||
"@rollup/rollup-linux-riscv64-gnu": "4.41.0",
|
||||
"@rollup/rollup-linux-riscv64-musl": "4.41.0",
|
||||
"@rollup/rollup-linux-s390x-gnu": "4.41.0",
|
||||
"@rollup/rollup-linux-x64-gnu": "4.41.0",
|
||||
"@rollup/rollup-linux-x64-musl": "4.41.0",
|
||||
"@rollup/rollup-win32-arm64-msvc": "4.41.0",
|
||||
"@rollup/rollup-win32-ia32-msvc": "4.41.0",
|
||||
"@rollup/rollup-win32-x64-msvc": "4.41.0",
|
||||
"@rollup/rollup-android-arm-eabi": "4.43.0",
|
||||
"@rollup/rollup-android-arm64": "4.43.0",
|
||||
"@rollup/rollup-darwin-arm64": "4.43.0",
|
||||
"@rollup/rollup-darwin-x64": "4.43.0",
|
||||
"@rollup/rollup-freebsd-arm64": "4.43.0",
|
||||
"@rollup/rollup-freebsd-x64": "4.43.0",
|
||||
"@rollup/rollup-linux-arm-gnueabihf": "4.43.0",
|
||||
"@rollup/rollup-linux-arm-musleabihf": "4.43.0",
|
||||
"@rollup/rollup-linux-arm64-gnu": "4.43.0",
|
||||
"@rollup/rollup-linux-arm64-musl": "4.43.0",
|
||||
"@rollup/rollup-linux-loongarch64-gnu": "4.43.0",
|
||||
"@rollup/rollup-linux-powerpc64le-gnu": "4.43.0",
|
||||
"@rollup/rollup-linux-riscv64-gnu": "4.43.0",
|
||||
"@rollup/rollup-linux-riscv64-musl": "4.43.0",
|
||||
"@rollup/rollup-linux-s390x-gnu": "4.43.0",
|
||||
"@rollup/rollup-linux-x64-gnu": "4.43.0",
|
||||
"@rollup/rollup-linux-x64-musl": "4.43.0",
|
||||
"@rollup/rollup-win32-arm64-msvc": "4.43.0",
|
||||
"@rollup/rollup-win32-ia32-msvc": "4.43.0",
|
||||
"@rollup/rollup-win32-x64-msvc": "4.43.0",
|
||||
"fsevents": "~2.3.2"
|
||||
}
|
||||
},
|
||||
@ -6658,19 +6831,6 @@
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/rollup/node_modules/@rollup/rollup-win32-x64-msvc": {
|
||||
"version": "4.41.0",
|
||||
"resolved": "https://registry.npmmirror.com/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.41.0.tgz",
|
||||
"integrity": "sha512-h1J+Yzjo/X+0EAvR2kIXJDuTuyT7drc+t2ALY0nIcGPbTatNOf0VWdhEA2Z4AAjv6X1NJV7SYo5oCTYRJhSlVA==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"os": [
|
||||
"win32"
|
||||
]
|
||||
},
|
||||
"node_modules/router": {
|
||||
"version": "2.2.0",
|
||||
"license": "MIT",
|
||||
@ -7338,6 +7498,12 @@
|
||||
"node": ">=6"
|
||||
}
|
||||
},
|
||||
"node_modules/tslib": {
|
||||
"version": "2.8.1",
|
||||
"resolved": "https://registry.npmmirror.com/tslib/-/tslib-2.8.1.tgz",
|
||||
"integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==",
|
||||
"license": "0BSD"
|
||||
},
|
||||
"node_modules/tsx": {
|
||||
"version": "4.19.4",
|
||||
"resolved": "https://registry.npmjs.org/tsx/-/tsx-4.19.4.tgz",
|
||||
|
11
package.json
11
package.json
@ -19,6 +19,7 @@
|
||||
"Other"
|
||||
],
|
||||
"activationEvents": [],
|
||||
"type": "module",
|
||||
"main": "./dist/extension.js",
|
||||
"icon": "icons/openmcp.png",
|
||||
"contributes": {
|
||||
@ -225,13 +226,13 @@
|
||||
"build": "turbo build",
|
||||
"build:electron": "turbo build --filter=@openmcp/electron",
|
||||
"build:all": "turbo build",
|
||||
"vscode:prepublish": "webpack --mode production",
|
||||
"vscode:prepublish": "rollup --config rollup.config.js",
|
||||
"compile": "tsc -p ./",
|
||||
"watch": "tsc -watch -p ./",
|
||||
"pretest": "npm run compile && npm run lint",
|
||||
"lint": "eslint src --ext ts",
|
||||
"test": "node ./out/test/runTest.js",
|
||||
"prepare:ocr": "webpack --config webpack/webpack.tesseract.js",
|
||||
"prepare:ocr": "rollup --config rollup.tesseract.js",
|
||||
"build:task-loop": "npx vite build --config webpack/vite.config.task-loop.mjs && node renderer/scripts/task-loop.build.mjs"
|
||||
},
|
||||
"dependencies": {
|
||||
@ -243,11 +244,16 @@
|
||||
"openai": "^5.0.1",
|
||||
"pako": "^2.1.0",
|
||||
"tesseract.js": "^6.0.1",
|
||||
"tslib": "^2.8.1",
|
||||
"uuid": "^11.1.0",
|
||||
"ws": "^8.18.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@rollup/plugin-commonjs": "^28.0.3",
|
||||
"@rollup/plugin-inject": "^5.0.5",
|
||||
"@rollup/plugin-json": "^6.1.0",
|
||||
"@rollup/plugin-node-resolve": "^16.0.1",
|
||||
"@rollup/plugin-typescript": "^12.1.2",
|
||||
"@types/node": "^22.15.29",
|
||||
"@types/pako": "^2.0.3",
|
||||
"@types/showdown": "^2.0.0",
|
||||
@ -255,6 +261,7 @@
|
||||
"copy-webpack-plugin": "^13.0.0",
|
||||
"fork-ts-checker-webpack-plugin": "^9.1.0",
|
||||
"null-loader": "^4.0.1",
|
||||
"rollup": "^4.43.0",
|
||||
"rollup-plugin-visualizer": "^6.0.1",
|
||||
"ts-loader": "^9.5.1",
|
||||
"turbo": "^2.5.3",
|
||||
|
@ -9,7 +9,7 @@ if (fs.existsSync(targetFile)) {
|
||||
content = content.replace(/'element-plus'/g, "'./tools.js'");
|
||||
content = content.replace(/"element-plus"/g, "\"./tools.js\"");
|
||||
|
||||
content = content.replace(/const chalk = require\("chalk"\);/g, 'const chalk = require("chalk").default;');
|
||||
// content = content.replace(/const chalk = require\("chalk"\);/g, 'const chalk = require("chalk").default;');
|
||||
|
||||
// Replace define_window_default$number.performance with performance
|
||||
content = content.replace(/define_window_default\$\d+\.performance/g, 'performance');
|
||||
|
@ -1,5 +1,5 @@
|
||||
const { TaskLoop } = require('../../openmcp-sdk/task-loop');
|
||||
const { TaskLoopAdapter } = require('../../openmcp-sdk/service');
|
||||
import { TaskLoop } from '../../openmcp-sdk/task-loop.js';
|
||||
import { TaskLoopAdapter } from '../../openmcp-sdk/service.js';
|
||||
|
||||
async function main() {
|
||||
// 创建适配器,负责通信和 mcp 连接
|
||||
|
23
rollup.config.js
Normal file
23
rollup.config.js
Normal file
@ -0,0 +1,23 @@
|
||||
import resolve from '@rollup/plugin-node-resolve';
|
||||
import commonjs from '@rollup/plugin-commonjs';
|
||||
import typescript from '@rollup/plugin-typescript';
|
||||
import json from '@rollup/plugin-json';
|
||||
|
||||
export default {
|
||||
input: 'src/extension.ts',
|
||||
output: {
|
||||
file: 'dist/extension.js',
|
||||
format: 'es',
|
||||
sourcemap: true
|
||||
},
|
||||
plugins: [
|
||||
json(),
|
||||
resolve({ browser: true }), // 支持 node_modules 解析
|
||||
commonjs(), // 转换 CommonJS 模块
|
||||
typescript() // 处理 TypeScript
|
||||
],
|
||||
external: ['vscode'], // 排除 VSCode 内置模块
|
||||
onwarn(warning, warn) {
|
||||
if (warning.code !== 'SOURCEMAP_ERROR') warn(warning);
|
||||
}
|
||||
};
|
15
rollup.tesseract.js
Normal file
15
rollup.tesseract.js
Normal file
@ -0,0 +1,15 @@
|
||||
import resolve from '@rollup/plugin-node-resolve';
|
||||
import commonjs from '@rollup/plugin-commonjs';
|
||||
|
||||
export default {
|
||||
input: 'src/ocr-worker.ts',
|
||||
output: {
|
||||
file: 'dist/ocr-worker.js',
|
||||
format: 'es'
|
||||
},
|
||||
plugins: [
|
||||
resolve(),
|
||||
commonjs()
|
||||
],
|
||||
external: ['tesseract.js'] // 显式排除 Tesseract
|
||||
};
|
@ -1,12 +1,11 @@
|
||||
import { WebSocketServer } from 'ws';
|
||||
import {pino} from 'pino';
|
||||
import { pino } from 'pino';
|
||||
import { fileURLToPath } from 'url';
|
||||
import { dirname } from 'path';
|
||||
import { dirname, join } from 'path';
|
||||
import { routeMessage } from './common/router.js';
|
||||
import { VSCodeWebViewLike } from './hook/adapter.js';
|
||||
import path from 'node:path';
|
||||
import * as fs from 'node:fs';
|
||||
import { setRunningCWD } from './hook/setting.js';
|
||||
import fs from 'fs/promises'; // 使用 Promise API 替代回调
|
||||
import path from 'path';
|
||||
import axios from 'axios';
|
||||
|
||||
export interface VSCodeMessage {
|
||||
@ -15,91 +14,91 @@ export interface VSCodeMessage {
|
||||
callbackId?: string;
|
||||
}
|
||||
|
||||
// 适配 ESM 的 __dirname
|
||||
const __filename = fileURLToPath(import.meta.url);
|
||||
const __dirname = dirname(__filename);
|
||||
|
||||
// 统一路径变量
|
||||
const devHome = join(__dirname, '..', '..');
|
||||
const serverPath = join(devHome, 'servers');
|
||||
const envPath = join(__dirname, '..', '.env');
|
||||
|
||||
const logger = pino({
|
||||
transport: {
|
||||
target: 'pino-pretty', // 启用 pino-pretty
|
||||
target: 'pino-pretty',
|
||||
options: {
|
||||
colorize: true, // 开启颜色
|
||||
levelFirst: true, // 先打印日志级别
|
||||
translateTime: 'SYS:yyyy-mm-dd HH:MM:ss', // 格式化时间
|
||||
ignore: 'pid,hostname', // 忽略部分字段
|
||||
colorize: true,
|
||||
levelFirst: true,
|
||||
translateTime: 'SYS:yyyy-mm-dd HH:MM:ss',
|
||||
ignore: 'pid,hostname',
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
export type MessageHandler = (message: VSCodeMessage) => void;
|
||||
|
||||
function refreshConnectionOption(envPath: string) {
|
||||
const serverPath = path.join(__dirname, '..', '..', 'servers');
|
||||
|
||||
async function refreshConnectionOption() {
|
||||
const defaultOption = {
|
||||
connectionType: 'STDIO',
|
||||
commandString: 'mcp run main.py',
|
||||
cwd: serverPath
|
||||
};
|
||||
|
||||
fs.writeFileSync(envPath, JSON.stringify(defaultOption, null, 4));
|
||||
|
||||
return { items: [ defaultOption ] };
|
||||
try {
|
||||
await fs.writeFile(envPath, JSON.stringify(defaultOption, null, 4), 'utf-8');
|
||||
return { items: [defaultOption] };
|
||||
} catch (error) {
|
||||
logger.error('刷新连接配置失败:', error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
function acquireConnectionOption() {
|
||||
const envPath = path.join(__dirname, '..', '.env');
|
||||
|
||||
if (!fs.existsSync(envPath)) {
|
||||
return refreshConnectionOption(envPath);
|
||||
}
|
||||
|
||||
async function acquireConnectionOption() {
|
||||
try {
|
||||
const option = JSON.parse(fs.readFileSync(envPath, 'utf-8'));
|
||||
const data = await fs.readFile(envPath, 'utf-8');
|
||||
const option = JSON.parse(data);
|
||||
|
||||
if (!option.items) {
|
||||
return refreshConnectionOption(envPath);
|
||||
}
|
||||
|
||||
if (option.items && option.items.length === 0) {
|
||||
return refreshConnectionOption(envPath);
|
||||
if (!option.items || option.items.length === 0) {
|
||||
return await refreshConnectionOption();
|
||||
}
|
||||
|
||||
// 按照前端的规范,整理成 commandString 样式
|
||||
option.items = option.items.map((item: any) => {
|
||||
option.items = option.items.map((item: { connectionType: string; commandString: string; command: any; args: any; url: any; }) => {
|
||||
if (item.connectionType === 'STDIO') {
|
||||
item.commandString = [item.command, ...item.args]?.join(' ');
|
||||
} else {
|
||||
item.url = item.url;
|
||||
}
|
||||
|
||||
return item;
|
||||
});
|
||||
|
||||
return option;
|
||||
|
||||
} catch (error) {
|
||||
logger.error('读取 .env 配置文件');
|
||||
return refreshConnectionOption(envPath);
|
||||
logger.error('读取 .env 配置文件失败:', error);
|
||||
return await refreshConnectionOption();
|
||||
}
|
||||
}
|
||||
|
||||
function updateConnectionOption(data: any) {
|
||||
const envPath = path.join(__dirname, '..', '.env');
|
||||
const connection = { items: data };
|
||||
fs.writeFileSync(envPath, JSON.stringify(connection, null, 4));
|
||||
async function updateConnectionOption(data: any) {
|
||||
try {
|
||||
await fs.writeFile(envPath, JSON.stringify({ items: data }, null, 4), 'utf-8');
|
||||
} catch (error) {
|
||||
logger.error('更新连接配置失败:', error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
const __dirname = dirname(fileURLToPath(import.meta.url));
|
||||
const devHome = path.join(__dirname, '..', '..');
|
||||
// 设置运行时路径
|
||||
import { setRunningCWD } from './hook/setting.js';
|
||||
setRunningCWD(devHome);
|
||||
|
||||
// 启动 WebSocket 服务器
|
||||
const wss = new WebSocketServer({ port: 8282 });
|
||||
console.log('WebSocket 服务器已启动:', 'ws://localhost:8282');
|
||||
|
||||
console.log('listen on ws://localhost:8282');
|
||||
|
||||
wss.on('connection', (ws: any) => {
|
||||
|
||||
// 仿造 webview 进行统一接口访问
|
||||
wss.on('connection', (ws) => {
|
||||
const webview = new VSCodeWebViewLike(ws);
|
||||
|
||||
// 先发送成功建立的消息
|
||||
webview.postMessage({
|
||||
command: 'hello',
|
||||
data: {
|
||||
@ -108,29 +107,25 @@ wss.on('connection', (ws: any) => {
|
||||
}
|
||||
});
|
||||
|
||||
const option = acquireConnectionOption();
|
||||
acquireConnectionOption().then(option => {
|
||||
webview.onDidReceiveMessage(async (message) => {
|
||||
logger.info(`收到命令: [${message.command || '未定义'}]`);
|
||||
|
||||
// 注册消息接受的管线
|
||||
webview.onDidReceiveMessage(message => {
|
||||
logger.info(`command: [${message.command || 'No Command'}]`);
|
||||
const { command, data } = message;
|
||||
|
||||
switch (command) {
|
||||
case 'web/launch-signature':
|
||||
const launchResult = {
|
||||
code: 200,
|
||||
msg: option.items
|
||||
};
|
||||
|
||||
webview.postMessage({
|
||||
command: 'web/launch-signature',
|
||||
data: launchResult
|
||||
data: {
|
||||
code: 200,
|
||||
msg: option.items
|
||||
}
|
||||
});
|
||||
|
||||
break;
|
||||
|
||||
case 'web/update-connection-signature':
|
||||
updateConnectionOption(data);
|
||||
await updateConnectionOption(data);
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -138,4 +133,7 @@ wss.on('connection', (ws: any) => {
|
||||
break;
|
||||
}
|
||||
});
|
||||
}).catch(error => {
|
||||
logger.error('初始化连接配置失败:', error);
|
||||
});
|
||||
});
|
@ -1,12 +1,17 @@
|
||||
import { WebSocketServer } from 'ws';
|
||||
import pino from 'pino';
|
||||
|
||||
import { fileURLToPath } from 'url';
|
||||
import { dirname, join } from 'path';
|
||||
import { routeMessage } from './common/router.js';
|
||||
import { VSCodeWebViewLike } from './hook/adapter.js';
|
||||
import path from 'node:path';
|
||||
import * as fs from 'node:fs';
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import { setRunningCWD } from './hook/setting.js';
|
||||
import { exit } from 'node:process';
|
||||
import { exit } from 'process';
|
||||
|
||||
// 适配 ESM 的 __dirname
|
||||
const __filename = fileURLToPath(import.meta.url);
|
||||
const __dirname = dirname(__filename);
|
||||
|
||||
export interface VSCodeMessage {
|
||||
command: string;
|
||||
@ -16,12 +21,12 @@ export interface VSCodeMessage {
|
||||
|
||||
const logger = pino.default({
|
||||
transport: {
|
||||
target: 'pino-pretty', // 启用 pino-pretty
|
||||
target: 'pino-pretty',
|
||||
options: {
|
||||
colorize: true, // 开启颜色
|
||||
levelFirst: true, // 先打印日志级别
|
||||
translateTime: 'SYS:yyyy-mm-dd HH:MM:ss', // 格式化时间
|
||||
ignore: 'pid,hostname', // 忽略部分字段
|
||||
colorize: true,
|
||||
levelFirst: true,
|
||||
translateTime: 'SYS:yyyy-mm-dd HH:MM:ss',
|
||||
ignore: 'pid,hostname',
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -29,8 +34,7 @@ const logger = pino.default({
|
||||
export type MessageHandler = (message: VSCodeMessage) => void;
|
||||
|
||||
function refreshConnectionOption(envPath: string) {
|
||||
const serverPath = path.join(__dirname, '..', '..', 'servers');
|
||||
|
||||
const serverPath = join(__dirname, '..', '..', 'servers');
|
||||
const defaultOption = {
|
||||
connectionType: 'STDIO',
|
||||
commandString: 'mcp run main.py',
|
||||
@ -38,12 +42,11 @@ function refreshConnectionOption(envPath: string) {
|
||||
};
|
||||
|
||||
fs.writeFileSync(envPath, JSON.stringify(defaultOption, null, 4));
|
||||
|
||||
return { items: [defaultOption] };
|
||||
}
|
||||
|
||||
function acquireConnectionOption() {
|
||||
const envPath = path.join(__dirname, '..', '.env');
|
||||
const envPath = join(__dirname, '..', '.env');
|
||||
|
||||
if (!fs.existsSync(envPath)) {
|
||||
return refreshConnectionOption(envPath);
|
||||
@ -52,11 +55,7 @@ function acquireConnectionOption() {
|
||||
try {
|
||||
const option = JSON.parse(fs.readFileSync(envPath, 'utf-8'));
|
||||
|
||||
if (!option.items) {
|
||||
return refreshConnectionOption(envPath);
|
||||
}
|
||||
|
||||
if (option.items && option.items.length === 0) {
|
||||
if (!option.items || option.items.length === 0) {
|
||||
return refreshConnectionOption(envPath);
|
||||
}
|
||||
|
||||
@ -67,7 +66,6 @@ function acquireConnectionOption() {
|
||||
} else {
|
||||
item.url = item.url;
|
||||
}
|
||||
|
||||
return item;
|
||||
});
|
||||
|
||||
@ -79,20 +77,22 @@ function acquireConnectionOption() {
|
||||
}
|
||||
}
|
||||
|
||||
if (!fs.existsSync(path.join(__dirname, '..', '.env.website.local'))) {
|
||||
// 验证 .env.website.local 存在性
|
||||
const localEnvPath = join(__dirname, '..', '.env.website.local');
|
||||
if (!fs.existsSync(localEnvPath)) {
|
||||
console.log('.env.website.local 不存在!');
|
||||
exit(0);
|
||||
}
|
||||
|
||||
const authPassword = JSON.parse(fs.readFileSync(path.join(__dirname, '..', '.env.website.local'), 'utf-8')).password;
|
||||
// 读取认证密码
|
||||
const authPassword = JSON.parse(fs.readFileSync(localEnvPath, 'utf-8')).password;
|
||||
|
||||
function updateConnectionOption(data: any) {
|
||||
const envPath = path.join(__dirname, '..', '.env');
|
||||
const connection = { items: data };
|
||||
fs.writeFileSync(envPath, JSON.stringify(connection, null, 4));
|
||||
const envPath = join(__dirname, '..', '.env');
|
||||
fs.writeFileSync(envPath, JSON.stringify({ items: data }, null, 4));
|
||||
}
|
||||
|
||||
const devHome = path.join(__dirname, '..', '..');
|
||||
const devHome = join(__dirname, '..', '..');
|
||||
setRunningCWD(devHome);
|
||||
|
||||
function verifyToken(url: string) {
|
||||
@ -104,30 +104,25 @@ function verifyToken(url: string) {
|
||||
}
|
||||
}
|
||||
|
||||
const wss = new WebSocketServer(
|
||||
{
|
||||
const wss = new WebSocketServer({
|
||||
port: 8282,
|
||||
verifyClient: (info, callback) => {
|
||||
console.log(info.req.url);
|
||||
const ok = verifyToken(info.req.url || '');
|
||||
const url = info.req.url || '';
|
||||
const ok = verifyToken(url);
|
||||
|
||||
if (!ok) {
|
||||
callback(false, 401, 'Unauthorized: Invalid token');
|
||||
} else {
|
||||
callback(true); // 允许连接
|
||||
callback(true);
|
||||
}
|
||||
}
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
console.log('listen on ws://localhost:8282');
|
||||
|
||||
wss.on('connection', (ws: any) => {
|
||||
|
||||
// 仿造 webview 进行统一接口访问
|
||||
wss.on('connection', (ws) => {
|
||||
const webview = new VSCodeWebViewLike(ws);
|
||||
|
||||
// 先发送成功建立的消息
|
||||
webview.postMessage({
|
||||
command: 'hello',
|
||||
data: {
|
||||
@ -138,23 +133,19 @@ wss.on('connection', (ws: any) => {
|
||||
|
||||
const option = acquireConnectionOption();
|
||||
|
||||
// 注册消息接受的管线
|
||||
webview.onDidReceiveMessage(message => {
|
||||
logger.info(`command: [${message.command || 'No Command'}]`);
|
||||
const { command, data } = message;
|
||||
|
||||
switch (command) {
|
||||
case 'web/launch-signature':
|
||||
const launchResult = {
|
||||
code: 200,
|
||||
msg: option.items
|
||||
};
|
||||
|
||||
webview.postMessage({
|
||||
command: 'web/launch-signature',
|
||||
data: launchResult
|
||||
data: {
|
||||
code: 200,
|
||||
msg: option.items
|
||||
}
|
||||
});
|
||||
|
||||
break;
|
||||
|
||||
case 'web/update-connection-signature':
|
||||
|
@ -1,4 +1,4 @@
|
||||
const path = require('path');
|
||||
import path from 'path';
|
||||
|
||||
module.exports = {
|
||||
entry: './src/main.ts',
|
||||
|
@ -1,10 +1,10 @@
|
||||
import * as vscode from 'vscode';
|
||||
import { registerCommands, registerTreeDataProviders } from '.';
|
||||
import { HelpProvider } from '../sidebar/help.controller';
|
||||
import { McpWorkspaceConnectProvider } from '../sidebar/workspace.controller';
|
||||
import { McpInstalledConnectProvider } from '../sidebar/installed.controller';
|
||||
import { WebviewController } from '../webview/webview.controller';
|
||||
import { HookController } from '../hook/hook.controller';
|
||||
import { registerCommands, registerTreeDataProviders } from './index.js';
|
||||
import { HelpProvider } from '../sidebar/help.controller.js';
|
||||
import { McpWorkspaceConnectProvider } from '../sidebar/workspace.controller.js';
|
||||
import { McpInstalledConnectProvider } from '../sidebar/installed.controller.js';
|
||||
import { WebviewController } from '../webview/webview.controller.js';
|
||||
import { HookController } from '../hook/hook.controller.js';
|
||||
|
||||
export const InstallModules = [
|
||||
McpWorkspaceConnectProvider,
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { CommandHandlerDescriptor, IRegisterCommandItem, IRegisterTreeDataProviderItem, TreeDataProviderConstructor } from "./index.dto";
|
||||
import { CommandHandlerDescriptor, IRegisterCommandItem, IRegisterTreeDataProviderItem, TreeDataProviderConstructor } from "./index.dto.js";
|
||||
|
||||
export const registerCommands = new Array<[string, IRegisterCommandItem]>();
|
||||
export const registerTreeDataProviders = new Map<string, IRegisterTreeDataProviderItem<any>>();
|
||||
|
@ -1,7 +1,7 @@
|
||||
import * as vscode from 'vscode';
|
||||
import { setRunningCWD, setVscodeWorkspace } from '../openmcp-sdk/service';
|
||||
import { launch } from './common/entry';
|
||||
import { initialiseI18n } from './i18n';
|
||||
import { setRunningCWD, setVscodeWorkspace } from '../openmcp-sdk/service/index.js';
|
||||
import { launch } from './common/entry.js';
|
||||
import { initialiseI18n } from './i18n/index.js';
|
||||
|
||||
export function activate(context: vscode.ExtensionContext) {
|
||||
console.log('activate openmcp');
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { RegisterCommand } from "../common";
|
||||
import { RegisterCommand } from "../common/index.js";
|
||||
import * as vscode from 'vscode';
|
||||
import * as path from 'path';
|
||||
import Tesseract from 'tesseract.js';
|
||||
|
@ -1,5 +1,5 @@
|
||||
import * as vscode from 'vscode';
|
||||
import { McpOptions } from '../global';
|
||||
import { McpOptions } from '../global.js';
|
||||
|
||||
export class SidebarItem extends vscode.TreeItem {
|
||||
constructor(
|
||||
|
@ -1,7 +1,7 @@
|
||||
import * as vscode from 'vscode';
|
||||
import { SidebarItem } from './common';
|
||||
import { RegisterTreeDataProvider } from '../common';
|
||||
import { t } from '../i18n';
|
||||
import { SidebarItem } from './common.js';
|
||||
import { RegisterTreeDataProvider } from '../common/index.js';
|
||||
import { t } from '../i18n/index.js';
|
||||
|
||||
@RegisterTreeDataProvider('openmcp.sidebar.help')
|
||||
export class HelpProvider implements vscode.TreeDataProvider<SidebarItem> {
|
||||
|
@ -1,9 +1,9 @@
|
||||
import * as vscode from 'vscode';
|
||||
import { RegisterCommand, RegisterTreeDataProvider } from '../common';
|
||||
import { ConnectionViewItem } from './common';
|
||||
import { getConnectionConfig, getInstalledConnectionConfigPath, saveConnectionConfig } from '../global';
|
||||
import { acquireInstalledConnection, deleteInstalledConnection } from './installed.service';
|
||||
import { revealOpenMcpWebviewPanel } from '../webview/webview.service';
|
||||
import { RegisterCommand, RegisterTreeDataProvider } from '../common/index.js';
|
||||
import { ConnectionViewItem } from './common.js';
|
||||
import { getConnectionConfig, getInstalledConnectionConfigPath, saveConnectionConfig } from '../global.js';
|
||||
import { acquireInstalledConnection, deleteInstalledConnection } from './installed.service.js';
|
||||
import { revealOpenMcpWebviewPanel } from '../webview/webview.service.js';
|
||||
|
||||
@RegisterTreeDataProvider('openmcp.sidebar.installed-connection')
|
||||
export class McpInstalledConnectProvider implements vscode.TreeDataProvider<ConnectionViewItem> {
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { getConnectionConfig, panels, saveConnectionConfig, getFirstValidPathFromCommand, McpOptions } from "../global";
|
||||
import { getConnectionConfig, panels, saveConnectionConfig, getFirstValidPathFromCommand, McpOptions } from "../global.js";
|
||||
import { exec, spawn } from 'node:child_process';
|
||||
import * as vscode from 'vscode';
|
||||
import { t } from "../i18n";
|
||||
import { t } from "../i18n/index.js";
|
||||
|
||||
export async function deleteInstalledConnection(item: McpOptions[] | McpOptions) {
|
||||
// 弹出确认对话框
|
||||
|
@ -1,9 +1,9 @@
|
||||
import * as vscode from 'vscode';
|
||||
import { RegisterCommand, RegisterTreeDataProvider } from '../common';
|
||||
import { getWorkspaceConnectionConfig, getWorkspaceConnectionConfigPath, getWorkspacePath, saveWorkspaceConnectionConfig } from '../global';
|
||||
import { ConnectionViewItem } from './common';
|
||||
import { revealOpenMcpWebviewPanel } from '../webview/webview.service';
|
||||
import { acquireUserCustomConnection, deleteUserConnection } from './workspace.service';
|
||||
import { RegisterCommand, RegisterTreeDataProvider } from '../common/index.js';
|
||||
import { getWorkspaceConnectionConfig, getWorkspaceConnectionConfigPath, getWorkspacePath, saveWorkspaceConnectionConfig } from '../global.js';
|
||||
import { ConnectionViewItem } from './common.js';
|
||||
import { revealOpenMcpWebviewPanel } from '../webview/webview.service.js';
|
||||
import { acquireUserCustomConnection, deleteUserConnection } from './workspace.service.js';
|
||||
|
||||
@RegisterTreeDataProvider('openmcp.sidebar.workspace-connection')
|
||||
export class McpWorkspaceConnectProvider implements vscode.TreeDataProvider<ConnectionViewItem> {
|
||||
@ -55,7 +55,7 @@ export class McpWorkspaceConnectProvider implements vscode.TreeDataProvider<Conn
|
||||
public refresh(context: vscode.ExtensionContext): void {
|
||||
console.log(this);
|
||||
|
||||
this._onDidChangeTreeData.fire();
|
||||
this._onDidChangeTreeData.fire(undefined);
|
||||
}
|
||||
|
||||
@RegisterCommand('addConnection')
|
||||
|
@ -1,6 +1,8 @@
|
||||
import { getFirstValidPathFromCommand, getWorkspaceConnectionConfig, getWorkspacePath, McpOptions, panels, saveWorkspaceConnectionConfig } from "../global";
|
||||
import { getFirstValidPathFromCommand, getWorkspaceConnectionConfig, getWorkspacePath, McpOptions, panels, saveWorkspaceConnectionConfig } from "../global.js";
|
||||
import * as vscode from 'vscode';
|
||||
import { t } from "../i18n";
|
||||
import { t } from "../i18n/index.js";
|
||||
import { exec } from 'child_process';
|
||||
import { promisify } from 'util';
|
||||
|
||||
export async function deleteUserConnection(item: McpOptions[] | McpOptions) {
|
||||
// 弹出确认对话框
|
||||
@ -45,8 +47,7 @@ export async function deleteUserConnection(item: McpOptions[] | McpOptions) {
|
||||
}
|
||||
|
||||
export async function validateAndGetCommandPath(command: string, cwd?: string): Promise<string> {
|
||||
const { exec } = require('child_process');
|
||||
const { promisify } = require('util');
|
||||
|
||||
const execAsync = promisify(exec);
|
||||
|
||||
try {
|
||||
|
@ -1,7 +1,7 @@
|
||||
import * as vscode from 'vscode';
|
||||
import { RegisterCommand } from "../common";
|
||||
import { getDefaultLanunchSignature, getWorkspacePath, revealOpenMcpWebviewPanel } from './webview.service';
|
||||
import { getWorkspaceConnectionConfigItemByPath } from '../global';
|
||||
import { RegisterCommand } from "../common/index.js";
|
||||
import { getDefaultLanunchSignature, getWorkspacePath, revealOpenMcpWebviewPanel } from './webview.service.js';
|
||||
import { getWorkspaceConnectionConfigItemByPath } from '../global.js';
|
||||
import path from 'path';
|
||||
|
||||
export class WebviewController {
|
||||
|
@ -1,8 +1,8 @@
|
||||
import * as vscode from 'vscode';
|
||||
import * as fs from 'fs';
|
||||
import * as fspath from 'path';
|
||||
import { ConnectionType, McpOptions, panels, updateInstalledConnectionConfig, updateWorkspaceConnectionConfig } from '../global';
|
||||
import { routeMessage } from '../../openmcp-sdk/service';
|
||||
import { ConnectionType, McpOptions, panels, updateInstalledConnectionConfig, updateWorkspaceConnectionConfig } from '../global.js';
|
||||
import { routeMessage } from '../../openmcp-sdk/service/index.js';
|
||||
|
||||
export function getWebviewContent(context: vscode.ExtensionContext, panel: vscode.WebviewPanel): string | undefined {
|
||||
const viewRoot = fspath.join(context.extensionPath, 'openmcp-sdk', 'renderer');
|
||||
@ -45,7 +45,7 @@ export function revealOpenMcpWebviewPanel(
|
||||
|
||||
// 对老版本的 option 进行调整
|
||||
option = Array.isArray(option)? option : [option];
|
||||
option.forEach(item => {
|
||||
option.forEach((item: McpOptions) => {
|
||||
const itemType = (item.type || item.connectionType).toUpperCase() as ConnectionType;
|
||||
item.type = undefined;
|
||||
item.connectionType = itemType;
|
||||
|
@ -1,7 +1,8 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"target": "ES6",
|
||||
"module": "NodeNext",
|
||||
"moduleResolution": "NodeNext",
|
||||
"outDir": "./dist",
|
||||
"rootDir": "./src",
|
||||
"strict": true,
|
||||
|
@ -1,50 +0,0 @@
|
||||
//@ts-check
|
||||
|
||||
'use strict';
|
||||
|
||||
const path = require('path');
|
||||
|
||||
//@ts-check
|
||||
/** @typedef {import('webpack').Configuration} WebpackConfig **/
|
||||
|
||||
/** @type WebpackConfig */
|
||||
const extensionConfig = {
|
||||
target: 'node', // VS Code extensions run in a Node.js-context 📖 -> https://webpack.js.org/configuration/node/
|
||||
mode: 'none', // this leaves the source code as close as possible to the original (when packaging we set this to 'production')
|
||||
|
||||
entry: './src/extension.ts', // the entry point of this extension, 📖 -> https://webpack.js.org/configuration/entry-context/
|
||||
output: {
|
||||
// the bundle is stored in the 'dist' folder (check package.json), 📖 -> https://webpack.js.org/configuration/output/
|
||||
path: path.resolve(__dirname, 'dist'),
|
||||
filename: 'extension.js',
|
||||
libraryTarget: 'commonjs2'
|
||||
},
|
||||
externals: {
|
||||
vscode: 'commonjs vscode' // the vscode-module is created on-the-fly and must be excluded. Add other modules that cannot be webpack'ed, 📖 -> https://webpack.js.org/configuration/externals/
|
||||
// modules added here also need to be added in the .vscodeignore file
|
||||
},
|
||||
resolve: {
|
||||
// support reading TypeScript and JavaScript files, 📖 -> https://github.com/TypeStrong/ts-loader
|
||||
extensions: ['.ts', '.js'],
|
||||
fallback: {
|
||||
bufferutil: false,
|
||||
'utf-8-validate': false
|
||||
}
|
||||
},
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.ts$/,
|
||||
exclude: /node_modules/,
|
||||
use: [
|
||||
{
|
||||
loader: 'ts-loader'
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
infrastructureLogging: {
|
||||
level: "log", // enables logging required for problem matchers
|
||||
},
|
||||
}; module.exports = [extensionConfig];
|
@ -1,63 +0,0 @@
|
||||
import { defineConfig, normalizePath } from 'vite';
|
||||
import { resolve } from 'path';
|
||||
import { viteStaticCopy } from 'vite-plugin-static-copy';
|
||||
|
||||
export default defineConfig({
|
||||
define: {
|
||||
'window': {
|
||||
'nodejs': true,
|
||||
'navigator': {
|
||||
'userAgent': 2
|
||||
},
|
||||
'performance': {
|
||||
'now': () => performance.now()
|
||||
},
|
||||
'Date': {
|
||||
'now': () => Date.now()
|
||||
}
|
||||
},
|
||||
},
|
||||
plugins: [
|
||||
viteStaticCopy({
|
||||
targets: [
|
||||
{
|
||||
src: normalizePath(resolve(__dirname, '../resources/openmcp-sdk-release/*')),
|
||||
dest: normalizePath(resolve(__dirname, '../openmcp-sdk'))
|
||||
}
|
||||
]
|
||||
})
|
||||
],
|
||||
build: {
|
||||
target: 'node18',
|
||||
lib: {
|
||||
entry: resolve(__dirname, '..', 'renderer/src/components/main-panel/chat/core/task-loop.ts'),
|
||||
name: 'TaskLoop',
|
||||
fileName: 'task-loop',
|
||||
formats: ['cjs']
|
||||
},
|
||||
outDir: resolve(__dirname, '..', 'openmcp-sdk'),
|
||||
emptyOutDir: false,
|
||||
rollupOptions: {
|
||||
external: [
|
||||
'vue',
|
||||
'chalk',
|
||||
'element-plus',
|
||||
],
|
||||
output: {
|
||||
globals: {
|
||||
vue: 'vue',
|
||||
chalk: 'chalk',
|
||||
'element-plus': './tools.js'
|
||||
},
|
||||
esModule: true
|
||||
}
|
||||
},
|
||||
minify: false,
|
||||
sourcemap: false
|
||||
},
|
||||
resolve: {
|
||||
alias: {
|
||||
'@': resolve(__dirname, '..', 'renderer/src'),
|
||||
}
|
||||
}
|
||||
});
|
@ -1,80 +0,0 @@
|
||||
const path = require('path');
|
||||
const TerserPlugin = require('terser-webpack-plugin');
|
||||
const webpack = require('webpack');
|
||||
const CopyWebpackPlugin = require('copy-webpack-plugin');
|
||||
|
||||
module.exports = {
|
||||
mode: 'development', // 设置为 development 模式
|
||||
devtool: 'source-map', // 生成 source map 以便调试
|
||||
entry: './renderer/src/components/main-panel/chat/core/task-loop.ts',
|
||||
output: {
|
||||
path: path.resolve(__dirname, '../openmcp-sdk'),
|
||||
filename: 'task-loop.js',
|
||||
libraryTarget: 'commonjs2'
|
||||
},
|
||||
target: 'node',
|
||||
resolve: {
|
||||
extensions: ['.ts', '.js'],
|
||||
alias: {
|
||||
'@': path.resolve(__dirname, '../renderer/src'), // 修正路径别名
|
||||
},
|
||||
},
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.ts$/,
|
||||
use: {
|
||||
loader: 'ts-loader',
|
||||
options: {
|
||||
configFile: path.resolve(__dirname, '../tsconfig.json') // 指定 tsconfig.json 路径
|
||||
}
|
||||
},
|
||||
exclude: /node_modules/,
|
||||
},
|
||||
{
|
||||
test: /\.vue$/,
|
||||
use: {
|
||||
loader: 'null-loader'
|
||||
}
|
||||
}
|
||||
],
|
||||
},
|
||||
optimization: {
|
||||
minimize: true, // Enable code compression
|
||||
minimizer: [
|
||||
new TerserPlugin({
|
||||
extractComments: false, // Disable extracting license files
|
||||
terserOptions: {
|
||||
compress: {
|
||||
drop_console: true, // Remove all console.* calls
|
||||
},
|
||||
},
|
||||
}),
|
||||
],
|
||||
},
|
||||
plugins: [
|
||||
new webpack.DefinePlugin({
|
||||
window: {
|
||||
nodejs: true,
|
||||
navigator: {
|
||||
userAgent: 2
|
||||
},
|
||||
performance: {
|
||||
now: () => Date.now()
|
||||
}
|
||||
}
|
||||
}),
|
||||
new CopyWebpackPlugin({
|
||||
patterns: [
|
||||
{
|
||||
from: path.resolve(__dirname, '../resources/openmcp-sdk-release'),
|
||||
to: path.resolve(__dirname, '../openmcp-sdk')
|
||||
}
|
||||
]
|
||||
})
|
||||
],
|
||||
externals: {
|
||||
vue: 'vue', // 不打包 vue 库
|
||||
'element-plus': './tools.js'
|
||||
},
|
||||
};
|
@ -1,43 +0,0 @@
|
||||
const path = require('path');
|
||||
const CopyWebpackPlugin = require('copy-webpack-plugin');
|
||||
|
||||
module.exports = {
|
||||
entry: './node_modules/tesseract.js/src/worker-script/node/index.js',
|
||||
output: {
|
||||
path: path.resolve(__dirname, '..', 'resources', 'ocr'),
|
||||
filename: 'worker.js',
|
||||
libraryTarget: 'commonjs2'
|
||||
},
|
||||
resolve: {
|
||||
fallback: {
|
||||
bufferutil: false,
|
||||
'utf-8-validate': false
|
||||
}
|
||||
},
|
||||
mode: 'production',
|
||||
target: 'node',
|
||||
plugins: [
|
||||
new CopyWebpackPlugin({
|
||||
patterns: [
|
||||
{
|
||||
from: path.resolve(__dirname, '..', 'node_modules', 'tesseract.js-core', 'tesseract*'),
|
||||
to: path.resolve(__dirname, '..', 'resources', 'ocr', '[name][ext]'),
|
||||
},
|
||||
],
|
||||
}),
|
||||
],
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.js$/,
|
||||
exclude: /node_modules/,
|
||||
use: {
|
||||
loader: 'babel-loader',
|
||||
options: {
|
||||
presets: ['@babel/preset-env'],
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
Loading…
x
Reference in New Issue
Block a user