adhdev 0.5.20 → 0.5.21

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.
package/dist/index.js CHANGED
@@ -29028,6 +29028,28 @@ var init_server_connection = __esm({
29028
29028
  this.setState("disconnected");
29029
29029
  return;
29030
29030
  }
29031
+ if (code === 4012) {
29032
+ import_daemon_core.LOG.info("Server", `[ServerConn] \u26A0 Force disconnected by user from dashboard.`);
29033
+ import_daemon_core.LOG.info("Server", `[ServerConn] Run 'adhdev daemon' to reconnect.`);
29034
+ this.setState("disconnected");
29035
+ return;
29036
+ }
29037
+ if (code === 4013) {
29038
+ import_daemon_core.LOG.info("Server", `[ServerConn] \u26A0 Connection token was revoked.`);
29039
+ import_daemon_core.LOG.info("Server", `[ServerConn] Run 'adhdev setup' to re-authenticate.`);
29040
+ this.setState("disconnected");
29041
+ try {
29042
+ const path3 = require("path");
29043
+ const fs3 = require("fs");
29044
+ const configPath = path3.join(process.env.HOME || process.env.USERPROFILE || "", ".adhdev", "config.json");
29045
+ if (fs3.existsSync(configPath)) {
29046
+ fs3.unlinkSync(configPath);
29047
+ import_daemon_core.LOG.info("Server", `[ServerConn] Config file removed. Re-run 'adhdev setup'.`);
29048
+ }
29049
+ } catch {
29050
+ }
29051
+ return;
29052
+ }
29031
29053
  if (code !== 1e3 && this.reconnectAttempts < 50) {
29032
29054
  this.setState("disconnected");
29033
29055
  this.scheduleReconnect();
@@ -29513,11 +29535,15 @@ ${e?.stack || ""}`);
29513
29535
  if (parsed.type === "pong") return;
29514
29536
  if (parsed.type === "screenshot_start") {
29515
29537
  const peer = this.peers.get(peerId);
29538
+ if (!parsed.ideType) {
29539
+ log(`screenshot_start: REJECTED \u2014 no ideType from peer ${peerId}`);
29540
+ return;
29541
+ }
29516
29542
  if (peer) {
29517
29543
  peer.screenshotActive = true;
29518
- peer.screenshotIdeType = parsed.ideType || void 0;
29544
+ peer.screenshotIdeType = parsed.ideType;
29519
29545
  peer.needsFirstFrame = true;
29520
- log(`screenshot_start: peer=${peerId}, ideType=${parsed.ideType || "any"}, channelOpen=${!!peer.screenshotChannel}, state=${peer.state}`);
29546
+ log(`screenshot_start: peer=${peerId}, ideType=${parsed.ideType}, channelOpen=${!!peer.screenshotChannel}, state=${peer.state}`);
29521
29547
  } else {
29522
29548
  log(`screenshot_start: peer ${peerId} NOT FOUND in peers map!`);
29523
29549
  }
@@ -29931,7 +29957,11 @@ var init_screenshot_controller = __esm({
29931
29957
  if (!this.deps.isRunning()) return;
29932
29958
  const active = this.deps.isScreenshotActive();
29933
29959
  const ssIdeType = this.deps.getScreenshotIdeType();
29934
- const cdp = this.deps.getCdp(ssIdeType);
29960
+ if (active && !ssIdeType) {
29961
+ this.timer = setTimeout(() => this.tick(), 500);
29962
+ return;
29963
+ }
29964
+ const cdp = ssIdeType ? this.deps.getCdp(ssIdeType) : null;
29935
29965
  const isRelay = this.deps.isUsingRelay();
29936
29966
  const profile = isRelay ? this.profileRelay : this.profileDirect;
29937
29967
  this.checkBudgetReset();
@@ -30079,7 +30109,7 @@ var init_adhdev_daemon = __esm({
30079
30109
  path2 = __toESM(require("path"));
30080
30110
  crypto2 = __toESM(require("crypto"));
30081
30111
  import_chalk = __toESM(require("chalk"));
30082
- pkgVersion = "0.5.20";
30112
+ pkgVersion = "0.5.21";
30083
30113
  if (pkgVersion === "unknown") {
30084
30114
  try {
30085
30115
  const possiblePaths = [