adhdev 0.9.34 → 0.9.35

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
@@ -10474,7 +10474,14 @@ var init_handler = __esm({
10474
10474
  await this._ctx.providerLoader.fetchLatest().catch(() => {
10475
10475
  });
10476
10476
  this._ctx.providerLoader.reload();
10477
- return { success: true };
10477
+ this._ctx.providerLoader.registerToDetector();
10478
+ const refreshedInstances = this._ctx.instanceManager ? this._ctx.instanceManager.refreshProviderDefinitions((providerType) => this._ctx.providerLoader.resolve(providerType)) : 0;
10479
+ const providers = this._ctx.providerLoader.getAll().map((provider) => ({
10480
+ type: provider.type,
10481
+ name: provider.name,
10482
+ category: provider.category
10483
+ }));
10484
+ return { success: true, refreshedInstances, providers };
10478
10485
  }
10479
10486
  return { success: false, error: "ProviderLoader not initialized" };
10480
10487
  }
@@ -12766,6 +12773,8 @@ var init_provider_cli_adapter = __esm({
12766
12773
  messages = [];
12767
12774
  committedMessages = [];
12768
12775
  structuredMessages = [];
12776
+ committedMessagesActivitySignature = "";
12777
+ committedMessagesChangedAt = 0;
12769
12778
  currentStatus = "starting";
12770
12779
  onStatusChange = null;
12771
12780
  responseBuffer = "";
@@ -12847,10 +12856,35 @@ var init_provider_cli_adapter = __esm({
12847
12856
  providerResolutionMeta;
12848
12857
  static FINISH_RETRY_DELAY_MS = 300;
12849
12858
  static MAX_FINISH_RETRIES = 2;
12859
+ buildCommittedMessagesActivitySignature() {
12860
+ const last = this.committedMessages[this.committedMessages.length - 1];
12861
+ return [
12862
+ String(this.committedMessages.length),
12863
+ String(last?.role || ""),
12864
+ String(last?.kind || ""),
12865
+ String(last?.senderName || ""),
12866
+ String(last?.timestamp || ""),
12867
+ String(last?.receivedAt || ""),
12868
+ normalizeComparableMessageContent(last?.content || "").slice(-240)
12869
+ ].join("|");
12870
+ }
12850
12871
  syncMessageViews() {
12872
+ const signature = this.buildCommittedMessagesActivitySignature();
12873
+ if (signature !== this.committedMessagesActivitySignature) {
12874
+ this.committedMessagesActivitySignature = signature;
12875
+ this.committedMessagesChangedAt = Date.now();
12876
+ }
12851
12877
  this.messages = [...this.committedMessages];
12852
12878
  this.structuredMessages = [...this.committedMessages];
12853
12879
  }
12880
+ getLastCommittedMessageActivityAt() {
12881
+ const last = this.committedMessages[this.committedMessages.length - 1];
12882
+ const messageTime = Math.max(
12883
+ typeof last?.receivedAt === "number" && Number.isFinite(last.receivedAt) ? last.receivedAt : 0,
12884
+ typeof last?.timestamp === "number" && Number.isFinite(last.timestamp) ? last.timestamp : 0
12885
+ );
12886
+ return Math.max(messageTime, this.committedMessagesChangedAt || 0);
12887
+ }
12854
12888
  readTerminalScreenText(now = Date.now()) {
12855
12889
  const screenText = this.terminalScreen.getText() || "";
12856
12890
  this.lastScreenText = screenText;
@@ -12990,9 +13024,16 @@ var init_provider_cli_adapter = __esm({
12990
13024
  /** Inject CLI scripts after construction (e.g. when resolved by ProviderLoader) */
12991
13025
  setCliScripts(scripts) {
12992
13026
  this.cliScripts = scripts;
13027
+ this.parsedStatusCache = null;
13028
+ this.parseErrorMessage = null;
12993
13029
  const scriptNames = listCliScriptNames(scripts);
12994
13030
  LOG.info("CLI", `[${this.cliType}] CLI scripts injected: [${scriptNames.join(", ")}]`);
12995
13031
  }
13032
+ /** Refresh provider scripts/config used by this adapter without restarting the PTY runtime. */
13033
+ refreshProviderDefinition(provider) {
13034
+ this.provider = provider;
13035
+ this.setCliScripts(provider.scripts || {});
13036
+ }
12996
13037
  updateRuntimeSettings(settings) {
12997
13038
  this.runtimeSettings = { ...settings };
12998
13039
  }
@@ -15014,6 +15055,11 @@ var init_cli_provider_instance = __esm({
15014
15055
  launchMode;
15015
15056
  startedAt = Date.now();
15016
15057
  onProviderSessionResolved;
15058
+ refreshProviderDefinition(provider) {
15059
+ if (provider.type !== this.type || provider.category !== "cli") return;
15060
+ this.provider = provider;
15061
+ this.adapter.refreshProviderDefinition(provider);
15062
+ }
15017
15063
  // ─── Lifecycle ─────────────────────────────────
15018
15064
  async init(context) {
15019
15065
  this.context = context;
@@ -15224,9 +15270,11 @@ var init_cli_provider_instance = __esm({
15224
15270
  const autoApproveActive = adapterStatus.status === "waiting_approval" && this.shouldAutoApprove();
15225
15271
  const visibleStatus = autoApproveActive ? "generating" : adapterStatus.status;
15226
15272
  const runtime = this.adapter.getRuntimeMetadata();
15273
+ const lastCommittedMessageActivityAt = typeof this.adapter.getLastCommittedMessageActivityAt === "function" ? this.adapter.getLastCommittedMessageActivityAt() : 0;
15227
15274
  return {
15228
15275
  id: this.instanceId,
15229
15276
  status: visibleStatus,
15277
+ lastMessageAt: lastCommittedMessageActivityAt || void 0,
15230
15278
  runtimeLifecycle: runtime?.lifecycle ?? null,
15231
15279
  runtimeSurfaceKind: runtime?.surfaceKind,
15232
15280
  runtimeRestoredFromStorage: runtime?.restoredFromStorage === true,
@@ -16059,10 +16107,10 @@ function mergeDefs(...defs) {
16059
16107
  function cloneDef(schema) {
16060
16108
  return mergeDefs(schema._zod.def);
16061
16109
  }
16062
- function getElementAtPath(obj, path35) {
16063
- if (!path35)
16110
+ function getElementAtPath(obj, path36) {
16111
+ if (!path36)
16064
16112
  return obj;
16065
- return path35.reduce((acc, key) => acc?.[key], obj);
16113
+ return path36.reduce((acc, key) => acc?.[key], obj);
16066
16114
  }
16067
16115
  function promiseAllObject(promisesObj) {
16068
16116
  const keys = Object.keys(promisesObj);
@@ -16374,11 +16422,11 @@ function aborted(x, startIndex = 0) {
16374
16422
  }
16375
16423
  return false;
16376
16424
  }
16377
- function prefixIssues(path35, issues) {
16425
+ function prefixIssues(path36, issues) {
16378
16426
  return issues.map((iss) => {
16379
16427
  var _a2;
16380
16428
  (_a2 = iss).path ?? (_a2.path = []);
16381
- iss.path.unshift(path35);
16429
+ iss.path.unshift(path36);
16382
16430
  return iss;
16383
16431
  });
16384
16432
  }
@@ -16621,7 +16669,7 @@ function formatError(error48, mapper = (issue2) => issue2.message) {
16621
16669
  }
16622
16670
  function treeifyError(error48, mapper = (issue2) => issue2.message) {
16623
16671
  const result = { errors: [] };
16624
- const processError = (error49, path35 = []) => {
16672
+ const processError = (error49, path36 = []) => {
16625
16673
  var _a2, _b;
16626
16674
  for (const issue2 of error49.issues) {
16627
16675
  if (issue2.code === "invalid_union" && issue2.errors.length) {
@@ -16631,7 +16679,7 @@ function treeifyError(error48, mapper = (issue2) => issue2.message) {
16631
16679
  } else if (issue2.code === "invalid_element") {
16632
16680
  processError({ issues: issue2.issues }, issue2.path);
16633
16681
  } else {
16634
- const fullpath = [...path35, ...issue2.path];
16682
+ const fullpath = [...path36, ...issue2.path];
16635
16683
  if (fullpath.length === 0) {
16636
16684
  result.errors.push(mapper(issue2));
16637
16685
  continue;
@@ -16663,8 +16711,8 @@ function treeifyError(error48, mapper = (issue2) => issue2.message) {
16663
16711
  }
16664
16712
  function toDotPath(_path) {
16665
16713
  const segs = [];
16666
- const path35 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
16667
- for (const seg of path35) {
16714
+ const path36 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
16715
+ for (const seg of path36) {
16668
16716
  if (typeof seg === "number")
16669
16717
  segs.push(`[${seg}]`);
16670
16718
  else if (typeof seg === "symbol")
@@ -29428,13 +29476,13 @@ function resolveRef(ref, ctx) {
29428
29476
  if (!ref.startsWith("#")) {
29429
29477
  throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
29430
29478
  }
29431
- const path35 = ref.slice(1).split("/").filter(Boolean);
29432
- if (path35.length === 0) {
29479
+ const path36 = ref.slice(1).split("/").filter(Boolean);
29480
+ if (path36.length === 0) {
29433
29481
  return ctx.rootSchema;
29434
29482
  }
29435
29483
  const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
29436
- if (path35[0] === defsKey) {
29437
- const key = path35[1];
29484
+ if (path36[0] === defsKey) {
29485
+ const key = path36[1];
29438
29486
  if (!key || !ctx.defs[key]) {
29439
29487
  throw new Error(`Reference not found: ${ref}`);
29440
29488
  }
@@ -34176,7 +34224,7 @@ var init_readdirp = __esm({
34176
34224
  this._directoryFilter = normalizeFilter(opts.directoryFilter);
34177
34225
  const statMethod = opts.lstat ? import_promises.lstat : import_promises.stat;
34178
34226
  if (wantBigintFsStats) {
34179
- this._stat = (path35) => statMethod(path35, { bigint: true });
34227
+ this._stat = (path36) => statMethod(path36, { bigint: true });
34180
34228
  } else {
34181
34229
  this._stat = statMethod;
34182
34230
  }
@@ -34201,8 +34249,8 @@ var init_readdirp = __esm({
34201
34249
  const par = this.parent;
34202
34250
  const fil = par && par.files;
34203
34251
  if (fil && fil.length > 0) {
34204
- const { path: path35, depth } = par;
34205
- const slice = fil.splice(0, batch).map((dirent) => this._formatEntry(dirent, path35));
34252
+ const { path: path36, depth } = par;
34253
+ const slice = fil.splice(0, batch).map((dirent) => this._formatEntry(dirent, path36));
34206
34254
  const awaited = await Promise.all(slice);
34207
34255
  for (const entry of awaited) {
34208
34256
  if (!entry)
@@ -34242,20 +34290,20 @@ var init_readdirp = __esm({
34242
34290
  this.reading = false;
34243
34291
  }
34244
34292
  }
34245
- async _exploreDir(path35, depth) {
34293
+ async _exploreDir(path36, depth) {
34246
34294
  let files;
34247
34295
  try {
34248
- files = await (0, import_promises.readdir)(path35, this._rdOptions);
34296
+ files = await (0, import_promises.readdir)(path36, this._rdOptions);
34249
34297
  } catch (error48) {
34250
34298
  this._onError(error48);
34251
34299
  }
34252
- return { files, depth, path: path35 };
34300
+ return { files, depth, path: path36 };
34253
34301
  }
34254
- async _formatEntry(dirent, path35) {
34302
+ async _formatEntry(dirent, path36) {
34255
34303
  let entry;
34256
34304
  const basename10 = this._isDirent ? dirent.name : dirent;
34257
34305
  try {
34258
- const fullPath = (0, import_node_path.resolve)((0, import_node_path.join)(path35, basename10));
34306
+ const fullPath = (0, import_node_path.resolve)((0, import_node_path.join)(path36, basename10));
34259
34307
  entry = { path: (0, import_node_path.relative)(this._root, fullPath), fullPath, basename: basename10 };
34260
34308
  entry[this._statsProp] = this._isDirent ? dirent : await this._stat(fullPath);
34261
34309
  } catch (err) {
@@ -34312,16 +34360,16 @@ var init_readdirp = __esm({
34312
34360
  });
34313
34361
 
34314
34362
  // ../../oss/packages/daemon-core/node_modules/chokidar/handler.js
34315
- function createFsWatchInstance(path35, options, listener, errHandler, emitRaw) {
34363
+ function createFsWatchInstance(path36, options, listener, errHandler, emitRaw) {
34316
34364
  const handleEvent = (rawEvent, evPath) => {
34317
- listener(path35);
34318
- emitRaw(rawEvent, evPath, { watchedPath: path35 });
34319
- if (evPath && path35 !== evPath) {
34320
- fsWatchBroadcast(sp.resolve(path35, evPath), KEY_LISTENERS, sp.join(path35, evPath));
34365
+ listener(path36);
34366
+ emitRaw(rawEvent, evPath, { watchedPath: path36 });
34367
+ if (evPath && path36 !== evPath) {
34368
+ fsWatchBroadcast(sp.resolve(path36, evPath), KEY_LISTENERS, sp.join(path36, evPath));
34321
34369
  }
34322
34370
  };
34323
34371
  try {
34324
- return (0, import_node_fs.watch)(path35, {
34372
+ return (0, import_node_fs.watch)(path36, {
34325
34373
  persistent: options.persistent
34326
34374
  }, handleEvent);
34327
34375
  } catch (error48) {
@@ -34670,12 +34718,12 @@ var init_handler2 = __esm({
34670
34718
  listener(val1, val2, val3);
34671
34719
  });
34672
34720
  };
34673
- setFsWatchListener = (path35, fullPath, options, handlers) => {
34721
+ setFsWatchListener = (path36, fullPath, options, handlers) => {
34674
34722
  const { listener, errHandler, rawEmitter } = handlers;
34675
34723
  let cont = FsWatchInstances.get(fullPath);
34676
34724
  let watcher;
34677
34725
  if (!options.persistent) {
34678
- watcher = createFsWatchInstance(path35, options, listener, errHandler, rawEmitter);
34726
+ watcher = createFsWatchInstance(path36, options, listener, errHandler, rawEmitter);
34679
34727
  if (!watcher)
34680
34728
  return;
34681
34729
  return watcher.close.bind(watcher);
@@ -34686,7 +34734,7 @@ var init_handler2 = __esm({
34686
34734
  addAndConvert(cont, KEY_RAW, rawEmitter);
34687
34735
  } else {
34688
34736
  watcher = createFsWatchInstance(
34689
- path35,
34737
+ path36,
34690
34738
  options,
34691
34739
  fsWatchBroadcast.bind(null, fullPath, KEY_LISTENERS),
34692
34740
  errHandler,
@@ -34701,7 +34749,7 @@ var init_handler2 = __esm({
34701
34749
  cont.watcherUnusable = true;
34702
34750
  if (isWindows && error48.code === "EPERM") {
34703
34751
  try {
34704
- const fd = await (0, import_promises2.open)(path35, "r");
34752
+ const fd = await (0, import_promises2.open)(path36, "r");
34705
34753
  await fd.close();
34706
34754
  broadcastErr(error48);
34707
34755
  } catch (err) {
@@ -34732,7 +34780,7 @@ var init_handler2 = __esm({
34732
34780
  };
34733
34781
  };
34734
34782
  FsWatchFileInstances = /* @__PURE__ */ new Map();
34735
- setFsWatchFileListener = (path35, fullPath, options, handlers) => {
34783
+ setFsWatchFileListener = (path36, fullPath, options, handlers) => {
34736
34784
  const { listener, rawEmitter } = handlers;
34737
34785
  let cont = FsWatchFileInstances.get(fullPath);
34738
34786
  const copts = cont && cont.options;
@@ -34754,7 +34802,7 @@ var init_handler2 = __esm({
34754
34802
  });
34755
34803
  const currmtime = curr.mtimeMs;
34756
34804
  if (curr.size !== prev.size || currmtime > prev.mtimeMs || currmtime === 0) {
34757
- foreach(cont.listeners, (listener2) => listener2(path35, curr));
34805
+ foreach(cont.listeners, (listener2) => listener2(path36, curr));
34758
34806
  }
34759
34807
  })
34760
34808
  };
@@ -34784,13 +34832,13 @@ var init_handler2 = __esm({
34784
34832
  * @param listener on fs change
34785
34833
  * @returns closer for the watcher instance
34786
34834
  */
34787
- _watchWithNodeFs(path35, listener) {
34835
+ _watchWithNodeFs(path36, listener) {
34788
34836
  const opts = this.fsw.options;
34789
- const directory = sp.dirname(path35);
34790
- const basename10 = sp.basename(path35);
34837
+ const directory = sp.dirname(path36);
34838
+ const basename10 = sp.basename(path36);
34791
34839
  const parent = this.fsw._getWatchedDir(directory);
34792
34840
  parent.add(basename10);
34793
- const absolutePath = sp.resolve(path35);
34841
+ const absolutePath = sp.resolve(path36);
34794
34842
  const options = {
34795
34843
  persistent: opts.persistent
34796
34844
  };
@@ -34800,12 +34848,12 @@ var init_handler2 = __esm({
34800
34848
  if (opts.usePolling) {
34801
34849
  const enableBin = opts.interval !== opts.binaryInterval;
34802
34850
  options.interval = enableBin && isBinaryPath(basename10) ? opts.binaryInterval : opts.interval;
34803
- closer = setFsWatchFileListener(path35, absolutePath, options, {
34851
+ closer = setFsWatchFileListener(path36, absolutePath, options, {
34804
34852
  listener,
34805
34853
  rawEmitter: this.fsw._emitRaw
34806
34854
  });
34807
34855
  } else {
34808
- closer = setFsWatchListener(path35, absolutePath, options, {
34856
+ closer = setFsWatchListener(path36, absolutePath, options, {
34809
34857
  listener,
34810
34858
  errHandler: this._boundHandleError,
34811
34859
  rawEmitter: this.fsw._emitRaw
@@ -34827,7 +34875,7 @@ var init_handler2 = __esm({
34827
34875
  let prevStats = stats;
34828
34876
  if (parent.has(basename10))
34829
34877
  return;
34830
- const listener = async (path35, newStats) => {
34878
+ const listener = async (path36, newStats) => {
34831
34879
  if (!this.fsw._throttle(THROTTLE_MODE_WATCH, file2, 5))
34832
34880
  return;
34833
34881
  if (!newStats || newStats.mtimeMs === 0) {
@@ -34841,11 +34889,11 @@ var init_handler2 = __esm({
34841
34889
  this.fsw._emit(EV.CHANGE, file2, newStats2);
34842
34890
  }
34843
34891
  if ((isMacos || isLinux || isFreeBSD) && prevStats.ino !== newStats2.ino) {
34844
- this.fsw._closeFile(path35);
34892
+ this.fsw._closeFile(path36);
34845
34893
  prevStats = newStats2;
34846
34894
  const closer2 = this._watchWithNodeFs(file2, listener);
34847
34895
  if (closer2)
34848
- this.fsw._addPathCloser(path35, closer2);
34896
+ this.fsw._addPathCloser(path36, closer2);
34849
34897
  } else {
34850
34898
  prevStats = newStats2;
34851
34899
  }
@@ -34877,7 +34925,7 @@ var init_handler2 = __esm({
34877
34925
  * @param item basename of this item
34878
34926
  * @returns true if no more processing is needed for this entry.
34879
34927
  */
34880
- async _handleSymlink(entry, directory, path35, item) {
34928
+ async _handleSymlink(entry, directory, path36, item) {
34881
34929
  if (this.fsw.closed) {
34882
34930
  return;
34883
34931
  }
@@ -34887,7 +34935,7 @@ var init_handler2 = __esm({
34887
34935
  this.fsw._incrReadyCount();
34888
34936
  let linkPath;
34889
34937
  try {
34890
- linkPath = await (0, import_promises2.realpath)(path35);
34938
+ linkPath = await (0, import_promises2.realpath)(path36);
34891
34939
  } catch (e) {
34892
34940
  this.fsw._emitReady();
34893
34941
  return true;
@@ -34897,12 +34945,12 @@ var init_handler2 = __esm({
34897
34945
  if (dir.has(item)) {
34898
34946
  if (this.fsw._symlinkPaths.get(full) !== linkPath) {
34899
34947
  this.fsw._symlinkPaths.set(full, linkPath);
34900
- this.fsw._emit(EV.CHANGE, path35, entry.stats);
34948
+ this.fsw._emit(EV.CHANGE, path36, entry.stats);
34901
34949
  }
34902
34950
  } else {
34903
34951
  dir.add(item);
34904
34952
  this.fsw._symlinkPaths.set(full, linkPath);
34905
- this.fsw._emit(EV.ADD, path35, entry.stats);
34953
+ this.fsw._emit(EV.ADD, path36, entry.stats);
34906
34954
  }
34907
34955
  this.fsw._emitReady();
34908
34956
  return true;
@@ -34932,9 +34980,9 @@ var init_handler2 = __esm({
34932
34980
  return;
34933
34981
  }
34934
34982
  const item = entry.path;
34935
- let path35 = sp.join(directory, item);
34983
+ let path36 = sp.join(directory, item);
34936
34984
  current.add(item);
34937
- if (entry.stats.isSymbolicLink() && await this._handleSymlink(entry, directory, path35, item)) {
34985
+ if (entry.stats.isSymbolicLink() && await this._handleSymlink(entry, directory, path36, item)) {
34938
34986
  return;
34939
34987
  }
34940
34988
  if (this.fsw.closed) {
@@ -34943,8 +34991,8 @@ var init_handler2 = __esm({
34943
34991
  }
34944
34992
  if (item === target || !target && !previous.has(item)) {
34945
34993
  this.fsw._incrReadyCount();
34946
- path35 = sp.join(dir, sp.relative(dir, path35));
34947
- this._addToNodeFs(path35, initialAdd, wh, depth + 1);
34994
+ path36 = sp.join(dir, sp.relative(dir, path36));
34995
+ this._addToNodeFs(path36, initialAdd, wh, depth + 1);
34948
34996
  }
34949
34997
  }).on(EV.ERROR, this._boundHandleError);
34950
34998
  return new Promise((resolve18, reject) => {
@@ -35013,13 +35061,13 @@ var init_handler2 = __esm({
35013
35061
  * @param depth Child path actually targeted for watch
35014
35062
  * @param target Child path actually targeted for watch
35015
35063
  */
35016
- async _addToNodeFs(path35, initialAdd, priorWh, depth, target) {
35064
+ async _addToNodeFs(path36, initialAdd, priorWh, depth, target) {
35017
35065
  const ready = this.fsw._emitReady;
35018
- if (this.fsw._isIgnored(path35) || this.fsw.closed) {
35066
+ if (this.fsw._isIgnored(path36) || this.fsw.closed) {
35019
35067
  ready();
35020
35068
  return false;
35021
35069
  }
35022
- const wh = this.fsw._getWatchHelpers(path35);
35070
+ const wh = this.fsw._getWatchHelpers(path36);
35023
35071
  if (priorWh) {
35024
35072
  wh.filterPath = (entry) => priorWh.filterPath(entry);
35025
35073
  wh.filterDir = (entry) => priorWh.filterDir(entry);
@@ -35035,8 +35083,8 @@ var init_handler2 = __esm({
35035
35083
  const follow = this.fsw.options.followSymlinks;
35036
35084
  let closer;
35037
35085
  if (stats.isDirectory()) {
35038
- const absPath = sp.resolve(path35);
35039
- const targetPath = follow ? await (0, import_promises2.realpath)(path35) : path35;
35086
+ const absPath = sp.resolve(path36);
35087
+ const targetPath = follow ? await (0, import_promises2.realpath)(path36) : path36;
35040
35088
  if (this.fsw.closed)
35041
35089
  return;
35042
35090
  closer = await this._handleDir(wh.watchPath, stats, initialAdd, depth, target, wh, targetPath);
@@ -35046,29 +35094,29 @@ var init_handler2 = __esm({
35046
35094
  this.fsw._symlinkPaths.set(absPath, targetPath);
35047
35095
  }
35048
35096
  } else if (stats.isSymbolicLink()) {
35049
- const targetPath = follow ? await (0, import_promises2.realpath)(path35) : path35;
35097
+ const targetPath = follow ? await (0, import_promises2.realpath)(path36) : path36;
35050
35098
  if (this.fsw.closed)
35051
35099
  return;
35052
35100
  const parent = sp.dirname(wh.watchPath);
35053
35101
  this.fsw._getWatchedDir(parent).add(wh.watchPath);
35054
35102
  this.fsw._emit(EV.ADD, wh.watchPath, stats);
35055
- closer = await this._handleDir(parent, stats, initialAdd, depth, path35, wh, targetPath);
35103
+ closer = await this._handleDir(parent, stats, initialAdd, depth, path36, wh, targetPath);
35056
35104
  if (this.fsw.closed)
35057
35105
  return;
35058
35106
  if (targetPath !== void 0) {
35059
- this.fsw._symlinkPaths.set(sp.resolve(path35), targetPath);
35107
+ this.fsw._symlinkPaths.set(sp.resolve(path36), targetPath);
35060
35108
  }
35061
35109
  } else {
35062
35110
  closer = this._handleFile(wh.watchPath, stats, initialAdd);
35063
35111
  }
35064
35112
  ready();
35065
35113
  if (closer)
35066
- this.fsw._addPathCloser(path35, closer);
35114
+ this.fsw._addPathCloser(path36, closer);
35067
35115
  return false;
35068
35116
  } catch (error48) {
35069
35117
  if (this.fsw._handleError(error48)) {
35070
35118
  ready();
35071
- return path35;
35119
+ return path36;
35072
35120
  }
35073
35121
  }
35074
35122
  }
@@ -35103,24 +35151,24 @@ function createPattern(matcher) {
35103
35151
  }
35104
35152
  return () => false;
35105
35153
  }
35106
- function normalizePath(path35) {
35107
- if (typeof path35 !== "string")
35154
+ function normalizePath(path36) {
35155
+ if (typeof path36 !== "string")
35108
35156
  throw new Error("string expected");
35109
- path35 = sp2.normalize(path35);
35110
- path35 = path35.replace(/\\/g, "/");
35157
+ path36 = sp2.normalize(path36);
35158
+ path36 = path36.replace(/\\/g, "/");
35111
35159
  let prepend = false;
35112
- if (path35.startsWith("//"))
35160
+ if (path36.startsWith("//"))
35113
35161
  prepend = true;
35114
- path35 = path35.replace(DOUBLE_SLASH_RE, "/");
35162
+ path36 = path36.replace(DOUBLE_SLASH_RE, "/");
35115
35163
  if (prepend)
35116
- path35 = "/" + path35;
35117
- return path35;
35164
+ path36 = "/" + path36;
35165
+ return path36;
35118
35166
  }
35119
35167
  function matchPatterns(patterns, testString, stats) {
35120
- const path35 = normalizePath(testString);
35168
+ const path36 = normalizePath(testString);
35121
35169
  for (let index = 0; index < patterns.length; index++) {
35122
35170
  const pattern = patterns[index];
35123
- if (pattern(path35, stats)) {
35171
+ if (pattern(path36, stats)) {
35124
35172
  return true;
35125
35173
  }
35126
35174
  }
@@ -35183,19 +35231,19 @@ var init_chokidar = __esm({
35183
35231
  }
35184
35232
  return str;
35185
35233
  };
35186
- normalizePathToUnix = (path35) => toUnix(sp2.normalize(toUnix(path35)));
35187
- normalizeIgnored = (cwd = "") => (path35) => {
35188
- if (typeof path35 === "string") {
35189
- return normalizePathToUnix(sp2.isAbsolute(path35) ? path35 : sp2.join(cwd, path35));
35234
+ normalizePathToUnix = (path36) => toUnix(sp2.normalize(toUnix(path36)));
35235
+ normalizeIgnored = (cwd = "") => (path36) => {
35236
+ if (typeof path36 === "string") {
35237
+ return normalizePathToUnix(sp2.isAbsolute(path36) ? path36 : sp2.join(cwd, path36));
35190
35238
  } else {
35191
- return path35;
35239
+ return path36;
35192
35240
  }
35193
35241
  };
35194
- getAbsolutePath = (path35, cwd) => {
35195
- if (sp2.isAbsolute(path35)) {
35196
- return path35;
35242
+ getAbsolutePath = (path36, cwd) => {
35243
+ if (sp2.isAbsolute(path36)) {
35244
+ return path36;
35197
35245
  }
35198
- return sp2.join(cwd, path35);
35246
+ return sp2.join(cwd, path36);
35199
35247
  };
35200
35248
  EMPTY_SET = Object.freeze(/* @__PURE__ */ new Set());
35201
35249
  DirEntry = class {
@@ -35260,10 +35308,10 @@ var init_chokidar = __esm({
35260
35308
  dirParts;
35261
35309
  followSymlinks;
35262
35310
  statMethod;
35263
- constructor(path35, follow, fsw) {
35311
+ constructor(path36, follow, fsw) {
35264
35312
  this.fsw = fsw;
35265
- const watchPath = path35;
35266
- this.path = path35 = path35.replace(REPLACER_RE, "");
35313
+ const watchPath = path36;
35314
+ this.path = path36 = path36.replace(REPLACER_RE, "");
35267
35315
  this.watchPath = watchPath;
35268
35316
  this.fullWatchPath = sp2.resolve(watchPath);
35269
35317
  this.dirParts = [];
@@ -35403,20 +35451,20 @@ var init_chokidar = __esm({
35403
35451
  this._closePromise = void 0;
35404
35452
  let paths = unifyPaths(paths_);
35405
35453
  if (cwd) {
35406
- paths = paths.map((path35) => {
35407
- const absPath = getAbsolutePath(path35, cwd);
35454
+ paths = paths.map((path36) => {
35455
+ const absPath = getAbsolutePath(path36, cwd);
35408
35456
  return absPath;
35409
35457
  });
35410
35458
  }
35411
- paths.forEach((path35) => {
35412
- this._removeIgnoredPath(path35);
35459
+ paths.forEach((path36) => {
35460
+ this._removeIgnoredPath(path36);
35413
35461
  });
35414
35462
  this._userIgnored = void 0;
35415
35463
  if (!this._readyCount)
35416
35464
  this._readyCount = 0;
35417
35465
  this._readyCount += paths.length;
35418
- Promise.all(paths.map(async (path35) => {
35419
- const res = await this._nodeFsHandler._addToNodeFs(path35, !_internal, void 0, 0, _origAdd);
35466
+ Promise.all(paths.map(async (path36) => {
35467
+ const res = await this._nodeFsHandler._addToNodeFs(path36, !_internal, void 0, 0, _origAdd);
35420
35468
  if (res)
35421
35469
  this._emitReady();
35422
35470
  return res;
@@ -35438,17 +35486,17 @@ var init_chokidar = __esm({
35438
35486
  return this;
35439
35487
  const paths = unifyPaths(paths_);
35440
35488
  const { cwd } = this.options;
35441
- paths.forEach((path35) => {
35442
- if (!sp2.isAbsolute(path35) && !this._closers.has(path35)) {
35489
+ paths.forEach((path36) => {
35490
+ if (!sp2.isAbsolute(path36) && !this._closers.has(path36)) {
35443
35491
  if (cwd)
35444
- path35 = sp2.join(cwd, path35);
35445
- path35 = sp2.resolve(path35);
35492
+ path36 = sp2.join(cwd, path36);
35493
+ path36 = sp2.resolve(path36);
35446
35494
  }
35447
- this._closePath(path35);
35448
- this._addIgnoredPath(path35);
35449
- if (this._watched.has(path35)) {
35495
+ this._closePath(path36);
35496
+ this._addIgnoredPath(path36);
35497
+ if (this._watched.has(path36)) {
35450
35498
  this._addIgnoredPath({
35451
- path: path35,
35499
+ path: path36,
35452
35500
  recursive: true
35453
35501
  });
35454
35502
  }
@@ -35512,38 +35560,38 @@ var init_chokidar = __esm({
35512
35560
  * @param stats arguments to be passed with event
35513
35561
  * @returns the error if defined, otherwise the value of the FSWatcher instance's `closed` flag
35514
35562
  */
35515
- async _emit(event, path35, stats) {
35563
+ async _emit(event, path36, stats) {
35516
35564
  if (this.closed)
35517
35565
  return;
35518
35566
  const opts = this.options;
35519
35567
  if (isWindows)
35520
- path35 = sp2.normalize(path35);
35568
+ path36 = sp2.normalize(path36);
35521
35569
  if (opts.cwd)
35522
- path35 = sp2.relative(opts.cwd, path35);
35523
- const args = [path35];
35570
+ path36 = sp2.relative(opts.cwd, path36);
35571
+ const args = [path36];
35524
35572
  if (stats != null)
35525
35573
  args.push(stats);
35526
35574
  const awf = opts.awaitWriteFinish;
35527
35575
  let pw;
35528
- if (awf && (pw = this._pendingWrites.get(path35))) {
35576
+ if (awf && (pw = this._pendingWrites.get(path36))) {
35529
35577
  pw.lastChange = /* @__PURE__ */ new Date();
35530
35578
  return this;
35531
35579
  }
35532
35580
  if (opts.atomic) {
35533
35581
  if (event === EVENTS.UNLINK) {
35534
- this._pendingUnlinks.set(path35, [event, ...args]);
35582
+ this._pendingUnlinks.set(path36, [event, ...args]);
35535
35583
  setTimeout(() => {
35536
- this._pendingUnlinks.forEach((entry, path36) => {
35584
+ this._pendingUnlinks.forEach((entry, path37) => {
35537
35585
  this.emit(...entry);
35538
35586
  this.emit(EVENTS.ALL, ...entry);
35539
- this._pendingUnlinks.delete(path36);
35587
+ this._pendingUnlinks.delete(path37);
35540
35588
  });
35541
35589
  }, typeof opts.atomic === "number" ? opts.atomic : 100);
35542
35590
  return this;
35543
35591
  }
35544
- if (event === EVENTS.ADD && this._pendingUnlinks.has(path35)) {
35592
+ if (event === EVENTS.ADD && this._pendingUnlinks.has(path36)) {
35545
35593
  event = EVENTS.CHANGE;
35546
- this._pendingUnlinks.delete(path35);
35594
+ this._pendingUnlinks.delete(path36);
35547
35595
  }
35548
35596
  }
35549
35597
  if (awf && (event === EVENTS.ADD || event === EVENTS.CHANGE) && this._readyEmitted) {
@@ -35561,16 +35609,16 @@ var init_chokidar = __esm({
35561
35609
  this.emitWithAll(event, args);
35562
35610
  }
35563
35611
  };
35564
- this._awaitWriteFinish(path35, awf.stabilityThreshold, event, awfEmit);
35612
+ this._awaitWriteFinish(path36, awf.stabilityThreshold, event, awfEmit);
35565
35613
  return this;
35566
35614
  }
35567
35615
  if (event === EVENTS.CHANGE) {
35568
- const isThrottled = !this._throttle(EVENTS.CHANGE, path35, 50);
35616
+ const isThrottled = !this._throttle(EVENTS.CHANGE, path36, 50);
35569
35617
  if (isThrottled)
35570
35618
  return this;
35571
35619
  }
35572
35620
  if (opts.alwaysStat && stats === void 0 && (event === EVENTS.ADD || event === EVENTS.ADD_DIR || event === EVENTS.CHANGE)) {
35573
- const fullPath = opts.cwd ? sp2.join(opts.cwd, path35) : path35;
35621
+ const fullPath = opts.cwd ? sp2.join(opts.cwd, path36) : path36;
35574
35622
  let stats2;
35575
35623
  try {
35576
35624
  stats2 = await (0, import_promises3.stat)(fullPath);
@@ -35601,23 +35649,23 @@ var init_chokidar = __esm({
35601
35649
  * @param timeout duration of time to suppress duplicate actions
35602
35650
  * @returns tracking object or false if action should be suppressed
35603
35651
  */
35604
- _throttle(actionType, path35, timeout) {
35652
+ _throttle(actionType, path36, timeout) {
35605
35653
  if (!this._throttled.has(actionType)) {
35606
35654
  this._throttled.set(actionType, /* @__PURE__ */ new Map());
35607
35655
  }
35608
35656
  const action = this._throttled.get(actionType);
35609
35657
  if (!action)
35610
35658
  throw new Error("invalid throttle");
35611
- const actionPath = action.get(path35);
35659
+ const actionPath = action.get(path36);
35612
35660
  if (actionPath) {
35613
35661
  actionPath.count++;
35614
35662
  return false;
35615
35663
  }
35616
35664
  let timeoutObject;
35617
35665
  const clear = () => {
35618
- const item = action.get(path35);
35666
+ const item = action.get(path36);
35619
35667
  const count = item ? item.count : 0;
35620
- action.delete(path35);
35668
+ action.delete(path36);
35621
35669
  clearTimeout(timeoutObject);
35622
35670
  if (item)
35623
35671
  clearTimeout(item.timeoutObject);
@@ -35625,7 +35673,7 @@ var init_chokidar = __esm({
35625
35673
  };
35626
35674
  timeoutObject = setTimeout(clear, timeout);
35627
35675
  const thr = { timeoutObject, clear, count: 0 };
35628
- action.set(path35, thr);
35676
+ action.set(path36, thr);
35629
35677
  return thr;
35630
35678
  }
35631
35679
  _incrReadyCount() {
@@ -35639,44 +35687,44 @@ var init_chokidar = __esm({
35639
35687
  * @param event
35640
35688
  * @param awfEmit Callback to be called when ready for event to be emitted.
35641
35689
  */
35642
- _awaitWriteFinish(path35, threshold, event, awfEmit) {
35690
+ _awaitWriteFinish(path36, threshold, event, awfEmit) {
35643
35691
  const awf = this.options.awaitWriteFinish;
35644
35692
  if (typeof awf !== "object")
35645
35693
  return;
35646
35694
  const pollInterval = awf.pollInterval;
35647
35695
  let timeoutHandler;
35648
- let fullPath = path35;
35649
- if (this.options.cwd && !sp2.isAbsolute(path35)) {
35650
- fullPath = sp2.join(this.options.cwd, path35);
35696
+ let fullPath = path36;
35697
+ if (this.options.cwd && !sp2.isAbsolute(path36)) {
35698
+ fullPath = sp2.join(this.options.cwd, path36);
35651
35699
  }
35652
35700
  const now = /* @__PURE__ */ new Date();
35653
35701
  const writes = this._pendingWrites;
35654
35702
  function awaitWriteFinishFn(prevStat) {
35655
35703
  (0, import_node_fs2.stat)(fullPath, (err, curStat) => {
35656
- if (err || !writes.has(path35)) {
35704
+ if (err || !writes.has(path36)) {
35657
35705
  if (err && err.code !== "ENOENT")
35658
35706
  awfEmit(err);
35659
35707
  return;
35660
35708
  }
35661
35709
  const now2 = Number(/* @__PURE__ */ new Date());
35662
35710
  if (prevStat && curStat.size !== prevStat.size) {
35663
- writes.get(path35).lastChange = now2;
35711
+ writes.get(path36).lastChange = now2;
35664
35712
  }
35665
- const pw = writes.get(path35);
35713
+ const pw = writes.get(path36);
35666
35714
  const df = now2 - pw.lastChange;
35667
35715
  if (df >= threshold) {
35668
- writes.delete(path35);
35716
+ writes.delete(path36);
35669
35717
  awfEmit(void 0, curStat);
35670
35718
  } else {
35671
35719
  timeoutHandler = setTimeout(awaitWriteFinishFn, pollInterval, curStat);
35672
35720
  }
35673
35721
  });
35674
35722
  }
35675
- if (!writes.has(path35)) {
35676
- writes.set(path35, {
35723
+ if (!writes.has(path36)) {
35724
+ writes.set(path36, {
35677
35725
  lastChange: now,
35678
35726
  cancelWait: () => {
35679
- writes.delete(path35);
35727
+ writes.delete(path36);
35680
35728
  clearTimeout(timeoutHandler);
35681
35729
  return event;
35682
35730
  }
@@ -35687,8 +35735,8 @@ var init_chokidar = __esm({
35687
35735
  /**
35688
35736
  * Determines whether user has asked to ignore this path.
35689
35737
  */
35690
- _isIgnored(path35, stats) {
35691
- if (this.options.atomic && DOT_RE.test(path35))
35738
+ _isIgnored(path36, stats) {
35739
+ if (this.options.atomic && DOT_RE.test(path36))
35692
35740
  return true;
35693
35741
  if (!this._userIgnored) {
35694
35742
  const { cwd } = this.options;
@@ -35698,17 +35746,17 @@ var init_chokidar = __esm({
35698
35746
  const list = [...ignoredPaths.map(normalizeIgnored(cwd)), ...ignored];
35699
35747
  this._userIgnored = anymatch(list, void 0);
35700
35748
  }
35701
- return this._userIgnored(path35, stats);
35749
+ return this._userIgnored(path36, stats);
35702
35750
  }
35703
- _isntIgnored(path35, stat4) {
35704
- return !this._isIgnored(path35, stat4);
35751
+ _isntIgnored(path36, stat4) {
35752
+ return !this._isIgnored(path36, stat4);
35705
35753
  }
35706
35754
  /**
35707
35755
  * Provides a set of common helpers and properties relating to symlink handling.
35708
35756
  * @param path file or directory pattern being watched
35709
35757
  */
35710
- _getWatchHelpers(path35) {
35711
- return new WatchHelper(path35, this.options.followSymlinks, this);
35758
+ _getWatchHelpers(path36) {
35759
+ return new WatchHelper(path36, this.options.followSymlinks, this);
35712
35760
  }
35713
35761
  // Directory helpers
35714
35762
  // -----------------
@@ -35740,63 +35788,63 @@ var init_chokidar = __esm({
35740
35788
  * @param item base path of item/directory
35741
35789
  */
35742
35790
  _remove(directory, item, isDirectory) {
35743
- const path35 = sp2.join(directory, item);
35744
- const fullPath = sp2.resolve(path35);
35745
- isDirectory = isDirectory != null ? isDirectory : this._watched.has(path35) || this._watched.has(fullPath);
35746
- if (!this._throttle("remove", path35, 100))
35791
+ const path36 = sp2.join(directory, item);
35792
+ const fullPath = sp2.resolve(path36);
35793
+ isDirectory = isDirectory != null ? isDirectory : this._watched.has(path36) || this._watched.has(fullPath);
35794
+ if (!this._throttle("remove", path36, 100))
35747
35795
  return;
35748
35796
  if (!isDirectory && this._watched.size === 1) {
35749
35797
  this.add(directory, item, true);
35750
35798
  }
35751
- const wp = this._getWatchedDir(path35);
35799
+ const wp = this._getWatchedDir(path36);
35752
35800
  const nestedDirectoryChildren = wp.getChildren();
35753
- nestedDirectoryChildren.forEach((nested) => this._remove(path35, nested));
35801
+ nestedDirectoryChildren.forEach((nested) => this._remove(path36, nested));
35754
35802
  const parent = this._getWatchedDir(directory);
35755
35803
  const wasTracked = parent.has(item);
35756
35804
  parent.remove(item);
35757
35805
  if (this._symlinkPaths.has(fullPath)) {
35758
35806
  this._symlinkPaths.delete(fullPath);
35759
35807
  }
35760
- let relPath = path35;
35808
+ let relPath = path36;
35761
35809
  if (this.options.cwd)
35762
- relPath = sp2.relative(this.options.cwd, path35);
35810
+ relPath = sp2.relative(this.options.cwd, path36);
35763
35811
  if (this.options.awaitWriteFinish && this._pendingWrites.has(relPath)) {
35764
35812
  const event = this._pendingWrites.get(relPath).cancelWait();
35765
35813
  if (event === EVENTS.ADD)
35766
35814
  return;
35767
35815
  }
35768
- this._watched.delete(path35);
35816
+ this._watched.delete(path36);
35769
35817
  this._watched.delete(fullPath);
35770
35818
  const eventName = isDirectory ? EVENTS.UNLINK_DIR : EVENTS.UNLINK;
35771
- if (wasTracked && !this._isIgnored(path35))
35772
- this._emit(eventName, path35);
35773
- this._closePath(path35);
35819
+ if (wasTracked && !this._isIgnored(path36))
35820
+ this._emit(eventName, path36);
35821
+ this._closePath(path36);
35774
35822
  }
35775
35823
  /**
35776
35824
  * Closes all watchers for a path
35777
35825
  */
35778
- _closePath(path35) {
35779
- this._closeFile(path35);
35780
- const dir = sp2.dirname(path35);
35781
- this._getWatchedDir(dir).remove(sp2.basename(path35));
35826
+ _closePath(path36) {
35827
+ this._closeFile(path36);
35828
+ const dir = sp2.dirname(path36);
35829
+ this._getWatchedDir(dir).remove(sp2.basename(path36));
35782
35830
  }
35783
35831
  /**
35784
35832
  * Closes only file-specific watchers
35785
35833
  */
35786
- _closeFile(path35) {
35787
- const closers = this._closers.get(path35);
35834
+ _closeFile(path36) {
35835
+ const closers = this._closers.get(path36);
35788
35836
  if (!closers)
35789
35837
  return;
35790
35838
  closers.forEach((closer) => closer());
35791
- this._closers.delete(path35);
35839
+ this._closers.delete(path36);
35792
35840
  }
35793
- _addPathCloser(path35, closer) {
35841
+ _addPathCloser(path36, closer) {
35794
35842
  if (!closer)
35795
35843
  return;
35796
- let list = this._closers.get(path35);
35844
+ let list = this._closers.get(path36);
35797
35845
  if (!list) {
35798
35846
  list = [];
35799
- this._closers.set(path35, list);
35847
+ this._closers.set(path36, list);
35800
35848
  }
35801
35849
  list.push(closer);
35802
35850
  }
@@ -40933,6 +40981,9 @@ function projectHotChatSessionStatesFromProviderState(state) {
40933
40981
  const project = (item) => ({
40934
40982
  id: item.instanceId,
40935
40983
  status: item.activeChat?.status || item.status,
40984
+ unread: item.unread,
40985
+ inboxBucket: item.inboxBucket,
40986
+ lastMessageAt: item.lastMessageAt ?? item.activeChat?.lastMessageAt,
40936
40987
  runtimeLifecycle: item.runtime?.lifecycle ?? null,
40937
40988
  runtimeSurfaceKind: item.runtime?.surfaceKind,
40938
40989
  runtimeRestoredFromStorage: item.runtime?.restoredFromStorage === true,
@@ -41145,6 +41196,17 @@ var init_provider_instance_manager = __esm({
41145
41196
  }
41146
41197
  return updated;
41147
41198
  }
41199
+ refreshProviderDefinitions(resolveProvider) {
41200
+ let refreshed = 0;
41201
+ for (const instance of this.instances.values()) {
41202
+ if (typeof instance.refreshProviderDefinition !== "function") continue;
41203
+ const provider = resolveProvider(instance.type);
41204
+ if (!provider || typeof provider !== "object") continue;
41205
+ instance.refreshProviderDefinition(provider);
41206
+ refreshed += 1;
41207
+ }
41208
+ return refreshed;
41209
+ }
41148
41210
  // ─── cleanup ──────────────────────────────────────
41149
41211
  /**
41150
41212
  * All terminate
@@ -45157,8 +45219,8 @@ var init_dev_server = __esm({
45157
45219
  }
45158
45220
  getEndpointList() {
45159
45221
  return this.routes.map((r) => {
45160
- const path35 = typeof r.pattern === "string" ? r.pattern : r.pattern.source.replace(/\\\//g, "/").replace(/\(\[.*?\]\+\)/g, ":type").replace(/[\^$]/g, "");
45161
- return `${r.method.padEnd(5)} ${path35}`;
45222
+ const path36 = typeof r.pattern === "string" ? r.pattern : r.pattern.source.replace(/\\\//g, "/").replace(/\(\[.*?\]\+\)/g, ":type").replace(/[\^$]/g, "");
45223
+ return `${r.method.padEnd(5)} ${path36}`;
45162
45224
  });
45163
45225
  }
45164
45226
  async start(port = DEV_SERVER_PORT) {
@@ -45427,20 +45489,7 @@ var init_dev_server = __esm({
45427
45489
  async handleReload(_req, res) {
45428
45490
  try {
45429
45491
  this.providerLoader.reload();
45430
- let refreshedInstances = 0;
45431
- if (this.instanceManager) {
45432
- for (const id of this.instanceManager.listInstanceIds()) {
45433
- const instance = this.instanceManager.getInstance(id);
45434
- const providerType = typeof instance?.type === "string" ? instance.type : "";
45435
- if (!providerType) continue;
45436
- const resolved = this.providerLoader.resolve(providerType);
45437
- if (!resolved) continue;
45438
- if (instance && typeof instance === "object" && "provider" in instance) {
45439
- instance.provider = resolved;
45440
- refreshedInstances += 1;
45441
- }
45442
- }
45443
- }
45492
+ const refreshedInstances = this.instanceManager ? this.instanceManager.refreshProviderDefinitions((providerType) => this.providerLoader.resolve(providerType)) : 0;
45444
45493
  const providers = this.providerLoader.getAll().map((p) => ({
45445
45494
  type: p.type,
45446
45495
  name: p.name,
@@ -59276,15 +59325,15 @@ var require_route = __commonJS({
59276
59325
  };
59277
59326
  }
59278
59327
  function wrapConversion(toModel, graph) {
59279
- const path35 = [graph[toModel].parent, toModel];
59328
+ const path36 = [graph[toModel].parent, toModel];
59280
59329
  let fn = conversions[graph[toModel].parent][toModel];
59281
59330
  let cur = graph[toModel].parent;
59282
59331
  while (graph[cur].parent) {
59283
- path35.unshift(graph[cur].parent);
59332
+ path36.unshift(graph[cur].parent);
59284
59333
  fn = link(conversions[graph[cur].parent][cur], fn);
59285
59334
  cur = graph[cur].parent;
59286
59335
  }
59287
- fn.conversion = path35;
59336
+ fn.conversion = path36;
59288
59337
  return fn;
59289
59338
  }
59290
59339
  module2.exports = function(fromModel) {
@@ -77154,9 +77203,9 @@ var init_prompt = __esm({
77154
77203
  init_utils();
77155
77204
  init_baseUI();
77156
77205
  _ = {
77157
- set: (obj, path35 = "", value) => {
77206
+ set: (obj, path36 = "", value) => {
77158
77207
  let pointer = obj;
77159
- path35.split(".").forEach((key, index, arr) => {
77208
+ path36.split(".").forEach((key, index, arr) => {
77160
77209
  if (key === "__proto__" || key === "constructor") return;
77161
77210
  if (index === arr.length - 1) {
77162
77211
  pointer[key] = value;
@@ -77166,8 +77215,8 @@ var init_prompt = __esm({
77166
77215
  pointer = pointer[key];
77167
77216
  });
77168
77217
  },
77169
- get: (obj, path35 = "", defaultValue) => {
77170
- const travel = (regexp) => String.prototype.split.call(path35, regexp).filter(Boolean).reduce(
77218
+ get: (obj, path36 = "", defaultValue) => {
77219
+ const travel = (regexp) => String.prototype.split.call(path36, regexp).filter(Boolean).reduce(
77171
77220
  // @ts-expect-error implicit any on res[key]
77172
77221
  (res, key) => res !== null && res !== void 0 ? res[key] : res,
77173
77222
  obj
@@ -80685,16 +80734,16 @@ var require_filesystem = __commonJS({
80685
80734
  var LDD_PATH = "/usr/bin/ldd";
80686
80735
  var SELF_PATH = "/proc/self/exe";
80687
80736
  var MAX_LENGTH = 2048;
80688
- var readFileSync20 = (path35) => {
80689
- const fd = fs27.openSync(path35, "r");
80737
+ var readFileSync20 = (path36) => {
80738
+ const fd = fs27.openSync(path36, "r");
80690
80739
  const buffer = Buffer.alloc(MAX_LENGTH);
80691
80740
  const bytesRead = fs27.readSync(fd, buffer, 0, MAX_LENGTH, 0);
80692
80741
  fs27.close(fd, () => {
80693
80742
  });
80694
80743
  return buffer.subarray(0, bytesRead);
80695
80744
  };
80696
- var readFile = (path35) => new Promise((resolve18, reject) => {
80697
- fs27.open(path35, "r", (err, fd) => {
80745
+ var readFile = (path36) => new Promise((resolve18, reject) => {
80746
+ fs27.open(path36, "r", (err, fd) => {
80698
80747
  if (err) {
80699
80748
  reject(err);
80700
80749
  } else {
@@ -80813,11 +80862,11 @@ var require_detect_libc = __commonJS({
80813
80862
  }
80814
80863
  return null;
80815
80864
  };
80816
- var familyFromInterpreterPath = (path35) => {
80817
- if (path35) {
80818
- if (path35.includes("/ld-musl-")) {
80865
+ var familyFromInterpreterPath = (path36) => {
80866
+ if (path36) {
80867
+ if (path36.includes("/ld-musl-")) {
80819
80868
  return MUSL;
80820
- } else if (path35.includes("/ld-linux-")) {
80869
+ } else if (path36.includes("/ld-linux-")) {
80821
80870
  return GLIBC;
80822
80871
  }
80823
80872
  }
@@ -80864,8 +80913,8 @@ var require_detect_libc = __commonJS({
80864
80913
  cachedFamilyInterpreter = null;
80865
80914
  try {
80866
80915
  const selfContent = await readFile(SELF_PATH);
80867
- const path35 = interpreterPath(selfContent);
80868
- cachedFamilyInterpreter = familyFromInterpreterPath(path35);
80916
+ const path36 = interpreterPath(selfContent);
80917
+ cachedFamilyInterpreter = familyFromInterpreterPath(path36);
80869
80918
  } catch (e) {
80870
80919
  }
80871
80920
  return cachedFamilyInterpreter;
@@ -80877,8 +80926,8 @@ var require_detect_libc = __commonJS({
80877
80926
  cachedFamilyInterpreter = null;
80878
80927
  try {
80879
80928
  const selfContent = readFileSync20(SELF_PATH);
80880
- const path35 = interpreterPath(selfContent);
80881
- cachedFamilyInterpreter = familyFromInterpreterPath(path35);
80929
+ const path36 = interpreterPath(selfContent);
80930
+ cachedFamilyInterpreter = familyFromInterpreterPath(path36);
80882
80931
  } catch (e) {
80883
80932
  }
80884
80933
  return cachedFamilyInterpreter;
@@ -82597,18 +82646,18 @@ var require_sharp = __commonJS({
82597
82646
  `@img/sharp-${runtimePlatform}/sharp.node`,
82598
82647
  "@img/sharp-wasm32/sharp.node"
82599
82648
  ];
82600
- var path35;
82649
+ var path36;
82601
82650
  var sharp;
82602
82651
  var errors = [];
82603
- for (path35 of paths) {
82652
+ for (path36 of paths) {
82604
82653
  try {
82605
- sharp = require(path35);
82654
+ sharp = require(path36);
82606
82655
  break;
82607
82656
  } catch (err) {
82608
82657
  errors.push(err);
82609
82658
  }
82610
82659
  }
82611
- if (sharp && path35.startsWith("@img/sharp-linux-x64") && !sharp._isUsingX64V2()) {
82660
+ if (sharp && path36.startsWith("@img/sharp-linux-x64") && !sharp._isUsingX64V2()) {
82612
82661
  const err = new Error("Prebuilt binaries for linux-x64 require v2 microarchitecture");
82613
82662
  err.code = "Unsupported CPU";
82614
82663
  errors.push(err);
@@ -85517,15 +85566,15 @@ var require_color = __commonJS({
85517
85566
  };
85518
85567
  }
85519
85568
  function wrapConversion(toModel, graph) {
85520
- const path35 = [graph[toModel].parent, toModel];
85569
+ const path36 = [graph[toModel].parent, toModel];
85521
85570
  let fn = conversions_default[graph[toModel].parent][toModel];
85522
85571
  let cur = graph[toModel].parent;
85523
85572
  while (graph[cur].parent) {
85524
- path35.unshift(graph[cur].parent);
85573
+ path36.unshift(graph[cur].parent);
85525
85574
  fn = link(conversions_default[graph[cur].parent][cur], fn);
85526
85575
  cur = graph[cur].parent;
85527
85576
  }
85528
- fn.conversion = path35;
85577
+ fn.conversion = path36;
85529
85578
  return fn;
85530
85579
  }
85531
85580
  function route(fromModel) {
@@ -86142,7 +86191,7 @@ var require_channel = __commonJS({
86142
86191
  var require_output = __commonJS({
86143
86192
  "../../node_modules/sharp/lib/output.js"(exports2, module2) {
86144
86193
  "use strict";
86145
- var path35 = require("path");
86194
+ var path36 = require("path");
86146
86195
  var is = require_is();
86147
86196
  var sharp = require_sharp();
86148
86197
  var formats = /* @__PURE__ */ new Map([
@@ -86173,9 +86222,9 @@ var require_output = __commonJS({
86173
86222
  let err;
86174
86223
  if (!is.string(fileOut)) {
86175
86224
  err = new Error("Missing output file path");
86176
- } else if (is.string(this.options.input.file) && path35.resolve(this.options.input.file) === path35.resolve(fileOut)) {
86225
+ } else if (is.string(this.options.input.file) && path36.resolve(this.options.input.file) === path36.resolve(fileOut)) {
86177
86226
  err = new Error("Cannot use same file for input and output");
86178
- } else if (jp2Regex.test(path35.extname(fileOut)) && !this.constructor.format.jp2k.output.file) {
86227
+ } else if (jp2Regex.test(path36.extname(fileOut)) && !this.constructor.format.jp2k.output.file) {
86179
86228
  err = errJp2Save();
86180
86229
  }
86181
86230
  if (err) {
@@ -88120,7 +88169,7 @@ var init_adhdev_daemon = __esm({
88120
88169
  init_version();
88121
88170
  init_src();
88122
88171
  init_runtime_defaults();
88123
- pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.34" });
88172
+ pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.35" });
88124
88173
  AdhdevDaemon = class _AdhdevDaemon {
88125
88174
  localHttpServer = null;
88126
88175
  localWss = null;
@@ -90663,6 +90712,7 @@ init_source();
90663
90712
  init_src();
90664
90713
 
90665
90714
  // src/cli/setup-commands.ts
90715
+ var import_node_path4 = __toESM(require("path"));
90666
90716
  init_source();
90667
90717
  init_src();
90668
90718
 
@@ -90815,8 +90865,7 @@ function parsePositiveInteger(value, fallback2) {
90815
90865
  return Number.isFinite(parsed) && parsed >= 0 ? parsed : fallback2;
90816
90866
  }
90817
90867
  function buildHistoryResumeLaunchPayload(cliType, session, overrideDir) {
90818
- const path35 = require("path");
90819
- const dir = typeof overrideDir === "string" && overrideDir.trim() ? path35.resolve(overrideDir.trim()) : typeof session.workspace === "string" && session.workspace.trim() ? path35.resolve(session.workspace.trim()) : "";
90868
+ const dir = typeof overrideDir === "string" && overrideDir.trim() ? import_node_path4.default.resolve(overrideDir.trim()) : typeof session.workspace === "string" && session.workspace.trim() ? import_node_path4.default.resolve(session.workspace.trim()) : "";
90820
90869
  if (!dir) {
90821
90870
  throw new Error(`Saved history ${session.providerSessionId} is missing workspace metadata. Pass --dir to resume it explicitly.`);
90822
90871
  }
@@ -90906,12 +90955,13 @@ async function promptForSavedHistoryResumeSession(providerArg, sessions, options
90906
90955
  }
90907
90956
  return selected;
90908
90957
  }
90909
- function registerSetupCommands(program2, providerLoader) {
90958
+ function registerSetupCommands(program2, getProviderLoader2) {
90910
90959
  program2.command("setup").description("Run the interactive setup wizard (detect IDEs, login)").option("-f, --force", "Force re-run setup even if already configured").action(async (options) => {
90911
90960
  const { runWizard: runWizard2 } = await Promise.resolve().then(() => (init_wizard(), wizard_exports));
90912
90961
  await runWizard2({ force: options.force });
90913
90962
  });
90914
90963
  program2.command("launch [target]").description("Launch IDE with CDP or start CLI agent").option("-w, --workspace <path>", "Workspace directory to open").option("-n, --new-window", "Open in a new window").option("-d, --dir <path>", "Working directory for CLI agent", process.cwd()).action(async (targetArg, options) => {
90964
+ const providerLoader = await getProviderLoader2();
90915
90965
  const {
90916
90966
  detectIDEs: detectIDEs2,
90917
90967
  detectCLIs: detectCLIs2,
@@ -90935,7 +90985,7 @@ function registerSetupCommands(program2, providerLoader) {
90935
90985
  console.log(source_default.gray(" Then run: adhdev launch " + targetArg));
90936
90986
  process.exit(1);
90937
90987
  }
90938
- const resolvedDir = require("path").resolve(workingDir);
90988
+ const resolvedDir = import_node_path4.default.resolve(workingDir);
90939
90989
  const result = await sendDaemonCommand("launch_cli", {
90940
90990
  cliType,
90941
90991
  dir: resolvedDir
@@ -91055,6 +91105,7 @@ function registerSetupCommands(program2, providerLoader) {
91055
91105
  });
91056
91106
  const history = program2.command("history").description("Browse and resume provider saved history");
91057
91107
  history.command("list <provider>").description("List saved history for a CLI or ACP provider").option("--json", "Print raw JSON output").option("--limit <count>", "Maximum number of saved history entries to show", "30").option("--offset <count>", "Skip the first N saved history entries", "0").option("--resumable", "Show only saved history entries that can resume immediately").option("--text <text>", "Filter saved history by title or preview substring").option("--workspace <text>", "Filter saved history by workspace path substring").option("--model <text>", "Filter saved history by model substring").option("--sort <mode>", "Sort by recent, oldest, or messages", "recent").action(async (providerArg, options) => {
91108
+ const providerLoader = await getProviderLoader2();
91058
91109
  const providerTarget = resolveLaunchableProviderTarget(providerLoader, providerArg);
91059
91110
  if (!providerTarget) {
91060
91111
  console.log(source_default.red(`
@@ -91127,6 +91178,7 @@ function registerSetupCommands(program2, providerLoader) {
91127
91178
  printSavedHistorySessions(providerArg, providerTarget.resolvedType, sessions, hasMore);
91128
91179
  });
91129
91180
  history.command("resume <provider> [historySessionId]").description("Resume saved history for a CLI or ACP provider").option("-d, --dir <path>", "Override the saved workspace when resuming").option("--resumable", "When choosing interactively, hide entries that still need --dir").option("--text <text>", "When choosing interactively, filter by title or preview substring").option("--workspace <text>", "When choosing interactively, filter by workspace path substring").option("--model <text>", "When choosing interactively, filter by model substring").option("--sort <mode>", "When choosing interactively, sort by recent, oldest, or messages", "recent").action(async (providerArg, historySessionId, options) => {
91181
+ const providerLoader = await getProviderLoader2();
91130
91182
  const providerTarget = resolveLaunchableProviderTarget(providerLoader, providerArg);
91131
91183
  if (!providerTarget) {
91132
91184
  console.log(source_default.red(`
@@ -91220,6 +91272,7 @@ function registerSetupCommands(program2, providerLoader) {
91220
91272
  }
91221
91273
  });
91222
91274
  program2.command("status").description("Show current ADHDev setup status").action(async () => {
91275
+ const providerLoader = await getProviderLoader2();
91223
91276
  const { loadConfig: loadConfig2, detectIDEs: detectIDEs2, detectCLIs: detectCLIs2 } = await Promise.resolve().then(() => (init_src(), src_exports));
91224
91277
  const { isDaemonRunning: isDaemonRunning2, getDaemonPid: getDaemonPid2 } = await Promise.resolve().then(() => (init_adhdev_daemon(), adhdev_daemon_exports));
91225
91278
  const { probeSessionHostStatus: probeSessionHostStatus2 } = await Promise.resolve().then(() => (init_session_host(), session_host_exports));
@@ -91303,6 +91356,7 @@ function registerSetupCommands(program2, providerLoader) {
91303
91356
  console.log();
91304
91357
  });
91305
91358
  program2.command("detect").description("Detect installed IDEs, CLI agents, and ACP agents").action(async () => {
91359
+ const providerLoader = await getProviderLoader2();
91306
91360
  const { detectIDEs: detectIDEs2, detectCLIs: detectCLIs2 } = await Promise.resolve().then(() => (init_src(), src_exports));
91307
91361
  console.log(source_default.bold("\n\u{1F50D} Detecting installed IDEs...\n"));
91308
91362
  const ides = await detectIDEs2();
@@ -91404,7 +91458,7 @@ function registerSetupCommands(program2, providerLoader) {
91404
91458
  program2.command("uninstall").description("Completely wipe all setting, configuration, stop daemon and uninstall service").option("-f, --force", "Skip confirmation prompt").action(async (options) => {
91405
91459
  const inquirer2 = await Promise.resolve().then(() => (init_lib(), lib_exports));
91406
91460
  const fs27 = await import("fs");
91407
- const path35 = await import("path");
91461
+ const path36 = await import("path");
91408
91462
  const os31 = await import("os");
91409
91463
  const { spawnSync: spawnSync3 } = await import("child_process");
91410
91464
  if (!options.force) {
@@ -91430,7 +91484,7 @@ function registerSetupCommands(program2, providerLoader) {
91430
91484
  }
91431
91485
  console.log(source_default.gray(" Removing OS background service..."));
91432
91486
  spawnSync3(process.execPath, [process.argv[1], "service", "uninstall"], { stdio: "inherit" });
91433
- const adhdevDir = path35.join(os31.homedir(), ".adhdev");
91487
+ const adhdevDir = path36.join(os31.homedir(), ".adhdev");
91434
91488
  if (fs27.existsSync(adhdevDir)) {
91435
91489
  console.log(source_default.gray(` Deleting ${adhdevDir}...`));
91436
91490
  try {
@@ -91454,10 +91508,10 @@ init_src();
91454
91508
 
91455
91509
  // src/cli/runtime-tools.ts
91456
91510
  var fs24 = __toESM(require("fs"));
91457
- var path30 = __toESM(require("path"));
91511
+ var path31 = __toESM(require("path"));
91458
91512
  function defaultPackageRoot() {
91459
91513
  const currentCliPath = process.argv[1] ? fs24.realpathSync.native(process.argv[1]) : process.cwd();
91460
- return path30.resolve(path30.dirname(currentCliPath), "../..");
91514
+ return path31.resolve(path31.dirname(currentCliPath), "../..");
91461
91515
  }
91462
91516
  function normalizePath2(value) {
91463
91517
  return value.replace(/\\/g, "/").toLowerCase();
@@ -91466,19 +91520,19 @@ function shouldPreferSource(currentCliPath, packageRoot) {
91466
91520
  const normalizedCliPath = normalizePath2(currentCliPath || "");
91467
91521
  if (normalizedCliPath.includes("/src/cli/")) return true;
91468
91522
  if (normalizedCliPath.includes("/dist/cli/")) return false;
91469
- return fs24.existsSync(path30.join(packageRoot, "src", "cli", "index.ts"));
91523
+ return fs24.existsSync(path31.join(packageRoot, "src", "cli", "index.ts"));
91470
91524
  }
91471
91525
  function getVendoredToolEntry(packageRoot, tool) {
91472
91526
  if (tool === "session-host-daemon") {
91473
- return path30.join(packageRoot, "vendor", "session-host-daemon", "index.js");
91527
+ return path31.join(packageRoot, "vendor", "session-host-daemon", "index.js");
91474
91528
  }
91475
- return path30.join(packageRoot, "vendor", "terminal-mux-cli", "index.js");
91529
+ return path31.join(packageRoot, "vendor", "terminal-mux-cli", "index.js");
91476
91530
  }
91477
91531
  function getSourceToolEntry(packageRoot, tool) {
91478
91532
  if (tool === "session-host-daemon") {
91479
- return path30.resolve(packageRoot, "../../oss/packages/session-host-daemon/src/index.ts");
91533
+ return path31.resolve(packageRoot, "../../oss/packages/session-host-daemon/src/index.ts");
91480
91534
  }
91481
- return path30.resolve(packageRoot, "../../oss/packages/terminal-mux-cli/src/index.ts");
91535
+ return path31.resolve(packageRoot, "../../oss/packages/terminal-mux-cli/src/index.ts");
91482
91536
  }
91483
91537
  function getGlobalToolCommand(tool) {
91484
91538
  return tool === "session-host-daemon" ? "adhdev-sessiond" : "adhmux";
@@ -91558,6 +91612,25 @@ async function createConfiguredProviderLoader(options = {}) {
91558
91612
  if (options.load) loader.loadAll();
91559
91613
  return loader;
91560
91614
  }
91615
+ var _sharedLoaderPromise = null;
91616
+ function getSharedCliProviderLoader() {
91617
+ if (!_sharedLoaderPromise) {
91618
+ _sharedLoaderPromise = (async () => {
91619
+ const { ProviderLoader: ProviderLoader2, loadConfig: loadConfig2 } = await Promise.resolve().then(() => (init_src(), src_exports));
91620
+ const config2 = loadConfig2();
91621
+ const loader = new ProviderLoader2({
91622
+ logFn: () => {
91623
+ },
91624
+ userDir: config2.providerDir,
91625
+ sourceMode: config2.providerSourceMode
91626
+ });
91627
+ loader.loadAll();
91628
+ loader.registerToDetector();
91629
+ return loader;
91630
+ })();
91631
+ }
91632
+ return _sharedLoaderPromise;
91633
+ }
91561
91634
 
91562
91635
  // src/cli/debug-trace-cli.ts
91563
91636
  function normalizeOptionalFilter(value) {
@@ -91634,9 +91707,6 @@ var DEFAULT_DAEMON_PORT_TEXT = String(DEFAULT_DAEMON_PORT);
91634
91707
  var DEV_SERVER_PORT2 = 19280;
91635
91708
  var DEV_SERVER_BASE_URL = `http://127.0.0.1:${DEV_SERVER_PORT2}`;
91636
91709
  function hideCommand(command) {
91637
- if (typeof command.hideHelp === "function") {
91638
- command.hideHelp();
91639
- }
91640
91710
  command._hidden = true;
91641
91711
  return command;
91642
91712
  }
@@ -91939,12 +92009,118 @@ async function handleTraceCommand(options) {
91939
92009
  console.log();
91940
92010
  }
91941
92011
  }
92012
+ async function runDaemonUpgrade(options, pkgVersion3) {
92013
+ const { isDaemonRunning: isDaemonRunning2, stopDaemon: stopDaemon2 } = await Promise.resolve().then(() => (init_adhdev_daemon(), adhdev_daemon_exports));
92014
+ const { stopManagedSessionHostProcess: stopManagedSessionHostProcess2 } = await Promise.resolve().then(() => (init_session_host(), session_host_exports));
92015
+ const { execSync: execSync8, spawn: spawn6 } = await import("child_process");
92016
+ const fsMod = await import("fs");
92017
+ const pathMod = await import("path");
92018
+ console.log(source_default.bold("\n \u{1F504} ADHDev Upgrade\n"));
92019
+ const adhdevPath = process.argv[1];
92020
+ const realPath = fsMod.realpathSync(adhdevPath);
92021
+ const isLinked = realPath.includes(".openclaw") || realPath.includes("/src/");
92022
+ const currentVersion = pkgVersion3;
92023
+ console.log(` ${source_default.bold("Current:")} v${currentVersion}`);
92024
+ console.log(` ${source_default.bold("Install:")} ${isLinked ? "npm link (dev)" : "npm global"}`);
92025
+ if (isLinked) {
92026
+ const projectRoot = pathMod.resolve(pathMod.dirname(realPath), "..");
92027
+ const launcherDir = pathMod.join(projectRoot);
92028
+ console.log(` ${source_default.bold("Path:")} ${launcherDir}`);
92029
+ console.log(source_default.cyan("\n Pulling latest..."));
92030
+ try {
92031
+ let gitRoot = launcherDir;
92032
+ while (!fsMod.existsSync(pathMod.join(gitRoot, ".git")) && gitRoot !== "/") {
92033
+ gitRoot = pathMod.dirname(gitRoot);
92034
+ }
92035
+ execSync8("git pull --rebase", { cwd: gitRoot, stdio: "inherit" });
92036
+ console.log(source_default.cyan("\n Building..."));
92037
+ execSync8("npm run build", { cwd: launcherDir, stdio: "inherit" });
92038
+ execSync8("npm link", { cwd: launcherDir, stdio: "inherit" });
92039
+ console.log(source_default.green("\n \u2713 Build complete"));
92040
+ } catch (e) {
92041
+ console.log(source_default.red(`
92042
+ \u2717 Build failed: ${e?.message}
92043
+ `));
92044
+ process.exit(1);
92045
+ }
92046
+ } else {
92047
+ console.log(source_default.cyan("\n Checking for updates..."));
92048
+ let latest;
92049
+ try {
92050
+ latest = execSync8("npm view adhdev version", { encoding: "utf-8" }).trim();
92051
+ } catch (e) {
92052
+ console.log(source_default.red(`
92053
+ \u2717 Failed to check latest version: ${e?.message}
92054
+ `));
92055
+ process.exit(1);
92056
+ return;
92057
+ }
92058
+ console.log(` ${source_default.bold("Latest:")} v${latest}`);
92059
+ if (latest === currentVersion) {
92060
+ console.log(source_default.green("\n \u2713 Already on latest version.\n"));
92061
+ if (!options.restart) return;
92062
+ } else {
92063
+ console.log(source_default.cyan(`
92064
+ Upgrading v${currentVersion} \u2192 v${latest}...`));
92065
+ const daemonWasRunning = options.restart !== false && isDaemonRunning2();
92066
+ if (daemonWasRunning) {
92067
+ stopDaemon2();
92068
+ await new Promise((r) => setTimeout(r, 1e3));
92069
+ stopManagedSessionHostProcess2();
92070
+ }
92071
+ const { spawnDetachedDaemonUpgradeHelper: spawnDetachedDaemonUpgradeHelper2 } = await Promise.resolve().then(() => (init_src(), src_exports));
92072
+ spawnDetachedDaemonUpgradeHelper2({
92073
+ packageName: "adhdev",
92074
+ targetVersion: latest,
92075
+ parentPid: process.pid,
92076
+ restartArgv: daemonWasRunning ? [process.argv[1], "daemon", "-p", DEFAULT_DAEMON_PORT_TEXT] : [],
92077
+ cwd: process.cwd()
92078
+ });
92079
+ if (daemonWasRunning) {
92080
+ console.log(source_default.cyan(" Upgrading and restarting daemon in background..."));
92081
+ } else {
92082
+ console.log(source_default.cyan(" Upgrading in background..."));
92083
+ console.log(source_default.gray(" Start daemon when ready: adhdev daemon"));
92084
+ }
92085
+ console.log(source_default.gray(` Progress: ~/.adhdev/daemon-upgrade.log
92086
+ `));
92087
+ process.exit(0);
92088
+ return;
92089
+ }
92090
+ }
92091
+ if (options.restart !== false && isDaemonRunning2()) {
92092
+ console.log(source_default.yellow("\n Restarting daemon..."));
92093
+ stopDaemon2();
92094
+ await new Promise((r) => setTimeout(r, 2e3));
92095
+ stopManagedSessionHostProcess2();
92096
+ await new Promise((r) => setTimeout(r, 500));
92097
+ const child = spawn6(process.execPath, [process.argv[1], "daemon", "-p", DEFAULT_DAEMON_PORT_TEXT], {
92098
+ detached: true,
92099
+ stdio: "ignore",
92100
+ windowsHide: true,
92101
+ env: { ...process.env }
92102
+ });
92103
+ child.unref();
92104
+ await new Promise((r) => setTimeout(r, 3e3));
92105
+ if (isDaemonRunning2()) {
92106
+ console.log(source_default.green(` \u2713 Daemon restarted with new version
92107
+ `));
92108
+ } else {
92109
+ console.log(source_default.yellow(` \u26A0 Daemon not detected. Start manually: adhdev daemon
92110
+ `));
92111
+ }
92112
+ } else if (options.restart !== false) {
92113
+ console.log(source_default.gray("\n Daemon was not running. Start with: adhdev daemon\n"));
92114
+ } else {
92115
+ console.log(source_default.green("\n \u2713 Upgrade complete (daemon not restarted)\n"));
92116
+ }
92117
+ }
91942
92118
  function registerDaemonCommands(program2, pkgVersion3) {
91943
92119
  program2.command("daemon").description("\u{1F680} Start ADHDev Daemon \u2014 unified hub for IDE monitoring, agent management, and remote control").option("-p, --port <port>", "Local WS server port", DEFAULT_DAEMON_PORT_TEXT).option("--server <url>", "Override server URL for testing").option("--dev", "Enable Dev Mode \u2014 HTTP API on :19280 for script debugging + structured trace collection").option("--log-level <level>", "Console log level (debug|info|warn|error)").option("--trace", "Enable structured debug trace collection").option("--trace-content", "Include richer content snapshots in debug traces").option("--trace-buffer-size <count>", "Structured trace ring buffer size").action(async (options) => {
91944
92120
  const { AdhdevDaemon: AdhdevDaemon2 } = await Promise.resolve().then(() => (init_adhdev_daemon(), adhdev_daemon_exports));
91945
92121
  const daemon = new AdhdevDaemon2();
91946
92122
  await daemon.start({
91947
- localPort: parseInt(options.port) || DEFAULT_DAEMON_PORT,
92123
+ localPort: parseInt(options.port, 10) || DEFAULT_DAEMON_PORT,
91948
92124
  serverUrl: options.server,
91949
92125
  foreground: true,
91950
92126
  dev: options.dev || false,
@@ -92040,7 +92216,7 @@ function registerDaemonCommands(program2, pkgVersion3) {
92040
92216
  const { probeSessionHostStatus: probeSessionHostStatus2 } = await Promise.resolve().then(() => (init_session_host(), session_host_exports));
92041
92217
  const port = parseInt(options.port, 10) || DEFAULT_DAEMON_PORT;
92042
92218
  const config2 = loadConfig2();
92043
- const providerLoader = await createConfiguredProviderLoader();
92219
+ const providerLoader = await getSharedCliProviderLoader();
92044
92220
  if (isDaemonRunning2({ port })) {
92045
92221
  console.log(source_default.green(`
92046
92222
  \u2713 ADHDev Daemon is running.
@@ -92499,114 +92675,10 @@ function registerDaemonCommands(program2, pkgVersion3) {
92499
92675
  }
92500
92676
  }));
92501
92677
  hideCommand(program2.command("daemon:upgrade").description("Upgrade ADHDev to latest version and restart daemon").option("--no-restart", "Upgrade only, skip daemon restart").action(async (options) => {
92502
- const { isDaemonRunning: isDaemonRunning2, stopDaemon: stopDaemon2 } = await Promise.resolve().then(() => (init_adhdev_daemon(), adhdev_daemon_exports));
92503
- const { stopManagedSessionHostProcess: stopManagedSessionHostProcess2 } = await Promise.resolve().then(() => (init_session_host(), session_host_exports));
92504
- const { execSync: execSync8, spawn: spawn6 } = await import("child_process");
92505
- const fsMod = await import("fs");
92506
- const pathMod = await import("path");
92507
- console.log(source_default.bold("\n \u{1F504} ADHDev Upgrade\n"));
92508
- const adhdevPath = process.argv[1];
92509
- const realPath = fsMod.realpathSync(adhdevPath);
92510
- const isLinked = realPath.includes(".openclaw") || realPath.includes("/src/");
92511
- const currentVersion = pkgVersion3;
92512
- console.log(` ${source_default.bold("Current:")} v${currentVersion}`);
92513
- console.log(` ${source_default.bold("Install:")} ${isLinked ? "npm link (dev)" : "npm global"}`);
92514
- if (isLinked) {
92515
- const projectRoot = pathMod.resolve(pathMod.dirname(realPath), "..");
92516
- const launcherDir = pathMod.join(projectRoot);
92517
- console.log(` ${source_default.bold("Path:")} ${launcherDir}`);
92518
- console.log(source_default.cyan("\n Pulling latest..."));
92519
- try {
92520
- let gitRoot = launcherDir;
92521
- while (!fsMod.existsSync(pathMod.join(gitRoot, ".git")) && gitRoot !== "/") {
92522
- gitRoot = pathMod.dirname(gitRoot);
92523
- }
92524
- execSync8("git pull --rebase", { cwd: gitRoot, stdio: "inherit" });
92525
- console.log(source_default.cyan("\n Building..."));
92526
- execSync8("npm run build", { cwd: launcherDir, stdio: "inherit" });
92527
- execSync8("npm link", { cwd: launcherDir, stdio: "inherit" });
92528
- console.log(source_default.green("\n \u2713 Build complete"));
92529
- } catch (e) {
92530
- console.log(source_default.red(`
92531
- \u2717 Build failed: ${e?.message}
92532
- `));
92533
- process.exit(1);
92534
- }
92535
- } else {
92536
- console.log(source_default.cyan("\n Checking for updates..."));
92537
- let latest;
92538
- try {
92539
- latest = execSync8("npm view adhdev version", { encoding: "utf-8" }).trim();
92540
- } catch (e) {
92541
- console.log(source_default.red(`
92542
- \u2717 Failed to check latest version: ${e?.message}
92543
- `));
92544
- process.exit(1);
92545
- return;
92546
- }
92547
- console.log(` ${source_default.bold("Latest:")} v${latest}`);
92548
- if (latest === currentVersion) {
92549
- console.log(source_default.green("\n \u2713 Already on latest version.\n"));
92550
- if (!options.restart) return;
92551
- } else {
92552
- console.log(source_default.cyan(`
92553
- Upgrading v${currentVersion} \u2192 v${latest}...`));
92554
- const daemonWasRunning = options.restart !== false && isDaemonRunning2();
92555
- if (daemonWasRunning) {
92556
- stopDaemon2();
92557
- await new Promise((r) => setTimeout(r, 1e3));
92558
- stopManagedSessionHostProcess2();
92559
- }
92560
- const { spawnDetachedDaemonUpgradeHelper: spawnDetachedDaemonUpgradeHelper2 } = await Promise.resolve().then(() => (init_src(), src_exports));
92561
- spawnDetachedDaemonUpgradeHelper2({
92562
- packageName: "adhdev",
92563
- targetVersion: latest,
92564
- parentPid: process.pid,
92565
- restartArgv: daemonWasRunning ? [process.argv[1], "daemon", "-p", DEFAULT_DAEMON_PORT_TEXT] : [],
92566
- cwd: process.cwd()
92567
- });
92568
- if (daemonWasRunning) {
92569
- console.log(source_default.cyan(" Upgrading and restarting daemon in background..."));
92570
- } else {
92571
- console.log(source_default.cyan(" Upgrading in background..."));
92572
- console.log(source_default.gray(" Start daemon when ready: adhdev daemon"));
92573
- }
92574
- console.log(source_default.gray(` Progress: ~/.adhdev/daemon-upgrade.log
92575
- `));
92576
- process.exit(0);
92577
- return;
92578
- }
92579
- }
92580
- if (options.restart !== false && isDaemonRunning2()) {
92581
- console.log(source_default.yellow("\n Restarting daemon..."));
92582
- stopDaemon2();
92583
- await new Promise((r) => setTimeout(r, 2e3));
92584
- stopManagedSessionHostProcess2();
92585
- await new Promise((r) => setTimeout(r, 500));
92586
- const child = spawn6(process.execPath, [process.argv[1], "daemon", "-p", DEFAULT_DAEMON_PORT_TEXT], {
92587
- detached: true,
92588
- stdio: "ignore",
92589
- windowsHide: true,
92590
- env: { ...process.env }
92591
- });
92592
- child.unref();
92593
- await new Promise((r) => setTimeout(r, 3e3));
92594
- if (isDaemonRunning2()) {
92595
- console.log(source_default.green(` \u2713 Daemon restarted with new version
92596
- `));
92597
- } else {
92598
- console.log(source_default.yellow(` \u26A0 Daemon not detected. Start manually: adhdev daemon
92599
- `));
92600
- }
92601
- } else if (options.restart !== false) {
92602
- console.log(source_default.gray("\n Daemon was not running. Start with: adhdev daemon\n"));
92603
- } else {
92604
- console.log(source_default.green("\n \u2713 Upgrade complete (daemon not restarted)\n"));
92605
- }
92678
+ await runDaemonUpgrade(options, pkgVersion3);
92606
92679
  }));
92607
92680
  program2.command("update").description("\u{1F504} Update ADHDev to latest version and restart daemon (alias for daemon:upgrade)").option("--no-restart", "Upgrade only, skip daemon restart").action(async (options) => {
92608
- process.argv = [process.argv[0], process.argv[1], "daemon:upgrade", ...options.restart === false ? ["--no-restart"] : []];
92609
- await program2.parseAsync(process.argv);
92681
+ await runDaemonUpgrade(options, pkgVersion3);
92610
92682
  });
92611
92683
  }
92612
92684
 
@@ -92615,7 +92687,7 @@ init_source();
92615
92687
  var import_child_process15 = require("child_process");
92616
92688
  var fs26 = __toESM(require("fs"));
92617
92689
  var os30 = __toESM(require("os"));
92618
- var path33 = __toESM(require("path"));
92690
+ var path34 = __toESM(require("path"));
92619
92691
  init_src();
92620
92692
  init_session_host();
92621
92693
 
@@ -92732,26 +92804,26 @@ function buildDoctorAdvice(input) {
92732
92804
 
92733
92805
  // src/cli/service-commands.ts
92734
92806
  var import_node_fs6 = __toESM(require("fs"));
92735
- var import_node_path4 = __toESM(require("path"));
92807
+ var import_node_path5 = __toESM(require("path"));
92736
92808
  var import_node_os6 = __toESM(require("os"));
92737
92809
  var import_node_child_process6 = require("child_process");
92738
92810
  init_source();
92739
92811
  init_src();
92740
92812
  var DEFAULT_LOCAL_DAEMON_HEALTH_TIMEOUT_MS3 = 1500;
92741
92813
  var LAUNCHD_LABEL = "dev.adhf.daemon";
92742
- var ADHDEV_DIR = import_node_path4.default.join(import_node_os6.default.homedir(), ".adhdev");
92743
- var LOG_OUT = import_node_path4.default.join(ADHDEV_DIR, "daemon-launchd.out");
92744
- var LOG_ERR = import_node_path4.default.join(ADHDEV_DIR, "daemon-launchd.err");
92814
+ var ADHDEV_DIR = import_node_path5.default.join(import_node_os6.default.homedir(), ".adhdev");
92815
+ var LOG_OUT = import_node_path5.default.join(ADHDEV_DIR, "daemon-launchd.out");
92816
+ var LOG_ERR = import_node_path5.default.join(ADHDEV_DIR, "daemon-launchd.err");
92745
92817
  var MAX_LOG_SIZE2 = 10 * 1024 * 1024;
92746
92818
  function getDarwinPlistPath() {
92747
- return import_node_path4.default.join(import_node_os6.default.homedir(), "Library", "LaunchAgents", `${LAUNCHD_LABEL}.plist`);
92819
+ return import_node_path5.default.join(import_node_os6.default.homedir(), "Library", "LaunchAgents", `${LAUNCHD_LABEL}.plist`);
92748
92820
  }
92749
92821
  function getWindowsStartupDir() {
92750
- const appData = process.env.APPDATA || import_node_path4.default.join(import_node_os6.default.homedir(), "AppData", "Roaming");
92751
- return import_node_path4.default.join(appData, "Microsoft", "Windows", "Start Menu", "Programs", "Startup");
92822
+ const appData = process.env.APPDATA || import_node_path5.default.join(import_node_os6.default.homedir(), "AppData", "Roaming");
92823
+ return import_node_path5.default.join(appData, "Microsoft", "Windows", "Start Menu", "Programs", "Startup");
92752
92824
  }
92753
92825
  function getWindowsVbsPath() {
92754
- return import_node_path4.default.join(getWindowsStartupDir(), "adhdev-daemon.vbs");
92826
+ return import_node_path5.default.join(getWindowsStartupDir(), "adhdev-daemon.vbs");
92755
92827
  }
92756
92828
  function resolveCliPath() {
92757
92829
  return import_node_fs6.default.realpathSync(process.argv[1]);
@@ -92817,7 +92889,7 @@ function rotateLogs() {
92817
92889
  }
92818
92890
  function buildPlist(nodeExe, cliExe) {
92819
92891
  const brewPrefix = import_node_fs6.default.existsSync("/opt/homebrew/bin") ? "/opt/homebrew/bin" : "/usr/local/bin";
92820
- const nodeDir = import_node_path4.default.dirname(nodeExe);
92892
+ const nodeDir = import_node_path5.default.dirname(nodeExe);
92821
92893
  const pathEntries = /* @__PURE__ */ new Set([nodeDir, brewPrefix, "/usr/local/bin", "/usr/bin", "/bin", "/usr/sbin", "/sbin"]);
92822
92894
  const pathValue = Array.from(pathEntries).join(":");
92823
92895
  return `<?xml version="1.0" encoding="UTF-8"?>
@@ -92856,7 +92928,7 @@ function buildPlist(nodeExe, cliExe) {
92856
92928
  function installDarwin(nodeExe, cliExe) {
92857
92929
  const plistPath = getDarwinPlistPath();
92858
92930
  ensureDir(ADHDEV_DIR);
92859
- ensureDir(import_node_path4.default.dirname(plistPath));
92931
+ ensureDir(import_node_path5.default.dirname(plistPath));
92860
92932
  import_node_fs6.default.writeFileSync(plistPath, buildPlist(nodeExe, cliExe), "utf-8");
92861
92933
  console.log(source_default.gray(` Plist: ${plistPath}`));
92862
92934
  try {
@@ -92889,7 +92961,7 @@ function isInstalledDarwin() {
92889
92961
  return import_node_fs6.default.existsSync(getDarwinPlistPath());
92890
92962
  }
92891
92963
  function buildVbs(nodeExe, cliExe) {
92892
- const logFile = import_node_path4.default.join(ADHDEV_DIR, "daemon-service.log").replace(/\\/g, "\\\\");
92964
+ const logFile = import_node_path5.default.join(ADHDEV_DIR, "daemon-service.log").replace(/\\/g, "\\\\");
92893
92965
  const escapedNodeExe = nodeExe.replace(/\\/g, "\\\\");
92894
92966
  const escapedCliExe = cliExe.replace(/\\/g, "\\\\");
92895
92967
  return `' ADHDev Daemon Auto-Start (generated by adhdev service install)
@@ -92900,11 +92972,11 @@ WshShell.Run "cmd.exe /c """"${escapedNodeExe}"""" """"${escapedCliExe}"""" daem
92900
92972
  function installWindows(nodeExe, cliExe) {
92901
92973
  const vbsPath = getWindowsVbsPath();
92902
92974
  ensureDir(ADHDEV_DIR);
92903
- ensureDir(import_node_path4.default.dirname(vbsPath));
92975
+ ensureDir(import_node_path5.default.dirname(vbsPath));
92904
92976
  import_node_fs6.default.writeFileSync(vbsPath, buildVbs(nodeExe, cliExe), "utf-8");
92905
92977
  console.log(source_default.gray(` Startup script: ${vbsPath}`));
92906
92978
  console.log(source_default.green("\n \u2713 Registered in Startup folder \u2014 daemon will start on login (hidden)."));
92907
- console.log(source_default.gray(` Logs: ${import_node_path4.default.join(ADHDEV_DIR, "daemon-service.log")}`));
92979
+ console.log(source_default.gray(` Logs: ${import_node_path5.default.join(ADHDEV_DIR, "daemon-service.log")}`));
92908
92980
  console.log(source_default.gray(" To start now without rebooting, run: adhdev daemon"));
92909
92981
  }
92910
92982
  function uninstallWindows() {
@@ -93098,11 +93170,11 @@ function formatBytes(bytes) {
93098
93170
 
93099
93171
  // src/cli/doctor-commands.ts
93100
93172
  function resolvePackageRoot() {
93101
- return path33.resolve(__dirname, "..", "..");
93173
+ return path34.resolve(__dirname, "..", "..");
93102
93174
  }
93103
93175
  function isLinkedInstall(packageRoot) {
93104
- const normalized = path33.normalize(packageRoot);
93105
- return !normalized.includes(`${path33.sep}node_modules${path33.sep}adhdev`);
93176
+ const normalized = path34.normalize(packageRoot);
93177
+ return !normalized.includes(`${path34.sep}node_modules${path34.sep}adhdev`);
93106
93178
  }
93107
93179
  function formatCheck(check2) {
93108
93180
  const icon = check2.ok ? source_default.green("\u2713") : source_default.red("\u2717");
@@ -93186,8 +93258,8 @@ function probeSharpRuntime(packageRoot, nativeSharpPackage) {
93186
93258
  }
93187
93259
  }
93188
93260
  function probeConfigAccess() {
93189
- const configDir = path33.join(os30.homedir(), ".adhdev");
93190
- const configPath = path33.join(configDir, "config.json");
93261
+ const configDir = path34.join(os30.homedir(), ".adhdev");
93262
+ const configPath = path34.join(configDir, "config.json");
93191
93263
  const checks = [];
93192
93264
  try {
93193
93265
  fs26.mkdirSync(configDir, { recursive: true });
@@ -93227,7 +93299,7 @@ function probeConfigAccess() {
93227
93299
  fatal: true
93228
93300
  });
93229
93301
  }
93230
- const probePath = path33.join(configDir, `.doctor-write-${process.pid}-${Date.now()}.tmp`);
93302
+ const probePath = path34.join(configDir, `.doctor-write-${process.pid}-${Date.now()}.tmp`);
93231
93303
  try {
93232
93304
  fs26.writeFileSync(probePath, "ok", "utf-8");
93233
93305
  fs26.rmSync(probePath, { force: true });
@@ -93416,7 +93488,7 @@ function registerDoctorCommands(program2, pkgVersion3) {
93416
93488
  });
93417
93489
  }
93418
93490
  if (process.platform === "darwin") {
93419
- serviceDefinitionPath = path33.join(os30.homedir(), "Library", "LaunchAgents", "dev.adhf.daemon.plist");
93491
+ serviceDefinitionPath = path34.join(os30.homedir(), "Library", "LaunchAgents", "dev.adhf.daemon.plist");
93420
93492
  if (fs26.existsSync(serviceDefinitionPath)) {
93421
93493
  serviceDefinitionCheck = evaluateServiceDefinitionDrift({
93422
93494
  serviceKind: "launchd",
@@ -93464,7 +93536,7 @@ function registerDoctorCommands(program2, pkgVersion3) {
93464
93536
  } catch {
93465
93537
  }
93466
93538
  try {
93467
- const providerLoader = await createConfiguredProviderLoader({ load: true });
93539
+ const providerLoader = await getSharedCliProviderLoader();
93468
93540
  const cliResults = await detectCLIs(providerLoader);
93469
93541
  for (const cli of cliResults) {
93470
93542
  checks.push({
@@ -93489,7 +93561,7 @@ function registerDoctorCommands(program2, pkgVersion3) {
93489
93561
  serviceCheck: serviceDefinitionCheck || void 0,
93490
93562
  sourceCliExample: "node --import tsx packages/daemon-cloud/src/cli/index.ts doctor"
93491
93563
  });
93492
- const sessionHostLogPath = path33.join(os30.homedir(), ".adhdev", "logs", "session-host.log");
93564
+ const sessionHostLogPath = path34.join(os30.homedir(), ".adhdev", "logs", "session-host.log");
93493
93565
  console.log(source_default.bold("\n\u{1FA7A} ADHDev Doctor\n"));
93494
93566
  console.log(source_default.gray(` Version: ${pkgVersion3}`));
93495
93567
  console.log(source_default.gray(` Platform: ${process.platform} ${process.arch}`));
@@ -93531,7 +93603,7 @@ function registerDoctorCommands(program2, pkgVersion3) {
93531
93603
 
93532
93604
  // src/cli/provider-commands.ts
93533
93605
  init_source();
93534
- var path34 = __toESM(require("path"));
93606
+ var path35 = __toESM(require("path"));
93535
93607
  init_cdp_utils();
93536
93608
  var DEV_SERVER_PORT3 = 19280;
93537
93609
  var IDE_AUTO_FIX_FUNCTIONS = [
@@ -93602,7 +93674,7 @@ function getCliAutoFixVerification(provider, providerDir) {
93602
93674
  };
93603
93675
  }
93604
93676
  function hideCommand2(command) {
93605
- command.hideHelp?.();
93677
+ command._hidden = true;
93606
93678
  return command;
93607
93679
  }
93608
93680
  async function createConfiguredProviderLoader2() {
@@ -93614,7 +93686,7 @@ function getProviderSourceCandidatePaths(options) {
93614
93686
  const results = [];
93615
93687
  for (const root of roots) {
93616
93688
  for (const name of relativeNames) {
93617
- results.push(path34.join(root, options.category, options.type, name));
93689
+ results.push(path35.join(root, options.category, options.type, name));
93618
93690
  }
93619
93691
  }
93620
93692
  return results;
@@ -93750,7 +93822,7 @@ function registerProviderCommands(program2) {
93750
93822
  let processNames = {};
93751
93823
  if (category === "ide") {
93752
93824
  const fs27 = await import("fs");
93753
- const path35 = await import("path");
93825
+ const path36 = await import("path");
93754
93826
  const os31 = await import("os");
93755
93827
  if (os31.platform() === "darwin") {
93756
93828
  while (true) {
@@ -93763,7 +93835,7 @@ function registerProviderCommands(program2) {
93763
93835
  }
93764
93836
  console.log(source_default.green(` \u2713 Path verified: ${p}`));
93765
93837
  osPaths["darwin"] = [p];
93766
- processNames["darwin"] = path35.basename(p, ".app");
93838
+ processNames["darwin"] = path36.basename(p, ".app");
93767
93839
  break;
93768
93840
  }
93769
93841
  } else if (os31.platform() === "win32") {
@@ -93777,7 +93849,7 @@ function registerProviderCommands(program2) {
93777
93849
  }
93778
93850
  console.log(source_default.green(` \u2713 Path verified: ${p}`));
93779
93851
  osPaths["win32"] = [p];
93780
- processNames["win32"] = path35.basename(p, ".exe");
93852
+ processNames["win32"] = path36.basename(p, ".exe");
93781
93853
  break;
93782
93854
  }
93783
93855
  }
@@ -94599,18 +94671,9 @@ if (process.platform === "win32") {
94599
94671
  process.exit(1);
94600
94672
  }
94601
94673
  }
94602
- var cliConfig = loadConfig();
94603
- var _cliProviderLoader = new ProviderLoader({
94604
- logFn: () => {
94605
- },
94606
- userDir: cliConfig.providerDir,
94607
- sourceMode: cliConfig.providerSourceMode
94608
- });
94609
- _cliProviderLoader.loadAll();
94610
- _cliProviderLoader.registerToDetector();
94611
94674
  var program = new import_commander.Command();
94612
94675
  program.name("adhdev").description("\u{1F9A6} ADHDev \u2014 Agent Dashboard Hub for Dev").version(pkgVersion2);
94613
- registerSetupCommands(program, _cliProviderLoader);
94676
+ registerSetupCommands(program, getSharedCliProviderLoader);
94614
94677
  registerDaemonCommands(program, pkgVersion2);
94615
94678
  registerDoctorCommands(program, pkgVersion2);
94616
94679
  registerProviderCommands(program);