coding-agent-adapters 0.4.2 → 0.5.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 +1 -1
- package/dist/index.cjs +75 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +13 -4
- package/dist/index.d.ts +13 -4
- package/dist/index.js +75 -8
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
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
|
|
185
|
-
* TUI CLIs (Claude Code, Gemini CLI) use
|
|
186
|
-
* instead of literal spaces
|
|
187
|
-
* before stripping other ANSI codes so regex
|
|
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
|
/**
|
|
@@ -464,6 +465,14 @@ interface AdapterPatterns {
|
|
|
464
465
|
auth: string[];
|
|
465
466
|
/** Blocking prompt detection patterns */
|
|
466
467
|
blocking: string[];
|
|
468
|
+
/** Loading/active indicator patterns */
|
|
469
|
+
loading: string[];
|
|
470
|
+
/** Turn completion patterns */
|
|
471
|
+
turnComplete: string[];
|
|
472
|
+
/** Tool wait patterns */
|
|
473
|
+
toolWait: string[];
|
|
474
|
+
/** Exit/session complete patterns */
|
|
475
|
+
exit: string[];
|
|
467
476
|
/** Source of patterns */
|
|
468
477
|
source: 'snapshot' | 'baseline';
|
|
469
478
|
/** Version these patterns are from (if from snapshot) */
|
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
|
|
185
|
-
* TUI CLIs (Claude Code, Gemini CLI) use
|
|
186
|
-
* instead of literal spaces
|
|
187
|
-
* before stripping other ANSI codes so regex
|
|
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
|
/**
|
|
@@ -464,6 +465,14 @@ interface AdapterPatterns {
|
|
|
464
465
|
auth: string[];
|
|
465
466
|
/** Blocking prompt detection patterns */
|
|
466
467
|
blocking: string[];
|
|
468
|
+
/** Loading/active indicator patterns */
|
|
469
|
+
loading: string[];
|
|
470
|
+
/** Turn completion patterns */
|
|
471
|
+
turnComplete: string[];
|
|
472
|
+
/** Tool wait patterns */
|
|
473
|
+
toolWait: string[];
|
|
474
|
+
/** Exit/session complete patterns */
|
|
475
|
+
exit: string[];
|
|
467
476
|
/** Source of patterns */
|
|
468
477
|
source: 'snapshot' | 'baseline';
|
|
469
478
|
/** Version these patterns are from (if from snapshot) */
|
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
|
|
397
|
-
* TUI CLIs (Claude Code, Gemini CLI) use
|
|
398
|
-
* instead of literal spaces
|
|
399
|
-
* before stripping other ANSI codes so regex
|
|
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
|
-
|
|
403
|
-
|
|
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",
|
|
@@ -980,6 +983,15 @@ var GeminiAdapter = class extends BaseCodingAdapter {
|
|
|
980
983
|
instructions: "Gemini is asking to apply a change (file write, shell command, etc.)"
|
|
981
984
|
};
|
|
982
985
|
}
|
|
986
|
+
if (/Interactive\s+shell\s+awaiting\s+input/i.test(stripped)) {
|
|
987
|
+
return {
|
|
988
|
+
detected: true,
|
|
989
|
+
type: "tool_wait",
|
|
990
|
+
prompt: "Gemini interactive shell needs user focus",
|
|
991
|
+
canAutoRespond: false,
|
|
992
|
+
instructions: "Press Tab to focus the interactive shell, or wait for it to complete"
|
|
993
|
+
};
|
|
994
|
+
}
|
|
983
995
|
const loginDetection = this.detectLogin(output);
|
|
984
996
|
if (loginDetection.required) {
|
|
985
997
|
return {
|
|
@@ -1101,6 +1113,12 @@ var GeminiAdapter = class extends BaseCodingAdapter {
|
|
|
1101
1113
|
code: 0
|
|
1102
1114
|
};
|
|
1103
1115
|
}
|
|
1116
|
+
if (/Agent\s+powering\s+down/i.test(stripped)) {
|
|
1117
|
+
return {
|
|
1118
|
+
exited: true,
|
|
1119
|
+
code: 0
|
|
1120
|
+
};
|
|
1121
|
+
}
|
|
1104
1122
|
return super.detectExit(output);
|
|
1105
1123
|
}
|
|
1106
1124
|
getPromptPattern() {
|
|
@@ -1804,7 +1822,7 @@ var AiderAdapter = class extends BaseCodingAdapter {
|
|
|
1804
1822
|
if (/Aider\s+is\s+waiting\s+for\s+your\s+input/.test(stripped)) {
|
|
1805
1823
|
return true;
|
|
1806
1824
|
}
|
|
1807
|
-
const hasPrompt = /(?:ask|code|architect)(?:\s+multi)?>\s*$/m.test(stripped);
|
|
1825
|
+
const hasPrompt = /(?:(?:ask|code|architect)(?:\s+multi)?)?>\s*$/m.test(stripped);
|
|
1808
1826
|
if (hasPrompt) {
|
|
1809
1827
|
const hasEditMarkers = /Applied edit to|Commit [a-f0-9]+|wrote to|Updated/i.test(stripped);
|
|
1810
1828
|
const hasTokenUsage = /Tokens:|Cost:/i.test(stripped);
|
|
@@ -1898,6 +1916,15 @@ var BASELINE_PATTERNS = {
|
|
|
1898
1916
|
"update available",
|
|
1899
1917
|
"[y/n]"
|
|
1900
1918
|
],
|
|
1919
|
+
loading: [
|
|
1920
|
+
"Reading X files\u2026"
|
|
1921
|
+
],
|
|
1922
|
+
turnComplete: [
|
|
1923
|
+
"Cooked for 1m 6s",
|
|
1924
|
+
"<CustomVerb> for 4m 39s"
|
|
1925
|
+
],
|
|
1926
|
+
toolWait: [],
|
|
1927
|
+
exit: [],
|
|
1901
1928
|
source: "baseline"
|
|
1902
1929
|
},
|
|
1903
1930
|
gemini: {
|
|
@@ -1919,6 +1946,20 @@ var BASELINE_PATTERNS = {
|
|
|
1919
1946
|
"update available",
|
|
1920
1947
|
"[y/n]"
|
|
1921
1948
|
],
|
|
1949
|
+
loading: [
|
|
1950
|
+
"<phrase> (esc to cancel, 25s)",
|
|
1951
|
+
"Waiting for user confirmation...",
|
|
1952
|
+
"Generating witty retort\u2026",
|
|
1953
|
+
"Reticulating splines",
|
|
1954
|
+
"Warming up the AI hamsters"
|
|
1955
|
+
],
|
|
1956
|
+
turnComplete: [],
|
|
1957
|
+
toolWait: [
|
|
1958
|
+
"Interactive shell awaiting input... press tab to focus shell"
|
|
1959
|
+
],
|
|
1960
|
+
exit: [
|
|
1961
|
+
"Agent powering down. Goodbye!"
|
|
1962
|
+
],
|
|
1922
1963
|
source: "baseline"
|
|
1923
1964
|
},
|
|
1924
1965
|
codex: {
|
|
@@ -1937,6 +1978,18 @@ var BASELINE_PATTERNS = {
|
|
|
1937
1978
|
"update available",
|
|
1938
1979
|
"[y/n]"
|
|
1939
1980
|
],
|
|
1981
|
+
loading: [
|
|
1982
|
+
"\u2022 Working (0s \u2022 esc to interrupt)",
|
|
1983
|
+
"Booting MCP server: alpha"
|
|
1984
|
+
],
|
|
1985
|
+
turnComplete: [
|
|
1986
|
+
"Worked for 1m 05s"
|
|
1987
|
+
],
|
|
1988
|
+
toolWait: [
|
|
1989
|
+
"Waiting for background terminal \xB7 <command>",
|
|
1990
|
+
"Searching the web"
|
|
1991
|
+
],
|
|
1992
|
+
exit: [],
|
|
1940
1993
|
source: "baseline"
|
|
1941
1994
|
},
|
|
1942
1995
|
aider: {
|
|
@@ -1955,6 +2008,16 @@ var BASELINE_PATTERNS = {
|
|
|
1955
2008
|
"(Y)es/(N)o",
|
|
1956
2009
|
"[y/n]"
|
|
1957
2010
|
],
|
|
2011
|
+
loading: [
|
|
2012
|
+
"Waiting for <model>",
|
|
2013
|
+
"Waiting for LLM",
|
|
2014
|
+
"Generating commit message with <model>"
|
|
2015
|
+
],
|
|
2016
|
+
turnComplete: [
|
|
2017
|
+
"Aider is waiting for your input"
|
|
2018
|
+
],
|
|
2019
|
+
toolWait: [],
|
|
2020
|
+
exit: [],
|
|
1958
2021
|
source: "baseline"
|
|
1959
2022
|
}
|
|
1960
2023
|
};
|
|
@@ -1972,6 +2035,10 @@ async function tryLoadFromMonitor(adapter, version) {
|
|
|
1972
2035
|
ready: patterns.readyPatterns || [],
|
|
1973
2036
|
auth: patterns.authPatterns || [],
|
|
1974
2037
|
blocking: patterns.blockingPatterns || [],
|
|
2038
|
+
loading: patterns.loadingPatterns || [],
|
|
2039
|
+
turnComplete: patterns.turnCompletePatterns || [],
|
|
2040
|
+
toolWait: patterns.toolWaitPatterns || [],
|
|
2041
|
+
exit: patterns.exitPatterns || [],
|
|
1975
2042
|
source: "snapshot",
|
|
1976
2043
|
version: patterns.version
|
|
1977
2044
|
};
|