@clawos-dev/clawd 0.2.111-beta.211.36274e2 → 0.2.112-beta.212.a6b6915

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.
Files changed (2) hide show
  1. package/dist/cli.cjs +25 -12
  2. package/package.json +1 -1
package/dist/cli.cjs CHANGED
@@ -39512,24 +39512,37 @@ function buildSessionHandlers(deps) {
39512
39512
  if (prevProject && prevProject !== nextProject) {
39513
39513
  await lifecycle.stopForSession(args.sessionId);
39514
39514
  }
39515
- if (nextProject && nextProject !== "" && nextProject !== prevProject) {
39516
- const projects = await projectStore.list();
39517
- const target = projects.find((p2) => p2.name === nextProject);
39518
- deps.logger?.info("session-update.start-dev-server", {
39515
+ if (nextProject && nextProject !== "") {
39516
+ const occupantSessionId = lifecycle.boundSessionId(nextProject);
39517
+ const alreadyRunningForThisSession = lifecycle.isRunning(nextProject) && occupantSessionId === args.sessionId;
39518
+ deps.logger?.info("session-update.maybe-start-dev-server", {
39519
39519
  sessionId: args.sessionId,
39520
39520
  projectName: nextProject,
39521
- targetFound: !!target,
39522
- projectCwd: target ? projectStore.projectDir(nextProject) : null,
39523
- tunnelUrl
39521
+ occupantSessionId,
39522
+ alreadyRunningForThisSession
39524
39523
  });
39525
- if (target) {
39526
- lifecycle.startForSession({
39524
+ if (!alreadyRunningForThisSession) {
39525
+ if (occupantSessionId && occupantSessionId !== args.sessionId) {
39526
+ await lifecycle.stopForSession(occupantSessionId);
39527
+ }
39528
+ const projects = await projectStore.list();
39529
+ const target = projects.find((p2) => p2.name === nextProject);
39530
+ deps.logger?.info("session-update.start-dev-server", {
39527
39531
  sessionId: args.sessionId,
39528
39532
  projectName: nextProject,
39529
- cwd: projectStore.projectDir(nextProject),
39530
- port: target.port,
39531
- tunnelHost: tunnelUrl ? new URL(tunnelUrl.replace(/^wss?:\/\//i, "https://")).host : null
39533
+ targetFound: !!target,
39534
+ projectCwd: target ? projectStore.projectDir(nextProject) : null,
39535
+ tunnelUrl
39532
39536
  });
39537
+ if (target) {
39538
+ lifecycle.startForSession({
39539
+ sessionId: args.sessionId,
39540
+ projectName: nextProject,
39541
+ cwd: projectStore.projectDir(nextProject),
39542
+ port: target.port,
39543
+ tunnelHost: tunnelUrl ? new URL(tunnelUrl.replace(/^wss?:\/\//i, "https://")).host : null
39544
+ });
39545
+ }
39533
39546
  }
39534
39547
  }
39535
39548
  } catch (err) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clawos-dev/clawd",
3
- "version": "0.2.111-beta.211.36274e2",
3
+ "version": "0.2.112-beta.212.a6b6915",
4
4
  "description": "Standalone clawd daemon — Claude Code (and future Codex) session server over WebSocket",
5
5
  "type": "module",
6
6
  "license": "MIT",