@adhdev/daemon-standalone 0.8.5 → 0.8.6

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
@@ -43524,6 +43524,8 @@ async (params) => {
43524
43524
  let approvalBuffer = "";
43525
43525
  let lastApprovalTime = 0;
43526
43526
  let completionSignalSeen = false;
43527
+ let autoStopTimer = null;
43528
+ let autoStopIssued = false;
43527
43529
  try {
43528
43530
  const { normalizeCliProviderForRuntime: normalizeCliProviderForRuntime2 } = await Promise.resolve().then(() => (init_provider_cli_adapter(), provider_cli_adapter_exports));
43529
43531
  const normalized = normalizeCliProviderForRuntime2(agentProvider);
@@ -43561,8 +43563,37 @@ async (params) => {
43561
43563
  lastApprovalTime = Date.now();
43562
43564
  }
43563
43565
  };
43566
+ const clearAutoStopTimer = () => {
43567
+ if (autoStopTimer) {
43568
+ clearTimeout(autoStopTimer);
43569
+ autoStopTimer = null;
43570
+ }
43571
+ };
43572
+ const scheduleAutoStopForVerification = () => {
43573
+ if (!verification || command !== "codex" || completionSignalSeen || autoStopIssued) return;
43574
+ const elapsed = Date.now() - spawnedAt;
43575
+ if (elapsed < 3e4) return;
43576
+ clearAutoStopTimer();
43577
+ autoStopTimer = setTimeout(() => {
43578
+ if (!ctx.autoImplProcess || completionSignalSeen || autoStopIssued) return;
43579
+ autoStopIssued = true;
43580
+ ctx.log(`Auto-implement output quiet for 30s after ${Math.round((Date.now() - spawnedAt) / 1e3)}s. Interrupting agent and switching to daemon verification.`);
43581
+ sendAutoImplSSE(ctx, {
43582
+ event: "output",
43583
+ data: {
43584
+ chunk: "\n[\u{1F916} ADHDev Pipeline] Agent output quiet. Interrupting and running daemon verification...\n",
43585
+ stream: "stdout"
43586
+ }
43587
+ });
43588
+ try {
43589
+ ctx.autoImplProcess.kill("SIGINT");
43590
+ } catch {
43591
+ }
43592
+ }, 3e4);
43593
+ };
43564
43594
  const finalizeCliAutoImpl = async (code) => {
43565
43595
  ctx.autoImplProcess = null;
43596
+ clearAutoStopTimer();
43566
43597
  let success2 = completionSignalSeen || code === 0;
43567
43598
  let message = success2 ? completionSignalSeen && code !== 0 ? "\u2705 Auto-implement complete (completion signal)" : "\u2705 Auto-implement complete" : `\u274C Agent exited (code: ${code})`;
43568
43599
  let verificationSummary = null;
@@ -43613,12 +43644,14 @@ async (params) => {
43613
43644
  if (isPty) {
43614
43645
  child.onData((data) => {
43615
43646
  stdout += data;
43647
+ clearAutoStopTimer();
43616
43648
  if (data.includes("\x1B[6n")) {
43617
43649
  child.write("\x1B[12;1R");
43618
43650
  ctx.log("Terminal CPR request (\\x1b[6n) intercepted in PTY, responding with dummy coordinates [12;1R]");
43619
43651
  }
43620
43652
  checkAutoApproval(data, (s15) => child.write(s15));
43621
43653
  sendAutoImplSSE(ctx, { event: "output", data: { chunk: data, stream: "stdout" } });
43654
+ scheduleAutoStopForVerification();
43622
43655
  });
43623
43656
  child.onExit(({ exitCode: code }) => {
43624
43657
  void finalizeCliAutoImpl(code);
@@ -43627,15 +43660,19 @@ async (params) => {
43627
43660
  child.stdout?.on("data", (d) => {
43628
43661
  const chunk = d.toString();
43629
43662
  stdout += chunk;
43663
+ clearAutoStopTimer();
43630
43664
  if (chunk.includes("\x1B[6n")) child.stdin?.write("\x1B[1;1R");
43631
43665
  checkAutoApproval(chunk, (s15) => child.stdin?.write(s15));
43632
43666
  sendAutoImplSSE(ctx, { event: "output", data: { chunk, stream: "stdout" } });
43667
+ scheduleAutoStopForVerification();
43633
43668
  });
43634
43669
  child.stderr?.on("data", (d) => {
43635
43670
  const chunk = d.toString();
43636
43671
  stderr += chunk;
43672
+ clearAutoStopTimer();
43637
43673
  checkAutoApproval(chunk, (s15) => child.stdin?.write(s15));
43638
43674
  sendAutoImplSSE(ctx, { event: "output", data: { chunk, stream: "stderr" } });
43675
+ scheduleAutoStopForVerification();
43639
43676
  });
43640
43677
  child.on("exit", (code) => {
43641
43678
  void finalizeCliAutoImpl(code);