adhdev 0.5.30 → 0.5.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -23006,8 +23006,8 @@ var require_dist = __commonJS({
23006
23006
  try {
23007
23007
  const fs10 = require("fs");
23008
23008
  const ptyDir = path9.resolve(path9.dirname(require.resolve("node-pty")), "..");
23009
- const arch3 = os11.arch() === "arm64" ? "darwin-arm64" : "darwin-x64";
23010
- const helper = path9.join(ptyDir, "prebuilds", arch3, "spawn-helper");
23009
+ const platformArch = `${os11.platform()}-${os11.arch()}`;
23010
+ const helper = path9.join(ptyDir, "prebuilds", platformArch, "spawn-helper");
23011
23011
  if (fs10.existsSync(helper)) {
23012
23012
  const stat = fs10.statSync(helper);
23013
23013
  if (!(stat.mode & 73)) {
@@ -23019,10 +23019,10 @@ var require_dist = __commonJS({
23019
23019
  }
23020
23020
  }
23021
23021
  } catch {
23022
- LOG5.error("CLI", "[ProviderCliAdapter] node-pty not found. Install: npm install node-pty@1.0.0");
23022
+ LOG5.error("CLI", "[ProviderCliAdapter] node-pty not found. Terminal features disabled.");
23023
23023
  }
23024
23024
  function stripAnsi(str) {
23025
- return str.replace(/\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])/g, "").replace(/\x1B\][^\x07]*\x07/g, "").replace(/\x1B\][^\x1B]*\x1B\\/g, "");
23025
+ return str.replace(/\x1B\[\d*[A-HJKSTfG]/g, " ").replace(/\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])/g, "").replace(/\x1B\][^\x07]*\x07/g, "").replace(/\x1B\][^\x1B]*\x1B\\/g, "").replace(/ +/g, " ");
23026
23026
  }
