adhdev 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/cli/index.js CHANGED
@@ -34166,6 +34166,8 @@ async function handleAutoImplement(ctx, type, req, res) {
34166
34166
  let approvalBuffer = "";
34167
34167
  let lastApprovalTime = 0;
34168
34168
  let completionSignalSeen = false;
34169
+ let autoStopTimer = null;
34170
+ let autoStopIssued = false;
34169
34171
  try {
34170
34172
  const { normalizeCliProviderForRuntime: normalizeCliProviderForRuntime2 } = await Promise.resolve().then(() => (init_provider_cli_adapter(), provider_cli_adapter_exports));
34171
34173
  const normalized = normalizeCliProviderForRuntime2(agentProvider);
@@ -34203,8 +34205,37 @@ async function handleAutoImplement(ctx, type, req, res) {
34203
34205
  lastApprovalTime = Date.now();
34204
34206
  }
34205
34207
  };
34208
+ const clearAutoStopTimer = () => {
34209
+ if (autoStopTimer) {
34210
+ clearTimeout(autoStopTimer);
34211
+ autoStopTimer = null;
34212
+ }
34213
+ };
34214
+ const scheduleAutoStopForVerification = () => {
34215
+ if (!verification || command !== "codex" || completionSignalSeen || autoStopIssued) return;
34216
+ const elapsed = Date.now() - spawnedAt;
34217
+ if (elapsed < 3e4) return;
34218
+ clearAutoStopTimer();
34219
+ autoStopTimer = setTimeout(() => {
34220
+ if (!ctx.autoImplProcess || completionSignalSeen || autoStopIssued) return;
34221
+ autoStopIssued = true;
34222
+ ctx.log(`Auto-implement output quiet for 30s after ${Math.round((Date.now() - spawnedAt) / 1e3)}s. Interrupting agent and switching to daemon verification.`);
34223
+ sendAutoImplSSE(ctx, {
34224
+ event: "output",
34225
+ data: {
34226
+ chunk: "\n[\u{1F916} ADHDev Pipeline] Agent output quiet. Interrupting and running daemon verification...\n",
34227
+ stream: "stdout"
34228
+ }
34229
+ });
34230
+ try {
34231
+ ctx.autoImplProcess.kill("SIGINT");
34232
+ } catch {
34233
+ }
34234
+ }, 3e4);
34235
+ };
34206
34236
  const finalizeCliAutoImpl = async (code) => {
34207
34237
  ctx.autoImplProcess = null;
34238
+ clearAutoStopTimer();
34208
34239
  let success2 = completionSignalSeen || code === 0;
34209
34240
  let message = success2 ? completionSignalSeen && code !== 0 ? "\u2705 Auto-implement complete (completion signal)" : "\u2705 Auto-implement complete" : `\u274C Agent exited (code: ${code})`;
34210
34241
  let verificationSummary = null;
@@ -34255,12 +34286,14 @@ async function handleAutoImplement(ctx, type, req, res) {
34255
34286
  if (isPty) {
34256
34287
  child.onData((data) => {
34257
34288
  stdout += data;
34289
+ clearAutoStopTimer();
34258
34290
  if (data.includes("\x1B[6n")) {
34259
34291
  child.write("\x1B[12;1R");
34260
34292
  ctx.log("Terminal CPR request (\\x1b[6n) intercepted in PTY, responding with dummy coordinates [12;1R]");
34261
34293
  }
34262
34294
  checkAutoApproval(data, (s) => child.write(s));
34263
34295
  sendAutoImplSSE(ctx, { event: "output", data: { chunk: data, stream: "stdout" } });
34296
+ scheduleAutoStopForVerification();
34264
34297
  });
34265
34298
  child.onExit(({ exitCode: code }) => {
34266
34299
  void finalizeCliAutoImpl(code);
@@ -34269,15 +34302,19 @@ async function handleAutoImplement(ctx, type, req, res) {
34269
34302
  child.stdout?.on("data", (d) => {
34270
34303
  const chunk = d.toString();
34271
34304
  stdout += chunk;
34305
+ clearAutoStopTimer();
34272
34306
  if (chunk.includes("\x1B[6n")) child.stdin?.write("\x1B[1;1R");
34273
34307
  checkAutoApproval(chunk, (s) => child.stdin?.write(s));
34274
34308
  sendAutoImplSSE(ctx, { event: "output", data: { chunk, stream: "stdout" } });
34309
+ scheduleAutoStopForVerification();
34275
34310
  });
34276
34311
  child.stderr?.on("data", (d) => {
34277
34312
  const chunk = d.toString();
34278
34313
  stderr += chunk;
34314
+ clearAutoStopTimer();
34279
34315
  checkAutoApproval(chunk, (s) => child.stdin?.write(s));
34280
34316
  sendAutoImplSSE(ctx, { event: "output", data: { chunk, stream: "stderr" } });
34317
+ scheduleAutoStopForVerification();
34281
34318
  });
34282
34319
  child.on("exit", (code) => {
34283
34320
  void finalizeCliAutoImpl(code);
@@ -39153,7 +39190,7 @@ var init_adhdev_daemon = __esm({
39153
39190
  fs17 = __toESM(require("fs"));
39154
39191
  path21 = __toESM(require("path"));
39155
39192
  import_chalk2 = __toESM(require("chalk"));
39156
- pkgVersion = "0.8.5";
39193
+ pkgVersion = "0.8.6";
39157
39194
  if (pkgVersion === "unknown") {
39158
39195
  try {
39159
39196
  const possiblePaths = [
@@ -40734,6 +40771,52 @@ function getDefaultAutoFixReference(category, type, providers) {
40734
40771
  }
40735
40772
  return "antigravity";
40736
40773
  }
40774
+ function escapeRegex2(value) {
40775
+ return String(value || "").replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
40776
+ }
40777
+ function getCliAutoFixVerification(type, providerDir) {
40778
+ if (type !== "codex-cli") return null;
40779
+ const normalizedDir = providerDir.replace(/\\/g, "/");
40780
+ const escapedDir = escapeRegex2(normalizedDir);
40781
+ return {
40782
+ fixtureName: "codex-cli-provider-fix",
40783
+ request: {
40784
+ type,
40785
+ workingDir: providerDir,
40786
+ freshSession: true,
40787
+ autoLaunch: true,
40788
+ autoResolveApprovals: true,
40789
+ approvalButtonIndex: 0,
40790
+ timeoutMs: 9e4,
40791
+ traceLimit: 200,
40792
+ text: "Create a file at tmp/adhdev_provider_fix_test.py that prints the current working directory and the squares of 1 through 5, then run python3 tmp/adhdev_provider_fix_test.py and tell me the exact output."
40793
+ },
40794
+ inspectFields: [
40795
+ "debug.messages",
40796
+ "trace.entries[].payload.parsedLastAssistant",
40797
+ "trace.entries[].payload.detectStatus",
40798
+ "trace.entries[].payload.parsedStatus"
40799
+ ],
40800
+ lastAssistantMustContainAny: [
40801
+ "Exact output:",
40802
+ "1",
40803
+ "4",
40804
+ "9",
40805
+ "16",
40806
+ "25"
40807
+ ],
40808
+ lastAssistantMustMatchAny: [
40809
+ escapedDir
40810
+ ],
40811
+ lastAssistantMustNotContainAny: [
40812
+ "Do you trust the contents of this directory?",
40813
+ "OpenAI Codex",
40814
+ "Tip: New",
40815
+ "Summarize recent commits"
40816
+ ],
40817
+ description: "Codex CLI must classify startup/trust screens correctly, transition idle -> generating -> idle, and preserve the exact stdout block in the final assistant transcript."
40818
+ };
40819
+ }
40737
40820
  function hideCommand2(command) {
40738
40821
  command.hideHelp?.();
40739
40822
  return command;
@@ -41145,13 +41228,15 @@ function registerProviderCommands(program2) {
41145
41228
  console.log(import_chalk6.default.gray(` \u{1F4AC} Comment: ${userComment}`));
41146
41229
  }
41147
41230
  try {
41231
+ const verification = providerToFix.category === "cli" ? getCliAutoFixVerification(type, targetDir) : null;
41148
41232
  const postData = JSON.stringify({
41149
41233
  functions: functionsToFix,
41150
41234
  agent: agentName,
41151
41235
  providerDir: targetDir,
41152
41236
  ...modelName ? { model: modelName } : {},
41153
41237
  ...userComment ? { comment: userComment } : {},
41154
- reference
41238
+ reference,
41239
+ ...verification ? { verification } : {}
41155
41240
  });
41156
41241
  const startResult = await new Promise((resolve13, reject) => {
41157
41242
  const req = http3.request({
@@ -41182,6 +41267,14 @@ function registerProviderCommands(program2) {
41182
41267
  throw new Error(`Auto-Impl Failed: ${startResult.error}`);
41183
41268
  }
41184
41269
  }
41270
+ if (startResult.skipped && startResult.verification?.pass) {
41271
+ console.log(import_chalk6.default.green(`
41272
+ \u2705 Auto-Implement preflight already passes for ${type}.`));
41273
+ console.log(import_chalk6.default.gray(` Verification mode: ${startResult.verification.mode}`));
41274
+ console.log(import_chalk6.default.gray(` Provider dir: ${startResult.providerDir}`));
41275
+ console.log();
41276
+ return;
41277
+ }
41185
41278
  if (!startResult.started || !startResult.sseUrl) {
41186
41279
  throw new Error(`Unexpected response: ${JSON.stringify(startResult)}`);
41187
41280
  }