adhdev 0.5.25 → 0.5.26

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
@@ -23077,7 +23077,7 @@ var require_dist = __commonJS({
23077
23077
  this.timeouts = {
23078
23078
  ptyFlush: t.ptyFlush ?? 50,
23079
23079
  dialogAccept: t.dialogAccept ?? 300,
23080
- approvalCooldown: t.approvalCooldown ?? 2e3,
23080
+ approvalCooldown: t.approvalCooldown ?? 500,
23081
23081
  generatingIdle: t.generatingIdle ?? 6e3,
23082
23082
  idleFinish: t.idleFinish ?? 5e3,
23083
23083
  maxResponse: t.maxResponse ?? 3e5,
@@ -23254,32 +23254,34 @@ var require_dist = __commonJS({
23254
23254
  }
23255
23255
  const hasApproval = patterns.approval.some((p) => p.test(this.recentOutputBuffer));
23256
23256
  if (hasApproval && this.currentStatus !== "waiting_approval") {
23257
- if (this.lastApprovalResolvedAt && Date.now() - this.lastApprovalResolvedAt < this.timeouts.approvalCooldown) return;
23258
- const ctxLines = this.recentOutputBuffer.split("\n").map((l) => l.trim()).filter((l) => l && !/^[─═╭╮╰╯│]+$/.test(l));
23259
- this.isWaitingForResponse = true;
23260
- this.setStatus("waiting_approval", "approval_pattern");
23261
- this.recentOutputBuffer = "";
23262
- this.approvalTransitionBuffer = "";
23263
- this.activeModal = {
23264
- message: ctxLines.slice(-5).join(" ").slice(0, 200) || "Approval required",
23265
- buttons: this.cliType === "claude-cli" ? ["Yes (y)", "Always allow (a)", "Deny (Esc)"] : ["Allow once", "Always allow", "Deny"]
23266
- };
23267
- if (this.idleTimeout) clearTimeout(this.idleTimeout);
23268
- if (this.approvalExitTimeout) clearTimeout(this.approvalExitTimeout);
23269
- this.approvalExitTimeout = setTimeout(() => {
23270
- if (this.currentStatus === "waiting_approval") {
23271
- LOG5.warn("CLI", `[${this.cliType}] Approval timeout \u2014 auto-exiting waiting_approval`);
23272
- this.activeModal = null;
23273
- this.lastApprovalResolvedAt = Date.now();
23274
- this.recentOutputBuffer = "";
23275
- this.approvalTransitionBuffer = "";
23276
- this.approvalExitTimeout = null;
23277
- this.setStatus(this.isWaitingForResponse ? "generating" : "idle", "approval_cleared");
23278
- this.onStatusChange?.();
23279
- }
23280
- }, 6e4);
23281
- this.onStatusChange?.();
23282
- return;
23257
+ const inCooldown = this.lastApprovalResolvedAt && Date.now() - this.lastApprovalResolvedAt < this.timeouts.approvalCooldown;
23258
+ if (!inCooldown) {
23259
+ const ctxLines = this.recentOutputBuffer.split("\n").map((l) => l.trim()).filter((l) => l && !/^[─═╭╮╰╯│]+$/.test(l));
23260
+ this.isWaitingForResponse = true;
23261
+ this.setStatus("waiting_approval", "approval_pattern");
23262
+ this.recentOutputBuffer = "";
23263
+ this.approvalTransitionBuffer = "";
23264
+ this.activeModal = {
23265
+ message: ctxLines.slice(-5).join(" ").slice(0, 200) || "Approval required",
23266
+ buttons: this.cliType === "claude-cli" ? ["Yes (y)", "Always allow (a)", "Deny (Esc)"] : ["Allow once", "Always allow", "Deny"]
23267
+ };
23268
+ if (this.idleTimeout) clearTimeout(this.idleTimeout);
23269
+ if (this.approvalExitTimeout) clearTimeout(this.approvalExitTimeout);
23270
+ this.approvalExitTimeout = setTimeout(() => {
23271
+ if (this.currentStatus === "waiting_approval") {
23272
+ LOG5.warn("CLI", `[${this.cliType}] Approval timeout \u2014 auto-exiting waiting_approval`);
23273
+ this.activeModal = null;
23274
+ this.lastApprovalResolvedAt = Date.now();
23275
+ this.recentOutputBuffer = "";
23276
+ this.approvalTransitionBuffer = "";
23277
+ this.approvalExitTimeout = null;
23278
+ this.setStatus(this.isWaitingForResponse ? "generating" : "idle", "approval_cleared");
23279
+ this.onStatusChange?.();
23280
+ }
23281
+ }, 6e4);
23282
+ this.onStatusChange?.();
23283
+ return;
23284
+ }
23283
23285
  }
23284
23286
  if (this.currentStatus === "waiting_approval") {
23285
23287
  this.approvalTransitionBuffer = (this.approvalTransitionBuffer + cleanData).slice(-500);
@@ -23331,7 +23333,10 @@ var require_dist = __commonJS({
23331
23333
  }
23332
23334
  const trailingLines = cleanData.split("\n").slice(-2).join("\n");
23333
23335
  if (patterns.prompt.some((p) => p.test(trailingLines))) {
23334
- this.finishResponse();
23336
+ const hasApprovalHere = patterns.approval.some((p) => p.test(this.recentOutputBuffer));
23337
+ if (!hasApprovalHere) {
23338
+ this.finishResponse();
23339
+ }
23335
23340
  } else {
23336
23341
  this.idleTimeout = setTimeout(() => {
23337
23342
  if (this.isWaitingForResponse && this.responseBuffer.trim()) {
@@ -30191,7 +30196,7 @@ var init_adhdev_daemon = __esm({
30191
30196
  path2 = __toESM(require("path"));
30192
30197
  crypto2 = __toESM(require("crypto"));
30193
30198
  import_chalk = __toESM(require("chalk"));
30194
- pkgVersion = "0.5.25";
30199
+ pkgVersion = "0.5.26";
30195
30200
  if (pkgVersion === "unknown") {
30196
30201
  try {
30197
30202
  const possiblePaths = [