@mindstudio-ai/local-model-tunnel 0.5.57 → 0.5.59

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-4Y45MX5M.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-PAU2OII4.js.map
1398
+ //# sourceMappingURL=chunk-2SN73FAD.js.map
@@ -250,7 +250,7 @@ async function fetchCallbackToken(appId, sessionId) {
250
250
  `${basePath(appId)}/manage/token`,
251
251
  getHeaders(sessionId)
252
252
  );
253
- return data.authorizationToken;
253
+ return { authorizationToken: data.authorizationToken, secrets: data.secrets };
254
254
  }
255
255
  async function getUploadUrl(appId, sessionId, extension, contentType) {
256
256
  return apiRequest(
@@ -1654,7 +1654,7 @@ var DevRunner = class {
1654
1654
  const startTime = Date.now();
1655
1655
  log.info("runner", "Method received", { requestId, method: opts.methodExport, source: "direct", sessionId: this.session.sessionId });
1656
1656
  try {
1657
- const authorizationToken = await fetchCallbackToken(this.appId, this.session.sessionId);
1657
+ const { authorizationToken, secrets } = await fetchCallbackToken(this.appId, this.session.sessionId);
1658
1658
  const transpiledPath = await this.transpiler.transpile(opts.methodPath);
1659
1659
  const userId = opts.userId === TEST_USER_SENTINEL ? await this.resolveTestUserId() : opts.userId ?? this.session.auth.userId;
1660
1660
  const roles = opts.roles ?? this.roleOverride;
@@ -1672,7 +1672,8 @@ var DevRunner = class {
1672
1672
  authorizationToken,
1673
1673
  apiBaseUrl: getApiBaseUrl(),
1674
1674
  projectRoot: this.projectRoot,
1675
- sessionId: this.session.sessionId
1675
+ sessionId: this.session.sessionId,
1676
+ secrets
1676
1677
  });
1677
1678
  const duration = Date.now() - startTime;
1678
1679
  if (result.success) {
@@ -1741,7 +1742,7 @@ var DevRunner = class {
1741
1742
  }
1742
1743
  log.debug("runner", "Transpiling scenario", { path: scenario.path });
1743
1744
  const transpiledPath = await this.transpiler.transpile(scenario.path);
1744
- const authorizationToken = await fetchCallbackToken(this.appId, this.session.sessionId);
1745
+ const { authorizationToken, secrets } = await fetchCallbackToken(this.appId, this.session.sessionId);
1745
1746
  log.debug("runner", "Running scenario seed function", { export: scenario.export });
1746
1747
  const result = await executeMethod({
1747
1748
  requestId,
@@ -1753,7 +1754,8 @@ var DevRunner = class {
1753
1754
  authorizationToken,
1754
1755
  apiBaseUrl: getApiBaseUrl(),
1755
1756
  projectRoot: this.projectRoot,
1756
- sessionId: this.session.sessionId
1757
+ sessionId: this.session.sessionId,
1758
+ secrets
1757
1759
  });
1758
1760
  if (!result.success) {
1759
1761
  const error = result.error?.message ?? "Scenario seed failed";
@@ -3269,6 +3271,20 @@ function detectAppConfig(cwd = process.cwd()) {
3269
3271
  return null;
3270
3272
  }
3271
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
+ }
3272
3288
  function getWebInterfaceConfig(appConfig, cwd = process.cwd()) {
3273
3289
  const webInterface = appConfig.interfaces.find(
3274
3290
  (i) => i.type === "web" && i.enabled !== false
@@ -3427,6 +3443,50 @@ function watchConfigFile(cwd, onChanged) {
3427
3443
  watcher.close();
3428
3444
  };
3429
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
+ }
3430
3490
 
3431
3491
  export {
3432
3492
  getEnvironment,
@@ -3470,6 +3530,7 @@ export {
3470
3530
  CommandError,
3471
3531
  DevProxy,
3472
3532
  detectAppConfig,
3533
+ detectAppConfigUntil,
3473
3534
  getWebInterfaceConfig,
3474
3535
  getWebProjectDir,
3475
3536
  readTableSources,
@@ -3477,6 +3538,7 @@ export {
3477
3538
  stablePort,
3478
3539
  detectGitBranch,
3479
3540
  watchTableFiles,
3480
- watchConfigFile
3541
+ watchConfigFile,
3542
+ watchManifestFiles
3481
3543
  };
3482
- //# sourceMappingURL=chunk-4Y45MX5M.js.map
3544
+ //# sourceMappingURL=chunk-45DC6K4V.js.map