adhdev 0.9.58 → 0.9.60

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
@@ -2843,19 +2843,19 @@ function resolveCommandPath(command) {
2843
2843
  return null;
2844
2844
  }
2845
2845
  function execAsync(cmd, timeoutMs = 5e3) {
2846
- return new Promise((resolve21) => {
2846
+ return new Promise((resolve22) => {
2847
2847
  const child = (0, import_child_process2.exec)(cmd, {
2848
2848
  encoding: "utf-8",
2849
2849
  timeout: timeoutMs,
2850
2850
  ...process.platform === "win32" ? { windowsHide: true } : {}
2851
2851
  }, (err, stdout) => {
2852
2852
  if (err || !stdout?.trim()) {
2853
- resolve21(null);
2853
+ resolve22(null);
2854
2854
  } else {
2855
- resolve21(stdout.trim());
2855
+ resolve22(stdout.trim());
2856
2856
  }
2857
2857
  });
2858
- child.on("error", () => resolve21(null));
2858
+ child.on("error", () => resolve22(null));
2859
2859
  });
2860
2860
  }
2861
2861
  async function detectCLIs(providerLoader, options) {
@@ -3467,7 +3467,7 @@ var init_manager = __esm({
3467
3467
  * Returns multiple entries if multiple IDE windows are open on same port
3468
3468
  */
3469
3469
  static listAllTargets(port) {
3470
- return new Promise((resolve21) => {
3470
+ return new Promise((resolve22) => {
3471
3471
  const req = http.get(`http://127.0.0.1:${port}/json`, (res) => {
3472
3472
  let data = "";
3473
3473
  res.on("data", (chunk) => data += chunk.toString());
@@ -3483,16 +3483,16 @@ var init_manager = __esm({
3483
3483
  (t) => !isNonMain(t.title || "") && t.url?.includes("workbench.html") && !t.url?.includes("agent")
3484
3484
  );
3485
3485
  const fallbackPages = pages.filter((t) => !isNonMain(t.title || ""));
3486
- resolve21(mainPages.length > 0 ? mainPages : fallbackPages);
3486
+ resolve22(mainPages.length > 0 ? mainPages : fallbackPages);
3487
3487
  } catch {
3488
- resolve21([]);
3488
+ resolve22([]);
3489
3489
  }
3490
3490
  });
3491
3491
  });
3492
- req.on("error", () => resolve21([]));
3492
+ req.on("error", () => resolve22([]));
3493
3493
  req.setTimeout(2e3, () => {
3494
3494
  req.destroy();
3495
- resolve21([]);
3495
+ resolve22([]);
3496
3496
  });
3497
3497
  });
3498
3498
  }
@@ -3532,7 +3532,7 @@ var init_manager = __esm({
3532
3532
  }
3533
3533
  }
3534
3534
  findTargetOnPort(port) {
3535
- return new Promise((resolve21) => {
3535
+ return new Promise((resolve22) => {
3536
3536
  const req = http.get(`http://127.0.0.1:${port}/json`, (res) => {
3537
3537
  let data = "";
3538
3538
  res.on("data", (chunk) => data += chunk.toString());
@@ -3543,7 +3543,7 @@ var init_manager = __esm({
3543
3543
  (t) => (t.type === "page" || t.type === "browser" || t.type === "Page") && t.webSocketDebuggerUrl
3544
3544
  );
3545
3545
  if (pages.length === 0) {
3546
- resolve21(targets.find((t) => t.webSocketDebuggerUrl) || null);
3546
+ resolve22(targets.find((t) => t.webSocketDebuggerUrl) || null);
3547
3547
  return;
3548
3548
  }
3549
3549
  const titleFilteredPages = pages.filter((t) => !this.isNonMainTitle(t.title || ""));
@@ -3562,25 +3562,25 @@ var init_manager = __esm({
3562
3562
  this._targetId = selected.target.id;
3563
3563
  }
3564
3564
  this._pageTitle = selected.target.title || "";
3565
- resolve21(selected.target);
3565
+ resolve22(selected.target);
3566
3566
  return;
3567
3567
  }
3568
3568
  if (previousTargetId) {
3569
3569
  this.log(`[CDP] Target ${previousTargetId} not found in page list`);
3570
- resolve21(null);
3570
+ resolve22(null);
3571
3571
  return;
3572
3572
  }
3573
3573
  this._pageTitle = list[0]?.title || "";
3574
- resolve21(list[0]);
3574
+ resolve22(list[0]);
3575
3575
  } catch {
3576
- resolve21(null);
3576
+ resolve22(null);
3577
3577
  }
3578
3578
  });
3579
3579
  });
3580
- req.on("error", () => resolve21(null));
3580
+ req.on("error", () => resolve22(null));
3581
3581
  req.setTimeout(2e3, () => {
3582
3582
  req.destroy();
3583
- resolve21(null);
3583
+ resolve22(null);
3584
3584
  });
3585
3585
  });
3586
3586
  }
@@ -3591,7 +3591,7 @@ var init_manager = __esm({
3591
3591
  this.extensionProviders = providers;
3592
3592
  }
3593
3593
  connectToTarget(wsUrl) {
3594
- return new Promise((resolve21) => {
3594
+ return new Promise((resolve22) => {
3595
3595
  this.ws = new import_ws.default(wsUrl);
3596
3596
  this.ws.on("open", async () => {
3597
3597
  this._connected = true;
@@ -3601,17 +3601,17 @@ var init_manager = __esm({
3601
3601
  }
3602
3602
  this.connectBrowserWs().catch(() => {
3603
3603
  });
3604
- resolve21(true);
3604
+ resolve22(true);
3605
3605
  });
3606
3606
  this.ws.on("message", (data) => {
3607
3607
  try {
3608
3608
  const msg = JSON.parse(data.toString());
3609
3609
  if (msg.id && this.pending.has(msg.id)) {
3610
- const { resolve: resolve22, reject } = this.pending.get(msg.id);
3610
+ const { resolve: resolve23, reject } = this.pending.get(msg.id);
3611
3611
  this.pending.delete(msg.id);
3612
3612
  this.failureCount = 0;
3613
3613
  if (msg.error) reject(new Error(msg.error.message));
3614
- else resolve22(msg.result);
3614
+ else resolve23(msg.result);
3615
3615
  } else if (msg.method === "Runtime.executionContextCreated") {
3616
3616
  this.contexts.add(msg.params.context.id);
3617
3617
  } else if (msg.method === "Runtime.executionContextDestroyed") {
@@ -3634,7 +3634,7 @@ var init_manager = __esm({
3634
3634
  this.ws.on("error", (err) => {
3635
3635
  this.log(`[CDP] WebSocket error: ${err.message}`);
3636
3636
  this._connected = false;
3637
- resolve21(false);
3637
+ resolve22(false);
3638
3638
  });
3639
3639
  });
3640
3640
  }
@@ -3648,7 +3648,7 @@ var init_manager = __esm({
3648
3648
  return;
3649
3649
  }
3650
3650
  this.log(`[CDP] Connecting browser WS for target discovery...`);
3651
- await new Promise((resolve21, reject) => {
3651
+ await new Promise((resolve22, reject) => {
3652
3652
  this.browserWs = new import_ws.default(browserWsUrl);
3653
3653
  this.browserWs.on("open", async () => {
3654
3654
  this._browserConnected = true;
@@ -3658,16 +3658,16 @@ var init_manager = __esm({
3658
3658
  } catch (e) {
3659
3659
  this.log(`[CDP] setDiscoverTargets failed: ${e.message}`);
3660
3660
  }
3661
- resolve21();
3661
+ resolve22();
3662
3662
  });
3663
3663
  this.browserWs.on("message", (data) => {
3664
3664
  try {
3665
3665
  const msg = JSON.parse(data.toString());
3666
3666
  if (msg.id && this.browserPending.has(msg.id)) {
3667
- const { resolve: resolve22, reject: reject2 } = this.browserPending.get(msg.id);
3667
+ const { resolve: resolve23, reject: reject2 } = this.browserPending.get(msg.id);
3668
3668
  this.browserPending.delete(msg.id);
3669
3669
  if (msg.error) reject2(new Error(msg.error.message));
3670
- else resolve22(msg.result);
3670
+ else resolve23(msg.result);
3671
3671
  }
3672
3672
  } catch {
3673
3673
  }
@@ -3687,31 +3687,31 @@ var init_manager = __esm({
3687
3687
  }
3688
3688
  }
3689
3689
  getBrowserWsUrl() {
3690
- return new Promise((resolve21) => {
3690
+ return new Promise((resolve22) => {
3691
3691
  const req = http.get(`http://127.0.0.1:${this.port}/json/version`, (res) => {
3692
3692
  let data = "";
3693
3693
  res.on("data", (chunk) => data += chunk.toString());
3694
3694
  res.on("end", () => {
3695
3695
  try {
3696
3696
  const info = JSON.parse(data);
3697
- resolve21(info.webSocketDebuggerUrl || null);
3697
+ resolve22(info.webSocketDebuggerUrl || null);
3698
3698
  } catch {
3699
- resolve21(null);
3699
+ resolve22(null);
3700
3700
  }
3701
3701
  });
3702
3702
  });
3703
- req.on("error", () => resolve21(null));
3703
+ req.on("error", () => resolve22(null));
3704
3704
  req.setTimeout(3e3, () => {
3705
3705
  req.destroy();
3706
- resolve21(null);
3706
+ resolve22(null);
3707
3707
  });
3708
3708
  });
3709
3709
  }
3710
3710
  sendBrowser(method, params = {}, timeoutMs = 15e3) {
3711
- return new Promise((resolve21, reject) => {
3711
+ return new Promise((resolve22, reject) => {
3712
3712
  if (!this.browserWs || !this._browserConnected) return reject(new Error("Browser WS not connected"));
3713
3713
  const id = this.browserMsgId++;
3714
- this.browserPending.set(id, { resolve: resolve21, reject });
3714
+ this.browserPending.set(id, { resolve: resolve22, reject });
3715
3715
  this.browserWs.send(JSON.stringify({ id, method, params }));
3716
3716
  setTimeout(() => {
3717
3717
  if (this.browserPending.has(id)) {
@@ -3751,11 +3751,11 @@ var init_manager = __esm({
3751
3751
  }
3752
3752
  // ─── CDP Protocol ────────────────────────────────────────
3753
3753
  sendInternal(method, params = {}, timeoutMs = 15e3) {
3754
- return new Promise((resolve21, reject) => {
3754
+ return new Promise((resolve22, reject) => {
3755
3755
  if (!this.ws || !this._connected) return reject(new Error("CDP not connected"));
3756
3756
  if (this.ws.readyState !== import_ws.default.OPEN) return reject(new Error("WebSocket not open"));
3757
3757
  const id = this.msgId++;
3758
- this.pending.set(id, { resolve: resolve21, reject });
3758
+ this.pending.set(id, { resolve: resolve22, reject });
3759
3759
  this.ws.send(JSON.stringify({ id, method, params }));
3760
3760
  setTimeout(() => {
3761
3761
  if (this.pending.has(id)) {
@@ -4004,7 +4004,7 @@ var init_manager = __esm({
4004
4004
  const browserWs = this.browserWs;
4005
4005
  let msgId = this.browserMsgId;
4006
4006
  const sendWs = (method, params = {}, sessionId) => {
4007
- return new Promise((resolve21, reject) => {
4007
+ return new Promise((resolve22, reject) => {
4008
4008
  const mid = msgId++;
4009
4009
  this.browserMsgId = msgId;
4010
4010
  const handler = (raw) => {
@@ -4013,7 +4013,7 @@ var init_manager = __esm({
4013
4013
  if (msg.id === mid) {
4014
4014
  browserWs.removeListener("message", handler);
4015
4015
  if (msg.error) reject(new Error(msg.error.message || JSON.stringify(msg.error)));
4016
- else resolve21(msg.result);
4016
+ else resolve22(msg.result);
4017
4017
  }
4018
4018
  } catch {
4019
4019
  }
@@ -4214,14 +4214,14 @@ var init_manager = __esm({
4214
4214
  if (!ws || ws.readyState !== import_ws.default.OPEN) {
4215
4215
  throw new Error("CDP not connected");
4216
4216
  }
4217
- return new Promise((resolve21, reject) => {
4217
+ return new Promise((resolve22, reject) => {
4218
4218
  const id = getNextId();
4219
4219
  pendingMap.set(id, {
4220
4220
  resolve: (result) => {
4221
4221
  if (result?.result?.subtype === "error") {
4222
4222
  reject(new Error(result.result.description));
4223
4223
  } else {
4224
- resolve21(result?.result?.value);
4224
+ resolve22(result?.result?.value);
4225
4225
  }
4226
4226
  },
4227
4227
  reject
@@ -4253,10 +4253,10 @@ var init_manager = __esm({
4253
4253
  throw new Error("CDP not connected");
4254
4254
  }
4255
4255
  const sendViaSession = (method, params = {}) => {
4256
- return new Promise((resolve21, reject) => {
4256
+ return new Promise((resolve22, reject) => {
4257
4257
  const pendingMap = this._browserConnected ? this.browserPending : this.pending;
4258
4258
  const id = this._browserConnected ? this.browserMsgId++ : this.msgId++;
4259
- pendingMap.set(id, { resolve: resolve21, reject });
4259
+ pendingMap.set(id, { resolve: resolve22, reject });
4260
4260
  ws.send(JSON.stringify({ id, sessionId, method, params }));
4261
4261
  setTimeout(() => {
4262
4262
  if (pendingMap.has(id)) {
@@ -9277,18 +9277,31 @@ function collapseReplayDuplicatesFromReadChat(messages) {
9277
9277
  const collapsed = [];
9278
9278
  const replaySignaturesInCurrentTurn = /* @__PURE__ */ new Set();
9279
9279
  let stableAssistantAnswerContentInCurrentTurn = "";
9280
+ let stableAssistantAnswerCollapsedIndex = -1;
9281
+ let stableAssistantAnswerHadInterveningActivity = false;
9280
9282
  let previousReplaySignature = "";
9281
9283
  for (const message of messages) {
9282
9284
  const info = getReadChatReplayCollapseInfo(message);
9283
9285
  if (info?.role === "user") {
9284
9286
  replaySignaturesInCurrentTurn.clear();
9285
9287
  stableAssistantAnswerContentInCurrentTurn = "";
9288
+ stableAssistantAnswerCollapsedIndex = -1;
9289
+ stableAssistantAnswerHadInterveningActivity = false;
9286
9290
  previousReplaySignature = "";
9287
9291
  }
9288
9292
  if (info?.collapsible && info.signature) {
9289
9293
  if (previousReplaySignature === info.signature) continue;
9290
9294
  if (replaySignaturesInCurrentTurn.has(info.signature)) continue;
9291
- if (isReplayedAssistantAnswerAfterStableAnswerInfo(info, stableAssistantAnswerContentInCurrentTurn)) continue;
9295
+ if (isReplayedAssistantAnswerAfterStableAnswerInfo(info, stableAssistantAnswerContentInCurrentTurn)) {
9296
+ const isAdjacentFullerAssistantAnswer = info.role === "assistant" && (!info.kind || info.kind === "standard") && stableAssistantAnswerCollapsedIndex >= 0 && stableAssistantAnswerCollapsedIndex === collapsed.length - 1 && !stableAssistantAnswerHadInterveningActivity && info.content.length > stableAssistantAnswerContentInCurrentTurn.length && info.content.startsWith(stableAssistantAnswerContentInCurrentTurn);
9297
+ if (isAdjacentFullerAssistantAnswer) {
9298
+ collapsed[stableAssistantAnswerCollapsedIndex] = message;
9299
+ replaySignaturesInCurrentTurn.add(info.signature);
9300
+ stableAssistantAnswerContentInCurrentTurn = info.content;
9301
+ previousReplaySignature = info.signature;
9302
+ }
9303
+ continue;
9304
+ }
9292
9305
  }
9293
9306
  collapsed.push(message);
9294
9307
  previousReplaySignature = info?.collapsible ? info.signature : "";
@@ -9297,6 +9310,10 @@ function collapseReplayDuplicatesFromReadChat(messages) {
9297
9310
  }
9298
9311
  if (isStableReadChatAssistantAnswerInfo(info)) {
9299
9312
  stableAssistantAnswerContentInCurrentTurn = info?.content || "";
9313
+ stableAssistantAnswerCollapsedIndex = collapsed.length - 1;
9314
+ stableAssistantAnswerHadInterveningActivity = false;
9315
+ } else if (stableAssistantAnswerContentInCurrentTurn && info?.role === "assistant" && (!info.kind || info.kind !== "standard")) {
9316
+ stableAssistantAnswerHadInterveningActivity = true;
9300
9317
  }
9301
9318
  }
9302
9319
  return collapsed;
@@ -9829,7 +9846,7 @@ function getCliVisibleTranscriptCount(adapter) {
9829
9846
  async function getStableExtensionBaseline(h) {
9830
9847
  const first = await readExtensionChatState(h);
9831
9848
  if (getStateMessageCount(first) > 0 || getStateLastSignature(first)) return first;
9832
- await new Promise((resolve21) => setTimeout(resolve21, 150));
9849
+ await new Promise((resolve22) => setTimeout(resolve22, 150));
9833
9850
  const second = await readExtensionChatState(h);
9834
9851
  return getStateMessageCount(second) >= getStateMessageCount(first) ? second : first;
9835
9852
  }
@@ -9837,7 +9854,7 @@ async function verifyExtensionSendObserved(h, before) {
9837
9854
  const beforeCount = getStateMessageCount(before);
9838
9855
  const beforeSignature = getStateLastSignature(before);
9839
9856
  for (let attempt = 0; attempt < 12; attempt += 1) {
9840
- await new Promise((resolve21) => setTimeout(resolve21, 250));
9857
+ await new Promise((resolve22) => setTimeout(resolve22, 250));
9841
9858
  const state = await readExtensionChatState(h);
9842
9859
  if (state?.status === "waiting_approval") return true;
9843
9860
  const afterCount = getStateMessageCount(state);
@@ -11491,7 +11508,7 @@ async function executeProviderScript(h, args, scriptName) {
11491
11508
  const enterCount = cliCommand.enterCount || 1;
11492
11509
  await adapter.writeRaw(cliCommand.text + "\r");
11493
11510
  for (let i = 1; i < enterCount; i += 1) {
11494
- await new Promise((resolve21) => setTimeout(resolve21, 50));
11511
+ await new Promise((resolve22) => setTimeout(resolve22, 50));
11495
11512
  await adapter.writeRaw("\r");
11496
11513
  }
11497
11514
  }
@@ -12207,7 +12224,7 @@ var init_handler = __esm({
12207
12224
  try {
12208
12225
  const http3 = await import("http");
12209
12226
  const postData = JSON.stringify(body);
12210
- const result = await new Promise((resolve21, reject) => {
12227
+ const result = await new Promise((resolve22, reject) => {
12211
12228
  const req = http3.request({
12212
12229
  hostname: "127.0.0.1",
12213
12230
  port: 19280,
@@ -12219,9 +12236,9 @@ var init_handler = __esm({
12219
12236
  res.on("data", (chunk) => data += chunk);
12220
12237
  res.on("end", () => {
12221
12238
  try {
12222
- resolve21(JSON.parse(data));
12239
+ resolve22(JSON.parse(data));
12223
12240
  } catch {
12224
- resolve21({ raw: data });
12241
+ resolve22({ raw: data });
12225
12242
  }
12226
12243
  });
12227
12244
  });
@@ -12239,15 +12256,15 @@ var init_handler = __esm({
12239
12256
  if (!providerType) return { success: false, error: "providerType required" };
12240
12257
  try {
12241
12258
  const http3 = await import("http");
12242
- const result = await new Promise((resolve21, reject) => {
12259
+ const result = await new Promise((resolve22, reject) => {
12243
12260
  http3.get(`http://127.0.0.1:19280/api/providers/${providerType}/${endpoint}`, (res) => {
12244
12261
  let data = "";
12245
12262
  res.on("data", (chunk) => data += chunk);
12246
12263
  res.on("end", () => {
12247
12264
  try {
12248
- resolve21(JSON.parse(data));
12265
+ resolve22(JSON.parse(data));
12249
12266
  } catch {
12250
- resolve21({ raw: data });
12267
+ resolve22({ raw: data });
12251
12268
  }
12252
12269
  });
12253
12270
  }).on("error", reject);
@@ -12261,7 +12278,7 @@ var init_handler = __esm({
12261
12278
  try {
12262
12279
  const http3 = await import("http");
12263
12280
  const postData = JSON.stringify(args || {});
12264
- const result = await new Promise((resolve21, reject) => {
12281
+ const result = await new Promise((resolve22, reject) => {
12265
12282
  const req = http3.request({
12266
12283
  hostname: "127.0.0.1",
12267
12284
  port: 19280,
@@ -12273,9 +12290,9 @@ var init_handler = __esm({
12273
12290
  res.on("data", (chunk) => data += chunk);
12274
12291
  res.on("end", () => {
12275
12292
  try {
12276
- resolve21(JSON.parse(data));
12293
+ resolve22(JSON.parse(data));
12277
12294
  } catch {
12278
- resolve21({ raw: data });
12295
+ resolve22({ raw: data });
12279
12296
  }
12280
12297
  });
12281
12298
  });
@@ -13301,14 +13318,14 @@ function applyTerminalColorEnv(env3) {
13301
13318
  function ensureNodePtySpawnHelperPermissions(logFn) {
13302
13319
  if (os22.platform() === "win32") return;
13303
13320
  try {
13304
- const fs23 = __require("fs");
13321
+ const fs24 = __require("fs");
13305
13322
  const ptyDir = path32.resolve(path32.dirname(__require.resolve("node-pty")), "..");
13306
13323
  const platformArch = `${os22.platform()}-${os22.arch()}`;
13307
13324
  const helper = path32.join(ptyDir, "prebuilds", platformArch, "spawn-helper");
13308
- if (fs23.existsSync(helper)) {
13309
- const stat5 = fs23.statSync(helper);
13325
+ if (fs24.existsSync(helper)) {
13326
+ const stat5 = fs24.statSync(helper);
13310
13327
  if (!(stat5.mode & 73)) {
13311
- fs23.chmodSync(helper, stat5.mode | 493);
13328
+ fs24.chmodSync(helper, stat5.mode | 493);
13312
13329
  logFn?.(`Fixed spawn-helper permissions: ${helper}`);
13313
13330
  }
13314
13331
  }
@@ -13781,8 +13798,8 @@ var init_pty_transport = __esm({
13781
13798
  let cwd = options.cwd;
13782
13799
  if (cwd) {
13783
13800
  try {
13784
- const fs23 = require("fs");
13785
- const stat5 = fs23.statSync(cwd);
13801
+ const fs24 = require("fs");
13802
+ const stat5 = fs24.statSync(cwd);
13786
13803
  if (!stat5.isDirectory()) cwd = os11.homedir();
13787
13804
  } catch {
13788
13805
  cwd = os11.homedir();
@@ -13885,12 +13902,12 @@ function findBinary(name) {
13885
13902
  function isScriptBinary(binaryPath) {
13886
13903
  if (!path14.isAbsolute(binaryPath)) return false;
13887
13904
  try {
13888
- const fs23 = require("fs");
13889
- const resolved = fs23.realpathSync(binaryPath);
13905
+ const fs24 = require("fs");
13906
+ const resolved = fs24.realpathSync(binaryPath);
13890
13907
  const head = Buffer.alloc(8);
13891
- const fd = fs23.openSync(resolved, "r");
13892
- fs23.readSync(fd, head, 0, 8, 0);
13893
- fs23.closeSync(fd);
13908
+ const fd = fs24.openSync(resolved, "r");
13909
+ fs24.readSync(fd, head, 0, 8, 0);
13910
+ fs24.closeSync(fd);
13894
13911
  let i = 0;
13895
13912
  if (head[0] === 239 && head[1] === 187 && head[2] === 191) i = 3;
13896
13913
  return head[i] === 35 && head[i + 1] === 33;
@@ -13901,12 +13918,12 @@ function isScriptBinary(binaryPath) {
13901
13918
  function looksLikeMachOOrElf(filePath) {
13902
13919
  if (!path14.isAbsolute(filePath)) return false;
13903
13920
  try {
13904
- const fs23 = require("fs");
13905
- const resolved = fs23.realpathSync(filePath);
13921
+ const fs24 = require("fs");
13922
+ const resolved = fs24.realpathSync(filePath);
13906
13923
  const buf = Buffer.alloc(8);
13907
- const fd = fs23.openSync(resolved, "r");
13908
- fs23.readSync(fd, buf, 0, 8, 0);
13909
- fs23.closeSync(fd);
13924
+ const fd = fs24.openSync(resolved, "r");
13925
+ fs24.readSync(fd, buf, 0, 8, 0);
13926
+ fs24.closeSync(fd);
13910
13927
  let i = 0;
13911
13928
  if (buf[0] === 239 && buf[1] === 187 && buf[2] === 191) i = 3;
13912
13929
  const b = buf.subarray(i);
@@ -15287,7 +15304,7 @@ var init_provider_cli_adapter = __esm({
15287
15304
  `[${this.cliType}] Waiting for interactive prompt: status=${status} stableMs=${stableMs} recentOutputMs=${recentlyOutput} screen=${JSON.stringify(summarizeCliTraceText(screenText, 220)).slice(0, 260)}`
15288
15305
  );
15289
15306
  }
15290
- await new Promise((resolve21) => setTimeout(resolve21, 50));
15307
+ await new Promise((resolve22) => setTimeout(resolve22, 50));
15291
15308
  }
15292
15309
  const finalScreenText = this.terminalScreen.getText() || "";
15293
15310
  LOG.warn(
@@ -16496,7 +16513,7 @@ var init_provider_cli_adapter = __esm({
16496
16513
  const deadline = Date.now() + 1e4;
16497
16514
  while (this.startupParseGate && Date.now() < deadline) {
16498
16515
  this.resolveStartupState("send_wait");
16499
- await new Promise((resolve21) => setTimeout(resolve21, 50));
16516
+ await new Promise((resolve22) => setTimeout(resolve22, 50));
16500
16517
  }
16501
16518
  }
16502
16519
  if (!allowInterventionPrompt) {
@@ -16577,13 +16594,13 @@ var init_provider_cli_adapter = __esm({
16577
16594
  }
16578
16595
  this.responseEpoch += 1;
16579
16596
  this.responseSettleIgnoreUntil = Date.now() + submitDelayMs + this.timeouts.outputSettle + 250;
16580
- await new Promise((resolve21, reject) => {
16597
+ await new Promise((resolve22, reject) => {
16581
16598
  let resolved = false;
16582
16599
  const completion = {
16583
16600
  resolveOnce: () => {
16584
16601
  if (resolved) return;
16585
16602
  resolved = true;
16586
- resolve21();
16603
+ resolve22();
16587
16604
  },
16588
16605
  rejectOnce: (error48) => {
16589
16606
  if (resolved) return;
@@ -16745,17 +16762,17 @@ var init_provider_cli_adapter = __esm({
16745
16762
  }
16746
16763
  }
16747
16764
  waitForStopped(timeoutMs) {
16748
- return new Promise((resolve21) => {
16765
+ return new Promise((resolve22) => {
16749
16766
  const startedAt = Date.now();
16750
16767
  const timer = setInterval(() => {
16751
16768
  if (!this.ptyProcess || this.currentStatus === "stopped") {
16752
16769
  clearInterval(timer);
16753
- resolve21(true);
16770
+ resolve22(true);
16754
16771
  return;
16755
16772
  }
16756
16773
  if (Date.now() - startedAt >= timeoutMs) {
16757
16774
  clearInterval(timer);
16758
- resolve21(false);
16775
+ resolve22(false);
16759
16776
  }
16760
16777
  }, 100);
16761
16778
  });
@@ -17076,7 +17093,7 @@ async function waitForCliAdapterReady(adapter, options) {
17076
17093
  if (status === "stopped") {
17077
17094
  throw new Error("CLI runtime stopped before it became ready");
17078
17095
  }
17079
- await new Promise((resolve21) => setTimeout(resolve21, pollMs));
17096
+ await new Promise((resolve22) => setTimeout(resolve22, pollMs));
17080
17097
  }
17081
17098
  throw new Error(`CLI runtime did not become ready within ${timeoutMs}ms`);
17082
17099
  }
@@ -17449,7 +17466,7 @@ var init_cli_provider_instance = __esm({
17449
17466
  const enterCount = cliCommand.enterCount || 1;
17450
17467
  await this.adapter.writeRaw(cliCommand.text + "\r");
17451
17468
  for (let i = 1; i < enterCount; i += 1) {
17452
- await new Promise((resolve21) => setTimeout(resolve21, 50));
17469
+ await new Promise((resolve22) => setTimeout(resolve22, 50));
17453
17470
  await this.adapter.writeRaw("\r");
17454
17471
  }
17455
17472
  }
@@ -18236,10 +18253,10 @@ function mergeDefs(...defs) {
18236
18253
  function cloneDef(schema) {
18237
18254
  return mergeDefs(schema._zod.def);
18238
18255
  }
18239
- function getElementAtPath(obj, path39) {
18240
- if (!path39)
18256
+ function getElementAtPath(obj, path40) {
18257
+ if (!path40)
18241
18258
  return obj;
18242
- return path39.reduce((acc, key) => acc?.[key], obj);
18259
+ return path40.reduce((acc, key) => acc?.[key], obj);
18243
18260
  }
18244
18261
  function promiseAllObject(promisesObj) {
18245
18262
  const keys = Object.keys(promisesObj);
@@ -18551,11 +18568,11 @@ function aborted(x, startIndex = 0) {
18551
18568
  }
18552
18569
  return false;
18553
18570
  }
18554
- function prefixIssues(path39, issues) {
18571
+ function prefixIssues(path40, issues) {
18555
18572
  return issues.map((iss) => {
18556
18573
  var _a2;
18557
18574
  (_a2 = iss).path ?? (_a2.path = []);
18558
- iss.path.unshift(path39);
18575
+ iss.path.unshift(path40);
18559
18576
  return iss;
18560
18577
  });
18561
18578
  }
@@ -18798,7 +18815,7 @@ function formatError(error48, mapper = (issue2) => issue2.message) {
18798
18815
  }
18799
18816
  function treeifyError(error48, mapper = (issue2) => issue2.message) {
18800
18817
  const result = { errors: [] };
18801
- const processError = (error49, path39 = []) => {
18818
+ const processError = (error49, path40 = []) => {
18802
18819
  var _a2, _b;
18803
18820
  for (const issue2 of error49.issues) {
18804
18821
  if (issue2.code === "invalid_union" && issue2.errors.length) {
@@ -18808,7 +18825,7 @@ function treeifyError(error48, mapper = (issue2) => issue2.message) {
18808
18825
  } else if (issue2.code === "invalid_element") {
18809
18826
  processError({ issues: issue2.issues }, issue2.path);
18810
18827
  } else {
18811
- const fullpath = [...path39, ...issue2.path];
18828
+ const fullpath = [...path40, ...issue2.path];
18812
18829
  if (fullpath.length === 0) {
18813
18830
  result.errors.push(mapper(issue2));
18814
18831
  continue;
@@ -18840,8 +18857,8 @@ function treeifyError(error48, mapper = (issue2) => issue2.message) {
18840
18857
  }
18841
18858
  function toDotPath(_path) {
18842
18859
  const segs = [];
18843
- const path39 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
18844
- for (const seg of path39) {
18860
+ const path40 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
18861
+ for (const seg of path40) {
18845
18862
  if (typeof seg === "number")
18846
18863
  segs.push(`[${seg}]`);
18847
18864
  else if (typeof seg === "symbol")
@@ -31605,13 +31622,13 @@ function resolveRef(ref, ctx) {
31605
31622
  if (!ref.startsWith("#")) {
31606
31623
  throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
31607
31624
  }
31608
- const path39 = ref.slice(1).split("/").filter(Boolean);
31609
- if (path39.length === 0) {
31625
+ const path40 = ref.slice(1).split("/").filter(Boolean);
31626
+ if (path40.length === 0) {
31610
31627
  return ctx.rootSchema;
31611
31628
  }
31612
31629
  const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
31613
- if (path39[0] === defsKey) {
31614
- const key = path39[1];
31630
+ if (path40[0] === defsKey) {
31631
+ const key = path40[1];
31615
31632
  if (!key || !ctx.defs[key]) {
31616
31633
  throw new Error(`Reference not found: ${ref}`);
31617
31634
  }
@@ -34038,8 +34055,8 @@ var init_acp = __esm({
34038
34055
  this.#requestHandler = requestHandler;
34039
34056
  this.#notificationHandler = notificationHandler;
34040
34057
  this.#stream = stream;
34041
- this.#closedPromise = new Promise((resolve21) => {
34042
- this.#abortController.signal.addEventListener("abort", () => resolve21());
34058
+ this.#closedPromise = new Promise((resolve22) => {
34059
+ this.#abortController.signal.addEventListener("abort", () => resolve22());
34043
34060
  });
34044
34061
  this.#receive();
34045
34062
  }
@@ -34188,8 +34205,8 @@ var init_acp = __esm({
34188
34205
  }
34189
34206
  async sendRequest(method, params) {
34190
34207
  const id = this.#nextRequestId++;
34191
- const responsePromise = new Promise((resolve21, reject) => {
34192
- this.#pendingResponses.set(id, { resolve: resolve21, reject });
34208
+ const responsePromise = new Promise((resolve22, reject) => {
34209
+ this.#pendingResponses.set(id, { resolve: resolve22, reject });
34193
34210
  });
34194
34211
  await this.#sendMessage({ jsonrpc: "2.0", id, method, params });
34195
34212
  return responsePromise;
@@ -34873,13 +34890,13 @@ var init_acp_provider_instance = __esm({
34873
34890
  }
34874
34891
  this.currentStatus = "waiting_approval";
34875
34892
  this.detectStatusTransition();
34876
- const approved = await new Promise((resolve21) => {
34877
- this.permissionResolvers.push(resolve21);
34893
+ const approved = await new Promise((resolve22) => {
34894
+ this.permissionResolvers.push(resolve22);
34878
34895
  setTimeout(() => {
34879
- const idx = this.permissionResolvers.indexOf(resolve21);
34896
+ const idx = this.permissionResolvers.indexOf(resolve22);
34880
34897
  if (idx >= 0) {
34881
34898
  this.permissionResolvers.splice(idx, 1);
34882
- resolve21(false);
34899
+ resolve22(false);
34883
34900
  }
34884
34901
  }, 3e5);
34885
34902
  });
@@ -36369,7 +36386,7 @@ var init_readdirp = __esm({
36369
36386
  this._directoryFilter = normalizeFilter(opts.directoryFilter);
36370
36387
  const statMethod = opts.lstat ? import_promises3.lstat : import_promises3.stat;
36371
36388
  if (wantBigintFsStats) {
36372
- this._stat = (path39) => statMethod(path39, { bigint: true });
36389
+ this._stat = (path40) => statMethod(path40, { bigint: true });
36373
36390
  } else {
36374
36391
  this._stat = statMethod;
36375
36392
  }
@@ -36394,8 +36411,8 @@ var init_readdirp = __esm({
36394
36411
  const par = this.parent;
36395
36412
  const fil = par && par.files;
36396
36413
  if (fil && fil.length > 0) {
36397
- const { path: path39, depth } = par;
36398
- const slice = fil.splice(0, batch).map((dirent) => this._formatEntry(dirent, path39));
36414
+ const { path: path40, depth } = par;
36415
+ const slice = fil.splice(0, batch).map((dirent) => this._formatEntry(dirent, path40));
36399
36416
  const awaited = await Promise.all(slice);
36400
36417
  for (const entry of awaited) {
36401
36418
  if (!entry)
@@ -36435,20 +36452,20 @@ var init_readdirp = __esm({
36435
36452
  this.reading = false;
36436
36453
  }
36437
36454
  }
36438
- async _exploreDir(path39, depth) {
36455
+ async _exploreDir(path40, depth) {
36439
36456
  let files;
36440
36457
  try {
36441
- files = await (0, import_promises3.readdir)(path39, this._rdOptions);
36458
+ files = await (0, import_promises3.readdir)(path40, this._rdOptions);
36442
36459
  } catch (error48) {
36443
36460
  this._onError(error48);
36444
36461
  }
36445
- return { files, depth, path: path39 };
36462
+ return { files, depth, path: path40 };
36446
36463
  }
36447
- async _formatEntry(dirent, path39) {
36464
+ async _formatEntry(dirent, path40) {
36448
36465
  let entry;
36449
36466
  const basename10 = this._isDirent ? dirent.name : dirent;
36450
36467
  try {
36451
- const fullPath = (0, import_node_path.resolve)((0, import_node_path.join)(path39, basename10));
36468
+ const fullPath = (0, import_node_path.resolve)((0, import_node_path.join)(path40, basename10));
36452
36469
  entry = { path: (0, import_node_path.relative)(this._root, fullPath), fullPath, basename: basename10 };
36453
36470
  entry[this._statsProp] = this._isDirent ? dirent : await this._stat(fullPath);
36454
36471
  } catch (err) {
@@ -36505,16 +36522,16 @@ var init_readdirp = __esm({
36505
36522
  });
36506
36523
 
36507
36524
  // ../../oss/packages/daemon-core/node_modules/chokidar/handler.js
36508
- function createFsWatchInstance(path39, options, listener, errHandler, emitRaw) {
36525
+ function createFsWatchInstance(path40, options, listener, errHandler, emitRaw) {
36509
36526
  const handleEvent = (rawEvent, evPath) => {
36510
- listener(path39);
36511
- emitRaw(rawEvent, evPath, { watchedPath: path39 });
36512
- if (evPath && path39 !== evPath) {
36513
- fsWatchBroadcast(sp.resolve(path39, evPath), KEY_LISTENERS, sp.join(path39, evPath));
36527
+ listener(path40);
36528
+ emitRaw(rawEvent, evPath, { watchedPath: path40 });
36529
+ if (evPath && path40 !== evPath) {
36530
+ fsWatchBroadcast(sp.resolve(path40, evPath), KEY_LISTENERS, sp.join(path40, evPath));
36514
36531
  }
36515
36532
  };
36516
36533
  try {
36517
- return (0, import_node_fs2.watch)(path39, {
36534
+ return (0, import_node_fs2.watch)(path40, {
36518
36535
  persistent: options.persistent
36519
36536
  }, handleEvent);
36520
36537
  } catch (error48) {
@@ -36863,12 +36880,12 @@ var init_handler2 = __esm({
36863
36880
  listener(val1, val2, val3);
36864
36881
  });
36865
36882
  };
36866
- setFsWatchListener = (path39, fullPath, options, handlers) => {
36883
+ setFsWatchListener = (path40, fullPath, options, handlers) => {
36867
36884
  const { listener, errHandler, rawEmitter } = handlers;
36868
36885
  let cont = FsWatchInstances.get(fullPath);
36869
36886
  let watcher;
36870
36887
  if (!options.persistent) {
36871
- watcher = createFsWatchInstance(path39, options, listener, errHandler, rawEmitter);
36888
+ watcher = createFsWatchInstance(path40, options, listener, errHandler, rawEmitter);
36872
36889
  if (!watcher)
36873
36890
  return;
36874
36891
  return watcher.close.bind(watcher);
@@ -36879,7 +36896,7 @@ var init_handler2 = __esm({
36879
36896
  addAndConvert(cont, KEY_RAW, rawEmitter);
36880
36897
  } else {
36881
36898
  watcher = createFsWatchInstance(
36882
- path39,
36899
+ path40,
36883
36900
  options,
36884
36901
  fsWatchBroadcast.bind(null, fullPath, KEY_LISTENERS),
36885
36902
  errHandler,
@@ -36894,7 +36911,7 @@ var init_handler2 = __esm({
36894
36911
  cont.watcherUnusable = true;
36895
36912
  if (isWindows && error48.code === "EPERM") {
36896
36913
  try {
36897
- const fd = await (0, import_promises4.open)(path39, "r");
36914
+ const fd = await (0, import_promises4.open)(path40, "r");
36898
36915
  await fd.close();
36899
36916
  broadcastErr(error48);
36900
36917
  } catch (err) {
@@ -36925,7 +36942,7 @@ var init_handler2 = __esm({
36925
36942
  };
36926
36943
  };
36927
36944
  FsWatchFileInstances = /* @__PURE__ */ new Map();
36928
- setFsWatchFileListener = (path39, fullPath, options, handlers) => {
36945
+ setFsWatchFileListener = (path40, fullPath, options, handlers) => {
36929
36946
  const { listener, rawEmitter } = handlers;
36930
36947
  let cont = FsWatchFileInstances.get(fullPath);
36931
36948
  const copts = cont && cont.options;
@@ -36947,7 +36964,7 @@ var init_handler2 = __esm({
36947
36964
  });
36948
36965
  const currmtime = curr.mtimeMs;
36949
36966
  if (curr.size !== prev.size || currmtime > prev.mtimeMs || currmtime === 0) {
36950
- foreach(cont.listeners, (listener2) => listener2(path39, curr));
36967
+ foreach(cont.listeners, (listener2) => listener2(path40, curr));
36951
36968
  }
36952
36969
  })
36953
36970
  };
@@ -36977,13 +36994,13 @@ var init_handler2 = __esm({
36977
36994
  * @param listener on fs change
36978
36995
  * @returns closer for the watcher instance
36979
36996
  */
36980
- _watchWithNodeFs(path39, listener) {
36997
+ _watchWithNodeFs(path40, listener) {
36981
36998
  const opts = this.fsw.options;
36982
- const directory = sp.dirname(path39);
36983
- const basename10 = sp.basename(path39);
36999
+ const directory = sp.dirname(path40);
37000
+ const basename10 = sp.basename(path40);
36984
37001
  const parent = this.fsw._getWatchedDir(directory);
36985
37002
  parent.add(basename10);
36986
- const absolutePath = sp.resolve(path39);
37003
+ const absolutePath = sp.resolve(path40);
36987
37004
  const options = {
36988
37005
  persistent: opts.persistent
36989
37006
  };
@@ -36993,12 +37010,12 @@ var init_handler2 = __esm({
36993
37010
  if (opts.usePolling) {
36994
37011
  const enableBin = opts.interval !== opts.binaryInterval;
36995
37012
  options.interval = enableBin && isBinaryPath(basename10) ? opts.binaryInterval : opts.interval;
36996
- closer = setFsWatchFileListener(path39, absolutePath, options, {
37013
+ closer = setFsWatchFileListener(path40, absolutePath, options, {
36997
37014
  listener,
36998
37015
  rawEmitter: this.fsw._emitRaw
36999
37016
  });
37000
37017
  } else {
37001
- closer = setFsWatchListener(path39, absolutePath, options, {
37018
+ closer = setFsWatchListener(path40, absolutePath, options, {
37002
37019
  listener,
37003
37020
  errHandler: this._boundHandleError,
37004
37021
  rawEmitter: this.fsw._emitRaw
@@ -37020,7 +37037,7 @@ var init_handler2 = __esm({
37020
37037
  let prevStats = stats;
37021
37038
  if (parent.has(basename10))
37022
37039
  return;
37023
- const listener = async (path39, newStats) => {
37040
+ const listener = async (path40, newStats) => {
37024
37041
  if (!this.fsw._throttle(THROTTLE_MODE_WATCH, file2, 5))
37025
37042
  return;
37026
37043
  if (!newStats || newStats.mtimeMs === 0) {
@@ -37034,11 +37051,11 @@ var init_handler2 = __esm({
37034
37051
  this.fsw._emit(EV.CHANGE, file2, newStats2);
37035
37052
  }
37036
37053
  if ((isMacos || isLinux || isFreeBSD) && prevStats.ino !== newStats2.ino) {
37037
- this.fsw._closeFile(path39);
37054
+ this.fsw._closeFile(path40);
37038
37055
  prevStats = newStats2;
37039
37056
  const closer2 = this._watchWithNodeFs(file2, listener);
37040
37057
  if (closer2)
37041
- this.fsw._addPathCloser(path39, closer2);
37058
+ this.fsw._addPathCloser(path40, closer2);
37042
37059
  } else {
37043
37060
  prevStats = newStats2;
37044
37061
  }
@@ -37070,7 +37087,7 @@ var init_handler2 = __esm({
37070
37087
  * @param item basename of this item
37071
37088
  * @returns true if no more processing is needed for this entry.
37072
37089
  */
37073
- async _handleSymlink(entry, directory, path39, item) {
37090
+ async _handleSymlink(entry, directory, path40, item) {
37074
37091
  if (this.fsw.closed) {
37075
37092
  return;
37076
37093
  }
@@ -37080,7 +37097,7 @@ var init_handler2 = __esm({
37080
37097
  this.fsw._incrReadyCount();
37081
37098
  let linkPath;
37082
37099
  try {
37083
- linkPath = await (0, import_promises4.realpath)(path39);
37100
+ linkPath = await (0, import_promises4.realpath)(path40);
37084
37101
  } catch (e) {
37085
37102
  this.fsw._emitReady();
37086
37103
  return true;
@@ -37090,12 +37107,12 @@ var init_handler2 = __esm({
37090
37107
  if (dir.has(item)) {
37091
37108
  if (this.fsw._symlinkPaths.get(full) !== linkPath) {
37092
37109
  this.fsw._symlinkPaths.set(full, linkPath);
37093
- this.fsw._emit(EV.CHANGE, path39, entry.stats);
37110
+ this.fsw._emit(EV.CHANGE, path40, entry.stats);
37094
37111
  }
37095
37112
  } else {
37096
37113
  dir.add(item);
37097
37114
  this.fsw._symlinkPaths.set(full, linkPath);
37098
- this.fsw._emit(EV.ADD, path39, entry.stats);
37115
+ this.fsw._emit(EV.ADD, path40, entry.stats);
37099
37116
  }
37100
37117
  this.fsw._emitReady();
37101
37118
  return true;
@@ -37125,9 +37142,9 @@ var init_handler2 = __esm({
37125
37142
  return;
37126
37143
  }
37127
37144
  const item = entry.path;
37128
- let path39 = sp.join(directory, item);
37145
+ let path40 = sp.join(directory, item);
37129
37146
  current.add(item);
37130
- if (entry.stats.isSymbolicLink() && await this._handleSymlink(entry, directory, path39, item)) {
37147
+ if (entry.stats.isSymbolicLink() && await this._handleSymlink(entry, directory, path40, item)) {
37131
37148
  return;
37132
37149
  }
37133
37150
  if (this.fsw.closed) {
@@ -37136,11 +37153,11 @@ var init_handler2 = __esm({
37136
37153
  }
37137
37154
  if (item === target || !target && !previous.has(item)) {
37138
37155
  this.fsw._incrReadyCount();
37139
- path39 = sp.join(dir, sp.relative(dir, path39));
37140
- this._addToNodeFs(path39, initialAdd, wh, depth + 1);
37156
+ path40 = sp.join(dir, sp.relative(dir, path40));
37157
+ this._addToNodeFs(path40, initialAdd, wh, depth + 1);
37141
37158
  }
37142
37159
  }).on(EV.ERROR, this._boundHandleError);
37143
- return new Promise((resolve21, reject) => {
37160
+ return new Promise((resolve22, reject) => {
37144
37161
  if (!stream)
37145
37162
  return reject();
37146
37163
  stream.once(STR_END, () => {
@@ -37149,7 +37166,7 @@ var init_handler2 = __esm({
37149
37166
  return;
37150
37167
  }
37151
37168
  const wasThrottled = throttler ? throttler.clear() : false;
37152
- resolve21(void 0);
37169
+ resolve22(void 0);
37153
37170
  previous.getChildren().filter((item) => {
37154
37171
  return item !== directory && !current.has(item);
37155
37172
  }).forEach((item) => {
@@ -37206,13 +37223,13 @@ var init_handler2 = __esm({
37206
37223
  * @param depth Child path actually targeted for watch
37207
37224
  * @param target Child path actually targeted for watch
37208
37225
  */
37209
- async _addToNodeFs(path39, initialAdd, priorWh, depth, target) {
37226
+ async _addToNodeFs(path40, initialAdd, priorWh, depth, target) {
37210
37227
  const ready = this.fsw._emitReady;
37211
- if (this.fsw._isIgnored(path39) || this.fsw.closed) {
37228
+ if (this.fsw._isIgnored(path40) || this.fsw.closed) {
37212
37229
  ready();
37213
37230
  return false;
37214
37231
  }
37215
- const wh = this.fsw._getWatchHelpers(path39);
37232
+ const wh = this.fsw._getWatchHelpers(path40);
37216
37233
  if (priorWh) {
37217
37234
  wh.filterPath = (entry) => priorWh.filterPath(entry);
37218
37235
  wh.filterDir = (entry) => priorWh.filterDir(entry);
@@ -37228,8 +37245,8 @@ var init_handler2 = __esm({
37228
37245
  const follow = this.fsw.options.followSymlinks;
37229
37246
  let closer;
37230
37247
  if (stats.isDirectory()) {
37231
- const absPath = sp.resolve(path39);
37232
- const targetPath = follow ? await (0, import_promises4.realpath)(path39) : path39;
37248
+ const absPath = sp.resolve(path40);
37249
+ const targetPath = follow ? await (0, import_promises4.realpath)(path40) : path40;
37233
37250
  if (this.fsw.closed)
37234
37251
  return;
37235
37252
  closer = await this._handleDir(wh.watchPath, stats, initialAdd, depth, target, wh, targetPath);
@@ -37239,29 +37256,29 @@ var init_handler2 = __esm({
37239
37256
  this.fsw._symlinkPaths.set(absPath, targetPath);
37240
37257
  }
37241
37258
  } else if (stats.isSymbolicLink()) {
37242
- const targetPath = follow ? await (0, import_promises4.realpath)(path39) : path39;
37259
+ const targetPath = follow ? await (0, import_promises4.realpath)(path40) : path40;
37243
37260
  if (this.fsw.closed)
37244
37261
  return;
37245
37262
  const parent = sp.dirname(wh.watchPath);
37246
37263
  this.fsw._getWatchedDir(parent).add(wh.watchPath);
37247
37264
  this.fsw._emit(EV.ADD, wh.watchPath, stats);
37248
- closer = await this._handleDir(parent, stats, initialAdd, depth, path39, wh, targetPath);
37265
+ closer = await this._handleDir(parent, stats, initialAdd, depth, path40, wh, targetPath);
37249
37266
  if (this.fsw.closed)
37250
37267
  return;
37251
37268
  if (targetPath !== void 0) {
37252
- this.fsw._symlinkPaths.set(sp.resolve(path39), targetPath);
37269
+ this.fsw._symlinkPaths.set(sp.resolve(path40), targetPath);
37253
37270
  }
37254
37271
  } else {
37255
37272
  closer = this._handleFile(wh.watchPath, stats, initialAdd);
37256
37273
  }
37257
37274
  ready();
37258
37275
  if (closer)
37259
- this.fsw._addPathCloser(path39, closer);
37276
+ this.fsw._addPathCloser(path40, closer);
37260
37277
  return false;
37261
37278
  } catch (error48) {
37262
37279
  if (this.fsw._handleError(error48)) {
37263
37280
  ready();
37264
- return path39;
37281
+ return path40;
37265
37282
  }
37266
37283
  }
37267
37284
  }
@@ -37296,24 +37313,24 @@ function createPattern(matcher) {
37296
37313
  }
37297
37314
  return () => false;
37298
37315
  }
37299
- function normalizePath(path39) {
37300
- if (typeof path39 !== "string")
37316
+ function normalizePath(path40) {
37317
+ if (typeof path40 !== "string")
37301
37318
  throw new Error("string expected");
37302
- path39 = sp2.normalize(path39);
37303
- path39 = path39.replace(/\\/g, "/");
37319
+ path40 = sp2.normalize(path40);
37320
+ path40 = path40.replace(/\\/g, "/");
37304
37321
  let prepend = false;
37305
- if (path39.startsWith("//"))
37322
+ if (path40.startsWith("//"))
37306
37323
  prepend = true;
37307
- path39 = path39.replace(DOUBLE_SLASH_RE, "/");
37324
+ path40 = path40.replace(DOUBLE_SLASH_RE, "/");
37308
37325
  if (prepend)
37309
- path39 = "/" + path39;
37310
- return path39;
37326
+ path40 = "/" + path40;
37327
+ return path40;
37311
37328
  }
37312
37329
  function matchPatterns(patterns, testString, stats) {
37313
- const path39 = normalizePath(testString);
37330
+ const path40 = normalizePath(testString);
37314
37331
  for (let index = 0; index < patterns.length; index++) {
37315
37332
  const pattern = patterns[index];
37316
- if (pattern(path39, stats)) {
37333
+ if (pattern(path40, stats)) {
37317
37334
  return true;
37318
37335
  }
37319
37336
  }
@@ -37376,19 +37393,19 @@ var init_chokidar = __esm({
37376
37393
  }
37377
37394
  return str;
37378
37395
  };
37379
- normalizePathToUnix = (path39) => toUnix(sp2.normalize(toUnix(path39)));
37380
- normalizeIgnored = (cwd = "") => (path39) => {
37381
- if (typeof path39 === "string") {
37382
- return normalizePathToUnix(sp2.isAbsolute(path39) ? path39 : sp2.join(cwd, path39));
37396
+ normalizePathToUnix = (path40) => toUnix(sp2.normalize(toUnix(path40)));
37397
+ normalizeIgnored = (cwd = "") => (path40) => {
37398
+ if (typeof path40 === "string") {
37399
+ return normalizePathToUnix(sp2.isAbsolute(path40) ? path40 : sp2.join(cwd, path40));
37383
37400
  } else {
37384
- return path39;
37401
+ return path40;
37385
37402
  }
37386
37403
  };
37387
- getAbsolutePath = (path39, cwd) => {
37388
- if (sp2.isAbsolute(path39)) {
37389
- return path39;
37404
+ getAbsolutePath = (path40, cwd) => {
37405
+ if (sp2.isAbsolute(path40)) {
37406
+ return path40;
37390
37407
  }
37391
- return sp2.join(cwd, path39);
37408
+ return sp2.join(cwd, path40);
37392
37409
  };
37393
37410
  EMPTY_SET = Object.freeze(/* @__PURE__ */ new Set());
37394
37411
  DirEntry = class {
@@ -37453,10 +37470,10 @@ var init_chokidar = __esm({
37453
37470
  dirParts;
37454
37471
  followSymlinks;
37455
37472
  statMethod;
37456
- constructor(path39, follow, fsw) {
37473
+ constructor(path40, follow, fsw) {
37457
37474
  this.fsw = fsw;
37458
- const watchPath = path39;
37459
- this.path = path39 = path39.replace(REPLACER_RE, "");
37475
+ const watchPath = path40;
37476
+ this.path = path40 = path40.replace(REPLACER_RE, "");
37460
37477
  this.watchPath = watchPath;
37461
37478
  this.fullWatchPath = sp2.resolve(watchPath);
37462
37479
  this.dirParts = [];
@@ -37596,20 +37613,20 @@ var init_chokidar = __esm({
37596
37613
  this._closePromise = void 0;
37597
37614
  let paths = unifyPaths(paths_);
37598
37615
  if (cwd) {
37599
- paths = paths.map((path39) => {
37600
- const absPath = getAbsolutePath(path39, cwd);
37616
+ paths = paths.map((path40) => {
37617
+ const absPath = getAbsolutePath(path40, cwd);
37601
37618
  return absPath;
37602
37619
  });
37603
37620
  }
37604
- paths.forEach((path39) => {
37605
- this._removeIgnoredPath(path39);
37621
+ paths.forEach((path40) => {
37622
+ this._removeIgnoredPath(path40);
37606
37623
  });
37607
37624
  this._userIgnored = void 0;
37608
37625
  if (!this._readyCount)
37609
37626
  this._readyCount = 0;
37610
37627
  this._readyCount += paths.length;
37611
- Promise.all(paths.map(async (path39) => {
37612
- const res = await this._nodeFsHandler._addToNodeFs(path39, !_internal, void 0, 0, _origAdd);
37628
+ Promise.all(paths.map(async (path40) => {
37629
+ const res = await this._nodeFsHandler._addToNodeFs(path40, !_internal, void 0, 0, _origAdd);
37613
37630
  if (res)
37614
37631
  this._emitReady();
37615
37632
  return res;
@@ -37631,17 +37648,17 @@ var init_chokidar = __esm({
37631
37648
  return this;
37632
37649
  const paths = unifyPaths(paths_);
37633
37650
  const { cwd } = this.options;
37634
- paths.forEach((path39) => {
37635
- if (!sp2.isAbsolute(path39) && !this._closers.has(path39)) {
37651
+ paths.forEach((path40) => {
37652
+ if (!sp2.isAbsolute(path40) && !this._closers.has(path40)) {
37636
37653
  if (cwd)
37637
- path39 = sp2.join(cwd, path39);
37638
- path39 = sp2.resolve(path39);
37654
+ path40 = sp2.join(cwd, path40);
37655
+ path40 = sp2.resolve(path40);
37639
37656
  }
37640
- this._closePath(path39);
37641
- this._addIgnoredPath(path39);
37642
- if (this._watched.has(path39)) {
37657
+ this._closePath(path40);
37658
+ this._addIgnoredPath(path40);
37659
+ if (this._watched.has(path40)) {
37643
37660
  this._addIgnoredPath({
37644
- path: path39,
37661
+ path: path40,
37645
37662
  recursive: true
37646
37663
  });
37647
37664
  }
@@ -37705,38 +37722,38 @@ var init_chokidar = __esm({
37705
37722
  * @param stats arguments to be passed with event
37706
37723
  * @returns the error if defined, otherwise the value of the FSWatcher instance's `closed` flag
37707
37724
  */
37708
- async _emit(event, path39, stats) {
37725
+ async _emit(event, path40, stats) {
37709
37726
  if (this.closed)
37710
37727
  return;
37711
37728
  const opts = this.options;
37712
37729
  if (isWindows)
37713
- path39 = sp2.normalize(path39);
37730
+ path40 = sp2.normalize(path40);
37714
37731
  if (opts.cwd)
37715
- path39 = sp2.relative(opts.cwd, path39);
37716
- const args = [path39];
37732
+ path40 = sp2.relative(opts.cwd, path40);
37733
+ const args = [path40];
37717
37734
  if (stats != null)
37718
37735
  args.push(stats);
37719
37736
  const awf = opts.awaitWriteFinish;
37720
37737
  let pw;
37721
- if (awf && (pw = this._pendingWrites.get(path39))) {
37738
+ if (awf && (pw = this._pendingWrites.get(path40))) {
37722
37739
  pw.lastChange = /* @__PURE__ */ new Date();
37723
37740
  return this;
37724
37741
  }
37725
37742
  if (opts.atomic) {
37726
37743
  if (event === EVENTS.UNLINK) {
37727
- this._pendingUnlinks.set(path39, [event, ...args]);
37744
+ this._pendingUnlinks.set(path40, [event, ...args]);
37728
37745
  setTimeout(() => {
37729
- this._pendingUnlinks.forEach((entry, path40) => {
37746
+ this._pendingUnlinks.forEach((entry, path41) => {
37730
37747
  this.emit(...entry);
37731
37748
  this.emit(EVENTS.ALL, ...entry);
37732
- this._pendingUnlinks.delete(path40);
37749
+ this._pendingUnlinks.delete(path41);
37733
37750
  });
37734
37751
  }, typeof opts.atomic === "number" ? opts.atomic : 100);
37735
37752
  return this;
37736
37753
  }
37737
- if (event === EVENTS.ADD && this._pendingUnlinks.has(path39)) {
37754
+ if (event === EVENTS.ADD && this._pendingUnlinks.has(path40)) {
37738
37755
  event = EVENTS.CHANGE;
37739
- this._pendingUnlinks.delete(path39);
37756
+ this._pendingUnlinks.delete(path40);
37740
37757
  }
37741
37758
  }
37742
37759
  if (awf && (event === EVENTS.ADD || event === EVENTS.CHANGE) && this._readyEmitted) {
@@ -37754,16 +37771,16 @@ var init_chokidar = __esm({
37754
37771
  this.emitWithAll(event, args);
37755
37772
  }
37756
37773
  };
37757
- this._awaitWriteFinish(path39, awf.stabilityThreshold, event, awfEmit);
37774
+ this._awaitWriteFinish(path40, awf.stabilityThreshold, event, awfEmit);
37758
37775
  return this;
37759
37776
  }
37760
37777
  if (event === EVENTS.CHANGE) {
37761
- const isThrottled = !this._throttle(EVENTS.CHANGE, path39, 50);
37778
+ const isThrottled = !this._throttle(EVENTS.CHANGE, path40, 50);
37762
37779
  if (isThrottled)
37763
37780
  return this;
37764
37781
  }
37765
37782
  if (opts.alwaysStat && stats === void 0 && (event === EVENTS.ADD || event === EVENTS.ADD_DIR || event === EVENTS.CHANGE)) {
37766
- const fullPath = opts.cwd ? sp2.join(opts.cwd, path39) : path39;
37783
+ const fullPath = opts.cwd ? sp2.join(opts.cwd, path40) : path40;
37767
37784
  let stats2;
37768
37785
  try {
37769
37786
  stats2 = await (0, import_promises5.stat)(fullPath);
@@ -37794,23 +37811,23 @@ var init_chokidar = __esm({
37794
37811
  * @param timeout duration of time to suppress duplicate actions
37795
37812
  * @returns tracking object or false if action should be suppressed
37796
37813
  */
37797
- _throttle(actionType, path39, timeout) {
37814
+ _throttle(actionType, path40, timeout) {
37798
37815
  if (!this._throttled.has(actionType)) {
37799
37816
  this._throttled.set(actionType, /* @__PURE__ */ new Map());
37800
37817
  }
37801
37818
  const action = this._throttled.get(actionType);
37802
37819
  if (!action)
37803
37820
  throw new Error("invalid throttle");
37804
- const actionPath = action.get(path39);
37821
+ const actionPath = action.get(path40);
37805
37822
  if (actionPath) {
37806
37823
  actionPath.count++;
37807
37824
  return false;
37808
37825
  }
37809
37826
  let timeoutObject;
37810
37827
  const clear = () => {
37811
- const item = action.get(path39);
37828
+ const item = action.get(path40);
37812
37829
  const count = item ? item.count : 0;
37813
- action.delete(path39);
37830
+ action.delete(path40);
37814
37831
  clearTimeout(timeoutObject);
37815
37832
  if (item)
37816
37833
  clearTimeout(item.timeoutObject);
@@ -37818,7 +37835,7 @@ var init_chokidar = __esm({
37818
37835
  };
37819
37836
  timeoutObject = setTimeout(clear, timeout);
37820
37837
  const thr = { timeoutObject, clear, count: 0 };
37821
- action.set(path39, thr);
37838
+ action.set(path40, thr);
37822
37839
  return thr;
37823
37840
  }
37824
37841
  _incrReadyCount() {
@@ -37832,44 +37849,44 @@ var init_chokidar = __esm({
37832
37849
  * @param event
37833
37850
  * @param awfEmit Callback to be called when ready for event to be emitted.
37834
37851
  */
37835
- _awaitWriteFinish(path39, threshold, event, awfEmit) {
37852
+ _awaitWriteFinish(path40, threshold, event, awfEmit) {
37836
37853
  const awf = this.options.awaitWriteFinish;
37837
37854
  if (typeof awf !== "object")
37838
37855
  return;
37839
37856
  const pollInterval = awf.pollInterval;
37840
37857
  let timeoutHandler;
37841
- let fullPath = path39;
37842
- if (this.options.cwd && !sp2.isAbsolute(path39)) {
37843
- fullPath = sp2.join(this.options.cwd, path39);
37858
+ let fullPath = path40;
37859
+ if (this.options.cwd && !sp2.isAbsolute(path40)) {
37860
+ fullPath = sp2.join(this.options.cwd, path40);
37844
37861
  }
37845
37862
  const now = /* @__PURE__ */ new Date();
37846
37863
  const writes = this._pendingWrites;
37847
37864
  function awaitWriteFinishFn(prevStat) {
37848
37865
  (0, import_node_fs3.stat)(fullPath, (err, curStat) => {
37849
- if (err || !writes.has(path39)) {
37866
+ if (err || !writes.has(path40)) {
37850
37867
  if (err && err.code !== "ENOENT")
37851
37868
  awfEmit(err);
37852
37869
  return;
37853
37870
  }
37854
37871
  const now2 = Number(/* @__PURE__ */ new Date());
37855
37872
  if (prevStat && curStat.size !== prevStat.size) {
37856
- writes.get(path39).lastChange = now2;
37873
+ writes.get(path40).lastChange = now2;
37857
37874
  }
37858
- const pw = writes.get(path39);
37875
+ const pw = writes.get(path40);
37859
37876
  const df = now2 - pw.lastChange;
37860
37877
  if (df >= threshold) {
37861
- writes.delete(path39);
37878
+ writes.delete(path40);
37862
37879
  awfEmit(void 0, curStat);
37863
37880
  } else {
37864
37881
  timeoutHandler = setTimeout(awaitWriteFinishFn, pollInterval, curStat);
37865
37882
  }
37866
37883
  });
37867
37884
  }
37868
- if (!writes.has(path39)) {
37869
- writes.set(path39, {
37885
+ if (!writes.has(path40)) {
37886
+ writes.set(path40, {
37870
37887
  lastChange: now,
37871
37888
  cancelWait: () => {
37872
- writes.delete(path39);
37889
+ writes.delete(path40);
37873
37890
  clearTimeout(timeoutHandler);
37874
37891
  return event;
37875
37892
  }
@@ -37880,8 +37897,8 @@ var init_chokidar = __esm({
37880
37897
  /**
37881
37898
  * Determines whether user has asked to ignore this path.
37882
37899
  */
37883
- _isIgnored(path39, stats) {
37884
- if (this.options.atomic && DOT_RE.test(path39))
37900
+ _isIgnored(path40, stats) {
37901
+ if (this.options.atomic && DOT_RE.test(path40))
37885
37902
  return true;
37886
37903
  if (!this._userIgnored) {
37887
37904
  const { cwd } = this.options;
@@ -37891,17 +37908,17 @@ var init_chokidar = __esm({
37891
37908
  const list = [...ignoredPaths.map(normalizeIgnored(cwd)), ...ignored];
37892
37909
  this._userIgnored = anymatch(list, void 0);
37893
37910
  }
37894
- return this._userIgnored(path39, stats);
37911
+ return this._userIgnored(path40, stats);
37895
37912
  }
37896
- _isntIgnored(path39, stat5) {
37897
- return !this._isIgnored(path39, stat5);
37913
+ _isntIgnored(path40, stat5) {
37914
+ return !this._isIgnored(path40, stat5);
37898
37915
  }
37899
37916
  /**
37900
37917
  * Provides a set of common helpers and properties relating to symlink handling.
37901
37918
  * @param path file or directory pattern being watched
37902
37919
  */
37903
- _getWatchHelpers(path39) {
37904
- return new WatchHelper(path39, this.options.followSymlinks, this);
37920
+ _getWatchHelpers(path40) {
37921
+ return new WatchHelper(path40, this.options.followSymlinks, this);
37905
37922
  }
37906
37923
  // Directory helpers
37907
37924
  // -----------------
@@ -37933,63 +37950,63 @@ var init_chokidar = __esm({
37933
37950
  * @param item base path of item/directory
37934
37951
  */
37935
37952
  _remove(directory, item, isDirectory) {
37936
- const path39 = sp2.join(directory, item);
37937
- const fullPath = sp2.resolve(path39);
37938
- isDirectory = isDirectory != null ? isDirectory : this._watched.has(path39) || this._watched.has(fullPath);
37939
- if (!this._throttle("remove", path39, 100))
37953
+ const path40 = sp2.join(directory, item);
37954
+ const fullPath = sp2.resolve(path40);
37955
+ isDirectory = isDirectory != null ? isDirectory : this._watched.has(path40) || this._watched.has(fullPath);
37956
+ if (!this._throttle("remove", path40, 100))
37940
37957
  return;
37941
37958
  if (!isDirectory && this._watched.size === 1) {
37942
37959
  this.add(directory, item, true);
37943
37960
  }
37944
- const wp = this._getWatchedDir(path39);
37961
+ const wp = this._getWatchedDir(path40);
37945
37962
  const nestedDirectoryChildren = wp.getChildren();
37946
- nestedDirectoryChildren.forEach((nested) => this._remove(path39, nested));
37963
+ nestedDirectoryChildren.forEach((nested) => this._remove(path40, nested));
37947
37964
  const parent = this._getWatchedDir(directory);
37948
37965
  const wasTracked = parent.has(item);
37949
37966
  parent.remove(item);
37950
37967
  if (this._symlinkPaths.has(fullPath)) {
37951
37968
  this._symlinkPaths.delete(fullPath);
37952
37969
  }
37953
- let relPath = path39;
37970
+ let relPath = path40;
37954
37971
  if (this.options.cwd)
37955
- relPath = sp2.relative(this.options.cwd, path39);
37972
+ relPath = sp2.relative(this.options.cwd, path40);
37956
37973
  if (this.options.awaitWriteFinish && this._pendingWrites.has(relPath)) {
37957
37974
  const event = this._pendingWrites.get(relPath).cancelWait();
37958
37975
  if (event === EVENTS.ADD)
37959
37976
  return;
37960
37977
  }
37961
- this._watched.delete(path39);
37978
+ this._watched.delete(path40);
37962
37979
  this._watched.delete(fullPath);
37963
37980
  const eventName = isDirectory ? EVENTS.UNLINK_DIR : EVENTS.UNLINK;
37964
- if (wasTracked && !this._isIgnored(path39))
37965
- this._emit(eventName, path39);
37966
- this._closePath(path39);
37981
+ if (wasTracked && !this._isIgnored(path40))
37982
+ this._emit(eventName, path40);
37983
+ this._closePath(path40);
37967
37984
  }
37968
37985
  /**
37969
37986
  * Closes all watchers for a path
37970
37987
  */
37971
- _closePath(path39) {
37972
- this._closeFile(path39);
37973
- const dir = sp2.dirname(path39);
37974
- this._getWatchedDir(dir).remove(sp2.basename(path39));
37988
+ _closePath(path40) {
37989
+ this._closeFile(path40);
37990
+ const dir = sp2.dirname(path40);
37991
+ this._getWatchedDir(dir).remove(sp2.basename(path40));
37975
37992
  }
37976
37993
  /**
37977
37994
  * Closes only file-specific watchers
37978
37995
  */
37979
- _closeFile(path39) {
37980
- const closers = this._closers.get(path39);
37996
+ _closeFile(path40) {
37997
+ const closers = this._closers.get(path40);
37981
37998
  if (!closers)
37982
37999
  return;
37983
38000
  closers.forEach((closer) => closer());
37984
- this._closers.delete(path39);
38001
+ this._closers.delete(path40);
37985
38002
  }
37986
- _addPathCloser(path39, closer) {
38003
+ _addPathCloser(path40, closer) {
37987
38004
  if (!closer)
37988
38005
  return;
37989
- let list = this._closers.get(path39);
38006
+ let list = this._closers.get(path40);
37990
38007
  if (!list) {
37991
38008
  list = [];
37992
- this._closers.set(path39, list);
38009
+ this._closers.set(path40, list);
37993
38010
  }
37994
38011
  list.push(closer);
37995
38012
  }
@@ -39191,7 +39208,7 @@ var init_provider_loader = __esm({
39191
39208
  return { updated: false };
39192
39209
  }
39193
39210
  try {
39194
- const etag = await new Promise((resolve21, reject) => {
39211
+ const etag = await new Promise((resolve22, reject) => {
39195
39212
  const options = {
39196
39213
  method: "HEAD",
39197
39214
  hostname: "github.com",
@@ -39209,7 +39226,7 @@ var init_provider_loader = __esm({
39209
39226
  headers: { "User-Agent": "adhdev-launcher" },
39210
39227
  timeout: 1e4
39211
39228
  }, (res2) => {
39212
- resolve21(res2.headers.etag || res2.headers["last-modified"] || "");
39229
+ resolve22(res2.headers.etag || res2.headers["last-modified"] || "");
39213
39230
  });
39214
39231
  req2.on("error", reject);
39215
39232
  req2.on("timeout", () => {
@@ -39218,7 +39235,7 @@ var init_provider_loader = __esm({
39218
39235
  });
39219
39236
  req2.end();
39220
39237
  } else {
39221
- resolve21(res.headers.etag || res.headers["last-modified"] || "");
39238
+ resolve22(res.headers.etag || res.headers["last-modified"] || "");
39222
39239
  }
39223
39240
  });
39224
39241
  req.on("error", reject);
@@ -39282,7 +39299,7 @@ var init_provider_loader = __esm({
39282
39299
  downloadFile(url2, destPath) {
39283
39300
  const https = require("https");
39284
39301
  const http3 = require("http");
39285
- return new Promise((resolve21, reject) => {
39302
+ return new Promise((resolve22, reject) => {
39286
39303
  const doRequest = (reqUrl, redirectCount = 0) => {
39287
39304
  if (redirectCount > 5) {
39288
39305
  reject(new Error("Too many redirects"));
@@ -39302,7 +39319,7 @@ var init_provider_loader = __esm({
39302
39319
  res.pipe(ws);
39303
39320
  ws.on("finish", () => {
39304
39321
  ws.close();
39305
- resolve21();
39322
+ resolve22();
39306
39323
  });
39307
39324
  ws.on("error", reject);
39308
39325
  });
@@ -39887,17 +39904,17 @@ async function findFreePort(ports) {
39887
39904
  throw new Error("No free port found");
39888
39905
  }
39889
39906
  function checkPortFree(port) {
39890
- return new Promise((resolve21) => {
39907
+ return new Promise((resolve22) => {
39891
39908
  const server = net2.createServer();
39892
39909
  server.unref();
39893
- server.on("error", () => resolve21(false));
39910
+ server.on("error", () => resolve22(false));
39894
39911
  server.listen(port, "127.0.0.1", () => {
39895
- server.close(() => resolve21(true));
39912
+ server.close(() => resolve22(true));
39896
39913
  });
39897
39914
  });
39898
39915
  }
39899
39916
  async function isCdpActive(port) {
39900
- return new Promise((resolve21) => {
39917
+ return new Promise((resolve22) => {
39901
39918
  const req = require("http").get(`http://127.0.0.1:${port}/json/version`, {
39902
39919
  timeout: 2e3
39903
39920
  }, (res) => {
@@ -39906,16 +39923,16 @@ async function isCdpActive(port) {
39906
39923
  res.on("end", () => {
39907
39924
  try {
39908
39925
  const info = JSON.parse(data);
39909
- resolve21(!!info["WebKit-Version"] || !!info["Browser"]);
39926
+ resolve22(!!info["WebKit-Version"] || !!info["Browser"]);
39910
39927
  } catch {
39911
- resolve21(false);
39928
+ resolve22(false);
39912
39929
  }
39913
39930
  });
39914
39931
  });
39915
- req.on("error", () => resolve21(false));
39932
+ req.on("error", () => resolve22(false));
39916
39933
  req.on("timeout", () => {
39917
39934
  req.destroy();
39918
- resolve21(false);
39935
+ resolve22(false);
39919
39936
  });
39920
39937
  });
39921
39938
  }
@@ -40051,7 +40068,7 @@ function detectCurrentWorkspace(ideId) {
40051
40068
  }
40052
40069
  } else if (plat === "win32") {
40053
40070
  try {
40054
- const fs23 = require("fs");
40071
+ const fs24 = require("fs");
40055
40072
  const appNameMap = getMacAppIdentifiers();
40056
40073
  const appName = appNameMap[ideId];
40057
40074
  if (appName) {
@@ -40060,8 +40077,8 @@ function detectCurrentWorkspace(ideId) {
40060
40077
  appName,
40061
40078
  "storage.json"
40062
40079
  );
40063
- if (fs23.existsSync(storagePath)) {
40064
- const data = JSON.parse(fs23.readFileSync(storagePath, "utf-8"));
40080
+ if (fs24.existsSync(storagePath)) {
40081
+ const data = JSON.parse(fs24.readFileSync(storagePath, "utf-8"));
40065
40082
  const workspaces = data?.openedPathsList?.workspaces3 || data?.openedPathsList?.entries || [];
40066
40083
  if (workspaces.length > 0) {
40067
40084
  const recent = workspaces[0];
@@ -40904,7 +40921,7 @@ async function waitForPidExit(pid, timeoutMs) {
40904
40921
  while (Date.now() - start < timeoutMs) {
40905
40922
  try {
40906
40923
  process.kill(pid, 0);
40907
- await new Promise((resolve21) => setTimeout(resolve21, 250));
40924
+ await new Promise((resolve22) => setTimeout(resolve22, 250));
40908
40925
  } catch {
40909
40926
  return;
40910
40927
  }
@@ -41015,7 +41032,7 @@ async function runDaemonUpgradeHelper(payload) {
41015
41032
  appendUpgradeLog(installOutput.trim());
41016
41033
  }
41017
41034
  if (process.platform === "win32") {
41018
- await new Promise((resolve21) => setTimeout(resolve21, 500));
41035
+ await new Promise((resolve22) => setTimeout(resolve22, 500));
41019
41036
  cleanupStaleGlobalInstallDirs(payload.packageName, installCommand.surface);
41020
41037
  appendUpgradeLog("Post-install staging cleanup complete");
41021
41038
  }
@@ -42476,7 +42493,7 @@ var init_provider_adapter = __esm({
42476
42493
  const beforeCount = this.messageCount(before);
42477
42494
  const beforeSignature = this.lastMessageSignature(before);
42478
42495
  for (let attempt = 0; attempt < 12; attempt += 1) {
42479
- await new Promise((resolve21) => setTimeout(resolve21, 250));
42496
+ await new Promise((resolve22) => setTimeout(resolve22, 250));
42480
42497
  let state;
42481
42498
  try {
42482
42499
  state = await this.readChat(evaluate);
@@ -42498,7 +42515,7 @@ var init_provider_adapter = __esm({
42498
42515
  if (this.messageCount(first) > 0 || this.lastMessageSignature(first)) {
42499
42516
  return first;
42500
42517
  }
42501
- await new Promise((resolve21) => setTimeout(resolve21, 150));
42518
+ await new Promise((resolve22) => setTimeout(resolve22, 150));
42502
42519
  const second = await this.readChat(evaluate);
42503
42520
  return this.messageCount(second) >= this.messageCount(first) ? second : first;
42504
42521
  }
@@ -42649,7 +42666,7 @@ var init_provider_adapter = __esm({
42649
42666
  if (typeof data.error === "string" && data.error.trim()) return false;
42650
42667
  }
42651
42668
  for (let attempt = 0; attempt < 6; attempt += 1) {
42652
- await new Promise((resolve21) => setTimeout(resolve21, 250));
42669
+ await new Promise((resolve22) => setTimeout(resolve22, 250));
42653
42670
  const state = await this.readChat(evaluate);
42654
42671
  const title = this.getStateTitle(state);
42655
42672
  if (this.titlesMatch(title, sessionId)) return true;
@@ -45296,7 +45313,7 @@ function getCliTargetBundle(ctx, type, instanceId) {
45296
45313
  return { target, instance, adapter };
45297
45314
  }
45298
45315
  function sleep(ms) {
45299
- return new Promise((resolve21) => setTimeout(resolve21, ms));
45316
+ return new Promise((resolve22) => setTimeout(resolve22, ms));
45300
45317
  }
45301
45318
  async function waitForCliReady(ctx, type, instanceId, timeoutMs) {
45302
45319
  const startedAt = Date.now();
@@ -47544,8 +47561,8 @@ var init_dev_server = __esm({
47544
47561
  }
47545
47562
  getEndpointList() {
47546
47563
  return this.routes.map((r) => {
47547
- const path39 = typeof r.pattern === "string" ? r.pattern : r.pattern.source.replace(/\\\//g, "/").replace(/\(\[.*?\]\+\)/g, ":type").replace(/[\^$]/g, "");
47548
- return `${r.method.padEnd(5)} ${path39}`;
47564
+ const path40 = typeof r.pattern === "string" ? r.pattern : r.pattern.source.replace(/\\\//g, "/").replace(/\(\[.*?\]\+\)/g, ":type").replace(/[\^$]/g, "");
47565
+ return `${r.method.padEnd(5)} ${path40}`;
47549
47566
  });
47550
47567
  }
47551
47568
  async start(port = DEV_SERVER_PORT) {
@@ -47576,15 +47593,15 @@ var init_dev_server = __esm({
47576
47593
  this.json(res, 500, { error: e.message });
47577
47594
  }
47578
47595
  });
47579
- return new Promise((resolve21, reject) => {
47596
+ return new Promise((resolve22, reject) => {
47580
47597
  this.server.listen(port, "127.0.0.1", () => {
47581
47598
  this.log(`Dev server listening on http://127.0.0.1:${port}`);
47582
- resolve21();
47599
+ resolve22();
47583
47600
  });
47584
47601
  this.server.on("error", (e) => {
47585
47602
  if (e.code === "EADDRINUSE") {
47586
47603
  this.log(`Port ${port} in use, skipping dev server`);
47587
- resolve21();
47604
+ resolve22();
47588
47605
  } else {
47589
47606
  reject(e);
47590
47607
  }
@@ -47666,20 +47683,20 @@ var init_dev_server = __esm({
47666
47683
  child.stderr?.on("data", (d) => {
47667
47684
  stderr += d.toString().slice(0, 2e3);
47668
47685
  });
47669
- await new Promise((resolve21) => {
47686
+ await new Promise((resolve22) => {
47670
47687
  const timer = setTimeout(() => {
47671
47688
  child.kill();
47672
- resolve21();
47689
+ resolve22();
47673
47690
  }, 3e3);
47674
47691
  child.on("exit", () => {
47675
47692
  clearTimeout(timer);
47676
- resolve21();
47693
+ resolve22();
47677
47694
  });
47678
47695
  child.stdout?.once("data", () => {
47679
47696
  setTimeout(() => {
47680
47697
  child.kill();
47681
47698
  clearTimeout(timer);
47682
- resolve21();
47699
+ resolve22();
47683
47700
  }, 500);
47684
47701
  });
47685
47702
  });
@@ -48182,14 +48199,14 @@ var init_dev_server = __esm({
48182
48199
  child.stderr?.on("data", (d) => {
48183
48200
  stderr += d.toString();
48184
48201
  });
48185
- await new Promise((resolve21) => {
48202
+ await new Promise((resolve22) => {
48186
48203
  const timer = setTimeout(() => {
48187
48204
  child.kill();
48188
- resolve21();
48205
+ resolve22();
48189
48206
  }, timeout);
48190
48207
  child.on("exit", () => {
48191
48208
  clearTimeout(timer);
48192
- resolve21();
48209
+ resolve22();
48193
48210
  });
48194
48211
  });
48195
48212
  const elapsed = Date.now() - start;
@@ -48859,14 +48876,14 @@ data: ${JSON.stringify(msg.data)}
48859
48876
  res.end(JSON.stringify(data, null, 2));
48860
48877
  }
48861
48878
  async readBody(req) {
48862
- return new Promise((resolve21) => {
48879
+ return new Promise((resolve22) => {
48863
48880
  let body = "";
48864
48881
  req.on("data", (chunk) => body += chunk);
48865
48882
  req.on("end", () => {
48866
48883
  try {
48867
- resolve21(JSON.parse(body));
48884
+ resolve22(JSON.parse(body));
48868
48885
  } catch {
48869
- resolve21({});
48886
+ resolve22({});
48870
48887
  }
48871
48888
  });
48872
48889
  });
@@ -49383,7 +49400,7 @@ async function waitForReady(endpoint, timeoutMs = STARTUP_TIMEOUT_MS) {
49383
49400
  const deadline = Date.now() + timeoutMs;
49384
49401
  while (Date.now() < deadline) {
49385
49402
  if (await canConnect(endpoint)) return;
49386
- await new Promise((resolve21) => setTimeout(resolve21, STARTUP_POLL_MS));
49403
+ await new Promise((resolve22) => setTimeout(resolve22, STARTUP_POLL_MS));
49387
49404
  }
49388
49405
  throw new Error(`Session host did not become ready within ${timeoutMs}ms`);
49389
49406
  }
@@ -49487,12 +49504,12 @@ async function installExtension(ide, extension) {
49487
49504
  const res = await fetch(extension.vsixUrl);
49488
49505
  if (res.ok) {
49489
49506
  const buffer = Buffer.from(await res.arrayBuffer());
49490
- const fs23 = await import("fs");
49491
- fs23.writeFileSync(vsixPath, buffer);
49492
- return new Promise((resolve21) => {
49507
+ const fs24 = await import("fs");
49508
+ fs24.writeFileSync(vsixPath, buffer);
49509
+ return new Promise((resolve22) => {
49493
49510
  const cmd = `"${ide.cliCommand}" --install-extension "${vsixPath}" --force`;
49494
49511
  (0, import_child_process11.exec)(cmd, { timeout: 6e4 }, (error48, _stdout, stderr) => {
49495
- resolve21({
49512
+ resolve22({
49496
49513
  extensionId: extension.id,
49497
49514
  marketplaceId: extension.marketplaceId,
49498
49515
  success: !error48,
@@ -49505,11 +49522,11 @@ async function installExtension(ide, extension) {
49505
49522
  } catch (e) {
49506
49523
  }
49507
49524
  }
49508
- return new Promise((resolve21) => {
49525
+ return new Promise((resolve22) => {
49509
49526
  const cmd = `"${ide.cliCommand}" --install-extension ${extension.marketplaceId} --force`;
49510
49527
  (0, import_child_process11.exec)(cmd, { timeout: 6e4 }, (error48, stdout, stderr) => {
49511
49528
  if (error48) {
49512
- resolve21({
49529
+ resolve22({
49513
49530
  extensionId: extension.id,
49514
49531
  marketplaceId: extension.marketplaceId,
49515
49532
  success: false,
@@ -49517,7 +49534,7 @@ async function installExtension(ide, extension) {
49517
49534
  error: stderr || error48.message
49518
49535
  });
49519
49536
  } else {
49520
- resolve21({
49537
+ resolve22({
49521
49538
  extensionId: extension.id,
49522
49539
  marketplaceId: extension.marketplaceId,
49523
49540
  success: true,
@@ -50213,7 +50230,7 @@ async function sendDaemonCommand(cmd, args = {}, port) {
50213
50230
  const resolvedPort = resolveDaemonCommandPort(port);
50214
50231
  const WebSocket4 = (await import("ws")).default;
50215
50232
  const { DAEMON_WS_PATH: DAEMON_WS_PATH2 } = await Promise.resolve().then(() => (init_src(), src_exports));
50216
- return new Promise((resolve21, reject) => {
50233
+ return new Promise((resolve22, reject) => {
50217
50234
  const wsUrl = `ws://127.0.0.1:${resolvedPort}${DAEMON_WS_PATH2 || "/daemon"}`;
50218
50235
  const ws = new WebSocket4(wsUrl);
50219
50236
  const requestId = `cli-${Date.now()}`;
@@ -50254,7 +50271,7 @@ async function sendDaemonCommand(cmd, args = {}, port) {
50254
50271
  if (msg.type === "ext:command_result" && msg.payload?.requestId === requestId || msg.type === "daemon:command_result" || msg.type === "command_result") {
50255
50272
  clearTimeout(timeout);
50256
50273
  ws.close();
50257
- resolve21(msg.payload?.result || msg.payload || msg);
50274
+ resolve22(msg.payload?.result || msg.payload || msg);
50258
50275
  }
50259
50276
  } catch {
50260
50277
  }
@@ -50273,13 +50290,13 @@ This command needs a running local daemon with IPC enabled. Start with: adhdev d
50273
50290
  }
50274
50291
  async function directCdpEval(expression, port = 9222) {
50275
50292
  const http3 = await import("http");
50276
- const targets = await new Promise((resolve21, reject) => {
50293
+ const targets = await new Promise((resolve22, reject) => {
50277
50294
  http3.get(`http://127.0.0.1:${port}/json`, (res) => {
50278
50295
  let data = "";
50279
50296
  res.on("data", (c) => data += c);
50280
50297
  res.on("end", () => {
50281
50298
  try {
50282
- resolve21(JSON.parse(data));
50299
+ resolve22(JSON.parse(data));
50283
50300
  } catch {
50284
50301
  reject(new Error("Invalid JSON"));
50285
50302
  }
@@ -50292,7 +50309,7 @@ async function directCdpEval(expression, port = 9222) {
50292
50309
  const target = (mainPages.length > 0 ? mainPages[0] : pages[0]) || targets[0];
50293
50310
  if (!target?.webSocketDebuggerUrl) throw new Error("No CDP target found");
50294
50311
  const WebSocket4 = (await import("ws")).default;
50295
- return new Promise((resolve21, reject) => {
50312
+ return new Promise((resolve22, reject) => {
50296
50313
  const ws = new WebSocket4(target.webSocketDebuggerUrl);
50297
50314
  const timeout = setTimeout(() => {
50298
50315
  ws.close();
@@ -50314,11 +50331,11 @@ async function directCdpEval(expression, port = 9222) {
50314
50331
  clearTimeout(timeout);
50315
50332
  ws.close();
50316
50333
  if (msg.result?.result?.value !== void 0) {
50317
- resolve21(msg.result.result.value);
50334
+ resolve22(msg.result.result.value);
50318
50335
  } else if (msg.result?.exceptionDetails) {
50319
50336
  reject(new Error(msg.result.exceptionDetails.text));
50320
50337
  } else {
50321
- resolve21(msg.result);
50338
+ resolve22(msg.result);
50322
50339
  }
50323
50340
  }
50324
50341
  });
@@ -50854,14 +50871,14 @@ var require_run_async = __commonJS({
50854
50871
  return function() {
50855
50872
  var args = arguments;
50856
50873
  var originalThis = this;
50857
- var promise2 = new Promise(function(resolve21, reject) {
50874
+ var promise2 = new Promise(function(resolve22, reject) {
50858
50875
  var resolved = false;
50859
50876
  const wrappedResolve = function(value) {
50860
50877
  if (resolved) {
50861
50878
  console.warn("Run-async promise already resolved.");
50862
50879
  }
50863
50880
  resolved = true;
50864
- resolve21(value);
50881
+ resolve22(value);
50865
50882
  };
50866
50883
  var rejected = false;
50867
50884
  const wrappedReject = function(value) {
@@ -51652,7 +51669,7 @@ var require_Observable = __commonJS({
51652
51669
  Observable2.prototype.forEach = function(next, promiseCtor) {
51653
51670
  var _this = this;
51654
51671
  promiseCtor = getPromiseCtor(promiseCtor);
51655
- return new promiseCtor(function(resolve21, reject) {
51672
+ return new promiseCtor(function(resolve22, reject) {
51656
51673
  var subscriber = new Subscriber_1.SafeSubscriber({
51657
51674
  next: function(value) {
51658
51675
  try {
@@ -51663,7 +51680,7 @@ var require_Observable = __commonJS({
51663
51680
  }
51664
51681
  },
51665
51682
  error: reject,
51666
- complete: resolve21
51683
+ complete: resolve22
51667
51684
  });
51668
51685
  _this.subscribe(subscriber);
51669
51686
  });
@@ -51685,14 +51702,14 @@ var require_Observable = __commonJS({
51685
51702
  Observable2.prototype.toPromise = function(promiseCtor) {
51686
51703
  var _this = this;
51687
51704
  promiseCtor = getPromiseCtor(promiseCtor);
51688
- return new promiseCtor(function(resolve21, reject) {
51705
+ return new promiseCtor(function(resolve22, reject) {
51689
51706
  var value;
51690
51707
  _this.subscribe(function(x) {
51691
51708
  return value = x;
51692
51709
  }, function(err) {
51693
51710
  return reject(err);
51694
51711
  }, function() {
51695
- return resolve21(value);
51712
+ return resolve22(value);
51696
51713
  });
51697
51714
  });
51698
51715
  };
@@ -53788,11 +53805,11 @@ var require_innerFrom = __commonJS({
53788
53805
  "use strict";
53789
53806
  var __awaiter = exports2 && exports2.__awaiter || function(thisArg, _arguments, P, generator) {
53790
53807
  function adopt(value) {
53791
- return value instanceof P ? value : new P(function(resolve21) {
53792
- resolve21(value);
53808
+ return value instanceof P ? value : new P(function(resolve22) {
53809
+ resolve22(value);
53793
53810
  });
53794
53811
  }
53795
- return new (P || (P = Promise))(function(resolve21, reject) {
53812
+ return new (P || (P = Promise))(function(resolve22, reject) {
53796
53813
  function fulfilled(value) {
53797
53814
  try {
53798
53815
  step(generator.next(value));
@@ -53808,7 +53825,7 @@ var require_innerFrom = __commonJS({
53808
53825
  }
53809
53826
  }
53810
53827
  function step(result) {
53811
- result.done ? resolve21(result.value) : adopt(result.value).then(fulfilled, rejected);
53828
+ result.done ? resolve22(result.value) : adopt(result.value).then(fulfilled, rejected);
53812
53829
  }
53813
53830
  step((generator = generator.apply(thisArg, _arguments || [])).next());
53814
53831
  });
@@ -53890,14 +53907,14 @@ var require_innerFrom = __commonJS({
53890
53907
  }, i);
53891
53908
  function verb(n) {
53892
53909
  i[n] = o[n] && function(v) {
53893
- return new Promise(function(resolve21, reject) {
53894
- v = o[n](v), settle(resolve21, reject, v.done, v.value);
53910
+ return new Promise(function(resolve22, reject) {
53911
+ v = o[n](v), settle(resolve22, reject, v.done, v.value);
53895
53912
  });
53896
53913
  };
53897
53914
  }
53898
- function settle(resolve21, reject, d, v) {
53915
+ function settle(resolve22, reject, d, v) {
53899
53916
  Promise.resolve(v).then(function(v2) {
53900
- resolve21({ value: v2, done: d });
53917
+ resolve22({ value: v2, done: d });
53901
53918
  }, reject);
53902
53919
  }
53903
53920
  };
@@ -54516,7 +54533,7 @@ var require_lastValueFrom = __commonJS({
54516
54533
  var EmptyError_1 = require_EmptyError();
54517
54534
  function lastValueFrom(source, config2) {
54518
54535
  var hasConfig = typeof config2 === "object";
54519
- return new Promise(function(resolve21, reject) {
54536
+ return new Promise(function(resolve22, reject) {
54520
54537
  var _hasValue = false;
54521
54538
  var _value;
54522
54539
  source.subscribe({
@@ -54527,9 +54544,9 @@ var require_lastValueFrom = __commonJS({
54527
54544
  error: reject,
54528
54545
  complete: function() {
54529
54546
  if (_hasValue) {
54530
- resolve21(_value);
54547
+ resolve22(_value);
54531
54548
  } else if (hasConfig) {
54532
- resolve21(config2.defaultValue);
54549
+ resolve22(config2.defaultValue);
54533
54550
  } else {
54534
54551
  reject(new EmptyError_1.EmptyError());
54535
54552
  }
@@ -54551,16 +54568,16 @@ var require_firstValueFrom = __commonJS({
54551
54568
  var Subscriber_1 = require_Subscriber();
54552
54569
  function firstValueFrom(source, config2) {
54553
54570
  var hasConfig = typeof config2 === "object";
54554
- return new Promise(function(resolve21, reject) {
54571
+ return new Promise(function(resolve22, reject) {
54555
54572
  var subscriber = new Subscriber_1.SafeSubscriber({
54556
54573
  next: function(value) {
54557
- resolve21(value);
54574
+ resolve22(value);
54558
54575
  subscriber.unsubscribe();
54559
54576
  },
54560
54577
  error: reject,
54561
54578
  complete: function() {
54562
54579
  if (hasConfig) {
54563
- resolve21(config2.defaultValue);
54580
+ resolve22(config2.defaultValue);
54564
54581
  } else {
54565
54582
  reject(new EmptyError_1.EmptyError());
54566
54583
  }
@@ -61679,15 +61696,15 @@ var require_route = __commonJS({
61679
61696
  };
61680
61697
  }
61681
61698
  function wrapConversion(toModel, graph) {
61682
- const path39 = [graph[toModel].parent, toModel];
61699
+ const path40 = [graph[toModel].parent, toModel];
61683
61700
  let fn = conversions[graph[toModel].parent][toModel];
61684
61701
  let cur = graph[toModel].parent;
61685
61702
  while (graph[cur].parent) {
61686
- path39.unshift(graph[cur].parent);
61703
+ path40.unshift(graph[cur].parent);
61687
61704
  fn = link(conversions[graph[cur].parent][cur], fn);
61688
61705
  cur = graph[cur].parent;
61689
61706
  }
61690
- fn.conversion = path39;
61707
+ fn.conversion = path40;
61691
61708
  return fn;
61692
61709
  }
61693
61710
  module2.exports = function(fromModel) {
@@ -66366,14 +66383,14 @@ var require_async_iterator = __commonJS({
66366
66383
  };
66367
66384
  }
66368
66385
  function readAndResolve(iter) {
66369
- var resolve21 = iter[kLastResolve];
66370
- if (resolve21 !== null) {
66386
+ var resolve22 = iter[kLastResolve];
66387
+ if (resolve22 !== null) {
66371
66388
  var data = iter[kStream].read();
66372
66389
  if (data !== null) {
66373
66390
  iter[kLastPromise] = null;
66374
66391
  iter[kLastResolve] = null;
66375
66392
  iter[kLastReject] = null;
66376
- resolve21(createIterResult(data, false));
66393
+ resolve22(createIterResult(data, false));
66377
66394
  }
66378
66395
  }
66379
66396
  }
@@ -66381,13 +66398,13 @@ var require_async_iterator = __commonJS({
66381
66398
  process.nextTick(readAndResolve, iter);
66382
66399
  }
66383
66400
  function wrapForNext(lastPromise, iter) {
66384
- return function(resolve21, reject) {
66401
+ return function(resolve22, reject) {
66385
66402
  lastPromise.then(function() {
66386
66403
  if (iter[kEnded]) {
66387
- resolve21(createIterResult(void 0, true));
66404
+ resolve22(createIterResult(void 0, true));
66388
66405
  return;
66389
66406
  }
66390
- iter[kHandlePromise](resolve21, reject);
66407
+ iter[kHandlePromise](resolve22, reject);
66391
66408
  }, reject);
66392
66409
  };
66393
66410
  }
@@ -66407,12 +66424,12 @@ var require_async_iterator = __commonJS({
66407
66424
  return Promise.resolve(createIterResult(void 0, true));
66408
66425
  }
66409
66426
  if (this[kStream].destroyed) {
66410
- return new Promise(function(resolve21, reject) {
66427
+ return new Promise(function(resolve22, reject) {
66411
66428
  process.nextTick(function() {
66412
66429
  if (_this[kError]) {
66413
66430
  reject(_this[kError]);
66414
66431
  } else {
66415
- resolve21(createIterResult(void 0, true));
66432
+ resolve22(createIterResult(void 0, true));
66416
66433
  }
66417
66434
  });
66418
66435
  });
@@ -66435,13 +66452,13 @@ var require_async_iterator = __commonJS({
66435
66452
  return this;
66436
66453
  }), _defineProperty(_Object$setPrototypeO, "return", function _return() {
66437
66454
  var _this2 = this;
66438
- return new Promise(function(resolve21, reject) {
66455
+ return new Promise(function(resolve22, reject) {
66439
66456
  _this2[kStream].destroy(null, function(err) {
66440
66457
  if (err) {
66441
66458
  reject(err);
66442
66459
  return;
66443
66460
  }
66444
- resolve21(createIterResult(void 0, true));
66461
+ resolve22(createIterResult(void 0, true));
66445
66462
  });
66446
66463
  });
66447
66464
  }), _Object$setPrototypeO), AsyncIteratorPrototype);
@@ -66463,15 +66480,15 @@ var require_async_iterator = __commonJS({
66463
66480
  value: stream._readableState.endEmitted,
66464
66481
  writable: true
66465
66482
  }), _defineProperty(_Object$create, kHandlePromise, {
66466
- value: function value(resolve21, reject) {
66483
+ value: function value(resolve22, reject) {
66467
66484
  var data = iterator[kStream].read();
66468
66485
  if (data) {
66469
66486
  iterator[kLastPromise] = null;
66470
66487
  iterator[kLastResolve] = null;
66471
66488
  iterator[kLastReject] = null;
66472
- resolve21(createIterResult(data, false));
66489
+ resolve22(createIterResult(data, false));
66473
66490
  } else {
66474
- iterator[kLastResolve] = resolve21;
66491
+ iterator[kLastResolve] = resolve22;
66475
66492
  iterator[kLastReject] = reject;
66476
66493
  }
66477
66494
  },
@@ -66490,12 +66507,12 @@ var require_async_iterator = __commonJS({
66490
66507
  iterator[kError] = err;
66491
66508
  return;
66492
66509
  }
66493
- var resolve21 = iterator[kLastResolve];
66494
- if (resolve21 !== null) {
66510
+ var resolve22 = iterator[kLastResolve];
66511
+ if (resolve22 !== null) {
66495
66512
  iterator[kLastPromise] = null;
66496
66513
  iterator[kLastResolve] = null;
66497
66514
  iterator[kLastReject] = null;
66498
- resolve21(createIterResult(void 0, true));
66515
+ resolve22(createIterResult(void 0, true));
66499
66516
  }
66500
66517
  iterator[kEnded] = true;
66501
66518
  });
@@ -66510,7 +66527,7 @@ var require_async_iterator = __commonJS({
66510
66527
  var require_from2 = __commonJS({
66511
66528
  "../../node_modules/readable-stream/lib/internal/streams/from.js"(exports2, module2) {
66512
66529
  "use strict";
66513
- function asyncGeneratorStep(gen, resolve21, reject, _next, _throw, key, arg) {
66530
+ function asyncGeneratorStep(gen, resolve22, reject, _next, _throw, key, arg) {
66514
66531
  try {
66515
66532
  var info = gen[key](arg);
66516
66533
  var value = info.value;
@@ -66519,7 +66536,7 @@ var require_from2 = __commonJS({
66519
66536
  return;
66520
66537
  }
66521
66538
  if (info.done) {
66522
- resolve21(value);
66539
+ resolve22(value);
66523
66540
  } else {
66524
66541
  Promise.resolve(value).then(_next, _throw);
66525
66542
  }
@@ -66527,13 +66544,13 @@ var require_from2 = __commonJS({
66527
66544
  function _asyncToGenerator(fn) {
66528
66545
  return function() {
66529
66546
  var self2 = this, args = arguments;
66530
- return new Promise(function(resolve21, reject) {
66547
+ return new Promise(function(resolve22, reject) {
66531
66548
  var gen = fn.apply(self2, args);
66532
66549
  function _next(value) {
66533
- asyncGeneratorStep(gen, resolve21, reject, _next, _throw, "next", value);
66550
+ asyncGeneratorStep(gen, resolve22, reject, _next, _throw, "next", value);
66534
66551
  }
66535
66552
  function _throw(err) {
66536
- asyncGeneratorStep(gen, resolve21, reject, _next, _throw, "throw", err);
66553
+ asyncGeneratorStep(gen, resolve22, reject, _next, _throw, "throw", err);
66537
66554
  }
66538
66555
  _next(void 0);
66539
66556
  });
@@ -68472,9 +68489,9 @@ var init_base = __esm({
68472
68489
  * @return {Promise}
68473
68490
  */
68474
68491
  run() {
68475
- return new Promise((resolve21, reject) => {
68492
+ return new Promise((resolve22, reject) => {
68476
68493
  this._run(
68477
- (value) => resolve21(value),
68494
+ (value) => resolve22(value),
68478
68495
  (error48) => reject(error48)
68479
68496
  );
68480
68497
  });
@@ -75106,26 +75123,26 @@ var require_lib = __commonJS({
75106
75123
  return matches;
75107
75124
  };
75108
75125
  exports2.analyse = analyse;
75109
- var detectFile = (filepath, opts = {}) => new Promise((resolve21, reject) => {
75126
+ var detectFile = (filepath, opts = {}) => new Promise((resolve22, reject) => {
75110
75127
  let fd;
75111
- const fs23 = (0, node_1.default)();
75128
+ const fs24 = (0, node_1.default)();
75112
75129
  const handler = (err, buffer) => {
75113
75130
  if (fd) {
75114
- fs23.closeSync(fd);
75131
+ fs24.closeSync(fd);
75115
75132
  }
75116
75133
  if (err) {
75117
75134
  reject(err);
75118
75135
  } else if (buffer) {
75119
- resolve21((0, exports2.detect)(buffer));
75136
+ resolve22((0, exports2.detect)(buffer));
75120
75137
  } else {
75121
75138
  reject(new Error("No error and no buffer received"));
75122
75139
  }
75123
75140
  };
75124
75141
  const sampleSize = (opts === null || opts === void 0 ? void 0 : opts.sampleSize) || 0;
75125
75142
  if (sampleSize > 0) {
75126
- fd = fs23.openSync(filepath, "r");
75143
+ fd = fs24.openSync(filepath, "r");
75127
75144
  let sample = Buffer.allocUnsafe(sampleSize);
75128
- fs23.read(fd, sample, 0, sampleSize, opts.offset, (err, bytesRead) => {
75145
+ fs24.read(fd, sample, 0, sampleSize, opts.offset, (err, bytesRead) => {
75129
75146
  if (err) {
75130
75147
  handler(err, null);
75131
75148
  } else {
@@ -75137,22 +75154,22 @@ var require_lib = __commonJS({
75137
75154
  });
75138
75155
  return;
75139
75156
  }
75140
- fs23.readFile(filepath, handler);
75157
+ fs24.readFile(filepath, handler);
75141
75158
  });
75142
75159
  exports2.detectFile = detectFile;
75143
75160
  var detectFileSync = (filepath, opts = {}) => {
75144
- const fs23 = (0, node_1.default)();
75161
+ const fs24 = (0, node_1.default)();
75145
75162
  if (opts && opts.sampleSize) {
75146
- const fd = fs23.openSync(filepath, "r");
75163
+ const fd = fs24.openSync(filepath, "r");
75147
75164
  let sample = Buffer.allocUnsafe(opts.sampleSize);
75148
- const bytesRead = fs23.readSync(fd, sample, 0, opts.sampleSize, opts.offset);
75165
+ const bytesRead = fs24.readSync(fd, sample, 0, opts.sampleSize, opts.offset);
75149
75166
  if (bytesRead < opts.sampleSize) {
75150
75167
  sample = sample.subarray(0, bytesRead);
75151
75168
  }
75152
- fs23.closeSync(fd);
75169
+ fs24.closeSync(fd);
75153
75170
  return (0, exports2.detect)(sample);
75154
75171
  }
75155
- return (0, exports2.detect)(fs23.readFileSync(filepath));
75172
+ return (0, exports2.detect)(fs24.readFileSync(filepath));
75156
75173
  };
75157
75174
  exports2.detectFileSync = detectFileSync;
75158
75175
  exports2.default = {
@@ -79557,9 +79574,9 @@ var init_prompt = __esm({
79557
79574
  init_utils();
79558
79575
  init_baseUI();
79559
79576
  _ = {
79560
- set: (obj, path39 = "", value) => {
79577
+ set: (obj, path40 = "", value) => {
79561
79578
  let pointer = obj;
79562
- path39.split(".").forEach((key, index, arr) => {
79579
+ path40.split(".").forEach((key, index, arr) => {
79563
79580
  if (key === "__proto__" || key === "constructor") return;
79564
79581
  if (index === arr.length - 1) {
79565
79582
  pointer[key] = value;
@@ -79569,8 +79586,8 @@ var init_prompt = __esm({
79569
79586
  pointer = pointer[key];
79570
79587
  });
79571
79588
  },
79572
- get: (obj, path39 = "", defaultValue) => {
79573
- const travel = (regexp) => String.prototype.split.call(path39, regexp).filter(Boolean).reduce(
79589
+ get: (obj, path40 = "", defaultValue) => {
79590
+ const travel = (regexp) => String.prototype.split.call(path40, regexp).filter(Boolean).reduce(
79574
79591
  // @ts-expect-error implicit any on res[key]
79575
79592
  (res, key) => res !== null && res !== void 0 ? res[key] : res,
79576
79593
  obj
@@ -80986,8 +81003,8 @@ var init_server_connection = __esm({
80986
81003
  * Returns the command result or throws on timeout / auth failure.
80987
81004
  */
80988
81005
  sendMeshCommand(targetDaemonId, command, args = {}, timeoutMs = 3e4) {
80989
- return new Promise((resolve21, reject) => {
80990
- const requestId = `mesh_${Date.now()}_${Math.random().toString(36).substring(2, 8)}`;
81006
+ return new Promise((resolve22, reject) => {
81007
+ const requestId = `mesh_${crypto.randomUUID()}`;
80991
81008
  const timer = setTimeout(() => {
80992
81009
  this.off("daemon_mesh_result", handler);
80993
81010
  reject(new Error(`Mesh command timed out after ${timeoutMs}ms`));
@@ -80999,7 +81016,7 @@ var init_server_connection = __esm({
80999
81016
  if (msg.payload?.success === false) {
81000
81017
  reject(new Error(msg.payload?.error ?? "Mesh command failed"));
81001
81018
  } else {
81002
- resolve21(msg.payload?.result);
81019
+ resolve22(msg.payload?.result);
81003
81020
  }
81004
81021
  };
81005
81022
  this.on("daemon_mesh_result", handler);
@@ -82789,27 +82806,27 @@ var require_process = __commonJS({
82789
82806
  var require_filesystem = __commonJS({
82790
82807
  "../../node_modules/detect-libc/lib/filesystem.js"(exports2, module2) {
82791
82808
  "use strict";
82792
- var fs23 = require("fs");
82809
+ var fs24 = require("fs");
82793
82810
  var LDD_PATH = "/usr/bin/ldd";
82794
82811
  var SELF_PATH = "/proc/self/exe";
82795
82812
  var MAX_LENGTH = 2048;
82796
- var readFileSync20 = (path39) => {
82797
- const fd = fs23.openSync(path39, "r");
82813
+ var readFileSync20 = (path40) => {
82814
+ const fd = fs24.openSync(path40, "r");
82798
82815
  const buffer = Buffer.alloc(MAX_LENGTH);
82799
- const bytesRead = fs23.readSync(fd, buffer, 0, MAX_LENGTH, 0);
82800
- fs23.close(fd, () => {
82816
+ const bytesRead = fs24.readSync(fd, buffer, 0, MAX_LENGTH, 0);
82817
+ fs24.close(fd, () => {
82801
82818
  });
82802
82819
  return buffer.subarray(0, bytesRead);
82803
82820
  };
82804
- var readFile2 = (path39) => new Promise((resolve21, reject) => {
82805
- fs23.open(path39, "r", (err, fd) => {
82821
+ var readFile2 = (path40) => new Promise((resolve22, reject) => {
82822
+ fs24.open(path40, "r", (err, fd) => {
82806
82823
  if (err) {
82807
82824
  reject(err);
82808
82825
  } else {
82809
82826
  const buffer = Buffer.alloc(MAX_LENGTH);
82810
- fs23.read(fd, buffer, 0, MAX_LENGTH, 0, (_2, bytesRead) => {
82811
- resolve21(buffer.subarray(0, bytesRead));
82812
- fs23.close(fd, () => {
82827
+ fs24.read(fd, buffer, 0, MAX_LENGTH, 0, (_2, bytesRead) => {
82828
+ resolve22(buffer.subarray(0, bytesRead));
82829
+ fs24.close(fd, () => {
82813
82830
  });
82814
82831
  });
82815
82832
  }
@@ -82876,10 +82893,10 @@ var require_detect_libc = __commonJS({
82876
82893
  var commandOut = "";
82877
82894
  var safeCommand = () => {
82878
82895
  if (!commandOut) {
82879
- return new Promise((resolve21) => {
82896
+ return new Promise((resolve22) => {
82880
82897
  childProcess.exec(command, (err, out) => {
82881
82898
  commandOut = err ? " " : out;
82882
- resolve21(commandOut);
82899
+ resolve22(commandOut);
82883
82900
  });
82884
82901
  });
82885
82902
  }
@@ -82921,11 +82938,11 @@ var require_detect_libc = __commonJS({
82921
82938
  }
82922
82939
  return null;
82923
82940
  };
82924
- var familyFromInterpreterPath = (path39) => {
82925
- if (path39) {
82926
- if (path39.includes("/ld-musl-")) {
82941
+ var familyFromInterpreterPath = (path40) => {
82942
+ if (path40) {
82943
+ if (path40.includes("/ld-musl-")) {
82927
82944
  return MUSL;
82928
- } else if (path39.includes("/ld-linux-")) {
82945
+ } else if (path40.includes("/ld-linux-")) {
82929
82946
  return GLIBC;
82930
82947
  }
82931
82948
  }
@@ -82972,8 +82989,8 @@ var require_detect_libc = __commonJS({
82972
82989
  cachedFamilyInterpreter = null;
82973
82990
  try {
82974
82991
  const selfContent = await readFile2(SELF_PATH);
82975
- const path39 = interpreterPath(selfContent);
82976
- cachedFamilyInterpreter = familyFromInterpreterPath(path39);
82992
+ const path40 = interpreterPath(selfContent);
82993
+ cachedFamilyInterpreter = familyFromInterpreterPath(path40);
82977
82994
  } catch (e) {
82978
82995
  }
82979
82996
  return cachedFamilyInterpreter;
@@ -82985,8 +83002,8 @@ var require_detect_libc = __commonJS({
82985
83002
  cachedFamilyInterpreter = null;
82986
83003
  try {
82987
83004
  const selfContent = readFileSync20(SELF_PATH);
82988
- const path39 = interpreterPath(selfContent);
82989
- cachedFamilyInterpreter = familyFromInterpreterPath(path39);
83005
+ const path40 = interpreterPath(selfContent);
83006
+ cachedFamilyInterpreter = familyFromInterpreterPath(path40);
82990
83007
  } catch (e) {
82991
83008
  }
82992
83009
  return cachedFamilyInterpreter;
@@ -84705,18 +84722,18 @@ var require_sharp = __commonJS({
84705
84722
  `@img/sharp-${runtimePlatform}/sharp.node`,
84706
84723
  "@img/sharp-wasm32/sharp.node"
84707
84724
  ];
84708
- var path39;
84725
+ var path40;
84709
84726
  var sharp;
84710
84727
  var errors = [];
84711
- for (path39 of paths) {
84728
+ for (path40 of paths) {
84712
84729
  try {
84713
- sharp = require(path39);
84730
+ sharp = require(path40);
84714
84731
  break;
84715
84732
  } catch (err) {
84716
84733
  errors.push(err);
84717
84734
  }
84718
84735
  }
84719
- if (sharp && path39.startsWith("@img/sharp-linux-x64") && !sharp._isUsingX64V2()) {
84736
+ if (sharp && path40.startsWith("@img/sharp-linux-x64") && !sharp._isUsingX64V2()) {
84720
84737
  const err = new Error("Prebuilt binaries for linux-x64 require v2 microarchitecture");
84721
84738
  err.code = "Unsupported CPU";
84722
84739
  errors.push(err);
@@ -85559,14 +85576,14 @@ var require_input = __commonJS({
85559
85576
  return this;
85560
85577
  } else {
85561
85578
  if (this._isStreamInput()) {
85562
- return new Promise((resolve21, reject) => {
85579
+ return new Promise((resolve22, reject) => {
85563
85580
  const finished = () => {
85564
85581
  this._flattenBufferIn();
85565
85582
  sharp.metadata(this.options, (err, metadata2) => {
85566
85583
  if (err) {
85567
85584
  reject(is.nativeError(err, stack));
85568
85585
  } else {
85569
- resolve21(metadata2);
85586
+ resolve22(metadata2);
85570
85587
  }
85571
85588
  });
85572
85589
  };
@@ -85577,12 +85594,12 @@ var require_input = __commonJS({
85577
85594
  }
85578
85595
  });
85579
85596
  } else {
85580
- return new Promise((resolve21, reject) => {
85597
+ return new Promise((resolve22, reject) => {
85581
85598
  sharp.metadata(this.options, (err, metadata2) => {
85582
85599
  if (err) {
85583
85600
  reject(is.nativeError(err, stack));
85584
85601
  } else {
85585
- resolve21(metadata2);
85602
+ resolve22(metadata2);
85586
85603
  }
85587
85604
  });
85588
85605
  });
@@ -85615,25 +85632,25 @@ var require_input = __commonJS({
85615
85632
  return this;
85616
85633
  } else {
85617
85634
  if (this._isStreamInput()) {
85618
- return new Promise((resolve21, reject) => {
85635
+ return new Promise((resolve22, reject) => {
85619
85636
  this.on("finish", function() {
85620
85637
  this._flattenBufferIn();
85621
85638
  sharp.stats(this.options, (err, stats2) => {
85622
85639
  if (err) {
85623
85640
  reject(is.nativeError(err, stack));
85624
85641
  } else {
85625
- resolve21(stats2);
85642
+ resolve22(stats2);
85626
85643
  }
85627
85644
  });
85628
85645
  });
85629
85646
  });
85630
85647
  } else {
85631
- return new Promise((resolve21, reject) => {
85648
+ return new Promise((resolve22, reject) => {
85632
85649
  sharp.stats(this.options, (err, stats2) => {
85633
85650
  if (err) {
85634
85651
  reject(is.nativeError(err, stack));
85635
85652
  } else {
85636
- resolve21(stats2);
85653
+ resolve22(stats2);
85637
85654
  }
85638
85655
  });
85639
85656
  });
@@ -87625,15 +87642,15 @@ var require_color = __commonJS({
87625
87642
  };
87626
87643
  }
87627
87644
  function wrapConversion(toModel, graph) {
87628
- const path39 = [graph[toModel].parent, toModel];
87645
+ const path40 = [graph[toModel].parent, toModel];
87629
87646
  let fn = conversions_default[graph[toModel].parent][toModel];
87630
87647
  let cur = graph[toModel].parent;
87631
87648
  while (graph[cur].parent) {
87632
- path39.unshift(graph[cur].parent);
87649
+ path40.unshift(graph[cur].parent);
87633
87650
  fn = link(conversions_default[graph[cur].parent][cur], fn);
87634
87651
  cur = graph[cur].parent;
87635
87652
  }
87636
- fn.conversion = path39;
87653
+ fn.conversion = path40;
87637
87654
  return fn;
87638
87655
  }
87639
87656
  function route(fromModel) {
@@ -88250,7 +88267,7 @@ var require_channel = __commonJS({
88250
88267
  var require_output = __commonJS({
88251
88268
  "../../node_modules/sharp/lib/output.js"(exports2, module2) {
88252
88269
  "use strict";
88253
- var path39 = require("path");
88270
+ var path40 = require("path");
88254
88271
  var is = require_is();
88255
88272
  var sharp = require_sharp();
88256
88273
  var formats = /* @__PURE__ */ new Map([
@@ -88281,9 +88298,9 @@ var require_output = __commonJS({
88281
88298
  let err;
88282
88299
  if (!is.string(fileOut)) {
88283
88300
  err = new Error("Missing output file path");
88284
- } else if (is.string(this.options.input.file) && path39.resolve(this.options.input.file) === path39.resolve(fileOut)) {
88301
+ } else if (is.string(this.options.input.file) && path40.resolve(this.options.input.file) === path40.resolve(fileOut)) {
88285
88302
  err = new Error("Cannot use same file for input and output");
88286
- } else if (jp2Regex.test(path39.extname(fileOut)) && !this.constructor.format.jp2k.output.file) {
88303
+ } else if (jp2Regex.test(path40.extname(fileOut)) && !this.constructor.format.jp2k.output.file) {
88287
88304
  err = errJp2Save();
88288
88305
  }
88289
88306
  if (err) {
@@ -89055,7 +89072,7 @@ var require_output = __commonJS({
89055
89072
  return this;
89056
89073
  } else {
89057
89074
  if (this._isStreamInput()) {
89058
- return new Promise((resolve21, reject) => {
89075
+ return new Promise((resolve22, reject) => {
89059
89076
  this.once("finish", () => {
89060
89077
  this._flattenBufferIn();
89061
89078
  sharp.pipeline(this.options, (err, data, info) => {
@@ -89063,24 +89080,24 @@ var require_output = __commonJS({
89063
89080
  reject(is.nativeError(err, stack));
89064
89081
  } else {
89065
89082
  if (this.options.resolveWithObject) {
89066
- resolve21({ data, info });
89083
+ resolve22({ data, info });
89067
89084
  } else {
89068
- resolve21(data);
89085
+ resolve22(data);
89069
89086
  }
89070
89087
  }
89071
89088
  });
89072
89089
  });
89073
89090
  });
89074
89091
  } else {
89075
- return new Promise((resolve21, reject) => {
89092
+ return new Promise((resolve22, reject) => {
89076
89093
  sharp.pipeline(this.options, (err, data, info) => {
89077
89094
  if (err) {
89078
89095
  reject(is.nativeError(err, stack));
89079
89096
  } else {
89080
89097
  if (this.options.resolveWithObject) {
89081
- resolve21({ data, info });
89098
+ resolve22({ data, info });
89082
89099
  } else {
89083
- resolve21(data);
89100
+ resolve22(data);
89084
89101
  }
89085
89102
  }
89086
89103
  });
@@ -90010,15 +90027,38 @@ var init_daemon_mesh_manager = __esm({
90010
90027
  "src/daemon-mesh-manager.ts"() {
90011
90028
  "use strict";
90012
90029
  init_src();
90013
- DaemonMeshManager = class {
90030
+ DaemonMeshManager = class _DaemonMeshManager {
90014
90031
  rules = [];
90015
90032
  serverConn;
90016
90033
  constructor(serverConn) {
90017
90034
  this.serverConn = serverConn;
90018
90035
  }
90036
+ static COMMAND_ALLOWLIST = /* @__PURE__ */ new Set([
90037
+ "send_chat",
90038
+ "read_chat",
90039
+ "git_status",
90040
+ "git_diff_summary",
90041
+ "launch_cli"
90042
+ ]);
90019
90043
  setRules(rules) {
90020
- this.rules = rules;
90021
- LOG.info("Mesh", `[Mesh] ${rules.length} rule(s) loaded`);
90044
+ const valid = [];
90045
+ for (const rule of rules) {
90046
+ if (!rule.trigger || typeof rule.trigger !== "string") {
90047
+ LOG.warn("Mesh", `[Mesh] Skipping rule: missing or invalid 'trigger'`);
90048
+ continue;
90049
+ }
90050
+ if (!rule.targetDaemonId || typeof rule.targetDaemonId !== "string") {
90051
+ LOG.warn("Mesh", `[Mesh] Skipping rule trigger='${rule.trigger}': missing or invalid 'targetDaemonId'`);
90052
+ continue;
90053
+ }
90054
+ if (!_DaemonMeshManager.COMMAND_ALLOWLIST.has(rule.command)) {
90055
+ LOG.warn("Mesh", `[Mesh] Skipping rule trigger='${rule.trigger}': command '${rule.command}' not in allowlist`);
90056
+ continue;
90057
+ }
90058
+ valid.push(rule);
90059
+ }
90060
+ this.rules = valid;
90061
+ LOG.info("Mesh", `[Mesh] ${valid.length}/${rules.length} rule(s) loaded`);
90022
90062
  }
90023
90063
  async emit(event) {
90024
90064
  const matching = this.rules.filter((r) => r.trigger === event.trigger);
@@ -90289,7 +90329,7 @@ var init_adhdev_daemon = __esm({
90289
90329
  init_version();
90290
90330
  init_src();
90291
90331
  init_runtime_defaults();
90292
- pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.58" });
90332
+ pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.60" });
90293
90333
  AdhdevDaemon = class _AdhdevDaemon {
90294
90334
  localHttpServer = null;
90295
90335
  localWss = null;
@@ -91104,6 +91144,26 @@ ${err?.stack || ""}`);
91104
91144
  if (!result || result.success !== true) return false;
91105
91145
  return commandType === "launch_cli" || commandType === "launch_ide";
91106
91146
  }
91147
+ async buildMeshCheckpointContext(workspace, base) {
91148
+ if (!this.components) return base;
91149
+ try {
91150
+ const statusResult = await Promise.race([
91151
+ this.components.router.execute("git_status", { workspace }, "mesh"),
91152
+ new Promise((resolve22) => setTimeout(() => resolve22(null), 4e3))
91153
+ ]);
91154
+ const s = statusResult?.status ?? statusResult;
91155
+ if (s?.isGitRepo) {
91156
+ return {
91157
+ ...base,
91158
+ branch: s.branch ?? "",
91159
+ ahead: s.ahead ?? 0,
91160
+ behind: s.behind ?? 0
91161
+ };
91162
+ }
91163
+ } catch {
91164
+ }
91165
+ return base;
91166
+ }
91107
91167
  triggerImmediateLaunchStatusUpdate(reason) {
91108
91168
  this.statusReporter?.resetP2PHash();
91109
91169
  void this.statusReporter?.sendUnifiedStatusReport({ forceServer: true, reason });
@@ -91225,13 +91285,15 @@ ${err?.stack || ""}`);
91225
91285
  void this.flushP2PWorkspaceGitSubscriptions();
91226
91286
  }
91227
91287
  if (cmdType === "git_checkpoint" && routed.success && this.meshManager) {
91228
- void this.meshManager.emit({
91229
- trigger: "git_checkpoint_complete",
91230
- context: {
91231
- workspace: String(normalizedData.workspace ?? ""),
91232
- checkpoint_message: routed.checkpoint?.message ?? String(normalizedData.message ?? ""),
91233
- commit: routed.checkpoint?.commit ?? ""
91234
- }
91288
+ const workspace = String(normalizedData.workspace ?? "");
91289
+ const baseContext = {
91290
+ workspace,
91291
+ checkpoint_message: routed.checkpoint?.message ?? String(normalizedData.message ?? ""),
91292
+ commit: routed.checkpoint?.commit ?? "",
91293
+ source_session_id: String(normalizedData.targetSessionId ?? "")
91294
+ };
91295
+ void this.buildMeshCheckpointContext(workspace, baseContext).then((ctx) => {
91296
+ this.meshManager.emit({ trigger: "git_checkpoint_complete", context: ctx });
91235
91297
  });
91236
91298
  }
91237
91299
  return { ...routed, interactionId };
@@ -91270,7 +91332,7 @@ ${err?.stack || ""}`);
91270
91332
  this.localWss.emit("connection", ws, req);
91271
91333
  });
91272
91334
  });
91273
- await new Promise((resolve21, reject) => {
91335
+ await new Promise((resolve22, reject) => {
91274
91336
  const cleanup = () => {
91275
91337
  this.localHttpServer?.off("error", onError);
91276
91338
  this.localHttpServer?.off("listening", onListening);
@@ -91281,7 +91343,7 @@ ${err?.stack || ""}`);
91281
91343
  };
91282
91344
  const onListening = () => {
91283
91345
  cleanup();
91284
- resolve21();
91346
+ resolve22();
91285
91347
  };
91286
91348
  this.localHttpServer.once("error", onError);
91287
91349
  this.localHttpServer.once("listening", onListening);
@@ -91455,12 +91517,12 @@ ${err?.stack || ""}`);
91455
91517
  this.localClients.clear();
91456
91518
  this.localWss?.close();
91457
91519
  this.localWss = null;
91458
- await new Promise((resolve21) => {
91520
+ await new Promise((resolve22) => {
91459
91521
  if (!this.localHttpServer) {
91460
- resolve21();
91522
+ resolve22();
91461
91523
  return;
91462
91524
  }
91463
- this.localHttpServer.close(() => resolve21());
91525
+ this.localHttpServer.close(() => resolve22());
91464
91526
  this.localHttpServer = null;
91465
91527
  });
91466
91528
  } catch {
@@ -93660,8 +93722,8 @@ function registerSetupCommands(program2, getProviderLoader2) {
93660
93722
  });
93661
93723
  program2.command("uninstall").description("Completely wipe all setting, configuration, stop daemon and uninstall service").option("-f, --force", "Skip confirmation prompt").action(async (options) => {
93662
93724
  const inquirer2 = await Promise.resolve().then(() => (init_lib(), lib_exports));
93663
- const fs23 = await import("fs");
93664
- const path39 = await import("path");
93725
+ const fs24 = await import("fs");
93726
+ const path40 = await import("path");
93665
93727
  const os31 = await import("os");
93666
93728
  const { spawnSync: spawnSync3 } = await import("child_process");
93667
93729
  if (!options.force) {
@@ -93687,11 +93749,11 @@ function registerSetupCommands(program2, getProviderLoader2) {
93687
93749
  }
93688
93750
  console.log(source_default.gray(" Removing OS background service..."));
93689
93751
  spawnSync3(process.execPath, [process.argv[1], "service", "uninstall"], { stdio: "inherit" });
93690
- const adhdevDir = path39.join(os31.homedir(), ".adhdev");
93691
- if (fs23.existsSync(adhdevDir)) {
93752
+ const adhdevDir = path40.join(os31.homedir(), ".adhdev");
93753
+ if (fs24.existsSync(adhdevDir)) {
93692
93754
  console.log(source_default.gray(` Deleting ${adhdevDir}...`));
93693
93755
  try {
93694
- fs23.rmSync(adhdevDir, { recursive: true, force: true });
93756
+ fs24.rmSync(adhdevDir, { recursive: true, force: true });
93695
93757
  console.log(source_default.green(" \u2713 Data wiped."));
93696
93758
  } catch (e) {
93697
93759
  console.log(source_default.red(` \u2717 Failed to delete ~/.adhdev: ${e.message}`));
@@ -93945,14 +94007,14 @@ async function requestSessionHostDirect(request) {
93945
94007
  }
93946
94008
  async function runRuntimeLaunchSpec(spec) {
93947
94009
  const { spawn: spawn7 } = await import("child_process");
93948
- return await new Promise((resolve21, reject) => {
94010
+ return await new Promise((resolve22, reject) => {
93949
94011
  const child = spawn7(spec.command, spec.args, {
93950
94012
  stdio: "inherit",
93951
94013
  env: spec.env,
93952
94014
  shell: process.platform === "win32" && spec.command !== process.execPath
93953
94015
  });
93954
94016
  child.on("error", reject);
93955
- child.on("exit", (code) => resolve21(code ?? 0));
94017
+ child.on("exit", (code) => resolve22(code ?? 0));
93956
94018
  });
93957
94019
  }
93958
94020
  async function resolveRuntimeSessionId(target, options) {
@@ -94186,7 +94248,7 @@ async function handleTraceCommand(options) {
94186
94248
  }
94187
94249
  }
94188
94250
  while (!stopped) {
94189
- await new Promise((resolve21) => setTimeout(resolve21, intervalMs));
94251
+ await new Promise((resolve22) => setTimeout(resolve22, intervalMs));
94190
94252
  if (stopped) break;
94191
94253
  const nextTrace = await fetchTrace(buildDebugTraceFollowPollArgs(baseArgs, cursor));
94192
94254
  const nextBatch = collectFreshDebugTraceEntries(nextTrace, cursor);
@@ -95952,7 +96014,7 @@ function registerProviderCommands(program2) {
95952
96014
  } catch {
95953
96015
  try {
95954
96016
  const http3 = await import("http");
95955
- const result = await new Promise((resolve21, reject) => {
96017
+ const result = await new Promise((resolve22, reject) => {
95956
96018
  const req = http3.request({
95957
96019
  hostname: "127.0.0.1",
95958
96020
  port: DEV_SERVER_PORT3,
@@ -95964,9 +96026,9 @@ function registerProviderCommands(program2) {
95964
96026
  res.on("data", (c) => data += c);
95965
96027
  res.on("end", () => {
95966
96028
  try {
95967
- resolve21(JSON.parse(data));
96029
+ resolve22(JSON.parse(data));
95968
96030
  } catch {
95969
- resolve21({ raw: data });
96031
+ resolve22({ raw: data });
95970
96032
  }
95971
96033
  });
95972
96034
  });
@@ -96026,35 +96088,35 @@ function registerProviderCommands(program2) {
96026
96088
  let osPaths = {};
96027
96089
  let processNames = {};
96028
96090
  if (category === "ide") {
96029
- const fs23 = await import("fs");
96030
- const path39 = await import("path");
96091
+ const fs24 = await import("fs");
96092
+ const path40 = await import("path");
96031
96093
  const os31 = await import("os");
96032
96094
  if (os31.platform() === "darwin") {
96033
96095
  while (true) {
96034
96096
  const p = (await rl.question(`macOS Application Path (e.g. /Applications/${defaultName}.app): `)).trim() || `/Applications/${defaultName}.app`;
96035
96097
  if (p === "skip") break;
96036
- if (!fs23.existsSync(p)) {
96098
+ if (!fs24.existsSync(p)) {
96037
96099
  console.log(source_default.red(` \u2717 Path not found: ${p}`));
96038
96100
  console.log(source_default.gray(` (Please provide the exact absolute path to the .app or binary, or type 'skip')`));
96039
96101
  continue;
96040
96102
  }
96041
96103
  console.log(source_default.green(` \u2713 Path verified: ${p}`));
96042
96104
  osPaths["darwin"] = [p];
96043
- processNames["darwin"] = path39.basename(p, ".app");
96105
+ processNames["darwin"] = path40.basename(p, ".app");
96044
96106
  break;
96045
96107
  }
96046
96108
  } else if (os31.platform() === "win32") {
96047
96109
  while (true) {
96048
96110
  const p = (await rl.question(`Windows Executable Path (e.g. C:\\Program Files\\${defaultName}\\${defaultName}.exe): `)).trim();
96049
96111
  if (!p || p === "skip") break;
96050
- if (!fs23.existsSync(p)) {
96112
+ if (!fs24.existsSync(p)) {
96051
96113
  console.log(source_default.red(` \u2717 Path not found: ${p}`));
96052
96114
  console.log(source_default.gray(` (Please provide the exact absolute path, or type 'skip')`));
96053
96115
  continue;
96054
96116
  }
96055
96117
  console.log(source_default.green(` \u2713 Path verified: ${p}`));
96056
96118
  osPaths["win32"] = [p];
96057
- processNames["win32"] = path39.basename(p, ".exe");
96119
+ processNames["win32"] = path40.basename(p, ".exe");
96058
96120
  break;
96059
96121
  }
96060
96122
  }
@@ -96068,12 +96130,12 @@ function registerProviderCommands(program2) {
96068
96130
  console.log(source_default.yellow("Invalid port number."));
96069
96131
  continue;
96070
96132
  }
96071
- const isFree = await new Promise((resolve21) => {
96133
+ const isFree = await new Promise((resolve22) => {
96072
96134
  const server = net3.createServer();
96073
96135
  server.unref();
96074
- server.on("error", () => resolve21(false));
96136
+ server.on("error", () => resolve22(false));
96075
96137
  server.listen(port, "127.0.0.1", () => {
96076
- server.close(() => resolve21(true));
96138
+ server.close(() => resolve22(true));
96077
96139
  });
96078
96140
  });
96079
96141
  if (!isFree) {
@@ -96088,7 +96150,7 @@ function registerProviderCommands(program2) {
96088
96150
  rl.close();
96089
96151
  const location = options.builtin ? "builtin" : "user";
96090
96152
  const http3 = await import("http");
96091
- const result = await new Promise((resolve21, reject) => {
96153
+ const result = await new Promise((resolve22, reject) => {
96092
96154
  const postData = JSON.stringify({ type, name, category, location, cdpPorts, osPaths, processNames });
96093
96155
  const req = http3.request({
96094
96156
  hostname: "127.0.0.1",
@@ -96101,9 +96163,9 @@ function registerProviderCommands(program2) {
96101
96163
  res.on("data", (c) => data += c);
96102
96164
  res.on("end", () => {
96103
96165
  try {
96104
- resolve21(JSON.parse(data));
96166
+ resolve22(JSON.parse(data));
96105
96167
  } catch {
96106
- resolve21({ raw: data });
96168
+ resolve22({ raw: data });
96107
96169
  }
96108
96170
  });
96109
96171
  });
@@ -96302,7 +96364,7 @@ function registerProviderCommands(program2) {
96302
96364
  reference,
96303
96365
  ...verification ? { verification } : {}
96304
96366
  });
96305
- const startResult = await new Promise((resolve21, reject) => {
96367
+ const startResult = await new Promise((resolve22, reject) => {
96306
96368
  const req = http3.request({
96307
96369
  hostname: "127.0.0.1",
96308
96370
  port: DEV_SERVER_PORT3,
@@ -96314,9 +96376,9 @@ function registerProviderCommands(program2) {
96314
96376
  res.on("data", (c) => data += c);
96315
96377
  res.on("end", () => {
96316
96378
  try {
96317
- resolve21(JSON.parse(data));
96379
+ resolve22(JSON.parse(data));
96318
96380
  } catch {
96319
- resolve21({ raw: data });
96381
+ resolve22({ raw: data });
96320
96382
  }
96321
96383
  });
96322
96384
  });
@@ -96350,7 +96412,7 @@ function registerProviderCommands(program2) {
96350
96412
  fsMock.writeFileSync(logFile, `=== Auto-Impl Started ===
96351
96413
  `);
96352
96414
  console.log(source_default.gray(` Agent logs: ${logFile}`));
96353
- await new Promise((resolve21, reject) => {
96415
+ await new Promise((resolve22, reject) => {
96354
96416
  http3.get(`http://127.0.0.1:${DEV_SERVER_PORT3}${startResult.sseUrl}`, (res) => {
96355
96417
  let buffer = "";
96356
96418
  res.on("data", (chunk) => {
@@ -96387,7 +96449,7 @@ function registerProviderCommands(program2) {
96387
96449
  if (currentData.success === false) {
96388
96450
  reject(new Error(`Agent failed to implement scripts properly (exit: ${currentData.exitCode})`));
96389
96451
  } else {
96390
- resolve21();
96452
+ resolve22();
96391
96453
  }
96392
96454
  } else if (currentEvent === "error") {
96393
96455
  fsMock.appendFileSync(logFile, `
@@ -96398,7 +96460,7 @@ function registerProviderCommands(program2) {
96398
96460
  }
96399
96461
  }
96400
96462
  });
96401
- res.on("end", resolve21);
96463
+ res.on("end", resolve22);
96402
96464
  }).on("error", reject);
96403
96465
  });
96404
96466
  console.log(source_default.green(`
@@ -96457,7 +96519,7 @@ function registerProviderCommands(program2) {
96457
96519
  ideType: type,
96458
96520
  params: options.param ? { text: options.param, sessionId: options.param, buttonText: options.param } : {}
96459
96521
  });
96460
- const result = await new Promise((resolve21, reject) => {
96522
+ const result = await new Promise((resolve22, reject) => {
96461
96523
  const req = http3.request({
96462
96524
  hostname: "127.0.0.1",
96463
96525
  port: DEV_SERVER_PORT3,
@@ -96469,9 +96531,9 @@ function registerProviderCommands(program2) {
96469
96531
  res.on("data", (c) => data += c);
96470
96532
  res.on("end", () => {
96471
96533
  try {
96472
- resolve21(JSON.parse(data));
96534
+ resolve22(JSON.parse(data));
96473
96535
  } catch {
96474
- resolve21({ raw: data });
96536
+ resolve22({ raw: data });
96475
96537
  }
96476
96538
  });
96477
96539
  });
@@ -96507,15 +96569,15 @@ function registerProviderCommands(program2) {
96507
96569
  provider.command("source <type>").description("View source code of a provider").action(async (type) => {
96508
96570
  try {
96509
96571
  const http3 = await import("http");
96510
- const result = await new Promise((resolve21, reject) => {
96572
+ const result = await new Promise((resolve22, reject) => {
96511
96573
  http3.get(`http://127.0.0.1:${DEV_SERVER_PORT3}/api/providers/${type}/source`, (res) => {
96512
96574
  let data = "";
96513
96575
  res.on("data", (c) => data += c);
96514
96576
  res.on("end", () => {
96515
96577
  try {
96516
- resolve21(JSON.parse(data));
96578
+ resolve22(JSON.parse(data));
96517
96579
  } catch {
96518
- resolve21({ raw: data });
96580
+ resolve22({ raw: data });
96519
96581
  }
96520
96582
  });
96521
96583
  }).on("error", () => {
@@ -96563,7 +96625,7 @@ function registerProviderCommands(program2) {
96563
96625
  try {
96564
96626
  const http3 = await import("http");
96565
96627
  const postData = JSON.stringify({ script: "readChat", params: {} });
96566
- const result = await new Promise((resolve21, reject) => {
96628
+ const result = await new Promise((resolve22, reject) => {
96567
96629
  const req = http3.request({
96568
96630
  hostname: "127.0.0.1",
96569
96631
  port: DEV_SERVER_PORT3,
@@ -96575,9 +96637,9 @@ function registerProviderCommands(program2) {
96575
96637
  res2.on("data", (c) => data += c);
96576
96638
  res2.on("end", () => {
96577
96639
  try {
96578
- resolve21(JSON.parse(data));
96640
+ resolve22(JSON.parse(data));
96579
96641
  } catch {
96580
- resolve21({ raw: data });
96642
+ resolve22({ raw: data });
96581
96643
  }
96582
96644
  });
96583
96645
  });
@@ -96741,8 +96803,8 @@ function registerCdpCommands(program2) {
96741
96803
  }
96742
96804
  const output = typeof result === "string" ? result : JSON.stringify(result, null, 2);
96743
96805
  if (options.output) {
96744
- const fs23 = await import("fs");
96745
- fs23.writeFileSync(options.output, output, "utf-8");
96806
+ const fs24 = await import("fs");
96807
+ fs24.writeFileSync(options.output, output, "utf-8");
96746
96808
  console.log(source_default.green(`
96747
96809
  \u2713 Saved to ${options.output} (${output.length} chars)
96748
96810
  `));
@@ -96818,13 +96880,13 @@ function registerCdpCommands(program2) {
96818
96880
  cdp.command("screenshot").description("Capture IDE screenshot").option("-p, --port <port>", "CDP port", "9222").option("-o, --output <file>", "Output file path", "/tmp/cdp_screenshot.jpg").action(async (options) => {
96819
96881
  try {
96820
96882
  const http3 = await import("http");
96821
- const targets = await new Promise((resolve21, reject) => {
96883
+ const targets = await new Promise((resolve22, reject) => {
96822
96884
  http3.get(`http://127.0.0.1:${options.port}/json`, (res) => {
96823
96885
  let data = "";
96824
96886
  res.on("data", (c) => data += c);
96825
96887
  res.on("end", () => {
96826
96888
  try {
96827
- resolve21(JSON.parse(data));
96889
+ resolve22(JSON.parse(data));
96828
96890
  } catch {
96829
96891
  reject(new Error("Invalid JSON"));
96830
96892
  }
@@ -96838,20 +96900,20 @@ function registerCdpCommands(program2) {
96838
96900
  if (!target?.webSocketDebuggerUrl) throw new Error("No CDP target");
96839
96901
  const WebSocket4 = (await import("ws")).default;
96840
96902
  const ws = new WebSocket4(target.webSocketDebuggerUrl);
96841
- await new Promise((resolve21, reject) => {
96903
+ await new Promise((resolve22, reject) => {
96842
96904
  ws.on("open", () => {
96843
96905
  ws.send(JSON.stringify({ id: 1, method: "Page.captureScreenshot", params: { format: "jpeg", quality: 50 } }));
96844
96906
  });
96845
96907
  ws.on("message", async (data) => {
96846
96908
  const msg = JSON.parse(data.toString());
96847
96909
  if (msg.id === 1 && msg.result?.data) {
96848
- const fs23 = await import("fs");
96849
- fs23.writeFileSync(options.output, Buffer.from(msg.result.data, "base64"));
96910
+ const fs24 = await import("fs");
96911
+ fs24.writeFileSync(options.output, Buffer.from(msg.result.data, "base64"));
96850
96912
  console.log(source_default.green(`
96851
96913
  \u2713 Screenshot saved to ${options.output}
96852
96914
  `));
96853
96915
  ws.close();
96854
- resolve21();
96916
+ resolve22();
96855
96917
  }
96856
96918
  });
96857
96919
  ws.on("error", (e) => reject(e));
@@ -96867,7 +96929,9 @@ function registerCdpCommands(program2) {
96867
96929
 
96868
96930
  // src/cli/mcp-commands.ts
96869
96931
  var import_node_child_process3 = require("child_process");
96932
+ var fs23 = __toESM(require("fs"));
96870
96933
  var import_node_module3 = require("module");
96934
+ var path39 = __toESM(require("path"));
96871
96935
  init_source();
96872
96936
  function registerMcpCommands(program2) {
96873
96937
  program2.command("mcp").description("Start an MCP server to expose IDE agents as tools (for Claude Desktop, etc.)").option("--api-key <key>", "ADHDev cloud API key (switches to cloud mode)").option("--port <n>", "Standalone daemon port (default: 3847)", "3847").option("--password <pass>", "Standalone daemon password (if set)").option("--base-url <url>", "Override cloud API base URL").addHelpText("after", `
@@ -96885,8 +96949,8 @@ Claude Desktop config (~/.claude_desktop_config.json):
96885
96949
  }
96886
96950
  }
96887
96951
 
96888
- Tools available (local): list_sessions, read_chat, send_chat, approve, screenshot, git_status
96889
- Tools available (cloud): list_sessions, read_chat, send_chat, approve
96952
+ Tools available (local): list_sessions, launch_session, check_pending, read_chat, send_chat, approve, git_status, screenshot
96953
+ Tools available (cloud): list_sessions, launch_session, check_pending, read_chat, send_chat, approve, git_status
96890
96954
  `).action(async (opts) => {
96891
96955
  const mcpBin = resolveMcpBin();
96892
96956
  if (!mcpBin) {
@@ -96915,6 +96979,15 @@ Tools available (cloud): list_sessions, read_chat, send_chat, approve
96915
96979
  });
96916
96980
  }
96917
96981
  function resolveMcpBin() {
96982
+ const packagedCandidates = [
96983
+ path39.resolve(__dirname, "../vendor/mcp-server/index.js"),
96984
+ path39.resolve(__dirname, "../../vendor/mcp-server/index.js")
96985
+ ];
96986
+ for (const candidate of packagedCandidates) {
96987
+ if (fs23.existsSync(candidate)) {
96988
+ return candidate;
96989
+ }
96990
+ }
96918
96991
  try {
96919
96992
  const req = (0, import_node_module3.createRequire)(__filename);
96920
96993
  return req.resolve("@adhdev/mcp-server");