@mindstudio-ai/local-model-tunnel 0.5.68 → 0.5.69

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.
@@ -26,7 +26,7 @@ import {
26
26
  syncSchema,
27
27
  watchManifestFiles,
28
28
  watchTableFiles
29
- } from "./chunk-DE6EFRG6.js";
29
+ } from "./chunk-YYDTRACW.js";
30
30
 
31
31
  // src/dev/browser/launcher.ts
32
32
  import puppeteer from "puppeteer-core";
@@ -1466,4 +1466,4 @@ async function startHeadless(opts = {}) {
1466
1466
  export {
1467
1467
  startHeadless
1468
1468
  };
1469
- //# sourceMappingURL=chunk-JUSG4OJ7.js.map
1469
+ //# sourceMappingURL=chunk-MWGHX2WY.js.map
@@ -7,7 +7,7 @@ import {
7
7
  setProviderInstallPath,
8
8
  submitProgress,
9
9
  submitResult
10
- } from "./chunk-DE6EFRG6.js";
10
+ } from "./chunk-YYDTRACW.js";
11
11
 
12
12
  // src/providers/ollama/index.ts
13
13
  import { Ollama } from "ollama";
@@ -1395,4 +1395,4 @@ export {
1395
1395
  requestEvents,
1396
1396
  TunnelRunner
1397
1397
  };
1398
- //# sourceMappingURL=chunk-745MM3DC.js.map
1398
+ //# sourceMappingURL=chunk-XAOWX4ML.js.map
@@ -1513,6 +1513,57 @@ function readApiConfig(projectRoot, appConfig) {
1513
1513
  return parsed.api;
1514
1514
  }
1515
1515
 
1516
+ // src/dev/interfaces/mcp-config.ts
1517
+ import { readFileSync as readFileSync6 } from "fs";
1518
+ import { join as join8, dirname as dirname5 } from "path";
1519
+ function readMcpConfig(projectRoot, appConfig) {
1520
+ const mcpInterface = appConfig.interfaces.find(
1521
+ (i) => i.type === "mcp" && i.enabled !== false
1522
+ );
1523
+ if (!mcpInterface) {
1524
+ throw new Error("No MCP interface configured in mindstudio.json");
1525
+ }
1526
+ const configPath = join8(projectRoot, mcpInterface.path);
1527
+ let raw;
1528
+ try {
1529
+ raw = readFileSync6(configPath, "utf-8");
1530
+ } catch {
1531
+ throw new Error(
1532
+ `MCP config not found at ${mcpInterface.path} \u2014 run your build command`
1533
+ );
1534
+ }
1535
+ const parsed = JSON.parse(raw);
1536
+ const config2 = parsed.mcp ?? parsed;
1537
+ const mcpDir = dirname5(configPath);
1538
+ const readRef = (rel, label) => {
1539
+ try {
1540
+ return readFileSync6(join8(mcpDir, rel), "utf-8");
1541
+ } catch {
1542
+ throw new Error(`MCP ${label} not found at ${rel} \u2014 run your build command`);
1543
+ }
1544
+ };
1545
+ const instructions = config2.instructions ? readRef(config2.instructions, "instructions") : "";
1546
+ const tools = (config2.tools ?? []).map(
1547
+ (tool) => ({
1548
+ ...tool,
1549
+ description: readRef(tool.description, `tool description for "${tool.method}"`)
1550
+ })
1551
+ );
1552
+ const prompts = (config2.prompts ?? []).map(
1553
+ (prompt) => ({
1554
+ ...prompt,
1555
+ template: readRef(prompt.template, `prompt template for "${prompt.name}"`)
1556
+ })
1557
+ );
1558
+ return {
1559
+ ...config2,
1560
+ instructions,
1561
+ tools,
1562
+ prompts,
1563
+ resources: config2.resources ?? []
1564
+ };
1565
+ }
1566
+
1516
1567
  // src/dev/interfaces/read-config.ts
1517
1568
  function readConfig(projectRoot, appConfig) {
1518
1569
  let agent = null;
@@ -1531,11 +1582,20 @@ function readConfig(projectRoot, appConfig) {
1531
1582
  error: err instanceof Error ? err.message : String(err)
1532
1583
  });
1533
1584
  }
