adhdev 0.6.47 → 0.6.48

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
@@ -2091,6 +2091,9 @@ var init_status_monitor = __esm({
2091
2091
  config;
2092
2092
  lastAlertTime = /* @__PURE__ */ new Map();
2093
2093
  generatingStartTimes = /* @__PURE__ */ new Map();
2094
+ longGeneratingAlerted = /* @__PURE__ */ new Map();
2095
+ lastProgressFingerprint = /* @__PURE__ */ new Map();
2096
+ lastProgressChangeAt = /* @__PURE__ */ new Map();
2094
2097
  constructor(config2) {
2095
2098
  this.config = { ...DEFAULT_MONITOR_CONFIG, ...config2 };
2096
2099
  }
@@ -2106,7 +2109,7 @@ var init_status_monitor = __esm({
2106
2109
  * Check status transition → return notification event array.
2107
2110
  * Called from each onTick() or detectStatusTransition().
2108
2111
  */
2109
- check(agentKey, status, now) {
2112
+ check(agentKey, status, now, progressFingerprint) {
2110
2113
  const events = [];
2111
2114
  if (this.config.approvalAlert && status === "waiting_approval") {
2112
2115
  if (this.shouldAlert(agentKey + ":approval", now)) {
@@ -2121,24 +2124,40 @@ var init_status_monitor = __esm({
2121
2124
  if (status === "generating" || status === "streaming") {
2122
2125
  if (!this.generatingStartTimes.has(agentKey)) {
2123
2126
  this.generatingStartTimes.set(agentKey, now);
2127
+ this.longGeneratingAlerted.set(agentKey, false);
2128
+ const initialFingerprint = progressFingerprint ?? "";
2129
+ this.lastProgressFingerprint.set(agentKey, initialFingerprint);
2130
+ this.lastProgressChangeAt.set(agentKey, now);
2131
+ }
2132
+ const currentFingerprint = progressFingerprint ?? "";
2133
+ const previousFingerprint = this.lastProgressFingerprint.get(agentKey);
2134
+ if (previousFingerprint !== currentFingerprint) {
2135
+ this.lastProgressFingerprint.set(agentKey, currentFingerprint);
2136
+ this.lastProgressChangeAt.set(agentKey, now);
2137
+ this.longGeneratingAlerted.set(agentKey, false);
2124
2138
  }
2125
2139
  if (this.config.longGeneratingAlert) {
2126
- const startedAt = this.generatingStartTimes.get(agentKey);
2127
- const elapsedSec = Math.round((now - startedAt) / 1e3);
2128
- if (elapsedSec > this.config.longGeneratingThresholdSec) {
2140
+ const progressChangedAt = this.lastProgressChangeAt.get(agentKey) || this.generatingStartTimes.get(agentKey);
2141
+ const elapsedSec = Math.round((now - progressChangedAt) / 1e3);
2142
+ const alreadyAlerted = this.longGeneratingAlerted.get(agentKey) === true;
2143
+ if (elapsedSec > this.config.longGeneratingThresholdSec && !alreadyAlerted) {
2129
2144
  if (this.shouldAlert(agentKey + ":long_gen", now)) {
2145
+ this.longGeneratingAlerted.set(agentKey, true);
2130
2146
  events.push({
2131
2147
  type: "monitor:long_generating",
2132
2148
  agentKey,
2133
2149
  elapsedSec,
2134
2150
  timestamp: now,
2135
- message: `${agentKey} has been generating for ${Math.round(elapsedSec / 60)}min`
2151
+ message: `${agentKey} output appears stuck for ${Math.round(elapsedSec / 60)}min`
2136
2152
  });
2137
2153
  }
2138
2154
  }
2139
2155
  }
2140
2156
  } else {
2141
2157
  this.generatingStartTimes.delete(agentKey);
2158
+ this.longGeneratingAlerted.delete(agentKey);
2159
+ this.lastProgressFingerprint.delete(agentKey);
2160
+ this.lastProgressChangeAt.delete(agentKey);
2142
2161
  }
2143
2162
  return events;
2144
2163
  }
@@ -2155,11 +2174,17 @@ var init_status_monitor = __esm({
2155
2174
  reset(agentKey) {
2156
2175
  if (agentKey) {
2157
2176
  this.generatingStartTimes.delete(agentKey);
2177
+ this.longGeneratingAlerted.delete(agentKey);
2178
+ this.lastProgressFingerprint.delete(agentKey);
2179
+ this.lastProgressChangeAt.delete(agentKey);
2158
2180
  for (const k of this.lastAlertTime.keys()) {
2159
2181
  if (k.startsWith(agentKey)) this.lastAlertTime.delete(k);
2160
2182
  }
2161
2183
  } else {
2162
2184
  this.generatingStartTimes.clear();
2185
+ this.longGeneratingAlerted.clear();
2186
+ this.lastProgressFingerprint.clear();
2187
+ this.lastProgressChangeAt.clear();
2163
2188
  this.lastAlertTime.clear();
2164
2189
  }
2165
2190
  }
@@ -2266,9 +2291,11 @@ var init_extension_provider_instance = __esm({
2266
2291
  // (generating_started, generating_completed, waiting_approval)
2267
2292
  // via its own detectAgentTransitions(). Emitting here would cause
2268
2293
  // duplicate toasts with slightly different content.
2269
- detectTransition(newStatus, _data) {
2294
+ detectTransition(newStatus, data) {
2270
2295
  const now = Date.now();
2271
2296
  const agentStatus = newStatus === "streaming" || newStatus === "generating" ? "generating" : newStatus === "waiting_approval" ? "waiting_approval" : "idle";
2297
+ const lastMsg = Array.isArray(data?.messages) && data.messages.length > 0 ? data.messages[data.messages.length - 1] : null;
2298
+ const progressFingerprint = agentStatus === "generating" ? `${lastMsg?.role || ""}:${typeof lastMsg?.content === "string" ? lastMsg.content : JSON.stringify(lastMsg?.content || "")}`.slice(-2e3) : void 0;
2272
2299
  if (agentStatus !== this.lastAgentStatus) {
2273
2300
  if (this.lastAgentStatus === "idle" && agentStatus === "generating") {
2274
2301
  this.generatingStartedAt = now;
@@ -2278,7 +2305,7 @@ var init_extension_provider_instance = __esm({
2278
2305
  this.lastAgentStatus = agentStatus;
2279
2306
  }
2280
2307
  const agentKey = `${this.type}:ext`;
2281
- const monitorEvents = this.monitor.check(agentKey, agentStatus, now);
2308
+ const monitorEvents = this.monitor.check(agentKey, agentStatus, now, progressFingerprint);
2282
2309
  for (const me of monitorEvents) {
2283
2310
  this.pushEvent({ event: me.type, agentKey: me.agentKey, message: me.message, elapsedSec: me.elapsedSec, timestamp: me.timestamp });
2284
2311
  }
@@ -2712,6 +2739,8 @@ var init_ide_provider_instance = __esm({
2712
2739
  if (!chatStatus) return;
2713
2740
  const agentKey = `${this.type}:native`;
2714
2741
  const agentStatus = chatStatus === "streaming" || chatStatus === "generating" ? "generating" : chatStatus === "waiting_approval" ? "waiting_approval" : "idle";
2742
+ const lastMsg = Array.isArray(chatData?.messages) && chatData.messages.length > 0 ? chatData.messages[chatData.messages.length - 1] : null;
2743
+ const progressFingerprint = agentStatus === "generating" ? `${lastMsg?.role || ""}:${typeof lastMsg?.content === "string" ? lastMsg.content : JSON.stringify(lastMsg?.content || "")}`.slice(-2e3) : void 0;
2715
2744
  this.currentStatus = agentStatus;
2716
2745
  const lastStatus = this.lastAgentStatuses.get(agentKey) || "idle";
2717
2746
  if (agentStatus !== lastStatus) {
@@ -2741,7 +2770,7 @@ var init_ide_provider_instance = __esm({
2741
2770
  if (agentStatus === "waiting_approval" && this.settings.autoApprove && !this.autoApproveBusy) {
2742
2771
  this.autoApproveViaScript(chatData);
2743
2772
  }
2744
- const monitorEvents = this.monitor.check(agentKey, agentStatus, now);
2773
+ const monitorEvents = this.monitor.check(agentKey, agentStatus, now, progressFingerprint);
2745
2774
  for (const me of monitorEvents) {
2746
2775
  this.pushEvent({ event: me.type, agentKey: me.agentKey, message: me.message, elapsedSec: me.elapsedSec, timestamp: me.timestamp });
2747
2776
  }
@@ -7237,16 +7266,15 @@ var init_provider_cli_adapter = __esm({
7237
7266
  }
7238
7267
  FALLBACK_PROMPT = [
7239
7268
  /Type your message/i,
7240
- /^>\s*$/m,
7241
- // '>' alone on its own line
7242
- /[›❯]\s*[\r\n]/,
7243
- // prompt char followed by line ending (ANSI-stripped may not have $ at end)
7244
- /[›❯]\s*$/m,
7245
- // prompt char at end of line (multiline)
7246
7269
  /for\s*shortcuts/i,
7247
- // Claude Code prompt (ANSI strip may remove spaces → 'forshortcuts')
7270
+ // Claude Code prompt
7248
7271
  /\?\s*for\s*help/i,
7249
- /Press enter/i
7272
+ // Claude Code help prompt
7273
+ /Press enter/i,
7274
+ /^[>›❯]\s*$/i,
7275
+ // Prompt char as the complete evaluated string
7276
+ /[>›❯]\s*$/
7277
+ // Prompt char at the very end of evaluated string
7250
7278
  ];
7251
7279
  FALLBACK_GENERATING = [
7252
7280
  /[\u2800-\u28ff]/,
@@ -7263,12 +7291,8 @@ var init_provider_cli_adapter = __esm({
7263
7291
  /Always\s*allow/i,
7264
7292
  /\(y\/n\)/i,
7265
7293
  /\[Y\/n\]/i,
7266
- /Run\s+\w+\s+command/i,
7267
- // "Run bash command" etc — requires surrounding words to avoid false matches
7268
- /Yes,?\s*don'?t\s*ask/i,
7294
+ /Yes,?\s*don'?t\s*ask/i
7269
7295
  // "Yes, don't ask again" (Claude Code)
7270
- /\bDeny\b/i
7271
- // Word-boundary match — avoids "allow & deny" in /permissions menu text
7272
7296
  ];
7273
7297
  ProviderCliAdapter = class {
7274
7298
  constructor(provider, workingDir, extraArgs = []) {
@@ -7876,6 +7900,8 @@ var init_cli_provider_instance = __esm({
7876
7900
  const newStatus = adapterStatus.status;
7877
7901
  const dirName = this.workingDir.split("/").filter(Boolean).pop() || "session";
7878
7902
  const chatTitle = `${this.provider.name} \xB7 ${dirName}`;
7903
+ const partial2 = this.adapter.getPartialResponse();
7904
+ const progressFingerprint = newStatus === "generating" ? `${partial2 || ""}::${adapterStatus.messages.at(-1)?.content || ""}`.slice(-2e3) : void 0;
7879
7905
  if (newStatus !== this.lastStatus) {
7880
7906
  LOG.info("CLI", `[${this.type}] status: ${this.lastStatus} \u2192 ${newStatus}`);
7881
7907
  if (this.lastStatus === "idle" && newStatus === "generating") {
@@ -7964,7 +7990,7 @@ var init_cli_provider_instance = __esm({
7964
7990
  this.lastStatus = newStatus;
7965
7991
  }
7966
7992
  const agentKey = `${this.type}:cli`;
7967
- const monitorEvents = this.monitor.check(agentKey, newStatus, now);
7993
+ const monitorEvents = this.monitor.check(agentKey, newStatus, now, progressFingerprint);
7968
7994
  for (const me of monitorEvents) {
7969
7995
  this.pushEvent({ event: me.type, agentKey: me.agentKey, message: me.message, elapsedSec: me.elapsedSec, timestamp: me.timestamp });
7970
7996
  }
@@ -25141,6 +25167,7 @@ var init_acp_provider_instance = __esm({
25141
25167
  const newStatus = this.currentStatus;
25142
25168
  const dirName = this.workingDir.split("/").filter(Boolean).pop() || "session";
25143
25169
  const chatTitle = `${this.provider.name} \xB7 ${dirName}`;
25170
+ const progressFingerprint = newStatus === "generating" ? `${this.partialContent}::${JSON.stringify(this.partialBlocks)}::${JSON.stringify(this.activeToolCalls.map((t) => ({ name: t.name, status: t.status })))}`.slice(-2e3) : void 0;
25144
25171
  if (newStatus !== this.lastStatus) {
25145
25172
  if (this.lastStatus === "idle" && newStatus === "generating") {
25146
25173
  this.generatingStartedAt = now;
@@ -25163,7 +25190,7 @@ var init_acp_provider_instance = __esm({
25163
25190
  this.lastStatus = newStatus;
25164
25191
  }
25165
25192
  const agentKey = `${this.type}:acp`;
25166
- const monitorEvents = this.monitor.check(agentKey, newStatus, now);
25193
+ const monitorEvents = this.monitor.check(agentKey, newStatus, now, progressFingerprint);
25167
25194
  for (const me of monitorEvents) {
25168
25195
  this.pushEvent({ event: me.type, agentKey: me.agentKey, message: me.message, elapsedSec: me.elapsedSec, timestamp: me.timestamp });
25169
25196
  }
@@ -31302,7 +31329,7 @@ var init_adhdev_daemon = __esm({
31302
31329
  fs11 = __toESM(require("fs"));
31303
31330
  path14 = __toESM(require("path"));
31304
31331
  import_chalk2 = __toESM(require("chalk"));
31305
- pkgVersion = "0.6.47";
31332
+ pkgVersion = "0.6.48";
31306
31333
  if (pkgVersion === "unknown") {
31307
31334
  try {
31308
31335
  const possiblePaths = [