@mindstudio-ai/local-model-tunnel 0.5.58 → 0.5.60

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.
@@ -7,7 +7,7 @@ import {
7
7
  setProviderInstallPath,
8
8
  submitProgress,
9
9
  submitResult
10
- } from "./chunk-ENW2BU6M.js";
10
+ } from "./chunk-45DC6K4V.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-M5OOKF3L.js.map
1398
+ //# sourceMappingURL=chunk-2SN73FAD.js.map
@@ -3271,6 +3271,20 @@ function detectAppConfig(cwd = process.cwd()) {
3271
3271
  return null;
3272
3272
  }
3273
3273
  }
3274
+ async function detectAppConfigUntil(cwd, predicate, attempts = 5, delayMs = 60) {
3275
+ let last = null;
3276
+ for (let i = 0; i < attempts; i++) {
3277
+ const config2 = detectAppConfig(cwd);
3278
+ if (config2) {
3279
+ last = config2;
3280
+ if (predicate(config2)) return config2;
3281
+ }
3282
+ if (i < attempts - 1) {
3283
+ await new Promise((r) => setTimeout(r, delayMs));
3284
+ }
3285
+ }
3286
+ return last;
3287
+ }
3274
3288
  function getWebInterfaceConfig(appConfig, cwd = process.cwd()) {
3275
3289
  const webInterface = appConfig.interfaces.find(
3276
3290
  (i) => i.type === "web" && i.enabled !== false
@@ -3429,6 +3443,50 @@ function watchConfigFile(cwd, onChanged) {
3429
3443
  watcher.close();
3430
3444
  };
3431
3445
  }
3446
+ function watchManifestFiles(cwd, onChanged) {
3447
+ const manifestPath = join10(cwd, "mindstudio.json");
3448
+ let watched = /* @__PURE__ */ new Set([manifestPath]);
3449
+ let debounceTimer;
3450
+ let pendingPath = null;
3451
+ const watcher = watch2(manifestPath, {
3452
+ ignoreInitial: true,
3453
+ disableGlobbing: true
3454
+ });
3455
+ const updateInterfaceWatchers = () => {
3456
+ const config2 = detectAppConfig(cwd);
3457
+ const desired = /* @__PURE__ */ new Set([manifestPath]);
3458
+ for (const iface of config2?.interfaces ?? []) {
3459
+ if (iface.enabled === false) continue;
3460
+ if (!iface.path) continue;
3461
+ desired.add(join10(cwd, iface.path));
3462
+ }
3463
+ for (const p of desired) {
3464
+ if (!watched.has(p)) watcher.add(p);
3465
+ }
3466
+ for (const p of watched) {
3467
+ if (!desired.has(p)) watcher.unwatch(p);
3468
+ }
3469
+ watched = desired;
3470
+ };
3471
+ updateInterfaceWatchers();
3472
+ watcher.on("all", (_event, path2) => {
3473
+ pendingPath = path2 ?? manifestPath;
3474
+ clearTimeout(debounceTimer);
3475
+ debounceTimer = setTimeout(() => {
3476
+ const changed = pendingPath ?? manifestPath;
3477
+ pendingPath = null;
3478
+ if (changed === manifestPath) updateInterfaceWatchers();
3479
+ onChanged(changed);
3480
+ }, 500);
3481
+ });
3482
+ log.info("config", "Watching manifest + interface configs for changes", {
3483
+ paths: Array.from(watched)
3484
+ });
3485
+ return () => {
3486
+ clearTimeout(debounceTimer);
3487
+ watcher.close();
3488
+ };
3489
+ }
3432
3490
 
3433
3491
  export {
3434
3492
  getEnvironment,
@@ -3472,6 +3530,7 @@ export {
3472
3530
  CommandError,
3473
3531
  DevProxy,
3474
3532
  detectAppConfig,
3533
+ detectAppConfigUntil,
3475
3534
  getWebInterfaceConfig,
3476
3535
  getWebProjectDir,
3477
3536
  readTableSources,
@@ -3479,6 +3538,7 @@ export {
3479
3538
  stablePort,
3480
3539
  detectGitBranch,
3481
3540
  watchTableFiles,
3482
- watchConfigFile
3541
+ watchConfigFile,
3542
+ watchManifestFiles
3483
3543
  };
3484
- //# sourceMappingURL=chunk-ENW2BU6M.js.map
3544
+ //# sourceMappingURL=chunk-45DC6K4V.js.map