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

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.
@@ -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";
@@ -2080,16 +2082,16 @@ var DevRunner = class {
2080
2082
  );
2081
2083
  }
2082
2084
  const methods = auth.methods ?? [];
2083
- const hasEmail = methods.some((m) => m.includes("email"));
2084
- const hasPhone = methods.some((m) => m.includes("phone"));
2085
+ const hasEmail = methods.includes("email-code");
2086
+ const hasSms = methods.includes("sms-code");
2085
2087
  let opts;
2086
2088
  if (hasEmail) {
2087
2089
  opts = { email: TEST_USER_EMAIL };
2088
- } else if (hasPhone) {
2090
+ } else if (hasSms) {
2089
2091
  opts = { phone: TEST_USER_PHONE };
2090
2092
  } else {
2091
2093
  throw new Error(
2092
- `Cannot resolve userId="${TEST_USER_SENTINEL}": auth.methods in mindstudio.json does not include an email- or phone-based method (got ${JSON.stringify(methods)}).`
2094
+ `Cannot resolve userId="${TEST_USER_SENTINEL}": auth.methods in mindstudio.json must include "email-code" or "sms-code" (got ${JSON.stringify(methods)}).`
2093
2095
  );
2094
2096
  }
2095
2097
  const { user } = await createAuthSession(this.appId, opts);
@@ -2496,7 +2498,7 @@ var DevProxy = class _DevProxy {
2496
2498
  handleWsConnection(ws, req) {
2497
2499
  let clientId = null;
2498
2500
  const remoteAddr = req.socket.remoteAddress ?? "";
2499
- const isLoopback = remoteAddr === "127.0.0.1" || remoteAddr === "::1" || remoteAddr === "::ffff:127.0.0.1";
2501
+ const isLoopback = remoteAddr === "::1" || /^127\./.test(remoteAddr) || /^::ffff:127\./i.test(remoteAddr);
2500
2502
  const helloTimeout = setTimeout(() => {
2501
2503
  if (!clientId) {
2502
2504
  log.warn(
@@ -2522,7 +2524,7 @@ var DevProxy = class _DevProxy {
2522
2524
  const helloUrl = String(msg.url || "");
2523
2525
  const isSandboxBrowser = isLoopback && msg.sandbox === true;
2524
2526
  const mode = isSandboxBrowser ? "headless" : msg.mode === "iframe" ? "iframe" : msg.mode === "mirror" ? "mirror" : "standalone";
2525
- log.debug("proxy", "WS hello received", {
2527
+ log.info("proxy", "WS hello received", {
2526
2528
  remoteAddr,
2527
2529
  isLoopback,
2528
2530
  helloMode: msg.mode,
@@ -2530,6 +2532,21 @@ var DevProxy = class _DevProxy {
2530
2532
  helloUrl,
2531
2533
  resolvedMode: mode
2532
2534
  });
2535
+ const looksLikeSandbox = msg.sandbox === true || helloUrl.includes("ms_sandbox=1");
2536
+ if (looksLikeSandbox && mode !== "headless") {
2537
+ log.warn(
2538
+ "proxy",
2539
+ "Client looks like the sandbox browser but did not register as headless",
2540
+ {
2541
+ remoteAddr,
2542
+ isLoopback,
2543
+ helloSandbox: msg.sandbox,
2544
+ helloUrl,
2545
+ resolvedMode: mode,
2546
+ hint: "The loopback check probably failed. See proxy.ts handleWsConnection isLoopback regex."
2547
+ }
2548
+ );
2549
+ }
2533
2550
  const viewport = msg.viewport || {
2534
2551
  w: 0,
2535
2552
  h: 0
@@ -3464,4 +3481,4 @@ export {
3464
3481
  watchTableFiles,
3465
3482
  watchConfigFile
3466
3483
  };
3467
- //# sourceMappingURL=chunk-ERAJTIOM.js.map
3484
+ //# sourceMappingURL=chunk-ENW2BU6M.js.map