adhdev 0.5.31 → 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/cli/index.js CHANGED
@@ -23022,7 +23022,7 @@ var require_dist = __commonJS({
23022
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;
@@ -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.31";
30316
+ pkgVersion = "0.5.32";
30286
30317
  if (pkgVersion === "unknown") {
30287
30318
  try {
30288
30319
  const possiblePaths = [