adhdev 0.9.75 → 0.9.76-rc.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -2387,7 +2387,7 @@ function buildNodeConfigSection(mesh) {
2387
2387
  for (const n of mesh.nodes) {
2388
2388
  const labels = [];
2389
2389
  if (n.isLocalWorktree) labels.push("worktree");
2390
- if (n.policy.readOnly) labels.push("read-only");
2390
+ if (n.policy?.readOnly) labels.push("read-only");
2391
2391
  const suffix = labels.length ? ` [${labels.join(", ")}]` : "";
2392
2392
  lines.push(`- **${n.workspace}** (${n.id})${suffix}`);
2393
2393
  }
@@ -2433,18 +2433,20 @@ var init_coordinator_prompt = __esm({
2433
2433
  3. **Delegate** \u2014 For each task:
2434
2434
  a. Pick the best node (consider: health, dirty state, current workload).
2435
2435
  b. If no session exists, call \`mesh_launch_session\` to start one.
2436
- c. Call \`mesh_send_task\` with a clear, self-contained natural-language instruction.
2436
+ c. Call \`mesh_send_task\` with a **complete, self-contained** instruction that includes all context the agent needs (file paths, line numbers, what to change, why). Do not send partial instructions expecting future follow-up.
2437
2437
  4. **Monitor** \u2014 Periodically call \`mesh_read_chat\` to check progress. Handle approvals via \`mesh_approve\`.
2438
2438
  5. **Verify** \u2014 When a task reports completion, call \`mesh_git_status\` to verify changes were made.
2439
2439
  6. **Checkpoint** \u2014 Call \`mesh_checkpoint\` to save the work.
2440
2440
  7. **Report** \u2014 Summarize what was done, what changed, and any issues.`;
2441
2441
  RULES_SECTION = `## Rules
2442
2442
 
2443
- - **Be conversational.** Delegate work the way a tech lead would \u2014 clear, specific instructions in natural language.
2444
- - **Don't inspect code.** Trust the agent's output. Verify via git diff/status, not by reading source files.
2443
+ - **Minimize coordinator context.** The coordinator's job is routing, not implementing. Do not read source files, run commands, or analyze code directly \u2014 delegate all of that to node agents. Your context should stay lean.
2444
+ - **Delegate analysis too.** If you need to understand a bug or explore the codebase, send that investigation as a task to a node. Do not do it yourself.
2445
+ - **Front-load the task message.** When calling \`mesh_send_task\`, include everything the agent needs: what files to touch, what the problem is, what the fix should look like. The agent won't ask follow-up questions.
2446
+ - **Don't inspect code.** Trust the agent's output. Verify via \`mesh_git_status\`, not by reading source files.
2445
2447
  - **Don't over-parallelize.** Start with 1-2 concurrent tasks. Scale up if they succeed.
2446
2448
  - **Handle failures gracefully.** If a task fails, read the chat to understand why, then retry or reassign.
2447
- - **Keep the user informed.** Report progress after each delegation round.
2449
+ - **Keep the user informed.** Report progress after each delegation round \u2014 one or two sentences, not a narration.
2448
2450
  - **Respect node capabilities.** Don't send build tasks to read-only nodes. Don't push from nodes that aren't allowed to.
2449
2451
  - **Never fabricate tool results.** Always call the actual tool; never pretend you did.`;
2450
2452
  }
@@ -8395,6 +8397,14 @@ function getActiveChatOptions(profile) {
8395
8397
  if (profile === "full") return {};
8396
8398
  return LIVE_STATUS_ACTIVE_CHAT_OPTIONS;
8397
8399
  }
8400
+ function resolveSessionStatus(activeChat, providerStatus) {
8401
+ const chatStatus = normalizeManagedStatus(activeChat?.status, { activeModal: activeChat?.activeModal || null });
8402
+ const topLevelStatus = normalizeManagedStatus(providerStatus, { activeModal: activeChat?.activeModal || null });
8403
+ if (chatStatus === "waiting_approval" || topLevelStatus === "waiting_approval") return "waiting_approval";
8404
+ if (chatStatus === "generating" || topLevelStatus === "generating") return "generating";
8405
+ if (topLevelStatus !== "idle") return topLevelStatus;
8406
+ return chatStatus;
8407
+ }
8398
8408
  function shouldIncludeSessionControls(profile) {
8399
8409
  return profile !== "live";
8400
8410
  }
@@ -8450,9 +8460,7 @@ function buildIdeWorkspaceSession(state, cdpManagers, options) {
8450
8460
  providerName: state.name,
8451
8461
  kind: "workspace",
8452
8462
  transport: "cdp-page",
8453
- status: normalizeManagedStatus(activeChat?.status || state.status, {
8454
- activeModal: activeChat?.activeModal || null
8455
- }),
8463
+ status: resolveSessionStatus(activeChat, state.status),
8456
8464
  title,
8457
8465
  workspace,
8458
8466
  ...git && { git },
@@ -8487,9 +8495,7 @@ function buildExtensionAgentSession(parent, ext, options) {
8487
8495
  providerSessionId: ext.providerSessionId,
8488
8496
  kind: "agent",
8489
8497
  transport: "cdp-webview",
8490
- status: normalizeManagedStatus(activeChat?.status || ext.status, {
8491
- activeModal: activeChat?.activeModal || null
8492
- }),
8498
+ status: resolveSessionStatus(activeChat, ext.status),
8493
8499
  title: activeChat?.title || ext.name,
8494
8500
  workspace,
8495
8501
  ...git && { git },
@@ -8539,9 +8545,7 @@ function buildCliSession(state, options) {
8539
8545
  providerSessionId: state.providerSessionId,
8540
8546
  kind: "agent",
8541
8547
  transport: "pty",
8542
- status: normalizeManagedStatus(activeChat?.status || state.status, {
8543
- activeModal: activeChat?.activeModal || null
8544
- }),
8548
+ status: resolveSessionStatus(activeChat, state.status),
8545
8549
  title: activeChat?.title || state.name,
8546
8550
  workspace,
8547
8551
  ...git && { git },
@@ -8589,9 +8593,7 @@ function buildAcpSession(state, options) {
8589
8593
  providerName: state.name,
8590
8594
  kind: "agent",
8591
8595
  transport: "acp",
8592
- status: normalizeManagedStatus(activeChat?.status || state.status, {
8593
- activeModal: activeChat?.activeModal || null
8594
- }),
8596
+ status: resolveSessionStatus(activeChat, state.status),
8595
8597
  title: activeChat?.title || state.name,
8596
8598
  workspace,
8597
8599
  ...git && { git },
@@ -13676,6 +13678,11 @@ var init_provider_cli_adapter = __esm({
13676
13678
  const currentSnapshot = normalizeScreenSnapshot(screenText);
13677
13679
  const lastSnapshot = this.lastScreenSnapshot;
13678
13680
  if (!lastSnapshot || lastSnapshot === currentSnapshot) return screenText;
13681
+ const activeScreenPattern = /\besc to (?:interrupt|stop)\b|Enter to interrupt, Ctrl\+C to cancel|Enter to confirm\s*[·•-]\s*Esc to cancel|\b(?:MCP servers?|tool calls?)\b[^\n\r]{0,160}\brequire approval\b/i;
13682
+ const staleSnapshotLooksActive = activeScreenPattern.test(lastSnapshot);
13683
+ const currentScreenLooksIdle = /(?:^|\n|\r)\s*[❯›>]\s*(?:Try\s+["“][^\n\r"”]+["”])?\s*(?:\n|\r|$)/.test(screenText) && !activeScreenPattern.test(screenText);
13684
+ if (staleSnapshotLooksActive && currentScreenLooksIdle) return screenText;
13685
+ if (currentSnapshot.length >= lastSnapshot.length) return screenText;
13679
13686
  return `${screenText}
13680
13687
  ${lastSnapshot}`;
13681
13688
  }
@@ -34821,7 +34828,7 @@ Run 'adhdev doctor' for detailed diagnostics.`
34821
34828
  }
34822
34829
  });
34823
34830
 
34824
- // ../../oss/packages/daemon-core/node_modules/readdirp/index.js
34831
+ // ../../oss/node_modules/readdirp/esm/index.js
34825
34832
  function readdirp(root, options = {}) {
34826
34833
  let type = options.entryType || options.type;
34827
34834
  if (type === "both")
@@ -34838,13 +34845,13 @@ function readdirp(root, options = {}) {
34838
34845
  options.root = root;
34839
34846
  return new ReaddirpStream(options);
34840
34847
  }
34841
- var import_promises3, import_node_path, import_node_stream, EntryTypes, defaultOptions, RECURSIVE_ERROR_CODE, NORMAL_FLOW_ERRORS, ALL_TYPES, DIR_TYPES, FILE_TYPES, isNormalFlowError, wantBigintFsStats, emptyFn, normalizeFilter, ReaddirpStream;
34842
- var init_readdirp = __esm({
34843
- "../../oss/packages/daemon-core/node_modules/readdirp/index.js"() {
34848
+ var import_promises3, import_node_stream, import_node_path, EntryTypes, defaultOptions, RECURSIVE_ERROR_CODE, NORMAL_FLOW_ERRORS, ALL_TYPES, DIR_TYPES, FILE_TYPES, isNormalFlowError, wantBigintFsStats, emptyFn, normalizeFilter, ReaddirpStream;
34849
+ var init_esm = __esm({
34850
+ "../../oss/node_modules/readdirp/esm/index.js"() {
34844
34851
  "use strict";
34845
34852
  import_promises3 = require("fs/promises");
34846
- import_node_path = require("path");
34847
34853
  import_node_stream = require("stream");
34854
+ import_node_path = require("path");
34848
34855
  EntryTypes = {
34849
34856
  FILE_TYPE: "files",
34850
34857
  DIR_TYPE: "directories",
@@ -34899,20 +34906,6 @@ var init_readdirp = __esm({
34899
34906
  return emptyFn;
34900
34907
  };
34901
34908
  ReaddirpStream = class extends import_node_stream.Readable {
34902
- parents;
34903
- reading;
34904
- parent;
34905
- _stat;
34906
- _maxDepth;
34907
- _wantsDir;
34908
- _wantsFile;
34909
- _wantsEverything;
34910
- _root;
34911
- _isDirent;
34912
- _statsProp;
34913
- _rdOptions;
34914
- _fileFilter;
34915
- _directoryFilter;
34916
34909
  constructor(options = {}) {
34917
34910
  super({
34918
34911
  objectMode: true,
@@ -34929,7 +34922,7 @@ var init_readdirp = __esm({
34929
34922
  } else {
34930
34923
  this._stat = statMethod;
34931
34924
  }
34932
- this._maxDepth = opts.depth != null && Number.isSafeInteger(opts.depth) ? opts.depth : defaultOptions.depth;
34925
+ this._maxDepth = opts.depth ?? defaultOptions.depth;
34933
34926
  this._wantsDir = type ? DIR_TYPES.has(type) : false;
34934
34927
  this._wantsFile = type ? FILE_TYPES.has(type) : false;
34935
34928
  this._wantsEverything = type === EntryTypes.EVERYTHING_TYPE;
@@ -35060,17 +35053,17 @@ var init_readdirp = __esm({
35060
35053
  }
35061
35054
  });
35062
35055
 
35063
- // ../../oss/packages/daemon-core/node_modules/chokidar/handler.js
35056
+ // ../../oss/node_modules/chokidar/esm/handler.js
35064
35057
  function createFsWatchInstance(path33, options, listener, errHandler, emitRaw) {
35065
35058
  const handleEvent = (rawEvent, evPath) => {
35066
35059
  listener(path33);
35067
35060
  emitRaw(rawEvent, evPath, { watchedPath: path33 });
35068
35061
  if (evPath && path33 !== evPath) {
35069
- fsWatchBroadcast(sp.resolve(path33, evPath), KEY_LISTENERS, sp.join(path33, evPath));
35062
+ fsWatchBroadcast(sysPath.resolve(path33, evPath), KEY_LISTENERS, sysPath.join(path33, evPath));
35070
35063
  }
35071
35064
  };
35072
35065
  try {
35073
- return (0, import_node_fs2.watch)(path33, {
35066
+ return (0, import_fs7.watch)(path33, {
35074
35067
  persistent: options.persistent
35075
35068
  }, handleEvent);
35076
35069
  } catch (error48) {
@@ -35078,14 +35071,14 @@ function createFsWatchInstance(path33, options, listener, errHandler, emitRaw) {
35078
35071
  return void 0;
35079
35072
  }
35080
35073
  }
35081
- var import_node_fs2, import_promises4, import_node_os2, sp, STR_DATA, STR_END, STR_CLOSE, EMPTY_FN, pl, isWindows, isMacos, isLinux, isFreeBSD, isIBMi, EVENTS, EV, THROTTLE_MODE_WATCH, statMethods, KEY_LISTENERS, KEY_ERR, KEY_RAW, HANDLER_KEYS, binaryExtensions, isBinaryPath, foreach, addAndConvert, clearItem, delFromSet, isEmptySet, FsWatchInstances, fsWatchBroadcast, setFsWatchListener, FsWatchFileInstances, setFsWatchFileListener, NodeFsHandler;
35074
+ var import_fs7, import_promises4, sysPath, import_os3, STR_DATA, STR_END, STR_CLOSE, EMPTY_FN, pl, isWindows, isMacos, isLinux, isFreeBSD, isIBMi, EVENTS, EV, THROTTLE_MODE_WATCH, statMethods, KEY_LISTENERS, KEY_ERR, KEY_RAW, HANDLER_KEYS, binaryExtensions, isBinaryPath, foreach, addAndConvert, clearItem, delFromSet, isEmptySet, FsWatchInstances, fsWatchBroadcast, setFsWatchListener, FsWatchFileInstances, setFsWatchFileListener, NodeFsHandler;
35082
35075
  var init_handler2 = __esm({
35083
- "../../oss/packages/daemon-core/node_modules/chokidar/handler.js"() {
35076
+ "../../oss/node_modules/chokidar/esm/handler.js"() {
35084
35077
  "use strict";
35085
- import_node_fs2 = require("fs");
35078
+ import_fs7 = require("fs");
35086
35079
  import_promises4 = require("fs/promises");
35087
- import_node_os2 = require("os");
35088
- sp = __toESM(require("path"), 1);
35080
+ sysPath = __toESM(require("path"), 1);
35081
+ import_os3 = require("os");
35089
35082
  STR_DATA = "data";
35090
35083
  STR_END = "end";
35091
35084
  STR_CLOSE = "close";
@@ -35096,7 +35089,7 @@ var init_handler2 = __esm({
35096
35089
  isMacos = pl === "darwin";
35097
35090
  isLinux = pl === "linux";
35098
35091
  isFreeBSD = pl === "freebsd";
35099
- isIBMi = (0, import_node_os2.type)() === "OS400";
35092
+ isIBMi = (0, import_os3.type)() === "OS400";
35100
35093
  EVENTS = {
35101
35094
  ALL: "all",
35102
35095
  READY: "ready",
@@ -35378,7 +35371,7 @@ var init_handler2 = __esm({
35378
35371
  "zip",
35379
35372
  "zipx"
35380
35373
  ]);
35381
- isBinaryPath = (filePath) => binaryExtensions.has(sp.extname(filePath).slice(1).toLowerCase());
35374
+ isBinaryPath = (filePath) => binaryExtensions.has(sysPath.extname(filePath).slice(1).toLowerCase());
35382
35375
  foreach = (val, fn) => {
35383
35376
  if (val instanceof Set) {
35384
35377
  val.forEach(fn);
@@ -35486,7 +35479,7 @@ var init_handler2 = __esm({
35486
35479
  let cont = FsWatchFileInstances.get(fullPath);
35487
35480
  const copts = cont && cont.options;
35488
35481
  if (copts && (copts.persistent < options.persistent || copts.interval > options.interval)) {
35489
- (0, import_node_fs2.unwatchFile)(fullPath);
35482
+ (0, import_fs7.unwatchFile)(fullPath);
35490
35483
  cont = void 0;
35491
35484
  }
35492
35485
  if (cont) {
@@ -35497,7 +35490,7 @@ var init_handler2 = __esm({
35497
35490
  listeners: listener,
35498
35491
  rawEmitters: rawEmitter,
35499
35492
  options,
35500
- watcher: (0, import_node_fs2.watchFile)(fullPath, options, (curr, prev) => {
35493
+ watcher: (0, import_fs7.watchFile)(fullPath, options, (curr, prev) => {
35501
35494
  foreach(cont.rawEmitters, (rawEmitter2) => {
35502
35495
  rawEmitter2(EV.CHANGE, fullPath, { curr, prev });
35503
35496
  });
@@ -35514,15 +35507,13 @@ var init_handler2 = __esm({
35514
35507
  delFromSet(cont, KEY_RAW, rawEmitter);
35515
35508
  if (isEmptySet(cont.listeners)) {
35516
35509
  FsWatchFileInstances.delete(fullPath);
35517
- (0, import_node_fs2.unwatchFile)(fullPath);
35510
+ (0, import_fs7.unwatchFile)(fullPath);
35518
35511
  cont.options = cont.watcher = void 0;
35519
35512
  Object.freeze(cont);
35520
35513
  }
35521
35514
  };
35522
35515
  };
35523
35516
  NodeFsHandler = class {
35524
- fsw;
35525
- _boundHandleError;
35526
35517
  constructor(fsW) {
35527
35518
  this.fsw = fsW;
35528
35519
  this._boundHandleError = (error48) => fsW._handleError(error48);
@@ -35535,11 +35526,11 @@ var init_handler2 = __esm({
35535
35526
  */
35536
35527
  _watchWithNodeFs(path33, listener) {
35537
35528
  const opts = this.fsw.options;
35538
- const directory = sp.dirname(path33);
35539
- const basename9 = sp.basename(path33);
35529
+ const directory = sysPath.dirname(path33);
35530
+ const basename9 = sysPath.basename(path33);
35540
35531
  const parent = this.fsw._getWatchedDir(directory);
35541
35532
  parent.add(basename9);
35542
- const absolutePath = sp.resolve(path33);
35533
+ const absolutePath = sysPath.resolve(path33);
35543
35534
  const options = {
35544
35535
  persistent: opts.persistent
35545
35536
  };
@@ -35570,8 +35561,8 @@ var init_handler2 = __esm({
35570
35561
  if (this.fsw.closed) {
35571
35562
  return;
35572
35563
  }
35573
- const dirname11 = sp.dirname(file2);
35574
- const basename9 = sp.basename(file2);
35564
+ const dirname11 = sysPath.dirname(file2);
35565
+ const basename9 = sysPath.basename(file2);
35575
35566
  const parent = this.fsw._getWatchedDir(dirname11);
35576
35567
  let prevStats = stats;
35577
35568
  if (parent.has(basename9))
@@ -35662,9 +35653,8 @@ var init_handler2 = __esm({
35662
35653
  this.fsw._symlinkPaths.set(full, true);
35663
35654
  }
35664
35655
  _handleRead(directory, initialAdd, wh, target, dir, depth, throttler) {
35665
- directory = sp.join(directory, "");
35666
- const throttleKey = target ? `${directory}:${target}` : directory;
35667
- throttler = this.fsw._throttle("readdir", throttleKey, 1e3);
35656
+ directory = sysPath.join(directory, "");
35657
+ throttler = this.fsw._throttle("readdir", directory, 1e3);
35668
35658
  if (!throttler)
35669
35659
  return;
35670
35660
  const previous = this.fsw._getWatchedDir(wh.path);
@@ -35681,7 +35671,7 @@ var init_handler2 = __esm({
35681
35671
  return;
35682
35672
  }
35683
35673
  const item = entry.path;
35684
- let path33 = sp.join(directory, item);
35674
+ let path33 = sysPath.join(directory, item);
35685
35675
  current.add(item);
35686
35676
  if (entry.stats.isSymbolicLink() && await this._handleSymlink(entry, directory, path33, item)) {
35687
35677
  return;
@@ -35692,7 +35682,7 @@ var init_handler2 = __esm({
35692
35682
  }
35693
35683
  if (item === target || !target && !previous.has(item)) {
35694
35684
  this.fsw._incrReadyCount();
35695
- path33 = sp.join(dir, sp.relative(dir, path33));
35685
+ path33 = sysPath.join(dir, sysPath.relative(dir, path33));
35696
35686
  this._addToNodeFs(path33, initialAdd, wh, depth + 1);
35697
35687
  }
35698
35688
  }).on(EV.ERROR, this._boundHandleError);
@@ -35729,12 +35719,12 @@ var init_handler2 = __esm({
35729
35719
  * @returns closer for the watcher instance.
35730
35720
  */
35731
35721
  async _handleDir(dir, stats, initialAdd, depth, target, wh, realpath4) {
35732
- const parentDir = this.fsw._getWatchedDir(sp.dirname(dir));
35733
- const tracked = parentDir.has(sp.basename(dir));
35722
+ const parentDir = this.fsw._getWatchedDir(sysPath.dirname(dir));
35723
+ const tracked = parentDir.has(sysPath.basename(dir));
35734
35724
  if (!(initialAdd && this.fsw.options.ignoreInitial) && !target && !tracked) {
35735
35725
  this.fsw._emit(EV.ADD_DIR, dir, stats);
35736
35726
  }
35737
- parentDir.add(sp.basename(dir));
35727
+ parentDir.add(sysPath.basename(dir));
35738
35728
  this.fsw._getWatchedDir(dir);
35739
35729
  let throttler;
35740
35730
  let closer;
@@ -35784,7 +35774,7 @@ var init_handler2 = __esm({
35784
35774
  const follow = this.fsw.options.followSymlinks;
35785
35775
  let closer;
35786
35776
  if (stats.isDirectory()) {
35787
- const absPath = sp.resolve(path33);
35777
+ const absPath = sysPath.resolve(path33);
35788
35778
  const targetPath = follow ? await (0, import_promises4.realpath)(path33) : path33;
35789
35779
  if (this.fsw.closed)
35790
35780
  return;
@@ -35798,14 +35788,14 @@ var init_handler2 = __esm({
35798
35788
  const targetPath = follow ? await (0, import_promises4.realpath)(path33) : path33;
35799
35789
  if (this.fsw.closed)
35800
35790
  return;
35801
- const parent = sp.dirname(wh.watchPath);
35791
+ const parent = sysPath.dirname(wh.watchPath);
35802
35792
  this.fsw._getWatchedDir(parent).add(wh.watchPath);
35803
35793
  this.fsw._emit(EV.ADD, wh.watchPath, stats);
35804
35794
  closer = await this._handleDir(parent, stats, initialAdd, depth, path33, wh, targetPath);
35805
35795
  if (this.fsw.closed)
35806
35796
  return;
35807
35797
  if (targetPath !== void 0) {
35808
- this.fsw._symlinkPaths.set(sp.resolve(path33), targetPath);
35798
+ this.fsw._symlinkPaths.set(sysPath.resolve(path33), targetPath);
35809
35799
  }
35810
35800
  } else {
35811
35801
  closer = this._handleFile(wh.watchPath, stats, initialAdd);
@@ -35825,7 +35815,7 @@ var init_handler2 = __esm({
35825
35815
  }
35826
35816
  });
35827
35817
 
35828
- // ../../oss/packages/daemon-core/node_modules/chokidar/index.js
35818
+ // ../../oss/node_modules/chokidar/esm/index.js
35829
35819
  function arrify(item) {
35830
35820
  return Array.isArray(item) ? item : [item];
35831
35821
  }
@@ -35841,11 +35831,11 @@ function createPattern(matcher) {
35841
35831
  if (matcher.path === string4)
35842
35832
  return true;
35843
35833
  if (matcher.recursive) {
35844
- const relative5 = sp2.relative(matcher.path, string4);
35834
+ const relative5 = sysPath2.relative(matcher.path, string4);
35845
35835
  if (!relative5) {
35846
35836
  return false;
35847
35837
  }
35848
- return !relative5.startsWith("..") && !sp2.isAbsolute(relative5);
35838
+ return !relative5.startsWith("..") && !sysPath2.isAbsolute(relative5);
35849
35839
  }
35850
35840
  return false;
35851
35841
  };
@@ -35855,12 +35845,14 @@ function createPattern(matcher) {
35855
35845
  function normalizePath(path33) {
35856
35846
  if (typeof path33 !== "string")
35857
35847
  throw new Error("string expected");
35858
- path33 = sp2.normalize(path33);
35848
+ path33 = sysPath2.normalize(path33);
35859
35849
  path33 = path33.replace(/\\/g, "/");
35860
35850
  let prepend = false;
35861
35851
  if (path33.startsWith("//"))
35862
35852
  prepend = true;
35863
- path33 = path33.replace(DOUBLE_SLASH_RE, "/");
35853
+ const DOUBLE_SLASH_RE2 = /\/\//;
35854
+ while (path33.match(DOUBLE_SLASH_RE2))
35855
+ path33 = path33.replace(DOUBLE_SLASH_RE2, "/");
35864
35856
  if (prepend)
35865
35857
  path33 = "/" + path33;
35866
35858
  return path33;
@@ -35893,15 +35885,15 @@ function watch(paths, options = {}) {
35893
35885
  watcher.add(paths);
35894
35886
  return watcher;
35895
35887
  }
35896
- var import_node_events, import_node_fs3, import_promises5, sp2, SLASH, SLASH_SLASH, ONE_DOT, TWO_DOTS, STRING_TYPE, BACK_SLASH_RE, DOUBLE_SLASH_RE, DOT_RE, REPLACER_RE, isMatcherObject, unifyPaths, toUnix, normalizePathToUnix, normalizeIgnored, getAbsolutePath, EMPTY_SET, DirEntry, STAT_METHOD_F, STAT_METHOD_L, WatchHelper, FSWatcher;
35897
- var init_chokidar = __esm({
35898
- "../../oss/packages/daemon-core/node_modules/chokidar/index.js"() {
35888
+ var import_fs8, import_promises5, import_events, sysPath2, SLASH, SLASH_SLASH, ONE_DOT, TWO_DOTS, STRING_TYPE, BACK_SLASH_RE, DOUBLE_SLASH_RE, DOT_RE, REPLACER_RE, isMatcherObject, unifyPaths, toUnix, normalizePathToUnix, normalizeIgnored, getAbsolutePath, EMPTY_SET, DirEntry, STAT_METHOD_F, STAT_METHOD_L, WatchHelper, FSWatcher;
35889
+ var init_esm2 = __esm({
35890
+ "../../oss/node_modules/chokidar/esm/index.js"() {
35899
35891
  "use strict";
35900
- import_node_events = require("events");
35901
- import_node_fs3 = require("fs");
35892
+ import_fs8 = require("fs");
35902
35893
  import_promises5 = require("fs/promises");
35903
- sp2 = __toESM(require("path"), 1);
35904
- init_readdirp();
35894
+ import_events = require("events");
35895
+ sysPath2 = __toESM(require("path"), 1);
35896
+ init_esm();
35905
35897
  init_handler2();
35906
35898
  SLASH = "/";
35907
35899
  SLASH_SLASH = "//";
@@ -35909,7 +35901,7 @@ var init_chokidar = __esm({
35909
35901
  TWO_DOTS = "..";
35910
35902
  STRING_TYPE = "string";
35911
35903
  BACK_SLASH_RE = /\\/g;
35912
- DOUBLE_SLASH_RE = /\/\//g;
35904
+ DOUBLE_SLASH_RE = /\/\//;
35913
35905
  DOT_RE = /\..*\.(sw[px])$|~$|\.subl.*\.tmp/;
35914
35906
  REPLACER_RE = /^\.[/\\]/;
35915
35907
  isMatcherObject = (matcher) => typeof matcher === "object" && matcher !== null && !(matcher instanceof RegExp);
@@ -35926,31 +35918,30 @@ var init_chokidar = __esm({
35926
35918
  if (str.startsWith(SLASH_SLASH)) {
35927
35919
  prepend = true;
35928
35920
  }
35929
- str = str.replace(DOUBLE_SLASH_RE, SLASH);
35921
+ while (str.match(DOUBLE_SLASH_RE)) {
35922
+ str = str.replace(DOUBLE_SLASH_RE, SLASH);
35923
+ }
35930
35924
  if (prepend) {
35931
35925
  str = SLASH + str;
35932
35926
  }
35933
35927
  return str;
35934
35928
  };
35935
- normalizePathToUnix = (path33) => toUnix(sp2.normalize(toUnix(path33)));
35929
+ normalizePathToUnix = (path33) => toUnix(sysPath2.normalize(toUnix(path33)));
35936
35930
  normalizeIgnored = (cwd = "") => (path33) => {
35937
35931
  if (typeof path33 === "string") {
35938
- return normalizePathToUnix(sp2.isAbsolute(path33) ? path33 : sp2.join(cwd, path33));
35932
+ return normalizePathToUnix(sysPath2.isAbsolute(path33) ? path33 : sysPath2.join(cwd, path33));
35939
35933
  } else {
35940
35934
  return path33;
35941
35935
  }
35942
35936
  };
35943
35937
  getAbsolutePath = (path33, cwd) => {
35944
- if (sp2.isAbsolute(path33)) {
35938
+ if (sysPath2.isAbsolute(path33)) {
35945
35939
  return path33;
35946
35940
  }
35947
- return sp2.join(cwd, path33);
35941
+ return sysPath2.join(cwd, path33);
35948
35942
  };
35949
35943
  EMPTY_SET = Object.freeze(/* @__PURE__ */ new Set());
35950
35944
  DirEntry = class {
35951
- path;
35952
- _removeWatcher;
35953
- items;
35954
35945
  constructor(dir, removeWatcher) {
35955
35946
  this.path = dir;
35956
35947
  this._removeWatcher = removeWatcher;
@@ -35975,7 +35966,7 @@ var init_chokidar = __esm({
35975
35966
  await (0, import_promises5.readdir)(dir);
35976
35967
  } catch (err) {
35977
35968
  if (this._removeWatcher) {
35978
- this._removeWatcher(sp2.dirname(dir), sp2.basename(dir));
35969
+ this._removeWatcher(sysPath2.dirname(dir), sysPath2.basename(dir));
35979
35970
  }
35980
35971
  }
35981
35972
  }
@@ -36002,19 +35993,12 @@ var init_chokidar = __esm({
36002
35993
  STAT_METHOD_F = "stat";
36003
35994
  STAT_METHOD_L = "lstat";
36004
35995
  WatchHelper = class {
36005
- fsw;
36006
- path;
36007
- watchPath;
36008
- fullWatchPath;
36009
- dirParts;
36010
- followSymlinks;
36011
- statMethod;
36012
35996
  constructor(path33, follow, fsw) {
36013
35997
  this.fsw = fsw;
36014
35998
  const watchPath = path33;
36015
35999
  this.path = path33 = path33.replace(REPLACER_RE, "");
36016
36000
  this.watchPath = watchPath;
36017
- this.fullWatchPath = sp2.resolve(watchPath);
36001
+ this.fullWatchPath = sysPath2.resolve(watchPath);
36018
36002
  this.dirParts = [];
36019
36003
  this.dirParts.forEach((parts) => {
36020
36004
  if (parts.length > 1)
@@ -36024,7 +36008,7 @@ var init_chokidar = __esm({
36024
36008
  this.statMethod = follow ? STAT_METHOD_F : STAT_METHOD_L;
36025
36009
  }
36026
36010
  entryPath(entry) {
36027
- return sp2.join(this.watchPath, sp2.relative(this.watchPath, entry.fullPath));
36011
+ return sysPath2.join(this.watchPath, sysPath2.relative(this.watchPath, entry.fullPath));
36028
36012
  }
36029
36013
  filterPath(entry) {
36030
36014
  const { stats } = entry;
@@ -36037,25 +36021,7 @@ var init_chokidar = __esm({
36037
36021
  return this.fsw._isntIgnored(this.entryPath(entry), entry.stats);
36038
36022
  }
36039
36023
  };
36040
- FSWatcher = class extends import_node_events.EventEmitter {
36041
- closed;
36042
- options;
36043
- _closers;
36044
- _ignoredPaths;
36045
- _throttled;
36046
- _streams;
36047
- _symlinkPaths;
36048
- _watched;
36049
- _pendingWrites;
36050
- _pendingUnlinks;
36051
- _readyCount;
36052
- _emitReady;
36053
- _closePromise;
36054
- _userIgnored;
36055
- _readyEmitted;
36056
- _emitRaw;
36057
- _boundRemove;
36058
- _nodeFsHandler;
36024
+ FSWatcher = class extends import_events.EventEmitter {
36059
36025
  // Not indenting methods for history sake; for now.
36060
36026
  constructor(_opts = {}) {
36061
36027
  super();
@@ -36174,7 +36140,7 @@ var init_chokidar = __esm({
36174
36140
  return;
36175
36141
  results.forEach((item) => {
36176
36142
  if (item)
36177
- this.add(sp2.dirname(item), sp2.basename(_origAdd || item));
36143
+ this.add(sysPath2.dirname(item), sysPath2.basename(_origAdd || item));
36178
36144
  });
36179
36145
  });
36180
36146
  return this;
@@ -36188,10 +36154,10 @@ var init_chokidar = __esm({
36188
36154
  const paths = unifyPaths(paths_);
36189
36155
  const { cwd } = this.options;
36190
36156
  paths.forEach((path33) => {
36191
- if (!sp2.isAbsolute(path33) && !this._closers.has(path33)) {
36157
+ if (!sysPath2.isAbsolute(path33) && !this._closers.has(path33)) {
36192
36158
  if (cwd)
36193
- path33 = sp2.join(cwd, path33);
36194
- path33 = sp2.resolve(path33);
36159
+ path33 = sysPath2.join(cwd, path33);
36160
+ path33 = sysPath2.resolve(path33);
36195
36161
  }
36196
36162
  this._closePath(path33);
36197
36163
  this._addIgnoredPath(path33);
@@ -36240,7 +36206,7 @@ var init_chokidar = __esm({
36240
36206
  getWatched() {
36241
36207
  const watchList = {};
36242
36208
  this._watched.forEach((entry, dir) => {
36243
- const key = this.options.cwd ? sp2.relative(this.options.cwd, dir) : dir;
36209
+ const key = this.options.cwd ? sysPath2.relative(this.options.cwd, dir) : dir;
36244
36210
  const index = key || ONE_DOT;
36245
36211
  watchList[index] = entry.getChildren().sort();
36246
36212
  });
@@ -36266,9 +36232,9 @@ var init_chokidar = __esm({
36266
36232
  return;
36267
36233
  const opts = this.options;
36268
36234
  if (isWindows)
36269
- path33 = sp2.normalize(path33);
36235
+ path33 = sysPath2.normalize(path33);
36270
36236
  if (opts.cwd)
36271
- path33 = sp2.relative(opts.cwd, path33);
36237
+ path33 = sysPath2.relative(opts.cwd, path33);
36272
36238
  const args = [path33];
36273
36239
  if (stats != null)
36274
36240
  args.push(stats);
@@ -36319,7 +36285,7 @@ var init_chokidar = __esm({
36319
36285
  return this;
36320
36286
  }
36321
36287
  if (opts.alwaysStat && stats === void 0 && (event === EVENTS.ADD || event === EVENTS.ADD_DIR || event === EVENTS.CHANGE)) {
36322
- const fullPath = opts.cwd ? sp2.join(opts.cwd, path33) : path33;
36288
+ const fullPath = opts.cwd ? sysPath2.join(opts.cwd, path33) : path33;
36323
36289
  let stats2;
36324
36290
  try {
36325
36291
  stats2 = await (0, import_promises5.stat)(fullPath);
@@ -36395,13 +36361,13 @@ var init_chokidar = __esm({
36395
36361
  const pollInterval = awf.pollInterval;
36396
36362
  let timeoutHandler;
36397
36363
  let fullPath = path33;
36398
- if (this.options.cwd && !sp2.isAbsolute(path33)) {
36399
- fullPath = sp2.join(this.options.cwd, path33);
36364
+ if (this.options.cwd && !sysPath2.isAbsolute(path33)) {
36365
+ fullPath = sysPath2.join(this.options.cwd, path33);
36400
36366
  }
36401
36367
  const now = /* @__PURE__ */ new Date();
36402
36368
  const writes = this._pendingWrites;
36403
36369
  function awaitWriteFinishFn(prevStat) {
36404
- (0, import_node_fs3.stat)(fullPath, (err, curStat) => {
36370
+ (0, import_fs8.stat)(fullPath, (err, curStat) => {
36405
36371
  if (err || !writes.has(path33)) {
36406
36372
  if (err && err.code !== "ENOENT")
36407
36373
  awfEmit(err);
@@ -36466,7 +36432,7 @@ var init_chokidar = __esm({
36466
36432
  * @param directory path of the directory
36467
36433
  */
36468
36434
  _getWatchedDir(directory) {
36469
- const dir = sp2.resolve(directory);
36435
+ const dir = sysPath2.resolve(directory);
36470
36436
  if (!this._watched.has(dir))
36471
36437
  this._watched.set(dir, new DirEntry(dir, this._boundRemove));
36472
36438
  return this._watched.get(dir);
@@ -36489,8 +36455,8 @@ var init_chokidar = __esm({
36489
36455
  * @param item base path of item/directory
36490
36456
  */
36491
36457
  _remove(directory, item, isDirectory) {
36492
- const path33 = sp2.join(directory, item);
36493
- const fullPath = sp2.resolve(path33);
36458
+ const path33 = sysPath2.join(directory, item);
36459
+ const fullPath = sysPath2.resolve(path33);
36494
36460
  isDirectory = isDirectory != null ? isDirectory : this._watched.has(path33) || this._watched.has(fullPath);
36495
36461
  if (!this._throttle("remove", path33, 100))
36496
36462
  return;
@@ -36508,7 +36474,7 @@ var init_chokidar = __esm({
36508
36474
  }
36509
36475
  let relPath = path33;
36510
36476
  if (this.options.cwd)
36511
- relPath = sp2.relative(this.options.cwd, path33);
36477
+ relPath = sysPath2.relative(this.options.cwd, path33);
36512
36478
  if (this.options.awaitWriteFinish && this._pendingWrites.has(relPath)) {
36513
36479
  const event = this._pendingWrites.get(relPath).cancelWait();
36514
36480
  if (event === EVENTS.ADD)
@@ -36526,8 +36492,8 @@ var init_chokidar = __esm({
36526
36492
  */
36527
36493
  _closePath(path33) {
36528
36494
  this._closeFile(path33);
36529
- const dir = sp2.dirname(path33);
36530
- this._getWatchedDir(dir).remove(sp2.basename(path33));
36495
+ const dir = sysPath2.dirname(path33);
36496
+ this._getWatchedDir(dir).remove(sysPath2.basename(path33));
36531
36497
  }
36532
36498
  /**
36533
36499
  * Closes only file-specific watchers
@@ -36872,7 +36838,7 @@ var init_provider_loader = __esm({
36872
36838
  fs7 = __toESM(require("fs"));
36873
36839
  path17 = __toESM(require("path"));
36874
36840
  os16 = __toESM(require("os"));
36875
- init_chokidar();
36841
+ init_esm2();
36876
36842
  init_ide_detector();
36877
36843
  init_logger();
36878
36844
  init_provider_schema();
@@ -39093,7 +39059,7 @@ function resolveAdhdevMcpServerLaunch(options) {
39093
39059
  if (!entryPath) return null;
39094
39060
  return {
39095
39061
  command: options.nodeExecutable?.trim() || process.execPath,
39096
- args: [entryPath, "--repo-mesh", options.meshId]
39062
+ args: [entryPath, "--mode", "ipc", "--repo-mesh", options.meshId]
39097
39063
  };
39098
39064
  }
39099
39065
  function resolveAdhdevMcpEntryPath(explicitPath) {
@@ -39131,17 +39097,17 @@ function resolveAdhdevMcpEntryPath(explicitPath) {
39131
39097
  }
39132
39098
  function normalizeExistingPath(filePath) {
39133
39099
  try {
39134
- if (!(0, import_node_fs4.existsSync)(filePath)) return null;
39135
- return import_node_fs4.realpathSync.native(filePath);
39100
+ if (!(0, import_node_fs2.existsSync)(filePath)) return null;
39101
+ return import_node_fs2.realpathSync.native(filePath);
39136
39102
  } catch {
39137
39103
  return null;
39138
39104
  }
39139
39105
  }
39140
- var import_node_fs4, import_node_module2, import_node_path2, DEFAULT_SERVER_NAME, DEFAULT_ADHDEV_MCP_COMMAND;
39106
+ var import_node_fs2, import_node_module2, import_node_path2, DEFAULT_SERVER_NAME, DEFAULT_ADHDEV_MCP_COMMAND;
39141
39107
  var init_mesh_coordinator = __esm({
39142
39108
  "../../oss/packages/daemon-core/src/commands/mesh-coordinator.ts"() {
39143
39109
  "use strict";
39144
- import_node_fs4 = require("fs");
39110
+ import_node_fs2 = require("fs");
39145
39111
  import_node_module2 = require("module");
39146
39112
  import_node_path2 = require("path");
39147
39113
  DEFAULT_SERVER_NAME = "adhdev-mesh";
@@ -39911,7 +39877,7 @@ function summarizeSessionHostPruneResult(result) {
39911
39877
  keptCount: Array.isArray(value.keptSessionIds) ? value.keptSessionIds.length : void 0
39912
39878
  };
39913
39879
  }
39914
- var fs10, CHANNEL_NPM_TAG, CHAT_COMMANDS, READ_DEBUG_ENABLED2, DaemonCommandRouter;
39880
+ var fs10, CHANNEL_NPM_TAG, CHANNEL_SERVER_URL, CHAT_COMMANDS, READ_DEBUG_ENABLED2, DaemonCommandRouter;
39915
39881
  var init_router = __esm({
39916
39882
  "../../oss/packages/daemon-core/src/commands/router.ts"() {
39917
39883
  "use strict";
@@ -39939,6 +39905,10 @@ var init_router = __esm({
39939
39905
  init_upgrade_helper();
39940
39906
  fs10 = __toESM(require("fs"));
39941
39907
  CHANNEL_NPM_TAG = { stable: "latest", preview: "next" };
39908
+ CHANNEL_SERVER_URL = {
39909
+ stable: "https://api.adhf.dev",
39910
+ preview: "https://api-preview.adhf.dev"
39911
+ };
39942
39912
  CHAT_COMMANDS = [
39943
39913
  "send_chat",
39944
39914
  "new_chat",
@@ -40544,6 +40514,7 @@ var init_router = __esm({
40544
40514
  const npmTag = CHANNEL_NPM_TAG[channel];
40545
40515
  const latest = String(execNpmCommandSync(["view", `${pkgName}@${npmTag}`, "version"], { encoding: "utf-8", timeout: 1e4 }, npmSurface)).trim();
40546
40516
  LOG.info("Upgrade", `Latest ${pkgName}@${npmTag}: v${latest}`);
40517
+ updateConfig({ updateChannel: channel, serverUrl: CHANNEL_SERVER_URL[channel] });
40547
40518
  let currentInstalled = null;
40548
40519
  try {
40549
40520
  const currentJson = String(execNpmCommandSync(["ls", "-g", pkgName, "--depth=0", "--json"], {
@@ -40746,7 +40717,8 @@ var init_router = __esm({
40746
40717
  };
40747
40718
  if (args?.inlineMesh) {
40748
40719
  mcpServerEntry.env = {
40749
- ADHDEV_INLINE_MESH: JSON.stringify(mesh)
40720
+ ADHDEV_INLINE_MESH: JSON.stringify(mesh),
40721
+ ADHDEV_MCP_TRANSPORT: "ipc"
40750
40722
  };
40751
40723
  }
40752
40724
  const mcpConfig = {
@@ -42526,7 +42498,7 @@ function runCommand(cmd, timeout = 1e4) {
42526
42498
  }
42527
42499
  }
42528
42500
  function findBinary2(name) {
42529
- const cmd = (0, import_os3.platform)() === "win32" ? `where ${name}` : `which ${name}`;
42501
+ const cmd = (0, import_os4.platform)() === "win32" ? `where ${name}` : `which ${name}`;
42530
42502
  const result = runCommand(cmd, 5e3);
42531
42503
  return result ? result.split("\n")[0] : null;
42532
42504
  }
@@ -42574,7 +42546,7 @@ function checkPathExists2(paths) {
42574
42546
  return null;
42575
42547
  }
42576
42548
  function getMacAppVersion(appPath) {
42577
- if ((0, import_os3.platform)() !== "darwin" || !appPath.endsWith(".app")) return null;
42549
+ if ((0, import_os4.platform)() !== "darwin" || !appPath.endsWith(".app")) return null;
42578
42550
  const plistPath = path21.join(appPath, "Contents", "Info.plist");
42579
42551
  if (!fs11.existsSync(plistPath)) return null;
42580
42552
  const raw = runCommand(`/usr/libexec/PlistBuddy -c "Print CFBundleShortVersionString" "${plistPath}"`);
@@ -42582,7 +42554,7 @@ function getMacAppVersion(appPath) {
42582
42554
  }
42583
42555
  async function detectAllVersions(loader, archive) {
42584
42556
  const results = [];
42585
- const currentOs = (0, import_os3.platform)();
42557
+ const currentOs = (0, import_os4.platform)();
42586
42558
  for (const provider of loader.getAll()) {
42587
42559
  const info = {
42588
42560
  type: provider.type,
@@ -42638,7 +42610,7 @@ async function detectAllVersions(loader, archive) {
42638
42610
  }
42639
42611
  return results;
42640
42612
  }
42641
- var fs11, path21, os21, import_child_process10, import_os3, ARCHIVE_PATH, MAX_ENTRIES_PER_PROVIDER, VersionArchive;
42613
+ var fs11, path21, os21, import_child_process10, import_os4, ARCHIVE_PATH, MAX_ENTRIES_PER_PROVIDER, VersionArchive;
42642
42614
  var init_version_archive = __esm({
42643
42615
  "../../oss/packages/daemon-core/src/providers/version-archive.ts"() {
42644
42616
  "use strict";
@@ -42646,7 +42618,7 @@ var init_version_archive = __esm({
42646
42618
  path21 = __toESM(require("path"));
42647
42619
  os21 = __toESM(require("os"));
42648
42620
  import_child_process10 = require("child_process");
42649
- import_os3 = require("os");
42621
+ import_os4 = require("os");
42650
42622
  ARCHIVE_PATH = path21.join(os21.homedir(), ".adhdev", "version-history.json");
42651
42623
  MAX_ENTRIES_PER_PROVIDER = 20;
42652
42624
  VersionArchive = class {
@@ -42672,7 +42644,7 @@ var init_version_archive = __esm({
42672
42644
  entries.push({
42673
42645
  version: version2,
42674
42646
  detectedAt: (/* @__PURE__ */ new Date()).toISOString(),
42675
- os: (0, import_os3.platform)()
42647
+ os: (0, import_os4.platform)()
42676
42648
  });
42677
42649
  if (entries.length > MAX_ENTRIES_PER_PROVIDER) {
42678
42650
  this.history[type] = entries.slice(-MAX_ENTRIES_PER_PROVIDER);
@@ -49341,13 +49313,14 @@ var init_server_connection = __esm({
49341
49313
  reject(new Error(`Mesh command timed out after ${timeoutMs}ms`));
49342
49314
  }, timeoutMs);
49343
49315
  const handler = (msg) => {
49344
- if (msg.payload?.requestId !== requestId) return;
49316
+ const body = msg.payload && typeof msg.payload === "object" ? { ...msg, ...msg.payload } : msg;
49317
+ if (body.requestId !== requestId) return;
49345
49318
  this.off("daemon_mesh_result", handler);
49346
49319
  clearTimeout(timer);
49347
- if (msg.payload?.success === false) {
49348
- reject(new Error(msg.payload?.error ?? "Mesh command failed"));
49320
+ if (body.success === false) {
49321
+ reject(new Error(body.error ?? "Mesh command failed"));
49349
49322
  } else {
49350
- resolve20(msg.payload?.result);
49323
+ resolve20(body.result);
49351
49324
  }
49352
49325
  };
49353
49326
  this.on("daemon_mesh_result", handler);
@@ -49449,17 +49422,19 @@ var init_server_connection = __esm({
49449
49422
  return;
49450
49423
  } else if (message.type === "version_mismatch") {
49451
49424
  const p = message.payload;
49425
+ const updateCommand = typeof p.updateCommand === "string" && p.updateCommand.trim() ? p.updateCommand.trim() : "adhdev daemon:upgrade";
49452
49426
  LOG.info("Server", `
49453
49427
  \u{1F504} Update available: v${p.current} \u2192 v${p.latest}`);
49454
- LOG.info("Server", ` Run: adhdev daemon:upgrade
49428
+ LOG.info("Server", ` Run: ${updateCommand}
49455
49429
  `);
49456
49430
  } else if (message.type === "force_update_required") {
49457
49431
  this.compatBlocked = true;
49458
49432
  const p = message.payload;
49433
+ const updateCommand = typeof p.updateCommand === "string" && p.updateCommand.trim() ? p.updateCommand.trim() : "adhdev daemon:upgrade";
49459
49434
  LOG.error("Server", `
49460
49435
  \u26D4 Daemon v${this.options.daemonVersion} is no longer compatible.`);
49461
49436
  LOG.error("Server", ` Minimum required: v${p.minVersion}`);
49462
- LOG.error("Server", ` Run: adhdev daemon:upgrade
49437
+ LOG.error("Server", ` Run: ${updateCommand}
49463
49438
  `);
49464
49439
  }
49465
49440
  const handlers = this.messageHandlers.get(message.type);
@@ -55335,10 +55310,10 @@ var require_color = __commonJS({
55335
55310
  const b = srgbNonlinearTransformInv(rgb[2] / 255);
55336
55311
  const lp = Math.cbrt(0.4122214708 * r + 0.5363325363 * g + 0.0514459929 * b);
55337
55312
  const mp = Math.cbrt(0.2119034982 * r + 0.6806995451 * g + 0.1073969566 * b);
55338
- const sp3 = Math.cbrt(0.0883024619 * r + 0.2817188376 * g + 0.6299787005 * b);
55339
- const l = 0.2104542553 * lp + 0.793617785 * mp - 0.0040720468 * sp3;
55340
- const aa = 1.9779984951 * lp - 2.428592205 * mp + 0.4505937099 * sp3;
55341
- const bb = 0.0259040371 * lp + 0.7827717662 * mp - 0.808675766 * sp3;
55313
+ const sp = Math.cbrt(0.0883024619 * r + 0.2817188376 * g + 0.6299787005 * b);
55314
+ const l = 0.2104542553 * lp + 0.793617785 * mp - 0.0040720468 * sp;
55315
+ const aa = 1.9779984951 * lp - 2.428592205 * mp + 0.4505937099 * sp;
55316
+ const bb = 0.0259040371 * lp + 0.7827717662 * mp - 0.808675766 * sp;
55342
55317
  return [l * 100, aa * 100, bb * 100];
55343
55318
  };
55344
55319
  convert.rgb.cmyk = function(rgb) {
@@ -55600,10 +55575,10 @@ var require_color = __commonJS({
55600
55575
  const z2 = xyz[2] / 100;
55601
55576
  const lp = Math.cbrt(0.8189330101 * x + 0.3618667424 * y - 0.1288597137 * z2);
55602
55577
  const mp = Math.cbrt(0.0329845436 * x + 0.9293118715 * y + 0.0361456387 * z2);
55603
- const sp3 = Math.cbrt(0.0482003018 * x + 0.2643662691 * y + 0.633851707 * z2);
55604
- const l = 0.2104542553 * lp + 0.793617785 * mp - 0.0040720468 * sp3;
55605
- const a = 1.9779984951 * lp - 2.428592205 * mp + 0.4505937099 * sp3;
55606
- const b = 0.0259040371 * lp + 0.7827717662 * mp - 0.808675766 * sp3;
55578
+ const sp = Math.cbrt(0.0482003018 * x + 0.2643662691 * y + 0.633851707 * z2);
55579
+ const l = 0.2104542553 * lp + 0.793617785 * mp - 0.0040720468 * sp;
55580
+ const a = 1.9779984951 * lp - 2.428592205 * mp + 0.4505937099 * sp;
55581
+ const b = 0.0259040371 * lp + 0.7827717662 * mp - 0.808675766 * sp;
55607
55582
  return [l * 100, a * 100, b * 100];
55608
55583
  };
55609
55584
  convert.oklab.oklch = function(oklab) {
@@ -58525,7 +58500,7 @@ function _supportsColor2(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
58525
58500
  return min;
58526
58501
  }
58527
58502
  if (import_node_process2.default.platform === "win32") {
58528
- const osRelease = import_node_os3.default.release().split(".");
58503
+ const osRelease = import_node_os2.default.release().split(".");
58529
58504
  if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
58530
58505
  return Number(osRelease[2]) >= 14931 ? 3 : 2;
58531
58506
  }
@@ -58584,12 +58559,12 @@ function createSupportsColor2(stream, options = {}) {
58584
58559
  });
58585
58560
  return translateLevel2(level);
58586
58561
  }
58587
- var import_node_process2, import_node_os3, import_node_tty2, env2, flagForceColor2, supportsColor2, supports_color_default2;
58562
+ var import_node_process2, import_node_os2, import_node_tty2, env2, flagForceColor2, supportsColor2, supports_color_default2;
58588
58563
  var init_supports_color2 = __esm({
58589
58564
  "../../node_modules/chalk/source/vendor/supports-color/index.js"() {
58590
58565
  "use strict";
58591
58566
  import_node_process2 = __toESM(require("process"), 1);
58592
- import_node_os3 = __toESM(require("os"), 1);
58567
+ import_node_os2 = __toESM(require("os"), 1);
58593
58568
  import_node_tty2 = __toESM(require("tty"), 1);
58594
58569
  ({ env: env2 } = import_node_process2.default);
58595
58570
  if (hasFlag2("no-color") || hasFlag2("no-colors") || hasFlag2("color=false") || hasFlag2("color=never")) {
@@ -58807,18 +58782,18 @@ function resolvePackageVersion(options) {
58807
58782
  ];
58808
58783
  for (const p of possiblePaths) {
58809
58784
  try {
58810
- const data = JSON.parse((0, import_fs7.readFileSync)(p, "utf-8"));
58785
+ const data = JSON.parse((0, import_fs9.readFileSync)(p, "utf-8"));
58811
58786
  if (data.version) return data.version;
58812
58787
  } catch {
58813
58788
  }
58814
58789
  }
58815
58790
  return injectedVersion;
58816
58791
  }
58817
- var import_fs7, import_path4;
58792
+ var import_fs9, import_path4;
58818
58793
  var init_version = __esm({
58819
58794
  "src/version.ts"() {
58820
58795
  "use strict";
58821
- import_fs7 = require("fs");
58796
+ import_fs9 = require("fs");
58822
58797
  import_path4 = require("path");
58823
58798
  }
58824
58799
  });
@@ -58857,7 +58832,9 @@ var init_daemon_mesh_manager = __esm({
58857
58832
  "read_chat",
58858
58833
  "git_status",
58859
58834
  "git_diff_summary",
58860
- "launch_cli"
58835
+ "launch_cli",
58836
+ "git_checkpoint",
58837
+ "resolve_action"
58861
58838
  ]);
58862
58839
  setRules(rules) {
58863
58840
  const valid = [];
@@ -59148,7 +59125,7 @@ var init_adhdev_daemon = __esm({
59148
59125
  init_version();
59149
59126
  init_src();
59150
59127
  init_runtime_defaults();
59151
- pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.75" });
59128
+ pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.76-rc.10" });
59152
59129
  AdhdevDaemon = class _AdhdevDaemon {
59153
59130
  localHttpServer = null;
59154
59131
  localWss = null;
@@ -59984,6 +59961,19 @@ ${err?.stack || ""}`);
59984
59961
  void this.statusReporter?.sendUnifiedStatusReport({ forceServer: true, reason });
59985
59962
  void this.flushP2PDaemonMetadataSubscriptions();
59986
59963
  }
59964
+ emitMeshCheckpointCompleteIfNeeded(commandType, result, normalizedData) {
59965
+ if (commandType !== "git_checkpoint" || result?.success !== true || !this.meshManager) return;
59966
+ const workspace = String(normalizedData.workspace ?? "");
59967
+ const baseContext = {
59968
+ workspace,
59969
+ checkpoint_message: result.checkpoint?.message ?? String(normalizedData.message ?? ""),
59970
+ commit: result.checkpoint?.commit ?? "",
59971
+ source_session_id: String(normalizedData.targetSessionId ?? "")
59972
+ };
59973
+ void this.buildMeshCheckpointContext(workspace, baseContext).then((ctx) => {
59974
+ this.meshManager.emit({ trigger: "git_checkpoint_complete", context: ctx });
59975
+ });
59976
+ }
59987
59977
  async handleCommand(msg, cmd, args) {
59988
59978
  const normalizedArgs = this.ensureInteractionContext(args);
59989
59979
  const interactionId = String(normalizedArgs._interactionId);
@@ -60018,6 +60008,10 @@ ${err?.stack || ""}`);
60018
60008
  if (cmd === "resolve_action" || cmd === "send_chat" || cmd === "read_chat") {
60019
60009
  void this.flushP2PSessionModalSubscriptions();
60020
60010
  }
60011
+ if (cmd.startsWith("git_")) {
60012
+ void this.flushP2PWorkspaceGitSubscriptions();
60013
+ }
60014
+ this.emitMeshCheckpointCompleteIfNeeded(cmd, result, normalizedArgs);
60021
60015
  this.sendResult(msg, result.success, { ...result, interactionId });
60022
60016
  recordDebugTrace({
60023
60017
  interactionId,
@@ -60099,18 +60093,7 @@ ${err?.stack || ""}`);
60099
60093
  if (cmdType.startsWith("git_")) {
60100
60094
  void this.flushP2PWorkspaceGitSubscriptions();
60101
60095
  }
60102
- if (cmdType === "git_checkpoint" && routed.success && this.meshManager) {
60103
- const workspace = String(normalizedData.workspace ?? "");
60104
- const baseContext = {
60105
- workspace,
60106
- checkpoint_message: routed.checkpoint?.message ?? String(normalizedData.message ?? ""),
60107
- commit: routed.checkpoint?.commit ?? "",
60108
- source_session_id: String(normalizedData.targetSessionId ?? "")
60109
- };
60110
- void this.buildMeshCheckpointContext(workspace, baseContext).then((ctx) => {
60111
- this.meshManager.emit({ trigger: "git_checkpoint_complete", context: ctx });
60112
- });
60113
- }
60096
+ this.emitMeshCheckpointCompleteIfNeeded(cmdType, routed, normalizedData);
60114
60097
  return { ...routed, interactionId };
60115
60098
  } catch (e) {
60116
60099
  logCommand({ ts: (/* @__PURE__ */ new Date()).toISOString(), cmd: cmdType, source: "p2p", interactionId, success: false, error: e.message, durationMs: Date.now() - cmdStart });
@@ -60250,7 +60233,21 @@ ${err?.stack || ""}`);
60250
60233
  return;
60251
60234
  }
60252
60235
  try {
60253
- const result = await this.components.router.execute(command, normalizedArgs, "ipc");
60236
+ let result;
60237
+ if (command === "mesh_relay_command") {
60238
+ if (!this.meshManager) throw new Error("Mesh manager is not initialized");
60239
+ const targetDaemonId = typeof normalizedArgs.targetDaemonId === "string" ? normalizedArgs.targetDaemonId : "";
60240
+ const relayedCommand = typeof normalizedArgs.command === "string" ? normalizedArgs.command : "";
60241
+ const relayedArgs = normalizedArgs.args && typeof normalizedArgs.args === "object" ? normalizedArgs.args : {};
60242
+ if (!targetDaemonId || !relayedCommand) {
60243
+ throw new Error("mesh_relay_command requires targetDaemonId and command");
60244
+ }
60245
+ const relayResult = await this.meshManager.sendCommand(targetDaemonId, relayedCommand, relayedArgs);
60246
+ result = { success: true, result: relayResult };
60247
+ } else {
60248
+ result = await this.components.router.execute(command, normalizedArgs, "ipc");
60249
+ this.emitMeshCheckpointCompleteIfNeeded(command, result, normalizedArgs);
60250
+ }
60254
60251
  ws.send(JSON.stringify({
60255
60252
  type: "ext:command_result",
60256
60253
  payload: {
@@ -60581,7 +60578,7 @@ function isUnicodeSupported() {
60581
60578
  import_node_process3.default.env["TERM_PROGRAM"] === "Terminus-Sublime" || import_node_process3.default.env["TERM_PROGRAM"] === "vscode" || import_node_process3.default.env["TERM"] === "xterm-256color" || import_node_process3.default.env["TERM"] === "alacritty" || import_node_process3.default.env["TERMINAL_EMULATOR"] === "JetBrains-JediTerm";
60582
60579
  }
60583
60580
  var import_node_process3, common, specialMainSymbols, specialFallbackSymbols, mainSymbols, fallbackSymbols, shouldUseMain, figures, esm_default, replacements;
60584
- var init_esm = __esm({
60581
+ var init_esm3 = __esm({
60585
60582
  "../../node_modules/@inquirer/figures/dist/esm/index.js"() {
60586
60583
  "use strict";
60587
60584
  import_node_process3 = __toESM(require("process"), 1);
@@ -70502,7 +70499,7 @@ var init_separator = __esm({
70502
70499
  "../../node_modules/inquirer/lib/objects/separator.js"() {
70503
70500
  "use strict";
70504
70501
  import_yoctocolors_cjs2 = __toESM(require_yoctocolors_cjs(), 1);
70505
- init_esm();
70502
+ init_esm3();
70506
70503
  Separator = class {
70507
70504
  constructor(line) {
70508
70505
  this.type = "separator";
@@ -78626,7 +78623,7 @@ var init_list = __esm({
78626
78623
  "use strict";
78627
78624
  import_ansi_escapes3 = __toESM(require_ansi_escapes(), 1);
78628
78625
  import_yoctocolors_cjs4 = __toESM(require_yoctocolors_cjs(), 1);
78629
- init_esm();
78626
+ init_esm3();
78630
78627
  import_run_async2 = __toESM(require_run_async(), 1);
78631
78628
  import_rxjs3 = __toESM(require_cjs(), 1);
78632
78629
  init_events();
@@ -79321,7 +79318,7 @@ var init_checkbox = __esm({
79321
79318
  "use strict";
79322
79319
  import_ansi_escapes4 = __toESM(require_ansi_escapes(), 1);
79323
79320
  import_yoctocolors_cjs9 = __toESM(require_yoctocolors_cjs(), 1);
79324
- init_esm();
79321
+ init_esm3();
79325
79322
  import_rxjs8 = __toESM(require_cjs(), 1);
79326
79323
  init_events();
79327
79324
  init_paginator();
@@ -89075,15 +89072,15 @@ function splitStringBySpace(str) {
89075
89072
  }
89076
89073
  return pieces;
89077
89074
  }
89078
- var import_chardet, import_child_process14, import_fs8, import_node_path3, import_node_os4, import_node_crypto2, import_iconv_lite, ExternalEditor;
89079
- var init_esm2 = __esm({
89075
+ var import_chardet, import_child_process14, import_fs10, import_node_path3, import_node_os3, import_node_crypto2, import_iconv_lite, ExternalEditor;
89076
+ var init_esm4 = __esm({
89080
89077
  "../../node_modules/@inquirer/external-editor/dist/esm/index.js"() {
89081
89078
  "use strict";
89082
89079
  import_chardet = __toESM(require_lib2(), 1);
89083
89080
  import_child_process14 = require("child_process");
89084
- import_fs8 = require("fs");
89081
+ import_fs10 = require("fs");
89085
89082
  import_node_path3 = __toESM(require("path"), 1);
89086
- import_node_os4 = __toESM(require("os"), 1);
89083
+ import_node_os3 = __toESM(require("os"), 1);
89087
89084
  import_node_crypto2 = require("crypto");
89088
89085
  import_iconv_lite = __toESM(require_lib3(), 1);
89089
89086
  init_CreateFileError();
@@ -89142,7 +89139,7 @@ var init_esm2 = __esm({
89142
89139
  }
89143
89140
  createTemporaryFile() {
89144
89141
  try {
89145
- const baseDir = this.fileOptions.dir ?? import_node_os4.default.tmpdir();
89142
+ const baseDir = this.fileOptions.dir ?? import_node_os3.default.tmpdir();
89146
89143
  const id = (0, import_node_crypto2.randomUUID)();
89147
89144
  const prefix = sanitizeAffix(this.fileOptions.prefix);
89148
89145
  const postfix = sanitizeAffix(this.fileOptions.postfix);
@@ -89157,14 +89154,14 @@ var init_esm2 = __esm({
89157
89154
  if (Object.prototype.hasOwnProperty.call(this.fileOptions, "mode")) {
89158
89155
  opt.mode = this.fileOptions.mode;
89159
89156
  }
89160
- (0, import_fs8.writeFileSync)(this.tempFile, this.text, opt);
89157
+ (0, import_fs10.writeFileSync)(this.tempFile, this.text, opt);
89161
89158
  } catch (createFileError) {
89162
89159
  throw new CreateFileError(createFileError);
89163
89160
  }
89164
89161
  }
89165
89162
  readTemporaryFile() {
89166
89163
  try {
89167
- const tempFileBuffer = (0, import_fs8.readFileSync)(this.tempFile);
89164
+ const tempFileBuffer = (0, import_fs10.readFileSync)(this.tempFile);
89168
89165
  if (tempFileBuffer.length === 0) {
89169
89166
  this.text = "";
89170
89167
  } else {
@@ -89180,7 +89177,7 @@ var init_esm2 = __esm({
89180
89177
  }
89181
89178
  removeTemporaryFile() {
89182
89179
  try {
89183
- (0, import_fs8.unlinkSync)(this.tempFile);
89180
+ (0, import_fs10.unlinkSync)(this.tempFile);
89184
89181
  } catch (removeFileError) {
89185
89182
  throw new RemoveFileError(removeFileError);
89186
89183
  }
@@ -89214,7 +89211,7 @@ var init_editor = __esm({
89214
89211
  "../../node_modules/inquirer/lib/prompts/editor.js"() {
89215
89212
  "use strict";
89216
89213
  import_yoctocolors_cjs11 = __toESM(require_yoctocolors_cjs(), 1);
89217
- init_esm2();
89214
+ init_esm4();
89218
89215
  import_rxjs10 = __toESM(require_cjs(), 1);
89219
89216
  init_events();
89220
89217
  init_base();
@@ -90899,7 +90896,58 @@ init_lib();
90899
90896
  init_ora();
90900
90897
  init_src();
90901
90898
  init_version();
90902
- var SERVER_URL = process.env.ADHDEV_SERVER_URL || "https://api.adhf.dev";
90899
+ var CHANNEL_NPM_TAG2 = {
90900
+ stable: "latest",
90901
+ preview: "next"
90902
+ };
90903
+ var CHANNEL_SERVER_URL2 = {
90904
+ stable: "https://api.adhf.dev",
90905
+ preview: "https://api-preview.adhf.dev"
90906
+ };
90907
+ function normalizeSetupReleaseChannel(value) {
90908
+ if (typeof value !== "string") return null;
90909
+ const normalized = value.trim().toLowerCase();
90910
+ if (normalized === "stable" || normalized === "latest") return "stable";
90911
+ if (normalized === "preview" || normalized === "next") return "preview";
90912
+ return null;
90913
+ }
90914
+ function inferReleaseChannelFromServerUrl(serverUrl) {
90915
+ if (typeof serverUrl !== "string") return null;
90916
+ const normalized = serverUrl.trim().toLowerCase();
90917
+ if (!normalized) return null;
90918
+ if (normalized.includes("api-preview.adhf.dev") || normalized.includes("dev.adhf.dev")) return "preview";
90919
+ if (normalized.includes("api.adhf.dev") || normalized.includes("adhf.dev")) return "stable";
90920
+ return null;
90921
+ }
90922
+ function buildDashboardUrl(serverUrl, channel) {
90923
+ try {
90924
+ const url2 = new URL(serverUrl);
90925
+ if (url2.hostname === "api-preview.adhf.dev") return "https://dev.adhf.dev/dashboard";
90926
+ if (url2.hostname === "api.adhf.dev") return "https://adhf.dev/dashboard";
90927
+ if (url2.hostname === "127.0.0.1" || url2.hostname === "localhost") {
90928
+ url2.port = url2.port === "3100" ? "3000" : url2.port;
90929
+ url2.pathname = "/dashboard";
90930
+ url2.search = "";
90931
+ url2.hash = "";
90932
+ return url2.toString();
90933
+ }
90934
+ } catch {
90935
+ }
90936
+ return channel === "preview" ? "https://dev.adhf.dev/dashboard" : "https://adhf.dev/dashboard";
90937
+ }
90938
+ function buildSetupReleaseContext(options = {}) {
90939
+ const env3 = options.env || process.env;
90940
+ const envServerUrl = typeof env3.ADHDEV_SERVER_URL === "string" && env3.ADHDEV_SERVER_URL.trim() ? env3.ADHDEV_SERVER_URL.trim() : null;
90941
+ const config2 = options.config || {};
90942
+ const channel = normalizeSetupReleaseChannel(config2.updateChannel) || inferReleaseChannelFromServerUrl(envServerUrl) || inferReleaseChannelFromServerUrl(config2.serverUrl) || "stable";
90943
+ const serverUrl = envServerUrl || CHANNEL_SERVER_URL2[channel];
90944
+ return {
90945
+ channel,
90946
+ npmTag: CHANNEL_NPM_TAG2[channel],
90947
+ serverUrl,
90948
+ dashboardUrl: buildDashboardUrl(serverUrl, channel)
90949
+ };
90950
+ }
90903
90951
  var LOGO = `
90904
90952
  ${source_default2.cyan("\u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557")}
90905
90953
  ${source_default2.cyan("\u2551")} ${source_default2.bold.white("\u{1F9A6} ADHDev Setup Wizard")} ${source_default2.cyan("\u2551")}
@@ -90915,10 +90963,10 @@ function hasCloudMachineAuth() {
90915
90963
  const config2 = loadConfig();
90916
90964
  return Boolean(config2.machineSecret && config2.machineSecret.trim());
90917
90965
  }
90918
- function readLatestPublishedCliVersion(execFileSyncLocal) {
90966
+ function readLatestPublishedCliVersion(execFileSyncLocal, npmTag = "latest") {
90919
90967
  const surface = resolveCurrentGlobalInstallSurface({ packageName: "adhdev" });
90920
90968
  try {
90921
- return execFileSyncLocal(surface.npmExecutable, [...surface.npmArgsPrefix || [], "view", "adhdev", "version"], {
90969
+ return execFileSyncLocal(surface.npmExecutable, [...surface.npmArgsPrefix || [], "view", `adhdev@${npmTag}`, "version"], {
90922
90970
  encoding: "utf-8",
90923
90971
  timeout: 5e3,
90924
90972
  stdio: ["pipe", "pipe", "pipe"],
@@ -90949,38 +90997,41 @@ function readInstalledGlobalCliVersion(execFileSyncLocal) {
90949
90997
  }
90950
90998
  async function runWizard(options = {}) {
90951
90999
  console.log(LOGO);
91000
+ const config2 = loadConfig();
91001
+ const releaseContext = buildSetupReleaseContext({ config: config2 });
90952
91002
  if (isSetupComplete() && hasCloudMachineAuth() && !options.force) {
90953
- const config2 = loadConfig();
90954
91003
  console.log(source_default2.green("\u2713") + " ADHDev is already configured.");
90955
91004
  console.log(source_default2.gray(` Account: ${config2.userEmail || "not logged in"}`));
91005
+ console.log(source_default2.gray(` Server: ${releaseContext.serverUrl}`));
90956
91006
  console.log();
90957
- await checkForUpdate();
90958
- await startDaemonFlow();
91007
+ await checkForUpdate(releaseContext);
91008
+ await startDaemonFlow(releaseContext);
90959
91009
  return;
90960
91010
  }
90961
- await quickSetup();
91011
+ await quickSetup(releaseContext);
90962
91012
  }
90963
- async function checkForUpdate() {
91013
+ async function checkForUpdate(releaseContext) {
90964
91014
  try {
90965
91015
  const { execFileSync: execFileSync5 } = await import("child_process");
90966
91016
  const currentVersion = resolvePackageVersion();
90967
- const latestVersion = readLatestPublishedCliVersion(execFileSync5);
91017
+ const latestVersion = readLatestPublishedCliVersion(execFileSync5, releaseContext.npmTag);
90968
91018
  if (!latestVersion) return;
90969
91019
  if (!currentVersion || !latestVersion || currentVersion === latestVersion) return;
90970
- console.log(source_default2.yellow(` Update available: ${currentVersion} \u2192 ${latestVersion}`));
91020
+ console.log(source_default2.yellow(` Update available (${releaseContext.channel}/${releaseContext.npmTag}): ${currentVersion} \u2192 ${latestVersion}`));
90971
91021
  const { doUpdate } = await (await Promise.resolve().then(() => (init_lib(), lib_exports))).default.prompt([{
90972
91022
  type: "confirm",
90973
91023
  name: "doUpdate",
90974
- message: `Update adhdev CLI to v${latestVersion}?`,
91024
+ message: `Update adhdev CLI to v${latestVersion} from ${releaseContext.npmTag}?`,
90975
91025
  default: true
90976
91026
  }]);
90977
91027
  if (!doUpdate) {
90978
- console.log(source_default2.gray(" Skipping update. Run: npm install -g adhdev@latest\n"));
91028
+ console.log(source_default2.gray(` Skipping update. Run: npm install -g adhdev@${releaseContext.npmTag}
91029
+ `));
90979
91030
  return;
90980
91031
  }
90981
91032
  const spinner = (await Promise.resolve().then(() => (init_ora(), ora_exports))).default("Updating adhdev CLI...").start();
90982
91033
  try {
90983
- const installCommand = buildPinnedGlobalInstallCommand({ packageName: "adhdev", targetVersion: "latest" });
91034
+ const installCommand = buildPinnedGlobalInstallCommand({ packageName: "adhdev", targetVersion: releaseContext.npmTag });
90984
91035
  execFileSync5(installCommand.command, installCommand.args, {
90985
91036
  encoding: "utf-8",
90986
91037
  timeout: 6e4,
@@ -90991,14 +91042,17 @@ async function checkForUpdate() {
90991
91042
  console.log();
90992
91043
  } catch (e) {
90993
91044
  spinner.fail("Update failed");
90994
- console.log(source_default2.gray(" Manual: npm install -g adhdev@latest\n"));
91045
+ console.log(source_default2.gray(` Manual: npm install -g adhdev@${releaseContext.npmTag}
91046
+ `));
90995
91047
  }
90996
91048
  } catch {
90997
91049
  }
90998
91050
  }
90999
- async function quickSetup() {
91051
+ async function quickSetup(releaseContext) {
91000
91052
  console.log(source_default2.bold("\n\u{1F680} Quick Setup\n"));
91001
- const loginResult = await loginFlow();
91053
+ console.log(source_default2.gray(` Channel: ${releaseContext.channel} (${releaseContext.npmTag})`));
91054
+ console.log(source_default2.gray(` Server: ${releaseContext.serverUrl}`));
91055
+ const loginResult = await loginFlow(releaseContext);
91002
91056
  const setupDate = (/* @__PURE__ */ new Date()).toISOString();
91003
91057
  if (!loginResult) {
91004
91058
  updateConfig({
@@ -91009,7 +91063,9 @@ async function quickSetup() {
91009
91063
  setupDate,
91010
91064
  userEmail: null,
91011
91065
  userName: null,
91012
- machineSecret: null
91066
+ machineSecret: null,
91067
+ updateChannel: releaseContext.channel,
91068
+ serverUrl: releaseContext.serverUrl
91013
91069
  });
91014
91070
  console.log(source_default2.yellow("\u26A0 Setup is not complete without login. Run `adhdev setup` after signing in."));
91015
91071
  }
@@ -91020,14 +91076,16 @@ async function quickSetup() {
91020
91076
  userEmail: loginResult.email,
91021
91077
  userName: loginResult.name,
91022
91078
  setupDate,
91079
+ updateChannel: releaseContext.channel,
91080
+ serverUrl: releaseContext.serverUrl,
91023
91081
  ...loginResult.registeredMachineId ? { registeredMachineId: loginResult.registeredMachineId } : {}
91024
91082
  };
91025
91083
  updateConfig(configUpdate);
91026
91084
  console.log(source_default2.green(` \u2713 Machine registered`));
91027
91085
  }
91028
- await installCliOnly();
91086
+ await installCliOnly(releaseContext);
91029
91087
  if (loginResult) {
91030
- await startDaemonFlow();
91088
+ await startDaemonFlow(releaseContext);
91031
91089
  } else {
91032
91090
  console.log(source_default2.gray(" Start daemon after login: adhdev setup"));
91033
91091
  console.log();
@@ -91036,6 +91094,7 @@ async function quickSetup() {
91036
91094
  console.log(source_default2.bold("\n\u{1F389} Setup Complete!\n"));
91037
91095
  console.log(` ${source_default2.bold("User:")} ${loginResult?.email || "not logged in"}`);
91038
91096
  console.log(` ${source_default2.bold("Status:")} ${loginResult ? source_default2.green("Ready to connect") : source_default2.yellow("Login required")}`);
91097
+ console.log(` ${source_default2.bold("Server:")} ${releaseContext.serverUrl}`);
91039
91098
  console.log();
91040
91099
  console.log(source_default2.gray(" Next steps:"));
91041
91100
  console.log(source_default2.gray(` ${loginResult ? "adhdev daemon \u2014 Start the main daemon (IDE / remote features)" : "adhdev setup \u2014 Sign in to finish setup and enable the daemon"}`));
@@ -91046,11 +91105,12 @@ async function quickSetup() {
91046
91105
  console.log(source_default2.gray(" adhdev launch claude \u2014 Start Claude Code agent"));
91047
91106
  console.log(source_default2.gray(" adhdev status \u2014 Check setup status"));
91048
91107
  console.log();
91049
- console.log(source_default2.cyan(" Dashboard: https://adhf.dev/dashboard"));
91108
+ console.log(source_default2.cyan(` Dashboard: ${releaseContext.dashboardUrl}`));
91050
91109
  console.log();
91051
91110
  }
91052
- async function loginFlow() {
91111
+ async function loginFlow(releaseContext) {
91053
91112
  console.log(source_default2.bold("\n\u{1F510} Login to ADHDev\n"));
91113
+ console.log(source_default2.gray(` Auth server: ${releaseContext.serverUrl}`));
91054
91114
  const { wantLogin } = await lib_default.prompt([
91055
91115
  {
91056
91116
  type: "confirm",
@@ -91067,7 +91127,7 @@ async function loginFlow() {
91067
91127
  try {
91068
91128
  const config2 = loadConfig();
91069
91129
  const os29 = await import("os");
91070
- const res = await fetch(`${SERVER_URL}/auth/cli/init`, {
91130
+ const res = await fetch(`${releaseContext.serverUrl}/auth/cli/init`, {
91071
91131
  method: "POST",
91072
91132
  headers: { "Content-Type": "application/json" },
91073
91133
  body: JSON.stringify({
@@ -91109,7 +91169,7 @@ async function loginFlow() {
91109
91169
  while (Date.now() - startTime < timeout) {
91110
91170
  await new Promise((r) => setTimeout(r, 3e3));
91111
91171
  try {
91112
- const res = await fetch(`${SERVER_URL}/auth/cli/poll`, {
91172
+ const res = await fetch(`${releaseContext.serverUrl}/auth/cli/poll`, {
91113
91173
  method: "POST",
91114
91174
  headers: { "Content-Type": "application/json" },
91115
91175
  body: JSON.stringify({ deviceCode })
@@ -91139,9 +91199,9 @@ async function loginFlow() {
91139
91199
  console.log();
91140
91200
  console.log(source_default2.yellow(" To fix this, do one of the following:"));
91141
91201
  console.log(source_default2.gray(" 1. Remove an unused machine from the dashboard:"));
91142
- console.log(source_default2.gray(" https://adhf.dev/account \u2192 Registered Machines \u2192 \u2715 Remove"));
91202
+ console.log(source_default2.gray(` ${releaseContext.dashboardUrl.replace(/\/dashboard$/, "/account")} \u2192 Registered Machines \u2192 \u2715 Remove`));
91143
91203
  console.log(source_default2.gray(" 2. Upgrade your plan:"));
91144
- console.log(source_default2.gray(" https://adhf.dev/account?tab=billing"));
91204
+ console.log(source_default2.gray(` ${releaseContext.dashboardUrl.replace(/\/dashboard$/, "/account?tab=billing")}`));
91145
91205
  console.log();
91146
91206
  console.log(source_default2.gray(" Then run `adhdev setup` again."));
91147
91207
  console.log();
@@ -91153,11 +91213,12 @@ async function loginFlow() {
91153
91213
  pollSpinner.fail("Authentication timed out");
91154
91214
  return null;
91155
91215
  }
91156
- async function startDaemonFlow() {
91216
+ async function startDaemonFlow(releaseContext) {
91157
91217
  const { isDaemonRunning: isDaemonRunning2 } = await Promise.resolve().then(() => (init_adhdev_daemon(), adhdev_daemon_exports));
91158
91218
  if (isDaemonRunning2()) {
91159
91219
  console.log(source_default2.green(" \u2713 Daemon is already running"));
91160
- console.log(source_default2.gray(" Dashboard: https://adhf.dev/dashboard\n"));
91220
+ console.log(source_default2.gray(` Dashboard: ${releaseContext.dashboardUrl}
91221
+ `));
91161
91222
  return;
91162
91223
  }
91163
91224
  const { startDaemon } = await lib_default.prompt([
@@ -91211,7 +91272,7 @@ async function startDaemonFlow() {
91211
91272
  } else {
91212
91273
  daemonSpinner.warn("Daemon starting in background (may take a few seconds)");
91213
91274
  }
91214
- console.log(source_default2.gray(" Dashboard: https://adhf.dev/dashboard"));
91275
+ console.log(source_default2.gray(` Dashboard: ${releaseContext.dashboardUrl}`));
91215
91276
  console.log(source_default2.gray(` Logs: ${logPath}`));
91216
91277
  console.log();
91217
91278
  } catch (e) {
@@ -91219,7 +91280,7 @@ async function startDaemonFlow() {
91219
91280
  console.log(source_default2.gray(" Manual: adhdev daemon\n"));
91220
91281
  }
91221
91282
  }
91222
- async function installCliOnly() {
91283
+ async function installCliOnly(releaseContext) {
91223
91284
  const { execFileSync: execFileSyncLocal } = await import("child_process");
91224
91285
  const currentVersion = readInstalledGlobalCliVersion(execFileSyncLocal);
91225
91286
  const isNpx = process.env.npm_execpath?.includes("npx") || process.argv[1]?.includes("npx") || process.argv[1]?.includes("_npx");
@@ -91232,7 +91293,7 @@ async function installCliOnly() {
91232
91293
  console.log();
91233
91294
  if (currentVersion) {
91234
91295
  console.log(source_default2.green(` \u2713 Currently installed: v${currentVersion}`));
91235
- const latestVersion = readLatestPublishedCliVersion(execFileSyncLocal);
91296
+ const latestVersion = readLatestPublishedCliVersion(execFileSyncLocal, releaseContext.npmTag);
91236
91297
  if (latestVersion && currentVersion === latestVersion) {
91237
91298
  console.log(source_default2.gray(" (Already up to date)"));
91238
91299
  return;
@@ -91241,12 +91302,12 @@ async function installCliOnly() {
91241
91302
  const { doUpdate } = await lib_default.prompt([{
91242
91303
  type: "confirm",
91243
91304
  name: "doUpdate",
91244
- message: `Update to latest version${latestVersion ? ` (v${latestVersion})` : ""}?`,
91305
+ message: `Update to ${releaseContext.npmTag} version${latestVersion ? ` (v${latestVersion})` : ""}?`,
91245
91306
  default: true
91246
91307
  }]);
91247
91308
  if (!doUpdate) return;
91248
91309
  } else {
91249
- console.log(source_default2.gray(" Updating to latest..."));
91310
+ console.log(source_default2.gray(` Updating to ${releaseContext.npmTag}...`));
91250
91311
  }
91251
91312
  } else {
91252
91313
  console.log(source_default2.yellow(" \u2717 Not installed globally"));
@@ -91254,7 +91315,7 @@ async function installCliOnly() {
91254
91315
  const { doInstall } = await lib_default.prompt([{
91255
91316
  type: "confirm",
91256
91317
  name: "doInstall",
91257
- message: "Install adhdev CLI globally? (npm install -g adhdev)",
91318
+ message: `Install adhdev CLI globally? (npm install -g adhdev@${releaseContext.npmTag})`,
91258
91319
  default: true
91259
91320
  }]);
91260
91321
  if (!doInstall) {
@@ -91267,14 +91328,14 @@ async function installCliOnly() {
91267
91328
  }
91268
91329
  const installSpinner = ora2("Installing adhdev CLI...").start();
91269
91330
  try {
91270
- const installCommand = buildPinnedGlobalInstallCommand({ packageName: "adhdev", targetVersion: "latest" });
91331
+ const installCommand = buildPinnedGlobalInstallCommand({ packageName: "adhdev", targetVersion: releaseContext.npmTag });
91271
91332
  execFileSyncLocal(installCommand.command, installCommand.args, {
91272
91333
  encoding: "utf-8",
91273
91334
  timeout: 6e4,
91274
91335
  stdio: ["pipe", "pipe", "pipe"],
91275
91336
  ...installCommand.execOptions
91276
91337
  });
91277
- const newVersion = readInstalledGlobalCliVersion(execFileSyncLocal) || "latest";
91338
+ const newVersion = readInstalledGlobalCliVersion(execFileSyncLocal) || releaseContext.npmTag;
91278
91339
  installSpinner.succeed(`adhdev CLI ${currentVersion ? "updated" : "installed"} \u2713 (v${newVersion})`);
91279
91340
  console.log(source_default2.gray(" Try: adhdev daemon"));
91280
91341
  console.log();
@@ -91285,7 +91346,7 @@ async function installCliOnly() {
91285
91346
  if (osModule.platform() === "win32") {
91286
91347
  console.log(source_default2.gray(" On Windows, run PowerShell as Administrator"));
91287
91348
  }
91288
- console.log(source_default2.gray(" Manual: npm install -g adhdev@latest"));
91349
+ console.log(source_default2.gray(` Manual: npm install -g adhdev@${releaseContext.npmTag}`));
91289
91350
  console.log();
91290
91351
  }
91291
91352
  }
@@ -91300,7 +91361,7 @@ async function installCliOnly() {
91300
91361
  });
91301
91362
  /*! Bundled license information:
91302
91363
 
91303
- chokidar/index.js:
91364
+ chokidar/esm/index.js:
91304
91365
  (*! chokidar - MIT License (c) 2012 Paul Miller (paulmillr.com) *)
91305
91366
 
91306
91367
  sharp/lib/is.js: