@mindstudio-ai/local-model-tunnel 0.5.52 → 0.5.54

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.
@@ -1540,6 +1540,9 @@ function readConfig(projectRoot, appConfig) {
1540
1540
  }
1541
1541
 
1542
1542
  // src/dev/execution/runner.ts
1543
+ var TEST_USER_SENTINEL = "testUser";
1544
+ var TEST_USER_EMAIL = "remy@mindstudio.ai";
1545
+ var TEST_USER_PHONE = "+15555555555";
1543
1546
  var DevRunner = class {
1544
1547
  constructor(appId, projectRoot, startOpts = {}) {
1545
1548
  this.appId = appId;
@@ -1558,6 +1561,7 @@ var DevRunner = class {
1558
1561
  proxy = null;
1559
1562
  appConfig = null;
1560
1563
  roleOverride = null;
1564
+ testUserId = null;
1561
1565
  // proxyUrl is sent on every poll request so the platform dashboard can
1562
1566
  // show the developer's preview URL. Also included in the start request
1563
1567
  // so the dashboard sees it immediately without waiting for the first poll.
@@ -1652,7 +1656,7 @@ var DevRunner = class {
1652
1656
  try {
1653
1657
  const authorizationToken = await fetchCallbackToken(this.appId, this.session.sessionId);
1654
1658
  const transpiledPath = await this.transpiler.transpile(opts.methodPath);
1655
- const userId = opts.userId ?? this.session.auth.userId;
1659
+ const userId = opts.userId === TEST_USER_SENTINEL ? await this.resolveTestUserId() : opts.userId ?? this.session.auth.userId;
1656
1660
  const roles = opts.roles ?? this.roleOverride;
1657
1661
  const auth = roles ? {
1658
1662
  userId,
@@ -2067,6 +2071,37 @@ var DevRunner = class {
2067
2071
  sleep(ms) {
2068
2072
  return new Promise((resolve3) => setTimeout(resolve3, ms));
2069
2073
  }
2074
+ async resolveTestUserId() {
2075
+ if (this.testUserId) return this.testUserId;
2076
+ const auth = this.appConfig?.auth;
2077
+ if (!auth?.enabled) {
2078
+ throw new Error(
2079
+ `Cannot resolve userId="${TEST_USER_SENTINEL}": auth is not enabled in mindstudio.json. Add an "auth" block with enabled: true and a users table.`
2080
+ );
2081
+ }
2082
+ const methods = auth.methods ?? [];
2083
+ const hasEmail = methods.some((m) => m.includes("email"));
2084
+ const hasPhone = methods.some((m) => m.includes("phone"));
2085
+ let opts;
2086
+ if (hasEmail) {
2087
+ opts = { email: TEST_USER_EMAIL };
2088
+ } else if (hasPhone) {
2089
+ opts = { phone: TEST_USER_PHONE };
2090
+ } else {
2091
+ 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)}).`
2093
+ );
2094
+ }
2095
+ const { user } = await createAuthSession(this.appId, opts);
2096
+ const id = user.id;
2097
+ if (typeof id !== "string") {
2098
+ throw new Error(
2099
+ `createAuthSession did not return a string user.id for the test user`
2100
+ );
2101
+ }
2102
+ this.testUserId = id;
2103
+ return id;
2104
+ }
2070
2105
  };
2071
2106
 
2072
2107
  // src/dev/logging/browser-log.ts
@@ -3409,4 +3444,4 @@ export {
3409
3444
  watchTableFiles,
3410
3445
  watchConfigFile
3411
3446
  };
3412
- //# sourceMappingURL=chunk-4HSYB4GX.js.map
3447
+ //# sourceMappingURL=chunk-7XPEELY3.js.map