coding-agent-adapters 0.4.3 → 0.6.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 +20 -6
- package/dist/index.cjs +74 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +18 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.js +74 -0
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -44,12 +44,12 @@ session.send('Help me refactor this function to use async/await');
|
|
|
44
44
|
|
|
45
45
|
## Available Adapters
|
|
46
46
|
|
|
47
|
-
| Adapter | CLI | Type | Input Style | Auto-Response Rules |
|
|
48
|
-
|
|
49
|
-
| `ClaudeAdapter` | Claude Code | `claude` | TUI menus | 5 rules |
|
|
50
|
-
| `GeminiAdapter` | Gemini CLI | `gemini` | TUI menus | 3 rules |
|
|
51
|
-
| `CodexAdapter` | OpenAI Codex | `codex` | TUI menus | 6 rules |
|
|
52
|
-
| `AiderAdapter` | Aider | `aider` | Text `(Y)es/(N)o` | 17 rules |
|
|
47
|
+
| Adapter | CLI | Type | Input Style | Auto-Response Rules | Ready Settle |
|
|
48
|
+
|---------|-----|------|-------------|---------------------|-------------|
|
|
49
|
+
| `ClaudeAdapter` | Claude Code | `claude` | TUI menus | 5 rules | 500ms |
|
|
50
|
+
| `GeminiAdapter` | Gemini CLI | `gemini` | TUI menus | 3 rules | 300ms |
|
|
51
|
+
| `CodexAdapter` | OpenAI Codex | `codex` | TUI menus | 6 rules | 300ms |
|
|
52
|
+
| `AiderAdapter` | Aider | `aider` | Text `(Y)es/(N)o` | 17 rules | 200ms |
|
|
53
53
|
|
|
54
54
|
## Session Lifecycle Detection
|
|
55
55
|
|
|
@@ -83,6 +83,17 @@ Each adapter knows exactly what "ready for input" looks like:
|
|
|
83
83
|
| Codex | `>` glyph, placeholder suggestions | `chat_composer.rs` |
|
|
84
84
|
| Aider | `ask>`, `code>`, `architect>`, `help>`, `multi>`, startup banner | `io.py`, `base_coder.py` |
|
|
85
85
|
|
|
86
|
+
### Ready Settle Delay
|
|
87
|
+
|
|
88
|
+
Each adapter sets `readySettleMs` to control how long pty-manager waits after `detectReady()` matches before emitting `session_ready`. This prevents the orchestrator from sending input while the TUI is still rendering (status bar, shortcuts, update notices). The base default is 300ms; adapters override based on their rendering weight.
|
|
89
|
+
|
|
90
|
+
| Adapter | `readySettleMs` | Rationale |
|
|
91
|
+
|---------|----------------|-----------|
|
|
92
|
+
| Claude Code | 500ms | Heaviest TUI — status bar, shortcuts, update notices, /ide suggestions |
|
|
93
|
+
| Gemini CLI | 300ms | Moderate Ink TUI (inherits base default) |
|
|
94
|
+
| Codex | 300ms | Moderate Rust TUI (inherits base default) |
|
|
95
|
+
| Aider | 200ms | Minimal TUI, mostly text output |
|
|
96
|
+
|
|
86
97
|
### Blocking Prompt Detection
|
|
87
98
|
|
|
88
99
|
Adapters detect prompts that block the session and require user action:
|
|
@@ -382,6 +393,9 @@ export class CursorAdapter extends BaseCodingAdapter {
|
|
|
382
393
|
// Set to false if the CLI uses text prompts instead of TUI menus
|
|
383
394
|
override readonly usesTuiMenus = false;
|
|
384
395
|
|
|
396
|
+
// Tune ready settle delay for this CLI's rendering speed (base default: 300ms)
|
|
397
|
+
override readonly readySettleMs = 250;
|
|
398
|
+
|
|
385
399
|
readonly autoResponseRules: AutoResponseRule[] = [
|
|
386
400
|
{ pattern: /accept terms/i, type: 'tos', response: 'y', responseType: 'text', description: 'Accept TOS', safe: true, once: true },
|
|
387
401
|
];
|
package/dist/index.cjs
CHANGED
|
@@ -368,6 +368,12 @@ var BaseCodingAdapter = class extends ptyManager.BaseCLIAdapter {
|
|
|
368
368
|
* Coding agent CLIs use TUI menus that require arrow-key navigation.
|
|
369
369
|
*/
|
|
370
370
|
usesTuiMenus = true;
|
|
371
|
+
/**
|
|
372
|
+
* Ms of output silence after detectReady match before emitting session_ready.
|
|
373
|
+
* Allows TUI rendering (status bar, shortcuts, update notices) to complete
|
|
374
|
+
* before the orchestrator sends input.
|
|
375
|
+
*/
|
|
376
|
+
readySettleMs = 300;
|
|
371
377
|
/**
|
|
372
378
|
* The primary memory file for this CLI (the one it reads for project instructions).
|
|
373
379
|
* Returns the relativePath of the first 'memory' type file from getWorkspaceFiles().
|
|
@@ -535,6 +541,8 @@ Docs: ${this.installation.docsUrl}`
|
|
|
535
541
|
var ClaudeAdapter = class extends BaseCodingAdapter {
|
|
536
542
|
adapterType = "claude";
|
|
537
543
|
displayName = "Claude Code";
|
|
544
|
+
/** Heaviest TUI — status bar, shortcuts, update notices, /ide suggestions */
|
|
545
|
+
readySettleMs = 500;
|
|
538
546
|
installation = {
|
|
539
547
|
command: "npm install -g @anthropic-ai/claude-code",
|
|
540
548
|
alternatives: [
|
|
@@ -985,6 +993,15 @@ var GeminiAdapter = class extends BaseCodingAdapter {
|
|
|
985
993
|
instructions: "Gemini is asking to apply a change (file write, shell command, etc.)"
|
|
986
994
|
};
|
|
987
995
|
}
|
|
996
|
+
if (/Interactive\s+shell\s+awaiting\s+input/i.test(stripped)) {
|
|
997
|
+
return {
|
|
998
|
+
detected: true,
|
|
999
|
+
type: "tool_wait",
|
|
1000
|
+
prompt: "Gemini interactive shell needs user focus",
|
|
1001
|
+
canAutoRespond: false,
|
|
1002
|
+
instructions: "Press Tab to focus the interactive shell, or wait for it to complete"
|
|
1003
|
+
};
|
|
1004
|
+
}
|
|
988
1005
|
const loginDetection = this.detectLogin(output);
|
|
989
1006
|
if (loginDetection.required) {
|
|
990
1007
|
return {
|
|
@@ -1106,6 +1123,12 @@ var GeminiAdapter = class extends BaseCodingAdapter {
|
|
|
1106
1123
|
code: 0
|
|
1107
1124
|
};
|
|
1108
1125
|
}
|
|
1126
|
+
if (/Agent\s+powering\s+down/i.test(stripped)) {
|
|
1127
|
+
return {
|
|
1128
|
+
exited: true,
|
|
1129
|
+
code: 0
|
|
1130
|
+
};
|
|
1131
|
+
}
|
|
1109
1132
|
return super.detectExit(output);
|
|
1110
1133
|
}
|
|
1111
1134
|
getPromptPattern() {
|
|
@@ -1451,6 +1474,8 @@ var CodexAdapter = class extends BaseCodingAdapter {
|
|
|
1451
1474
|
var AiderAdapter = class extends BaseCodingAdapter {
|
|
1452
1475
|
adapterType = "aider";
|
|
1453
1476
|
displayName = "Aider";
|
|
1477
|
+
/** Minimal TUI, mostly text output — shorter settle delay */
|
|
1478
|
+
readySettleMs = 200;
|
|
1454
1479
|
/**
|
|
1455
1480
|
* Aider uses plain text [y/n] prompts, NOT TUI arrow-key menus.
|
|
1456
1481
|
*/
|
|
@@ -1903,6 +1928,15 @@ var BASELINE_PATTERNS = {
|
|
|
1903
1928
|
"update available",
|
|
1904
1929
|
"[y/n]"
|
|
1905
1930
|
],
|
|
1931
|
+
loading: [
|
|
1932
|
+
"Reading X files\u2026"
|
|
1933
|
+
],
|
|
1934
|
+
turnComplete: [
|
|
1935
|
+
"Cooked for 1m 6s",
|
|
1936
|
+
"<CustomVerb> for 4m 39s"
|
|
1937
|
+
],
|
|
1938
|
+
toolWait: [],
|
|
1939
|
+
exit: [],
|
|
1906
1940
|
source: "baseline"
|
|
1907
1941
|
},
|
|
1908
1942
|
gemini: {
|
|
@@ -1924,6 +1958,20 @@ var BASELINE_PATTERNS = {
|
|
|
1924
1958
|
"update available",
|
|
1925
1959
|
"[y/n]"
|
|
1926
1960
|
],
|
|
1961
|
+
loading: [
|
|
1962
|
+
"<phrase> (esc to cancel, 25s)",
|
|
1963
|
+
"Waiting for user confirmation...",
|
|
1964
|
+
"Generating witty retort\u2026",
|
|
1965
|
+
"Reticulating splines",
|
|
1966
|
+
"Warming up the AI hamsters"
|
|
1967
|
+
],
|
|
1968
|
+
turnComplete: [],
|
|
1969
|
+
toolWait: [
|
|
1970
|
+
"Interactive shell awaiting input... press tab to focus shell"
|
|
1971
|
+
],
|
|
1972
|
+
exit: [
|
|
1973
|
+
"Agent powering down. Goodbye!"
|
|
1974
|
+
],
|
|
1927
1975
|
source: "baseline"
|
|
1928
1976
|
},
|
|
1929
1977
|
codex: {
|
|
@@ -1942,6 +1990,18 @@ var BASELINE_PATTERNS = {
|
|
|
1942
1990
|
"update available",
|
|
1943
1991
|
"[y/n]"
|
|
1944
1992
|
],
|
|
1993
|
+
loading: [
|
|
1994
|
+
"\u2022 Working (0s \u2022 esc to interrupt)",
|
|
1995
|
+
"Booting MCP server: alpha"
|
|
1996
|
+
],
|
|
1997
|
+
turnComplete: [
|
|
1998
|
+
"Worked for 1m 05s"
|
|
1999
|
+
],
|
|
2000
|
+
toolWait: [
|
|
2001
|
+
"Waiting for background terminal \xB7 <command>",
|
|
2002
|
+
"Searching the web"
|
|
2003
|
+
],
|
|
2004
|
+
exit: [],
|
|
1945
2005
|
source: "baseline"
|
|
1946
2006
|
},
|
|
1947
2007
|
aider: {
|
|
@@ -1960,6 +2020,16 @@ var BASELINE_PATTERNS = {
|
|
|
1960
2020
|
"(Y)es/(N)o",
|
|
1961
2021
|
"[y/n]"
|
|
1962
2022
|
],
|
|
2023
|
+
loading: [
|
|
2024
|
+
"Waiting for <model>",
|
|
2025
|
+
"Waiting for LLM",
|
|
2026
|
+
"Generating commit message with <model>"
|
|
2027
|
+
],
|
|
2028
|
+
turnComplete: [
|
|
2029
|
+
"Aider is waiting for your input"
|
|
2030
|
+
],
|
|
2031
|
+
toolWait: [],
|
|
2032
|
+
exit: [],
|
|
1963
2033
|
source: "baseline"
|
|
1964
2034
|
}
|
|
1965
2035
|
};
|
|
@@ -1977,6 +2047,10 @@ async function tryLoadFromMonitor(adapter, version) {
|
|
|
1977
2047
|
ready: patterns.readyPatterns || [],
|
|
1978
2048
|
auth: patterns.authPatterns || [],
|
|
1979
2049
|
blocking: patterns.blockingPatterns || [],
|
|
2050
|
+
loading: patterns.loadingPatterns || [],
|
|
2051
|
+
turnComplete: patterns.turnCompletePatterns || [],
|
|
2052
|
+
toolWait: patterns.toolWaitPatterns || [],
|
|
2053
|
+
exit: patterns.exitPatterns || [],
|
|
1980
2054
|
source: "snapshot",
|
|
1981
2055
|
version: patterns.version
|
|
1982
2056
|
};
|