coding-agent-adapters 0.7.2 → 0.7.4

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.cjs CHANGED
@@ -656,12 +656,18 @@ var ClaudeAdapter = class extends BaseCodingAdapter {
656
656
  }
657
657
  getArgs(config) {
658
658
  const args = [];
659
+ const adapterConfig = config.adapterConfig;
659
660
  if (!this.isInteractive(config)) {
660
661
  args.push("--print");
661
662
  if (config.workdir) {
662
663
  args.push("--cwd", config.workdir);
663
664
  }
664
665
  }
666
+ if (adapterConfig?.resume) {
667
+ args.push("--resume", adapterConfig.resume);
668
+ } else if (adapterConfig?.continue) {
669
+ args.push("--continue");
670
+ }
665
671
  const approvalConfig = this.getApprovalConfig(config);
666
672
  if (approvalConfig) {
667
673
  args.push(...approvalConfig.cliFlags);
@@ -706,9 +712,6 @@ var ClaudeAdapter = class extends BaseCodingAdapter {
706
712
  * Detect blocking prompts specific to Claude Code CLI
707
713
  */
708
714
  detectBlockingPrompt(output) {
709
- if (this.detectReady(output)) {
710
- return { detected: false };
711
- }
712
715
  const stripped = this.stripAnsi(output);
713
716
  const loginDetection = this.detectLogin(output);
714
717
  if (loginDetection.required) {
@@ -769,6 +772,9 @@ var ClaudeAdapter = class extends BaseCodingAdapter {
769
772
  instructions: "Claude Code requesting file access permission"
770
773
  };
771
774
  }
775
+ if (this.detectReady(output)) {
776
+ return { detected: false };
777
+ }
772
778
  return super.detectBlockingPrompt(output);
773
779
  }
774
780
  /**
@@ -802,6 +808,11 @@ var ClaudeAdapter = class extends BaseCodingAdapter {
802
808
  */
803
809
  detectTaskComplete(output) {
804
810
  const stripped = this.stripAnsi(output);
811
+ if (!stripped.trim()) return false;
812
+ if (this.detectLoading(stripped)) return false;
813
+ if (/trust.*directory|do you want to|needs? your permission/i.test(stripped)) {
814
+ return false;
815
+ }
805
816
  const hasDuration = /[A-Z][A-Za-z' -]{2,40}\s+for\s+\d+(?:h\s+\d{1,2}m\s+\d{1,2}s|m\s+\d{1,2}s|s)/.test(stripped);
806
817
  const tail = stripped.slice(-300);
807
818
  const hasIdlePrompt = /❯/.test(tail);
@@ -815,14 +826,16 @@ var ClaudeAdapter = class extends BaseCodingAdapter {
815
826
  }
816
827
  detectReady(output) {
817
828
  const stripped = this.stripAnsi(output);
829
+ if (!stripped.trim()) return false;
830
+ if (this.detectLoading(stripped)) return false;
818
831
  if (/trust.*directory|do you want to|needs? your permission/i.test(stripped)) {
819
832
  return false;
820
833
  }
821
834
  const tail = stripped.slice(-300);
822
- return stripped.includes("How can I help") || stripped.includes("What would you like") || // v2.1+ shows "for shortcuts" hint when ready
823
- stripped.includes("for shortcuts") || // Match "claude> " or similar specific prompts, not bare ">"
824
- /claude>/i.test(tail) || // v2.1+ uses ❯ as the input prompt
825
- /❯/.test(tail);
835
+ const hasConversationalReadyText = stripped.includes("How can I help") || stripped.includes("What would you like");
836
+ const hasLegacyPrompt = /claude>/i.test(tail);
837
+ const hasShortcutsHint = stripped.includes("for shortcuts");
838
+ return hasConversationalReadyText || hasLegacyPrompt || hasShortcutsHint;
826
839
  }
827
840
  parseOutput(output) {
828
841
  const stripped = this.stripAnsi(output);
@@ -1340,22 +1353,26 @@ var CodexAdapter = class extends BaseCodingAdapter {
1340
1353
  }
1341
1354
  if (/preparing.?device.?code.?login/i.test(stripped) || /open.?this.?link.?in.?your.?browser/i.test(stripped) || /enter.?this.?one-time.?code/i.test(stripped)) {
1342
1355
  const codeMatch = stripped.match(/code[:\s]+([A-Z0-9-]+)/i);
1356
+ const deviceCode = codeMatch ? codeMatch[1] : void 0;
1343
1357
  const urlMatch = stripped.match(/https?:\/\/[^\s]+/);
1344
1358
  return {
1345
1359
  required: true,
1346
1360
  type: "device_code",
1347
1361
  url: urlMatch ? urlMatch[0] : void 0,
1348
- instructions: codeMatch ? `Enter code ${codeMatch[1]} at the URL` : "Device code authentication in progress \u2014 complete in browser"
1362
+ deviceCode,
1363
+ instructions: deviceCode ? `Enter code ${deviceCode} at the URL` : "Device code authentication in progress \u2014 complete in browser"
1349
1364
  };
1350
1365
  }
1351
1366
  if (stripped.includes("device code") || stripped.includes("Enter the code")) {
1352
1367
  const codeMatch = stripped.match(/code[:\s]+([A-Z0-9-]+)/i);
1368
+ const deviceCode = codeMatch ? codeMatch[1] : void 0;
1353
1369
  const urlMatch = stripped.match(/https?:\/\/[^\s]+/);
1354
1370
  return {
1355
1371
  required: true,
1356
1372
  type: "device_code",
1357
1373
  url: urlMatch ? urlMatch[0] : void 0,
1358
- instructions: codeMatch ? `Enter code ${codeMatch[1]} at the URL` : "Device code authentication required"
1374
+ deviceCode,
1375
+ instructions: deviceCode ? `Enter code ${deviceCode} at the URL` : "Device code authentication required"
1359
1376
  };
1360
1377
  }
1361
1378
  return { required: false };
@@ -1469,27 +1486,35 @@ var CodexAdapter = class extends BaseCodingAdapter {
1469
1486
  */
1470
1487
  detectTaskComplete(output) {
1471
1488
  const stripped = this.stripAnsi(output);
1489
+ if (!stripped.trim()) return false;
1490
+ if (this.detectLoading(stripped)) return false;
1472
1491
  const hasWorkedFor = /Worked\s+for\s+\d+(?:h\s+\d{2}m\s+\d{2}s|m\s+\d{2}s|s)/.test(stripped);
1473
- const hasReadyPrompt = /›\s+Ask\s+Codex\s+to\s+do\s+anything/.test(stripped);
1474
- if (hasWorkedFor && hasReadyPrompt) {
1492
+ const hasComposerPrompt = /›\s+Ask\s+Codex\s+to\s+do\s+anything/.test(stripped) || /^\s*›\s*(?!\d+\.)\S.*$/m.test(stripped);
1493
+ const hasIdleFooterHints = /\?\s+for\s+shortcuts/i.test(stripped) || /context\s+left/i.test(stripped) || /tab\s+to\s+queue\s+message/i.test(stripped);
1494
+ if (hasWorkedFor && (hasComposerPrompt || hasIdleFooterHints)) {
1475
1495
  return true;
1476
1496
  }
1477
- if (hasReadyPrompt) {
1497
+ if (hasComposerPrompt) {
1478
1498
  return true;
1479
1499
  }
1480
- if (hasWorkedFor && /›\s+/m.test(stripped)) {
1500
+ if (hasWorkedFor && hasIdleFooterHints) {
1481
1501
  return true;
1482
1502
  }
1483
1503
  return false;
1484
1504
  }
1485
1505
  detectReady(output) {
1486
1506
  const stripped = this.stripAnsi(output);
1507
+ if (!stripped.trim()) return false;
1508
+ if (this.detectLoading(stripped)) return false;
1509
+ const tail = stripped.slice(-1200);
1510
+ const hasComposerPrompt = /^\s*›\s*(?!\d+\.)\S.*$/m.test(tail) || /›\s+Ask\s+Codex\s+to\s+do\s+anything/.test(tail);
1511
+ const hasComposerFooter = /\?\s+for\s+shortcuts/i.test(tail) || /context\s+left/i.test(tail) || /tab\s+to\s+queue\s+message/i.test(tail) || /shift\s*\+\s*enter\s+for\s+newline/i.test(tail);
1512
+ if (hasComposerPrompt || hasComposerFooter) {
1513
+ return true;
1514
+ }
1487
1515
  if (/do.?you.?trust.?the.?contents/i.test(stripped) || /sign.?in.?with.?chatgpt/i.test(stripped) || /update.?available/i.test(stripped) || /enable.?full.?access/i.test(stripped) || /choose.?working.?directory/i.test(stripped)) {
1488
1516
  return false;
1489
1517
  }
1490
- if (/›\s+/m.test(stripped)) {
1491
- return true;
1492
- }
1493
1518
  if (/explain this codebase|summarize recent commits|find and fix a bug/i.test(stripped)) {
1494
1519
  return true;
1495
1520
  }