adhdev 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/cli/index.js +141 -8
- package/dist/cli/index.js.map +1 -1
- package/dist/index.js +84 -7
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- 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/dist/index.js
CHANGED
|
@@ -6232,6 +6232,9 @@ function promptLikelyVisible(screenText, promptSnippet) {
|
|
|
6232
6232
|
function normalizeScreenSnapshot(text) {
|
|
6233
6233
|
return sanitizeTerminalText(String(text || "")).replace(/\s+/g, " ").trim();
|
|
6234
6234
|
}
|
|
6235
|
+
function normalizeComparableMessageContent(text) {
|
|
6236
|
+
return String(text || "").replace(/\s+/g, " ").trim();
|
|
6237
|
+
}
|
|
6235
6238
|
function parsePatternEntry(x) {
|
|
6236
6239
|
if (x instanceof RegExp) return x;
|
|
6237
6240
|
if (x && typeof x === "object" && typeof x.source === "string") {
|
|
@@ -6413,11 +6416,44 @@ var init_provider_cli_adapter = __esm({
|
|
|
6413
6416
|
this.structuredMessages = [...this.committedMessages];
|
|
6414
6417
|
}
|
|
6415
6418
|
normalizeParsedMessages(parsedMessages) {
|
|
6416
|
-
|
|
6417
|
-
|
|
6418
|
-
|
|
6419
|
-
|
|
6420
|
-
|
|
6419
|
+
const referenceMessages = [...this.committedMessages];
|
|
6420
|
+
const usedReferenceIndexes = /* @__PURE__ */ new Set();
|
|
6421
|
+
const now = Date.now();
|
|
6422
|
+
const findReferenceTimestamp = (role, content, parsedIndex) => {
|
|
6423
|
+
const normalizedContent = normalizeComparableMessageContent(content);
|
|
6424
|
+
if (!normalizedContent) return void 0;
|
|
6425
|
+
const sameIndex = referenceMessages[parsedIndex];
|
|
6426
|
+
if (sameIndex && !usedReferenceIndexes.has(parsedIndex) && sameIndex.role === role && normalizeComparableMessageContent(sameIndex.content) === normalizedContent && typeof sameIndex.timestamp === "number" && Number.isFinite(sameIndex.timestamp)) {
|
|
6427
|
+
usedReferenceIndexes.add(parsedIndex);
|
|
6428
|
+
return sameIndex.timestamp;
|
|
6429
|
+
}
|
|
6430
|
+
for (let i = 0; i < referenceMessages.length; i++) {
|
|
6431
|
+
if (usedReferenceIndexes.has(i)) continue;
|
|
6432
|
+
const candidate = referenceMessages[i];
|
|
6433
|
+
if (!candidate || candidate.role !== role) continue;
|
|
6434
|
+
const candidateContent = normalizeComparableMessageContent(candidate.content);
|
|
6435
|
+
if (!candidateContent) continue;
|
|
6436
|
+
const exactMatch = candidateContent === normalizedContent;
|
|
6437
|
+
const fuzzyMatch = candidateContent.includes(normalizedContent) || normalizedContent.includes(candidateContent);
|
|
6438
|
+
if (!exactMatch && !fuzzyMatch) continue;
|
|
6439
|
+
if (typeof candidate.timestamp === "number" && Number.isFinite(candidate.timestamp)) {
|
|
6440
|
+
usedReferenceIndexes.add(i);
|
|
6441
|
+
return candidate.timestamp;
|
|
6442
|
+
}
|
|
6443
|
+
}
|
|
6444
|
+
return void 0;
|
|
6445
|
+
};
|
|
6446
|
+
return parsedMessages.filter((message) => message && (message.role === "user" || message.role === "assistant")).map((message, index) => {
|
|
6447
|
+
const role = message.role;
|
|
6448
|
+
const content = typeof message.content === "string" ? message.content : String(message.content || "");
|
|
6449
|
+
const parsedTimestamp = typeof message.timestamp === "number" && Number.isFinite(message.timestamp) ? message.timestamp : void 0;
|
|
6450
|
+
const referenceTimestamp = parsedTimestamp ?? findReferenceTimestamp(role, content, index);
|
|
6451
|
+
return {
|
|
6452
|
+
role,
|
|
6453
|
+
content,
|
|
6454
|
+
timestamp: referenceTimestamp ?? now
|
|
6455
|
+
};
|
|
6456
|
+
});
|
|
6421
6457
|
}
|
|
6422
6458
|
sliceFromOffset(text, start) {
|
|
6423
6459
|
if (!text) return "";
|
|
@@ -6575,11 +6611,15 @@ var init_provider_cli_adapter = __esm({
|
|
|
6575
6611
|
let shellCmd;
|
|
6576
6612
|
let shellArgs;
|
|
6577
6613
|
const useShellUnix = !isWin && (!!spawnConfig.shell || !path7.isAbsolute(binaryPath) || isScriptBinary(binaryPath) || !looksLikeMachOOrElf(binaryPath));
|
|
6578
|
-
const
|
|
6614
|
+
const isCmdShim = isWin && /\.(cmd|bat)$/i.test(binaryPath);
|
|
6615
|
+
const useShell = isWin ? !!spawnConfig.shell || isCmdShim : useShellUnix;
|
|
6579
6616
|
if (useShell) {
|
|
6580
6617
|
if (!spawnConfig.shell && !isWin) {
|
|
6581
6618
|
LOG.info("CLI", `[${this.cliType}] Using login shell (script shim or non-native binary)`);
|
|
6582
6619
|
}
|
|
6620
|
+
if (isCmdShim) {
|
|
6621
|
+
LOG.info("CLI", `[${this.cliType}] Using cmd.exe shell for .cmd/.bat shim: ${binaryPath}`);
|
|
6622
|
+
}
|
|
6583
6623
|
shellCmd = isWin ? "cmd.exe" : process.env.SHELL || "/bin/zsh";
|
|
6584
6624
|
if (isWin) {
|
|
6585
6625
|
shellArgs = ["/c", binaryPath, ...allArgs];
|
|
@@ -33795,6 +33835,8 @@ async function handleAutoImplement(ctx, type, req, res) {
|
|
|
33795
33835
|
let approvalBuffer = "";
|
|
33796
33836
|
let lastApprovalTime = 0;
|
|
33797
33837
|
let completionSignalSeen = false;
|
|
33838
|
+
let autoStopTimer = null;
|
|
33839
|
+
let autoStopIssued = false;
|
|
33798
33840
|
try {
|
|
33799
33841
|
const { normalizeCliProviderForRuntime: normalizeCliProviderForRuntime2 } = await Promise.resolve().then(() => (init_provider_cli_adapter(), provider_cli_adapter_exports));
|
|
33800
33842
|
const normalized = normalizeCliProviderForRuntime2(agentProvider);
|
|
@@ -33832,8 +33874,37 @@ async function handleAutoImplement(ctx, type, req, res) {
|
|
|
33832
33874
|
lastApprovalTime = Date.now();
|
|
33833
33875
|
}
|
|
33834
33876
|
};
|
|
33877
|
+
const clearAutoStopTimer = () => {
|
|
33878
|
+
if (autoStopTimer) {
|
|
33879
|
+
clearTimeout(autoStopTimer);
|
|
33880
|
+
autoStopTimer = null;
|
|
33881
|
+
}
|
|
33882
|
+
};
|
|
33883
|
+
const scheduleAutoStopForVerification = () => {
|
|
33884
|
+
if (!verification || command !== "codex" || completionSignalSeen || autoStopIssued) return;
|
|
33885
|
+
const elapsed = Date.now() - spawnedAt;
|
|
33886
|
+
if (elapsed < 3e4) return;
|
|
33887
|
+
clearAutoStopTimer();
|
|
33888
|
+
autoStopTimer = setTimeout(() => {
|
|
33889
|
+
if (!ctx.autoImplProcess || completionSignalSeen || autoStopIssued) return;
|
|
33890
|
+
autoStopIssued = true;
|
|
33891
|
+
ctx.log(`Auto-implement output quiet for 30s after ${Math.round((Date.now() - spawnedAt) / 1e3)}s. Interrupting agent and switching to daemon verification.`);
|
|
33892
|
+
sendAutoImplSSE(ctx, {
|
|
33893
|
+
event: "output",
|
|
33894
|
+
data: {
|
|
33895
|
+
chunk: "\n[\u{1F916} ADHDev Pipeline] Agent output quiet. Interrupting and running daemon verification...\n",
|
|
33896
|
+
stream: "stdout"
|
|
33897
|
+
}
|
|
33898
|
+
});
|
|
33899
|
+
try {
|
|
33900
|
+
ctx.autoImplProcess.kill("SIGINT");
|
|
33901
|
+
} catch {
|
|
33902
|
+
}
|
|
33903
|
+
}, 3e4);
|
|
33904
|
+
};
|
|
33835
33905
|
const finalizeCliAutoImpl = async (code) => {
|
|
33836
33906
|
ctx.autoImplProcess = null;
|
|
33907
|
+
clearAutoStopTimer();
|
|
33837
33908
|
let success2 = completionSignalSeen || code === 0;
|
|
33838
33909
|
let message = success2 ? completionSignalSeen && code !== 0 ? "\u2705 Auto-implement complete (completion signal)" : "\u2705 Auto-implement complete" : `\u274C Agent exited (code: ${code})`;
|
|
33839
33910
|
let verificationSummary = null;
|
|
@@ -33884,12 +33955,14 @@ async function handleAutoImplement(ctx, type, req, res) {
|
|
|
33884
33955
|
if (isPty) {
|
|
33885
33956
|
child.onData((data) => {
|
|
33886
33957
|
stdout += data;
|
|
33958
|
+
clearAutoStopTimer();
|
|
33887
33959
|
if (data.includes("\x1B[6n")) {
|
|
33888
33960
|
child.write("\x1B[12;1R");
|
|
33889
33961
|
ctx.log("Terminal CPR request (\\x1b[6n) intercepted in PTY, responding with dummy coordinates [12;1R]");
|
|
33890
33962
|
}
|
|
33891
33963
|
checkAutoApproval(data, (s) => child.write(s));
|
|
33892
33964
|
sendAutoImplSSE(ctx, { event: "output", data: { chunk: data, stream: "stdout" } });
|
|
33965
|
+
scheduleAutoStopForVerification();
|
|
33893
33966
|
});
|
|
33894
33967
|
child.onExit(({ exitCode: code }) => {
|
|
33895
33968
|
void finalizeCliAutoImpl(code);
|
|
@@ -33898,15 +33971,19 @@ async function handleAutoImplement(ctx, type, req, res) {
|
|
|
33898
33971
|
child.stdout?.on("data", (d) => {
|
|
33899
33972
|
const chunk = d.toString();
|
|
33900
33973
|
stdout += chunk;
|
|
33974
|
+
clearAutoStopTimer();
|
|
33901
33975
|
if (chunk.includes("\x1B[6n")) child.stdin?.write("\x1B[1;1R");
|
|
33902
33976
|
checkAutoApproval(chunk, (s) => child.stdin?.write(s));
|
|
33903
33977
|
sendAutoImplSSE(ctx, { event: "output", data: { chunk, stream: "stdout" } });
|
|
33978
|
+
scheduleAutoStopForVerification();
|
|
33904
33979
|
});
|
|
33905
33980
|
child.stderr?.on("data", (d) => {
|
|
33906
33981
|
const chunk = d.toString();
|
|
33907
33982
|
stderr += chunk;
|
|
33983
|
+
clearAutoStopTimer();
|
|
33908
33984
|
checkAutoApproval(chunk, (s) => child.stdin?.write(s));
|
|
33909
33985
|
sendAutoImplSSE(ctx, { event: "output", data: { chunk, stream: "stderr" } });
|
|
33986
|
+
scheduleAutoStopForVerification();
|
|
33910
33987
|
});
|
|
33911
33988
|
child.on("exit", (code) => {
|
|
33912
33989
|
void finalizeCliAutoImpl(code);
|
|
@@ -38510,7 +38587,7 @@ var init_adhdev_daemon = __esm({
|
|
|
38510
38587
|
fs16 = __toESM(require("fs"));
|
|
38511
38588
|
path20 = __toESM(require("path"));
|
|
38512
38589
|
import_chalk2 = __toESM(require("chalk"));
|
|
38513
|
-
pkgVersion = "0.8.
|
|
38590
|
+
pkgVersion = "0.8.7";
|
|
38514
38591
|
if (pkgVersion === "unknown") {
|
|
38515
38592
|
try {
|
|
38516
38593
|
const possiblePaths = [
|