adhdev 0.9.34 → 0.9.36

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;
@@ -12879,7 +12913,16 @@ var init_provider_cli_adapter = __esm({
12879
12913
  if (baseMessages.length <= _ProviderCliAdapter.PARSE_MESSAGE_TAIL_LIMIT) return baseMessages;
12880
12914
  return baseMessages.slice(-_ProviderCliAdapter.PARSE_MESSAGE_TAIL_LIMIT);
12881
12915
  }
12916
+ messagesShareStableIdentity(left2, right2) {
12917
+ if (left2 === right2) return true;
12918
+ if (!left2 || !right2) return false;
12919
+ if ((left2.role || "") !== (right2.role || "")) return false;
12920
+ if (left2.id && right2.id && String(left2.id) === String(right2.id)) return true;
12921
+ if (typeof left2.index === "number" && typeof right2.index === "number" && left2.index === right2.index) return true;
12922
+ return false;
12923
+ }
12882
12924
  messagesComparable(left2, right2) {
12925
+ if (this.messagesShareStableIdentity(left2, right2)) return true;
12883
12926
  if (!left2 || !right2) return false;
12884
12927
  if ((left2.role || "") !== (right2.role || "")) return false;
12885
12928
  const leftText = normalizeComparableTranscriptText(left2.content);
@@ -12990,9 +13033,16 @@ var init_provider_cli_adapter = __esm({
12990
13033
  /** Inject CLI scripts after construction (e.g. when resolved by ProviderLoader) */
12991
13034
  setCliScripts(scripts) {
12992
13035
  this.cliScripts = scripts;
13036
+ this.parsedStatusCache = null;
13037
+ this.parseErrorMessage = null;
12993
13038
  const scriptNames = listCliScriptNames(scripts);
12994
13039
  LOG.info("CLI", `[${this.cliType}] CLI scripts injected: [${scriptNames.join(", ")}]`);
12995
13040
  }
13041
+ /** Refresh provider scripts/config used by this adapter without restarting the PTY runtime. */
13042
+ refreshProviderDefinition(provider) {
13043
+ this.provider = provider;
13044
+ this.setCliScripts(provider.scripts || {});
13045
+ }
12996
13046
  updateRuntimeSettings(settings) {
12997
13047
  this.runtimeSettings = { ...settings };
12998
13048
  }
@@ -14023,6 +14073,69 @@ var init_provider_cli_adapter = __esm({
14023
14073
  this.committedMessages = normalized;
14024
14074
  this.syncMessageViews();
14025
14075
  }
14076
+ getSharedCommittedPrefixLength(parsedMessages) {
14077
+ const committedMessages = this.committedMessages;
14078
+ const max = Math.min(parsedMessages.length, committedMessages.length);
14079
+ let index = 0;
14080
+ while (index < max && this.messagesShareStableIdentity(parsedMessages[index], committedMessages[index])) {
14081
+ index += 1;
14082
+ }
14083
+ return index;
14084
+ }
14085
+ hydrateCommittedPrefixForParsedStatus(parsedMessages) {
14086
+ const sharedPrefixLength = this.getSharedCommittedPrefixLength(parsedMessages);
14087
+ if (sharedPrefixLength !== this.committedMessages.length) return null;
14088
+ const committedHydratedMessages = this.committedMessages.map((message, index) => {
14089
+ const timestamp = typeof message.timestamp === "number" && Number.isFinite(message.timestamp) ? message.timestamp : this.lastOutputAt || this.currentTurnScope?.startedAt || Date.now();
14090
+ const contentValue = message.content;
14091
+ return {
14092
+ role: message.role,
14093
+ content: typeof contentValue === "string" ? contentValue : String(contentValue || ""),
14094
+ timestamp,
14095
+ receivedAt: typeof message.receivedAt === "number" && Number.isFinite(message.receivedAt) ? message.receivedAt : timestamp,
14096
+ kind: message.kind,
14097
+ id: message.id || `msg_${index}`,
14098
+ index: typeof message.index === "number" ? message.index : index,
14099
+ meta: message.meta,
14100
+ senderName: message.senderName
14101
+ };
14102
+ });
14103
+ const extraMessages = parsedMessages.slice(sharedPrefixLength);
14104
+ if (extraMessages.length === 0) return committedHydratedMessages;
14105
+ const extraHydratedMessages = hydrateCliParsedMessages(extraMessages, {
14106
+ committedMessages: [],
14107
+ scope: this.currentTurnScope,
14108
+ lastOutputAt: this.lastOutputAt
14109
+ }).map((message, offset) => ({
14110
+ ...message,
14111
+ id: message.id || `msg_${sharedPrefixLength + offset}`,
14112
+ index: typeof message.index === "number" ? message.index : sharedPrefixLength + offset
14113
+ }));
14114
+ return [...committedHydratedMessages, ...extraHydratedMessages];
14115
+ }
14116
+ hydrateParsedMessagesForStatus(parsedMessages) {
14117
+ return this.hydrateCommittedPrefixForParsedStatus(parsedMessages) || hydrateCliParsedMessages(parsedMessages, {
14118
+ committedMessages: this.committedMessages,
14119
+ scope: this.currentTurnScope,
14120
+ lastOutputAt: this.lastOutputAt
14121
+ });
14122
+ }
14123
+ buildCommittedChatMessages() {
14124
+ return this.committedMessages.map((message, index) => {
14125
+ const contentValue = message.content;
14126
+ return buildChatMessage({
14127
+ role: message.role,
14128
+ content: typeof contentValue === "string" ? contentValue : String(contentValue || ""),
14129
+ timestamp: message.timestamp,
14130
+ kind: message.kind,
14131
+ meta: message.meta,
14132
+ senderName: message.senderName,
14133
+ id: message.id || `msg_${index}`,
14134
+ index: typeof message.index === "number" ? message.index : index,
14135
+ receivedAt: typeof message.receivedAt === "number" ? message.receivedAt : message.timestamp
14136
+ });
14137
+ });
14138
+ }
14026
14139
  /**
14027
14140
  * Script-based full parse — returns ReadChatResult.
14028
14141
  * Called by command handler / dashboard for rich content rendering.
@@ -14048,7 +14161,7 @@ var init_provider_cli_adapter = __esm({
14048
14161
  this.onStatusChange?.();
14049
14162
  }
14050
14163
  }
14051
- if (parsed && Array.isArray(parsed.messages)) {
14164
+ if (parsed && Array.isArray(parsed.messages) && this.provider.allowInputDuringGeneration === true) {
14052
14165
  const hydratedForCommit = normalizeCliParsedMessages(parsed.messages, {
14053
14166
  committedMessages: this.committedMessages,
14054
14167
  scope: this.currentTurnScope,
@@ -14067,21 +14180,21 @@ var init_provider_cli_adapter = __esm({
14067
14180
  const shouldPreferCommittedMessages = !this.currentTurnScope && !this.activeModal && this.currentStatus === "idle";
14068
14181
  let result;
14069
14182
  if (parsed && Array.isArray(parsed.messages)) {
14070
- const parsedHydratedMessages = hydrateCliParsedMessages(parsed.messages, {
14071
- committedMessages: this.committedMessages,
14072
- scope: this.currentTurnScope,
14073
- lastOutputAt: this.lastOutputAt
14074
- });
14075
- const committedHydratedMessages = this.committedMessages.map((message, index) => buildChatMessage({
14076
- ...message,
14077
- id: message.id || `msg_${index}`,
14078
- index: typeof message.index === "number" ? message.index : index,
14079
- receivedAt: typeof message.receivedAt === "number" ? message.receivedAt : message.timestamp
14080
- }));
14183
+ const parsedHydratedMessages = this.hydrateParsedMessagesForStatus(parsed.messages);
14081
14184
  const parsedLastAssistant = [...parsedHydratedMessages].reverse().find((message) => message.role === "assistant" && typeof message.content === "string" && message.content.trim());
14082
- const shouldAdoptParsedIdleReplay = !this.currentTurnScope && !this.activeModal && !!parsedLastAssistant && parsedTranscriptIsRicherThanCommitted(parsedHydratedMessages, committedHydratedMessages) && (this.currentStatus === "idle" || this.currentStatus === "generating" && this.isWaitingForResponse && parsed.status === "idle" && this.runDetectStatus(this.recentOutputBuffer) === "idle");
14185
+ const shouldAdoptParsedIdleReplay = !this.currentTurnScope && !this.activeModal && !!parsedLastAssistant && parsedTranscriptIsRicherThanCommitted(parsedHydratedMessages, this.committedMessages) && (this.currentStatus === "idle" || this.currentStatus === "generating" && this.isWaitingForResponse && parsed.status === "idle" && this.runDetectStatus(this.recentOutputBuffer) === "idle");
14083
14186
  if (shouldAdoptParsedIdleReplay) {
14084
- this.committedMessages = normalizeCliParsedMessages(parsed.messages, {
14187
+ this.committedMessages = this.getSharedCommittedPrefixLength(parsed.messages) === this.committedMessages.length ? parsedHydratedMessages.map((message) => ({
14188
+ role: message.role,
14189
+ content: typeof message.content === "string" ? message.content : String(message.content || ""),
14190
+ timestamp: message.timestamp,
14191
+ receivedAt: message.receivedAt,
14192
+ kind: message.kind,
14193
+ id: message.id,
14194
+ index: message.index,
14195
+ meta: message.meta,
14196
+ senderName: message.senderName
14197
+ })) : normalizeCliParsedMessages(parsed.messages, {
14085
14198
  committedMessages: this.committedMessages,
14086
14199
  scope: this.currentTurnScope,
14087
14200
  lastOutputAt: this.lastOutputAt
@@ -14100,15 +14213,9 @@ var init_provider_cli_adapter = __esm({
14100
14213
  this.onStatusChange?.();
14101
14214
  }
14102
14215
  }
14103
- const effectiveCommittedHydratedMessages = shouldAdoptParsedIdleReplay ? this.committedMessages.map((message, index) => buildChatMessage({
14104
- ...message,
14105
- id: message.id || `msg_${index}`,
14106
- index: typeof message.index === "number" ? message.index : index,
14107
- receivedAt: typeof message.receivedAt === "number" ? message.receivedAt : message.timestamp
14108
- })) : committedHydratedMessages;
14109
- const shouldPreferCommittedHistoryReplay = !this.currentTurnScope && !this.activeModal && effectiveCommittedHydratedMessages.length > parsedHydratedMessages.length;
14216
+ const shouldPreferCommittedHistoryReplay = !this.currentTurnScope && !this.activeModal && this.committedMessages.length > parsedHydratedMessages.length;
14110
14217
  const shouldPreferCommittedIdleReplay = shouldPreferCommittedMessages && !shouldAdoptParsedIdleReplay;
14111
- const hydratedMessages = shouldPreferCommittedIdleReplay || shouldPreferCommittedHistoryReplay ? effectiveCommittedHydratedMessages : parsedHydratedMessages;
14218
+ const hydratedMessages = shouldPreferCommittedIdleReplay || shouldPreferCommittedHistoryReplay ? this.buildCommittedChatMessages() : parsedHydratedMessages;
14112
14219
  result = {
14113
14220
  id: parsed.id || "cli_session",
14114
14221
  status: parsed.status || this.currentStatus,
@@ -15014,6 +15121,11 @@ var init_cli_provider_instance = __esm({
15014
15121
  launchMode;
15015
15122
  startedAt = Date.now();
15016
15123
  onProviderSessionResolved;
15124
+ refreshProviderDefinition(provider) {
15125
+ if (provider.type !== this.type || provider.category !== "cli") return;
15126
+ this.provider = provider;
15127
+ this.adapter.refreshProviderDefinition(provider);
15128
+ }
15017
15129
  // ─── Lifecycle ─────────────────────────────────
15018
15130
  async init(context) {
15019
15131
  this.context = context;
@@ -15224,9 +15336,11 @@ var init_cli_provider_instance = __esm({
15224
15336
  const autoApproveActive = adapterStatus.status === "waiting_approval" && this.shouldAutoApprove();
15225
15337
  const visibleStatus = autoApproveActive ? "generating" : adapterStatus.status;
15226
15338
  const runtime = this.adapter.getRuntimeMetadata();
15339
+ const lastCommittedMessageActivityAt = typeof this.adapter.getLastCommittedMessageActivityAt === "function" ? this.adapter.getLastCommittedMessageActivityAt() : 0;
15227
15340
  return {
15228
15341
  id: this.instanceId,
15229
15342
  status: visibleStatus,
15343
+ lastMessageAt: lastCommittedMessageActivityAt || void 0,
15230
15344
  runtimeLifecycle: runtime?.lifecycle ?? null,
15231
15345
  runtimeSurfaceKind: runtime?.surfaceKind,
15232
15346
  runtimeRestoredFromStorage: runtime?.restoredFromStorage === true,
@@ -16059,10 +16173,10 @@ function mergeDefs(...defs) {
16059
16173
  function cloneDef(schema) {
16060
16174
  return mergeDefs(schema._zod.def);
16061
16175
  }
16062
- function getElementAtPath(obj, path35) {
16063
- if (!path35)
16176
+ function getElementAtPath(obj, path36) {
16177
+ if (!path36)
16064
16178
  return obj;
16065
- return path35.reduce((acc, key) => acc?.[key], obj);
16179
+ return path36.reduce((acc, key) => acc?.[key], obj);
16066
16180
  }
16067
16181
  function promiseAllObject(promisesObj) {
16068
16182
  const keys = Object.keys(promisesObj);
@@ -16374,11 +16488,11 @@ function aborted(x, startIndex = 0) {
16374
16488
  }
16375
16489
  return false;
16376
16490
  }
16377
- function prefixIssues(path35, issues) {
16491
+ function prefixIssues(path36, issues) {
16378
16492
  return issues.map((iss) => {
16379
16493
  var _a2;
16380
16494
  (_a2 = iss).path ?? (_a2.path = []);
16381
- iss.path.unshift(path35);
16495
+ iss.path.unshift(path36);
16382
16496
  return iss;
16383
16497
  });
16384
16498
  }
@@ -16621,7 +16735,7 @@ function formatError(error48, mapper = (issue2) => issue2.message) {
16621
16735
  }
16622
16736
  function treeifyError(error48, mapper = (issue2) => issue2.message) {
16623
16737
  const result = { errors: [] };
16624
- const processError = (error49, path35 = []) => {
16738
+ const processError = (error49, path36 = []) => {
16625
16739
  var _a2, _b;
16626
16740
  for (const issue2 of error49.issues) {
16627
16741
  if (issue2.code === "invalid_union" && issue2.errors.length) {
@@ -16631,7 +16745,7 @@ function treeifyError(error48, mapper = (issue2) => issue2.message) {
16631
16745
  } else if (issue2.code === "invalid_element") {
16632
16746
  processError({ issues: issue2.issues }, issue2.path);
16633
16747
  } else {
16634
- const fullpath = [...path35, ...issue2.path];
16748
+ const fullpath = [...path36, ...issue2.path];
16635
16749
  if (fullpath.length === 0) {
16636
16750
  result.errors.push(mapper(issue2));
16637
16751
  continue;
@@ -16663,8 +16777,8 @@ function treeifyError(error48, mapper = (issue2) => issue2.message) {
16663
16777
  }
16664
16778
  function toDotPath(_path) {
16665
16779
  const segs = [];
16666
- const path35 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
16667
- for (const seg of path35) {
16780
+ const path36 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
16781
+ for (const seg of path36) {
16668
16782
  if (typeof seg === "number")
16669
16783
  segs.push(`[${seg}]`);
16670
16784
  else if (typeof seg === "symbol")
@@ -29428,13 +29542,13 @@ function resolveRef(ref, ctx) {
29428
29542
  if (!ref.startsWith("#")) {
29429
29543
  throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
29430
29544
  }
29431
- const path35 = ref.slice(1).split("/").filter(Boolean);
29432
- if (path35.length === 0) {
29545
+ const path36 = ref.slice(1).split("/").filter(Boolean);
29546
+ if (path36.length === 0) {
29433
29547
  return ctx.rootSchema;
29434
29548
  }
29435
29549
  const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
29436
- if (path35[0] === defsKey) {
29437
- const key = path35[1];
29550
+ if (path36[0] === defsKey) {
29551
+ const key = path36[1];
29438
29552
  if (!key || !ctx.defs[key]) {
29439
29553
  throw new Error(`Reference not found: ${ref}`);
29440
29554
  }
@@ -34176,7 +34290,7 @@ var init_readdirp = __esm({
34176
34290
  this._directoryFilter = normalizeFilter(opts.directoryFilter);
34177
34291
  const statMethod = opts.lstat ? import_promises.lstat : import_promises.stat;
34178
34292
  if (wantBigintFsStats) {
34179
- this._stat = (path35) => statMethod(path35, { bigint: true });
34293
+ this._stat = (path36) => statMethod(path36, { bigint: true });
34180
34294
  } else {
34181
34295
  this._stat = statMethod;
34182
34296
  }
@@ -34201,8 +34315,8 @@ var init_readdirp = __esm({
34201
34315
  const par = this.parent;
34202
34316
  const fil = par && par.files;
34203
34317
  if (fil && fil.length > 0) {
34204
- const { path: path35, depth } = par;
34205
- const slice = fil.splice(0, batch).map((dirent) => this._formatEntry(dirent, path35));
34318
+ const { path: path36, depth } = par;
34319
+ const slice = fil.splice(0, batch).map((dirent) => this._formatEntry(dirent, path36));
34206
34320
  const awaited = await Promise.all(slice);
34207
34321
  for (const entry of awaited) {
34208
34322
  if (!entry)
@@ -34242,20 +34356,20 @@ var init_readdirp = __esm({
34242
34356
  this.reading = false;
34243
34357
  }
34244
34358
  }
34245
- async _exploreDir(path35, depth) {
34359
+ async _exploreDir(path36, depth) {
34246
34360
  let files;
34247
34361
  try {
34248
- files = await (0, import_promises.readdir)(path35, this._rdOptions);
34362
+ files = await (0, import_promises.readdir)(path36, this._rdOptions);
34249
34363
  } catch (error48) {
34250
34364
  this._onError(error48);
34251
34365
  }
34252
- return { files, depth, path: path35 };
34366
+ return { files, depth, path: path36 };
34253
34367
  }
34254
- async _formatEntry(dirent, path35) {
34368
+ async _formatEntry(dirent, path36) {
34255
34369
  let entry;
34256
34370
  const basename10 = this._isDirent ? dirent.name : dirent;
34257
34371
  try {
34258
- const fullPath = (0, import_node_path.resolve)((0, import_node_path.join)(path35, basename10));
34372
+ const fullPath = (0, import_node_path.resolve)((0, import_node_path.join)(path36, basename10));
34259
34373
  entry = { path: (0, import_node_path.relative)(this._root, fullPath), fullPath, basename: basename10 };
34260
34374
  entry[this._statsProp] = this._isDirent ? dirent : await this._stat(fullPath);
34261
34375
  } catch (err) {
@@ -34312,16 +34426,16 @@ var init_readdirp = __esm({
34312
34426
  });
34313
34427
 
34314
34428
  // ../../oss/packages/daemon-core/node_modules/chokidar/handler.js
34315
- function createFsWatchInstance(path35, options, listener, errHandler, emitRaw) {
34429
+ function createFsWatchInstance(path36, options, listener, errHandler, emitRaw) {
34316
34430
  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));
34431
+ listener(path36);
34432
+ emitRaw(rawEvent, evPath, { watchedPath: path36 });
34433
+ if (evPath && path36 !== evPath) {
34434
+ fsWatchBroadcast(sp.resolve(path36, evPath), KEY_LISTENERS, sp.join(path36, evPath));
34321
34435
  }
34322
34436
  };
34323
34437
  try {
34324
- return (0, import_node_fs.watch)(path35, {
34438
+ return (0, import_node_fs.watch)(path36, {
34325
34439
  persistent: options.persistent
34326
34440
  }, handleEvent);
34327
34441
  } catch (error48) {
@@ -34670,12 +34784,12 @@ var init_handler2 = __esm({
34670
34784
  listener(val1, val2, val3);
34671
34785
  });
34672
34786
  };
34673
- setFsWatchListener = (path35, fullPath, options, handlers) => {
34787
+ setFsWatchListener = (path36, fullPath, options, handlers) => {
34674
34788
  const { listener, errHandler, rawEmitter } = handlers;
34675
34789
  let cont = FsWatchInstances.get(fullPath);
34676
34790
  let watcher;
34677
34791
  if (!options.persistent) {
34678
- watcher = createFsWatchInstance(path35, options, listener, errHandler, rawEmitter);
34792
+ watcher = createFsWatchInstance(path36, options, listener, errHandler, rawEmitter);
34679
34793
  if (!watcher)
34680
34794
  return;
34681
34795
  return watcher.close.bind(watcher);
@@ -34686,7 +34800,7 @@ var init_handler2 = __esm({
34686
34800
  addAndConvert(cont, KEY_RAW, rawEmitter);
34687
34801
  } else {
34688
34802
  watcher = createFsWatchInstance(
34689
- path35,
34803
+ path36,
34690
34804
  options,
34691
34805
  fsWatchBroadcast.bind(null, fullPath, KEY_LISTENERS),
34692
34806
  errHandler,
@@ -34701,7 +34815,7 @@ var init_handler2 = __esm({
34701
34815
  cont.watcherUnusable = true;
34702
34816
  if (isWindows && error48.code === "EPERM") {
34703
34817
  try {
34704
- const fd = await (0, import_promises2.open)(path35, "r");
34818
+ const fd = await (0, import_promises2.open)(path36, "r");
34705
34819
  await fd.close();
34706
34820
  broadcastErr(error48);
34707
34821
  } catch (err) {
@@ -34732,7 +34846,7 @@ var init_handler2 = __esm({
34732
34846
  };
34733
34847
  };
34734
34848
  FsWatchFileInstances = /* @__PURE__ */ new Map();
34735
- setFsWatchFileListener = (path35, fullPath, options, handlers) => {
34849
+ setFsWatchFileListener = (path36, fullPath, options, handlers) => {
34736
34850
  const { listener, rawEmitter } = handlers;
34737
34851
  let cont = FsWatchFileInstances.get(fullPath);
34738
34852
  const copts = cont && cont.options;
@@ -34754,7 +34868,7 @@ var init_handler2 = __esm({
34754
34868
  });
34755
34869
  const currmtime = curr.mtimeMs;
34756
34870
  if (curr.size !== prev.size || currmtime > prev.mtimeMs || currmtime === 0) {
34757
- foreach(cont.listeners, (listener2) => listener2(path35, curr));
34871
+ foreach(cont.listeners, (listener2) => listener2(path36, curr));
34758
34872
  }
34759
34873
  })
34760
34874
  };
@@ -34784,13 +34898,13 @@ var init_handler2 = __esm({
34784
34898
  * @param listener on fs change
34785
34899
  * @returns closer for the watcher instance
34786
34900
  */
34787
- _watchWithNodeFs(path35, listener) {
34901
+ _watchWithNodeFs(path36, listener) {
34788
34902
  const opts = this.fsw.options;
34789
- const directory = sp.dirname(path35);
34790
- const basename10 = sp.basename(path35);
34903
+ const directory = sp.dirname(path36);
34904
+ const basename10 = sp.basename(path36);
34791
34905
  const parent = this.fsw._getWatchedDir(directory);
34792
34906
  parent.add(basename10);
34793
- const absolutePath = sp.resolve(path35);
34907
+ const absolutePath = sp.resolve(path36);
34794
34908
  const options = {
34795
34909
  persistent: opts.persistent
34796
34910
  };
@@ -34800,12 +34914,12 @@ var init_handler2 = __esm({
34800
34914
  if (opts.usePolling) {
34801
34915
  const enableBin = opts.interval !== opts.binaryInterval;
34802
34916
  options.interval = enableBin && isBinaryPath(basename10) ? opts.binaryInterval : opts.interval;
34803
- closer = setFsWatchFileListener(path35, absolutePath, options, {
34917
+ closer = setFsWatchFileListener(path36, absolutePath, options, {
34804
34918
  listener,
34805
34919
  rawEmitter: this.fsw._emitRaw
34806
34920
  });
34807
34921
  } else {
34808
- closer = setFsWatchListener(path35, absolutePath, options, {
34922
+ closer = setFsWatchListener(path36, absolutePath, options, {
34809
34923
  listener,
34810
34924
  errHandler: this._boundHandleError,
34811
34925
  rawEmitter: this.fsw._emitRaw
@@ -34827,7 +34941,7 @@ var init_handler2 = __esm({
34827
34941
  let prevStats = stats;
34828
34942
  if (parent.has(basename10))
34829
34943
  return;
34830
- const listener = async (path35, newStats) => {
34944
+ const listener = async (path36, newStats) => {
34831
34945
  if (!this.fsw._throttle(THROTTLE_MODE_WATCH, file2, 5))
34832
34946
  return;
34833
34947
  if (!newStats || newStats.mtimeMs === 0) {
@@ -34841,11 +34955,11 @@ var init_handler2 = __esm({
34841
34955
  this.fsw._emit(EV.CHANGE, file2, newStats2);
34842
34956
  }
34843
34957
  if ((isMacos || isLinux || isFreeBSD) && prevStats.ino !== newStats2.ino) {
34844
- this.fsw._closeFile(path35);
34958
+ this.fsw._closeFile(path36);
34845
34959
  prevStats = newStats2;
34846
34960
  const closer2 = this._watchWithNodeFs(file2, listener);
34847
34961
  if (closer2)
34848
- this.fsw._addPathCloser(path35, closer2);
34962
+ this.fsw._addPathCloser(path36, closer2);
34849
34963
  } else {
34850
34964
  prevStats = newStats2;
34851
34965
  }
@@ -34877,7 +34991,7 @@ var init_handler2 = __esm({
34877
34991
  * @param item basename of this item
34878
34992
  * @returns true if no more processing is needed for this entry.
34879
34993
  */
34880
- async _handleSymlink(entry, directory, path35, item) {
34994
+ async _handleSymlink(entry, directory, path36, item) {
34881
34995
  if (this.fsw.closed) {
34882
34996
  return;
34883
34997
  }
@@ -34887,7 +35001,7 @@ var init_handler2 = __esm({
34887
35001
  this.fsw._incrReadyCount();
34888
35002
  let linkPath;
34889
35003
  try {
34890
- linkPath = await (0, import_promises2.realpath)(path35);
35004
+ linkPath = await (0, import_promises2.realpath)(path36);
34891
35005
  } catch (e) {
34892
35006
  this.fsw._emitReady();
34893
35007
  return true;
@@ -34897,12 +35011,12 @@ var init_handler2 = __esm({
34897
35011
  if (dir.has(item)) {
34898
35012
  if (this.fsw._symlinkPaths.get(full) !== linkPath) {
34899
35013
  this.fsw._symlinkPaths.set(full, linkPath);
34900
- this.fsw._emit(EV.CHANGE, path35, entry.stats);
35014
+ this.fsw._emit(EV.CHANGE, path36, entry.stats);
34901
35015
  }
34902
35016
  } else {
34903
35017
  dir.add(item);
34904
35018
  this.fsw._symlinkPaths.set(full, linkPath);
34905
- this.fsw._emit(EV.ADD, path35, entry.stats);
35019
+ this.fsw._emit(EV.ADD, path36, entry.stats);
34906
35020
  }
34907
35021
  this.fsw._emitReady();
34908
35022
  return true;
@@ -34932,9 +35046,9 @@ var init_handler2 = __esm({
34932
35046
  return;
34933
35047
  }
34934
35048
  const item = entry.path;
34935
- let path35 = sp.join(directory, item);
35049
+ let path36 = sp.join(directory, item);
34936
35050
  current.add(item);
34937
- if (entry.stats.isSymbolicLink() && await this._handleSymlink(entry, directory, path35, item)) {
35051
+ if (entry.stats.isSymbolicLink() && await this._handleSymlink(entry, directory, path36, item)) {
34938
35052
  return;
34939
35053
  }
34940
35054
  if (this.fsw.closed) {
@@ -34943,8 +35057,8 @@ var init_handler2 = __esm({
34943
35057
  }
34944
35058
  if (item === target || !target && !previous.has(item)) {
34945
35059
  this.fsw._incrReadyCount();
34946
- path35 = sp.join(dir, sp.relative(dir, path35));
34947
- this._addToNodeFs(path35, initialAdd, wh, depth + 1);
35060
+ path36 = sp.join(dir, sp.relative(dir, path36));
35061
+ this._addToNodeFs(path36, initialAdd, wh, depth + 1);
34948
35062
  }
34949
35063
  }).on(EV.ERROR, this._boundHandleError);
34950
35064
  return new Promise((resolve18, reject) => {
@@ -35013,13 +35127,13 @@ var init_handler2 = __esm({
35013
35127
  * @param depth Child path actually targeted for watch
35014
35128
  * @param target Child path actually targeted for watch
35015
35129
  */
35016
- async _addToNodeFs(path35, initialAdd, priorWh, depth, target) {
35130
+ async _addToNodeFs(path36, initialAdd, priorWh, depth, target) {
35017
35131
  const ready = this.fsw._emitReady;
35018
- if (this.fsw._isIgnored(path35) || this.fsw.closed) {
35132
+ if (this.fsw._isIgnored(path36) || this.fsw.closed) {
35019
35133
  ready();
35020
35134
  return false;
35021
35135
  }
35022
- const wh = this.fsw._getWatchHelpers(path35);
35136
+ const wh = this.fsw._getWatchHelpers(path36);
35023
35137
  if (priorWh) {
35024
35138
  wh.filterPath = (entry) => priorWh.filterPath(entry);
35025
35139
  wh.filterDir = (entry) => priorWh.filterDir(entry);
@@ -35035,8 +35149,8 @@ var init_handler2 = __esm({
35035
35149
  const follow = this.fsw.options.followSymlinks;
35036
35150
  let closer;
35037
35151
  if (stats.isDirectory()) {
35038
- const absPath = sp.resolve(path35);
35039
- const targetPath = follow ? await (0, import_promises2.realpath)(path35) : path35;
35152
+ const absPath = sp.resolve(path36);
35153
+ const targetPath = follow ? await (0, import_promises2.realpath)(path36) : path36;
35040
35154
  if (this.fsw.closed)
35041
35155
  return;
35042
35156
  closer = await this._handleDir(wh.watchPath, stats, initialAdd, depth, target, wh, targetPath);
@@ -35046,29 +35160,29 @@ var init_handler2 = __esm({
35046
35160
  this.fsw._symlinkPaths.set(absPath, targetPath);
35047
35161
  }
35048
35162
  } else if (stats.isSymbolicLink()) {
35049
- const targetPath = follow ? await (0, import_promises2.realpath)(path35) : path35;
35163
+ const targetPath = follow ? await (0, import_promises2.realpath)(path36) : path36;
35050
35164
  if (this.fsw.closed)
35051
35165
  return;
35052
35166
  const parent = sp.dirname(wh.watchPath);
35053
35167
  this.fsw._getWatchedDir(parent).add(wh.watchPath);
35054
35168
  this.fsw._emit(EV.ADD, wh.watchPath, stats);
35055
- closer = await this._handleDir(parent, stats, initialAdd, depth, path35, wh, targetPath);
35169
+ closer = await this._handleDir(parent, stats, initialAdd, depth, path36, wh, targetPath);
35056
35170
  if (this.fsw.closed)
35057
35171
  return;
35058
35172
  if (targetPath !== void 0) {
35059
- this.fsw._symlinkPaths.set(sp.resolve(path35), targetPath);
35173
+ this.fsw._symlinkPaths.set(sp.resolve(path36), targetPath);
35060
35174
  }
35061
35175
  } else {
35062
35176
  closer = this._handleFile(wh.watchPath, stats, initialAdd);
35063
35177
  }
35064
35178
  ready();
35065
35179
  if (closer)
35066
- this.fsw._addPathCloser(path35, closer);
35180
+ this.fsw._addPathCloser(path36, closer);
35067
35181
  return false;
35068
35182
  } catch (error48) {
35069
35183
  if (this.fsw._handleError(error48)) {
35070
35184
  ready();
35071
- return path35;
35185
+ return path36;
35072
35186
  }
35073
35187
  }
35074
35188
  }
@@ -35103,24 +35217,24 @@ function createPattern(matcher) {
35103
35217
  }
35104
35218
  return () => false;
35105
35219
  }
35106
- function normalizePath(path35) {
35107
- if (typeof path35 !== "string")
35220
+ function normalizePath(path36) {
35221
+ if (typeof path36 !== "string")
35108
35222
  throw new Error("string expected");
35109
- path35 = sp2.normalize(path35);
35110
- path35 = path35.replace(/\\/g, "/");
35223
+ path36 = sp2.normalize(path36);
35224
+ path36 = path36.replace(/\\/g, "/");
35111
35225
  let prepend = false;
35112
- if (path35.startsWith("//"))
35226
+ if (path36.startsWith("//"))
35113
35227
  prepend = true;
35114
- path35 = path35.replace(DOUBLE_SLASH_RE, "/");
35228
+ path36 = path36.replace(DOUBLE_SLASH_RE, "/");
35115
35229
  if (prepend)
35116
- path35 = "/" + path35;
35117
- return path35;
35230
+ path36 = "/" + path36;
35231
+ return path36;
35118
35232
  }
35119
35233
  function matchPatterns(patterns, testString, stats) {
35120
- const path35 = normalizePath(testString);
35234
+ const path36 = normalizePath(testString);
35121
35235
  for (let index = 0; index < patterns.length; index++) {
35122
35236
  const pattern = patterns[index];
35123
- if (pattern(path35, stats)) {
35237
+ if (pattern(path36, stats)) {
35124
35238
  return true;
35125
35239
  }
35126
35240
  }
@@ -35183,19 +35297,19 @@ var init_chokidar = __esm({
35183
35297
  }
35184
35298
  return str;
35185
35299
  };
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));
35300
+ normalizePathToUnix = (path36) => toUnix(sp2.normalize(toUnix(path36)));
35301
+ normalizeIgnored = (cwd = "") => (path36) => {
35302
+ if (typeof path36 === "string") {
35303
+ return normalizePathToUnix(sp2.isAbsolute(path36) ? path36 : sp2.join(cwd, path36));
35190
35304
  } else {
35191
- return path35;
35305
+ return path36;
35192
35306
  }
35193
35307
  };
35194
- getAbsolutePath = (path35, cwd) => {
35195
- if (sp2.isAbsolute(path35)) {
35196
- return path35;
35308
+ getAbsolutePath = (path36, cwd) => {
35309
+ if (sp2.isAbsolute(path36)) {
35310
+ return path36;
35197
35311
  }
35198
- return sp2.join(cwd, path35);
35312
+ return sp2.join(cwd, path36);
35199
35313
  };
35200
35314
  EMPTY_SET = Object.freeze(/* @__PURE__ */ new Set());
35201
35315
  DirEntry = class {
@@ -35260,10 +35374,10 @@ var init_chokidar = __esm({
35260
35374
  dirParts;
35261
35375
  followSymlinks;
35262
35376
  statMethod;
35263
- constructor(path35, follow, fsw) {
35377
+ constructor(path36, follow, fsw) {
35264
35378
  this.fsw = fsw;
35265
- const watchPath = path35;
35266
- this.path = path35 = path35.replace(REPLACER_RE, "");
35379
+ const watchPath = path36;
35380
+ this.path = path36 = path36.replace(REPLACER_RE, "");
35267
35381
  this.watchPath = watchPath;
35268
35382
  this.fullWatchPath = sp2.resolve(watchPath);
35269
35383
  this.dirParts = [];
@@ -35403,20 +35517,20 @@ var init_chokidar = __esm({
35403
35517
  this._closePromise = void 0;
35404
35518
  let paths = unifyPaths(paths_);
35405
35519
  if (cwd) {
35406
- paths = paths.map((path35) => {
35407
- const absPath = getAbsolutePath(path35, cwd);
35520
+ paths = paths.map((path36) => {
35521
+ const absPath = getAbsolutePath(path36, cwd);
35408
35522
  return absPath;
35409
35523
  });
35410
35524
  }
35411
- paths.forEach((path35) => {
35412
- this._removeIgnoredPath(path35);
35525
+ paths.forEach((path36) => {
35526
+ this._removeIgnoredPath(path36);
35413
35527
  });
35414
35528
  this._userIgnored = void 0;
35415
35529
  if (!this._readyCount)
35416
35530
  this._readyCount = 0;
35417
35531
  this._readyCount += paths.length;
35418
- Promise.all(paths.map(async (path35) => {
35419
- const res = await this._nodeFsHandler._addToNodeFs(path35, !_internal, void 0, 0, _origAdd);
35532
+ Promise.all(paths.map(async (path36) => {
35533
+ const res = await this._nodeFsHandler._addToNodeFs(path36, !_internal, void 0, 0, _origAdd);
35420
35534
  if (res)
35421
35535
  this._emitReady();
35422
35536
  return res;
@@ -35438,17 +35552,17 @@ var init_chokidar = __esm({
35438
35552
  return this;
35439
35553
  const paths = unifyPaths(paths_);
35440
35554
  const { cwd } = this.options;
35441
- paths.forEach((path35) => {
35442
- if (!sp2.isAbsolute(path35) && !this._closers.has(path35)) {
35555
+ paths.forEach((path36) => {
35556
+ if (!sp2.isAbsolute(path36) && !this._closers.has(path36)) {
35443
35557
  if (cwd)
35444
- path35 = sp2.join(cwd, path35);
35445
- path35 = sp2.resolve(path35);
35558
+ path36 = sp2.join(cwd, path36);
35559
+ path36 = sp2.resolve(path36);
35446
35560
  }
35447
- this._closePath(path35);
35448
- this._addIgnoredPath(path35);
35449
- if (this._watched.has(path35)) {
35561
+ this._closePath(path36);
35562
+ this._addIgnoredPath(path36);
35563
+ if (this._watched.has(path36)) {
35450
35564
  this._addIgnoredPath({
35451
- path: path35,
35565
+ path: path36,
35452
35566
  recursive: true
35453
35567
  });
35454
35568
  }
@@ -35512,38 +35626,38 @@ var init_chokidar = __esm({
35512
35626
  * @param stats arguments to be passed with event
35513
35627
  * @returns the error if defined, otherwise the value of the FSWatcher instance's `closed` flag
35514
35628
  */
35515
- async _emit(event, path35, stats) {
35629
+ async _emit(event, path36, stats) {
35516
35630
  if (this.closed)
35517
35631
  return;
35518
35632
  const opts = this.options;
35519
35633
  if (isWindows)
35520
- path35 = sp2.normalize(path35);
35634
+ path36 = sp2.normalize(path36);
35521
35635
  if (opts.cwd)
35522
- path35 = sp2.relative(opts.cwd, path35);
35523
- const args = [path35];
35636
+ path36 = sp2.relative(opts.cwd, path36);
35637
+ const args = [path36];
35524
35638
  if (stats != null)
35525
35639
  args.push(stats);
35526
35640
  const awf = opts.awaitWriteFinish;
35527
35641
  let pw;
35528
- if (awf && (pw = this._pendingWrites.get(path35))) {
35642
+ if (awf && (pw = this._pendingWrites.get(path36))) {
35529
35643
  pw.lastChange = /* @__PURE__ */ new Date();
35530
35644
  return this;
35531
35645
  }
35532
35646
  if (opts.atomic) {
35533
35647
  if (event === EVENTS.UNLINK) {
35534
- this._pendingUnlinks.set(path35, [event, ...args]);
35648
+ this._pendingUnlinks.set(path36, [event, ...args]);
35535
35649
  setTimeout(() => {
35536
- this._pendingUnlinks.forEach((entry, path36) => {
35650
+ this._pendingUnlinks.forEach((entry, path37) => {
35537
35651
  this.emit(...entry);
35538
35652
  this.emit(EVENTS.ALL, ...entry);
35539
- this._pendingUnlinks.delete(path36);
35653
+ this._pendingUnlinks.delete(path37);
35540
35654
  });
35541
35655
  }, typeof opts.atomic === "number" ? opts.atomic : 100);
35542
35656
  return this;
35543
35657
  }
35544
- if (event === EVENTS.ADD && this._pendingUnlinks.has(path35)) {
35658
+ if (event === EVENTS.ADD && this._pendingUnlinks.has(path36)) {
35545
35659
  event = EVENTS.CHANGE;
35546
- this._pendingUnlinks.delete(path35);
35660
+ this._pendingUnlinks.delete(path36);
35547
35661
  }
35548
35662
  }
35549
35663
  if (awf && (event === EVENTS.ADD || event === EVENTS.CHANGE) && this._readyEmitted) {
@@ -35561,16 +35675,16 @@ var init_chokidar = __esm({
35561
35675
  this.emitWithAll(event, args);
35562
35676
  }
35563
35677
  };
35564
- this._awaitWriteFinish(path35, awf.stabilityThreshold, event, awfEmit);
35678
+ this._awaitWriteFinish(path36, awf.stabilityThreshold, event, awfEmit);
35565
35679
  return this;
35566
35680
  }
35567
35681
  if (event === EVENTS.CHANGE) {
35568
- const isThrottled = !this._throttle(EVENTS.CHANGE, path35, 50);
35682
+ const isThrottled = !this._throttle(EVENTS.CHANGE, path36, 50);
35569
35683
  if (isThrottled)
35570
35684
  return this;
35571
35685
  }
35572
35686
  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;
35687
+ const fullPath = opts.cwd ? sp2.join(opts.cwd, path36) : path36;
35574
35688
  let stats2;
35575
35689
  try {
35576
35690
  stats2 = await (0, import_promises3.stat)(fullPath);
@@ -35601,23 +35715,23 @@ var init_chokidar = __esm({
35601
35715
  * @param timeout duration of time to suppress duplicate actions
35602
35716
  * @returns tracking object or false if action should be suppressed
35603
35717
  */
35604
- _throttle(actionType, path35, timeout) {
35718
+ _throttle(actionType, path36, timeout) {
35605
35719
  if (!this._throttled.has(actionType)) {
35606
35720
  this._throttled.set(actionType, /* @__PURE__ */ new Map());
35607
35721
  }
35608
35722
  const action = this._throttled.get(actionType);
35609
35723
  if (!action)
35610
35724
  throw new Error("invalid throttle");
35611
- const actionPath = action.get(path35);
35725
+ const actionPath = action.get(path36);
35612
35726
  if (actionPath) {
35613
35727
  actionPath.count++;
35614
35728
  return false;
35615
35729
  }
35616
35730
  let timeoutObject;
35617
35731
  const clear = () => {
35618
- const item = action.get(path35);
35732
+ const item = action.get(path36);
35619
35733
  const count = item ? item.count : 0;
35620
- action.delete(path35);
35734
+ action.delete(path36);
35621
35735
  clearTimeout(timeoutObject);
35622
35736
  if (item)
35623
35737
  clearTimeout(item.timeoutObject);
@@ -35625,7 +35739,7 @@ var init_chokidar = __esm({
35625
35739
  };
35626
35740
  timeoutObject = setTimeout(clear, timeout);
35627
35741
  const thr = { timeoutObject, clear, count: 0 };
35628
- action.set(path35, thr);
35742
+ action.set(path36, thr);
35629
35743
  return thr;
35630
35744
  }
35631
35745
  _incrReadyCount() {
@@ -35639,44 +35753,44 @@ var init_chokidar = __esm({
35639
35753
  * @param event
35640
35754
  * @param awfEmit Callback to be called when ready for event to be emitted.
35641
35755
  */
35642
- _awaitWriteFinish(path35, threshold, event, awfEmit) {
35756
+ _awaitWriteFinish(path36, threshold, event, awfEmit) {
35643
35757
  const awf = this.options.awaitWriteFinish;
35644
35758
  if (typeof awf !== "object")
35645
35759
  return;
35646
35760
  const pollInterval = awf.pollInterval;
35647
35761
  let timeoutHandler;
35648
- let fullPath = path35;
35649
- if (this.options.cwd && !sp2.isAbsolute(path35)) {
35650
- fullPath = sp2.join(this.options.cwd, path35);
35762
+ let fullPath = path36;
35763
+ if (this.options.cwd && !sp2.isAbsolute(path36)) {
35764
+ fullPath = sp2.join(this.options.cwd, path36);
35651
35765
  }
35652
35766
  const now = /* @__PURE__ */ new Date();
35653
35767
  const writes = this._pendingWrites;
35654
35768
  function awaitWriteFinishFn(prevStat) {
35655
35769
  (0, import_node_fs2.stat)(fullPath, (err, curStat) => {
35656
- if (err || !writes.has(path35)) {
35770
+ if (err || !writes.has(path36)) {
35657
35771
  if (err && err.code !== "ENOENT")
35658
35772
  awfEmit(err);
35659
35773
  return;
35660
35774
  }
35661
35775
  const now2 = Number(/* @__PURE__ */ new Date());
35662
35776
  if (prevStat && curStat.size !== prevStat.size) {
35663
- writes.get(path35).lastChange = now2;
35777
+ writes.get(path36).lastChange = now2;
35664
35778
  }
35665
- const pw = writes.get(path35);
35779
+ const pw = writes.get(path36);
35666
35780
  const df = now2 - pw.lastChange;
35667
35781
  if (df >= threshold) {
35668
- writes.delete(path35);
35782
+ writes.delete(path36);
35669
35783
  awfEmit(void 0, curStat);
35670
35784
  } else {
35671
35785
  timeoutHandler = setTimeout(awaitWriteFinishFn, pollInterval, curStat);
35672
35786
  }
35673
35787
  });
35674
35788
  }
35675
- if (!writes.has(path35)) {
35676
- writes.set(path35, {
35789
+ if (!writes.has(path36)) {
35790
+ writes.set(path36, {
35677
35791
  lastChange: now,
35678
35792
  cancelWait: () => {
35679
- writes.delete(path35);
35793
+ writes.delete(path36);
35680
35794
  clearTimeout(timeoutHandler);
35681
35795
  return event;
35682
35796
  }
@@ -35687,8 +35801,8 @@ var init_chokidar = __esm({
35687
35801
  /**
35688
35802
  * Determines whether user has asked to ignore this path.
35689
35803
  */
35690
- _isIgnored(path35, stats) {
35691
- if (this.options.atomic && DOT_RE.test(path35))
35804
+ _isIgnored(path36, stats) {
35805
+ if (this.options.atomic && DOT_RE.test(path36))
35692
35806
  return true;
35693
35807
  if (!this._userIgnored) {
35694
35808
  const { cwd } = this.options;
@@ -35698,17 +35812,17 @@ var init_chokidar = __esm({
35698
35812
  const list = [...ignoredPaths.map(normalizeIgnored(cwd)), ...ignored];
35699
35813
  this._userIgnored = anymatch(list, void 0);
35700
35814
  }
35701
- return this._userIgnored(path35, stats);
35815
+ return this._userIgnored(path36, stats);
35702
35816
  }
35703
- _isntIgnored(path35, stat4) {
35704
- return !this._isIgnored(path35, stat4);
35817
+ _isntIgnored(path36, stat4) {
35818
+ return !this._isIgnored(path36, stat4);
35705
35819
  }
35706
35820
  /**
35707
35821
  * Provides a set of common helpers and properties relating to symlink handling.
35708
35822
  * @param path file or directory pattern being watched
35709
35823
  */
35710
- _getWatchHelpers(path35) {
35711
- return new WatchHelper(path35, this.options.followSymlinks, this);
35824
+ _getWatchHelpers(path36) {
35825
+ return new WatchHelper(path36, this.options.followSymlinks, this);
35712
35826
  }
35713
35827
  // Directory helpers
35714
35828
  // -----------------
@@ -35740,63 +35854,63 @@ var init_chokidar = __esm({
35740
35854
  * @param item base path of item/directory
35741
35855
  */
35742
35856
  _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))
35857
+ const path36 = sp2.join(directory, item);
35858
+ const fullPath = sp2.resolve(path36);
35859
+ isDirectory = isDirectory != null ? isDirectory : this._watched.has(path36) || this._watched.has(fullPath);
35860
+ if (!this._throttle("remove", path36, 100))
35747
35861
  return;
35748
35862
  if (!isDirectory && this._watched.size === 1) {
35749
35863
  this.add(directory, item, true);
35750
35864
  }
35751
- const wp = this._getWatchedDir(path35);
35865
+ const wp = this._getWatchedDir(path36);
35752
35866
  const nestedDirectoryChildren = wp.getChildren();
35753
- nestedDirectoryChildren.forEach((nested) => this._remove(path35, nested));
35867
+ nestedDirectoryChildren.forEach((nested) => this._remove(path36, nested));
35754
35868
  const parent = this._getWatchedDir(directory);
35755
35869
  const wasTracked = parent.has(item);
35756
35870
  parent.remove(item);
35757
35871
  if (this._symlinkPaths.has(fullPath)) {
35758
35872
  this._symlinkPaths.delete(fullPath);
35759
35873
  }
35760
- let relPath = path35;
35874
+ let relPath = path36;
35761
35875
  if (this.options.cwd)
35762
- relPath = sp2.relative(this.options.cwd, path35);
35876
+ relPath = sp2.relative(this.options.cwd, path36);
35763
35877
  if (this.options.awaitWriteFinish && this._pendingWrites.has(relPath)) {
35764
35878
  const event = this._pendingWrites.get(relPath).cancelWait();
35765
35879
  if (event === EVENTS.ADD)
35766
35880
  return;
35767
35881
  }
35768
- this._watched.delete(path35);
35882
+ this._watched.delete(path36);
35769
35883
  this._watched.delete(fullPath);
35770
35884
  const eventName = isDirectory ? EVENTS.UNLINK_DIR : EVENTS.UNLINK;
35771
- if (wasTracked && !this._isIgnored(path35))
35772
- this._emit(eventName, path35);
35773
- this._closePath(path35);
35885
+ if (wasTracked && !this._isIgnored(path36))
35886
+ this._emit(eventName, path36);
35887
+ this._closePath(path36);
35774
35888
  }
35775
35889
  /**
35776
35890
  * Closes all watchers for a path
35777
35891
  */
35778
- _closePath(path35) {
35779
- this._closeFile(path35);
35780
- const dir = sp2.dirname(path35);
35781
- this._getWatchedDir(dir).remove(sp2.basename(path35));
35892
+ _closePath(path36) {
35893
+ this._closeFile(path36);
35894
+ const dir = sp2.dirname(path36);
35895
+ this._getWatchedDir(dir).remove(sp2.basename(path36));
35782
35896
  }
35783
35897
  /**
35784
35898
  * Closes only file-specific watchers
35785
35899
  */
35786
- _closeFile(path35) {
35787
- const closers = this._closers.get(path35);
35900
+ _closeFile(path36) {
35901
+ const closers = this._closers.get(path36);
35788
35902
  if (!closers)
35789
35903
  return;
35790
35904
  closers.forEach((closer) => closer());
35791
- this._closers.delete(path35);
35905
+ this._closers.delete(path36);
35792
35906
  }
35793
- _addPathCloser(path35, closer) {
35907
+ _addPathCloser(path36, closer) {
35794
35908
  if (!closer)
35795
35909
  return;
35796
- let list = this._closers.get(path35);
35910
+ let list = this._closers.get(path36);
35797
35911
  if (!list) {
35798
35912
  list = [];
35799
- this._closers.set(path35, list);
35913
+ this._closers.set(path36, list);
35800
35914
  }
35801
35915
  list.push(closer);
35802
35916
  }
@@ -40933,6 +41047,9 @@ function projectHotChatSessionStatesFromProviderState(state) {
40933
41047
  const project = (item) => ({
40934
41048
  id: item.instanceId,
40935
41049
  status: item.activeChat?.status || item.status,
41050
+ unread: item.unread,
41051
+ inboxBucket: item.inboxBucket,
41052
+ lastMessageAt: item.lastMessageAt ?? item.activeChat?.lastMessageAt,
40936
41053
  runtimeLifecycle: item.runtime?.lifecycle ?? null,
40937
41054
  runtimeSurfaceKind: item.runtime?.surfaceKind,
40938
41055
  runtimeRestoredFromStorage: item.runtime?.restoredFromStorage === true,
@@ -41145,6 +41262,17 @@ var init_provider_instance_manager = __esm({
41145
41262
  }
41146
41263
  return updated;
41147
41264
  }
41265
+ refreshProviderDefinitions(resolveProvider) {
41266
+ let refreshed = 0;
41267
+ for (const instance of this.instances.values()) {
41268
+ if (typeof instance.refreshProviderDefinition !== "function") continue;
41269
+ const provider = resolveProvider(instance.type);
41270
+ if (!provider || typeof provider !== "object") continue;
41271
+ instance.refreshProviderDefinition(provider);
41272
+ refreshed += 1;
41273
+ }
41274
+ return refreshed;
41275
+ }
41148
41276
  // ─── cleanup ──────────────────────────────────────
41149
41277
  /**
41150
41278
  * All terminate
@@ -45157,8 +45285,8 @@ var init_dev_server = __esm({
45157
45285
  }
45158
45286
  getEndpointList() {
45159
45287
  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}`;
45288
+ const path36 = typeof r.pattern === "string" ? r.pattern : r.pattern.source.replace(/\\\//g, "/").replace(/\(\[.*?\]\+\)/g, ":type").replace(/[\^$]/g, "");
45289
+ return `${r.method.padEnd(5)} ${path36}`;
45162
45290
  });
45163
45291
  }
45164
45292
  async start(port = DEV_SERVER_PORT) {
@@ -45427,20 +45555,7 @@ var init_dev_server = __esm({
45427
45555
  async handleReload(_req, res) {
45428
45556
  try {
45429
45557
  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
- }
45558
+ const refreshedInstances = this.instanceManager ? this.instanceManager.refreshProviderDefinitions((providerType) => this.providerLoader.resolve(providerType)) : 0;
45444
45559
  const providers = this.providerLoader.getAll().map((p) => ({
45445
45560
  type: p.type,
45446
45561
  name: p.name,
@@ -59276,15 +59391,15 @@ var require_route = __commonJS({
59276
59391
  };
59277
59392
  }
59278
59393
  function wrapConversion(toModel, graph) {
59279
- const path35 = [graph[toModel].parent, toModel];
59394
+ const path36 = [graph[toModel].parent, toModel];
59280
59395
  let fn = conversions[graph[toModel].parent][toModel];
59281
59396
  let cur = graph[toModel].parent;
59282
59397
  while (graph[cur].parent) {
59283
- path35.unshift(graph[cur].parent);
59398
+ path36.unshift(graph[cur].parent);
59284
59399
  fn = link(conversions[graph[cur].parent][cur], fn);
59285
59400
  cur = graph[cur].parent;
59286
59401
  }
59287
- fn.conversion = path35;
59402
+ fn.conversion = path36;
59288
59403
  return fn;
59289
59404
  }
59290
59405
  module2.exports = function(fromModel) {
@@ -77154,9 +77269,9 @@ var init_prompt = __esm({
77154
77269
  init_utils();
77155
77270
  init_baseUI();
77156
77271
  _ = {
77157
- set: (obj, path35 = "", value) => {
77272
+ set: (obj, path36 = "", value) => {
77158
77273
  let pointer = obj;
77159
- path35.split(".").forEach((key, index, arr) => {
77274
+ path36.split(".").forEach((key, index, arr) => {
77160
77275
  if (key === "__proto__" || key === "constructor") return;
77161
77276
  if (index === arr.length - 1) {
77162
77277
  pointer[key] = value;
@@ -77166,8 +77281,8 @@ var init_prompt = __esm({
77166
77281
  pointer = pointer[key];
77167
77282
  });
77168
77283
  },
77169
- get: (obj, path35 = "", defaultValue) => {
77170
- const travel = (regexp) => String.prototype.split.call(path35, regexp).filter(Boolean).reduce(
77284
+ get: (obj, path36 = "", defaultValue) => {
77285
+ const travel = (regexp) => String.prototype.split.call(path36, regexp).filter(Boolean).reduce(
77171
77286
  // @ts-expect-error implicit any on res[key]
77172
77287
  (res, key) => res !== null && res !== void 0 ? res[key] : res,
77173
77288
  obj
@@ -80685,16 +80800,16 @@ var require_filesystem = __commonJS({
80685
80800
  var LDD_PATH = "/usr/bin/ldd";
80686
80801
  var SELF_PATH = "/proc/self/exe";
80687
80802
  var MAX_LENGTH = 2048;
80688
- var readFileSync20 = (path35) => {
80689
- const fd = fs27.openSync(path35, "r");
80803
+ var readFileSync20 = (path36) => {
80804
+ const fd = fs27.openSync(path36, "r");
80690
80805
  const buffer = Buffer.alloc(MAX_LENGTH);
80691
80806
  const bytesRead = fs27.readSync(fd, buffer, 0, MAX_LENGTH, 0);
80692
80807
  fs27.close(fd, () => {
80693
80808
  });
80694
80809
  return buffer.subarray(0, bytesRead);
80695
80810
  };
80696
- var readFile = (path35) => new Promise((resolve18, reject) => {
80697
- fs27.open(path35, "r", (err, fd) => {
80811
+ var readFile = (path36) => new Promise((resolve18, reject) => {
80812
+ fs27.open(path36, "r", (err, fd) => {
80698
80813
  if (err) {
80699
80814
  reject(err);
80700
80815
  } else {
@@ -80813,11 +80928,11 @@ var require_detect_libc = __commonJS({
80813
80928
  }
80814
80929
  return null;
80815
80930
  };
80816
- var familyFromInterpreterPath = (path35) => {
80817
- if (path35) {
80818
- if (path35.includes("/ld-musl-")) {
80931
+ var familyFromInterpreterPath = (path36) => {
80932
+ if (path36) {
80933
+ if (path36.includes("/ld-musl-")) {
80819
80934
  return MUSL;
80820
- } else if (path35.includes("/ld-linux-")) {
80935
+ } else if (path36.includes("/ld-linux-")) {
80821
80936
  return GLIBC;
80822
80937
  }
80823
80938
  }
@@ -80864,8 +80979,8 @@ var require_detect_libc = __commonJS({
80864
80979
  cachedFamilyInterpreter = null;
80865
80980
  try {
80866
80981
  const selfContent = await readFile(SELF_PATH);
80867
- const path35 = interpreterPath(selfContent);
80868
- cachedFamilyInterpreter = familyFromInterpreterPath(path35);
80982
+ const path36 = interpreterPath(selfContent);
80983
+ cachedFamilyInterpreter = familyFromInterpreterPath(path36);
80869
80984
  } catch (e) {
80870
80985
  }
80871
80986
  return cachedFamilyInterpreter;
@@ -80877,8 +80992,8 @@ var require_detect_libc = __commonJS({
80877
80992
  cachedFamilyInterpreter = null;
80878
80993
  try {
80879
80994
  const selfContent = readFileSync20(SELF_PATH);
80880
- const path35 = interpreterPath(selfContent);
80881
- cachedFamilyInterpreter = familyFromInterpreterPath(path35);
80995
+ const path36 = interpreterPath(selfContent);
80996
+ cachedFamilyInterpreter = familyFromInterpreterPath(path36);
80882
80997
  } catch (e) {
80883
80998
  }
80884
80999
  return cachedFamilyInterpreter;
@@ -82597,18 +82712,18 @@ var require_sharp = __commonJS({
82597
82712
  `@img/sharp-${runtimePlatform}/sharp.node`,
82598
82713
  "@img/sharp-wasm32/sharp.node"
82599
82714
  ];
82600
- var path35;
82715
+ var path36;
82601
82716
  var sharp;
82602
82717
  var errors = [];
82603
- for (path35 of paths) {
82718
+ for (path36 of paths) {
82604
82719
  try {
82605
- sharp = require(path35);
82720
+ sharp = require(path36);
82606
82721
  break;
82607
82722
  } catch (err) {
82608
82723
  errors.push(err);
82609
82724
  }
82610
82725
  }
82611
- if (sharp && path35.startsWith("@img/sharp-linux-x64") && !sharp._isUsingX64V2()) {
82726
+ if (sharp && path36.startsWith("@img/sharp-linux-x64") && !sharp._isUsingX64V2()) {
82612
82727
  const err = new Error("Prebuilt binaries for linux-x64 require v2 microarchitecture");
82613
82728
  err.code = "Unsupported CPU";
82614
82729
  errors.push(err);
@@ -85517,15 +85632,15 @@ var require_color = __commonJS({
85517
85632
  };
85518
85633
  }
85519
85634
  function wrapConversion(toModel, graph) {
85520
- const path35 = [graph[toModel].parent, toModel];
85635
+ const path36 = [graph[toModel].parent, toModel];
85521
85636
  let fn = conversions_default[graph[toModel].parent][toModel];
85522
85637
  let cur = graph[toModel].parent;
85523
85638
  while (graph[cur].parent) {
85524
- path35.unshift(graph[cur].parent);
85639
+ path36.unshift(graph[cur].parent);
85525
85640
  fn = link(conversions_default[graph[cur].parent][cur], fn);
85526
85641
  cur = graph[cur].parent;
85527
85642
  }
85528
- fn.conversion = path35;
85643
+ fn.conversion = path36;
85529
85644
  return fn;
85530
85645
  }
85531
85646
  function route(fromModel) {
@@ -86142,7 +86257,7 @@ var require_channel = __commonJS({
86142
86257
  var require_output = __commonJS({
86143
86258
  "../../node_modules/sharp/lib/output.js"(exports2, module2) {
86144
86259
  "use strict";
86145
- var path35 = require("path");
86260
+ var path36 = require("path");
86146
86261
  var is = require_is();
86147
86262
  var sharp = require_sharp();
86148
86263
  var formats = /* @__PURE__ */ new Map([
@@ -86173,9 +86288,9 @@ var require_output = __commonJS({
86173
86288
  let err;
86174
86289
  if (!is.string(fileOut)) {
86175
86290
  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)) {
86291
+ } else if (is.string(this.options.input.file) && path36.resolve(this.options.input.file) === path36.resolve(fileOut)) {
86177
86292
  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) {
86293
+ } else if (jp2Regex.test(path36.extname(fileOut)) && !this.constructor.format.jp2k.output.file) {
86179
86294
  err = errJp2Save();
86180
86295
  }
86181
86296
  if (err) {
@@ -88120,7 +88235,7 @@ var init_adhdev_daemon = __esm({
88120
88235
  init_version();
88121
88236
  init_src();
88122
88237
  init_runtime_defaults();
88123
- pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.34" });
88238
+ pkgVersion = resolvePackageVersion({ injectedVersion: "0.9.36" });
88124
88239
  AdhdevDaemon = class _AdhdevDaemon {
88125
88240
  localHttpServer = null;
88126
88241
  localWss = null;
@@ -90663,6 +90778,7 @@ init_source();
90663
90778
  init_src();
90664
90779
 
90665
90780
  // src/cli/setup-commands.ts
90781
+ var import_node_path4 = __toESM(require("path"));
90666
90782
  init_source();
90667
90783
  init_src();
90668
90784
 
@@ -90815,8 +90931,7 @@ function parsePositiveInteger(value, fallback2) {
90815
90931
  return Number.isFinite(parsed) && parsed >= 0 ? parsed : fallback2;
90816
90932
  }
90817
90933
  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()) : "";
90934
+ 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
90935
  if (!dir) {
90821
90936
  throw new Error(`Saved history ${session.providerSessionId} is missing workspace metadata. Pass --dir to resume it explicitly.`);
90822
90937
  }
@@ -90906,12 +91021,13 @@ async function promptForSavedHistoryResumeSession(providerArg, sessions, options
90906
91021
  }
90907
91022
  return selected;
90908
91023
  }
90909
- function registerSetupCommands(program2, providerLoader) {
91024
+ function registerSetupCommands(program2, getProviderLoader2) {
90910
91025
  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
91026
  const { runWizard: runWizard2 } = await Promise.resolve().then(() => (init_wizard(), wizard_exports));
90912
91027
  await runWizard2({ force: options.force });
90913
91028
  });
90914
91029
  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) => {
91030
+ const providerLoader = await getProviderLoader2();
90915
91031
  const {
90916
91032
  detectIDEs: detectIDEs2,
90917
91033
  detectCLIs: detectCLIs2,
@@ -90935,7 +91051,7 @@ function registerSetupCommands(program2, providerLoader) {
90935
91051
  console.log(source_default.gray(" Then run: adhdev launch " + targetArg));
90936
91052
  process.exit(1);
90937
91053
  }
90938
- const resolvedDir = require("path").resolve(workingDir);
91054
+ const resolvedDir = import_node_path4.default.resolve(workingDir);
90939
91055
  const result = await sendDaemonCommand("launch_cli", {
90940
91056
  cliType,
90941
91057
  dir: resolvedDir
@@ -91055,6 +91171,7 @@ function registerSetupCommands(program2, providerLoader) {
91055
91171
  });
91056
91172
  const history = program2.command("history").description("Browse and resume provider saved history");
91057
91173
  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) => {
91174
+ const providerLoader = await getProviderLoader2();
91058
91175
  const providerTarget = resolveLaunchableProviderTarget(providerLoader, providerArg);
91059
91176
  if (!providerTarget) {
91060
91177
  console.log(source_default.red(`
@@ -91127,6 +91244,7 @@ function registerSetupCommands(program2, providerLoader) {
91127
91244
  printSavedHistorySessions(providerArg, providerTarget.resolvedType, sessions, hasMore);
91128
91245
  });
91129
91246
  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) => {
91247
+ const providerLoader = await getProviderLoader2();
91130
91248
  const providerTarget = resolveLaunchableProviderTarget(providerLoader, providerArg);
91131
91249
  if (!providerTarget) {
91132
91250
  console.log(source_default.red(`
@@ -91220,6 +91338,7 @@ function registerSetupCommands(program2, providerLoader) {
91220
91338
  }
91221
91339
  });
91222
91340
  program2.command("status").description("Show current ADHDev setup status").action(async () => {
91341
+ const providerLoader = await getProviderLoader2();
91223
91342
  const { loadConfig: loadConfig2, detectIDEs: detectIDEs2, detectCLIs: detectCLIs2 } = await Promise.resolve().then(() => (init_src(), src_exports));
91224
91343
  const { isDaemonRunning: isDaemonRunning2, getDaemonPid: getDaemonPid2 } = await Promise.resolve().then(() => (init_adhdev_daemon(), adhdev_daemon_exports));
91225
91344
  const { probeSessionHostStatus: probeSessionHostStatus2 } = await Promise.resolve().then(() => (init_session_host(), session_host_exports));
@@ -91303,6 +91422,7 @@ function registerSetupCommands(program2, providerLoader) {
91303
91422
  console.log();
91304
91423
  });
91305
91424
  program2.command("detect").description("Detect installed IDEs, CLI agents, and ACP agents").action(async () => {
91425
+ const providerLoader = await getProviderLoader2();
91306
91426
  const { detectIDEs: detectIDEs2, detectCLIs: detectCLIs2 } = await Promise.resolve().then(() => (init_src(), src_exports));
91307
91427
  console.log(source_default.bold("\n\u{1F50D} Detecting installed IDEs...\n"));
91308
91428
  const ides = await detectIDEs2();
@@ -91404,7 +91524,7 @@ function registerSetupCommands(program2, providerLoader) {
91404
91524
  program2.command("uninstall").description("Completely wipe all setting, configuration, stop daemon and uninstall service").option("-f, --force", "Skip confirmation prompt").action(async (options) => {
91405
91525
  const inquirer2 = await Promise.resolve().then(() => (init_lib(), lib_exports));
91406
91526
  const fs27 = await import("fs");
91407
- const path35 = await import("path");
91527
+ const path36 = await import("path");
91408
91528
  const os31 = await import("os");
91409
91529
  const { spawnSync: spawnSync3 } = await import("child_process");
91410
91530
  if (!options.force) {
@@ -91430,7 +91550,7 @@ function registerSetupCommands(program2, providerLoader) {
91430
91550
  }
91431
91551
  console.log(source_default.gray(" Removing OS background service..."));
91432
91552
  spawnSync3(process.execPath, [process.argv[1], "service", "uninstall"], { stdio: "inherit" });
91433
- const adhdevDir = path35.join(os31.homedir(), ".adhdev");
91553
+ const adhdevDir = path36.join(os31.homedir(), ".adhdev");
91434
91554
  if (fs27.existsSync(adhdevDir)) {
91435
91555
  console.log(source_default.gray(` Deleting ${adhdevDir}...`));
91436
91556
  try {
@@ -91454,10 +91574,10 @@ init_src();
91454
91574
 
91455
91575
  // src/cli/runtime-tools.ts
91456
91576
  var fs24 = __toESM(require("fs"));
91457
- var path30 = __toESM(require("path"));
91577
+ var path31 = __toESM(require("path"));
91458
91578
  function defaultPackageRoot() {
91459
91579
  const currentCliPath = process.argv[1] ? fs24.realpathSync.native(process.argv[1]) : process.cwd();
91460
- return path30.resolve(path30.dirname(currentCliPath), "../..");
91580
+ return path31.resolve(path31.dirname(currentCliPath), "../..");
91461
91581
  }
91462
91582
  function normalizePath2(value) {
91463
91583
  return value.replace(/\\/g, "/").toLowerCase();
@@ -91466,19 +91586,19 @@ function shouldPreferSource(currentCliPath, packageRoot) {
91466
91586
  const normalizedCliPath = normalizePath2(currentCliPath || "");
91467
91587
  if (normalizedCliPath.includes("/src/cli/")) return true;
91468
91588
  if (normalizedCliPath.includes("/dist/cli/")) return false;
91469
- return fs24.existsSync(path30.join(packageRoot, "src", "cli", "index.ts"));
91589
+ return fs24.existsSync(path31.join(packageRoot, "src", "cli", "index.ts"));
91470
91590
  }
91471
91591
  function getVendoredToolEntry(packageRoot, tool) {
91472
91592
  if (tool === "session-host-daemon") {
91473
- return path30.join(packageRoot, "vendor", "session-host-daemon", "index.js");
91593
+ return path31.join(packageRoot, "vendor", "session-host-daemon", "index.js");
91474
91594
  }
91475
- return path30.join(packageRoot, "vendor", "terminal-mux-cli", "index.js");
91595
+ return path31.join(packageRoot, "vendor", "terminal-mux-cli", "index.js");
91476
91596
  }
91477
91597
  function getSourceToolEntry(packageRoot, tool) {
91478
91598
  if (tool === "session-host-daemon") {
91479
- return path30.resolve(packageRoot, "../../oss/packages/session-host-daemon/src/index.ts");
91599
+ return path31.resolve(packageRoot, "../../oss/packages/session-host-daemon/src/index.ts");
91480
91600
  }
91481
- return path30.resolve(packageRoot, "../../oss/packages/terminal-mux-cli/src/index.ts");
91601
+ return path31.resolve(packageRoot, "../../oss/packages/terminal-mux-cli/src/index.ts");
91482
91602
  }
91483
91603
  function getGlobalToolCommand(tool) {
91484
91604
  return tool === "session-host-daemon" ? "adhdev-sessiond" : "adhmux";
@@ -91558,6 +91678,25 @@ async function createConfiguredProviderLoader(options = {}) {
91558
91678
  if (options.load) loader.loadAll();
91559
91679
  return loader;
91560
91680
  }
91681
+ var _sharedLoaderPromise = null;
91682
+ function getSharedCliProviderLoader() {
91683
+ if (!_sharedLoaderPromise) {
91684
+ _sharedLoaderPromise = (async () => {
91685
+ const { ProviderLoader: ProviderLoader2, loadConfig: loadConfig2 } = await Promise.resolve().then(() => (init_src(), src_exports));
91686
+ const config2 = loadConfig2();
91687
+ const loader = new ProviderLoader2({
91688
+ logFn: () => {
91689
+ },
91690
+ userDir: config2.providerDir,
91691
+ sourceMode: config2.providerSourceMode
91692
+ });
91693
+ loader.loadAll();
91694
+ loader.registerToDetector();
91695
+ return loader;
91696
+ })();
91697
+ }
91698
+ return _sharedLoaderPromise;
91699
+ }
91561
91700
 
91562
91701
  // src/cli/debug-trace-cli.ts
91563
91702
  function normalizeOptionalFilter(value) {
@@ -91634,9 +91773,6 @@ var DEFAULT_DAEMON_PORT_TEXT = String(DEFAULT_DAEMON_PORT);
91634
91773
  var DEV_SERVER_PORT2 = 19280;
91635
91774
  var DEV_SERVER_BASE_URL = `http://127.0.0.1:${DEV_SERVER_PORT2}`;
91636
91775
  function hideCommand(command) {
91637
- if (typeof command.hideHelp === "function") {
91638
- command.hideHelp();
91639
- }
91640
91776
  command._hidden = true;
91641
91777
  return command;
91642
91778
  }
@@ -91939,12 +92075,118 @@ async function handleTraceCommand(options) {
91939
92075
  console.log();
91940
92076
  }
91941
92077
  }
92078
+ async function runDaemonUpgrade(options, pkgVersion3) {
92079
+ const { isDaemonRunning: isDaemonRunning2, stopDaemon: stopDaemon2 } = await Promise.resolve().then(() => (init_adhdev_daemon(), adhdev_daemon_exports));
92080
+ const { stopManagedSessionHostProcess: stopManagedSessionHostProcess2 } = await Promise.resolve().then(() => (init_session_host(), session_host_exports));
92081
+ const { execSync: execSync8, spawn: spawn6 } = await import("child_process");
92082
+ const fsMod = await import("fs");
92083
+ const pathMod = await import("path");
92084
+ console.log(source_default.bold("\n \u{1F504} ADHDev Upgrade\n"));
92085
+ const adhdevPath = process.argv[1];
92086
+ const realPath = fsMod.realpathSync(adhdevPath);
92087
+ const isLinked = realPath.includes(".openclaw") || realPath.includes("/src/");
92088
+ const currentVersion = pkgVersion3;
92089
+ console.log(` ${source_default.bold("Current:")} v${currentVersion}`);
92090
+ console.log(` ${source_default.bold("Install:")} ${isLinked ? "npm link (dev)" : "npm global"}`);
92091
+ if (isLinked) {
92092
+ const projectRoot = pathMod.resolve(pathMod.dirname(realPath), "..");
92093
+ const launcherDir = pathMod.join(projectRoot);
92094
+ console.log(` ${source_default.bold("Path:")} ${launcherDir}`);
92095
+ console.log(source_default.cyan("\n Pulling latest..."));
92096
+ try {
92097
+ let gitRoot = launcherDir;
92098
+ while (!fsMod.existsSync(pathMod.join(gitRoot, ".git")) && gitRoot !== "/") {
92099
+ gitRoot = pathMod.dirname(gitRoot);
92100
+ }
92101
+ execSync8("git pull --rebase", { cwd: gitRoot, stdio: "inherit" });
92102
+ console.log(source_default.cyan("\n Building..."));
92103
+ execSync8("npm run build", { cwd: launcherDir, stdio: "inherit" });
92104
+ execSync8("npm link", { cwd: launcherDir, stdio: "inherit" });
92105
+ console.log(source_default.green("\n \u2713 Build complete"));
92106
+ } catch (e) {
92107
+ console.log(source_default.red(`
92108
+ \u2717 Build failed: ${e?.message}
92109
+ `));
92110
+ process.exit(1);
92111
+ }
92112
+ } else {
92113
+ console.log(source_default.cyan("\n Checking for updates..."));
92114
+ let latest;
92115
+ try {
92116
+ latest = execSync8("npm view adhdev version", { encoding: "utf-8" }).trim();
92117
+ } catch (e) {
92118
+ console.log(source_default.red(`
92119
+ \u2717 Failed to check latest version: ${e?.message}
92120
+ `));
92121
+ process.exit(1);
92122
+ return;
92123
+ }
92124
+ console.log(` ${source_default.bold("Latest:")} v${latest}`);
92125
+ if (latest === currentVersion) {
92126
+ console.log(source_default.green("\n \u2713 Already on latest version.\n"));
92127
+ if (!options.restart) return;
92128
+ } else {
92129
+ console.log(source_default.cyan(`
92130
+ Upgrading v${currentVersion} \u2192 v${latest}...`));
92131
+ const daemonWasRunning = options.restart !== false && isDaemonRunning2();
92132
+ if (daemonWasRunning) {
92133
+ stopDaemon2();
92134
+ await new Promise((r) => setTimeout(r, 1e3));
92135
+ stopManagedSessionHostProcess2();
92136
+ }
92137
+ const { spawnDetachedDaemonUpgradeHelper: spawnDetachedDaemonUpgradeHelper2 } = await Promise.resolve().then(() => (init_src(), src_exports));
92138
+ spawnDetachedDaemonUpgradeHelper2({
92139
+ packageName: "adhdev",
92140
+ targetVersion: latest,
92141
+ parentPid: process.pid,
92142
+ restartArgv: daemonWasRunning ? [process.argv[1], "daemon", "-p", DEFAULT_DAEMON_PORT_TEXT] : [],
92143
+ cwd: process.cwd()
92144
+ });
92145
+ if (daemonWasRunning) {
92146
+ console.log(source_default.cyan(" Upgrading and restarting daemon in background..."));
92147
+ } else {
92148
+ console.log(source_default.cyan(" Upgrading in background..."));
92149
+ console.log(source_default.gray(" Start daemon when ready: adhdev daemon"));
92150
+ }
92151
+ console.log(source_default.gray(` Progress: ~/.adhdev/daemon-upgrade.log
92152
+ `));
92153
+ process.exit(0);
92154
+ return;
92155
+ }
92156
+ }
92157
+ if (options.restart !== false && isDaemonRunning2()) {
92158
+ console.log(source_default.yellow("\n Restarting daemon..."));
92159
+ stopDaemon2();
92160
+ await new Promise((r) => setTimeout(r, 2e3));
92161
+ stopManagedSessionHostProcess2();
92162
+ await new Promise((r) => setTimeout(r, 500));
92163
+ const child = spawn6(process.execPath, [process.argv[1], "daemon", "-p", DEFAULT_DAEMON_PORT_TEXT], {
92164
+ detached: true,
92165
+ stdio: "ignore",
92166
+ windowsHide: true,
92167
+ env: { ...process.env }
92168
+ });
92169
+ child.unref();
92170
+ await new Promise((r) => setTimeout(r, 3e3));
92171
+ if (isDaemonRunning2()) {
92172
+ console.log(source_default.green(` \u2713 Daemon restarted with new version
92173
+ `));
92174
+ } else {
92175
+ console.log(source_default.yellow(` \u26A0 Daemon not detected. Start manually: adhdev daemon
92176
+ `));
92177
+ }
92178
+ } else if (options.restart !== false) {
92179
+ console.log(source_default.gray("\n Daemon was not running. Start with: adhdev daemon\n"));
92180
+ } else {
92181
+ console.log(source_default.green("\n \u2713 Upgrade complete (daemon not restarted)\n"));
92182
+ }
92183
+ }
91942
92184
  function registerDaemonCommands(program2, pkgVersion3) {
91943
92185
  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
92186
  const { AdhdevDaemon: AdhdevDaemon2 } = await Promise.resolve().then(() => (init_adhdev_daemon(), adhdev_daemon_exports));
91945
92187
  const daemon = new AdhdevDaemon2();
91946
92188
  await daemon.start({
91947
- localPort: parseInt(options.port) || DEFAULT_DAEMON_PORT,
92189
+ localPort: parseInt(options.port, 10) || DEFAULT_DAEMON_PORT,
91948
92190
  serverUrl: options.server,
91949
92191
  foreground: true,
91950
92192
  dev: options.dev || false,
@@ -92040,7 +92282,7 @@ function registerDaemonCommands(program2, pkgVersion3) {
92040
92282
  const { probeSessionHostStatus: probeSessionHostStatus2 } = await Promise.resolve().then(() => (init_session_host(), session_host_exports));
92041
92283
  const port = parseInt(options.port, 10) || DEFAULT_DAEMON_PORT;
92042
92284
  const config2 = loadConfig2();
92043
- const providerLoader = await createConfiguredProviderLoader();
92285
+ const providerLoader = await getSharedCliProviderLoader();
92044
92286
  if (isDaemonRunning2({ port })) {
92045
92287
  console.log(source_default.green(`
92046
92288
  \u2713 ADHDev Daemon is running.
@@ -92499,114 +92741,10 @@ function registerDaemonCommands(program2, pkgVersion3) {
92499
92741
  }
92500
92742
  }));
92501
92743
  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
- }
92744
+ await runDaemonUpgrade(options, pkgVersion3);
92606
92745
  }));
92607
92746
  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);
92747
+ await runDaemonUpgrade(options, pkgVersion3);
92610
92748
  });
92611
92749
  }
92612
92750
 
@@ -92615,7 +92753,7 @@ init_source();
92615
92753
  var import_child_process15 = require("child_process");
92616
92754
  var fs26 = __toESM(require("fs"));
92617
92755
  var os30 = __toESM(require("os"));
92618
- var path33 = __toESM(require("path"));
92756
+ var path34 = __toESM(require("path"));
92619
92757
  init_src();
92620
92758
  init_session_host();
92621
92759
 
@@ -92732,26 +92870,26 @@ function buildDoctorAdvice(input) {
92732
92870
 
92733
92871
  // src/cli/service-commands.ts
92734
92872
  var import_node_fs6 = __toESM(require("fs"));
92735
- var import_node_path4 = __toESM(require("path"));
92873
+ var import_node_path5 = __toESM(require("path"));
92736
92874
  var import_node_os6 = __toESM(require("os"));
92737
92875
  var import_node_child_process6 = require("child_process");
92738
92876
  init_source();
92739
92877
  init_src();
92740
92878
  var DEFAULT_LOCAL_DAEMON_HEALTH_TIMEOUT_MS3 = 1500;
92741
92879
  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");
92880
+ var ADHDEV_DIR = import_node_path5.default.join(import_node_os6.default.homedir(), ".adhdev");
92881
+ var LOG_OUT = import_node_path5.default.join(ADHDEV_DIR, "daemon-launchd.out");
92882
+ var LOG_ERR = import_node_path5.default.join(ADHDEV_DIR, "daemon-launchd.err");
92745
92883
  var MAX_LOG_SIZE2 = 10 * 1024 * 1024;
92746
92884
  function getDarwinPlistPath() {
92747
- return import_node_path4.default.join(import_node_os6.default.homedir(), "Library", "LaunchAgents", `${LAUNCHD_LABEL}.plist`);
92885
+ return import_node_path5.default.join(import_node_os6.default.homedir(), "Library", "LaunchAgents", `${LAUNCHD_LABEL}.plist`);
92748
92886
  }
92749
92887
  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");
92888
+ const appData = process.env.APPDATA || import_node_path5.default.join(import_node_os6.default.homedir(), "AppData", "Roaming");
92889
+ return import_node_path5.default.join(appData, "Microsoft", "Windows", "Start Menu", "Programs", "Startup");
92752
92890
  }
92753
92891
  function getWindowsVbsPath() {
92754
- return import_node_path4.default.join(getWindowsStartupDir(), "adhdev-daemon.vbs");
92892
+ return import_node_path5.default.join(getWindowsStartupDir(), "adhdev-daemon.vbs");
92755
92893
  }
92756
92894
  function resolveCliPath() {
92757
92895
  return import_node_fs6.default.realpathSync(process.argv[1]);
@@ -92817,7 +92955,7 @@ function rotateLogs() {
92817
92955
  }
92818
92956
  function buildPlist(nodeExe, cliExe) {
92819
92957
  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);
92958
+ const nodeDir = import_node_path5.default.dirname(nodeExe);
92821
92959
  const pathEntries = /* @__PURE__ */ new Set([nodeDir, brewPrefix, "/usr/local/bin", "/usr/bin", "/bin", "/usr/sbin", "/sbin"]);
92822
92960
  const pathValue = Array.from(pathEntries).join(":");
92823
92961
  return `<?xml version="1.0" encoding="UTF-8"?>
@@ -92856,7 +92994,7 @@ function buildPlist(nodeExe, cliExe) {
92856
92994
  function installDarwin(nodeExe, cliExe) {
92857
92995
  const plistPath = getDarwinPlistPath();
92858
92996
  ensureDir(ADHDEV_DIR);
92859
- ensureDir(import_node_path4.default.dirname(plistPath));
92997
+ ensureDir(import_node_path5.default.dirname(plistPath));
92860
92998
  import_node_fs6.default.writeFileSync(plistPath, buildPlist(nodeExe, cliExe), "utf-8");
92861
92999
  console.log(source_default.gray(` Plist: ${plistPath}`));
92862
93000
  try {
@@ -92889,7 +93027,7 @@ function isInstalledDarwin() {
92889
93027
  return import_node_fs6.default.existsSync(getDarwinPlistPath());
92890
93028
  }
92891
93029
  function buildVbs(nodeExe, cliExe) {
92892
- const logFile = import_node_path4.default.join(ADHDEV_DIR, "daemon-service.log").replace(/\\/g, "\\\\");
93030
+ const logFile = import_node_path5.default.join(ADHDEV_DIR, "daemon-service.log").replace(/\\/g, "\\\\");
92893
93031
  const escapedNodeExe = nodeExe.replace(/\\/g, "\\\\");
92894
93032
  const escapedCliExe = cliExe.replace(/\\/g, "\\\\");
92895
93033
  return `' ADHDev Daemon Auto-Start (generated by adhdev service install)
@@ -92900,11 +93038,11 @@ WshShell.Run "cmd.exe /c """"${escapedNodeExe}"""" """"${escapedCliExe}"""" daem
92900
93038
  function installWindows(nodeExe, cliExe) {
92901
93039
  const vbsPath = getWindowsVbsPath();
92902
93040
  ensureDir(ADHDEV_DIR);
92903
- ensureDir(import_node_path4.default.dirname(vbsPath));
93041
+ ensureDir(import_node_path5.default.dirname(vbsPath));
92904
93042
  import_node_fs6.default.writeFileSync(vbsPath, buildVbs(nodeExe, cliExe), "utf-8");
92905
93043
  console.log(source_default.gray(` Startup script: ${vbsPath}`));
92906
93044
  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")}`));
93045
+ console.log(source_default.gray(` Logs: ${import_node_path5.default.join(ADHDEV_DIR, "daemon-service.log")}`));
92908
93046
  console.log(source_default.gray(" To start now without rebooting, run: adhdev daemon"));
92909
93047
  }
92910
93048
  function uninstallWindows() {
@@ -93098,11 +93236,11 @@ function formatBytes(bytes) {
93098
93236
 
93099
93237
  // src/cli/doctor-commands.ts
93100
93238
  function resolvePackageRoot() {
93101
- return path33.resolve(__dirname, "..", "..");
93239
+ return path34.resolve(__dirname, "..", "..");
93102
93240
  }
93103
93241
  function isLinkedInstall(packageRoot) {
93104
- const normalized = path33.normalize(packageRoot);
93105
- return !normalized.includes(`${path33.sep}node_modules${path33.sep}adhdev`);
93242
+ const normalized = path34.normalize(packageRoot);
93243
+ return !normalized.includes(`${path34.sep}node_modules${path34.sep}adhdev`);
93106
93244
  }
93107
93245
  function formatCheck(check2) {
93108
93246
  const icon = check2.ok ? source_default.green("\u2713") : source_default.red("\u2717");
@@ -93186,8 +93324,8 @@ function probeSharpRuntime(packageRoot, nativeSharpPackage) {
93186
93324
  }
93187
93325
  }
93188
93326
  function probeConfigAccess() {
93189
- const configDir = path33.join(os30.homedir(), ".adhdev");
93190
- const configPath = path33.join(configDir, "config.json");
93327
+ const configDir = path34.join(os30.homedir(), ".adhdev");
93328
+ const configPath = path34.join(configDir, "config.json");
93191
93329
  const checks = [];
93192
93330
  try {
93193
93331
  fs26.mkdirSync(configDir, { recursive: true });
@@ -93227,7 +93365,7 @@ function probeConfigAccess() {
93227
93365
  fatal: true
93228
93366
  });
93229
93367
  }
93230
- const probePath = path33.join(configDir, `.doctor-write-${process.pid}-${Date.now()}.tmp`);
93368
+ const probePath = path34.join(configDir, `.doctor-write-${process.pid}-${Date.now()}.tmp`);
93231
93369
  try {
93232
93370
  fs26.writeFileSync(probePath, "ok", "utf-8");
93233
93371
  fs26.rmSync(probePath, { force: true });
@@ -93416,7 +93554,7 @@ function registerDoctorCommands(program2, pkgVersion3) {
93416
93554
  });
93417
93555
  }
93418
93556
  if (process.platform === "darwin") {
93419
- serviceDefinitionPath = path33.join(os30.homedir(), "Library", "LaunchAgents", "dev.adhf.daemon.plist");
93557
+ serviceDefinitionPath = path34.join(os30.homedir(), "Library", "LaunchAgents", "dev.adhf.daemon.plist");
93420
93558
  if (fs26.existsSync(serviceDefinitionPath)) {
93421
93559
  serviceDefinitionCheck = evaluateServiceDefinitionDrift({
93422
93560
  serviceKind: "launchd",
@@ -93464,7 +93602,7 @@ function registerDoctorCommands(program2, pkgVersion3) {
93464
93602
  } catch {
93465
93603
  }
93466
93604
  try {
93467
- const providerLoader = await createConfiguredProviderLoader({ load: true });
93605
+ const providerLoader = await getSharedCliProviderLoader();
93468
93606
  const cliResults = await detectCLIs(providerLoader);
93469
93607
  for (const cli of cliResults) {
93470
93608
  checks.push({
@@ -93489,7 +93627,7 @@ function registerDoctorCommands(program2, pkgVersion3) {
93489
93627
  serviceCheck: serviceDefinitionCheck || void 0,
93490
93628
  sourceCliExample: "node --import tsx packages/daemon-cloud/src/cli/index.ts doctor"
93491
93629
  });
93492
- const sessionHostLogPath = path33.join(os30.homedir(), ".adhdev", "logs", "session-host.log");
93630
+ const sessionHostLogPath = path34.join(os30.homedir(), ".adhdev", "logs", "session-host.log");
93493
93631
  console.log(source_default.bold("\n\u{1FA7A} ADHDev Doctor\n"));
93494
93632
  console.log(source_default.gray(` Version: ${pkgVersion3}`));
93495
93633
  console.log(source_default.gray(` Platform: ${process.platform} ${process.arch}`));
@@ -93531,7 +93669,7 @@ function registerDoctorCommands(program2, pkgVersion3) {
93531
93669
 
93532
93670
  // src/cli/provider-commands.ts
93533
93671
  init_source();
93534
- var path34 = __toESM(require("path"));
93672
+ var path35 = __toESM(require("path"));
93535
93673
  init_cdp_utils();
93536
93674
  var DEV_SERVER_PORT3 = 19280;
93537
93675
  var IDE_AUTO_FIX_FUNCTIONS = [
@@ -93602,7 +93740,7 @@ function getCliAutoFixVerification(provider, providerDir) {
93602
93740
  };
93603
93741
  }
93604
93742
  function hideCommand2(command) {
93605
- command.hideHelp?.();
93743
+ command._hidden = true;
93606
93744
  return command;
93607
93745
  }
93608
93746
  async function createConfiguredProviderLoader2() {
@@ -93614,7 +93752,7 @@ function getProviderSourceCandidatePaths(options) {
93614
93752
  const results = [];
93615
93753
  for (const root of roots) {
93616
93754
  for (const name of relativeNames) {
93617
- results.push(path34.join(root, options.category, options.type, name));
93755
+ results.push(path35.join(root, options.category, options.type, name));
93618
93756
  }
93619
93757
  }
93620
93758
  return results;
@@ -93750,7 +93888,7 @@ function registerProviderCommands(program2) {
93750
93888
  let processNames = {};
93751
93889
  if (category === "ide") {
93752
93890
  const fs27 = await import("fs");
93753
- const path35 = await import("path");
93891
+ const path36 = await import("path");
93754
93892
  const os31 = await import("os");
93755
93893
  if (os31.platform() === "darwin") {
93756
93894
  while (true) {
@@ -93763,7 +93901,7 @@ function registerProviderCommands(program2) {
93763
93901
  }
93764
93902
  console.log(source_default.green(` \u2713 Path verified: ${p}`));
93765
93903
  osPaths["darwin"] = [p];
93766
- processNames["darwin"] = path35.basename(p, ".app");
93904
+ processNames["darwin"] = path36.basename(p, ".app");
93767
93905
  break;
93768
93906
  }
93769
93907
  } else if (os31.platform() === "win32") {
@@ -93777,7 +93915,7 @@ function registerProviderCommands(program2) {
93777
93915
  }
93778
93916
  console.log(source_default.green(` \u2713 Path verified: ${p}`));
93779
93917
  osPaths["win32"] = [p];
93780
- processNames["win32"] = path35.basename(p, ".exe");
93918
+ processNames["win32"] = path36.basename(p, ".exe");
93781
93919
  break;
93782
93920
  }
93783
93921
  }
@@ -94599,18 +94737,9 @@ if (process.platform === "win32") {
94599
94737
  process.exit(1);
94600
94738
  }
94601
94739
  }
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
94740
  var program = new import_commander.Command();
94612
94741
  program.name("adhdev").description("\u{1F9A6} ADHDev \u2014 Agent Dashboard Hub for Dev").version(pkgVersion2);
94613
- registerSetupCommands(program, _cliProviderLoader);
94742
+ registerSetupCommands(program, getSharedCliProviderLoader);
94614
94743
  registerDaemonCommands(program, pkgVersion2);
94615
94744
  registerDoctorCommands(program, pkgVersion2);
94616
94745
  registerProviderCommands(program);