adhdev 0.9.71 → 0.9.72

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
@@ -2656,8 +2656,8 @@ async function detectIDEs(providerLoader) {
2656
2656
  if ((0, import_fs4.existsSync)(bundledCli)) resolvedCli = bundledCli;
2657
2657
  }
2658
2658
  if (!resolvedCli && appPath && os29 === "win32") {
2659
- const { dirname: dirname10 } = await import("path");
2660
- const appDir = dirname10(appPath);
2659
+ const { dirname: dirname11 } = await import("path");
2660
+ const appDir = dirname11(appPath);
2661
2661
  const candidates = [
2662
2662
  `${appDir}\\\\bin\\\\${def.cli}.cmd`,
2663
2663
  `${appDir}\\\\bin\\\\${def.cli}`,
@@ -2729,19 +2729,19 @@ function resolveCommandPath(command) {
2729
2729
  return null;
2730
2730
  }
2731
2731
  function execAsync(cmd, timeoutMs = 5e3) {
2732
- return new Promise((resolve19) => {
2732
+ return new Promise((resolve20) => {
2733
2733
  const child = (0, import_child_process2.exec)(cmd, {
2734
2734
  encoding: "utf-8",
2735
2735
  timeout: timeoutMs,
2736
2736
  ...process.platform === "win32" ? { windowsHide: true } : {}
2737
2737
  }, (err, stdout) => {
2738
2738
  if (err || !stdout?.trim()) {
2739
- resolve19(null);
2739
+ resolve20(null);
2740
2740
  } else {
2741
- resolve19(stdout.trim());
2741
+ resolve20(stdout.trim());
2742
2742
  }
2743
2743
  });
2744
- child.on("error", () => resolve19(null));
2744
+ child.on("error", () => resolve20(null));
2745
2745
  });
2746
2746
  }
2747
2747
  async function detectCLIs(providerLoader, options) {
@@ -3353,7 +3353,7 @@ var init_manager = __esm({
3353
3353
  * Returns multiple entries if multiple IDE windows are open on same port
3354
3354
  */
3355
3355
  static listAllTargets(port) {
3356
- return new Promise((resolve19) => {
3356
+ return new Promise((resolve20) => {
3357
3357
  const req = http.get(`http://127.0.0.1:${port}/json`, (res) => {
3358
3358
  let data = "";
3359
3359
  res.on("data", (chunk) => data += chunk.toString());
@@ -3369,16 +3369,16 @@ var init_manager = __esm({
3369
3369
  (t) => !isNonMain(t.title || "") && t.url?.includes("workbench.html") && !t.url?.includes("agent")
3370
3370
  );
3371
3371
  const fallbackPages = pages.filter((t) => !isNonMain(t.title || ""));
3372
- resolve19(mainPages.length > 0 ? mainPages : fallbackPages);
3372
+ resolve20(mainPages.length > 0 ? mainPages : fallbackPages);
3373
3373
  } catch {
3374
- resolve19([]);
3374
+ resolve20([]);
3375
3375
  }
3376
3376
  });
3377
3377
  });
3378
- req.on("error", () => resolve19([]));
3378
+ req.on("error", () => resolve20([]));
3379
3379
  req.setTimeout(2e3, () => {
3380
3380
  req.destroy();
3381
- resolve19([]);
3381
+ resolve20([]);
3382
3382
  });
3383
3383
  });
3384
3384
  }
@@ -3418,7 +3418,7 @@ var init_manager = __esm({
3418
3418
  }
3419
3419
  }
3420
3420
  findTargetOnPort(port) {
3421
- return new Promise((resolve19) => {
3421
+ return new Promise((resolve20) => {
3422
3422
  const req = http.get(`http://127.0.0.1:${port}/json`, (res) => {
3423
3423
  let data = "";
3424
3424
  res.on("data", (chunk) => data += chunk.toString());
@@ -3429,7 +3429,7 @@ var init_manager = __esm({
3429
3429
  (t) => (t.type === "page" || t.type === "browser" || t.type === "Page") && t.webSocketDebuggerUrl
3430
3430
  );
3431
3431
  if (pages.length === 0) {
3432
- resolve19(targets.find((t) => t.webSocketDebuggerUrl) || null);
3432
+ resolve20(targets.find((t) => t.webSocketDebuggerUrl) || null);
3433
3433
  return;
3434
3434
  }
3435
3435
  const titleFilteredPages = pages.filter((t) => !this.isNonMainTitle(t.title || ""));
@@ -3448,25 +3448,25 @@ var init_manager = __esm({
3448
3448
  this._targetId = selected.target.id;
3449
3449
  }
3450
3450
  this._pageTitle = selected.target.title || "";
3451
- resolve19(selected.target);
3451
+ resolve20(selected.target);
3452
3452
  return;
3453
3453
  }
3454
3454
  if (previousTargetId) {
3455
3455
  this.log(`[CDP] Target ${previousTargetId} not found in page list`);
3456
- resolve19(null);
3456
+ resolve20(null);
3457
3457
  return;
3458
3458
  }
3459
3459
  this._pageTitle = list[0]?.title || "";
3460
- resolve19(list[0]);
3460
+ resolve20(list[0]);
3461
3461
  } catch {
3462
- resolve19(null);
3462
+ resolve20(null);
3463
3463
  }
3464
3464
  });
3465
3465
  });
3466
- req.on("error", () => resolve19(null));
3466
+ req.on("error", () => resolve20(null));
3467
3467
  req.setTimeout(2e3, () => {
3468
3468
  req.destroy();
3469
- resolve19(null);
3469
+ resolve20(null);
3470
3470
  });
3471
3471
  });
3472
3472
  }
@@ -3477,7 +3477,7 @@ var init_manager = __esm({
3477
3477
  this.extensionProviders = providers;
3478
3478
  }
3479
3479
  connectToTarget(wsUrl) {
3480
- return new Promise((resolve19) => {
3480
+ return new Promise((resolve20) => {
3481
3481
  this.ws = new import_ws.default(wsUrl);
3482
3482
  this.ws.on("open", async () => {
3483
3483
  this._connected = true;
@@ -3487,17 +3487,17 @@ var init_manager = __esm({
3487
3487
  }
3488
3488
  this.connectBrowserWs().catch(() => {
3489
3489
  });
3490
- resolve19(true);
3490
+ resolve20(true);
3491
3491
  });
3492
3492
  this.ws.on("message", (data) => {
3493
3493
  try {
3494
3494
  const msg = JSON.parse(data.toString());
3495
3495
  if (msg.id && this.pending.has(msg.id)) {
3496
- const { resolve: resolve20, reject } = this.pending.get(msg.id);
3496
+ const { resolve: resolve21, reject } = this.pending.get(msg.id);
3497
3497
  this.pending.delete(msg.id);
3498
3498
  this.failureCount = 0;
3499
3499
  if (msg.error) reject(new Error(msg.error.message));
3500
- else resolve20(msg.result);
3500
+ else resolve21(msg.result);
3501
3501
  } else if (msg.method === "Runtime.executionContextCreated") {
3502
3502
  this.contexts.add(msg.params.context.id);
3503
3503
  } else if (msg.method === "Runtime.executionContextDestroyed") {
@@ -3520,7 +3520,7 @@ var init_manager = __esm({
3520
3520
  this.ws.on("error", (err) => {
3521
3521
  this.log(`[CDP] WebSocket error: ${err.message}`);
3522
3522
  this._connected = false;
3523
- resolve19(false);
3523
+ resolve20(false);
3524
3524
  });
3525
3525
  });
3526
3526
  }
@@ -3534,7 +3534,7 @@ var init_manager = __esm({
3534
3534
  return;
3535
3535
  }
3536
3536
  this.log(`[CDP] Connecting browser WS for target discovery...`);
3537
- await new Promise((resolve19, reject) => {
3537
+ await new Promise((resolve20, reject) => {
3538
3538
  this.browserWs = new import_ws.default(browserWsUrl);
3539
3539
  this.browserWs.on("open", async () => {
3540
3540
  this._browserConnected = true;
@@ -3544,16 +3544,16 @@ var init_manager = __esm({
3544
3544
  } catch (e) {
3545
3545
  this.log(`[CDP] setDiscoverTargets failed: ${e.message}`);
3546
3546
  }
3547
- resolve19();
3547
+ resolve20();
3548
3548
  });
3549
3549
  this.browserWs.on("message", (data) => {
3550
3550
  try {
3551
3551
  const msg = JSON.parse(data.toString());
3552
3552
  if (msg.id && this.browserPending.has(msg.id)) {
3553
- const { resolve: resolve20, reject: reject2 } = this.browserPending.get(msg.id);
3553
+ const { resolve: resolve21, reject: reject2 } = this.browserPending.get(msg.id);
3554
3554
  this.browserPending.delete(msg.id);
3555
3555
  if (msg.error) reject2(new Error(msg.error.message));
3556
- else resolve20(msg.result);
3556
+ else resolve21(msg.result);
3557
3557
  }
3558
3558
  } catch {
3559
3559
  }
@@ -3573,31 +3573,31 @@ var init_manager = __esm({
3573
3573
  }
3574
3574
  }
3575
3575
  getBrowserWsUrl() {
3576
- return new Promise((resolve19) => {
3576
+ return new Promise((resolve20) => {
3577
3577
  const req = http.get(`http://127.0.0.1:${this.port}/json/version`, (res) => {
3578
3578
  let data = "";
3579
3579
  res.on("data", (chunk) => data += chunk.toString());
3580
3580
  res.on("end", () => {
3581
3581
  try {
3582
3582
  const info = JSON.parse(data);
3583
- resolve19(info.webSocketDebuggerUrl || null);
3583
+ resolve20(info.webSocketDebuggerUrl || null);
3584
3584
  } catch {
3585
- resolve19(null);
3585
+ resolve20(null);
3586
3586
  }
3587
3587
  });
3588
3588
  });
3589
- req.on("error", () => resolve19(null));
3589
+ req.on("error", () => resolve20(null));
3590
3590
  req.setTimeout(3e3, () => {
3591
3591
  req.destroy();
3592
- resolve19(null);
3592
+ resolve20(null);
3593
3593
  });
3594
3594
  });
3595
3595
  }
3596
3596
  sendBrowser(method, params = {}, timeoutMs = 15e3) {
3597
- return new Promise((resolve19, reject) => {
3597
+ return new Promise((resolve20, reject) => {
3598
3598
  if (!this.browserWs || !this._browserConnected) return reject(new Error("Browser WS not connected"));
3599
3599
  const id = this.browserMsgId++;
3600
- this.browserPending.set(id, { resolve: resolve19, reject });
3600
+ this.browserPending.set(id, { resolve: resolve20, reject });
3601
3601
  this.browserWs.send(JSON.stringify({ id, method, params }));
3602
3602
  setTimeout(() => {
3603
3603
  if (this.browserPending.has(id)) {
@@ -3637,11 +3637,11 @@ var init_manager = __esm({
3637
3637
  }
3638
3638
  // ─── CDP Protocol ────────────────────────────────────────
3639
3639
  sendInternal(method, params = {}, timeoutMs = 15e3) {
3640
- return new Promise((resolve19, reject) => {
3640
+ return new Promise((resolve20, reject) => {
3641
3641
  if (!this.ws || !this._connected) return reject(new Error("CDP not connected"));
3642
3642
  if (this.ws.readyState !== import_ws.default.OPEN) return reject(new Error("WebSocket not open"));
3643
3643
  const id = this.msgId++;
3644
- this.pending.set(id, { resolve: resolve19, reject });
3644
+ this.pending.set(id, { resolve: resolve20, reject });
3645
3645
  this.ws.send(JSON.stringify({ id, method, params }));
3646
3646
  setTimeout(() => {
3647
3647
  if (this.pending.has(id)) {
@@ -3890,7 +3890,7 @@ var init_manager = __esm({
3890
3890
  const browserWs = this.browserWs;
3891
3891
  let msgId = this.browserMsgId;
3892
3892
  const sendWs = (method, params = {}, sessionId) => {
3893
- return new Promise((resolve19, reject) => {
3893
+ return new Promise((resolve20, reject) => {
3894
3894
  const mid = msgId++;
3895
3895
  this.browserMsgId = msgId;
3896
3896
  const handler = (raw) => {
@@ -3899,7 +3899,7 @@ var init_manager = __esm({
3899
3899
  if (msg.id === mid) {
3900
3900
  browserWs.removeListener("message", handler);
3901
3901
  if (msg.error) reject(new Error(msg.error.message || JSON.stringify(msg.error)));
3902
- else resolve19(msg.result);
3902
+ else resolve20(msg.result);
3903
3903
  }
3904
3904
  } catch {
3905
3905
  }
@@ -4100,14 +4100,14 @@ var init_manager = __esm({
4100
4100
  if (!ws || ws.readyState !== import_ws.default.OPEN) {
4101
4101
  throw new Error("CDP not connected");
4102
4102
  }
4103
- return new Promise((resolve19, reject) => {
4103
+ return new Promise((resolve20, reject) => {
4104
4104
  const id = getNextId();
4105
4105
  pendingMap.set(id, {
4106
4106
  resolve: (result) => {
4107
4107
  if (result?.result?.subtype === "error") {
4108
4108
  reject(new Error(result.result.description));
4109
4109
  } else {
4110
- resolve19(result?.result?.value);
4110
+ resolve20(result?.result?.value);
4111
4111
  }
4112
4112
  },
4113
4113
  reject
@@ -4139,10 +4139,10 @@ var init_manager = __esm({
4139
4139
  throw new Error("CDP not connected");
4140
4140
  }
4141
4141
  const sendViaSession = (method, params = {}) => {
4142
- return new Promise((resolve19, reject) => {
4142
+ return new Promise((resolve20, reject) => {
4143
4143
  const pendingMap = this._browserConnected ? this.browserPending : this.pending;
4144
4144
  const id = this._browserConnected ? this.browserMsgId++ : this.msgId++;
4145
- pendingMap.set(id, { resolve: resolve19, reject });
4145
+ pendingMap.set(id, { resolve: resolve20, reject });
4146
4146
  ws.send(JSON.stringify({ id, sessionId, method, params }));
4147
4147
  setTimeout(() => {
4148
4148
  if (pendingMap.has(id)) {
@@ -9527,7 +9527,7 @@ function getCliVisibleTranscriptCount(adapter) {
9527
9527
  async function getStableExtensionBaseline(h) {
9528
9528
  const first = await readExtensionChatState(h);
9529
9529
  if (getStateMessageCount(first) > 0 || getStateLastSignature(first)) return first;
9530
- await new Promise((resolve19) => setTimeout(resolve19, 150));
9530
+ await new Promise((resolve20) => setTimeout(resolve20, 150));
9531
9531
  const second = await readExtensionChatState(h);
9532
9532
  return getStateMessageCount(second) >= getStateMessageCount(first) ? second : first;
9533
9533
  }
@@ -9535,7 +9535,7 @@ async function verifyExtensionSendObserved(h, before) {
9535
9535
  const beforeCount = getStateMessageCount(before);
9536
9536
  const beforeSignature = getStateLastSignature(before);
9537
9537
  for (let attempt = 0; attempt < 12; attempt += 1) {
9538
- await new Promise((resolve19) => setTimeout(resolve19, 250));
9538
+ await new Promise((resolve20) => setTimeout(resolve20, 250));
9539
9539
  const state = await readExtensionChatState(h);
9540
9540
  if (state?.status === "waiting_approval") return true;
9541
9541
  const afterCount = getStateMessageCount(state);
@@ -11207,7 +11207,7 @@ async function executeProviderScript(h, args, scriptName) {
11207
11207
  const enterCount = cliCommand.enterCount || 1;
11208
11208
  await adapter.writeRaw(cliCommand.text + "\r");
11209
11209
  for (let i = 1; i < enterCount; i += 1) {
11210
- await new Promise((resolve19) => setTimeout(resolve19, 50));
11210
+ await new Promise((resolve20) => setTimeout(resolve20, 50));
11211
11211
  await adapter.writeRaw("\r");
11212
11212
  }
11213
11213
  }
@@ -11923,7 +11923,7 @@ var init_handler = __esm({
11923
11923
  try {
11924
11924
  const http3 = await import("http");
11925
11925
  const postData = JSON.stringify(body);
11926
- const result = await new Promise((resolve19, reject) => {
11926
+ const result = await new Promise((resolve20, reject) => {
11927
11927
  const req = http3.request({
11928
11928
  hostname: "127.0.0.1",
11929
11929
  port: 19280,
@@ -11935,9 +11935,9 @@ var init_handler = __esm({
11935
11935
  res.on("data", (chunk) => data += chunk);
11936
11936
  res.on("end", () => {
11937
11937
  try {
11938
- resolve19(JSON.parse(data));
11938
+ resolve20(JSON.parse(data));
11939
11939
  } catch {
11940
- resolve19({ raw: data });
11940
+ resolve20({ raw: data });
11941
11941
  }
11942
11942
  });
11943
11943
  });
@@ -11955,15 +11955,15 @@ var init_handler = __esm({
11955
11955
  if (!providerType) return { success: false, error: "providerType required" };
11956
11956
  try {
11957
11957
  const http3 = await import("http");
11958
- const result = await new Promise((resolve19, reject) => {
11958
+ const result = await new Promise((resolve20, reject) => {
11959
11959
  http3.get(`http://127.0.0.1:19280/api/providers/${providerType}/${endpoint}`, (res) => {
11960
11960
  let data = "";
11961
11961
  res.on("data", (chunk) => data += chunk);
11962
11962
  res.on("end", () => {
11963
11963
  try {
11964
- resolve19(JSON.parse(data));
11964
+ resolve20(JSON.parse(data));
11965
11965
  } catch {
11966
- resolve19({ raw: data });
11966
+ resolve20({ raw: data });
11967
11967
  }
11968
11968
  });
11969
11969
  }).on("error", reject);
@@ -11977,7 +11977,7 @@ var init_handler = __esm({
11977
11977
  try {
11978
11978
  const http3 = await import("http");
11979
11979
  const postData = JSON.stringify(args || {});
11980
- const result = await new Promise((resolve19, reject) => {
11980
+ const result = await new Promise((resolve20, reject) => {
11981
11981
  const req = http3.request({
11982
11982
  hostname: "127.0.0.1",
11983
11983
  port: 19280,
@@ -11989,9 +11989,9 @@ var init_handler = __esm({
11989
11989
  res.on("data", (chunk) => data += chunk);
11990
11990
  res.on("end", () => {
11991
11991
  try {
11992
- resolve19(JSON.parse(data));
11992
+ resolve20(JSON.parse(data));
11993
11993
  } catch {
11994
- resolve19({ raw: data });
11994
+ resolve20({ raw: data });
11995
11995
  }
11996
11996
  });
11997
11997
  });
@@ -14138,7 +14138,7 @@ var init_provider_cli_adapter = __esm({
14138
14138
  `[${this.cliType}] Waiting for interactive prompt: status=${status} stableMs=${stableMs} recentOutputMs=${recentlyOutput} screen=${JSON.stringify(summarizeCliTraceText(screenText, 220)).slice(0, 260)}`
14139
14139
  );
14140
14140
  }
14141
- await new Promise((resolve19) => setTimeout(resolve19, 50));
14141
+ await new Promise((resolve20) => setTimeout(resolve20, 50));
14142
14142
  }
14143
14143
  const finalScreenText = this.terminalScreen.getText() || "";
14144
14144
  LOG.warn(
@@ -15048,7 +15048,7 @@ var init_provider_cli_adapter = __esm({
15048
15048
  const deadline = Date.now() + 1e4;
15049
15049
  while (this.startupParseGate && Date.now() < deadline) {
15050
15050
  this.resolveStartupState("send_wait");
15051
- await new Promise((resolve19) => setTimeout(resolve19, 50));
15051
+ await new Promise((resolve20) => setTimeout(resolve20, 50));
15052
15052
  }
15053
15053
  }
15054
15054
  if (!allowInterventionPrompt) {
@@ -15124,13 +15124,13 @@ var init_provider_cli_adapter = __esm({
15124
15124
  }
15125
15125
  this.responseEpoch += 1;
15126
15126
  this.responseSettleIgnoreUntil = Date.now() + submitDelayMs + this.timeouts.outputSettle + 250;
15127
- await new Promise((resolve19, reject) => {
15127
+ await new Promise((resolve20, reject) => {
15128
15128
  let resolved = false;
15129
15129
  const completion = {
15130
15130
  resolveOnce: () => {
15131
15131
  if (resolved) return;
15132
15132
  resolved = true;
15133
- resolve19();
15133
+ resolve20();
15134
15134
  },
15135
15135
  rejectOnce: (error48) => {
15136
15136
  if (resolved) return;
@@ -15288,17 +15288,17 @@ var init_provider_cli_adapter = __esm({
15288
15288
  }
15289
15289
  }
15290
15290
  waitForStopped(timeoutMs) {
15291
- return new Promise((resolve19) => {
15291
+ return new Promise((resolve20) => {
15292
15292
  const startedAt = Date.now();
15293
15293
  const timer = setInterval(() => {
15294
15294
  if (!this.ptyProcess || this.currentStatus === "stopped") {
15295
15295
  clearInterval(timer);
15296
- resolve19(true);
15296
+ resolve20(true);
15297
15297
  return;
15298
15298
  }
15299
15299
  if (Date.now() - startedAt >= timeoutMs) {
15300
15300
  clearInterval(timer);
15301
- resolve19(false);
15301
+ resolve20(false);
15302
15302
  }
15303
15303
  }, 100);
15304
15304
  });
@@ -15636,7 +15636,7 @@ async function waitForCliAdapterReady(adapter, options) {
15636
15636
  if (status === "stopped") {
15637
15637
  throw new Error("CLI runtime stopped before it became ready");
15638
15638
  }
15639
- await new Promise((resolve19) => setTimeout(resolve19, pollMs));
15639
+ await new Promise((resolve20) => setTimeout(resolve20, pollMs));
15640
15640
  }
15641
15641
  throw new Error(`CLI runtime did not become ready within ${timeoutMs}ms`);
15642
15642
  }
@@ -16001,7 +16001,7 @@ var init_cli_provider_instance = __esm({
16001
16001
  const enterCount = cliCommand.enterCount || 1;
16002
16002
  await this.adapter.writeRaw(cliCommand.text + "\r");
16003
16003
  for (let i = 1; i < enterCount; i += 1) {
16004
- await new Promise((resolve19) => setTimeout(resolve19, 50));
16004
+ await new Promise((resolve20) => setTimeout(resolve20, 50));
16005
16005
  await this.adapter.writeRaw("\r");
16006
16006
  }
16007
16007
  }
@@ -32583,8 +32583,8 @@ var init_acp = __esm({
32583
32583
  this.#requestHandler = requestHandler;
32584
32584
  this.#notificationHandler = notificationHandler;
32585
32585
  this.#stream = stream;
32586
- this.#closedPromise = new Promise((resolve19) => {
32587
- this.#abortController.signal.addEventListener("abort", () => resolve19());
32586
+ this.#closedPromise = new Promise((resolve20) => {
32587
+ this.#abortController.signal.addEventListener("abort", () => resolve20());
32588
32588
  });
32589
32589
  this.#receive();
32590
32590
  }
@@ -32733,8 +32733,8 @@ var init_acp = __esm({
32733
32733
  }
32734
32734
  async sendRequest(method, params) {
32735
32735
  const id = this.#nextRequestId++;
32736
- const responsePromise = new Promise((resolve19, reject) => {
32737
- this.#pendingResponses.set(id, { resolve: resolve19, reject });
32736
+ const responsePromise = new Promise((resolve20, reject) => {
32737
+ this.#pendingResponses.set(id, { resolve: resolve20, reject });
32738
32738
  });
32739
32739
  await this.#sendMessage({ jsonrpc: "2.0", id, method, params });
32740
32740
  return responsePromise;
@@ -33418,13 +33418,13 @@ var init_acp_provider_instance = __esm({
33418
33418
  }
33419
33419
  this.currentStatus = "waiting_approval";
33420
33420
  this.detectStatusTransition();
33421
- const approved = await new Promise((resolve19) => {
33422
- this.permissionResolvers.push(resolve19);
33421
+ const approved = await new Promise((resolve20) => {
33422
+ this.permissionResolvers.push(resolve20);
33423
33423
  setTimeout(() => {
33424
- const idx = this.permissionResolvers.indexOf(resolve19);
33424
+ const idx = this.permissionResolvers.indexOf(resolve20);
33425
33425
  if (idx >= 0) {
33426
33426
  this.permissionResolvers.splice(idx, 1);
33427
- resolve19(false);
33427
+ resolve20(false);
33428
33428
  }
33429
33429
  }, 3e5);
33430
33430
  });
@@ -35559,9 +35559,9 @@ var init_handler2 = __esm({
35559
35559
  if (this.fsw.closed) {
35560
35560
  return;
35561
35561
  }
35562
- const dirname10 = sp.dirname(file2);
35562
+ const dirname11 = sp.dirname(file2);
35563
35563
  const basename9 = sp.basename(file2);
35564
- const parent = this.fsw._getWatchedDir(dirname10);
35564
+ const parent = this.fsw._getWatchedDir(dirname11);
35565
35565
  let prevStats = stats;
35566
35566
  if (parent.has(basename9))
35567
35567
  return;
@@ -35588,7 +35588,7 @@ var init_handler2 = __esm({
35588
35588
  prevStats = newStats2;
35589
35589
  }
35590
35590
  } catch (error48) {
35591
- this.fsw._remove(dirname10, basename9);
35591
+ this.fsw._remove(dirname11, basename9);
35592
35592
  }
35593
35593
  } else if (parent.has(basename9)) {
35594
35594
  const at = newStats.atimeMs;
@@ -35685,7 +35685,7 @@ var init_handler2 = __esm({
35685
35685
  this._addToNodeFs(path33, initialAdd, wh, depth + 1);
35686
35686
  }
35687
35687
  }).on(EV.ERROR, this._boundHandleError);
35688
- return new Promise((resolve19, reject) => {
35688
+ return new Promise((resolve20, reject) => {
35689
35689
  if (!stream)
35690
35690
  return reject();
35691
35691
  stream.once(STR_END, () => {
@@ -35694,7 +35694,7 @@ var init_handler2 = __esm({
35694
35694
  return;
35695
35695
  }
35696
35696
  const wasThrottled = throttler ? throttler.clear() : false;
35697
- resolve19(void 0);
35697
+ resolve20(void 0);
35698
35698
  previous.getChildren().filter((item) => {
35699
35699
  return item !== directory && !current.has(item);
35700
35700
  }).forEach((item) => {
@@ -37794,7 +37794,7 @@ var init_provider_loader = __esm({
37794
37794
  return { updated: false };
37795
37795
  }
37796
37796
  try {
37797
- const etag = await new Promise((resolve19, reject) => {
37797
+ const etag = await new Promise((resolve20, reject) => {
37798
37798
  const options = {
37799
37799
  method: "HEAD",
37800
37800
  hostname: "github.com",
@@ -37812,7 +37812,7 @@ var init_provider_loader = __esm({
37812
37812
  headers: { "User-Agent": "adhdev-launcher" },
37813
37813
  timeout: 1e4
37814
37814
  }, (res2) => {
37815
- resolve19(res2.headers.etag || res2.headers["last-modified"] || "");
37815
+ resolve20(res2.headers.etag || res2.headers["last-modified"] || "");
37816
37816
  });
37817
37817
  req2.on("error", reject);
37818
37818
  req2.on("timeout", () => {
@@ -37821,7 +37821,7 @@ var init_provider_loader = __esm({
37821
37821
  });
37822
37822
  req2.end();
37823
37823
  } else {
37824
- resolve19(res.headers.etag || res.headers["last-modified"] || "");
37824
+ resolve20(res.headers.etag || res.headers["last-modified"] || "");
37825
37825
  }
37826
37826
  });
37827
37827
  req.on("error", reject);
@@ -37885,7 +37885,7 @@ var init_provider_loader = __esm({
37885
37885
  downloadFile(url2, destPath) {
37886
37886
  const https = require("https");
37887
37887
  const http3 = require("http");
37888
- return new Promise((resolve19, reject) => {
37888
+ return new Promise((resolve20, reject) => {
37889
37889
  const doRequest = (reqUrl, redirectCount = 0) => {
37890
37890
  if (redirectCount > 5) {
37891
37891
  reject(new Error("Too many redirects"));
@@ -37905,7 +37905,7 @@ var init_provider_loader = __esm({
37905
37905
  res.pipe(ws);
37906
37906
  ws.on("finish", () => {
37907
37907
  ws.close();
37908
- resolve19();
37908
+ resolve20();
37909
37909
  });
37910
37910
  ws.on("error", reject);
37911
37911
  });
@@ -38490,17 +38490,17 @@ async function findFreePort(ports) {
38490
38490
  throw new Error("No free port found");
38491
38491
  }
38492
38492
  function checkPortFree(port) {
38493
- return new Promise((resolve19) => {
38493
+ return new Promise((resolve20) => {
38494
38494
  const server = net2.createServer();
38495
38495
  server.unref();
38496
- server.on("error", () => resolve19(false));
38496
+ server.on("error", () => resolve20(false));
38497
38497
  server.listen(port, "127.0.0.1", () => {
38498
- server.close(() => resolve19(true));
38498
+ server.close(() => resolve20(true));
38499
38499
  });
38500
38500
  });
38501
38501
  }
38502
38502
  async function isCdpActive(port) {
38503
- return new Promise((resolve19) => {
38503
+ return new Promise((resolve20) => {
38504
38504
  const req = require("http").get(`http://127.0.0.1:${port}/json/version`, {
38505
38505
  timeout: 2e3
38506
38506
  }, (res) => {
@@ -38509,16 +38509,16 @@ async function isCdpActive(port) {
38509
38509
  res.on("end", () => {
38510
38510
  try {
38511
38511
  const info = JSON.parse(data);
38512
- resolve19(!!info["WebKit-Version"] || !!info["Browser"]);
38512
+ resolve20(!!info["WebKit-Version"] || !!info["Browser"]);
38513
38513
  } catch {
38514
- resolve19(false);
38514
+ resolve20(false);
38515
38515
  }
38516
38516
  });
38517
38517
  });
38518
- req.on("error", () => resolve19(false));
38518
+ req.on("error", () => resolve20(false));
38519
38519
  req.on("timeout", () => {
38520
38520
  req.destroy();
38521
- resolve19(false);
38521
+ resolve20(false);
38522
38522
  });
38523
38523
  });
38524
38524
  }
@@ -39029,11 +39029,23 @@ function resolveMeshCoordinatorSetup(options) {
39029
39029
  if (!path33) {
39030
39030
  return { kind: "unsupported", reason: "Provider auto-import MCP config is missing a config path" };
39031
39031
  }
39032
+ const mcpServer = resolveAdhdevMcpServerLaunch({
39033
+ meshId,
39034
+ nodeExecutable: options.nodeExecutable,
39035
+ adhdevMcpEntryPath: options.adhdevMcpEntryPath
39036
+ });
39037
+ if (!mcpServer) {
39038
+ return {
39039
+ kind: "unsupported",
39040
+ reason: "Could not resolve the ADHDev MCP server entrypoint without relying on a PATH bin shim"
39041
+ };
39042
+ }
39032
39043
  return {
39033
39044
  kind: "auto_import",
39034
39045
  serverName,
39035
- configPath: (0, import_path4.join)(workspace, path33),
39036
- configFormat: mcpConfig.format
39046
+ configPath: (0, import_node_path2.join)(workspace, path33),
39047
+ configFormat: mcpConfig.format,
39048
+ mcpServer
39037
39049
  };
39038
39050
  }
39039
39051
  if (mcpConfig.mode === "manual") {
@@ -39065,11 +39077,60 @@ function resolveMeshCoordinatorSetup(options) {
39065
39077
  function renderMeshCoordinatorTemplate(template, values) {
39066
39078
  return template.replace(/\{\{\s*(meshId|workspace|serverName|adhdevMcpCommand)\s*\}\}/g, (_2, key) => values[key] || "");
39067
39079
  }
39068
- var import_path4, DEFAULT_SERVER_NAME, DEFAULT_ADHDEV_MCP_COMMAND;
39080
+ function resolveAdhdevMcpServerLaunch(options) {
39081
+ const entryPath = resolveAdhdevMcpEntryPath(options.adhdevMcpEntryPath);
39082
+ if (!entryPath) return null;
39083
+ return {
39084
+ command: options.nodeExecutable?.trim() || process.execPath,
39085
+ args: [entryPath, "--repo-mesh", options.meshId]
39086
+ };
39087
+ }
39088
+ function resolveAdhdevMcpEntryPath(explicitPath) {
39089
+ const explicit = explicitPath?.trim();
39090
+ if (explicit) return normalizeExistingPath(explicit) || explicit;
39091
+ const envPath = process.env.ADHDEV_MCP_SERVER_PATH?.trim();
39092
+ if (envPath) return normalizeExistingPath(envPath) || envPath;
39093
+ const candidates = [];
39094
+ const addCandidate = (candidate) => {
39095
+ if (!candidates.includes(candidate)) candidates.push(candidate);
39096
+ };
39097
+ const addPackagedCandidates = (baseFile) => {
39098
+ if (!baseFile) return;
39099
+ const realBase = normalizeExistingPath(baseFile) || baseFile;
39100
+ const dir = (0, import_node_path2.dirname)(realBase);
39101
+ addCandidate((0, import_node_path2.resolve)(dir, "../vendor/mcp-server/index.js"));
39102
+ addCandidate((0, import_node_path2.resolve)(dir, "../../vendor/mcp-server/index.js"));
39103
+ addCandidate((0, import_node_path2.resolve)(dir, "../../../vendor/mcp-server/index.js"));
39104
+ };
39105
+ addPackagedCandidates(process.argv[1]);
39106
+ for (const candidate of candidates) {
39107
+ const normalized = normalizeExistingPath(candidate);
39108
+ if (normalized) return normalized;
39109
+ }
39110
+ try {
39111
+ const requireBase = process.argv[1] ? normalizeExistingPath(process.argv[1]) || process.argv[1] : (0, import_node_path2.join)(process.cwd(), "adhdev-daemon.js");
39112
+ const req = (0, import_node_module2.createRequire)(requireBase);
39113
+ const resolvedModule = req.resolve("@adhdev/mcp-server");
39114
+ return normalizeExistingPath(resolvedModule) || resolvedModule;
39115
+ } catch {
39116
+ return null;
39117
+ }
39118
+ }
39119
+ function normalizeExistingPath(filePath) {
39120
+ try {
39121
+ if (!(0, import_node_fs4.existsSync)(filePath)) return null;
39122
+ return import_node_fs4.realpathSync.native(filePath);
39123
+ } catch {
39124
+ return null;
39125
+ }
39126
+ }
39127
+ var import_node_fs4, import_node_module2, import_node_path2, DEFAULT_SERVER_NAME, DEFAULT_ADHDEV_MCP_COMMAND;
39069
39128
  var init_mesh_coordinator = __esm({
39070
39129
  "../../oss/packages/daemon-core/src/commands/mesh-coordinator.ts"() {
39071
39130
  "use strict";
39072
- import_path4 = require("path");
39131
+ import_node_fs4 = require("fs");
39132
+ import_node_module2 = require("module");
39133
+ import_node_path2 = require("path");
39073
39134
  DEFAULT_SERVER_NAME = "adhdev-mesh";
39074
39135
  DEFAULT_ADHDEV_MCP_COMMAND = "adhdev-mcp";
39075
39136
  }
@@ -39588,7 +39649,7 @@ async function waitForPidExit(pid, timeoutMs) {
39588
39649
  while (Date.now() - start < timeoutMs) {
39589
39650
  try {
39590
39651
  process.kill(pid, 0);
39591
- await new Promise((resolve19) => setTimeout(resolve19, 250));
39652
+ await new Promise((resolve20) => setTimeout(resolve20, 250));
39592
39653
  } catch {
39593
39654
  return;
39594
39655
  }
@@ -39699,7 +39760,7 @@ async function runDaemonUpgradeHelper(payload) {
39699
39760
  appendUpgradeLog(installOutput.trim());
39700
39761
  }
39701
39762
  if (process.platform === "win32") {
39702
- await new Promise((resolve19) => setTimeout(resolve19, 500));
39763
+ await new Promise((resolve20) => setTimeout(resolve20, 500));
39703
39764
  cleanupStaleGlobalInstallDirs(payload.packageName, installCommand.surface);
39704
39765
  appendUpgradeLog("Post-install staging cleanup complete");
39705
39766
  }
@@ -40623,9 +40684,9 @@ var init_router = __esm({
40623
40684
  workspace
40624
40685
  };
40625
40686
  }
40626
- const { existsSync: existsSync25, readFileSync: readFileSync20, writeFileSync: writeFileSync14, copyFileSync: copyFileSync4 } = await import("fs");
40687
+ const { existsSync: existsSync26, readFileSync: readFileSync20, writeFileSync: writeFileSync14, copyFileSync: copyFileSync4 } = await import("fs");
40627
40688
  const mcpConfigPath = coordinatorSetup.configPath;
40628
- const hadExistingMcpConfig = existsSync25(mcpConfigPath);
40689
+ const hadExistingMcpConfig = existsSync26(mcpConfigPath);
40629
40690
  let existingMcpConfig = {};
40630
40691
  if (hadExistingMcpConfig) {
40631
40692
  try {
@@ -40639,8 +40700,8 @@ var init_router = __esm({
40639
40700
  mcpServers: {
40640
40701
  ...existingMcpConfig.mcpServers || {},
40641
40702
  [coordinatorSetup.serverName]: {
40642
- command: "adhdev-mcp",
40643
- args: ["--repo-mesh", meshId]
40703
+ command: coordinatorSetup.mcpServer.command,
40704
+ args: coordinatorSetup.mcpServer.args
40644
40705
  }
40645
40706
  }
40646
40707
  };
@@ -41326,7 +41387,7 @@ var init_provider_adapter = __esm({
41326
41387
  const beforeCount = this.messageCount(before);
41327
41388
  const beforeSignature = this.lastMessageSignature(before);
41328
41389
  for (let attempt = 0; attempt < 12; attempt += 1) {
41329
- await new Promise((resolve19) => setTimeout(resolve19, 250));
41390
+ await new Promise((resolve20) => setTimeout(resolve20, 250));
41330
41391
  let state;
41331
41392
  try {
41332
41393
  state = await this.readChat(evaluate);
@@ -41348,7 +41409,7 @@ var init_provider_adapter = __esm({
41348
41409
  if (this.messageCount(first) > 0 || this.lastMessageSignature(first)) {
41349
41410
  return first;
41350
41411
  }
41351
- await new Promise((resolve19) => setTimeout(resolve19, 150));
41412
+ await new Promise((resolve20) => setTimeout(resolve20, 150));
41352
41413
  const second = await this.readChat(evaluate);
41353
41414
  return this.messageCount(second) >= this.messageCount(first) ? second : first;
41354
41415
  }
@@ -41499,7 +41560,7 @@ var init_provider_adapter = __esm({
41499
41560
  if (typeof data.error === "string" && data.error.trim()) return false;
41500
41561
  }
41501
41562
  for (let attempt = 0; attempt < 6; attempt += 1) {
41502
- await new Promise((resolve19) => setTimeout(resolve19, 250));
41563
+ await new Promise((resolve20) => setTimeout(resolve20, 250));
41503
41564
  const state = await this.readChat(evaluate);
41504
41565
  const title = this.getStateTitle(state);
41505
41566
  if (this.titlesMatch(title, sessionId)) return true;
@@ -44146,7 +44207,7 @@ function getCliTargetBundle(ctx, type, instanceId) {
44146
44207
  return { target, instance, adapter };
44147
44208
  }
44148
44209
  function sleep(ms) {
44149
- return new Promise((resolve19) => setTimeout(resolve19, ms));
44210
+ return new Promise((resolve20) => setTimeout(resolve20, ms));
44150
44211
  }
44151
44212
  async function waitForCliReady(ctx, type, instanceId, timeoutMs) {
44152
44213
  const startedAt = Date.now();
@@ -46426,15 +46487,15 @@ var init_dev_server = __esm({
46426
46487
  this.json(res, 500, { error: e.message });
46427
46488
  }
46428
46489
  });
46429
- return new Promise((resolve19, reject) => {
46490
+ return new Promise((resolve20, reject) => {
46430
46491
  this.server.listen(port, "127.0.0.1", () => {
46431
46492
  this.log(`Dev server listening on http://127.0.0.1:${port}`);
46432
- resolve19();
46493
+ resolve20();
46433
46494
  });
46434
46495
  this.server.on("error", (e) => {
46435
46496
  if (e.code === "EADDRINUSE") {
46436
46497
  this.log(`Port ${port} in use, skipping dev server`);
46437
- resolve19();
46498
+ resolve20();
46438
46499
  } else {
46439
46500
  reject(e);
46440
46501
  }
@@ -46516,20 +46577,20 @@ var init_dev_server = __esm({
46516
46577
  child.stderr?.on("data", (d) => {
46517
46578
  stderr += d.toString().slice(0, 2e3);
46518
46579
  });
46519
- await new Promise((resolve19) => {
46580
+ await new Promise((resolve20) => {
46520
46581
  const timer = setTimeout(() => {
46521
46582
  child.kill();
46522
- resolve19();
46583
+ resolve20();
46523
46584
  }, 3e3);
46524
46585
  child.on("exit", () => {
46525
46586
  clearTimeout(timer);
46526
- resolve19();
46587
+ resolve20();
46527
46588
  });
46528
46589
  child.stdout?.once("data", () => {
46529
46590
  setTimeout(() => {
46530
46591
  child.kill();
46531
46592
  clearTimeout(timer);
46532
- resolve19();
46593
+ resolve20();
46533
46594
  }, 500);
46534
46595
  });
46535
46596
  });
@@ -47032,14 +47093,14 @@ var init_dev_server = __esm({
47032
47093
  child.stderr?.on("data", (d) => {
47033
47094
  stderr += d.toString();
47034
47095
  });
47035
- await new Promise((resolve19) => {
47096
+ await new Promise((resolve20) => {
47036
47097
  const timer = setTimeout(() => {
47037
47098
  child.kill();
47038
- resolve19();
47099
+ resolve20();
47039
47100
  }, timeout);
47040
47101
  child.on("exit", () => {
47041
47102
  clearTimeout(timer);
47042
- resolve19();
47103
+ resolve20();
47043
47104
  });
47044
47105
  });
47045
47106
  const elapsed = Date.now() - start;
@@ -47709,14 +47770,14 @@ data: ${JSON.stringify(msg.data)}
47709
47770
  res.end(JSON.stringify(data, null, 2));
47710
47771
  }
47711
47772
  async readBody(req) {
47712
- return new Promise((resolve19) => {
47773
+ return new Promise((resolve20) => {
47713
47774
  let body = "";
47714
47775
  req.on("data", (chunk) => body += chunk);
47715
47776
  req.on("end", () => {
47716
47777
  try {
47717
- resolve19(JSON.parse(body));
47778
+ resolve20(JSON.parse(body));
47718
47779
  } catch {
47719
- resolve19({});
47780
+ resolve20({});
47720
47781
  }
47721
47782
  });
47722
47783
  });
@@ -48233,7 +48294,7 @@ async function waitForReady(endpoint, timeoutMs = STARTUP_TIMEOUT_MS) {
48233
48294
  const deadline = Date.now() + timeoutMs;
48234
48295
  while (Date.now() < deadline) {
48235
48296
  if (await canConnect(endpoint)) return;
48236
- await new Promise((resolve19) => setTimeout(resolve19, STARTUP_POLL_MS));
48297
+ await new Promise((resolve20) => setTimeout(resolve20, STARTUP_POLL_MS));
48237
48298
  }
48238
48299
  throw new Error(`Session host did not become ready within ${timeoutMs}ms`);
48239
48300
  }
@@ -48339,10 +48400,10 @@ async function installExtension(ide, extension) {
48339
48400
  const buffer = Buffer.from(await res.arrayBuffer());
48340
48401
  const fs20 = await import("fs");
48341
48402
  fs20.writeFileSync(vsixPath, buffer);
48342
- return new Promise((resolve19) => {
48403
+ return new Promise((resolve20) => {
48343
48404
  const cmd = `"${ide.cliCommand}" --install-extension "${vsixPath}" --force`;
48344
48405
  (0, import_child_process11.exec)(cmd, { timeout: 6e4 }, (error48, _stdout, stderr) => {
48345
- resolve19({
48406
+ resolve20({
48346
48407
  extensionId: extension.id,
48347
48408
  marketplaceId: extension.marketplaceId,
48348
48409
  success: !error48,
@@ -48355,11 +48416,11 @@ async function installExtension(ide, extension) {
48355
48416
  } catch (e) {
48356
48417
  }
48357
48418
  }
48358
- return new Promise((resolve19) => {
48419
+ return new Promise((resolve20) => {
48359
48420
  const cmd = `"${ide.cliCommand}" --install-extension ${extension.marketplaceId} --force`;
48360
48421
  (0, import_child_process11.exec)(cmd, { timeout: 6e4 }, (error48, stdout, stderr) => {
48361
48422
  if (error48) {
48362
- resolve19({
48423
+ resolve20({
48363
48424
  extensionId: extension.id,
48364
48425
  marketplaceId: extension.marketplaceId,
48365
48426
  success: false,
@@ -48367,7 +48428,7 @@ async function installExtension(ide, extension) {
48367
48428
  error: stderr || error48.message
48368
48429
  });
48369
48430
  } else {
48370
- resolve19({
48431
+ resolve20({
48371
48432
  extensionId: extension.id,
48372
48433
  marketplaceId: extension.marketplaceId,
48373
48434
  success: true,
@@ -49222,7 +49283,7 @@ var init_server_connection = __esm({
49222
49283
  * Returns the command result or throws on timeout / auth failure.
49223
49284
  */
49224
49285
  sendMeshCommand(targetDaemonId, command, args = {}, timeoutMs = 3e4) {
49225
- return new Promise((resolve19, reject) => {
49286
+ return new Promise((resolve20, reject) => {
49226
49287
  const requestId = `mesh_${crypto.randomUUID()}`;
49227
49288
  const timer = setTimeout(() => {
49228
49289
  this.off("daemon_mesh_result", handler);
@@ -49235,7 +49296,7 @@ var init_server_connection = __esm({
49235
49296
  if (msg.payload?.success === false) {
49236
49297
  reject(new Error(msg.payload?.error ?? "Mesh command failed"));
49237
49298
  } else {
49238
- resolve19(msg.payload?.result);
49299
+ resolve20(msg.payload?.result);
49239
49300
  }
49240
49301
  };
49241
49302
  this.on("daemon_mesh_result", handler);
@@ -50542,19 +50603,19 @@ var init_peer_connection_manager = __esm({
50542
50603
  });
50543
50604
 
50544
50605
  // src/daemon-p2p/index.ts
50545
- var fs16, path27, import_node_module2, esmRequire, DaemonP2PSender;
50606
+ var fs16, path27, import_node_module3, esmRequire, DaemonP2PSender;
50546
50607
  var init_daemon_p2p = __esm({
50547
50608
  "src/daemon-p2p/index.ts"() {
50548
50609
  "use strict";
50549
50610
  fs16 = __toESM(require("fs"));
50550
50611
  path27 = __toESM(require("path"));
50551
- import_node_module2 = require("module");
50612
+ import_node_module3 = require("module");
50552
50613
  init_src();
50553
50614
  init_data_channel_router();
50554
50615
  init_screenshot_sender();
50555
50616
  init_peer_connection_manager();
50556
50617
  init_log();
50557
- esmRequire = (0, import_node_module2.createRequire)(__filename);
50618
+ esmRequire = (0, import_node_module3.createRequire)(__filename);
50558
50619
  DaemonP2PSender = class {
50559
50620
  serverConn;
50560
50621
  peers = /* @__PURE__ */ new Map();
@@ -51031,14 +51092,14 @@ var require_filesystem = __commonJS({
51031
51092
  });
51032
51093
  return buffer.subarray(0, bytesRead);
51033
51094
  };
51034
- var readFile2 = (path33) => new Promise((resolve19, reject) => {
51095
+ var readFile2 = (path33) => new Promise((resolve20, reject) => {
51035
51096
  fs20.open(path33, "r", (err, fd) => {
51036
51097
  if (err) {
51037
51098
  reject(err);
51038
51099
  } else {
51039
51100
  const buffer = Buffer.alloc(MAX_LENGTH);
51040
51101
  fs20.read(fd, buffer, 0, MAX_LENGTH, 0, (_2, bytesRead) => {
51041
- resolve19(buffer.subarray(0, bytesRead));
51102
+ resolve20(buffer.subarray(0, bytesRead));
51042
51103
  fs20.close(fd, () => {
51043
51104
  });
51044
51105
  });
@@ -51106,10 +51167,10 @@ var require_detect_libc = __commonJS({
51106
51167
  var commandOut = "";
51107
51168
  var safeCommand = () => {
51108
51169
  if (!commandOut) {
51109
- return new Promise((resolve19) => {
51170
+ return new Promise((resolve20) => {
51110
51171
  childProcess.exec(command, (err, out) => {
51111
51172
  commandOut = err ? " " : out;
51112
- resolve19(commandOut);
51173
+ resolve20(commandOut);
51113
51174
  });
51114
51175
  });
51115
51176
  }
@@ -53789,14 +53850,14 @@ var require_input = __commonJS({
53789
53850
  return this;
53790
53851
  } else {
53791
53852
  if (this._isStreamInput()) {
53792
- return new Promise((resolve19, reject) => {
53853
+ return new Promise((resolve20, reject) => {
53793
53854
  const finished = () => {
53794
53855
  this._flattenBufferIn();
53795
53856
  sharp.metadata(this.options, (err, metadata2) => {
53796
53857
  if (err) {
53797
53858
  reject(is.nativeError(err, stack));
53798
53859
  } else {
53799
- resolve19(metadata2);
53860
+ resolve20(metadata2);
53800
53861
  }
53801
53862
  });
53802
53863
  };
@@ -53807,12 +53868,12 @@ var require_input = __commonJS({
53807
53868
  }
53808
53869
  });
53809
53870
  } else {
53810
- return new Promise((resolve19, reject) => {
53871
+ return new Promise((resolve20, reject) => {
53811
53872
  sharp.metadata(this.options, (err, metadata2) => {
53812
53873
  if (err) {
53813
53874
  reject(is.nativeError(err, stack));
53814
53875
  } else {
53815
- resolve19(metadata2);
53876
+ resolve20(metadata2);
53816
53877
  }
53817
53878
  });
53818
53879
  });
@@ -53845,25 +53906,25 @@ var require_input = __commonJS({
53845
53906
  return this;
53846
53907
  } else {
53847
53908
  if (this._isStreamInput()) {
53848
- return new Promise((resolve19, reject) => {
53909
+ return new Promise((resolve20, reject) => {
53849
53910
  this.on("finish", function() {
53850
53911
  this._flattenBufferIn();
53851
53912
  sharp.stats(this.options, (err, stats2) => {
53852
53913
  if (err) {
53853
53914
  reject(is.nativeError(err, stack));
53854
53915
  } else {
53855
- resolve19(stats2);
53916
+ resolve20(stats2);
53856
53917
  }
53857
53918
  });
53858
53919
  });
53859
53920
  });
53860
53921
  } else {
53861
- return new Promise((resolve19, reject) => {
53922
+ return new Promise((resolve20, reject) => {
53862
53923
  sharp.stats(this.options, (err, stats2) => {
53863
53924
  if (err) {
53864
53925
  reject(is.nativeError(err, stack));
53865
53926
  } else {
53866
- resolve19(stats2);
53927
+ resolve20(stats2);
53867
53928
  }
53868
53929
  });
53869
53930
  });
@@ -57285,7 +57346,7 @@ var require_output = __commonJS({
57285
57346
  return this;
57286
57347
  } else {
57287
57348
  if (this._isStreamInput()) {
57288
- return new Promise((resolve19, reject) => {
57349
+ return new Promise((resolve20, reject) => {
57289
57350
  this.once("finish", () => {
57290
57351
  this._flattenBufferIn();
57291
57352
  sharp.pipeline(this.options, (err, data, info) => {
@@ -57293,24 +57354,24 @@ var require_output = __commonJS({
57293
57354
  reject(is.nativeError(err, stack));
57294
57355
  } else {
57295
57356
  if (this.options.resolveWithObject) {
57296
- resolve19({ data, info });
57357
+ resolve20({ data, info });
57297
57358
  } else {
57298
- resolve19(data);
57359
+ resolve20(data);
57299
57360
  }
57300
57361
  }
57301
57362
  });
57302
57363
  });
57303
57364
  });
57304
57365
  } else {
57305
- return new Promise((resolve19, reject) => {
57366
+ return new Promise((resolve20, reject) => {
57306
57367
  sharp.pipeline(this.options, (err, data, info) => {
57307
57368
  if (err) {
57308
57369
  reject(is.nativeError(err, stack));
57309
57370
  } else {
57310
57371
  if (this.options.resolveWithObject) {
57311
- resolve19({ data, info });
57372
+ resolve20({ data, info });
57312
57373
  } else {
57313
- resolve19(data);
57374
+ resolve20(data);
57314
57375
  }
57315
57376
  }
57316
57377
  });
@@ -58689,9 +58750,9 @@ function resolvePackageVersion(options) {
58689
58750
  const injectedVersion = options?.injectedVersion || "unknown";
58690
58751
  const dir = options?.dirname || __dirname;
58691
58752
  const possiblePaths = [
58692
- (0, import_path5.join)(dir, "..", "..", "package.json"),
58693
- (0, import_path5.join)(dir, "..", "package.json"),
58694
- (0, import_path5.join)(dir, "package.json")
58753
+ (0, import_path4.join)(dir, "..", "..", "package.json"),
58754
+ (0, import_path4.join)(dir, "..", "package.json"),
58755
+ (0, import_path4.join)(dir, "package.json")
58695
58756
  ];
58696
58757
  for (const p of possiblePaths) {
58697
58758
  try {
@@ -58702,12 +58763,12 @@ function resolvePackageVersion(options) {
58702
58763
  }
58703
58764
  return injectedVersion;
58704
58765
  }
58705
- var import_fs7, import_path5;
58766
+ var import_fs7, import_path4;
58706
58767
  var init_version = __esm({
58707
58768
  "src/version.ts"() {
58708
58769
  "use strict";
58709
58770
  import_fs7 = require("fs");
58710
- import_path5 = require("path");
58771
+ import_path4 = require("path");
58711
58772
  }
58712
58773
  });
58713
58774
 
@@ -59036,7 +59097,7 @@ var init_adhdev_daemon = __esm({
59036
59097
  init_version();
59037
59098
  init_src();
59038
59099
  init_runtime_defaults();
59039
- pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.71" });
59100
+ pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.72" });
59040
59101
  AdhdevDaemon = class _AdhdevDaemon {
59041
59102
  localHttpServer = null;
59042
59103
  localWss = null;
@@ -59852,7 +59913,7 @@ ${err?.stack || ""}`);
59852
59913
  try {
59853
59914
  const statusResult = await Promise.race([
59854
59915
  this.components.router.execute("git_status", { workspace }, "mesh"),
59855
- new Promise((resolve19) => setTimeout(() => resolve19(null), 4e3))
59916
+ new Promise((resolve20) => setTimeout(() => resolve20(null), 4e3))
59856
59917
  ]);
59857
59918
  const s = statusResult?.status ?? statusResult;
59858
59919
  if (s?.isGitRepo) {
@@ -60035,7 +60096,7 @@ ${err?.stack || ""}`);
60035
60096
  this.localWss.emit("connection", ws, req);
60036
60097
  });
60037
60098
  });
60038
- await new Promise((resolve19, reject) => {
60099
+ await new Promise((resolve20, reject) => {
60039
60100
  const cleanup = () => {
60040
60101
  this.localHttpServer?.off("error", onError);
60041
60102
  this.localHttpServer?.off("listening", onListening);
@@ -60046,7 +60107,7 @@ ${err?.stack || ""}`);
60046
60107
  };
60047
60108
  const onListening = () => {
60048
60109
  cleanup();
60049
- resolve19();
60110
+ resolve20();
60050
60111
  };
60051
60112
  this.localHttpServer.once("error", onError);
60052
60113
  this.localHttpServer.once("listening", onListening);
@@ -60220,12 +60281,12 @@ ${err?.stack || ""}`);
60220
60281
  this.localClients.clear();
60221
60282
  this.localWss?.close();
60222
60283
  this.localWss = null;
60223
- await new Promise((resolve19) => {
60284
+ await new Promise((resolve20) => {
60224
60285
  if (!this.localHttpServer) {
60225
- resolve19();
60286
+ resolve20();
60226
60287
  return;
60227
60288
  }
60228
- this.localHttpServer.close(() => resolve19());
60289
+ this.localHttpServer.close(() => resolve20());
60229
60290
  this.localHttpServer = null;
60230
60291
  });
60231
60292
  } catch {
@@ -60773,14 +60834,14 @@ var require_run_async = __commonJS({
60773
60834
  return function() {
60774
60835
  var args = arguments;
60775
60836
  var originalThis = this;
60776
- var promise2 = new Promise(function(resolve19, reject) {
60837
+ var promise2 = new Promise(function(resolve20, reject) {
60777
60838
  var resolved = false;
60778
60839
  const wrappedResolve = function(value) {
60779
60840
  if (resolved) {
60780
60841
  console.warn("Run-async promise already resolved.");
60781
60842
  }
60782
60843
  resolved = true;
60783
- resolve19(value);
60844
+ resolve20(value);
60784
60845
  };
60785
60846
  var rejected = false;
60786
60847
  const wrappedReject = function(value) {
@@ -61571,7 +61632,7 @@ var require_Observable = __commonJS({
61571
61632
  Observable2.prototype.forEach = function(next, promiseCtor) {
61572
61633
  var _this = this;
61573
61634
  promiseCtor = getPromiseCtor(promiseCtor);
61574
- return new promiseCtor(function(resolve19, reject) {
61635
+ return new promiseCtor(function(resolve20, reject) {
61575
61636
  var subscriber = new Subscriber_1.SafeSubscriber({
61576
61637
  next: function(value) {
61577
61638
  try {
@@ -61582,7 +61643,7 @@ var require_Observable = __commonJS({
61582
61643
  }
61583
61644
  },
61584
61645
  error: reject,
61585
- complete: resolve19
61646
+ complete: resolve20
61586
61647
  });
61587
61648
  _this.subscribe(subscriber);
61588
61649
  });
@@ -61604,14 +61665,14 @@ var require_Observable = __commonJS({
61604
61665
  Observable2.prototype.toPromise = function(promiseCtor) {
61605
61666
  var _this = this;
61606
61667
  promiseCtor = getPromiseCtor(promiseCtor);
61607
- return new promiseCtor(function(resolve19, reject) {
61668
+ return new promiseCtor(function(resolve20, reject) {
61608
61669
  var value;
61609
61670
  _this.subscribe(function(x) {
61610
61671
  return value = x;
61611
61672
  }, function(err) {
61612
61673
  return reject(err);
61613
61674
  }, function() {
61614
- return resolve19(value);
61675
+ return resolve20(value);
61615
61676
  });
61616
61677
  });
61617
61678
  };
@@ -63707,11 +63768,11 @@ var require_innerFrom = __commonJS({
63707
63768
  "use strict";
63708
63769
  var __awaiter = exports2 && exports2.__awaiter || function(thisArg, _arguments, P, generator) {
63709
63770
  function adopt(value) {
63710
- return value instanceof P ? value : new P(function(resolve19) {
63711
- resolve19(value);
63771
+ return value instanceof P ? value : new P(function(resolve20) {
63772
+ resolve20(value);
63712
63773
  });
63713
63774
  }
63714
- return new (P || (P = Promise))(function(resolve19, reject) {
63775
+ return new (P || (P = Promise))(function(resolve20, reject) {
63715
63776
  function fulfilled(value) {
63716
63777
  try {
63717
63778
  step(generator.next(value));
@@ -63727,7 +63788,7 @@ var require_innerFrom = __commonJS({
63727
63788
  }
63728
63789
  }
63729
63790
  function step(result) {
63730
- result.done ? resolve19(result.value) : adopt(result.value).then(fulfilled, rejected);
63791
+ result.done ? resolve20(result.value) : adopt(result.value).then(fulfilled, rejected);
63731
63792
  }
63732
63793
  step((generator = generator.apply(thisArg, _arguments || [])).next());
63733
63794
  });
@@ -63809,14 +63870,14 @@ var require_innerFrom = __commonJS({
63809
63870
  }, i);
63810
63871
  function verb(n) {
63811
63872
  i[n] = o[n] && function(v) {
63812
- return new Promise(function(resolve19, reject) {
63813
- v = o[n](v), settle(resolve19, reject, v.done, v.value);
63873
+ return new Promise(function(resolve20, reject) {
63874
+ v = o[n](v), settle(resolve20, reject, v.done, v.value);
63814
63875
  });
63815
63876
  };
63816
63877
  }
63817
- function settle(resolve19, reject, d, v) {
63878
+ function settle(resolve20, reject, d, v) {
63818
63879
  Promise.resolve(v).then(function(v2) {
63819
- resolve19({ value: v2, done: d });
63880
+ resolve20({ value: v2, done: d });
63820
63881
  }, reject);
63821
63882
  }
63822
63883
  };
@@ -64435,7 +64496,7 @@ var require_lastValueFrom = __commonJS({
64435
64496
  var EmptyError_1 = require_EmptyError();
64436
64497
  function lastValueFrom(source, config2) {
64437
64498
  var hasConfig = typeof config2 === "object";
64438
- return new Promise(function(resolve19, reject) {
64499
+ return new Promise(function(resolve20, reject) {
64439
64500
  var _hasValue = false;
64440
64501
  var _value;
64441
64502
  source.subscribe({
@@ -64446,9 +64507,9 @@ var require_lastValueFrom = __commonJS({
64446
64507
  error: reject,
64447
64508
  complete: function() {
64448
64509
  if (_hasValue) {
64449
- resolve19(_value);
64510
+ resolve20(_value);
64450
64511
  } else if (hasConfig) {
64451
- resolve19(config2.defaultValue);
64512
+ resolve20(config2.defaultValue);
64452
64513
  } else {
64453
64514
  reject(new EmptyError_1.EmptyError());
64454
64515
  }
@@ -64470,16 +64531,16 @@ var require_firstValueFrom = __commonJS({
64470
64531
  var Subscriber_1 = require_Subscriber();
64471
64532
  function firstValueFrom(source, config2) {
64472
64533
  var hasConfig = typeof config2 === "object";
64473
- return new Promise(function(resolve19, reject) {
64534
+ return new Promise(function(resolve20, reject) {
64474
64535
  var subscriber = new Subscriber_1.SafeSubscriber({
64475
64536
  next: function(value) {
64476
- resolve19(value);
64537
+ resolve20(value);
64477
64538
  subscriber.unsubscribe();
64478
64539
  },
64479
64540
  error: reject,
64480
64541
  complete: function() {
64481
64542
  if (hasConfig) {
64482
- resolve19(config2.defaultValue);
64543
+ resolve20(config2.defaultValue);
64483
64544
  } else {
64484
64545
  reject(new EmptyError_1.EmptyError());
64485
64546
  }
@@ -76285,14 +76346,14 @@ var require_async_iterator = __commonJS({
76285
76346
  };
76286
76347
  }
76287
76348
  function readAndResolve(iter) {
76288
- var resolve19 = iter[kLastResolve];
76289
- if (resolve19 !== null) {
76349
+ var resolve20 = iter[kLastResolve];
76350
+ if (resolve20 !== null) {
76290
76351
  var data = iter[kStream].read();
76291
76352
  if (data !== null) {
76292
76353
  iter[kLastPromise] = null;
76293
76354
  iter[kLastResolve] = null;
76294
76355
  iter[kLastReject] = null;
76295
- resolve19(createIterResult(data, false));
76356
+ resolve20(createIterResult(data, false));
76296
76357
  }
76297
76358
  }
76298
76359
  }
@@ -76300,13 +76361,13 @@ var require_async_iterator = __commonJS({
76300
76361
  process.nextTick(readAndResolve, iter);
76301
76362
  }
76302
76363
  function wrapForNext(lastPromise, iter) {
76303
- return function(resolve19, reject) {
76364
+ return function(resolve20, reject) {
76304
76365
  lastPromise.then(function() {
76305
76366
  if (iter[kEnded]) {
76306
- resolve19(createIterResult(void 0, true));
76367
+ resolve20(createIterResult(void 0, true));
76307
76368
  return;
76308
76369
  }
76309
- iter[kHandlePromise](resolve19, reject);
76370
+ iter[kHandlePromise](resolve20, reject);
76310
76371
  }, reject);
76311
76372
  };
76312
76373
  }
@@ -76326,12 +76387,12 @@ var require_async_iterator = __commonJS({
76326
76387
  return Promise.resolve(createIterResult(void 0, true));
76327
76388
  }
76328
76389
  if (this[kStream].destroyed) {
76329
- return new Promise(function(resolve19, reject) {
76390
+ return new Promise(function(resolve20, reject) {
76330
76391
  process.nextTick(function() {
76331
76392
  if (_this[kError]) {
76332
76393
  reject(_this[kError]);
76333
76394
  } else {
76334
- resolve19(createIterResult(void 0, true));
76395
+ resolve20(createIterResult(void 0, true));
76335
76396
  }
76336
76397
  });
76337
76398
  });
@@ -76354,13 +76415,13 @@ var require_async_iterator = __commonJS({
76354
76415
  return this;
76355
76416
  }), _defineProperty(_Object$setPrototypeO, "return", function _return() {
76356
76417
  var _this2 = this;
76357
- return new Promise(function(resolve19, reject) {
76418
+ return new Promise(function(resolve20, reject) {
76358
76419
  _this2[kStream].destroy(null, function(err) {
76359
76420
  if (err) {
76360
76421
  reject(err);
76361
76422
  return;
76362
76423
  }
76363
- resolve19(createIterResult(void 0, true));
76424
+ resolve20(createIterResult(void 0, true));
76364
76425
  });
76365
76426
  });
76366
76427
  }), _Object$setPrototypeO), AsyncIteratorPrototype);
@@ -76382,15 +76443,15 @@ var require_async_iterator = __commonJS({
76382
76443
  value: stream._readableState.endEmitted,
76383
76444
  writable: true
76384
76445
  }), _defineProperty(_Object$create, kHandlePromise, {
76385
- value: function value(resolve19, reject) {
76446
+ value: function value(resolve20, reject) {
76386
76447
  var data = iterator[kStream].read();
76387
76448
  if (data) {
76388
76449
  iterator[kLastPromise] = null;
76389
76450
  iterator[kLastResolve] = null;
76390
76451
  iterator[kLastReject] = null;
76391
- resolve19(createIterResult(data, false));
76452
+ resolve20(createIterResult(data, false));
76392
76453
  } else {
76393
- iterator[kLastResolve] = resolve19;
76454
+ iterator[kLastResolve] = resolve20;
76394
76455
  iterator[kLastReject] = reject;
76395
76456
  }
76396
76457
  },
@@ -76409,12 +76470,12 @@ var require_async_iterator = __commonJS({
76409
76470
  iterator[kError] = err;
76410
76471
  return;
76411
76472
  }
76412
- var resolve19 = iterator[kLastResolve];
76413
- if (resolve19 !== null) {
76473
+ var resolve20 = iterator[kLastResolve];
76474
+ if (resolve20 !== null) {
76414
76475
  iterator[kLastPromise] = null;
76415
76476
  iterator[kLastResolve] = null;
76416
76477
  iterator[kLastReject] = null;
76417
- resolve19(createIterResult(void 0, true));
76478
+ resolve20(createIterResult(void 0, true));
76418
76479
  }
76419
76480
  iterator[kEnded] = true;
76420
76481
  });
@@ -76429,7 +76490,7 @@ var require_async_iterator = __commonJS({
76429
76490
  var require_from2 = __commonJS({
76430
76491
  "../../node_modules/readable-stream/lib/internal/streams/from.js"(exports2, module2) {
76431
76492
  "use strict";
76432
- function asyncGeneratorStep(gen, resolve19, reject, _next, _throw, key, arg) {
76493
+ function asyncGeneratorStep(gen, resolve20, reject, _next, _throw, key, arg) {
76433
76494
  try {
76434
76495
  var info = gen[key](arg);
76435
76496
  var value = info.value;
@@ -76438,7 +76499,7 @@ var require_from2 = __commonJS({
76438
76499
  return;
76439
76500
  }
76440
76501
  if (info.done) {
76441
- resolve19(value);
76502
+ resolve20(value);
76442
76503
  } else {
76443
76504
  Promise.resolve(value).then(_next, _throw);
76444
76505
  }
@@ -76446,13 +76507,13 @@ var require_from2 = __commonJS({
76446
76507
  function _asyncToGenerator(fn) {
76447
76508
  return function() {
76448
76509
  var self2 = this, args = arguments;
76449
- return new Promise(function(resolve19, reject) {
76510
+ return new Promise(function(resolve20, reject) {
76450
76511
  var gen = fn.apply(self2, args);
76451
76512
  function _next(value) {
76452
- asyncGeneratorStep(gen, resolve19, reject, _next, _throw, "next", value);
76513
+ asyncGeneratorStep(gen, resolve20, reject, _next, _throw, "next", value);
76453
76514
  }
76454
76515
  function _throw(err) {
76455
- asyncGeneratorStep(gen, resolve19, reject, _next, _throw, "throw", err);
76516
+ asyncGeneratorStep(gen, resolve20, reject, _next, _throw, "throw", err);
76456
76517
  }
76457
76518
  _next(void 0);
76458
76519
  });
@@ -78391,9 +78452,9 @@ var init_base = __esm({
78391
78452
  * @return {Promise}
78392
78453
  */
78393
78454
  run() {
78394
- return new Promise((resolve19, reject) => {
78455
+ return new Promise((resolve20, reject) => {
78395
78456
  this._run(
78396
- (value) => resolve19(value),
78457
+ (value) => resolve20(value),
78397
78458
  (error48) => reject(error48)
78398
78459
  );
78399
78460
  });
@@ -85025,7 +85086,7 @@ var require_lib2 = __commonJS({
85025
85086
  return matches;
85026
85087
  };
85027
85088
  exports2.analyse = analyse;
85028
- var detectFile = (filepath, opts = {}) => new Promise((resolve19, reject) => {
85089
+ var detectFile = (filepath, opts = {}) => new Promise((resolve20, reject) => {
85029
85090
  let fd;
85030
85091
  const fs20 = (0, node_1.default)();
85031
85092
  const handler = (err, buffer) => {
@@ -85035,7 +85096,7 @@ var require_lib2 = __commonJS({
85035
85096
  if (err) {
85036
85097
  reject(err);
85037
85098
  } else if (buffer) {
85038
- resolve19((0, exports2.detect)(buffer));
85099
+ resolve20((0, exports2.detect)(buffer));
85039
85100
  } else {
85040
85101
  reject(new Error("No error and no buffer received"));
85041
85102
  }
@@ -88963,14 +89024,14 @@ function splitStringBySpace(str) {
88963
89024
  }
88964
89025
  return pieces;
88965
89026
  }
88966
- var import_chardet, import_child_process14, import_fs8, import_node_path2, import_node_os4, import_node_crypto2, import_iconv_lite, ExternalEditor;
89027
+ var import_chardet, import_child_process14, import_fs8, import_node_path3, import_node_os4, import_node_crypto2, import_iconv_lite, ExternalEditor;
88967
89028
  var init_esm2 = __esm({
88968
89029
  "../../node_modules/@inquirer/external-editor/dist/esm/index.js"() {
88969
89030
  "use strict";
88970
89031
  import_chardet = __toESM(require_lib2(), 1);
88971
89032
  import_child_process14 = require("child_process");
88972
89033
  import_fs8 = require("fs");
88973
- import_node_path2 = __toESM(require("path"), 1);
89034
+ import_node_path3 = __toESM(require("path"), 1);
88974
89035
  import_node_os4 = __toESM(require("os"), 1);
88975
89036
  import_node_crypto2 = require("crypto");
88976
89037
  import_iconv_lite = __toESM(require_lib3(), 1);
@@ -89035,8 +89096,8 @@ var init_esm2 = __esm({
89035
89096
  const prefix = sanitizeAffix(this.fileOptions.prefix);
89036
89097
  const postfix = sanitizeAffix(this.fileOptions.postfix);
89037
89098
  const filename = `${prefix}${id}${postfix}`;
89038
- const candidate = import_node_path2.default.resolve(baseDir, filename);
89039
- const baseResolved = import_node_path2.default.resolve(baseDir) + import_node_path2.default.sep;
89099
+ const candidate = import_node_path3.default.resolve(baseDir, filename);
89100
+ const baseResolved = import_node_path3.default.resolve(baseDir) + import_node_path3.default.sep;
89040
89101
  if (!candidate.startsWith(baseResolved)) {
89041
89102
  throw new Error("Resolved temporary file escaped the base directory");
89042
89103
  }