@adhdev/daemon-core 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.mjs
CHANGED
|
@@ -15819,6 +15819,8 @@ async function handleAutoImplement(ctx, type, req, res) {
|
|
|
15819
15819
|
let approvalBuffer = "";
|
|
15820
15820
|
let lastApprovalTime = 0;
|
|
15821
15821
|
let completionSignalSeen = false;
|
|
15822
|
+
let autoStopTimer = null;
|
|
15823
|
+
let autoStopIssued = false;
|
|
15822
15824
|
try {
|
|
15823
15825
|
const { normalizeCliProviderForRuntime: normalizeCliProviderForRuntime2 } = await Promise.resolve().then(() => (init_provider_cli_adapter(), provider_cli_adapter_exports));
|
|
15824
15826
|
const normalized = normalizeCliProviderForRuntime2(agentProvider);
|
|
@@ -15856,8 +15858,37 @@ async function handleAutoImplement(ctx, type, req, res) {
|
|
|
15856
15858
|
lastApprovalTime = Date.now();
|
|
15857
15859
|
}
|
|
15858
15860
|
};
|
|
15861
|
+
const clearAutoStopTimer = () => {
|
|
15862
|
+
if (autoStopTimer) {
|
|
15863
|
+
clearTimeout(autoStopTimer);
|
|
15864
|
+
autoStopTimer = null;
|
|
15865
|
+
}
|
|
15866
|
+
};
|
|
15867
|
+
const scheduleAutoStopForVerification = () => {
|
|
15868
|
+
if (!verification || command !== "codex" || completionSignalSeen || autoStopIssued) return;
|
|
15869
|
+
const elapsed = Date.now() - spawnedAt;
|
|
15870
|
+
if (elapsed < 3e4) return;
|
|
15871
|
+
clearAutoStopTimer();
|
|
15872
|
+
autoStopTimer = setTimeout(() => {
|
|
15873
|
+
if (!ctx.autoImplProcess || completionSignalSeen || autoStopIssued) return;
|
|
15874
|
+
autoStopIssued = true;
|
|
15875
|
+
ctx.log(`Auto-implement output quiet for 30s after ${Math.round((Date.now() - spawnedAt) / 1e3)}s. Interrupting agent and switching to daemon verification.`);
|
|
15876
|
+
sendAutoImplSSE(ctx, {
|
|
15877
|
+
event: "output",
|
|
15878
|
+
data: {
|
|
15879
|
+
chunk: "\n[\u{1F916} ADHDev Pipeline] Agent output quiet. Interrupting and running daemon verification...\n",
|
|
15880
|
+
stream: "stdout"
|
|
15881
|
+
}
|
|
15882
|
+
});
|
|
15883
|
+
try {
|
|
15884
|
+
ctx.autoImplProcess.kill("SIGINT");
|
|
15885
|
+
} catch {
|
|
15886
|
+
}
|
|
15887
|
+
}, 3e4);
|
|
15888
|
+
};
|
|
15859
15889
|
const finalizeCliAutoImpl = async (code) => {
|
|
15860
15890
|
ctx.autoImplProcess = null;
|
|
15891
|
+
clearAutoStopTimer();
|
|
15861
15892
|
let success = completionSignalSeen || code === 0;
|
|
15862
15893
|
let message = success ? completionSignalSeen && code !== 0 ? "\u2705 Auto-implement complete (completion signal)" : "\u2705 Auto-implement complete" : `\u274C Agent exited (code: ${code})`;
|
|
15863
15894
|
let verificationSummary = null;
|
|
@@ -15908,12 +15939,14 @@ async function handleAutoImplement(ctx, type, req, res) {
|
|
|
15908
15939
|
if (isPty) {
|
|
15909
15940
|
child.onData((data) => {
|
|
15910
15941
|
stdout += data;
|
|
15942
|
+
clearAutoStopTimer();
|
|
15911
15943
|
if (data.includes("\x1B[6n")) {
|
|
15912
15944
|
child.write("\x1B[12;1R");
|
|
15913
15945
|
ctx.log("Terminal CPR request (\\x1b[6n) intercepted in PTY, responding with dummy coordinates [12;1R]");
|
|
15914
15946
|
}
|
|
15915
15947
|
checkAutoApproval(data, (s) => child.write(s));
|
|
15916
15948
|
sendAutoImplSSE(ctx, { event: "output", data: { chunk: data, stream: "stdout" } });
|
|
15949
|
+
scheduleAutoStopForVerification();
|
|
15917
15950
|
});
|
|
15918
15951
|
child.onExit(({ exitCode: code }) => {
|
|
15919
15952
|
void finalizeCliAutoImpl(code);
|
|
@@ -15922,15 +15955,19 @@ async function handleAutoImplement(ctx, type, req, res) {
|
|
|
15922
15955
|
child.stdout?.on("data", (d) => {
|
|
15923
15956
|
const chunk = d.toString();
|
|
15924
15957
|
stdout += chunk;
|
|
15958
|
+
clearAutoStopTimer();
|
|
15925
15959
|
if (chunk.includes("\x1B[6n")) child.stdin?.write("\x1B[1;1R");
|
|
15926
15960
|
checkAutoApproval(chunk, (s) => child.stdin?.write(s));
|
|
15927
15961
|
sendAutoImplSSE(ctx, { event: "output", data: { chunk, stream: "stdout" } });
|
|
15962
|
+
scheduleAutoStopForVerification();
|
|
15928
15963
|
});
|
|
15929
15964
|
child.stderr?.on("data", (d) => {
|
|
15930
15965
|
const chunk = d.toString();
|
|
15931
15966
|
stderr += chunk;
|
|
15967
|
+
clearAutoStopTimer();
|
|
15932
15968
|
checkAutoApproval(chunk, (s) => child.stdin?.write(s));
|
|
15933
15969
|
sendAutoImplSSE(ctx, { event: "output", data: { chunk, stream: "stderr" } });
|
|
15970
|
+
scheduleAutoStopForVerification();
|
|
15934
15971
|
});
|
|
15935
15972
|
child.on("exit", (code) => {
|
|
15936
15973
|
void finalizeCliAutoImpl(code);
|