@trops/dash-core 0.1.54 → 0.1.56

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.
@@ -18,12 +18,12 @@ var require$$8 = require('https');
18
18
  var require$$0$2 = require('@modelcontextprotocol/sdk/client/index.js');
19
19
  var require$$1$3 = require('@modelcontextprotocol/sdk/client/stdio.js');
20
20
  var require$$2$3 = require('@modelcontextprotocol/sdk/client/streamableHttp.js');
21
+ var require$$5$2 = require('child_process');
21
22
  var require$$2$4 = require('algoliasearch');
22
23
  var require$$3$2 = require('node:path');
23
24
  var require$$0$3 = require('openai');
24
25
  require('live-plugin-manager');
25
- var require$$0$5 = require('@anthropic-ai/sdk');
26
- var require$$0$4 = require('child_process');
26
+ var require$$0$4 = require('@anthropic-ai/sdk');
27
27
  var require$$2$6 = require('os');
28
28
  var require$$3$3 = require('adm-zip');
29
29
  var require$$4$1 = require('url');
@@ -379,6 +379,10 @@ const MCP_GET_CATALOG$1 = "mcp-get-catalog";
379
379
  const MCP_GET_CATALOG_COMPLETE = "mcp-get-catalog-complete";
380
380
  const MCP_GET_CATALOG_ERROR = "mcp-get-catalog-error";
381
381
 
382
+ const MCP_RUN_AUTH$1 = "mcp-run-auth";
383
+ const MCP_RUN_AUTH_COMPLETE = "mcp-run-auth-complete";
384
+ const MCP_RUN_AUTH_ERROR = "mcp-run-auth-error";
385
+
382
386
  var mcpEvents$1 = {
383
387
  MCP_START_SERVER: MCP_START_SERVER$1,
384
388
  MCP_START_SERVER_COMPLETE,
@@ -404,6 +408,9 @@ var mcpEvents$1 = {
404
408
  MCP_GET_CATALOG: MCP_GET_CATALOG$1,
405
409
  MCP_GET_CATALOG_COMPLETE,
406
410
  MCP_GET_CATALOG_ERROR,
411
+ MCP_RUN_AUTH: MCP_RUN_AUTH$1,
412
+ MCP_RUN_AUTH_COMPLETE,
413
+ MCP_RUN_AUTH_ERROR,
407
414
  };
408
415
 
409
416
  /**
@@ -4828,10 +4835,7 @@ let _shellPath$1 = null;
4828
4835
  function getShellPath$1() {
4829
4836
  if (_shellPath$1 !== null) return _shellPath$1;
4830
4837
 
4831
- const fallbackDirs = [
4832
- "/usr/local/bin",
4833
- "/opt/homebrew/bin",
4834
- ];
4838
+ const fallbackDirs = ["/usr/local/bin", "/opt/homebrew/bin"];
4835
4839
 
4836
4840
  // Add nvm/volta/nodenv paths if available
4837
4841
  const home = process.env.HOME || "";
@@ -5406,6 +5410,59 @@ const mcpController$2 = {
5406
5410
  return servers;
5407
5411
  },
5408
5412
 
5413
+ /**
5414
+ * runAuth
5415
+ * Run a one-shot auth command (e.g., OAuth browser flow) for an MCP server
5416
+ *
5417
+ * @param {BrowserWindow} win the main window
5418
+ * @param {object} mcpConfig { transport, command, args, envMapping }
5419
+ * @param {object} credentials decrypted credentials object
5420
+ * @param {object} authCommand { command, args }
5421
+ * @returns {{ success } | { error, message }}
5422
+ */
5423
+ runAuth: async (win, mcpConfig, credentials, authCommand) => {
5424
+ const { spawn } = require$$5$2;
5425
+
5426
+ const env = { ...process.env, PATH: getShellPath$1() };
5427
+
5428
+ // Inject credentials as env vars using the same envMapping as startServer
5429
+ if (mcpConfig?.envMapping && credentials) {
5430
+ Object.entries(mcpConfig.envMapping).forEach(
5431
+ ([envVar, credentialKey]) => {
5432
+ if (credentials[credentialKey] !== undefined) {
5433
+ env[envVar] = credentials[credentialKey];
5434
+ }
5435
+ },
5436
+ );
5437
+ }
5438
+
5439
+ return new Promise((resolve) => {
5440
+ const proc = spawn(authCommand.command, authCommand.args || [], {
5441
+ env,
5442
+ stdio: ["ignore", "pipe", "pipe"],
5443
+ });
5444
+
5445
+ const timeout = setTimeout(() => {
5446
+ proc.kill();
5447
+ resolve({ error: true, message: "Auth timed out (120s)" });
5448
+ }, 120000);
5449
+
5450
+ proc.on("close", (code) => {
5451
+ clearTimeout(timeout);
5452
+ resolve(
5453
+ code === 0
5454
+ ? { success: true }
5455
+ : { error: true, message: `Auth exited with code ${code}` },
5456
+ );
5457
+ });
5458
+
5459
+ proc.on("error", (err) => {
5460
+ clearTimeout(timeout);
5461
+ resolve({ error: true, message: err.message });
5462
+ });
5463
+ });
5464
+ },
5465
+
5409
5466
  /**
5410
5467
  * stopAllServers
5411
5468
  * Stop all running MCP servers (called on app quit)
@@ -6366,7 +6423,7 @@ var pluginController_1 = pluginController$1;
6366
6423
  * can use the Chat widget without a separate API key.
6367
6424
  */
6368
6425
 
6369
- const { spawn, execSync } = require$$0$4;
6426
+ const { spawn, execSync } = require$$5$2;
6370
6427
  const {
6371
6428
  LLM_STREAM_DELTA: LLM_STREAM_DELTA$2,
6372
6429
  LLM_STREAM_TOOL_CALL: LLM_STREAM_TOOL_CALL$2,
@@ -6798,7 +6855,7 @@ var cliController_1 = cliController$2;
6798
6855
  * per-request, receiving the full messages array each time.
6799
6856
  */
6800
6857
 
6801
- const Anthropic = require$$0$5;
6858
+ const Anthropic = require$$0$4;
6802
6859
  const mcpController$1 = mcpController_1;
6803
6860
  const cliController$1 = cliController_1;
6804
6861
  const {
@@ -8015,6 +8072,7 @@ const {
8015
8072
  MCP_READ_RESOURCE,
8016
8073
  MCP_SERVER_STATUS,
8017
8074
  MCP_GET_CATALOG,
8075
+ MCP_RUN_AUTH,
8018
8076
  } = events$8;
8019
8077
 
8020
8078
  const mcpApi$2 = {
@@ -8109,6 +8167,18 @@ const mcpApi$2 = {
8109
8167
  * @returns {Promise<{ catalog } | { error, message }>}
8110
8168
  */
8111
8169
  getCatalog: () => ipcRenderer$9.invoke(MCP_GET_CATALOG),
8170
+
8171
+ /**
8172
+ * runAuth
8173
+ * Run a one-shot auth command for an MCP server (e.g., OAuth browser flow)
8174
+ *
8175
+ * @param {object} mcpConfig { transport, command, args, envMapping }
8176
+ * @param {object} credentials decrypted credentials object
8177
+ * @param {object} authCommand { command, args }
8178
+ * @returns {Promise<{ success } | { error, message }>}
8179
+ */
8180
+ runAuth: (mcpConfig, credentials, authCommand) =>
8181
+ ipcRenderer$9.invoke(MCP_RUN_AUTH, { mcpConfig, credentials, authCommand }),
8112
8182
  };
8113
8183
 
8114
8184
  var mcpApi_1 = mcpApi$2;