@trops/dash-core 0.1.411 → 0.1.412
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 +42 -4
- package/dist/electron/index.js.map +1 -1
- package/package.json +1 -1
package/dist/electron/index.js
CHANGED
|
@@ -51663,15 +51663,26 @@ const cliController$2 = {
|
|
|
51663
51663
|
|
|
51664
51664
|
// Auto-wire the hosted Dash MCP server so the assistant can use Dash
|
|
51665
51665
|
// tools (apply_theme, create_dashboard, add_widget, etc.) without
|
|
51666
|
-
// the user running `claude mcp add dash ...` themselves. We
|
|
51667
|
-
//
|
|
51668
|
-
//
|
|
51666
|
+
// the user running `claude mcp add dash ...` themselves. We write
|
|
51667
|
+
// the JSON to a short-lived temp file and pass its path via
|
|
51668
|
+
// --mcp-config; merges with any user-configured MCPs so their
|
|
51669
|
+
// other tools (github, slack, etc.) remain available.
|
|
51670
|
+
//
|
|
51671
|
+
// We use a file, not inline JSON, because the inline form is
|
|
51672
|
+
// fragile on Windows: shell:true hands the arg to cmd.exe which
|
|
51673
|
+
// tokenizes on embedded whitespace inside the JSON (notably in
|
|
51674
|
+
// "Authorization: Bearer <UUID>" and the URL). Even with proper
|
|
51675
|
+
// windowsQuote escaping, cmd.exe's `""` handling inside /d /s /c
|
|
51676
|
+
// drops tokens — the user sees "MCP config file not found" with
|
|
51677
|
+
// fragments of the JSON prepended to cwd. Writing the JSON to a
|
|
51678
|
+
// file avoids every layer of that problem.
|
|
51669
51679
|
//
|
|
51670
51680
|
// Prereqs: the Dash MCP server is running and has issued a bearer
|
|
51671
51681
|
// token. If either is missing (server disabled, first launch before
|
|
51672
51682
|
// auto-start completes), we silently skip — the assistant still
|
|
51673
51683
|
// works for non-Dash queries, and the setup banner remains visible
|
|
51674
51684
|
// as a manual fallback.
|
|
51685
|
+
let mcpConfigFilePath = null;
|
|
51675
51686
|
try {
|
|
51676
51687
|
const mcpDashServerController = mcpDashServerController_1;
|
|
51677
51688
|
const status = mcpDashServerController.getStatus?.(win);
|
|
@@ -51694,7 +51705,18 @@ const cliController$2 = {
|
|
|
51694
51705
|
},
|
|
51695
51706
|
},
|
|
51696
51707
|
});
|
|
51697
|
-
|
|
51708
|
+
const os = require("os");
|
|
51709
|
+
const path = require("path");
|
|
51710
|
+
const fs = require("fs");
|
|
51711
|
+
// Unique per-request filename so concurrent assistant calls
|
|
51712
|
+
// don't race on the same file. The token is sensitive, so
|
|
51713
|
+
// mode 0600 — owner read/write only.
|
|
51714
|
+
mcpConfigFilePath = path.join(
|
|
51715
|
+
os.tmpdir(),
|
|
51716
|
+
`dash-mcp-config-${requestId}.json`,
|
|
51717
|
+
);
|
|
51718
|
+
fs.writeFileSync(mcpConfigFilePath, mcpConfig, { mode: 0o600 });
|
|
51719
|
+
args.push("--mcp-config", mcpConfigFilePath);
|
|
51698
51720
|
}
|
|
51699
51721
|
}
|
|
51700
51722
|
} catch (err) {
|
|
@@ -51705,6 +51727,19 @@ const cliController$2 = {
|
|
|
51705
51727
|
);
|
|
51706
51728
|
}
|
|
51707
51729
|
|
|
51730
|
+
// Best-effort cleanup of the temp MCP config file. Called from
|
|
51731
|
+
// both child exit handlers and the outer catch. Safe to call
|
|
51732
|
+
// multiple times — becomes a no-op after the first unlink.
|
|
51733
|
+
const cleanupMcpConfigFile = () => {
|
|
51734
|
+
if (!mcpConfigFilePath) return;
|
|
51735
|
+
try {
|
|
51736
|
+
require("fs").unlinkSync(mcpConfigFilePath);
|
|
51737
|
+
} catch {
|
|
51738
|
+
// File may already be gone; ignore.
|
|
51739
|
+
}
|
|
51740
|
+
mcpConfigFilePath = null;
|
|
51741
|
+
};
|
|
51742
|
+
|
|
51708
51743
|
if (model) {
|
|
51709
51744
|
args.push("--model", model);
|
|
51710
51745
|
}
|
|
@@ -51908,6 +51943,7 @@ const cliController$2 = {
|
|
|
51908
51943
|
});
|
|
51909
51944
|
|
|
51910
51945
|
child.on("error", (err) => {
|
|
51946
|
+
cleanupMcpConfigFile();
|
|
51911
51947
|
activeProcesses.delete(requestId);
|
|
51912
51948
|
safeSend(win, LLM_STREAM_ERROR$2, {
|
|
51913
51949
|
requestId,
|
|
@@ -51917,6 +51953,7 @@ const cliController$2 = {
|
|
|
51917
51953
|
});
|
|
51918
51954
|
|
|
51919
51955
|
child.on("close", (code) => {
|
|
51956
|
+
cleanupMcpConfigFile();
|
|
51920
51957
|
activeProcesses.delete(requestId);
|
|
51921
51958
|
|
|
51922
51959
|
// Process any remaining buffer
|
|
@@ -51980,6 +52017,7 @@ const cliController$2 = {
|
|
|
51980
52017
|
}
|
|
51981
52018
|
});
|
|
51982
52019
|
} catch (err) {
|
|
52020
|
+
cleanupMcpConfigFile();
|
|
51983
52021
|
activeProcesses.delete(requestId);
|
|
51984
52022
|
safeSend(win, LLM_STREAM_ERROR$2, {
|
|
51985
52023
|
requestId,
|