@adhdev/daemon-standalone 0.8.5 → 0.8.7
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 +83 -6
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/public/assets/index-CGcC7g8q.js +61 -0
- package/public/assets/index-wM3ElPKX.css +1 -0
- package/public/index.html +2 -2
- package/vendor/session-host-daemon/index.js +7 -0
- package/vendor/session-host-daemon/index.js.map +1 -1
- package/vendor/session-host-daemon/index.mjs +7 -0
- package/vendor/session-host-daemon/index.mjs.map +1 -1
- package/public/assets/index-D0aXnIOE.css +0 -1
- package/public/assets/index-rG_uc9Km.js +0 -62
package/dist/index.js
CHANGED
|
@@ -28611,6 +28611,9 @@ var require_dist2 = __commonJS({
|
|
|
28611
28611
|
function normalizeScreenSnapshot(text) {
|
|
28612
28612
|
return sanitizeTerminalText(String(text || "")).replace(/\s+/g, " ").trim();
|
|
28613
28613
|
}
|
|
28614
|
+
function normalizeComparableMessageContent(text) {
|
|
28615
|
+
return String(text || "").replace(/\s+/g, " ").trim();
|
|
28616
|
+
}
|
|
28614
28617
|
function parsePatternEntry(x) {
|
|
28615
28618
|
if (x instanceof RegExp) return x;
|
|
28616
28619
|
if (x && typeof x === "object" && typeof x.source === "string") {
|
|
@@ -28796,11 +28799,44 @@ var require_dist2 = __commonJS({
|
|
|
28796
28799
|
this.structuredMessages = [...this.committedMessages];
|
|
28797
28800
|
}
|
|
28798
28801
|
normalizeParsedMessages(parsedMessages) {
|
|
28799
|
-
|
|
28800
|
-
|
|
28801
|
-
|
|
28802
|
-
|
|
28803
|
-
|
|
28802
|
+
const referenceMessages = [...this.committedMessages];
|
|
28803
|
+
const usedReferenceIndexes = /* @__PURE__ */ new Set();
|
|
28804
|
+
const now = Date.now();
|
|
28805
|
+
const findReferenceTimestamp = (role, content, parsedIndex) => {
|
|
28806
|
+
const normalizedContent = normalizeComparableMessageContent(content);
|
|
28807
|
+
if (!normalizedContent) return void 0;
|
|
28808
|
+
const sameIndex = referenceMessages[parsedIndex];
|
|
28809
|
+
if (sameIndex && !usedReferenceIndexes.has(parsedIndex) && sameIndex.role === role && normalizeComparableMessageContent(sameIndex.content) === normalizedContent && typeof sameIndex.timestamp === "number" && Number.isFinite(sameIndex.timestamp)) {
|
|
28810
|
+
usedReferenceIndexes.add(parsedIndex);
|
|
28811
|
+
return sameIndex.timestamp;
|
|
28812
|
+
}
|
|
28813
|
+
for (let i = 0; i < referenceMessages.length; i++) {
|
|
28814
|
+
if (usedReferenceIndexes.has(i)) continue;
|
|
28815
|
+
const candidate = referenceMessages[i];
|
|
28816
|
+
if (!candidate || candidate.role !== role) continue;
|
|
28817
|
+
const candidateContent = normalizeComparableMessageContent(candidate.content);
|
|
28818
|
+
if (!candidateContent) continue;
|
|
28819
|
+
const exactMatch = candidateContent === normalizedContent;
|
|
28820
|
+
const fuzzyMatch = candidateContent.includes(normalizedContent) || normalizedContent.includes(candidateContent);
|
|
28821
|
+
if (!exactMatch && !fuzzyMatch) continue;
|
|
28822
|
+
if (typeof candidate.timestamp === "number" && Number.isFinite(candidate.timestamp)) {
|
|
28823
|
+
usedReferenceIndexes.add(i);
|
|
28824
|
+
return candidate.timestamp;
|
|
28825
|
+
}
|
|
28826
|
+
}
|
|
28827
|
+
return void 0;
|
|
28828
|
+
};
|
|
28829
|
+
return parsedMessages.filter((message) => message && (message.role === "user" || message.role === "assistant")).map((message, index) => {
|
|
28830
|
+
const role = message.role;
|
|
28831
|
+
const content = typeof message.content === "string" ? message.content : String(message.content || "");
|
|
28832
|
+
const parsedTimestamp = typeof message.timestamp === "number" && Number.isFinite(message.timestamp) ? message.timestamp : void 0;
|
|
28833
|
+
const referenceTimestamp = parsedTimestamp ?? findReferenceTimestamp(role, content, index);
|
|
28834
|
+
return {
|
|
28835
|
+
role,
|
|
28836
|
+
content,
|
|
28837
|
+
timestamp: referenceTimestamp ?? now
|
|
28838
|
+
};
|
|
28839
|
+
});
|
|
28804
28840
|
}
|
|
28805
28841
|
sliceFromOffset(text, start) {
|
|
28806
28842
|
if (!text) return "";
|
|
@@ -28958,11 +28994,15 @@ var require_dist2 = __commonJS({
|
|
|
28958
28994
|
let shellCmd;
|
|
28959
28995
|
let shellArgs;
|
|
28960
28996
|
const useShellUnix = !isWin && (!!spawnConfig.shell || !path7.isAbsolute(binaryPath) || isScriptBinary(binaryPath) || !looksLikeMachOOrElf(binaryPath));
|
|
28961
|
-
const
|
|
28997
|
+
const isCmdShim = isWin && /\.(cmd|bat)$/i.test(binaryPath);
|
|
28998
|
+
const useShell = isWin ? !!spawnConfig.shell || isCmdShim : useShellUnix;
|
|
28962
28999
|
if (useShell) {
|
|
28963
29000
|
if (!spawnConfig.shell && !isWin) {
|
|
28964
29001
|
LOG2.info("CLI", `[${this.cliType}] Using login shell (script shim or non-native binary)`);
|
|
28965
29002
|
}
|
|
29003
|
+
if (isCmdShim) {
|
|
29004
|
+
LOG2.info("CLI", `[${this.cliType}] Using cmd.exe shell for .cmd/.bat shim: ${binaryPath}`);
|
|
29005
|
+
}
|
|
28966
29006
|
shellCmd = isWin ? "cmd.exe" : process.env.SHELL || "/bin/zsh";
|
|
28967
29007
|
if (isWin) {
|
|
28968
29008
|
shellArgs = ["/c", binaryPath, ...allArgs];
|
|
@@ -43524,6 +43564,8 @@ async (params) => {
|
|
|
43524
43564
|
let approvalBuffer = "";
|
|
43525
43565
|
let lastApprovalTime = 0;
|
|
43526
43566
|
let completionSignalSeen = false;
|
|
43567
|
+
let autoStopTimer = null;
|
|
43568
|
+
let autoStopIssued = false;
|
|
43527
43569
|
try {
|
|
43528
43570
|
const { normalizeCliProviderForRuntime: normalizeCliProviderForRuntime2 } = await Promise.resolve().then(() => (init_provider_cli_adapter(), provider_cli_adapter_exports));
|
|
43529
43571
|
const normalized = normalizeCliProviderForRuntime2(agentProvider);
|
|
@@ -43561,8 +43603,37 @@ async (params) => {
|
|
|
43561
43603
|
lastApprovalTime = Date.now();
|
|
43562
43604
|
}
|
|
43563
43605
|
};
|
|
43606
|
+
const clearAutoStopTimer = () => {
|
|
43607
|
+
if (autoStopTimer) {
|
|
43608
|
+
clearTimeout(autoStopTimer);
|
|
43609
|
+
autoStopTimer = null;
|
|
43610
|
+
}
|
|
43611
|
+
};
|
|
43612
|
+
const scheduleAutoStopForVerification = () => {
|
|
43613
|
+
if (!verification || command !== "codex" || completionSignalSeen || autoStopIssued) return;
|
|
43614
|
+
const elapsed = Date.now() - spawnedAt;
|
|
43615
|
+
if (elapsed < 3e4) return;
|
|
43616
|
+
clearAutoStopTimer();
|
|
43617
|
+
autoStopTimer = setTimeout(() => {
|
|
43618
|
+
if (!ctx.autoImplProcess || completionSignalSeen || autoStopIssued) return;
|
|
43619
|
+
autoStopIssued = true;
|
|
43620
|
+
ctx.log(`Auto-implement output quiet for 30s after ${Math.round((Date.now() - spawnedAt) / 1e3)}s. Interrupting agent and switching to daemon verification.`);
|
|
43621
|
+
sendAutoImplSSE(ctx, {
|
|
43622
|
+
event: "output",
|
|
43623
|
+
data: {
|
|
43624
|
+
chunk: "\n[\u{1F916} ADHDev Pipeline] Agent output quiet. Interrupting and running daemon verification...\n",
|
|
43625
|
+
stream: "stdout"
|
|
43626
|
+
}
|
|
43627
|
+
});
|
|
43628
|
+
try {
|
|
43629
|
+
ctx.autoImplProcess.kill("SIGINT");
|
|
43630
|
+
} catch {
|
|
43631
|
+
}
|
|
43632
|
+
}, 3e4);
|
|
43633
|
+
};
|
|
43564
43634
|
const finalizeCliAutoImpl = async (code) => {
|
|
43565
43635
|
ctx.autoImplProcess = null;
|
|
43636
|
+
clearAutoStopTimer();
|
|
43566
43637
|
let success2 = completionSignalSeen || code === 0;
|
|
43567
43638
|
let message = success2 ? completionSignalSeen && code !== 0 ? "\u2705 Auto-implement complete (completion signal)" : "\u2705 Auto-implement complete" : `\u274C Agent exited (code: ${code})`;
|
|
43568
43639
|
let verificationSummary = null;
|
|
@@ -43613,12 +43684,14 @@ async (params) => {
|
|
|
43613
43684
|
if (isPty) {
|
|
43614
43685
|
child.onData((data) => {
|
|
43615
43686
|
stdout += data;
|
|
43687
|
+
clearAutoStopTimer();
|
|
43616
43688
|
if (data.includes("\x1B[6n")) {
|
|
43617
43689
|
child.write("\x1B[12;1R");
|
|
43618
43690
|
ctx.log("Terminal CPR request (\\x1b[6n) intercepted in PTY, responding with dummy coordinates [12;1R]");
|
|
43619
43691
|
}
|
|
43620
43692
|
checkAutoApproval(data, (s15) => child.write(s15));
|
|
43621
43693
|
sendAutoImplSSE(ctx, { event: "output", data: { chunk: data, stream: "stdout" } });
|
|
43694
|
+
scheduleAutoStopForVerification();
|
|
43622
43695
|
});
|
|
43623
43696
|
child.onExit(({ exitCode: code }) => {
|
|
43624
43697
|
void finalizeCliAutoImpl(code);
|
|
@@ -43627,15 +43700,19 @@ async (params) => {
|
|
|
43627
43700
|
child.stdout?.on("data", (d) => {
|
|
43628
43701
|
const chunk = d.toString();
|
|
43629
43702
|
stdout += chunk;
|
|
43703
|
+
clearAutoStopTimer();
|
|
43630
43704
|
if (chunk.includes("\x1B[6n")) child.stdin?.write("\x1B[1;1R");
|
|
43631
43705
|
checkAutoApproval(chunk, (s15) => child.stdin?.write(s15));
|
|
43632
43706
|
sendAutoImplSSE(ctx, { event: "output", data: { chunk, stream: "stdout" } });
|
|
43707
|
+
scheduleAutoStopForVerification();
|
|
43633
43708
|
});
|
|
43634
43709
|
child.stderr?.on("data", (d) => {
|
|
43635
43710
|
const chunk = d.toString();
|
|
43636
43711
|
stderr += chunk;
|
|
43712
|
+
clearAutoStopTimer();
|
|
43637
43713
|
checkAutoApproval(chunk, (s15) => child.stdin?.write(s15));
|
|
43638
43714
|
sendAutoImplSSE(ctx, { event: "output", data: { chunk, stream: "stderr" } });
|
|
43715
|
+
scheduleAutoStopForVerification();
|
|
43639
43716
|
});
|
|
43640
43717
|
child.on("exit", (code) => {
|
|
43641
43718
|
void finalizeCliAutoImpl(code);
|