@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.js
CHANGED
|
@@ -15896,6 +15896,8 @@ async function handleAutoImplement(ctx, type, req, res) {
|
|
|
15896
15896
|
let approvalBuffer = "";
|
|
15897
15897
|
let lastApprovalTime = 0;
|
|
15898
15898
|
let completionSignalSeen = false;
|
|
15899
|
+
let autoStopTimer = null;
|
|
15900
|
+
let autoStopIssued = false;
|
|
15899
15901
|
try {
|
|
15900
15902
|
const { normalizeCliProviderForRuntime: normalizeCliProviderForRuntime2 } = await Promise.resolve().then(() => (init_provider_cli_adapter(), provider_cli_adapter_exports));
|
|
15901
15903
|
const normalized = normalizeCliProviderForRuntime2(agentProvider);
|
|
@@ -15933,8 +15935,37 @@ async function handleAutoImplement(ctx, type, req, res) {
|
|
|
15933
15935
|
lastApprovalTime = Date.now();
|
|
15934
15936
|
}
|
|
15935
15937
|
};
|
|
15938
|
+
const clearAutoStopTimer = () => {
|
|
15939
|
+
if (autoStopTimer) {
|
|
15940
|
+
clearTimeout(autoStopTimer);
|
|
15941
|
+
autoStopTimer = null;
|
|
15942
|
+
}
|
|
15943
|
+
};
|
|
15944
|
+
const scheduleAutoStopForVerification = () => {
|
|
15945
|
+
if (!verification || command !== "codex" || completionSignalSeen || autoStopIssued) return;
|
|
15946
|
+
const elapsed = Date.now() - spawnedAt;
|
|
15947
|
+
if (elapsed < 3e4) return;
|
|
15948
|
+
clearAutoStopTimer();
|
|
15949
|
+
autoStopTimer = setTimeout(() => {
|
|
15950
|
+
if (!ctx.autoImplProcess || completionSignalSeen || autoStopIssued) return;
|
|
15951
|
+
autoStopIssued = true;
|
|
15952
|
+
ctx.log(`Auto-implement output quiet for 30s after ${Math.round((Date.now() - spawnedAt) / 1e3)}s. Interrupting agent and switching to daemon verification.`);
|
|
15953
|
+
sendAutoImplSSE(ctx, {
|
|
15954
|
+
event: "output",
|
|
15955
|
+
data: {
|
|
15956
|
+
chunk: "\n[\u{1F916} ADHDev Pipeline] Agent output quiet. Interrupting and running daemon verification...\n",
|
|
15957
|
+
stream: "stdout"
|
|
15958
|
+
}
|
|
15959
|
+
});
|
|
15960
|
+
try {
|
|
15961
|
+
ctx.autoImplProcess.kill("SIGINT");
|
|
15962
|
+
} catch {
|
|
15963
|
+
}
|
|
15964
|
+
}, 3e4);
|
|
15965
|
+
};
|
|
15936
15966
|
const finalizeCliAutoImpl = async (code) => {
|
|
15937
15967
|
ctx.autoImplProcess = null;
|
|
15968
|
+
clearAutoStopTimer();
|
|
15938
15969
|
let success = completionSignalSeen || code === 0;
|
|
15939
15970
|
let message = success ? completionSignalSeen && code !== 0 ? "\u2705 Auto-implement complete (completion signal)" : "\u2705 Auto-implement complete" : `\u274C Agent exited (code: ${code})`;
|
|
15940
15971
|
let verificationSummary = null;
|
|
@@ -15985,12 +16016,14 @@ async function handleAutoImplement(ctx, type, req, res) {
|
|
|
15985
16016
|
if (isPty) {
|
|
15986
16017
|
child.onData((data) => {
|
|
15987
16018
|
stdout += data;
|
|
16019
|
+
clearAutoStopTimer();
|
|
15988
16020
|
if (data.includes("\x1B[6n")) {
|
|
15989
16021
|
child.write("\x1B[12;1R");
|
|
15990
16022
|
ctx.log("Terminal CPR request (\\x1b[6n) intercepted in PTY, responding with dummy coordinates [12;1R]");
|
|
15991
16023
|
}
|
|
15992
16024
|
checkAutoApproval(data, (s) => child.write(s));
|
|
15993
16025
|
sendAutoImplSSE(ctx, { event: "output", data: { chunk: data, stream: "stdout" } });
|
|
16026
|
+
scheduleAutoStopForVerification();
|
|
15994
16027
|
});
|
|
15995
16028
|
child.onExit(({ exitCode: code }) => {
|
|
15996
16029
|
void finalizeCliAutoImpl(code);
|
|
@@ -15999,15 +16032,19 @@ async function handleAutoImplement(ctx, type, req, res) {
|
|
|
15999
16032
|
child.stdout?.on("data", (d) => {
|
|
16000
16033
|
const chunk = d.toString();
|
|
16001
16034
|
stdout += chunk;
|
|
16035
|
+
clearAutoStopTimer();
|
|
16002
16036
|
if (chunk.includes("\x1B[6n")) child.stdin?.write("\x1B[1;1R");
|
|
16003
16037
|
checkAutoApproval(chunk, (s) => child.stdin?.write(s));
|
|
16004
16038
|
sendAutoImplSSE(ctx, { event: "output", data: { chunk, stream: "stdout" } });
|
|
16039
|
+
scheduleAutoStopForVerification();
|
|
16005
16040
|
});
|
|
16006
16041
|
child.stderr?.on("data", (d) => {
|
|
16007
16042
|
const chunk = d.toString();
|
|
16008
16043
|
stderr += chunk;
|
|
16044
|
+
clearAutoStopTimer();
|
|
16009
16045
|
checkAutoApproval(chunk, (s) => child.stdin?.write(s));
|
|
16010
16046
|
sendAutoImplSSE(ctx, { event: "output", data: { chunk, stream: "stderr" } });
|
|
16047
|
+
scheduleAutoStopForVerification();
|
|
16011
16048
|
});
|
|
16012
16049
|
child.on("exit", (code) => {
|
|
16013
16050
|
void finalizeCliAutoImpl(code);
|