coding-agent-adapters 0.2.3 → 0.2.6

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
@@ -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
- * Adapter type to class mapping
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
- * Adapter type to class mapping
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,
@@ -458,8 +488,21 @@ var CodexAdapter = class extends BaseCodingAdapter {
458
488
  response: "n",
459
489
  description: "Decline beta features",
460
490
  safe: true
491
+ },
492
+ {
493
+ pattern: /Update (available|now)|Skip until next version/i,
494
+ type: "config",
495
+ response: "2",
496
+ description: "Skip Codex CLI update prompt",
497
+ safe: true
461
498
  }
462
499
  ];
500
+ getRecommendedModels(_credentials) {
501
+ return {
502
+ powerful: "o3",
503
+ fast: "gpt-4o-mini"
504
+ };
505
+ }
463
506
  getCommand() {
464
507
  return "codex";
465
508
  }
@@ -622,6 +665,30 @@ var AiderAdapter = class extends BaseCodingAdapter {
622
665
  safe: true
623
666
  }
624
667
  ];
668
+ getRecommendedModels(credentials) {
669
+ if (credentials?.anthropicKey) {
670
+ return {
671
+ powerful: "anthropic/claude-sonnet-4-20250514",
672
+ fast: "anthropic/claude-haiku-4-5-20251001"
673
+ };
674
+ }
675
+ if (credentials?.openaiKey) {
676
+ return {
677
+ powerful: "openai/o3",
678
+ fast: "openai/gpt-4o-mini"
679
+ };
680
+ }
681
+ if (credentials?.googleKey) {
682
+ return {
683
+ powerful: "gemini/gemini-2.5-pro",
684
+ fast: "gemini/gemini-2.5-flash"
685
+ };
686
+ }
687
+ return {
688
+ powerful: "anthropic/claude-sonnet-4-20250514",
689
+ fast: "anthropic/claude-haiku-4-5-20251001"
690
+ };
691
+ }
625
692
  getCommand() {
626
693
  return "aider";
627
694
  }
@@ -632,27 +699,24 @@ var AiderAdapter = class extends BaseCodingAdapter {
632
699
  args.push("--no-pretty");
633
700
  args.push("--no-show-diffs");
634
701
  }
635
- const credentials = this.getCredentials(config);
702
+ const provider = config.adapterConfig?.provider;
636
703
  if (config.env?.AIDER_MODEL) {
637
704
  args.push("--model", config.env.AIDER_MODEL);
705
+ } else if (provider === "anthropic") {
706
+ args.push("--model", "sonnet");
707
+ } else if (provider === "openai") {
708
+ args.push("--model", "4o");
709
+ } else if (provider === "google") {
710
+ args.push("--model", "gemini/gemini-2.5-pro");
638
711
  }
639
- if (credentials.anthropicKey && !config.env?.AIDER_MODEL) {
640
- args.push("--model", "claude-3-5-sonnet-20241022");
641
- }
712
+ const credentials = this.getCredentials(config);
713
+ if (credentials.anthropicKey) args.push("--api-key", `anthropic=${credentials.anthropicKey}`);
714
+ if (credentials.openaiKey) args.push("--api-key", `openai=${credentials.openaiKey}`);
715
+ if (credentials.googleKey) args.push("--api-key", `gemini=${credentials.googleKey}`);
642
716
  return args;
643
717
  }
644
718
  getEnv(config) {
645
719
  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
720
  if (!this.isInteractive(config)) {
657
721
  env.NO_COLOR = "1";
658
722
  }
@@ -754,6 +818,144 @@ var AiderAdapter = class extends BaseCodingAdapter {
754
818
  }
755
819
  };
756
820
 
