coding-agent-adapters 0.6.0 → 0.7.0
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/README.md +27 -0
- package/dist/index.cjs +77 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +40 -0
- package/dist/index.d.ts +40 -0
- package/dist/index.js +77 -0
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -105,6 +105,28 @@ Adapters detect prompts that block the session and require user action:
|
|
|
105
105
|
| Codex | Directory trust, tool approval, update available, model migration, CWD selection |
|
|
106
106
|
| Aider | File operations, shell commands, git init, pip install, destructive operations |
|
|
107
107
|
|
|
108
|
+
### Loading / Active-Work Detection
|
|
109
|
+
|
|
110
|
+
Each adapter implements `detectLoading(output)` to detect when the CLI is actively processing — thinking spinners, file reading, model streaming. When loading is detected, pty-manager suppresses stall detection entirely, avoiding unnecessary LLM classifier calls during normal operation.
|
|
111
|
+
|
|
112
|
+
| Adapter | Loading Indicators | Source Patterns |
|
|
113
|
+
|---------|-------------------|----------------|
|
|
114
|
+
| Claude | `esc to interrupt`, `Reading N files` | `claude_active_reading_files` |
|
|
115
|
+
| Gemini | `esc to cancel`, `Waiting for user confirmation` | `gemini_active_loading_line` |
|
|
116
|
+
| Codex | `esc to interrupt`, `Booting MCP server`, `Searching the web` | `codex_active_status_row`, `codex_active_booting_mcp` |
|
|
117
|
+
| Aider | `Waiting for LLM/<model>`, `Generating commit message with` | `aider_active_waiting_model`, `aider_active_waiting_llm_default` |
|
|
118
|
+
|
|
119
|
+
```typescript
|
|
120
|
+
const claude = new ClaudeAdapter();
|
|
121
|
+
claude.detectLoading('• Working (5s • esc to interrupt)'); // true
|
|
122
|
+
claude.detectLoading('Reading 42 files…'); // true
|
|
123
|
+
claude.detectLoading('❯ '); // false
|
|
124
|
+
|
|
125
|
+
const aider = new AiderAdapter();
|
|
126
|
+
aider.detectLoading('Waiting for claude-sonnet-4-20250514'); // true
|
|
127
|
+
aider.detectLoading('code> '); // false
|
|
128
|
+
```
|
|
129
|
+
|
|
108
130
|
### Task Completion Detection
|
|
109
131
|
|
|
110
132
|
Each adapter implements `detectTaskComplete(output)` to recognize when the CLI has finished a task and returned to its idle prompt. This is more specific than `detectReady()` — it matches high-confidence completion indicators (duration summaries, explicit done messages) that short-circuit the LLM stall classifier in pty-manager.
|
|
@@ -425,6 +447,11 @@ export class CursorAdapter extends BaseCodingAdapter {
|
|
|
425
447
|
return /cursor>\s*$/m.test(output);
|
|
426
448
|
}
|
|
427
449
|
|
|
450
|
+
detectLoading(output: string): boolean {
|
|
451
|
+
// Active loading indicator — suppresses stall detection
|
|
452
|
+
return /processing|thinking/i.test(output);
|
|
453
|
+
}
|
|
454
|
+
|
|
428
455
|
detectTaskComplete(output: string): boolean {
|
|
429
456
|
// High-confidence: task summary + idle prompt
|
|
430
457
|
return /completed in \d+s/.test(output) && /cursor>\s*$/m.test(output);
|
package/dist/index.cjs
CHANGED
|
@@ -760,6 +760,24 @@ var ClaudeAdapter = class extends BaseCodingAdapter {
|
|
|
760
760
|
}
|
|
761
761
|
return super.detectBlockingPrompt(output);
|
|
762
762
|
}
|
|
763
|
+
/**
|
|
764
|
+
* Detect if Claude Code is actively loading/processing.
|
|
765
|
+
*
|
|
766
|
+
* Patterns from: AGENT_LOADING_STATUS_PATTERNS.json
|
|
767
|
+
* - claude_active_reading_files: "Reading N files…"
|
|
768
|
+
* - General: "esc to interrupt" spinner status line
|
|
769
|
+
*/
|
|
770
|
+
detectLoading(output) {
|
|
771
|
+
const stripped = this.stripAnsi(output);
|
|
772
|
+
const tail = stripped.slice(-500);
|
|
773
|
+
if (/esc\s+to\s+interrupt/i.test(tail)) {
|
|
774
|
+
return true;
|
|
775
|
+
}
|
|
776
|
+
if (/Reading\s+\d+\s+files/i.test(tail)) {
|
|
777
|
+
return true;
|
|
778
|
+
}
|
|
779
|
+
return false;
|
|
780
|
+
}
|
|
763
781
|
/**
|
|
764
782
|
* Detect task completion for Claude Code.
|
|
765
783
|
*
|
|
@@ -1051,6 +1069,24 @@ var GeminiAdapter = class extends BaseCodingAdapter {
|
|
|
1051
1069
|
}
|
|
1052
1070
|
return super.detectBlockingPrompt(output);
|
|
1053
1071
|
}
|
|
1072
|
+
/**
|
|
1073
|
+
* Detect if Gemini CLI is actively loading/processing.
|
|
1074
|
+
*
|
|
1075
|
+
* Patterns from: AGENT_LOADING_STATUS_PATTERNS.json
|
|
1076
|
+
* - gemini_active_loading_line: "(esc to cancel, Xs)"
|
|
1077
|
+
* - gemini_active_waiting_user_confirmation: "Waiting for user confirmation..."
|
|
1078
|
+
*/
|
|
1079
|
+
detectLoading(output) {
|
|
1080
|
+
const stripped = this.stripAnsi(output);
|
|
1081
|
+
const tail = stripped.slice(-500);
|
|
1082
|
+
if (/esc\s+to\s+cancel/i.test(tail)) {
|
|
1083
|
+
return true;
|
|
1084
|
+
}
|
|
1085
|
+
if (/Waiting\s+for\s+user\s+confirmation/i.test(tail)) {
|
|
1086
|
+
return true;
|
|
1087
|
+
}
|
|
1088
|
+
return false;
|
|
1089
|
+
}
|
|
1054
1090
|
/**
|
|
1055
1091
|
* Detect task completion for Gemini CLI.
|
|
1056
1092
|
*
|
|
@@ -1387,6 +1423,28 @@ var CodexAdapter = class extends BaseCodingAdapter {
|
|
|
1387
1423
|
}
|
|
1388
1424
|
return super.detectBlockingPrompt(output);
|
|
1389
1425
|
}
|
|
1426
|
+
/**
|
|
1427
|
+
* Detect if Codex CLI is actively loading/processing.
|
|
1428
|
+
*
|
|
1429
|
+
* Patterns from: AGENT_LOADING_STATUS_PATTERNS.json
|
|
1430
|
+
* - codex_active_status_row: "• Working (0s • esc to interrupt)"
|
|
1431
|
+
* - codex_active_booting_mcp: "Booting MCP server: ..."
|
|
1432
|
+
* - codex_active_web_search: "Searching the web"
|
|
1433
|
+
*/
|
|
1434
|
+
detectLoading(output) {
|
|
1435
|
+
const stripped = this.stripAnsi(output);
|
|
1436
|
+
const tail = stripped.slice(-500);
|
|
1437
|
+
if (/esc\s+to\s+interrupt/i.test(tail)) {
|
|
1438
|
+
return true;
|
|
1439
|
+
}
|
|
1440
|
+
if (/Booting\s+MCP\s+server/i.test(tail)) {
|
|
1441
|
+
return true;
|
|
1442
|
+
}
|
|
1443
|
+
if (/Searching\s+the\s+web/i.test(tail)) {
|
|
1444
|
+
return true;
|
|
1445
|
+
}
|
|
1446
|
+
return false;
|
|
1447
|
+
}
|
|
1390
1448
|
/**
|
|
1391
1449
|
* Detect task completion for Codex CLI.
|
|
1392
1450
|
*
|
|
@@ -1819,6 +1877,25 @@ var AiderAdapter = class extends BaseCodingAdapter {
|
|
|
1819
1877
|
}
|
|
1820
1878
|
return super.detectBlockingPrompt(output);
|
|
1821
1879
|
}
|
|
1880
|
+
/**
|
|
1881
|
+
* Detect if Aider is actively loading/processing.
|
|
1882
|
+
*
|
|
1883
|
+
* Patterns from: AGENT_LOADING_STATUS_PATTERNS.json
|
|
1884
|
+
* - aider_active_waiting_model: "Waiting for <model>"
|
|
1885
|
+
* - aider_active_waiting_llm_default: "Waiting for LLM"
|
|
1886
|
+
* - aider_active_generating_commit_message: "Generating commit message with ..."
|
|
1887
|
+
*/
|
|
1888
|
+
detectLoading(output) {
|
|
1889
|
+
const stripped = this.stripAnsi(output);
|
|
1890
|
+
const tail = stripped.slice(-500);
|
|
1891
|
+
if (/Waiting\s+for\s+(?:LLM|[A-Za-z0-9_./:@-]+)/i.test(tail)) {
|
|
1892
|
+
return true;
|
|
1893
|
+
}
|
|
1894
|
+
if (/Generating\s+commit\s+message\s+with\s+/i.test(tail)) {
|
|
1895
|
+
return true;
|
|
1896
|
+
}
|
|
1897
|
+
return false;
|
|
1898
|
+
}
|
|
1822
1899
|
/**
|
|
1823
1900
|
* Detect task completion for Aider.
|
|
1824
1901
|
*
|