23027
23027
  function findBinary(name) {
23028
23028
  const isWin = os11.platform() === "win32";
@@ -23330,6 +23330,9 @@ var require_dist = __commonJS({
23330
23330
  }
23331
23331
  return;
23332
23332
  }
23333
+ if (cleanData.trim().length > 5) {
23334
+ LOG5.debug("CLI", `[${this.cliType}] output chunk (${cleanData.length}): ${cleanData.slice(0, 300).replace(/\n/g, "\\n")}`);
23335
+ }
23333
23336
  const hasApproval = patterns.approval.some((p) => p.test(this.recentOutputBuffer));
23334
23337
  if (hasApproval && this.currentStatus !== "waiting_approval") {
23335
23338
  const inCooldown = this.lastApprovalResolvedAt && Date.now() - this.lastApprovalResolvedAt < this.timeouts.approvalCooldown;
@@ -23690,7 +23693,8 @@ var require_dist = __commonJS({
23690
23693
  this.adapter.shutdown();
23691
23694
  this.monitor.reset();
23692
23695
  }
23693
- // ─── Status transition detection (moved from daemon-status.ts) ──────
23696
+ completedDebounceTimer = null;
23697
+ completedDebouncePending = null;
23694
23698
  detectStatusTransition() {
23695
23699
  const now = Date.now();
23696
23700
  const adapterStatus = this.adapter.getStatus();
@@ -23700,7 +23704,15 @@ var require_dist = __commonJS({
23700
23704
  if (newStatus !== this.lastStatus) {
23701
23705
  LOG5.info("CLI", `[${this.type}] status: ${this.lastStatus} \u2192 ${newStatus}`);
23702
23706
  if (this.lastStatus === "idle" && newStatus === "generating") {
23703
- this.generatingStartedAt = now;
23707
+ if (this.completedDebouncePending) {
23708
+ LOG5.info("CLI", `[${this.type}] cancelled pending completed (resumed generating)`);
23709
+ if (this.completedDebounceTimer) {
23710
+ clearTimeout(this.completedDebounceTimer);
23711
+ this.completedDebounceTimer = null;
23712
+ }
23713
+ this.completedDebouncePending = null;
23714
+ }
23715
+ if (!this.generatingStartedAt) this.generatingStartedAt = now;
23704
23716
  if (this.generatingDebounceTimer) clearTimeout(this.generatingDebounceTimer);
23705
23717
  this.generatingDebouncePending = { chatTitle, timestamp: now };
23706
23718
  this.generatingDebounceTimer = setTimeout(() => {
@@ -23719,6 +23731,11 @@ var require_dist = __commonJS({
23719
23731
  this.pushEvent({ event: "agent:generating_started", ...this.generatingDebouncePending });
23720
23732
  this.generatingDebouncePending = null;
23721
23733
  }
23734
+ if (this.completedDebounceTimer) {
23735
+ clearTimeout(this.completedDebounceTimer);
23736
+ this.completedDebounceTimer = null;
23737
+ }
23738
+ this.completedDebouncePending = null;
23722
23739
  if (!this.generatingStartedAt) this.generatingStartedAt = now;
23723
23740
  const modal = adapterStatus.activeModal;
23724
23741
  LOG5.info("CLI", `[${this.type}] approval modal: "${modal?.message?.slice(0, 80) ?? "none"}"`);
@@ -23738,17 +23755,31 @@ var require_dist = __commonJS({
23738
23755
  this.generatingDebounceTimer = null;
23739
23756
  }
23740
23757
  this.generatingDebouncePending = null;
23758
+ this.generatingStartedAt = 0;
23741
23759
  } else {
23742
- LOG5.info("CLI", `[${this.type}] completed in ${duration3}s`);
23743
- this.pushEvent({ event: "agent:generating_completed", chatTitle, duration: duration3, timestamp: now });
23760
+ if (this.completedDebounceTimer) clearTimeout(this.completedDebounceTimer);
23761
+ this.completedDebouncePending = { chatTitle, duration: duration3, timestamp: now };
23762
+ this.completedDebounceTimer = setTimeout(() => {
23763
+ if (this.completedDebouncePending) {
23764
+ LOG5.info("CLI", `[${this.type}] completed in ${this.completedDebouncePending.duration}s`);
23765
+ this.pushEvent({ event: "agent:generating_completed", ...this.completedDebouncePending });
23766
+ this.completedDebouncePending = null;
23767
+ this.generatingStartedAt = 0;
23768
+ }
23769
+ this.completedDebounceTimer = null;
23770
+ }, 2e3);
23744
23771
  }
23745
- this.generatingStartedAt = 0;
23746
23772
  } else if (newStatus === "stopped") {
23747
23773
  if (this.generatingDebounceTimer) {
23748
23774
  clearTimeout(this.generatingDebounceTimer);
23749
23775
  this.generatingDebounceTimer = null;
23750
23776
  }
23751
23777
  this.generatingDebouncePending = null;
23778
+ if (this.completedDebounceTimer) {
23779
+ clearTimeout(this.completedDebounceTimer);
23780
+ this.completedDebounceTimer = null;
23781
+ }
23782
+ this.completedDebouncePending = null;
23752
23783
  this.pushEvent({ event: "agent:stopped", chatTitle, timestamp: now });
23753
23784
  }
23754
23785
  this.lastStatus = newStatus;
@@ -29223,7 +29254,7 @@ var init_server_connection = __esm({
29223
29254
  }
29224
29255
  return;
29225
29256
  }
29226
- if (code !== 1e3 && this.reconnectAttempts < 50) {
29257
+ if (code !== 1e3) {
29227
29258
  this.setState("disconnected");
29228
29259
  this.scheduleReconnect();
29229
29260
  } else {
@@ -29241,9 +29272,9 @@ var init_server_connection = __esm({
29241
29272
  }
29242
29273
  }
29243
29274
  scheduleReconnect() {
29244
- const delay = Math.min(1e3 * Math.pow(2, this.reconnectAttempts), 6e4);
29275
+ const delay = Math.min(2e3 * Math.pow(1.5, this.reconnectAttempts), 6e4);
29245
29276
  this.reconnectAttempts++;
29246
- import_daemon_core.LOG.info("Server", `[ServerConn] Reconnecting in ${delay}ms (attempt ${this.reconnectAttempts})...`);
29277
+ import_daemon_core.LOG.info("Server", `[ServerConn] Reconnecting in ${(delay / 1e3).toFixed(1)}s (attempt ${this.reconnectAttempts})...`);
29247
29278
  this.reconnectTimer = setTimeout(() => this.connect(), delay);
29248
29279
  }
29249
29280
  clearTimers() {
@@ -29261,11 +29292,11 @@ var init_server_connection = __esm({
29261
29292
  try {
29262
29293
  this.ws.ping();
29263
29294
  this.pongTimeout = setTimeout(() => {
29264
- import_daemon_core.LOG.info("Server", "[ServerConn] \u26A0 Pong timeout (10s) \u2014 closing zombie WS");
29295
+ import_daemon_core.LOG.info("Server", "[ServerConn] \u26A0 Pong timeout (15s) \u2014 closing zombie WS");
29265
29296
  if (this.ws) {
29266
29297
  this.ws.terminate();
29267
29298
  }
29268
- }, 1e4);
29299
+ }, 15e3);
29269
29300
  } catch {
29270
29301
  }
29271
29302
  }, 3e4);
@@ -30282,7 +30313,7 @@ var init_adhdev_daemon = __esm({
30282
30313
  path2 = __toESM(require("path"));
30283
30314
  crypto2 = __toESM(require("crypto"));
30284
30315
  import_chalk = __toESM(require("chalk"));
30285
- pkgVersion = "0.5.30";
30316
+ pkgVersion = "0.5.32";
30286
30317
  if (pkgVersion === "unknown") {
30287
30318
  try {
30288
30319
  const possiblePaths = [