821
+ // src/pattern-loader.ts
822
+ var BASELINE_PATTERNS = {
823
+ claude: {
824
+ ready: [
825
+ "Claude Code",
826
+ "How can I help",
827
+ "What would you like",
828
+ "Ready"
829
+ ],
830
+ auth: [
831
+ "ANTHROPIC_API_KEY",
832
+ "API key not found",
833
+ "authentication required",
834
+ "Please sign in",
835
+ "Invalid API key"
836
+ ],
837
+ blocking: [
838
+ "update available",
839
+ "[y/n]"
840
+ ],
841
+ source: "baseline"
842
+ },
843
+ gemini: {
844
+ ready: [
845
+ "Type your message",
846
+ "How can I help",
847
+ "What would you like",
848
+ "Ready"
849
+ ],
850
+ auth: [
851
+ "GOOGLE_API_KEY",
852
+ "GEMINI_API_KEY",
853
+ "API key not found",
854
+ "Sign in with Google",
855
+ "gcloud auth",
856
+ "Application Default Credentials"
857
+ ],
858
+ blocking: [
859
+ "update available",
860
+ "[y/n]"
861
+ ],
862
+ source: "baseline"
863
+ },
864
+ codex: {
865
+ ready: [
866
+ "Codex",
867
+ "How can I help",
868
+ "Ready"
869
+ ],
870
+ auth: [
871
+ "OPENAI_API_KEY",
872
+ "API key not found",
873
+ "Unauthorized",
874
+ "Invalid API key"
875
+ ],
876
+ blocking: [
877
+ "update available",
878
+ "[y/n]"
879
+ ],
880
+ source: "baseline"
881
+ },
882
+ aider: {
883
+ ready: [
884
+ "Aider",
885
+ "What would you like",
886
+ "Ready"
887
+ ],
888
+ auth: [
889
+ "API key",
890
+ "OPENAI_API_KEY",
891
+ "ANTHROPIC_API_KEY",
892
+ "No API key"
893
+ ],
894
+ blocking: [
895
+ "(Y)es/(N)o",
896
+ "[y/n]"
897
+ ],
898
+ source: "baseline"
899
+ }
900
+ };
901
+ var patternCache = /* @__PURE__ */ new Map();
902
+ async function tryLoadFromMonitor(adapter, version) {
903
+ try {
904
+ const moduleName = "agent-adapter-monitor";
905
+ const monitor = await import(
906
+ /* webpackIgnore: true */
907
+ moduleName
908
+ );
909
+ const patterns = version ? await monitor.getPatternsForVersion(adapter, version) : await monitor.getPatternsForVersion(adapter, "latest");
910
+ if (patterns) {
911
+ return {
912
+ ready: patterns.readyPatterns || [],
913
+ auth: patterns.authPatterns || [],
914
+ blocking: patterns.blockingPatterns || [],
915
+ source: "snapshot",
916
+ version: patterns.version
917
+ };
918
+ }
919
+ } catch {
920
+ }
921
+ return null;
922
+ }
923
+ async function loadPatterns(adapter, version, forceRefresh = false) {
924
+ const cacheKey = `${adapter}:${version || "latest"}`;
925
+ if (!forceRefresh && patternCache.has(cacheKey)) {
926
+ return patternCache.get(cacheKey);
927
+ }
928
+ const monitorPatterns = await tryLoadFromMonitor(adapter, version);
929
+ if (monitorPatterns && monitorPatterns.ready.length > 0) {
930
+ patternCache.set(cacheKey, monitorPatterns);
931
+ return monitorPatterns;
932
+ }
933
+ const baseline = BASELINE_PATTERNS[adapter];
934
+ patternCache.set(cacheKey, baseline);
935
+ return baseline;
936
+ }
937
+ function loadPatternsSync(adapter) {
938
+ const cacheKey = `${adapter}:latest`;
939
+ if (patternCache.has(cacheKey)) {
940
+ return patternCache.get(cacheKey);
941
+ }
942
+ return BASELINE_PATTERNS[adapter];
943
+ }
944
+ async function preloadAllPatterns() {
945
+ const adapters = ["claude", "gemini", "codex", "aider"];
946
+ await Promise.all(adapters.map((adapter) => loadPatterns(adapter)));
947
+ }
948
+ function clearPatternCache() {
949
+ patternCache.clear();
950
+ }
951
+ function getBaselinePatterns(adapter) {
952
+ return BASELINE_PATTERNS[adapter];
953
+ }
954
+ async function hasDynamicPatterns(adapter) {
955
+ const patterns = await tryLoadFromMonitor(adapter);
956
+ return patterns !== null;
957
+ }
958
+
757
959
  // src/index.ts
758
960
  function createAllAdapters() {
759
961
  return [
@@ -814,6 +1016,6 @@ async function printMissingAdapters(types) {
814
1016
  }
815
1017
  }
816
1018
 
817
- export { ADAPTER_TYPES, AiderAdapter, BaseCodingAdapter, ClaudeAdapter, CodexAdapter, GeminiAdapter, checkAdapters, checkAllAdapters, createAdapter, createAllAdapters, printMissingAdapters };
1019
+ export { ADAPTER_TYPES, AiderAdapter, BaseCodingAdapter, ClaudeAdapter, CodexAdapter, GeminiAdapter, checkAdapters, checkAllAdapters, clearPatternCache, createAdapter, createAllAdapters, getBaselinePatterns, hasDynamicPatterns, loadPatterns, loadPatternsSync, preloadAllPatterns, printMissingAdapters };
818
1020
  //# sourceMappingURL=index.js.map
819
1021
  //# sourceMappingURL=index.js.map