@trops/dash-core 0.1.63 → 0.1.65
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/dist/electron/index.js +32 -9
- package/dist/electron/index.js.map +1 -1
- package/package.json +1 -1
package/dist/electron/index.js
CHANGED
|
@@ -4904,10 +4904,21 @@ function getShellPath$1() {
|
|
|
4904
4904
|
|
|
4905
4905
|
try {
|
|
4906
4906
|
const shell = process.env.SHELL || "/bin/bash";
|
|
4907
|
-
|
|
4908
|
-
|
|
4909
|
-
|
|
4910
|
-
|
|
4907
|
+
const marker = "__DASH_PATH__";
|
|
4908
|
+
const raw = execSync(
|
|
4909
|
+
`${shell} -ilc 'echo "${marker}$PATH${marker}"'`,
|
|
4910
|
+
{ encoding: "utf8", timeout: 5000 },
|
|
4911
|
+
);
|
|
4912
|
+
// Extract PATH between markers, stripping session restore noise
|
|
4913
|
+
const startIdx = raw.indexOf(marker);
|
|
4914
|
+
const endIdx = raw.lastIndexOf(marker);
|
|
4915
|
+
if (startIdx !== -1 && endIdx > startIdx) {
|
|
4916
|
+
_shellPath$1 = raw
|
|
4917
|
+
.substring(startIdx + marker.length, endIdx)
|
|
4918
|
+
.replace(/[\r\n]/g, "");
|
|
4919
|
+
} else {
|
|
4920
|
+
_shellPath$1 = process.env.PATH || "";
|
|
4921
|
+
}
|
|
4911
4922
|
} catch (err) {
|
|
4912
4923
|
console.warn("[mcpController] Failed to resolve shell PATH:", err.message);
|
|
4913
4924
|
_shellPath$1 = process.env.PATH || "";
|
|
@@ -4943,6 +4954,21 @@ function getShellPath$1() {
|
|
|
4943
4954
|
return _shellPath$1;
|
|
4944
4955
|
}
|
|
4945
4956
|
|
|
4957
|
+
/**
|
|
4958
|
+
* Create a clean environment for MCP child processes.
|
|
4959
|
+
* Strips npm_* and ELECTRON_* vars that would force the child
|
|
4960
|
+
* to use Electron's or npm's Node binary instead of the PATH one.
|
|
4961
|
+
*/
|
|
4962
|
+
function cleanEnvForChildProcess() {
|
|
4963
|
+
const env = {};
|
|
4964
|
+
for (const [key, value] of Object.entries(process.env)) {
|
|
4965
|
+
if (key.startsWith("npm_") || key.startsWith("ELECTRON_")) continue;
|
|
4966
|
+
env[key] = value;
|
|
4967
|
+
}
|
|
4968
|
+
env.PATH = getShellPath$1();
|
|
4969
|
+
return env;
|
|
4970
|
+
}
|
|
4971
|
+
|
|
4946
4972
|
/**
|
|
4947
4973
|
* Active MCP server connections
|
|
4948
4974
|
* Map<string, { client: Client, transport: Transport, tools: Array, status: string }>
|
|
@@ -5055,10 +5081,7 @@ const mcpController$2 = {
|
|
|
5055
5081
|
});
|
|
5056
5082
|
} else {
|
|
5057
5083
|
// stdio transport (default) - spawn a local child process
|
|
5058
|
-
const env =
|
|
5059
|
-
// Ensure full shell PATH is available (Electron GUI apps
|
|
5060
|
-
// on macOS don't inherit nvm/homebrew paths)
|
|
5061
|
-
env.PATH = getShellPath$1();
|
|
5084
|
+
const env = cleanEnvForChildProcess();
|
|
5062
5085
|
if (mcpConfig.envMapping && credentials) {
|
|
5063
5086
|
Object.entries(mcpConfig.envMapping).forEach(
|
|
5064
5087
|
([envVar, credentialKey]) => {
|
|
@@ -5499,7 +5522,7 @@ const mcpController$2 = {
|
|
|
5499
5522
|
runAuth: async (win, mcpConfig, credentials, authCommand) => {
|
|
5500
5523
|
const { spawn } = require$$5$2;
|
|
5501
5524
|
|
|
5502
|
-
const env =
|
|
5525
|
+
const env = cleanEnvForChildProcess();
|
|
5503
5526
|
|
|
5504
5527
|
// Inject credentials as env vars using the same envMapping as startServer
|
|
5505
5528
|
if (mcpConfig?.envMapping && credentials) {
|