coding-agent-adapters 0.2.3 → 0.2.5
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 +215 -14
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +94 -11
- package/dist/index.d.ts +94 -11
- package/dist/index.js +210 -15
- package/dist/index.js.map +1 -1
- package/package.json +8 -2
package/dist/index.d.cts
CHANGED
|
@@ -30,6 +30,15 @@ interface InstallationInfo {
|
|
|
30
30
|
/** Minimum required version (if known) */
|
|
31
31
|
minVersion?: string;
|
|
32
32
|
}
|
|
33
|
+
/**
|
|
34
|
+
* Model tier recommendations for an adapter
|
|
35
|
+
*/
|
|
36
|
+
interface ModelRecommendations {
|
|
37
|
+
/** Most capable model for complex tasks */
|
|
38
|
+
powerful: string;
|
|
39
|
+
/** Fastest/cheapest model for simple tasks */
|
|
40
|
+
fast: string;
|
|
41
|
+
}
|
|
33
42
|
/**
|
|
34
43
|
* Extended config with credentials and mode support
|
|
35
44
|
*/
|
|
@@ -40,6 +49,12 @@ interface CodingAgentConfig extends SpawnConfig {
|
|
|
40
49
|
* Use this when you want the full interactive CLI experience.
|
|
41
50
|
*/
|
|
42
51
|
interactive?: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Preferred provider for multi-provider adapters (e.g., Aider).
|
|
54
|
+
* Only the API key for this provider is passed, letting the CLI
|
|
55
|
+
* pick its best model for that provider automatically.
|
|
56
|
+
*/
|
|
57
|
+
provider?: 'anthropic' | 'openai' | 'google';
|
|
43
58
|
} & Record<string, unknown>;
|
|
44
59
|
}
|
|
45
60
|
/**
|
|
@@ -59,6 +74,11 @@ declare abstract class BaseCodingAdapter extends BaseCLIAdapter {
|
|
|
59
74
|
* When true, skip non-interactive flags (--print, --quiet, etc.)
|
|
60
75
|
*/
|
|
61
76
|
protected isInteractive(config: SpawnConfig): boolean;
|
|
77
|
+
/**
|
|
78
|
+
* Get recommended models for this adapter.
|
|
79
|
+
* Returns powerful (most capable) and fast (cheapest/fastest) model names.
|
|
80
|
+
*/
|
|
81
|
+
abstract getRecommendedModels(credentials?: AgentCredentials): ModelRecommendations;
|
|
62
82
|
/**
|
|
63
83
|
* Override detectExit to include installation instructions
|
|
64
84
|
*/
|
|
@@ -96,6 +116,7 @@ declare class ClaudeAdapter extends BaseCodingAdapter {
|
|
|
96
116
|
* These handle common prompts that can be safely auto-responded.
|
|
97
117
|
*/
|
|
98
118
|
readonly autoResponseRules: AutoResponseRule[];
|
|
119
|
+
getRecommendedModels(_credentials?: AgentCredentials): ModelRecommendations;
|
|
99
120
|
getCommand(): string;
|
|
100
121
|
getArgs(config: SpawnConfig): string[];
|
|
101
122
|
getEnv(config: SpawnConfig): Record<string, string>;
|
|
@@ -120,6 +141,7 @@ declare class GeminiAdapter extends BaseCodingAdapter {
|
|
|
120
141
|
readonly adapterType = "gemini";
|
|
121
142
|
readonly displayName = "Google Gemini";
|
|
122
143
|
readonly installation: InstallationInfo;
|
|
144
|
+
getRecommendedModels(_credentials?: AgentCredentials): ModelRecommendations;
|
|
123
145
|
getCommand(): string;
|
|
124
146
|
getArgs(config: SpawnConfig): string[];
|
|
125
147
|
getEnv(config: SpawnConfig): Record<string, string>;
|
|
@@ -145,6 +167,7 @@ declare class CodexAdapter extends BaseCodingAdapter {
|
|
|
145
167
|
* Auto-response rules for OpenAI Codex CLI.
|
|
146
168
|
*/
|
|
147
169
|
readonly autoResponseRules: AutoResponseRule[];
|
|
170
|
+
getRecommendedModels(_credentials?: AgentCredentials): ModelRecommendations;
|
|
148
171
|
getCommand(): string;
|
|
149
172
|
getArgs(config: SpawnConfig): string[];
|
|
150
173
|
getEnv(config: SpawnConfig): Record<string, string>;
|
|
@@ -174,6 +197,7 @@ declare class AiderAdapter extends BaseCodingAdapter {
|
|
|
174
197
|
* Auto-response rules for Aider CLI.
|
|
175
198
|
*/
|
|
176
199
|
readonly autoResponseRules: AutoResponseRule[];
|
|
200
|
+
getRecommendedModels(credentials?: AgentCredentials): ModelRecommendations;
|
|
177
201
|
getCommand(): string;
|
|
178
202
|
getArgs(config: SpawnConfig): string[];
|
|
179
203
|
getEnv(config: SpawnConfig): Record<string, string>;
|
|
@@ -185,6 +209,73 @@ declare class AiderAdapter extends BaseCodingAdapter {
|
|
|
185
209
|
getHealthCheckCommand(): string;
|
|
186
210
|
}
|
|
187
211
|
|
|
212
|
+
/**
|
|
213
|
+
* Shared types for coding-agent-adapters
|
|
214
|
+
*/
|
|
215
|
+
/**
|
|
216
|
+
* Supported adapter types
|
|
217
|
+
*/
|
|
218
|
+
type AdapterType = 'claude' | 'gemini' | 'codex' | 'aider';
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* Dynamic Pattern Loader
|
|
222
|
+
*
|
|
223
|
+
* Loads adapter patterns from @parallax/adapter-monitor snapshots when available,
|
|
224
|
+
* with fallback to hardcoded baseline patterns.
|
|
225
|
+
*/
|
|
226
|
+
|
|
227
|
+
/**
|
|
228
|
+
* Pattern set for an adapter
|
|
229
|
+
*/
|
|
230
|
+
interface AdapterPatterns {
|
|
231
|
+
/** Ready state detection patterns */
|
|
232
|
+
ready: string[];
|
|
233
|
+
/** Auth/login detection patterns */
|
|
234
|
+
auth: string[];
|
|
235
|
+
/** Blocking prompt detection patterns */
|
|
236
|
+
blocking: string[];
|
|
237
|
+
/** Source of patterns */
|
|
238
|
+
source: 'snapshot' | 'baseline';
|
|
239
|
+
/** Version these patterns are from (if from snapshot) */
|
|
240
|
+
version?: string;
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* Load patterns for an adapter
|
|
244
|
+
*
|
|
245
|
+
* Tries to load from @parallax/adapter-monitor snapshots first,
|
|
246
|
+
* falls back to hardcoded baseline patterns.
|
|
247
|
+
*
|
|
248
|
+
* @param adapter - Adapter type
|
|
249
|
+
* @param version - Optional specific CLI version to load patterns for
|
|
250
|
+
* @param forceRefresh - Skip cache and reload
|
|
251
|
+
*/
|
|
252
|
+
declare function loadPatterns(adapter: AdapterType, version?: string, forceRefresh?: boolean): Promise<AdapterPatterns>;
|
|
253
|
+
/**
|
|
254
|
+
* Load patterns synchronously (uses cache or baseline only)
|
|
255
|
+
*
|
|
256
|
+
* Use this in constructors or synchronous code paths.
|
|
257
|
+
* For best results, call loadPatterns() asynchronously during init.
|
|
258
|
+
*/
|
|
259
|
+
declare function loadPatternsSync(adapter: AdapterType): AdapterPatterns;
|
|
260
|
+
/**
|
|
261
|
+
* Preload patterns for all adapters
|
|
262
|
+
*
|
|
263
|
+
* Call this during application startup to warm the cache.
|
|
264
|
+
*/
|
|
265
|
+
declare function preloadAllPatterns(): Promise<void>;
|
|
266
|
+
/**
|
|
267
|
+
* Clear the pattern cache
|
|
268
|
+
*/
|
|
269
|
+
declare function clearPatternCache(): void;
|
|
270
|
+
/**
|
|
271
|
+
* Get baseline patterns (always available, no async)
|
|
272
|
+
*/
|
|
273
|
+
declare function getBaselinePatterns(adapter: AdapterType): AdapterPatterns;
|
|
274
|
+
/**
|
|
275
|
+
* Check if dynamic patterns are available
|
|
276
|
+
*/
|
|
277
|
+
declare function hasDynamicPatterns(adapter: AdapterType): Promise<boolean>;
|
|
278
|
+
|
|
188
279
|
/**
|
|
189
280
|
* coding-agent-adapters
|
|
190
281
|
*
|
|
@@ -227,16 +318,8 @@ declare class AiderAdapter extends BaseCodingAdapter {
|
|
|
227
318
|
* Create instances of all available adapters
|
|
228
319
|
*/
|
|
229
320
|
declare function createAllAdapters(): (ClaudeAdapter | GeminiAdapter | CodexAdapter | AiderAdapter)[];
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
*/
|
|
233
|
-
declare const ADAPTER_TYPES: {
|
|
234
|
-
readonly claude: typeof ClaudeAdapter;
|
|
235
|
-
readonly gemini: typeof GeminiAdapter;
|
|
236
|
-
readonly codex: typeof CodexAdapter;
|
|
237
|
-
readonly aider: typeof AiderAdapter;
|
|
238
|
-
};
|
|
239
|
-
type AdapterType = keyof typeof ADAPTER_TYPES;
|
|
321
|
+
|
|
322
|
+
declare const ADAPTER_TYPES: Record<AdapterType, typeof ClaudeAdapter | typeof GeminiAdapter | typeof CodexAdapter | typeof AiderAdapter>;
|
|
240
323
|
/**
|
|
241
324
|
* Create a specific adapter by type
|
|
242
325
|
*/
|
|
@@ -288,4 +371,4 @@ declare function checkAllAdapters(): Promise<PreflightResult[]>;
|
|
|
288
371
|
*/
|
|
289
372
|
declare function printMissingAdapters(types?: AdapterType[]): Promise<void>;
|
|
290
373
|
|
|
291
|
-
export { ADAPTER_TYPES, type AdapterType, type AgentCredentials, AiderAdapter, BaseCodingAdapter, ClaudeAdapter, CodexAdapter, type CodingAgentConfig, GeminiAdapter, type InstallationInfo, type PreflightResult, checkAdapters, checkAllAdapters, createAdapter, createAllAdapters, printMissingAdapters };
|
|
374
|
+
export { ADAPTER_TYPES, type AdapterPatterns, type AdapterType, type AgentCredentials, AiderAdapter, BaseCodingAdapter, ClaudeAdapter, CodexAdapter, type CodingAgentConfig, GeminiAdapter, type InstallationInfo, type ModelRecommendations, type PreflightResult, checkAdapters, checkAllAdapters, clearPatternCache, createAdapter, createAllAdapters, getBaselinePatterns, hasDynamicPatterns, loadPatterns, loadPatternsSync, preloadAllPatterns, printMissingAdapters };
|
package/dist/index.d.ts
CHANGED
|
@@ -30,6 +30,15 @@ interface InstallationInfo {
|
|
|
30
30
|
/** Minimum required version (if known) */
|
|
31
31
|
minVersion?: string;
|
|
32
32
|
}
|
|
33
|
+
/**
|
|
34
|
+
* Model tier recommendations for an adapter
|
|
35
|
+
*/
|
|
36
|
+
interface ModelRecommendations {
|
|
37
|
+
/** Most capable model for complex tasks */
|
|
38
|
+
powerful: string;
|
|
39
|
+
/** Fastest/cheapest model for simple tasks */
|
|
40
|
+
fast: string;
|
|
41
|
+
}
|
|
33
42
|
/**
|
|
34
43
|
* Extended config with credentials and mode support
|
|
35
44
|
*/
|
|
@@ -40,6 +49,12 @@ interface CodingAgentConfig extends SpawnConfig {
|
|
|
40
49
|
* Use this when you want the full interactive CLI experience.
|
|
41
50
|
*/
|
|
42
51
|
interactive?: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Preferred provider for multi-provider adapters (e.g., Aider).
|
|
54
|
+
* Only the API key for this provider is passed, letting the CLI
|
|
55
|
+
* pick its best model for that provider automatically.
|
|
56
|
+
*/
|
|
57
|
+
provider?: 'anthropic' | 'openai' | 'google';
|
|
43
58
|
} & Record<string, unknown>;
|
|
44
59
|
}
|
|
45
60
|
/**
|
|
@@ -59,6 +74,11 @@ declare abstract class BaseCodingAdapter extends BaseCLIAdapter {
|
|
|
59
74
|
* When true, skip non-interactive flags (--print, --quiet, etc.)
|
|
60
75
|
*/
|
|
61
76
|
protected isInteractive(config: SpawnConfig): boolean;
|
|
77
|
+
/**
|
|
78
|
+
* Get recommended models for this adapter.
|
|
79
|
+
* Returns powerful (most capable) and fast (cheapest/fastest) model names.
|
|
80
|
+
*/
|
|
81
|
+
abstract getRecommendedModels(credentials?: AgentCredentials): ModelRecommendations;
|
|
62
82
|
/**
|
|
63
83
|
* Override detectExit to include installation instructions
|
|
64
84
|
*/
|
|
@@ -96,6 +116,7 @@ declare class ClaudeAdapter extends BaseCodingAdapter {
|
|
|
96
116
|
* These handle common prompts that can be safely auto-responded.
|
|
97
117
|
*/
|
|
98
118
|
readonly autoResponseRules: AutoResponseRule[];
|
|
119
|
+
getRecommendedModels(_credentials?: AgentCredentials): ModelRecommendations;
|
|
99
120
|
getCommand(): string;
|
|
100
121
|
getArgs(config: SpawnConfig): string[];
|
|
101
122
|
getEnv(config: SpawnConfig): Record<string, string>;
|
|
@@ -120,6 +141,7 @@ declare class GeminiAdapter extends BaseCodingAdapter {
|
|
|
120
141
|
readonly adapterType = "gemini";
|
|
121
142
|
readonly displayName = "Google Gemini";
|
|
122
143
|
readonly installation: InstallationInfo;
|
|
144
|
+
getRecommendedModels(_credentials?: AgentCredentials): ModelRecommendations;
|
|
123
145
|
getCommand(): string;
|
|
124
146
|
getArgs(config: SpawnConfig): string[];
|
|
125
147
|
getEnv(config: SpawnConfig): Record<string, string>;
|
|
@@ -145,6 +167,7 @@ declare class CodexAdapter extends BaseCodingAdapter {
|
|
|
145
167
|
* Auto-response rules for OpenAI Codex CLI.
|
|
146
168
|
*/
|
|
147
169
|
readonly autoResponseRules: AutoResponseRule[];
|
|
170
|
+
getRecommendedModels(_credentials?: AgentCredentials): ModelRecommendations;
|
|
148
171
|
getCommand(): string;
|
|
149
172
|
getArgs(config: SpawnConfig): string[];
|
|
150
173
|
getEnv(config: SpawnConfig): Record<string, string>;
|
|
@@ -174,6 +197,7 @@ declare class AiderAdapter extends BaseCodingAdapter {
|
|
|
174
197
|
* Auto-response rules for Aider CLI.
|
|
175
198
|
*/
|
|
176
199
|
readonly autoResponseRules: AutoResponseRule[];
|
|
200
|
+
getRecommendedModels(credentials?: AgentCredentials): ModelRecommendations;
|
|
177
201
|
getCommand(): string;
|
|
178
202
|
getArgs(config: SpawnConfig): string[];
|
|
179
203
|
getEnv(config: SpawnConfig): Record<string, string>;
|
|
@@ -185,6 +209,73 @@ declare class AiderAdapter extends BaseCodingAdapter {
|
|
|
185
209
|
getHealthCheckCommand(): string;
|
|
186
210
|
}
|
|
187
211
|
|
|
212
|
+
/**
|
|
213
|
+
* Shared types for coding-agent-adapters
|
|
214
|
+
*/
|
|
215
|
+
/**
|
|
216
|
+
* Supported adapter types
|
|
217
|
+
*/
|
|
218
|
+
type AdapterType = 'claude' | 'gemini' | 'codex' | 'aider';
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* Dynamic Pattern Loader
|
|
222
|
+
*
|
|
223
|
+
* Loads adapter patterns from @parallax/adapter-monitor snapshots when available,
|
|
224
|
+
* with fallback to hardcoded baseline patterns.
|
|
225
|
+
*/
|
|
226
|
+
|
|
227
|
+
/**
|
|
228
|
+
* Pattern set for an adapter
|
|
229
|
+
*/
|
|
230
|
+
interface AdapterPatterns {
|
|
231
|
+
/** Ready state detection patterns */
|
|
232
|
+
ready: string[];
|
|
233
|
+
/** Auth/login detection patterns */
|
|
234
|
+
auth: string[];
|
|
235
|
+
/** Blocking prompt detection patterns */
|
|
236
|
+
blocking: string[];
|
|
237
|
+
/** Source of patterns */
|
|
238
|
+
source: 'snapshot' | 'baseline';
|
|
239
|
+
/** Version these patterns are from (if from snapshot) */
|
|
240
|
+
version?: string;
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* Load patterns for an adapter
|
|
244
|
+
*
|
|
245
|
+
* Tries to load from @parallax/adapter-monitor snapshots first,
|
|
246
|
+
* falls back to hardcoded baseline patterns.
|
|
247
|
+
*
|
|
248
|
+
* @param adapter - Adapter type
|
|
249
|
+
* @param version - Optional specific CLI version to load patterns for
|
|
250
|
+
* @param forceRefresh - Skip cache and reload
|
|
251
|
+
*/
|
|
252
|
+
declare function loadPatterns(adapter: AdapterType, version?: string, forceRefresh?: boolean): Promise<AdapterPatterns>;
|
|
253
|
+
/**
|
|
254
|
+
* Load patterns synchronously (uses cache or baseline only)
|
|
255
|
+
*
|
|
256
|
+
* Use this in constructors or synchronous code paths.
|
|
257
|
+
* For best results, call loadPatterns() asynchronously during init.
|
|
258
|
+
*/
|
|
259
|
+
declare function loadPatternsSync(adapter: AdapterType): AdapterPatterns;
|
|
260
|
+
/**
|
|
261
|
+
* Preload patterns for all adapters
|
|
262
|
+
*
|
|
263
|
+
* Call this during application startup to warm the cache.
|
|
264
|
+
*/
|
|
265
|
+
declare function preloadAllPatterns(): Promise<void>;
|
|
266
|
+
/**
|
|
267
|
+
* Clear the pattern cache
|
|
268
|
+
*/
|
|
269
|
+
declare function clearPatternCache(): void;
|
|
270
|
+
/**
|
|
271
|
+
* Get baseline patterns (always available, no async)
|
|
272
|
+
*/
|
|
273
|
+
declare function getBaselinePatterns(adapter: AdapterType): AdapterPatterns;
|
|
274
|
+
/**
|
|
275
|
+
* Check if dynamic patterns are available
|
|
276
|
+
*/
|
|
277
|
+
declare function hasDynamicPatterns(adapter: AdapterType): Promise<boolean>;
|
|
278
|
+
|
|
188
279
|
/**
|
|
189
280
|
* coding-agent-adapters
|
|
190
281
|
*
|
|
@@ -227,16 +318,8 @@ declare class AiderAdapter extends BaseCodingAdapter {
|
|
|
227
318
|
* Create instances of all available adapters
|
|
228
319
|
*/
|
|
229
320
|
declare function createAllAdapters(): (ClaudeAdapter | GeminiAdapter | CodexAdapter | AiderAdapter)[];
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
*/
|
|
233
|
-
declare const ADAPTER_TYPES: {
|
|
234
|
-
readonly claude: typeof ClaudeAdapter;
|
|
235
|
-
readonly gemini: typeof GeminiAdapter;
|
|
236
|
-
readonly codex: typeof CodexAdapter;
|
|
237
|
-
readonly aider: typeof AiderAdapter;
|
|
238
|
-
};
|
|
239
|
-
type AdapterType = keyof typeof ADAPTER_TYPES;
|
|
321
|
+
|
|
322
|
+
declare const ADAPTER_TYPES: Record<AdapterType, typeof ClaudeAdapter | typeof GeminiAdapter | typeof CodexAdapter | typeof AiderAdapter>;
|
|
240
323
|
/**
|
|
241
324
|
* Create a specific adapter by type
|
|
242
325
|
*/
|
|
@@ -288,4 +371,4 @@ declare function checkAllAdapters(): Promise<PreflightResult[]>;
|
|
|
288
371
|
*/
|
|
289
372
|
declare function printMissingAdapters(types?: AdapterType[]): Promise<void>;
|
|
290
373
|
|
|
291
|
-
export { ADAPTER_TYPES, type AdapterType, type AgentCredentials, AiderAdapter, BaseCodingAdapter, ClaudeAdapter, CodexAdapter, type CodingAgentConfig, GeminiAdapter, type InstallationInfo, type PreflightResult, checkAdapters, checkAllAdapters, createAdapter, createAllAdapters, printMissingAdapters };
|
|
374
|
+
export { ADAPTER_TYPES, type AdapterPatterns, type AdapterType, type AgentCredentials, AiderAdapter, BaseCodingAdapter, ClaudeAdapter, CodexAdapter, type CodingAgentConfig, GeminiAdapter, type InstallationInfo, type ModelRecommendations, type PreflightResult, checkAdapters, checkAllAdapters, clearPatternCache, createAdapter, createAllAdapters, getBaselinePatterns, hasDynamicPatterns, loadPatterns, loadPatternsSync, preloadAllPatterns, printMissingAdapters };
|
package/dist/index.js
CHANGED
|
@@ -141,6 +141,12 @@ var ClaudeAdapter = class extends BaseCodingAdapter {
|
|
|
141
141
|
safe: true
|
|
142
142
|
}
|
|
143
143
|
];
|
|
144
|
+
getRecommendedModels(_credentials) {
|
|
145
|
+
return {
|
|
146
|
+
powerful: "claude-sonnet-4-20250514",
|
|
147
|
+
fast: "claude-haiku-4-5-20251001"
|
|
148
|
+
};
|
|
149
|
+
}
|
|
144
150
|
getCommand() {
|
|
145
151
|
return "claude";
|
|
146
152
|
}
|
|
@@ -204,6 +210,15 @@ var ClaudeAdapter = class extends BaseCodingAdapter {
|
|
|
204
210
|
instructions: loginDetection.instructions
|
|
205
211
|
};
|
|
206
212
|
}
|
|
213
|
+
if (/Do you want to|wants? (your )?permission|needs your permission/i.test(stripped)) {
|
|
214
|
+
return {
|
|
215
|
+
detected: true,
|
|
216
|
+
type: "permission",
|
|
217
|
+
prompt: "Claude tool permission",
|
|
218
|
+
canAutoRespond: false,
|
|
219
|
+
instructions: "Claude is asking permission to use a tool"
|
|
220
|
+
};
|
|
221
|
+
}
|
|
207
222
|
if (/choose.*model|select.*model|available models/i.test(stripped) && /\d+\)|claude-/i.test(stripped)) {
|
|
208
223
|
return {
|
|
209
224
|
detected: true,
|
|
@@ -286,6 +301,12 @@ var GeminiAdapter = class extends BaseCodingAdapter {
|
|
|
286
301
|
],
|
|
287
302
|
docsUrl: "https://github.com/anthropics/gemini-cli#installation"
|
|
288
303
|
};
|
|
304
|
+
getRecommendedModels(_credentials) {
|
|
305
|
+
return {
|
|
306
|
+
powerful: "gemini-2.5-pro",
|
|
307
|
+
fast: "gemini-2.5-flash"
|
|
308
|
+
};
|
|
309
|
+
}
|
|
289
310
|
getCommand() {
|
|
290
311
|
return "gemini";
|
|
291
312
|
}
|
|
@@ -355,6 +376,15 @@ var GeminiAdapter = class extends BaseCodingAdapter {
|
|
|
355
376
|
instructions: loginDetection.instructions
|
|
356
377
|
};
|
|
357
378
|
}
|
|
379
|
+
if (/Apply this change\?/i.test(stripped) || /Waiting for user confirmation/i.test(stripped)) {
|
|
380
|
+
return {
|
|
381
|
+
detected: true,
|
|
382
|
+
type: "permission",
|
|
383
|
+
prompt: "Gemini tool execution confirmation",
|
|
384
|
+
canAutoRespond: false,
|
|
385
|
+
instructions: "Gemini is asking to apply a change (file write, shell command, etc.)"
|
|
386
|
+
};
|
|
387
|
+
}
|
|
358
388
|
if (/select.*model|choose.*model|gemini-/i.test(stripped) && /\d+\)/i.test(stripped)) {
|
|
359
389
|
return {
|
|
360
390
|
detected: true,
|
|
@@ -460,6 +490,12 @@ var CodexAdapter = class extends BaseCodingAdapter {
|
|
|
460
490
|
safe: true
|
|
461
491
|
}
|
|
462
492
|
];
|
|
493
|
+
getRecommendedModels(_credentials) {
|
|
494
|
+
return {
|
|
495
|
+
powerful: "o3",
|
|
496
|
+
fast: "gpt-4o-mini"
|
|
497
|
+
};
|
|
498
|
+
}
|
|
463
499
|
getCommand() {
|
|
464
500
|
return "codex";
|
|
465
501
|
}
|
|
@@ -622,6 +658,30 @@ var AiderAdapter = class extends BaseCodingAdapter {
|
|
|
622
658
|
safe: true
|
|
623
659
|
}
|
|
624
660
|
];
|
|
661
|
+
getRecommendedModels(credentials) {
|
|
662
|
+
if (credentials?.anthropicKey) {
|
|
663
|
+
return {
|
|
664
|
+
powerful: "anthropic/claude-sonnet-4-20250514",
|
|
665
|
+
fast: "anthropic/claude-haiku-4-5-20251001"
|
|
666
|
+
};
|
|
667
|
+
}
|
|
668
|
+
if (credentials?.openaiKey) {
|
|
669
|
+
return {
|
|
670
|
+
powerful: "openai/o3",
|
|
671
|
+
fast: "openai/gpt-4o-mini"
|
|
672
|
+
};
|
|
673
|
+
}
|
|
674
|
+
if (credentials?.googleKey) {
|
|
675
|
+
return {
|
|
676
|
+
powerful: "gemini/gemini-2.5-pro",
|
|
677
|
+
fast: "gemini/gemini-2.5-flash"
|
|
678
|
+
};
|
|
679
|
+
}
|
|
680
|
+
return {
|
|
681
|
+
powerful: "anthropic/claude-sonnet-4-20250514",
|
|
682
|
+
fast: "anthropic/claude-haiku-4-5-20251001"
|
|
683
|
+
};
|
|
684
|
+
}
|
|
625
685
|
getCommand() {
|
|
626
686
|
return "aider";
|
|
627
687
|
}
|
|
@@ -632,27 +692,24 @@ var AiderAdapter = class extends BaseCodingAdapter {
|
|
|
632
692
|
args.push("--no-pretty");
|
|
633
693
|
args.push("--no-show-diffs");
|
|
634
694
|
}
|
|
635
|
-
const
|
|
695
|
+
const provider = config.adapterConfig?.provider;
|
|
636
696
|
if (config.env?.AIDER_MODEL) {
|
|
637
697
|
args.push("--model", config.env.AIDER_MODEL);
|
|
698
|
+
} else if (provider === "anthropic") {
|
|
699
|
+
args.push("--model", "sonnet");
|
|
700
|
+
} else if (provider === "openai") {
|
|
701
|
+
args.push("--model", "4o");
|
|
702
|
+
} else if (provider === "google") {
|
|
703
|
+
args.push("--model", "gemini");
|
|
638
704
|
}
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
}
|
|
705
|
+
const credentials = this.getCredentials(config);
|
|
706
|
+
if (credentials.anthropicKey) args.push("--api-key", `anthropic=${credentials.anthropicKey}`);
|
|
707
|
+
if (credentials.openaiKey) args.push("--api-key", `openai=${credentials.openaiKey}`);
|
|
708
|
+
if (credentials.googleKey) args.push("--api-key", `google=${credentials.googleKey}`);
|
|
642
709
|
return args;
|
|
643
710
|
}
|
|
644
711
|
getEnv(config) {
|
|
645
712
|
const env = {};
|
|
646
|
-
const credentials = this.getCredentials(config);
|
|
647
|
-
if (credentials.anthropicKey) {
|
|
648
|
-
env.ANTHROPIC_API_KEY = credentials.anthropicKey;
|
|
649
|
-
}
|
|
650
|
-
if (credentials.openaiKey) {
|
|
651
|
-
env.OPENAI_API_KEY = credentials.openaiKey;
|
|
652
|
-
}
|
|
653
|
-
if (credentials.googleKey) {
|
|
654
|
-
env.GOOGLE_API_KEY = credentials.googleKey;
|
|
655
|
-
}
|
|
656
713
|
if (!this.isInteractive(config)) {
|
|
657
714
|
env.NO_COLOR = "1";
|
|
658
715
|
}
|
|
@@ -754,6 +811,144 @@ var AiderAdapter = class extends BaseCodingAdapter {
|
|
|
754
811
|
}
|
|
755
812
|
};
|
|
756
813
|
|
|
814
|
+
// src/pattern-loader.ts
|
|
815
|
+
var BASELINE_PATTERNS = {
|
|
816
|
+
claude: {
|
|
817
|
+
ready: [
|
|
818
|
+
"Claude Code",
|
|
819
|
+
"How can I help",
|
|
820
|
+
"What would you like",
|
|
821
|
+
"Ready"
|
|
822
|
+
],
|
|
823
|
+
auth: [
|
|
824
|
+
"ANTHROPIC_API_KEY",
|
|
825
|
+
"API key not found",
|
|
826
|
+
"authentication required",
|
|
827
|
+
"Please sign in",
|
|
828
|
+
"Invalid API key"
|
|
829
|
+
],
|
|
830
|
+
blocking: [
|
|
831
|
+
"update available",
|
|
832
|
+
"[y/n]"
|
|
833
|
+
],
|
|
834
|
+
source: "baseline"
|
|
835
|
+
},
|
|
836
|
+
gemini: {
|
|
837
|
+
ready: [
|
|
838
|
+
"Type your message",
|
|
839
|
+
"How can I help",
|
|
840
|
+
"What would you like",
|
|
841
|
+
"Ready"
|
|
842
|
+
],
|
|
843
|
+
auth: [
|
|
844
|
+
"GOOGLE_API_KEY",
|
|
845
|
+
"GEMINI_API_KEY",
|
|
846
|
+
"API key not found",
|
|
847
|
+
"Sign in with Google",
|
|
848
|
+
"gcloud auth",
|
|
849
|
+
"Application Default Credentials"
|
|
850
|
+
],
|
|
851
|
+
blocking: [
|
|
852
|
+
"update available",
|
|
853
|
+
"[y/n]"
|
|
854
|
+
],
|
|
855
|
+
source: "baseline"
|
|
856
|
+
},
|
|
857
|
+
codex: {
|
|
858
|
+
ready: [
|
|
859
|
+
"Codex",
|
|
860
|
+
"How can I help",
|
|
861
|
+
"Ready"
|
|
862
|
+
],
|
|
863
|
+
auth: [
|
|
864
|
+
"OPENAI_API_KEY",
|
|
865
|
+
"API key not found",
|
|
866
|
+
"Unauthorized",
|
|
867
|
+
"Invalid API key"
|
|
868
|
+
],
|
|
869
|
+
blocking: [
|
|
870
|
+
"update available",
|
|
871
|
+
"[y/n]"
|
|
872
|
+
],
|
|
873
|
+
source: "baseline"
|
|
874
|
+
},
|
|
875
|
+
aider: {
|
|
876
|
+
ready: [
|
|
877
|
+
"Aider",
|
|
878
|
+
"What would you like",
|
|
879
|
+
"Ready"
|
|
880
|
+
],
|
|
881
|
+
auth: [
|
|
882
|
+
"API key",
|
|
883
|
+
"OPENAI_API_KEY",
|
|
884
|
+
"ANTHROPIC_API_KEY",
|
|
885
|
+
"No API key"
|
|
886
|
+
],
|
|
887
|
+
blocking: [
|
|
888
|
+
"(Y)es/(N)o",
|
|
889
|
+
"[y/n]"
|
|
890
|
+
],
|
|
891
|
+
source: "baseline"
|
|
892
|
+
}
|
|
893
|
+
};
|
|
894
|
+
var patternCache = /* @__PURE__ */ new Map();
|
|
895
|
+
async function tryLoadFromMonitor(adapter, version) {
|
|
896
|
+
try {
|
|
897
|
+
const moduleName = "agent-adapter-monitor";
|
|
898
|
+
const monitor = await import(
|
|
899
|
+
/* webpackIgnore: true */
|
|
900
|
+
moduleName
|
|
901
|
+
);
|
|
902
|
+
const patterns = version ? await monitor.getPatternsForVersion(adapter, version) : await monitor.getPatternsForVersion(adapter, "latest");
|
|
903
|
+
if (patterns) {
|
|
904
|
+
return {
|
|
905
|
+
ready: patterns.readyPatterns || [],
|
|
906
|
+
auth: patterns.authPatterns || [],
|
|
907
|
+
blocking: patterns.blockingPatterns || [],
|
|
908
|
+
source: "snapshot",
|
|
909
|
+
version: patterns.version
|
|
910
|
+
};
|
|
911
|
+
}
|
|
912
|
+
} catch {
|
|
913
|
+
}
|
|
914
|
+
return null;
|
|
915
|
+
}
|
|
916
|
+
async function loadPatterns(adapter, version, forceRefresh = false) {
|
|
917
|
+
const cacheKey = `${adapter}:${version || "latest"}`;
|
|
918
|
+
if (!forceRefresh && patternCache.has(cacheKey)) {
|
|
919
|
+
return patternCache.get(cacheKey);
|
|
920
|
+
}
|
|
921
|
+
const monitorPatterns = await tryLoadFromMonitor(adapter, version);
|
|
922
|
+
if (monitorPatterns && monitorPatterns.ready.length > 0) {
|
|
923
|
+
patternCache.set(cacheKey, monitorPatterns);
|
|
924
|
+
return monitorPatterns;
|
|
925
|
+
}
|
|
926
|
+
const baseline = BASELINE_PATTERNS[adapter];
|
|
927
|
+
patternCache.set(cacheKey, baseline);
|
|
928
|
+
return baseline;
|
|
929
|
+
}
|
|
930
|
+
function loadPatternsSync(adapter) {
|
|
931
|
+
const cacheKey = `${adapter}:latest`;
|
|
932
|
+
if (patternCache.has(cacheKey)) {
|
|
933
|
+
return patternCache.get(cacheKey);
|
|
934
|
+
}
|
|
935
|
+
return BASELINE_PATTERNS[adapter];
|
|
936
|
+
}
|
|
937
|
+
async function preloadAllPatterns() {
|
|
938
|
+
const adapters = ["claude", "gemini", "codex", "aider"];
|
|
939
|
+
await Promise.all(adapters.map((adapter) => loadPatterns(adapter)));
|
|
940
|
+
}
|
|
941
|
+
function clearPatternCache() {
|
|
942
|
+
patternCache.clear();
|
|
943
|
+
}
|
|
944
|
+
function getBaselinePatterns(adapter) {
|
|
945
|
+
return BASELINE_PATTERNS[adapter];
|
|
946
|
+
}
|
|
947
|
+
async function hasDynamicPatterns(adapter) {
|
|
948
|
+
const patterns = await tryLoadFromMonitor(adapter);
|
|
949
|
+
return patterns !== null;
|
|
950
|
+
}
|
|
951
|
+
|
|
757
952
|
// src/index.ts
|
|
758
953
|
function createAllAdapters() {
|
|
759
954
|
return [
|
|
@@ -814,6 +1009,6 @@ async function printMissingAdapters(types) {
|
|
|
814
1009
|
}
|
|
815
1010
|
}
|
|
816
1011
|
|
|
817
|
-
export { ADAPTER_TYPES, AiderAdapter, BaseCodingAdapter, ClaudeAdapter, CodexAdapter, GeminiAdapter, checkAdapters, checkAllAdapters, createAdapter, createAllAdapters, printMissingAdapters };
|
|
1012
|
+
export { ADAPTER_TYPES, AiderAdapter, BaseCodingAdapter, ClaudeAdapter, CodexAdapter, GeminiAdapter, checkAdapters, checkAllAdapters, clearPatternCache, createAdapter, createAllAdapters, getBaselinePatterns, hasDynamicPatterns, loadPatterns, loadPatternsSync, preloadAllPatterns, printMissingAdapters };
|
|
818
1013
|
//# sourceMappingURL=index.js.map
|
|
819
1014
|
//# sourceMappingURL=index.js.map
|