@trops/dash-core 0.1.79 → 0.1.81

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.
@@ -4568,7 +4568,12 @@ function requireProviderController () {
4568
4568
  // Load MCP catalog for merging new config fields into saved providers
4569
4569
  let catalog = [];
4570
4570
  try {
4571
- const catalogPath = path.join(__dirname, "..", "mcp", "mcpServerCatalog.json");
4571
+ const catalogPath = path.join(
4572
+ __dirname,
4573
+ "..",
4574
+ "mcp",
4575
+ "mcpServerCatalog.json",
4576
+ );
4572
4577
  if (existsSync(catalogPath)) {
4573
4578
  const catalogData = JSON.parse(readFileSync(catalogPath, "utf-8"));
4574
4579
  catalog = catalogData.servers || [];
@@ -4602,9 +4607,12 @@ function requireProviderController () {
4602
4607
  // (providers snapshot mcpConfig at creation time; this ensures
4603
4608
  // existing providers pick up new catalog features like argsMapping)
4604
4609
  if (!data.mcpConfig.argsMapping && data.type) {
4605
- const catalogEntry = catalog.find((entry) => entry.id === data.type);
4610
+ const catalogEntry = catalog.find(
4611
+ (entry) => entry.id === data.type,
4612
+ );
4606
4613
  if (catalogEntry?.mcpConfig?.argsMapping) {
4607
- provider.mcpConfig.argsMapping = catalogEntry.mcpConfig.argsMapping;
4614
+ provider.mcpConfig.argsMapping =
4615
+ catalogEntry.mcpConfig.argsMapping;
4608
4616
  }
4609
4617
  }
4610
4618
  }
@@ -5168,6 +5176,30 @@ const mcpController$2 = {
5168
5176
  await mcpController$2.stopServer(win, serverName);
5169
5177
  }
5170
5178
 
5179
+ // Merge with catalog entry to pick up updated command/args
5180
+ // (saved provider config may reference a stale or archived package)
5181
+ try {
5182
+ const { catalog } = mcpController$2.getCatalog(win);
5183
+ const catalogEntry = (catalog || []).find(
5184
+ (entry) => entry.name === serverName,
5185
+ );
5186
+ if (catalogEntry?.mcpConfig) {
5187
+ const cat = catalogEntry.mcpConfig;
5188
+ if (cat.command) mcpConfig.command = cat.command;
5189
+ if (cat.args) mcpConfig.args = [...cat.args];
5190
+ if (cat.staticEnv) mcpConfig.staticEnv = cat.staticEnv;
5191
+ if (cat.tokenRefresh) mcpConfig.tokenRefresh = cat.tokenRefresh;
5192
+ if (cat.envMapping) {
5193
+ mcpConfig.envMapping = {
5194
+ ...mcpConfig.envMapping,
5195
+ ...cat.envMapping,
5196
+ };
5197
+ }
5198
+ }
5199
+ } catch (catalogErr) {
5200
+ // Non-fatal: proceed with saved config if catalog lookup fails
5201
+ }
5202
+
5171
5203
  console.log(
5172
5204
  `[mcpController] Starting server: ${serverName} (transport: ${
5173
5205
  mcpConfig.transport || "stdio"
@@ -5739,8 +5771,16 @@ const mcpController$2 = {
5739
5771
  });
5740
5772
  }
5741
5773
 
5774
+ // Interpolate {{MCP_DIR}} in authCommand args (same as startServer)
5775
+ const mcpDir = path$6.join(__dirname, "..", "mcp");
5776
+ const resolvedArgs = (authCommand.args || []).map((arg) =>
5777
+ typeof arg === "string" && arg.includes("{{MCP_DIR}}")
5778
+ ? arg.replace(/\{\{MCP_DIR\}\}/g, mcpDir)
5779
+ : arg,
5780
+ );
5781
+
5742
5782
  return new Promise((resolve) => {
5743
- const proc = spawn(authCommand.command, authCommand.args || [], {
5783
+ const proc = spawn(authCommand.command, resolvedArgs, {
5744
5784
  env,
5745
5785
  stdio: ["ignore", "pipe", "pipe"],
5746
5786
  });
@@ -8783,11 +8823,11 @@ let _nextListenerId = 0;
8783
8823
  const _listenerMap = new Map();
8784
8824
 
8785
8825
  function _addListener(channel, callback) {
8786
- const id = String(++_nextListenerId);
8787
- const wrapped = (_event, data) => callback(data);
8788
- ipcRenderer$2.on(channel, wrapped);
8789
- _listenerMap.set(id, { channel, wrapped });
8790
- return id;
8826
+ const id = String(++_nextListenerId);
8827
+ const wrapped = (_event, data) => callback(data);
8828
+ ipcRenderer$2.on(channel, wrapped);
8829
+ _listenerMap.set(id, { channel, wrapped });
8830
+ return id;
8791
8831
  }
8792
8832
 
8793
8833
  const llmApi$2 = {
@@ -10080,9 +10120,7 @@ var dynamicWidgetLoaderExports = dynamicWidgetLoader$2.exports;
10080
10120
  try {
10081
10121
  const head = fs.readFileSync(candidate, "utf8").slice(0, 256);
10082
10122
  if (/^\s*(import\s|export\s)/m.test(head)) {
10083
- console.log(
10084
- `[WidgetRegistry] Skipping ESM bundle: ${candidate}`,
10085
- );
10123
+ console.log(`[WidgetRegistry] Skipping ESM bundle: ${candidate}`);
10086
10124
  continue;
10087
10125
  }
10088
10126
  } catch (_) {