1585
+ let mcp = null;
1586
+ try {
1587
+ mcp = readMcpConfig(projectRoot, appConfig);
1588
+ } catch (err) {
1589
+ log.debug("config", "MCP config not available", {
1590
+ error: err instanceof Error ? err.message : String(err)
1591
+ });
1592
+ }
1534
1593
  return {
1535
1594
  name: appConfig.name,
1536
1595
  auth: appConfig.auth ?? null,
1537
1596
  agent,
1538
- api
1597
+ api,
1598
+ mcp
1539
1599
  };
1540
1600
  }
1541
1601
 
@@ -3392,13 +3452,13 @@ ${agentScript}`;
3392
3452
  };
3393
3453
 
3394
3454
  // src/dev/config/app-config.ts
3395
- import { readFileSync as readFileSync6, existsSync as existsSync3 } from "fs";
3396
- import { join as join8, dirname as dirname5 } from "path";
3455
+ import { readFileSync as readFileSync7, existsSync as existsSync3 } from "fs";
3456
+ import { join as join9, dirname as dirname6 } from "path";
3397
3457
  function detectAppConfig(cwd = process.cwd()) {
3398
- const appJsonPath = join8(cwd, "mindstudio.json");
3458
+ const appJsonPath = join9(cwd, "mindstudio.json");
3399
3459
  if (!existsSync3(appJsonPath)) return null;
3400
3460
  try {
3401
- const raw = readFileSync6(appJsonPath, "utf-8");
3461
+ const raw = readFileSync7(appJsonPath, "utf-8");
3402
3462
  const parsed = JSON.parse(raw);
3403
3463
  if (!parsed.name || !Array.isArray(parsed.methods)) {
3404
3464
  return null;
@@ -3449,12 +3509,12 @@ function getWebInterfaceConfig(appConfig, cwd = process.cwd()) {
3449
3509
  if (!webInterface) {
3450
3510
  return null;
3451
3511
  }
3452
- const configPath = join8(cwd, webInterface.path);
3512
+ const configPath = join9(cwd, webInterface.path);
3453
3513
  if (!existsSync3(configPath)) {
3454
3514
  return null;
3455
3515
  }
3456
3516
  try {
3457
- const raw = readFileSync6(configPath, "utf-8");
3517
+ const raw = readFileSync7(configPath, "utf-8");
3458
3518
  const parsed = JSON.parse(raw);
3459
3519
  const web = parsed.web;
3460
3520
  if (!web || typeof web !== "object") {
@@ -3476,18 +3536,18 @@ function getWebProjectDir(appConfig, cwd = process.cwd()) {
3476
3536
  if (!webInterface) {
3477
3537
  return null;
3478
3538
  }
3479
- return dirname5(join8(cwd, webInterface.path));
3539
+ return dirname6(join9(cwd, webInterface.path));
3480
3540
  }
3481
3541
  function readTableSources(appConfig, cwd = process.cwd()) {
3482
3542
  const results = [];
3483
3543
  for (const table of appConfig.tables) {
3484
- const filePath = join8(cwd, table.path);
3544
+ const filePath = join9(cwd, table.path);
3485
3545
  if (!existsSync3(filePath)) {
3486
3546
  log.warn("config", "Table source file not found", { table: table.export, path: table.path });
3487
3547
  continue;
3488
3548
  }
3489
3549
  try {
3490
- const source = readFileSync6(filePath, "utf-8");
3550
+ const source = readFileSync7(filePath, "utf-8");
3491
3551
  const name = table.export;
3492
3552
  results.push({ name, source });
3493
3553
  } catch (err) {
@@ -3505,9 +3565,9 @@ function findDirsNeedingInstall(appConfig, cwd = process.cwd()) {
3505
3565
  const firstMethodPath = appConfig.methods[0].path;
3506
3566
  const parts = firstMethodPath.split("/");
3507
3567
  for (let i = parts.length - 1; i >= 1; i--) {
3508
- const candidate = join8(cwd, ...parts.slice(0, i));
3509
- if (existsSync3(join8(candidate, "package.json"))) {
3510
- if (!existsSync3(join8(candidate, "node_modules"))) {
3568
+ const candidate = join9(cwd, ...parts.slice(0, i));
3569
+ if (existsSync3(join9(candidate, "package.json"))) {
3570
+ if (!existsSync3(join9(candidate, "node_modules"))) {
3511
3571
  dirs.push(candidate);
3512
3572
  }
3513
3573
  break;
@@ -3515,8 +3575,8 @@ function findDirsNeedingInstall(appConfig, cwd = process.cwd()) {
3515
3575
  }
3516
3576
  }
3517
3577
  const webProjectDir = getWebProjectDir(appConfig, cwd);
3518
- if (webProjectDir && existsSync3(join8(webProjectDir, "package.json"))) {
3519
- if (!existsSync3(join8(webProjectDir, "node_modules"))) {
3578
+ if (webProjectDir && existsSync3(join9(webProjectDir, "package.json"))) {
3579
+ if (!existsSync3(join9(webProjectDir, "node_modules"))) {
3520
3580
  dirs.push(webProjectDir);
3521
3581
  }
3522
3582
  }
@@ -3545,11 +3605,11 @@ function detectGitBranch() {
3545
3605
 
3546
3606
  // src/dev/config/table-watcher.ts
3547
3607
  import { watch } from "chokidar";
3548
- import { join as join9, dirname as dirname6, basename as basename2 } from "path";
3608
+ import { join as join10, dirname as dirname7, basename as basename2 } from "path";
3549
3609
  function watchTableFiles(tables, cwd, onChanged) {
3550
3610
  if (tables.length === 0) return () => {
3551
3611
  };
3552
- const filePaths = tables.map((t) => join9(cwd, t.path));
3612
+ const filePaths = tables.map((t) => join10(cwd, t.path));
3553
3613
  let syncTimer;
3554
3614
  const watcher = watch(filePaths, {
3555
3615
  ignoreInitial: true,
@@ -3562,8 +3622,8 @@ function watchTableFiles(tables, cwd, onChanged) {
3562
3622
  });
3563
3623
  const dirToFiles = /* @__PURE__ */ new Map();
3564
3624
  for (const table of tables) {
3565
- const absPath = join9(cwd, table.path);
3566
- const dir = dirname6(absPath);
3625
+ const absPath = join10(cwd, table.path);
3626
+ const dir = dirname7(absPath);
3567
3627
  const file = basename2(absPath);
3568
3628
  if (!dirToFiles.has(dir)) dirToFiles.set(dir, /* @__PURE__ */ new Set());
3569
3629
  dirToFiles.get(dir).add(file);
@@ -3580,9 +3640,9 @@ function watchTableFiles(tables, cwd, onChanged) {
3580
3640
 
3581
3641
  // src/dev/config/config-watcher.ts
3582
3642
  import { watch as watch2 } from "chokidar";
3583
- import { join as join10 } from "path";
3643
+ import { join as join11 } from "path";
3584
3644
  function watchConfigFile(cwd, onChanged) {
3585
- const configPath = join10(cwd, "mindstudio.json");
3645
+ const configPath = join11(cwd, "mindstudio.json");
3586
3646
  let debounceTimer;
3587
3647
  const watcher = watch2(configPath, {
3588
3648
  ignoreInitial: true,
@@ -3601,7 +3661,7 @@ function watchConfigFile(cwd, onChanged) {
3601
3661
  };
3602
3662
  }
3603
3663
  function watchManifestFiles(cwd, onChanged) {
3604
- const manifestPath = join10(cwd, "mindstudio.json");
3664
+ const manifestPath = join11(cwd, "mindstudio.json");
3605
3665
  let watched = /* @__PURE__ */ new Set([manifestPath]);
3606
3666
  let debounceTimer;
3607
3667
  let pendingPath = null;
@@ -3615,7 +3675,7 @@ function watchManifestFiles(cwd, onChanged) {
3615
3675
  for (const iface of config2?.interfaces ?? []) {
3616
3676
  if (iface.enabled === false) continue;
3617
3677
  if (!iface.path) continue;
3618
- desired.add(join10(cwd, iface.path));
3678
+ desired.add(join11(cwd, iface.path));
3619
3679
  }
3620
3680
  for (const p of desired) {
3621
3681
  if (!watched.has(p)) watcher.add(p);
@@ -3698,4 +3758,4 @@ export {
3698
3758
  watchConfigFile,
3699
3759
  watchManifestFiles
3700
3760
  };
3701
- //# sourceMappingURL=chunk-DE6EFRG6.js.map
3761
+ //# sourceMappingURL=chunk-YYDTRACW.js.map