adhdev 0.5.24 → 0.5.26

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/cli/index.js CHANGED
@@ -16904,15 +16904,15 @@ var require_dist = __commonJS({
16904
16904
  var import_child_process2 = require("child_process");
16905
16905
  var os22 = __toESM2(require("os"));
16906
16906
  function execAsync(cmd, timeoutMs = 5e3) {
16907
- return new Promise((resolve7) => {
16907
+ return new Promise((resolve8) => {
16908
16908
  const child = (0, import_child_process2.exec)(cmd, { encoding: "utf-8", timeout: timeoutMs }, (err, stdout) => {
16909
16909
  if (err || !stdout?.trim()) {
16910
- resolve7(null);
16910
+ resolve8(null);
16911
16911
  } else {
16912
- resolve7(stdout.trim());
16912
+ resolve8(stdout.trim());
16913
16913
  }
16914
16914
  });
16915
- child.on("error", () => resolve7(null));
16915
+ child.on("error", () => resolve8(null));
16916
16916
  });
16917
16917
  }
16918
16918
  async function detectCLIs(providerLoader) {
@@ -17262,7 +17262,7 @@ var require_dist = __commonJS({
17262
17262
  * Returns multiple entries if multiple IDE windows are open on same port
17263
17263
  */
17264
17264
  static listAllTargets(port) {
17265
- return new Promise((resolve7) => {
17265
+ return new Promise((resolve8) => {
17266
17266
  const req = http.get(`http://127.0.0.1:${port}/json`, (res) => {
17267
17267
  let data = "";
17268
17268
  res.on("data", (chunk) => data += chunk.toString());
@@ -17278,16 +17278,16 @@ var require_dist = __commonJS({
17278
17278
  (t) => !isNonMain(t.title || "") && t.url?.includes("workbench.html") && !t.url?.includes("agent")
17279
17279
  );
17280
17280
  const fallbackPages = pages.filter((t) => !isNonMain(t.title || ""));
17281
- resolve7(mainPages.length > 0 ? mainPages : fallbackPages);
17281
+ resolve8(mainPages.length > 0 ? mainPages : fallbackPages);
17282
17282
  } catch {
17283
- resolve7([]);
17283
+ resolve8([]);
17284
17284
  }
17285
17285
  });
17286
17286
  });
17287
- req.on("error", () => resolve7([]));
17287
+ req.on("error", () => resolve8([]));
17288
17288
  req.setTimeout(2e3, () => {
17289
17289
  req.destroy();
17290
- resolve7([]);
17290
+ resolve8([]);
17291
17291
  });
17292
17292
  });
17293
17293
  }
@@ -17327,7 +17327,7 @@ var require_dist = __commonJS({
17327
17327
  }
17328
17328
  }
17329
17329
  findTargetOnPort(port) {
17330
- return new Promise((resolve7) => {
17330
+ return new Promise((resolve8) => {
17331
17331
  const req = http.get(`http://127.0.0.1:${port}/json`, (res) => {
17332
17332
  let data = "";
17333
17333
  res.on("data", (chunk) => data += chunk.toString());
@@ -17338,7 +17338,7 @@ var require_dist = __commonJS({
17338
17338
  (t) => (t.type === "page" || t.type === "browser" || t.type === "Page") && t.webSocketDebuggerUrl
17339
17339
  );
17340
17340
  if (pages.length === 0) {
17341
- resolve7(targets.find((t) => t.webSocketDebuggerUrl) || null);
17341
+ resolve8(targets.find((t) => t.webSocketDebuggerUrl) || null);
17342
17342
  return;
17343
17343
  }
17344
17344
  const mainPages = pages.filter((t) => !this.isNonMainTitle(t.title || ""));
@@ -17348,24 +17348,24 @@ var require_dist = __commonJS({
17348
17348
  const specific = list.find((t) => t.id === this._targetId);
17349
17349
  if (specific) {
17350
17350
  this._pageTitle = specific.title || "";
17351
- resolve7(specific);
17351
+ resolve8(specific);
17352
17352
  } else {
17353
17353
  this.log(`[CDP] Target ${this._targetId} not found in page list`);
17354
- resolve7(null);
17354
+ resolve8(null);
17355
17355
  }
17356
17356
  return;
17357
17357
  }
17358
17358
  this._pageTitle = list[0]?.title || "";
17359
- resolve7(list[0]);
17359
+ resolve8(list[0]);
17360
17360
  } catch {
17361
- resolve7(null);
17361
+ resolve8(null);
17362
17362
  }
17363
17363
  });
17364
17364
  });
17365
- req.on("error", () => resolve7(null));
17365
+ req.on("error", () => resolve8(null));
17366
17366
  req.setTimeout(2e3, () => {
17367
17367
  req.destroy();
17368
- resolve7(null);
17368
+ resolve8(null);
17369
17369
  });
17370
17370
  });
17371
17371
  }
@@ -17376,7 +17376,7 @@ var require_dist = __commonJS({
17376
17376
  this.extensionProviders = providers;
17377
17377
  }
17378
17378
  connectToTarget(wsUrl) {
17379
- return new Promise((resolve7) => {
17379
+ return new Promise((resolve8) => {
17380
17380
  this.ws = new import_ws2.default(wsUrl);
17381
17381
  this.ws.on("open", async () => {
17382
17382
  this._connected = true;
@@ -17386,17 +17386,17 @@ var require_dist = __commonJS({
17386
17386
  }
17387
17387
  this.connectBrowserWs().catch(() => {
17388
17388
  });
17389
- resolve7(true);
17389
+ resolve8(true);
17390
17390
  });
17391
17391
  this.ws.on("message", (data) => {
17392
17392
  try {
17393
17393
  const msg = JSON.parse(data.toString());
17394
17394
  if (msg.id && this.pending.has(msg.id)) {
17395
- const { resolve: resolve8, reject } = this.pending.get(msg.id);
17395
+ const { resolve: resolve9, reject } = this.pending.get(msg.id);
17396
17396
  this.pending.delete(msg.id);
17397
17397
  this.failureCount = 0;
17398
17398
  if (msg.error) reject(new Error(msg.error.message));
17399
- else resolve8(msg.result);
17399
+ else resolve9(msg.result);
17400
17400
  } else if (msg.method === "Runtime.executionContextCreated") {
17401
17401
  this.contexts.add(msg.params.context.id);
17402
17402
  } else if (msg.method === "Runtime.executionContextDestroyed") {
@@ -17419,7 +17419,7 @@ var require_dist = __commonJS({
17419
17419
  this.ws.on("error", (err) => {
17420
17420
  this.log(`[CDP] WebSocket error: ${err.message}`);
17421
17421
  this._connected = false;
17422
- resolve7(false);
17422
+ resolve8(false);
17423
17423
  });
17424
17424
  });
17425
17425
  }
@@ -17433,7 +17433,7 @@ var require_dist = __commonJS({
17433
17433
  return;
17434
17434
  }
17435
17435
  this.log(`[CDP] Connecting browser WS for target discovery...`);
17436
- await new Promise((resolve7, reject) => {
17436
+ await new Promise((resolve8, reject) => {
17437
17437
  this.browserWs = new import_ws2.default(browserWsUrl);
17438
17438
  this.browserWs.on("open", async () => {
17439
17439
  this._browserConnected = true;
@@ -17443,16 +17443,16 @@ var require_dist = __commonJS({
17443
17443
  } catch (e) {
17444
17444
  this.log(`[CDP] setDiscoverTargets failed: ${e.message}`);
17445
17445
  }
17446
- resolve7();
17446
+ resolve8();
17447
17447
  });
17448
17448
  this.browserWs.on("message", (data) => {
17449
17449
  try {
17450
17450
  const msg = JSON.parse(data.toString());
17451
17451
  if (msg.id && this.browserPending.has(msg.id)) {
17452
- const { resolve: resolve8, reject: reject2 } = this.browserPending.get(msg.id);
17452
+ const { resolve: resolve9, reject: reject2 } = this.browserPending.get(msg.id);
17453
17453
  this.browserPending.delete(msg.id);
17454
17454
  if (msg.error) reject2(new Error(msg.error.message));
17455
- else resolve8(msg.result);
17455
+ else resolve9(msg.result);
17456
17456
  }
17457
17457
  } catch {
17458
17458
  }
@@ -17472,31 +17472,31 @@ var require_dist = __commonJS({
17472
17472
  }
17473
17473
  }
17474
17474
  getBrowserWsUrl() {
17475
- return new Promise((resolve7) => {
17475
+ return new Promise((resolve8) => {
17476
17476
  const req = http.get(`http://127.0.0.1:${this.port}/json/version`, (res) => {
17477
17477
  let data = "";
17478
17478
  res.on("data", (chunk) => data += chunk.toString());
17479
17479
  res.on("end", () => {
17480
17480
  try {
17481
17481
  const info = JSON.parse(data);
17482
- resolve7(info.webSocketDebuggerUrl || null);
17482
+ resolve8(info.webSocketDebuggerUrl || null);
17483
17483
  } catch {
17484
- resolve7(null);
17484
+ resolve8(null);
17485
17485
  }
17486
17486
  });
17487
17487
  });
17488
- req.on("error", () => resolve7(null));
17488
+ req.on("error", () => resolve8(null));
17489
17489
  req.setTimeout(3e3, () => {
17490
17490
  req.destroy();
17491
- resolve7(null);
17491
+ resolve8(null);
17492
17492
  });
17493
17493
  });
17494
17494
  }
17495
17495
  sendBrowser(method, params = {}, timeoutMs = 15e3) {
17496
- return new Promise((resolve7, reject) => {
17496
+ return new Promise((resolve8, reject) => {
17497
17497
  if (!this.browserWs || !this._browserConnected) return reject(new Error("Browser WS not connected"));
17498
17498
  const id = this.browserMsgId++;
17499
- this.browserPending.set(id, { resolve: resolve7, reject });
17499
+ this.browserPending.set(id, { resolve: resolve8, reject });
17500
17500
  this.browserWs.send(JSON.stringify({ id, method, params }));
17501
17501
  setTimeout(() => {
17502
17502
  if (this.browserPending.has(id)) {
@@ -17536,11 +17536,11 @@ var require_dist = __commonJS({
17536
17536
  }
17537
17537
  // ─── CDP Protocol ────────────────────────────────────────
17538
17538
  sendInternal(method, params = {}, timeoutMs = 15e3) {
17539
- return new Promise((resolve7, reject) => {
17539
+ return new Promise((resolve8, reject) => {
17540
17540
  if (!this.ws || !this._connected) return reject(new Error("CDP not connected"));
17541
17541
  if (this.ws.readyState !== import_ws2.default.OPEN) return reject(new Error("WebSocket not open"));
17542
17542
  const id = this.msgId++;
17543
- this.pending.set(id, { resolve: resolve7, reject });
17543
+ this.pending.set(id, { resolve: resolve8, reject });
17544
17544
  this.ws.send(JSON.stringify({ id, method, params }));
17545
17545
  setTimeout(() => {
17546
17546
  if (this.pending.has(id)) {
@@ -17749,7 +17749,7 @@ var require_dist = __commonJS({
17749
17749
  const browserWs = this.browserWs;
17750
17750
  let msgId = this.browserMsgId;
17751
17751
  const sendWs = (method, params = {}, sessionId) => {
17752
- return new Promise((resolve7, reject) => {
17752
+ return new Promise((resolve8, reject) => {
17753
17753
  const mid = msgId++;
17754
17754
  this.browserMsgId = msgId;
17755
17755
  const handler = (raw) => {
@@ -17758,7 +17758,7 @@ var require_dist = __commonJS({
17758
17758
  if (msg.id === mid) {
17759
17759
  browserWs.removeListener("message", handler);
17760
17760
  if (msg.error) reject(new Error(msg.error.message || JSON.stringify(msg.error)));
17761
- else resolve7(msg.result);
17761
+ else resolve8(msg.result);
17762
17762
  }
17763
17763
  } catch {
17764
17764
  }
@@ -17932,14 +17932,14 @@ var require_dist = __commonJS({
17932
17932
  if (!ws || ws.readyState !== import_ws2.default.OPEN) {
17933
17933
  throw new Error("CDP not connected");
17934
17934
  }
17935
- return new Promise((resolve7, reject) => {
17935
+ return new Promise((resolve8, reject) => {
17936
17936
  const id = getNextId();
17937
17937
  pendingMap.set(id, {
17938
17938
  resolve: (result) => {
17939
17939
  if (result?.result?.subtype === "error") {
17940
17940
  reject(new Error(result.result.description));
17941
17941
  } else {
17942
- resolve7(result?.result?.value);
17942
+ resolve8(result?.result?.value);
17943
17943
  }
17944
17944
  },
17945
17945
  reject
@@ -17971,10 +17971,10 @@ var require_dist = __commonJS({
17971
17971
  throw new Error("CDP not connected");
17972
17972
  }
17973
17973
  const sendViaSession = (method, params = {}) => {
17974
- return new Promise((resolve7, reject) => {
17974
+ return new Promise((resolve8, reject) => {
17975
17975
  const pendingMap = this._browserConnected ? this.browserPending : this.pending;
17976
17976
  const id = this._browserConnected ? this.browserMsgId++ : this.msgId++;
17977
- pendingMap.set(id, { resolve: resolve7, reject });
17977
+ pendingMap.set(id, { resolve: resolve8, reject });
17978
17978
  ws.send(JSON.stringify({ id, sessionId, method, params }));
17979
17979
  setTimeout(() => {
17980
17980
  if (pendingMap.has(id)) {
@@ -21520,7 +21520,7 @@ var require_dist = __commonJS({
21520
21520
  return { updated: false };
21521
21521
  }
21522
21522
  try {
21523
- const etag = await new Promise((resolve7, reject) => {
21523
+ const etag = await new Promise((resolve8, reject) => {
21524
21524
  const options = {
21525
21525
  method: "HEAD",
21526
21526
  hostname: "github.com",
@@ -21538,7 +21538,7 @@ var require_dist = __commonJS({
21538
21538
  headers: { "User-Agent": "adhdev-launcher" },
21539
21539
  timeout: 1e4
21540
21540
  }, (res2) => {
21541
- resolve7(res2.headers.etag || res2.headers["last-modified"] || "");
21541
+ resolve8(res2.headers.etag || res2.headers["last-modified"] || "");
21542
21542
  });
21543
21543
  req2.on("error", reject);
21544
21544
  req2.on("timeout", () => {
@@ -21547,7 +21547,7 @@ var require_dist = __commonJS({
21547
21547
  });
21548
21548
  req2.end();
21549
21549
  } else {
21550
- resolve7(res.headers.etag || res.headers["last-modified"] || "");
21550
+ resolve8(res.headers.etag || res.headers["last-modified"] || "");
21551
21551
  }
21552
21552
  });
21553
21553
  req.on("error", reject);
@@ -21611,7 +21611,7 @@ var require_dist = __commonJS({
21611
21611
  downloadFile(url2, destPath) {
21612
21612
  const https = require("https");
21613
21613
  const http3 = require("http");
21614
- return new Promise((resolve7, reject) => {
21614
+ return new Promise((resolve8, reject) => {
21615
21615
  const doRequest = (reqUrl, redirectCount = 0) => {
21616
21616
  if (redirectCount > 5) {
21617
21617
  reject(new Error("Too many redirects"));
@@ -21631,7 +21631,7 @@ var require_dist = __commonJS({
21631
21631
  res.pipe(ws);
21632
21632
  ws.on("finish", () => {
21633
21633
  ws.close();
21634
- resolve7();
21634
+ resolve8();
21635
21635
  });
21636
21636
  ws.on("error", reject);
21637
21637
  });
@@ -21966,17 +21966,17 @@ var require_dist = __commonJS({
21966
21966
  throw new Error("No free port found");
21967
21967
  }
21968
21968
  function checkPortFree(port) {
21969
- return new Promise((resolve7) => {
21969
+ return new Promise((resolve8) => {
21970
21970
  const server = net.createServer();
21971
21971
  server.unref();
21972
- server.on("error", () => resolve7(false));
21972
+ server.on("error", () => resolve8(false));
21973
21973
  server.listen(port, "127.0.0.1", () => {
21974
- server.close(() => resolve7(true));
21974
+ server.close(() => resolve8(true));
21975
21975
  });
21976
21976
  });
21977
21977
  }
21978
21978
  async function isCdpActive(port) {
21979
- return new Promise((resolve7) => {
21979
+ return new Promise((resolve8) => {
21980
21980
  const req = require("http").get(`http://127.0.0.1:${port}/json/version`, {
21981
21981
  timeout: 2e3
21982
21982
  }, (res) => {
@@ -21985,16 +21985,16 @@ var require_dist = __commonJS({
21985
21985
  res.on("end", () => {
21986
21986
  try {
21987
21987
  const info = JSON.parse(data);
21988
- resolve7(!!info["WebKit-Version"] || !!info["Browser"]);
21988
+ resolve8(!!info["WebKit-Version"] || !!info["Browser"]);
21989
21989
  } catch {
21990
- resolve7(false);
21990
+ resolve8(false);
21991
21991
  }
21992
21992
  });
21993
21993
  });
21994
- req.on("error", () => resolve7(false));
21994
+ req.on("error", () => resolve8(false));
21995
21995
  req.on("timeout", () => {
21996
21996
  req.destroy();
21997
- resolve7(false);
21997
+ resolve8(false);
21998
21998
  });
21999
21999
  });
22000
22000
  }
@@ -22927,7 +22927,7 @@ var require_dist = __commonJS({
22927
22927
  if (os11.platform() !== "win32") {
22928
22928
  try {
22929
22929
  const fs10 = require("fs");
22930
- const ptyDir = path9.dirname(require.resolve("node-pty"));
22930
+ const ptyDir = path9.resolve(path9.dirname(require.resolve("node-pty")), "..");
22931
22931
  const arch3 = os11.arch() === "arm64" ? "darwin-arm64" : "darwin-x64";
22932
22932
  const helper = path9.join(ptyDir, "prebuilds", arch3, "spawn-helper");
22933
22933
  if (fs10.existsSync(helper)) {
@@ -23077,7 +23077,7 @@ var require_dist = __commonJS({
23077
23077
  this.timeouts = {
23078
23078
  ptyFlush: t.ptyFlush ?? 50,
23079
23079
  dialogAccept: t.dialogAccept ?? 300,
23080
- approvalCooldown: t.approvalCooldown ?? 2e3,
23080
+ approvalCooldown: t.approvalCooldown ?? 500,
23081
23081
  generatingIdle: t.generatingIdle ?? 6e3,
23082
23082
  idleFinish: t.idleFinish ?? 5e3,
23083
23083
  maxResponse: t.maxResponse ?? 3e5,
@@ -23254,32 +23254,34 @@ var require_dist = __commonJS({
23254
23254
  }
23255
23255
  const hasApproval = patterns.approval.some((p) => p.test(this.recentOutputBuffer));
23256
23256
  if (hasApproval && this.currentStatus !== "waiting_approval") {
23257
- if (this.lastApprovalResolvedAt && Date.now() - this.lastApprovalResolvedAt < this.timeouts.approvalCooldown) return;
23258
- const ctxLines = this.recentOutputBuffer.split("\n").map((l) => l.trim()).filter((l) => l && !/^[─═╭╮╰╯│]+$/.test(l));
23259
- this.isWaitingForResponse = true;
23260
- this.setStatus("waiting_approval", "approval_pattern");
23261
- this.recentOutputBuffer = "";
23262
- this.approvalTransitionBuffer = "";
23263
- this.activeModal = {
23264
- message: ctxLines.slice(-5).join(" ").slice(0, 200) || "Approval required",
23265
- buttons: this.cliType === "claude-cli" ? ["Yes (y)", "Always allow (a)", "Deny (Esc)"] : ["Allow once", "Always allow", "Deny"]
23266
- };
23267
- if (this.idleTimeout) clearTimeout(this.idleTimeout);
23268
- if (this.approvalExitTimeout) clearTimeout(this.approvalExitTimeout);
23269
- this.approvalExitTimeout = setTimeout(() => {
23270
- if (this.currentStatus === "waiting_approval") {
23271
- LOG5.warn("CLI", `[${this.cliType}] Approval timeout \u2014 auto-exiting waiting_approval`);
23272
- this.activeModal = null;
23273
- this.lastApprovalResolvedAt = Date.now();
23274
- this.recentOutputBuffer = "";
23275
- this.approvalTransitionBuffer = "";
23276
- this.approvalExitTimeout = null;
23277
- this.setStatus(this.isWaitingForResponse ? "generating" : "idle", "approval_cleared");
23278
- this.onStatusChange?.();
23279
- }
23280
- }, 6e4);
23281
- this.onStatusChange?.();
23282
- return;
23257
+ const inCooldown = this.lastApprovalResolvedAt && Date.now() - this.lastApprovalResolvedAt < this.timeouts.approvalCooldown;
23258
+ if (!inCooldown) {
23259
+ const ctxLines = this.recentOutputBuffer.split("\n").map((l) => l.trim()).filter((l) => l && !/^[─═╭╮╰╯│]+$/.test(l));
23260
+ this.isWaitingForResponse = true;
23261
+ this.setStatus("waiting_approval", "approval_pattern");
23262
+ this.recentOutputBuffer = "";
23263
+ this.approvalTransitionBuffer = "";
23264
+ this.activeModal = {
23265
+ message: ctxLines.slice(-5).join(" ").slice(0, 200) || "Approval required",
23266
+ buttons: this.cliType === "claude-cli" ? ["Yes (y)", "Always allow (a)", "Deny (Esc)"] : ["Allow once", "Always allow", "Deny"]
23267
+ };
23268
+ if (this.idleTimeout) clearTimeout(this.idleTimeout);
23269
+ if (this.approvalExitTimeout) clearTimeout(this.approvalExitTimeout);
23270
+ this.approvalExitTimeout = setTimeout(() => {
23271
+ if (this.currentStatus === "waiting_approval") {
23272
+ LOG5.warn("CLI", `[${this.cliType}] Approval timeout \u2014 auto-exiting waiting_approval`);
23273
+ this.activeModal = null;
23274
+ this.lastApprovalResolvedAt = Date.now();
23275
+ this.recentOutputBuffer = "";
23276
+ this.approvalTransitionBuffer = "";
23277
+ this.approvalExitTimeout = null;
23278
+ this.setStatus(this.isWaitingForResponse ? "generating" : "idle", "approval_cleared");
23279
+ this.onStatusChange?.();
23280
+ }
23281
+ }, 6e4);
23282
+ this.onStatusChange?.();
23283
+ return;
23284
+ }
23283
23285
  }
23284
23286
  if (this.currentStatus === "waiting_approval") {
23285
23287
  this.approvalTransitionBuffer = (this.approvalTransitionBuffer + cleanData).slice(-500);
@@ -23331,7 +23333,10 @@ var require_dist = __commonJS({
23331
23333
  }
23332
23334
  const trailingLines = cleanData.split("\n").slice(-2).join("\n");
23333
23335
  if (patterns.prompt.some((p) => p.test(trailingLines))) {
23334
- this.finishResponse();
23336
+ const hasApprovalHere = patterns.approval.some((p) => p.test(this.recentOutputBuffer));
23337
+ if (!hasApprovalHere) {
23338
+ this.finishResponse();
23339
+ }
23335
23340
  } else {
23336
23341
  this.idleTimeout = setTimeout(() => {
23337
23342
  if (this.isWaitingForResponse && this.responseBuffer.trim()) {
@@ -24118,13 +24123,13 @@ var require_dist = __commonJS({
24118
24123
  }
24119
24124
  this.currentStatus = "waiting_approval";
24120
24125
  this.detectStatusTransition();
24121
- const approved = await new Promise((resolve7) => {
24122
- this.permissionResolvers.push(resolve7);
24126
+ const approved = await new Promise((resolve8) => {
24127
+ this.permissionResolvers.push(resolve8);
24123
24128
  setTimeout(() => {
24124
- const idx = this.permissionResolvers.indexOf(resolve7);
24129
+ const idx = this.permissionResolvers.indexOf(resolve8);
24125
24130
  if (idx >= 0) {
24126
24131
  this.permissionResolvers.splice(idx, 1);
24127
- resolve7(false);
24132
+ resolve8(false);
24128
24133
  }
24129
24134
  }, 3e5);
24130
24135
  });
@@ -25354,6 +25359,18 @@ ${installInfo}`
25354
25359
  }
25355
25360
  }
25356
25361
  }
25362
+ if (this._activeIdeType === ideType && agentStreamManager.activeAgentType) {
25363
+ const activeType = agentStreamManager.activeAgentType;
25364
+ const enabledExtTypes = new Set(
25365
+ providerLoader.getEnabledExtensionProviders(ideType).map((p) => p.type)
25366
+ );
25367
+ if (!enabledExtTypes.has(activeType)) {
25368
+ LOG5.info("AgentStream", `Active agent ${activeType} was disabled for ${ideType} \u2014 detaching`);
25369
+ await agentStreamManager.switchActiveAgent(cdp, null);
25370
+ this._activeIdeType = null;
25371
+ this.deps.onStreamsUpdated?.(ideType, []);
25372
+ }
25373
+ }
25357
25374
  }
25358
25375
  if (this._activeIdeType) {
25359
25376
  const cdp = cdpManagers.get(this._activeIdeType);
@@ -26154,15 +26171,15 @@ async (params) => {
26154
26171
  this.json(res, 500, { error: e.message });
26155
26172
  }
26156
26173
  });
26157
- return new Promise((resolve7, reject) => {
26174
+ return new Promise((resolve8, reject) => {
26158
26175
  this.server.listen(port, "127.0.0.1", () => {
26159
26176
  this.log(`Dev server listening on http://127.0.0.1:${port}`);
26160
- resolve7();
26177
+ resolve8();
26161
26178
  });
26162
26179
  this.server.on("error", (e) => {
26163
26180
  if (e.code === "EADDRINUSE") {
26164
26181
  this.log(`Port ${port} in use, skipping dev server`);
26165
- resolve7();
26182
+ resolve8();
26166
26183
  } else {
26167
26184
  reject(e);
26168
26185
  }
@@ -26245,20 +26262,20 @@ async (params) => {
26245
26262
  child.stderr?.on("data", (d) => {
26246
26263
  stderr += d.toString().slice(0, 2e3);
26247
26264
  });
26248
- await new Promise((resolve7) => {
26265
+ await new Promise((resolve8) => {
26249
26266
  const timer = setTimeout(() => {
26250
26267
  child.kill();
26251
- resolve7();
26268
+ resolve8();
26252
26269
  }, 3e3);
26253
26270
  child.on("exit", () => {
26254
26271
  clearTimeout(timer);
26255
- resolve7();
26272
+ resolve8();
26256
26273
  });
26257
26274
  child.stdout?.once("data", () => {
26258
26275
  setTimeout(() => {
26259
26276
  child.kill();
26260
26277
  clearTimeout(timer);
26261
- resolve7();
26278
+ resolve8();
26262
26279
  }, 500);
26263
26280
  });
26264
26281
  });
@@ -26943,14 +26960,14 @@ async (params) => {
26943
26960
  child.stderr?.on("data", (d) => {
26944
26961
  stderr += d.toString();
26945
26962
  });
26946
- await new Promise((resolve7) => {
26963
+ await new Promise((resolve8) => {
26947
26964
  const timer = setTimeout(() => {
26948
26965
  child.kill();
26949
- resolve7();
26966
+ resolve8();
26950
26967
  }, timeout);
26951
26968
  child.on("exit", () => {
26952
26969
  clearTimeout(timer);
26953
- resolve7();
26970
+ resolve8();
26954
26971
  });
26955
26972
  });
26956
26973
  const elapsed = Date.now() - start;
@@ -28352,14 +28369,14 @@ data: ${JSON.stringify(msg.data)}
28352
28369
  res.end(JSON.stringify(data, null, 2));
28353
28370
  }
28354
28371
  async readBody(req) {
28355
- return new Promise((resolve7) => {
28372
+ return new Promise((resolve8) => {
28356
28373
  let body = "";
28357
28374
  req.on("data", (chunk) => body += chunk);
28358
28375
  req.on("end", () => {
28359
28376
  try {
28360
- resolve7(JSON.parse(body));
28377
+ resolve8(JSON.parse(body));
28361
28378
  } catch {
28362
- resolve7({});
28379
+ resolve8({});
28363
28380
  }
28364
28381
  });
28365
28382
  });
@@ -28726,10 +28743,10 @@ data: ${JSON.stringify(msg.data)}
28726
28743
  const buffer = Buffer.from(await res.arrayBuffer());
28727
28744
  const fs10 = await import("fs");
28728
28745
  fs10.writeFileSync(vsixPath, buffer);
28729
- return new Promise((resolve7) => {
28746
+ return new Promise((resolve8) => {
28730
28747
  const cmd = `"${ide.cliCommand}" --install-extension "${vsixPath}" --force`;
28731
28748
  (0, import_child_process8.exec)(cmd, { timeout: 6e4 }, (error48, _stdout, stderr) => {
28732
- resolve7({
28749
+ resolve8({
28733
28750
  extensionId: extension.id,
28734
28751
  marketplaceId: extension.marketplaceId,
28735
28752
  success: !error48,
@@ -28742,11 +28759,11 @@ data: ${JSON.stringify(msg.data)}
28742
28759
  } catch (e) {
28743
28760
  }
28744
28761
  }
28745
- return new Promise((resolve7) => {
28762
+ return new Promise((resolve8) => {
28746
28763
  const cmd = `"${ide.cliCommand}" --install-extension ${extension.marketplaceId} --force`;
28747
28764
  (0, import_child_process8.exec)(cmd, { timeout: 6e4 }, (error48, stdout, stderr) => {
28748
28765
  if (error48) {
28749
- resolve7({
28766
+ resolve8({
28750
28767
  extensionId: extension.id,
28751
28768
  marketplaceId: extension.marketplaceId,
28752
28769
  success: false,
@@ -28754,7 +28771,7 @@ data: ${JSON.stringify(msg.data)}
28754
28771
  error: stderr || error48.message
28755
28772
  });
28756
28773
  } else {
28757
- resolve7({
28774
+ resolve8({
28758
28775
  extensionId: extension.id,
28759
28776
  marketplaceId: extension.marketplaceId,
28760
28777
  success: true,
@@ -30179,7 +30196,7 @@ var init_adhdev_daemon = __esm({
30179
30196
  path2 = __toESM(require("path"));
30180
30197
  crypto2 = __toESM(require("crypto"));
30181
30198
  import_chalk = __toESM(require("chalk"));
30182
- pkgVersion = "0.5.24";
30199
+ pkgVersion = "0.5.26";
30183
30200
  if (pkgVersion === "unknown") {
30184
30201
  try {
30185
30202
  const possiblePaths = [