@lifeaitools/clauth 1.5.76 → 1.5.78

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.
@@ -10,12 +10,29 @@ const MAX_EVENT_QUEUE = 100;
10
10
  const MAX_SNIPPET = 2_000;
11
11
 
12
12
  const APP_TARGETS = {
13
+ studio_test: {
14
+ appSlug: "studio_test",
15
+ brandSlug: "studio_test",
16
+ packageName: "@regen/studio",
17
+ command: "pnpm --filter @regen/studio dev",
18
+ url: "http://localhost:3011/editor/local-test-target",
19
+ hmrUrl: "http://localhost:3011/_next/webpack-hmr",
20
+ },
21
+ "studio-test": {
22
+ appSlug: "studio_test",
23
+ brandSlug: "studio_test",
24
+ packageName: "@regen/studio",
25
+ command: "pnpm --filter @regen/studio dev",
26
+ url: "http://localhost:3011/editor/local-test-target",
27
+ hmrUrl: "http://localhost:3011/_next/webpack-hmr",
28
+ },
13
29
  prt: {
14
30
  appSlug: "prt",
15
31
  brandSlug: "prt",
16
32
  packageName: "@regen/prt-portal",
17
33
  command: "pnpm --filter @regen/prt-portal dev",
18
34
  url: "http://localhost:3006",
35
+ hmrUrl: "http://localhost:3006/_next/webpack-hmr",
19
36
  },
20
37
  "prt-portal": {
21
38
  appSlug: "prt",
@@ -23,6 +40,7 @@ const APP_TARGETS = {
23
40
  packageName: "@regen/prt-portal",
24
41
  command: "pnpm --filter @regen/prt-portal dev",
25
42
  url: "http://localhost:3006",
43
+ hmrUrl: "http://localhost:3006/_next/webpack-hmr",
26
44
  },
27
45
  };
28
46
 
@@ -96,6 +114,21 @@ async function isUrlReachable(url) {
96
114
  }
97
115
  }
98
116
 
117
+ async function isNextDevServer(target) {
118
+ if (!target.hmrUrl) return true;
119
+ try {
120
+ const response = await fetch(target.hmrUrl, {
121
+ method: "GET",
122
+ redirect: "manual",
123
+ signal: AbortSignal.timeout(1_500),
124
+ });
125
+ const contentType = response.headers.get("content-type") || "";
126
+ return response.status === 200 && contentType.includes("text/event-stream");
127
+ } catch {
128
+ return false;
129
+ }
130
+ }
131
+
99
132
  function resolveTarget(input = {}) {
100
133
  const slug = String(input.appSlug || input.brandSlug || "prt").toLowerCase();
101
134
  const configured = APP_TARGETS[slug];
@@ -119,6 +152,7 @@ function resolveTarget(input = {}) {
119
152
  brandSlug: input.brandSlug || base.brandSlug || input.appSlug || base.appSlug,
120
153
  command: input.devCommand || base.command,
121
154
  url: input.devUrl || base.url,
155
+ hmrUrl: input.hmrUrl || base.hmrUrl,
122
156
  cwd: input.cwd || input.repoRoot || process.cwd(),
123
157
  };
124
158
  }
@@ -180,8 +214,25 @@ export class StudioDebugSessionStore {
180
214
  return { ok: false, error: target.error, message: target.message, status: "error" };
181
215
  }
182
216
 
183
- const reachable = await isUrlReachable(target.url);
184
217
  const shouldLaunch = input.launchDevServer !== false;
218
+ const reachable = await isUrlReachable(target.url);
219
+ const devReady = reachable ? await isNextDevServer(target) : false;
220
+ if (reachable && shouldLaunch && !devReady && target.hmrUrl) {
221
+ return {
222
+ ok: false,
223
+ error: "non_dev_server",
224
+ message: `${target.url} is reachable, but ${target.hmrUrl} is not a Next dev HMR stream. Stop the process on that port and start ${target.command}.`,
225
+ status: "error",
226
+ launch: {
227
+ started: false,
228
+ alreadyRunning: true,
229
+ command: target.command,
230
+ url: target.url,
231
+ pid: null,
232
+ },
233
+ };
234
+ }
235
+
185
236
  const launch = reachable
186
237
  ? { started: false, command: target.command, url: target.url, alreadyRunning: true }
187
238
  : shouldLaunch
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lifeaitools/clauth",
3
- "version": "1.5.76",
3
+ "version": "1.5.78",
4
4
  "description": "Hardware-bound credential vault for the LIFEAI infrastructure stack",
5
5
  "type": "module",
6
6
  "bin": {