coding-agent-adapters 0.4.1 → 0.4.3

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.d.cts CHANGED
@@ -181,10 +181,11 @@ declare abstract class BaseCodingAdapter extends BaseCLIAdapter {
181
181
  */
182
182
  abstract getRecommendedModels(credentials?: AgentCredentials): ModelRecommendations;
183
183
  /**
184
- * Override stripAnsi to handle TUI cursor-forward codes.
185
- * TUI CLIs (Claude Code, Gemini CLI) use \x1b[<n>C (cursor forward)
186
- * instead of literal spaces for word positioning. Replace with spaces
187
- * before stripping other ANSI codes so regex patterns can match.
184
+ * Override stripAnsi to handle TUI cursor movement codes.
185
+ * TUI CLIs (Claude Code, Gemini CLI, Codex) use cursor positioning
186
+ * sequences instead of literal spaces. Replace ALL cursor movement
187
+ * codes with spaces before stripping other ANSI codes so regex
188
+ * patterns can match the visible text.
188
189
  */
189
190
  protected stripAnsi(str: string): string;
190
191
  /**
package/dist/index.d.ts CHANGED
@@ -181,10 +181,11 @@ declare abstract class BaseCodingAdapter extends BaseCLIAdapter {
181
181
  */
182
182
  abstract getRecommendedModels(credentials?: AgentCredentials): ModelRecommendations;
183
183
  /**
184
- * Override stripAnsi to handle TUI cursor-forward codes.
185
- * TUI CLIs (Claude Code, Gemini CLI) use \x1b[<n>C (cursor forward)
186
- * instead of literal spaces for word positioning. Replace with spaces
187
- * before stripping other ANSI codes so regex patterns can match.
184
+ * Override stripAnsi to handle TUI cursor movement codes.
185
+ * TUI CLIs (Claude Code, Gemini CLI, Codex) use cursor positioning
186
+ * sequences instead of literal spaces. Replace ALL cursor movement
187
+ * codes with spaces before stripping other ANSI codes so regex
188
+ * patterns can match the visible text.
188
189
  */
189
190
  protected stripAnsi(str: string): string;
190
191
  /**
package/dist/index.js CHANGED
@@ -393,14 +393,17 @@ var BaseCodingAdapter = class extends BaseCLIAdapter {
393
393
  return adapterConfig?.interactive === true;
394
394
  }
395
395
  /**
396
- * Override stripAnsi to handle TUI cursor-forward codes.
397
- * TUI CLIs (Claude Code, Gemini CLI) use \x1b[<n>C (cursor forward)
398
- * instead of literal spaces for word positioning. Replace with spaces
399
- * before stripping other ANSI codes so regex patterns can match.
396
+ * Override stripAnsi to handle TUI cursor movement codes.
397
+ * TUI CLIs (Claude Code, Gemini CLI, Codex) use cursor positioning
398
+ * sequences instead of literal spaces. Replace ALL cursor movement
399
+ * codes with spaces before stripping other ANSI codes so regex
400
+ * patterns can match the visible text.
400
401
  */
401
402
  stripAnsi(str) {
402
- const withSpaces = str.replace(/\x1b\[\d*C/g, " ");
403
- return super.stripAnsi(withSpaces);
403
+ let result = str.replace(/\x1b\[\d*[CDABGdEF]/g, " ");
404
+ result = result.replace(/\x1b\[\d*(?:;\d+)?[Hf]/g, " ");
405
+ result = result.replace(/\x1b\[\d*[JK]/g, " ");
406
+ return super.stripAnsi(result);
404
407
  }
405
408
  /**
406
409
  * Override detectExit to include installation instructions
@@ -546,7 +549,7 @@ var ClaudeAdapter = class extends BaseCodingAdapter {
546
549
  */
547
550
  autoResponseRules = [
548
551
  {
549
- pattern: /trust.*folder|safety.?check|project.you.created/i,
552
+ pattern: /trust.*(?:folder|directory)|safety.?check|project.you.created|(?:Yes|Allow).*(?:No|Deny).*(?:Enter|Return)/i,
550
553
  type: "permission",
551
554
  response: "",
552
555
  responseType: "keys",
@@ -922,7 +925,7 @@ var GeminiAdapter = class extends BaseCodingAdapter {
922
925
  }
923
926
  detectLogin(output) {
924
927
  const stripped = this.stripAnsi(output);
925
- if (stripped.includes("API key not found") || stripped.includes("GOOGLE_API_KEY") || stripped.includes("GEMINI_API_KEY") || stripped.includes("authentication required") || stripped.includes("Invalid API key") || stripped.includes("API key is not valid")) {
928
+ if (stripped.includes("API key not found") || /set (?:GOOGLE_API_KEY|GEMINI_API_KEY)/i.test(stripped) || stripped.includes("authentication required") || stripped.includes("Invalid API key") || stripped.includes("API key is not valid")) {
926
929
  return {
927
930
  required: true,
928
931
  type: "api_key",
@@ -1804,7 +1807,7 @@ var AiderAdapter = class extends BaseCodingAdapter {
1804
1807
  if (/Aider\s+is\s+waiting\s+for\s+your\s+input/.test(stripped)) {
1805
1808
  return true;
1806
1809
  }
1807
- const hasPrompt = /(?:ask|code|architect)(?:\s+multi)?>\s*$/m.test(stripped);
1810
+ const hasPrompt = /(?:(?:ask|code|architect)(?:\s+multi)?)?>\s*$/m.test(stripped);
1808
1811
  if (hasPrompt) {
1809
1812
  const hasEditMarkers = /Applied edit to|Commit [a-f0-9]+|wrote to|Updated/i.test(stripped);
1810
1813
  const hasTokenUsage = /Tokens:|Cost:/i.test(stripped);