coding-agent-adapters 0.1.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 +222 -0
- package/dist/index.cjs +807 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +270 -0
- package/dist/index.d.ts +270 -0
- package/dist/index.js +795 -0
- package/dist/index.js.map +1 -0
- package/package.json +62 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/base-coding-adapter.ts","../src/claude-adapter.ts","../src/gemini-adapter.ts","../src/codex-adapter.ts","../src/aider-adapter.ts","../src/index.ts"],"names":["BaseCLIAdapter"],"mappings":";;;;;AA6CO,IAAe,iBAAA,GAAf,cAAyCA,yBAAA,CAAe;AAAA;AAAA;AAAA;AAAA,EASnD,eAAe,MAAA,EAAuC;AAC9D,IAAA,MAAM,gBAAgB,MAAA,CAAO,aAAA;AAC7B,IAAA,OAAO,iBAAiB,EAAC;AAAA;AAC3B;AAAA;AAAA;AAAA,EAKA,WAAW,MAAA,EAAoE;AAC7E,IAAA,IAAI,OAAO,QAAA,CAAS,mBAAmB,KAAK,MAAA,CAAO,QAAA,CAAS,mBAAmB,CAAA,EAAG;AAChF,MAAA,OAAO;AAAA,QACL,MAAA,EAAQ,IAAA;AAAA,QACR,IAAA,EAAM,GAAA;AAAA,QACN,OAAO,CAAA,EAAG,IAAA,CAAK,WAAW,CAAA,8BAAA,EAAiC,IAAA,CAAK,aAAa,OAAO;AAAA,MAAA,EAAW,IAAA,CAAK,aAAa,OAAO,CAAA;AAAA,OAC1H;AAAA;AAGF,IAAA,OAAO,KAAA,CAAM,WAAW,MAAM,CAAA;AAAA;AAChC;AAAA;AAAA;AAAA,EAKA,sBAAA,GAAiC;AAC/B,IAAA,MAAM,KAAA,GAAQ;AAAA,MACZ,CAAA,EAAG,KAAK,WAAW,CAAA,aAAA,CAAA;AAAA,MACnB,GAAG,GAAA,CAAI,MAAA,CAAO,KAAK,WAAA,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I,CAAA,WAAA,EAAc,CAAA,CAAE,cAAc,CAAA,CAAE,CAAA;AAC5C,IAAA,OAAA,CAAQ,GAAA,CAAI,CAAA,QAAA,EAAW,CAAA,CAAE,OAAO,CAAA,CAAE,CAAA;AAClC,IAAA,IAAI,EAAE,KAAA,EAAO;AACX,MAAA,OAAA,CAAQ,GAAA,CAAI,CAAA,SAAA,EAAY,CAAA,CAAE,KAAK,CAAA,CAAE,CAAA;AAAA;AAEnC,IAAA,OAAA,CAAQ,GAAA,EAAI;AAAA;AAEhB","file":"index.cjs","sourcesContent":["/**\n * Base Coding Agent Adapter\n *\n * Extends pty-manager's BaseCLIAdapter with credential handling\n * for AI coding agents.\n */\n\nimport { BaseCLIAdapter } from 'pty-manager';\nimport type { SpawnConfig } from 'pty-manager';\n\n/**\n * Credentials that can be passed via SpawnConfig.adapterConfig\n */\nexport interface AgentCredentials {\n anthropicKey?: string;\n openaiKey?: string;\n googleKey?: string;\n githubToken?: string;\n custom?: Record<string, string>;\n}\n\n/**\n * Installation information for a CLI tool\n */\nexport interface InstallationInfo {\n /** Command to install the CLI (e.g., \"npm install -g @anthropic-ai/claude-code\") */\n command: string;\n /** Alternative installation methods */\n alternatives?: string[];\n /** URL to installation docs */\n docsUrl: string;\n /** Minimum required version (if known) */\n minVersion?: string;\n}\n\n/**\n * Extended config with credentials support\n */\nexport interface CodingAgentConfig extends SpawnConfig {\n adapterConfig?: AgentCredentials & Record<string, unknown>;\n}\n\n/**\n * Base class for AI coding agent adapters\n */\nexport abstract class BaseCodingAdapter extends BaseCLIAdapter {\n /**\n * Installation information for this CLI tool\n */\n abstract readonly installation: InstallationInfo;\n\n /**\n * Get credentials from config\n */\n protected getCredentials(config: SpawnConfig): AgentCredentials {\n const adapterConfig = config.adapterConfig as AgentCredentials | undefined;\n return adapterConfig || {};\n }\n\n /**\n * Override detectExit to include installation instructions\n */\n detectExit(output: string): { exited: boolean; code?: number; error?: string } {\n if (output.includes('Command not found') || output.includes('command not found')) {\n return {\n exited: true,\n code: 127,\n error: `${this.displayName} CLI not found. Install with: ${this.installation.command}\\nDocs: ${this.installation.docsUrl}`,\n };\n }\n\n return super.detectExit(output);\n }\n\n /**\n * Get formatted installation instructions\n */\n getInstallInstructions(): string {\n const lines = [\n `${this.displayName} Installation`,\n `${'='.repeat(this.displayName.length + 13)}`,\n '',\n `Primary: ${this.installation.command}`,\n ];\n\n if (this.installation.alternatives?.length) {\n lines.push('');\n lines.push('Alternatives:');\n for (const alt of this.installation.alternatives) {\n lines.push(` - ${alt}`);\n }\n }\n\n lines.push('');\n lines.push(`Docs: ${this.installation.docsUrl}`);\n\n if (this.installation.minVersion) {\n lines.push(`Minimum version: ${this.installation.minVersion}`);\n }\n\n return lines.join('\\n');\n }\n\n /**\n * Check if response appears complete based on common patterns\n */\n protected isResponseComplete(output: string): boolean {\n const completionIndicators = [\n /\\n>\\s*$/, // Ends with prompt\n /\\n\\s*$/, // Ends with newline\n /Done\\./i, // Explicit done\n /completed/i, // Task completed\n /finished/i, // Finished\n /```\\s*$/, // Code block ended\n ];\n\n return completionIndicators.some((pattern) => pattern.test(output));\n }\n\n /**\n * Extract the main content from CLI output, removing common artifacts\n */\n protected extractContent(output: string, promptPattern: RegExp): string {\n let content = output;\n\n // Remove prompt lines\n content = content.replace(promptPattern, '');\n\n // Remove common status lines\n content = content.replace(/^(Thinking|Working|Reading|Writing|Processing|Generating)\\.+$/gm, '');\n\n // Trim whitespace\n content = content.trim();\n\n return content;\n }\n}\n","/**\n * Claude Code CLI Adapter\n *\n * Adapter for the Claude Code CLI (claude command).\n */\n\nimport type {\n SpawnConfig,\n ParsedOutput,\n LoginDetection,\n BlockingPromptDetection,\n AutoResponseRule,\n} from 'pty-manager';\nimport { BaseCodingAdapter, type InstallationInfo } from './base-coding-adapter';\n\nexport class ClaudeAdapter extends BaseCodingAdapter {\n readonly adapterType = 'claude';\n readonly displayName = 'Claude Code';\n\n readonly installation: InstallationInfo = {\n command: 'npm install -g @anthropic-ai/claude-code',\n alternatives: [\n 'npx @anthropic-ai/claude-code (run without installing)',\n 'brew install claude-code (macOS with Homebrew)',\n ],\n docsUrl: 'https://docs.anthropic.com/en/docs/claude-code',\n minVersion: '1.0.0',\n };\n\n /**\n * Auto-response rules for Claude Code CLI.\n * These handle common prompts that can be safely auto-responded.\n */\n readonly autoResponseRules: AutoResponseRule[] = [\n {\n pattern: /update available.*\\[y\\/n\\]/i,\n type: 'update',\n response: 'n',\n description: 'Decline Claude Code update to continue execution',\n safe: true,\n },\n {\n pattern: /new version.*available.*\\[y\\/n\\]/i,\n type: 'update',\n response: 'n',\n description: 'Decline version upgrade prompt',\n safe: true,\n },\n {\n pattern: /would you like to enable.*telemetry.*\\[y\\/n\\]/i,\n type: 'config',\n response: 'n',\n description: 'Decline telemetry prompt',\n safe: true,\n },\n {\n pattern: /send anonymous usage data.*\\[y\\/n\\]/i,\n type: 'config',\n response: 'n',\n description: 'Decline anonymous usage data',\n safe: true,\n },\n {\n pattern: /continue without.*\\[y\\/n\\]/i,\n type: 'config',\n response: 'y',\n description: 'Continue without optional feature',\n safe: true,\n },\n ];\n\n getCommand(): string {\n return 'claude';\n }\n\n getArgs(config: SpawnConfig): string[] {\n const args: string[] = [];\n\n // Print mode for non-interactive usage\n args.push('--print');\n\n // Set working directory if specified\n if (config.workdir) {\n args.push('--cwd', config.workdir);\n }\n\n return args;\n }\n\n getEnv(config: SpawnConfig): Record<string, string> {\n const env: Record<string, string> = {};\n const credentials = this.getCredentials(config);\n\n // API key from credentials or env\n if (credentials.anthropicKey) {\n env.ANTHROPIC_API_KEY = credentials.anthropicKey;\n }\n\n // Model selection (if specified in config env)\n if (config.env?.ANTHROPIC_MODEL) {\n env.ANTHROPIC_MODEL = config.env.ANTHROPIC_MODEL;\n }\n\n // Disable interactive features for automation\n env.CLAUDE_CODE_DISABLE_INTERACTIVE = 'true';\n\n return env;\n }\n\n detectLogin(output: string): LoginDetection {\n const stripped = this.stripAnsi(output);\n\n // Check for API key issues\n if (\n stripped.includes('API key not found') ||\n stripped.includes('ANTHROPIC_API_KEY') ||\n stripped.includes('authentication required') ||\n stripped.includes('Please sign in') ||\n stripped.includes('Invalid API key')\n ) {\n return {\n required: true,\n type: 'api_key',\n instructions: 'Set ANTHROPIC_API_KEY environment variable or provide credentials in adapterConfig',\n };\n }\n\n // Check for OAuth/browser login\n if (\n stripped.includes('Open this URL') ||\n stripped.includes('browser to authenticate')\n ) {\n const urlMatch = stripped.match(/https?:\\/\\/[^\\s]+/);\n return {\n required: true,\n type: 'browser',\n url: urlMatch ? urlMatch[0] : undefined,\n instructions: 'Browser authentication required',\n };\n }\n\n return { required: false };\n }\n\n /**\n * Detect blocking prompts specific to Claude Code CLI\n */\n detectBlockingPrompt(output: string): BlockingPromptDetection {\n const stripped = this.stripAnsi(output);\n\n // First check for login (highest priority)\n const loginDetection = this.detectLogin(output);\n if (loginDetection.required) {\n return {\n detected: true,\n type: 'login',\n prompt: loginDetection.instructions,\n url: loginDetection.url,\n canAutoRespond: false,\n instructions: loginDetection.instructions,\n };\n }\n\n // Claude-specific: Model selection prompt\n if (/choose.*model|select.*model|available models/i.test(stripped) &&\n /\\d+\\)|claude-/i.test(stripped)) {\n return {\n detected: true,\n type: 'model_select',\n prompt: 'Claude model selection',\n canAutoRespond: false,\n instructions: 'Please select a Claude model or set ANTHROPIC_MODEL env var',\n };\n }\n\n // Claude-specific: API key tier/plan selection\n if (/which.*tier|select.*plan|api.*tier/i.test(stripped)) {\n return {\n detected: true,\n type: 'config',\n prompt: 'API tier selection',\n canAutoRespond: false,\n instructions: 'Please select an API tier',\n };\n }\n\n // Claude-specific: First-time setup wizard\n if (/welcome to claude|first time setup|initial configuration/i.test(stripped)) {\n return {\n detected: true,\n type: 'config',\n prompt: 'First-time setup',\n canAutoRespond: false,\n instructions: 'Claude Code requires initial configuration',\n };\n }\n\n // Claude-specific: Permission to access files/directories\n if (/allow.*access|grant.*permission|access to .* files/i.test(stripped) &&\n /\\[y\\/n\\]/i.test(stripped)) {\n return {\n detected: true,\n type: 'permission',\n prompt: 'File/directory access permission',\n options: ['y', 'n'],\n suggestedResponse: 'y',\n canAutoRespond: true,\n instructions: 'Claude Code requesting file access permission',\n };\n }\n\n // Fall back to base class detection\n return super.detectBlockingPrompt(output);\n }\n\n detectReady(output: string): boolean {\n const stripped = this.stripAnsi(output);\n\n // Claude Code shows a prompt when ready\n return (\n stripped.includes('Claude Code') ||\n stripped.includes('How can I help') ||\n stripped.includes('What would you like') ||\n // Check for the typical prompt pattern\n />\\s*$/.test(stripped) ||\n // Or a clear ready indicator\n stripped.includes('Ready')\n );\n }\n\n parseOutput(output: string): ParsedOutput | null {\n const stripped = this.stripAnsi(output);\n\n // Check if this looks like a complete response\n const isComplete = this.isResponseComplete(stripped);\n\n if (!isComplete) {\n return null;\n }\n\n // Determine if this is a question\n const isQuestion = this.containsQuestion(stripped);\n\n // Extract the actual content\n const content = this.extractContent(stripped, /^.*>\\s*/gm);\n\n return {\n type: isQuestion ? 'question' : 'response',\n content,\n isComplete: true,\n isQuestion,\n metadata: {\n raw: output,\n },\n };\n }\n\n getPromptPattern(): RegExp {\n // Claude Code prompt patterns\n return /(?:claude|>)\\s*$/i;\n }\n\n getHealthCheckCommand(): string {\n return 'claude --version';\n }\n}\n","/**\n * Google Gemini CLI Adapter\n *\n * Adapter for the Google Gemini CLI tool.\n */\n\nimport type {\n SpawnConfig,\n ParsedOutput,\n LoginDetection,\n BlockingPromptDetection,\n} from 'pty-manager';\nimport { BaseCodingAdapter, type InstallationInfo } from './base-coding-adapter';\n\nexport class GeminiAdapter extends BaseCodingAdapter {\n readonly adapterType = 'gemini';\n readonly displayName = 'Google Gemini';\n\n readonly installation: InstallationInfo = {\n command: 'npm install -g @anthropics/gemini-cli',\n alternatives: [\n 'See documentation for latest installation method',\n ],\n docsUrl: 'https://github.com/anthropics/gemini-cli#installation',\n };\n\n getCommand(): string {\n return 'gemini';\n }\n\n getArgs(config: SpawnConfig): string[] {\n const args: string[] = [];\n\n // Non-interactive mode\n args.push('--non-interactive');\n\n // Set working directory if specified\n if (config.workdir) {\n args.push('--cwd', config.workdir);\n }\n\n // Text output for easier parsing\n args.push('--output-format', 'text');\n\n return args;\n }\n\n getEnv(config: SpawnConfig): Record<string, string> {\n const env: Record<string, string> = {};\n const credentials = this.getCredentials(config);\n\n // Google API key from credentials\n if (credentials.googleKey) {\n env.GOOGLE_API_KEY = credentials.googleKey;\n env.GEMINI_API_KEY = credentials.googleKey;\n }\n\n // Model selection from config env\n if (config.env?.GEMINI_MODEL) {\n env.GEMINI_MODEL = config.env.GEMINI_MODEL;\n }\n\n // Disable color for parsing\n env.NO_COLOR = '1';\n\n return env;\n }\n\n detectLogin(output: string): LoginDetection {\n const stripped = this.stripAnsi(output);\n\n // Check for API key issues\n if (\n stripped.includes('API key not found') ||\n stripped.includes('GOOGLE_API_KEY') ||\n stripped.includes('GEMINI_API_KEY') ||\n stripped.includes('authentication required') ||\n stripped.includes('Invalid API key') ||\n stripped.includes('API key is not valid')\n ) {\n return {\n required: true,\n type: 'api_key',\n instructions: 'Set GOOGLE_API_KEY or GEMINI_API_KEY environment variable',\n };\n }\n\n // Check for OAuth flow\n if (\n stripped.includes('Sign in with Google') ||\n stripped.includes('OAuth') ||\n stripped.includes('accounts.google.com')\n ) {\n const urlMatch = stripped.match(/https?:\\/\\/[^\\s]+/);\n return {\n required: true,\n type: 'oauth',\n url: urlMatch ? urlMatch[0] : 'https://accounts.google.com',\n instructions: 'Google OAuth authentication required',\n };\n }\n\n // Check for ADC (Application Default Credentials)\n if (\n stripped.includes('Application Default Credentials') ||\n stripped.includes('gcloud auth')\n ) {\n return {\n required: true,\n type: 'browser',\n instructions: 'Run: gcloud auth application-default login',\n };\n }\n\n return { required: false };\n }\n\n detectBlockingPrompt(output: string): BlockingPromptDetection {\n const stripped = this.stripAnsi(output);\n\n // First check for login\n const loginDetection = this.detectLogin(output);\n if (loginDetection.required) {\n return {\n detected: true,\n type: 'login',\n prompt: loginDetection.instructions,\n url: loginDetection.url,\n canAutoRespond: false,\n instructions: loginDetection.instructions,\n };\n }\n\n // Gemini-specific: Model selection\n if (/select.*model|choose.*model|gemini-/i.test(stripped) &&\n /\\d+\\)/i.test(stripped)) {\n return {\n detected: true,\n type: 'model_select',\n prompt: 'Gemini model selection',\n canAutoRespond: false,\n instructions: 'Please select a model or set GEMINI_MODEL env var',\n };\n }\n\n // Gemini-specific: Project selection\n if (/select.*project|choose.*project|google cloud project/i.test(stripped)) {\n return {\n detected: true,\n type: 'project_select',\n prompt: 'Google Cloud project selection',\n canAutoRespond: false,\n instructions: 'Please select a Google Cloud project',\n };\n }\n\n // Gemini-specific: Safety filter triggered\n if (/safety.*filter|content.*blocked|unsafe.*content/i.test(stripped)) {\n return {\n detected: true,\n type: 'unknown',\n prompt: 'Safety filter triggered',\n canAutoRespond: false,\n instructions: 'Content was blocked by safety filters',\n };\n }\n\n // Fall back to base class detection\n return super.detectBlockingPrompt(output);\n }\n\n detectReady(output: string): boolean {\n const stripped = this.stripAnsi(output);\n\n return (\n stripped.includes('Gemini') ||\n stripped.includes('Ready') ||\n stripped.includes('How can I help') ||\n stripped.includes('What would you like') ||\n /(?:gemini|>)\\s*$/i.test(stripped)\n );\n }\n\n parseOutput(output: string): ParsedOutput | null {\n const stripped = this.stripAnsi(output);\n\n const isComplete = this.isResponseComplete(stripped);\n\n if (!isComplete) {\n return null;\n }\n\n const isQuestion = this.containsQuestion(stripped);\n\n // Extract content, removing prompts and safety warnings\n let content = this.extractContent(stripped, /^.*(?:gemini|>)\\s*/gim);\n content = content.replace(/^\\[Safety[^\\]]*\\].*$/gm, '');\n\n return {\n type: isQuestion ? 'question' : 'response',\n content,\n isComplete: true,\n isQuestion,\n metadata: {\n raw: output,\n },\n };\n }\n\n getPromptPattern(): RegExp {\n return /(?:gemini|>)\\s*$/i;\n }\n\n getHealthCheckCommand(): string {\n return 'gemini --version';\n }\n}\n","/**\n * OpenAI Codex CLI Adapter\n *\n * Adapter for the OpenAI Codex CLI tool.\n */\n\nimport type {\n SpawnConfig,\n ParsedOutput,\n LoginDetection,\n BlockingPromptDetection,\n AutoResponseRule,\n} from 'pty-manager';\nimport { BaseCodingAdapter, type InstallationInfo } from './base-coding-adapter';\n\nexport class CodexAdapter extends BaseCodingAdapter {\n readonly adapterType = 'codex';\n readonly displayName = 'OpenAI Codex';\n\n readonly installation: InstallationInfo = {\n command: 'npm install -g @openai/codex',\n alternatives: [\n 'pip install openai (Python SDK)',\n ],\n docsUrl: 'https://github.com/openai/codex',\n };\n\n /**\n * Auto-response rules for OpenAI Codex CLI.\n */\n readonly autoResponseRules: AutoResponseRule[] = [\n {\n pattern: /update available.*\\[y\\/n\\]/i,\n type: 'update',\n response: 'n',\n description: 'Decline Codex update to continue execution',\n safe: true,\n },\n {\n pattern: /new version.*\\[y\\/n\\]/i,\n type: 'update',\n response: 'n',\n description: 'Decline version upgrade',\n safe: true,\n },\n {\n pattern: /send.*telemetry.*\\[y\\/n\\]/i,\n type: 'config',\n response: 'n',\n description: 'Decline telemetry',\n safe: true,\n },\n {\n pattern: /enable.*beta.*features.*\\[y\\/n\\]/i,\n type: 'config',\n response: 'n',\n description: 'Decline beta features',\n safe: true,\n },\n ];\n\n getCommand(): string {\n return 'codex';\n }\n\n getArgs(config: SpawnConfig): string[] {\n const args: string[] = [];\n\n // Quiet mode for less verbose output\n args.push('--quiet');\n\n // Set working directory if specified\n if (config.workdir) {\n args.push('--cwd', config.workdir);\n }\n\n return args;\n }\n\n getEnv(config: SpawnConfig): Record<string, string> {\n const env: Record<string, string> = {};\n const credentials = this.getCredentials(config);\n\n // OpenAI API key from credentials\n if (credentials.openaiKey) {\n env.OPENAI_API_KEY = credentials.openaiKey;\n }\n\n // Model selection from config env\n if (config.env?.OPENAI_MODEL) {\n env.OPENAI_MODEL = config.env.OPENAI_MODEL;\n }\n\n // Disable color output for easier parsing\n env.NO_COLOR = '1';\n\n return env;\n }\n\n detectLogin(output: string): LoginDetection {\n const stripped = this.stripAnsi(output);\n\n // Check for API key issues\n if (\n stripped.includes('API key not found') ||\n stripped.includes('OPENAI_API_KEY') ||\n stripped.includes('authentication required') ||\n stripped.includes('Invalid API key') ||\n stripped.includes('Unauthorized') ||\n stripped.includes('API key is invalid')\n ) {\n return {\n required: true,\n type: 'api_key',\n instructions: 'Set OPENAI_API_KEY environment variable or provide credentials in adapterConfig',\n };\n }\n\n // Check for device code flow\n if (stripped.includes('device code') || stripped.includes('Enter the code')) {\n const codeMatch = stripped.match(/code[:\\s]+([A-Z0-9-]+)/i);\n const urlMatch = stripped.match(/https?:\\/\\/[^\\s]+/);\n return {\n required: true,\n type: 'device_code',\n url: urlMatch ? urlMatch[0] : undefined,\n instructions: codeMatch\n ? `Enter code ${codeMatch[1]} at the URL`\n : 'Device code authentication required',\n };\n }\n\n return { required: false };\n }\n\n /**\n * Detect blocking prompts specific to OpenAI Codex CLI\n */\n detectBlockingPrompt(output: string): BlockingPromptDetection {\n const stripped = this.stripAnsi(output);\n\n // First check for login\n const loginDetection = this.detectLogin(output);\n if (loginDetection.required) {\n return {\n detected: true,\n type: 'login',\n prompt: loginDetection.instructions,\n url: loginDetection.url,\n canAutoRespond: false,\n instructions: loginDetection.instructions,\n };\n }\n\n // OpenAI-specific: Model selection\n if (/select.*model|choose.*model|gpt-4|gpt-3\\.5/i.test(stripped) &&\n /\\d+\\)/i.test(stripped)) {\n return {\n detected: true,\n type: 'model_select',\n prompt: 'OpenAI model selection',\n canAutoRespond: false,\n instructions: 'Please select a model or set OPENAI_MODEL env var',\n };\n }\n\n // OpenAI-specific: Organization selection\n if (/select.*organization|choose.*org|multiple organizations/i.test(stripped)) {\n return {\n detected: true,\n type: 'config',\n prompt: 'Organization selection',\n canAutoRespond: false,\n instructions: 'Please select an OpenAI organization',\n };\n }\n\n // OpenAI-specific: Rate limit warning\n if (/rate limit|too many requests/i.test(stripped) &&\n /retry|wait/i.test(stripped)) {\n return {\n detected: true,\n type: 'unknown',\n prompt: 'Rate limit reached',\n canAutoRespond: false,\n instructions: 'OpenAI rate limit reached - please wait',\n };\n }\n\n // Fall back to base class detection\n return super.detectBlockingPrompt(output);\n }\n\n detectReady(output: string): boolean {\n const stripped = this.stripAnsi(output);\n\n return (\n stripped.includes('Codex') ||\n stripped.includes('Ready') ||\n stripped.includes('How can I help') ||\n /(?:codex|>)\\s*$/i.test(stripped)\n );\n }\n\n parseOutput(output: string): ParsedOutput | null {\n const stripped = this.stripAnsi(output);\n\n const isComplete = this.isResponseComplete(stripped);\n\n if (!isComplete) {\n return null;\n }\n\n const isQuestion = this.containsQuestion(stripped);\n const content = this.extractContent(stripped, /^.*(?:codex|>)\\s*/gim);\n\n return {\n type: isQuestion ? 'question' : 'response',\n content,\n isComplete: true,\n isQuestion,\n metadata: {\n raw: output,\n },\n };\n }\n\n getPromptPattern(): RegExp {\n return /(?:codex|>)\\s*$/i;\n }\n\n getHealthCheckCommand(): string {\n return 'codex --version';\n }\n}\n","/**\n * Aider CLI Adapter\n *\n * Adapter for the Aider AI pair programming tool.\n * https://github.com/paul-gauthier/aider\n */\n\nimport type {\n SpawnConfig,\n ParsedOutput,\n LoginDetection,\n BlockingPromptDetection,\n AutoResponseRule,\n} from 'pty-manager';\nimport { BaseCodingAdapter, type InstallationInfo } from './base-coding-adapter';\n\nexport class AiderAdapter extends BaseCodingAdapter {\n readonly adapterType = 'aider';\n readonly displayName = 'Aider';\n\n readonly installation: InstallationInfo = {\n command: 'pip install aider-chat',\n alternatives: [\n 'pipx install aider-chat (isolated install)',\n 'brew install aider (macOS with Homebrew)',\n ],\n docsUrl: 'https://aider.chat/docs/install.html',\n minVersion: '0.50.0',\n };\n\n /**\n * Auto-response rules for Aider CLI.\n */\n readonly autoResponseRules: AutoResponseRule[] = [\n {\n pattern: /Add .+ to the chat\\?.*\\[y\\/n\\]/i,\n type: 'permission',\n response: 'y',\n description: 'Allow Aider to add files to chat context',\n safe: true,\n },\n {\n pattern: /Create new file.*\\[y\\/n\\]/i,\n type: 'permission',\n response: 'y',\n description: 'Allow Aider to create new files',\n safe: true,\n },\n {\n pattern: /Apply.*changes.*\\[y\\/n\\]/i,\n type: 'permission',\n response: 'y',\n description: 'Apply proposed changes',\n safe: true,\n },\n ];\n\n getCommand(): string {\n return 'aider';\n }\n\n getArgs(config: SpawnConfig): string[] {\n const args: string[] = [];\n\n // Use auto-commits to avoid manual git operations\n args.push('--auto-commits');\n\n // Disable pretty output for easier parsing\n args.push('--no-pretty');\n\n // Don't show diffs (we'll handle this separately if needed)\n args.push('--no-show-diffs');\n\n // Set working directory via --file flag prefix\n // Aider uses current directory, so we rely on PTY cwd\n\n // Model can be specified via env or config\n const credentials = this.getCredentials(config);\n if (config.env?.AIDER_MODEL) {\n args.push('--model', config.env.AIDER_MODEL);\n }\n\n // Default to Claude if anthropic key is available\n if (credentials.anthropicKey && !config.env?.AIDER_MODEL) {\n args.push('--model', 'claude-3-5-sonnet-20241022');\n }\n\n return args;\n }\n\n getEnv(config: SpawnConfig): Record<string, string> {\n const env: Record<string, string> = {};\n const credentials = this.getCredentials(config);\n\n // Aider supports multiple backends\n if (credentials.anthropicKey) {\n env.ANTHROPIC_API_KEY = credentials.anthropicKey;\n }\n\n if (credentials.openaiKey) {\n env.OPENAI_API_KEY = credentials.openaiKey;\n }\n\n if (credentials.googleKey) {\n env.GOOGLE_API_KEY = credentials.googleKey;\n }\n\n // Disable color for parsing\n env.NO_COLOR = '1';\n\n // Disable git integration if not wanted\n if (config.env?.AIDER_NO_GIT === 'true') {\n env.AIDER_NO_GIT = 'true';\n }\n\n return env;\n }\n\n detectLogin(output: string): LoginDetection {\n const stripped = this.stripAnsi(output);\n\n // Check for missing API keys\n if (\n stripped.includes('No API key') ||\n stripped.includes('API key not found') ||\n stripped.includes('ANTHROPIC_API_KEY') ||\n stripped.includes('OPENAI_API_KEY') ||\n stripped.includes('Missing API key')\n ) {\n return {\n required: true,\n type: 'api_key',\n instructions: 'Set ANTHROPIC_API_KEY or OPENAI_API_KEY environment variable',\n };\n }\n\n // Check for invalid API key\n if (\n stripped.includes('Invalid API key') ||\n stripped.includes('Authentication failed') ||\n stripped.includes('Unauthorized')\n ) {\n return {\n required: true,\n type: 'api_key',\n instructions: 'API key is invalid - please check your credentials',\n };\n }\n\n return { required: false };\n }\n\n detectBlockingPrompt(output: string): BlockingPromptDetection {\n const stripped = this.stripAnsi(output);\n\n // First check for login\n const loginDetection = this.detectLogin(output);\n if (loginDetection.required) {\n return {\n detected: true,\n type: 'login',\n prompt: loginDetection.instructions,\n canAutoRespond: false,\n instructions: loginDetection.instructions,\n };\n }\n\n // Aider-specific: Model selection\n if (/select.*model|choose.*model|which model/i.test(stripped)) {\n return {\n detected: true,\n type: 'model_select',\n prompt: 'Model selection required',\n canAutoRespond: false,\n instructions: 'Please select a model or set AIDER_MODEL env var',\n };\n }\n\n // Aider-specific: Git repo not found\n if (/not.*git.*repo|git.*not.*found|initialize.*git/i.test(stripped)) {\n return {\n detected: true,\n type: 'config',\n prompt: 'Git repository required',\n canAutoRespond: false,\n instructions: 'Aider requires a git repository. Run git init or use --no-git',\n };\n }\n\n // Aider-specific: Confirm file operations (that aren't auto-responded)\n if (/delete|remove|overwrite/i.test(stripped) && /\\[y\\/n\\]/i.test(stripped)) {\n return {\n detected: true,\n type: 'permission',\n prompt: 'Destructive operation confirmation',\n options: ['y', 'n'],\n canAutoRespond: false,\n instructions: 'Aider is asking to perform a potentially destructive operation',\n };\n }\n\n // Fall back to base class detection\n return super.detectBlockingPrompt(output);\n }\n\n detectReady(output: string): boolean {\n const stripped = this.stripAnsi(output);\n\n return (\n stripped.includes('aider>') ||\n stripped.includes('Aider') ||\n /aider.*ready/i.test(stripped) ||\n // Aider shows file list when ready\n /Added.*to the chat/i.test(stripped) ||\n // Or the prompt\n />\\s*$/.test(stripped)\n );\n }\n\n parseOutput(output: string): ParsedOutput | null {\n const stripped = this.stripAnsi(output);\n\n const isComplete = this.isResponseComplete(stripped);\n\n if (!isComplete) {\n return null;\n }\n\n const isQuestion = this.containsQuestion(stripped);\n\n // Extract content, removing aider prompt\n let content = this.extractContent(stripped, /^.*aider>\\s*/gim);\n\n // Remove file operation confirmations from content\n content = content.replace(/^(Added|Removed|Created|Updated) .+ (to|from) the chat\\.?$/gm, '');\n\n return {\n type: isQuestion ? 'question' : 'response',\n content: content.trim(),\n isComplete: true,\n isQuestion,\n metadata: {\n raw: output,\n },\n };\n }\n\n getPromptPattern(): RegExp {\n return /(?:aider>|>)\\s*$/i;\n }\n\n getHealthCheckCommand(): string {\n return 'aider --version';\n }\n}\n","/**\n * coding-agent-adapters\n *\n * CLI adapters for AI coding agents.\n * Works with pty-manager to spawn and manage coding agents.\n *\n * @example\n * ```typescript\n * import { PTYManager, AdapterRegistry } from 'pty-manager';\n * import { ClaudeAdapter, GeminiAdapter } from 'coding-agent-adapters';\n *\n * const registry = new AdapterRegistry();\n * registry.register(new ClaudeAdapter());\n * registry.register(new GeminiAdapter());\n *\n * const manager = new PTYManager({ adapters: registry });\n *\n * const session = await manager.spawn({\n * name: 'my-agent',\n * type: 'claude',\n * workdir: '/path/to/project',\n * adapterConfig: {\n * anthropicKey: process.env.ANTHROPIC_API_KEY,\n * },\n * });\n * ```\n */\n\n// Base class for extending\nexport { BaseCodingAdapter } from './base-coding-adapter';\nexport type { AgentCredentials, CodingAgentConfig, InstallationInfo } from './base-coding-adapter';\n\n// Adapters\nexport { ClaudeAdapter } from './claude-adapter';\nexport { GeminiAdapter } from './gemini-adapter';\nexport { CodexAdapter } from './codex-adapter';\nexport { AiderAdapter } from './aider-adapter';\n\n// Convenience function to register all adapters\nimport { ClaudeAdapter } from './claude-adapter';\nimport { GeminiAdapter } from './gemini-adapter';\nimport { CodexAdapter } from './codex-adapter';\nimport { AiderAdapter } from './aider-adapter';\n\n/**\n * Create instances of all available adapters\n */\nexport function createAllAdapters() {\n return [\n new ClaudeAdapter(),\n new GeminiAdapter(),\n new CodexAdapter(),\n new AiderAdapter(),\n ];\n}\n\n/**\n * Adapter type to class mapping\n */\nexport const ADAPTER_TYPES = {\n claude: ClaudeAdapter,\n gemini: GeminiAdapter,\n codex: CodexAdapter,\n aider: AiderAdapter,\n} as const;\n\nexport type AdapterType = keyof typeof ADAPTER_TYPES;\n\n/**\n * Create a specific adapter by type\n */\nexport function createAdapter(type: AdapterType) {\n const AdapterClass = ADAPTER_TYPES[type];\n if (!AdapterClass) {\n throw new Error(`Unknown adapter type: ${type}`);\n }\n return new AdapterClass();\n}\n\n/**\n * Result of checking if a CLI is installed\n */\nexport interface PreflightResult {\n adapter: string;\n installed: boolean;\n version?: string;\n error?: string;\n installCommand: string;\n docsUrl: string;\n}\n\n/**\n * Check if specific adapters are installed\n *\n * @example\n * ```typescript\n * const results = await checkAdapters(['claude', 'aider']);\n * for (const result of results) {\n * if (!result.installed) {\n * console.log(`${result.adapter} not found. Install: ${result.installCommand}`);\n * }\n * }\n * ```\n */\nexport async function checkAdapters(types: AdapterType[]): Promise<PreflightResult[]> {\n const results: PreflightResult[] = [];\n\n for (const type of types) {\n const adapter = createAdapter(type);\n const validation = await adapter.validateInstallation();\n\n results.push({\n adapter: adapter.displayName,\n installed: validation.installed,\n version: validation.version,\n error: validation.error,\n installCommand: adapter.installation.command,\n docsUrl: adapter.installation.docsUrl,\n });\n }\n\n return results;\n}\n\n/**\n * Check all available adapters\n *\n * @example\n * ```typescript\n * const results = await checkAllAdapters();\n * const missing = results.filter(r => !r.installed);\n *\n * if (missing.length > 0) {\n * console.log('Missing CLI tools:');\n * for (const m of missing) {\n * console.log(` ${m.adapter}: ${m.installCommand}`);\n * }\n * }\n * ```\n */\nexport async function checkAllAdapters(): Promise<PreflightResult[]> {\n return checkAdapters(Object.keys(ADAPTER_TYPES) as AdapterType[]);\n}\n\n/**\n * Print installation instructions for missing adapters\n */\nexport async function printMissingAdapters(types?: AdapterType[]): Promise<void> {\n const results = types ? await checkAdapters(types) : await checkAllAdapters();\n const missing = results.filter(r => !r.installed);\n\n if (missing.length === 0) {\n console.log('All CLI tools are installed!');\n return;\n }\n\n console.log('\\nMissing CLI tools:\\n');\n for (const m of missing) {\n console.log(`${m.adapter}`);\n console.log(` Install: ${m.installCommand}`);\n console.log(` Docs: ${m.docsUrl}`);\n if (m.error) {\n console.log(` Error: ${m.error}`);\n }\n console.log();\n }\n}\n"]}
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
import { BaseCLIAdapter, SpawnConfig, AutoResponseRule, LoginDetection, BlockingPromptDetection, ParsedOutput } from 'pty-manager';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Base Coding Agent Adapter
|
|
5
|
+
*
|
|
6
|
+
* Extends pty-manager's BaseCLIAdapter with credential handling
|
|
7
|
+
* for AI coding agents.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Credentials that can be passed via SpawnConfig.adapterConfig
|
|
12
|
+
*/
|
|
13
|
+
interface AgentCredentials {
|
|
14
|
+
anthropicKey?: string;
|
|
15
|
+
openaiKey?: string;
|
|
16
|
+
googleKey?: string;
|
|
17
|
+
githubToken?: string;
|
|
18
|
+
custom?: Record<string, string>;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Installation information for a CLI tool
|
|
22
|
+
*/
|
|
23
|
+
interface InstallationInfo {
|
|
24
|
+
/** Command to install the CLI (e.g., "npm install -g @anthropic-ai/claude-code") */
|
|
25
|
+
command: string;
|
|
26
|
+
/** Alternative installation methods */
|
|
27
|
+
alternatives?: string[];
|
|
28
|
+
/** URL to installation docs */
|
|
29
|
+
docsUrl: string;
|
|
30
|
+
/** Minimum required version (if known) */
|
|
31
|
+
minVersion?: string;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Extended config with credentials support
|
|
35
|
+
*/
|
|
36
|
+
interface CodingAgentConfig extends SpawnConfig {
|
|
37
|
+
adapterConfig?: AgentCredentials & Record<string, unknown>;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Base class for AI coding agent adapters
|
|
41
|
+
*/
|
|
42
|
+
declare abstract class BaseCodingAdapter extends BaseCLIAdapter {
|
|
43
|
+
/**
|
|
44
|
+
* Installation information for this CLI tool
|
|
45
|
+
*/
|
|
46
|
+
abstract readonly installation: InstallationInfo;
|
|
47
|
+
/**
|
|
48
|
+
* Get credentials from config
|
|
49
|
+
*/
|
|
50
|
+
protected getCredentials(config: SpawnConfig): AgentCredentials;
|
|
51
|
+
/**
|
|
52
|
+
* Override detectExit to include installation instructions
|
|
53
|
+
*/
|
|
54
|
+
detectExit(output: string): {
|
|
55
|
+
exited: boolean;
|
|
56
|
+
code?: number;
|
|
57
|
+
error?: string;
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* Get formatted installation instructions
|
|
61
|
+
*/
|
|
62
|
+
getInstallInstructions(): string;
|
|
63
|
+
/**
|
|
64
|
+
* Check if response appears complete based on common patterns
|
|
65
|
+
*/
|
|
66
|
+
protected isResponseComplete(output: string): boolean;
|
|
67
|
+
/**
|
|
68
|
+
* Extract the main content from CLI output, removing common artifacts
|
|
69
|
+
*/
|
|
70
|
+
protected extractContent(output: string, promptPattern: RegExp): string;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Claude Code CLI Adapter
|
|
75
|
+
*
|
|
76
|
+
* Adapter for the Claude Code CLI (claude command).
|
|
77
|
+
*/
|
|
78
|
+
|
|
79
|
+
declare class ClaudeAdapter extends BaseCodingAdapter {
|
|
80
|
+
readonly adapterType = "claude";
|
|
81
|
+
readonly displayName = "Claude Code";
|
|
82
|
+
readonly installation: InstallationInfo;
|
|
83
|
+
/**
|
|
84
|
+
* Auto-response rules for Claude Code CLI.
|
|
85
|
+
* These handle common prompts that can be safely auto-responded.
|
|
86
|
+
*/
|
|
87
|
+
readonly autoResponseRules: AutoResponseRule[];
|
|
88
|
+
getCommand(): string;
|
|
89
|
+
getArgs(config: SpawnConfig): string[];
|
|
90
|
+
getEnv(config: SpawnConfig): Record<string, string>;
|
|
91
|
+
detectLogin(output: string): LoginDetection;
|
|
92
|
+
/**
|
|
93
|
+
* Detect blocking prompts specific to Claude Code CLI
|
|
94
|
+
*/
|
|
95
|
+
detectBlockingPrompt(output: string): BlockingPromptDetection;
|
|
96
|
+
detectReady(output: string): boolean;
|
|
97
|
+
parseOutput(output: string): ParsedOutput | null;
|
|
98
|
+
getPromptPattern(): RegExp;
|
|
99
|
+
getHealthCheckCommand(): string;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Google Gemini CLI Adapter
|
|
104
|
+
*
|
|
105
|
+
* Adapter for the Google Gemini CLI tool.
|
|
106
|
+
*/
|
|
107
|
+
|
|
108
|
+
declare class GeminiAdapter extends BaseCodingAdapter {
|
|
109
|
+
readonly adapterType = "gemini";
|
|
110
|
+
readonly displayName = "Google Gemini";
|
|
111
|
+
readonly installation: InstallationInfo;
|
|
112
|
+
getCommand(): string;
|
|
113
|
+
getArgs(config: SpawnConfig): string[];
|
|
114
|
+
getEnv(config: SpawnConfig): Record<string, string>;
|
|
115
|
+
detectLogin(output: string): LoginDetection;
|
|
116
|
+
detectBlockingPrompt(output: string): BlockingPromptDetection;
|
|
117
|
+
detectReady(output: string): boolean;
|
|
118
|
+
parseOutput(output: string): ParsedOutput | null;
|
|
119
|
+
getPromptPattern(): RegExp;
|
|
120
|
+
getHealthCheckCommand(): string;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* OpenAI Codex CLI Adapter
|
|
125
|
+
*
|
|
126
|
+
* Adapter for the OpenAI Codex CLI tool.
|
|
127
|
+
*/
|
|
128
|
+
|
|
129
|
+
declare class CodexAdapter extends BaseCodingAdapter {
|
|
130
|
+
readonly adapterType = "codex";
|
|
131
|
+
readonly displayName = "OpenAI Codex";
|
|
132
|
+
readonly installation: InstallationInfo;
|
|
133
|
+
/**
|
|
134
|
+
* Auto-response rules for OpenAI Codex CLI.
|
|
135
|
+
*/
|
|
136
|
+
readonly autoResponseRules: AutoResponseRule[];
|
|
137
|
+
getCommand(): string;
|
|
138
|
+
getArgs(config: SpawnConfig): string[];
|
|
139
|
+
getEnv(config: SpawnConfig): Record<string, string>;
|
|
140
|
+
detectLogin(output: string): LoginDetection;
|
|
141
|
+
/**
|
|
142
|
+
* Detect blocking prompts specific to OpenAI Codex CLI
|
|
143
|
+
*/
|
|
144
|
+
detectBlockingPrompt(output: string): BlockingPromptDetection;
|
|
145
|
+
detectReady(output: string): boolean;
|
|
146
|
+
parseOutput(output: string): ParsedOutput | null;
|
|
147
|
+
getPromptPattern(): RegExp;
|
|
148
|
+
getHealthCheckCommand(): string;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Aider CLI Adapter
|
|
153
|
+
*
|
|
154
|
+
* Adapter for the Aider AI pair programming tool.
|
|
155
|
+
* https://github.com/paul-gauthier/aider
|
|
156
|
+
*/
|
|
157
|
+
|
|
158
|
+
declare class AiderAdapter extends BaseCodingAdapter {
|
|
159
|
+
readonly adapterType = "aider";
|
|
160
|
+
readonly displayName = "Aider";
|
|
161
|
+
readonly installation: InstallationInfo;
|
|
162
|
+
/**
|
|
163
|
+
* Auto-response rules for Aider CLI.
|
|
164
|
+
*/
|
|
165
|
+
readonly autoResponseRules: AutoResponseRule[];
|
|
166
|
+
getCommand(): string;
|
|
167
|
+
getArgs(config: SpawnConfig): string[];
|
|
168
|
+
getEnv(config: SpawnConfig): Record<string, string>;
|
|
169
|
+
detectLogin(output: string): LoginDetection;
|
|
170
|
+
detectBlockingPrompt(output: string): BlockingPromptDetection;
|
|
171
|
+
detectReady(output: string): boolean;
|
|
172
|
+
parseOutput(output: string): ParsedOutput | null;
|
|
173
|
+
getPromptPattern(): RegExp;
|
|
174
|
+
getHealthCheckCommand(): string;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* coding-agent-adapters
|
|
179
|
+
*
|
|
180
|
+
* CLI adapters for AI coding agents.
|
|
181
|
+
* Works with pty-manager to spawn and manage coding agents.
|
|
182
|
+
*
|
|
183
|
+
* @example
|
|
184
|
+
* ```typescript
|
|
185
|
+
* import { PTYManager, AdapterRegistry } from 'pty-manager';
|
|
186
|
+
* import { ClaudeAdapter, GeminiAdapter } from 'coding-agent-adapters';
|
|
187
|
+
*
|
|
188
|
+
* const registry = new AdapterRegistry();
|
|
189
|
+
* registry.register(new ClaudeAdapter());
|
|
190
|
+
* registry.register(new GeminiAdapter());
|
|
191
|
+
*
|
|
192
|
+
* const manager = new PTYManager({ adapters: registry });
|
|
193
|
+
*
|
|
194
|
+
* const session = await manager.spawn({
|
|
195
|
+
* name: 'my-agent',
|
|
196
|
+
* type: 'claude',
|
|
197
|
+
* workdir: '/path/to/project',
|
|
198
|
+
* adapterConfig: {
|
|
199
|
+
* anthropicKey: process.env.ANTHROPIC_API_KEY,
|
|
200
|
+
* },
|
|
201
|
+
* });
|
|
202
|
+
* ```
|
|
203
|
+
*/
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* Create instances of all available adapters
|
|
207
|
+
*/
|
|
208
|
+
declare function createAllAdapters(): (ClaudeAdapter | GeminiAdapter | CodexAdapter | AiderAdapter)[];
|
|
209
|
+
/**
|
|
210
|
+
* Adapter type to class mapping
|
|
211
|
+
*/
|
|
212
|
+
declare const ADAPTER_TYPES: {
|
|
213
|
+
readonly claude: typeof ClaudeAdapter;
|
|
214
|
+
readonly gemini: typeof GeminiAdapter;
|
|
215
|
+
readonly codex: typeof CodexAdapter;
|
|
216
|
+
readonly aider: typeof AiderAdapter;
|
|
217
|
+
};
|
|
218
|
+
type AdapterType = keyof typeof ADAPTER_TYPES;
|
|
219
|
+
/**
|
|
220
|
+
* Create a specific adapter by type
|
|
221
|
+
*/
|
|
222
|
+
declare function createAdapter(type: AdapterType): ClaudeAdapter | GeminiAdapter | CodexAdapter | AiderAdapter;
|
|
223
|
+
/**
|
|
224
|
+
* Result of checking if a CLI is installed
|
|
225
|
+
*/
|
|
226
|
+
interface PreflightResult {
|
|
227
|
+
adapter: string;
|
|
228
|
+
installed: boolean;
|
|
229
|
+
version?: string;
|
|
230
|
+
error?: string;
|
|
231
|
+
installCommand: string;
|
|
232
|
+
docsUrl: string;
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* Check if specific adapters are installed
|
|
236
|
+
*
|
|
237
|
+
* @example
|
|
238
|
+
* ```typescript
|
|
239
|
+
* const results = await checkAdapters(['claude', 'aider']);
|
|
240
|
+
* for (const result of results) {
|
|
241
|
+
* if (!result.installed) {
|
|
242
|
+
* console.log(`${result.adapter} not found. Install: ${result.installCommand}`);
|
|
243
|
+
* }
|
|
244
|
+
* }
|
|
245
|
+
* ```
|
|
246
|
+
*/
|
|
247
|
+
declare function checkAdapters(types: AdapterType[]): Promise<PreflightResult[]>;
|
|
248
|
+
/**
|
|
249
|
+
* Check all available adapters
|
|
250
|
+
*
|
|
251
|
+
* @example
|
|
252
|
+
* ```typescript
|
|
253
|
+
* const results = await checkAllAdapters();
|
|
254
|
+
* const missing = results.filter(r => !r.installed);
|
|
255
|
+
*
|
|
256
|
+
* if (missing.length > 0) {
|
|
257
|
+
* console.log('Missing CLI tools:');
|
|
258
|
+
* for (const m of missing) {
|
|
259
|
+
* console.log(` ${m.adapter}: ${m.installCommand}`);
|
|
260
|
+
* }
|
|
261
|
+
* }
|
|
262
|
+
* ```
|
|
263
|
+
*/
|
|
264
|
+
declare function checkAllAdapters(): Promise<PreflightResult[]>;
|
|
265
|
+
/**
|
|
266
|
+
* Print installation instructions for missing adapters
|
|
267
|
+
*/
|
|
268
|
+
declare function printMissingAdapters(types?: AdapterType[]): Promise<void>;
|
|
269
|
+
|
|
270
|
+
export { ADAPTER_TYPES, type AdapterType, type AgentCredentials, AiderAdapter, BaseCodingAdapter, ClaudeAdapter, CodexAdapter, type CodingAgentConfig, GeminiAdapter, type InstallationInfo, type PreflightResult, checkAdapters, checkAllAdapters, createAdapter, createAllAdapters, printMissingAdapters };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
import { BaseCLIAdapter, SpawnConfig, AutoResponseRule, LoginDetection, BlockingPromptDetection, ParsedOutput } from 'pty-manager';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Base Coding Agent Adapter
|
|
5
|
+
*
|
|
6
|
+
* Extends pty-manager's BaseCLIAdapter with credential handling
|
|
7
|
+
* for AI coding agents.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Credentials that can be passed via SpawnConfig.adapterConfig
|
|
12
|
+
*/
|
|
13
|
+
interface AgentCredentials {
|
|
14
|
+
anthropicKey?: string;
|
|
15
|
+
openaiKey?: string;
|
|
16
|
+
googleKey?: string;
|
|
17
|
+
githubToken?: string;
|
|
18
|
+
custom?: Record<string, string>;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Installation information for a CLI tool
|
|
22
|
+
*/
|
|
23
|
+
interface InstallationInfo {
|
|
24
|
+
/** Command to install the CLI (e.g., "npm install -g @anthropic-ai/claude-code") */
|
|
25
|
+
command: string;
|
|
26
|
+
/** Alternative installation methods */
|
|
27
|
+
alternatives?: string[];
|
|
28
|
+
/** URL to installation docs */
|
|
29
|
+
docsUrl: string;
|
|
30
|
+
/** Minimum required version (if known) */
|
|
31
|
+
minVersion?: string;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Extended config with credentials support
|
|
35
|
+
*/
|
|
36
|
+
interface CodingAgentConfig extends SpawnConfig {
|
|
37
|
+
adapterConfig?: AgentCredentials & Record<string, unknown>;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Base class for AI coding agent adapters
|
|
41
|
+
*/
|
|
42
|
+
declare abstract class BaseCodingAdapter extends BaseCLIAdapter {
|
|
43
|
+
/**
|
|
44
|
+
* Installation information for this CLI tool
|
|
45
|
+
*/
|
|
46
|
+
abstract readonly installation: InstallationInfo;
|
|
47
|
+
/**
|
|
48
|
+
* Get credentials from config
|
|
49
|
+
*/
|
|
50
|
+
protected getCredentials(config: SpawnConfig): AgentCredentials;
|
|
51
|
+
/**
|
|
52
|
+
* Override detectExit to include installation instructions
|
|
53
|
+
*/
|
|
54
|
+
detectExit(output: string): {
|
|
55
|
+
exited: boolean;
|
|
56
|
+
code?: number;
|
|
57
|
+
error?: string;
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* Get formatted installation instructions
|
|
61
|
+
*/
|
|
62
|
+
getInstallInstructions(): string;
|
|
63
|
+
/**
|
|
64
|
+
* Check if response appears complete based on common patterns
|
|
65
|
+
*/
|
|
66
|
+
protected isResponseComplete(output: string): boolean;
|
|
67
|
+
/**
|
|
68
|
+
* Extract the main content from CLI output, removing common artifacts
|
|
69
|
+
*/
|
|
70
|
+
protected extractContent(output: string, promptPattern: RegExp): string;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Claude Code CLI Adapter
|
|
75
|
+
*
|
|
76
|
+
* Adapter for the Claude Code CLI (claude command).
|
|
77
|
+
*/
|
|
78
|
+
|
|
79
|
+
declare class ClaudeAdapter extends BaseCodingAdapter {
|
|
80
|
+
readonly adapterType = "claude";
|
|
81
|
+
readonly displayName = "Claude Code";
|
|
82
|
+
readonly installation: InstallationInfo;
|
|
83
|
+
/**
|
|
84
|
+
* Auto-response rules for Claude Code CLI.
|
|
85
|
+
* These handle common prompts that can be safely auto-responded.
|
|
86
|
+
*/
|
|
87
|
+
readonly autoResponseRules: AutoResponseRule[];
|
|
88
|
+
getCommand(): string;
|
|
89
|
+
getArgs(config: SpawnConfig): string[];
|
|
90
|
+
getEnv(config: SpawnConfig): Record<string, string>;
|
|
91
|
+
detectLogin(output: string): LoginDetection;
|
|
92
|
+
/**
|
|
93
|
+
* Detect blocking prompts specific to Claude Code CLI
|
|
94
|
+
*/
|
|
95
|
+
detectBlockingPrompt(output: string): BlockingPromptDetection;
|
|
96
|
+
detectReady(output: string): boolean;
|
|
97
|
+
parseOutput(output: string): ParsedOutput | null;
|
|
98
|
+
getPromptPattern(): RegExp;
|
|
99
|
+
getHealthCheckCommand(): string;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Google Gemini CLI Adapter
|
|
104
|
+
*
|
|
105
|
+
* Adapter for the Google Gemini CLI tool.
|
|
106
|
+
*/
|
|
107
|
+
|
|
108
|
+
declare class GeminiAdapter extends BaseCodingAdapter {
|
|
109
|
+
readonly adapterType = "gemini";
|
|
110
|
+
readonly displayName = "Google Gemini";
|
|
111
|
+
readonly installation: InstallationInfo;
|
|
112
|
+
getCommand(): string;
|
|
113
|
+
getArgs(config: SpawnConfig): string[];
|
|
114
|
+
getEnv(config: SpawnConfig): Record<string, string>;
|
|
115
|
+
detectLogin(output: string): LoginDetection;
|
|
116
|
+
detectBlockingPrompt(output: string): BlockingPromptDetection;
|
|
117
|
+
detectReady(output: string): boolean;
|
|
118
|
+
parseOutput(output: string): ParsedOutput | null;
|
|
119
|
+
getPromptPattern(): RegExp;
|
|
120
|
+
getHealthCheckCommand(): string;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* OpenAI Codex CLI Adapter
|
|
125
|
+
*
|
|
126
|
+
* Adapter for the OpenAI Codex CLI tool.
|
|
127
|
+
*/
|
|
128
|
+
|
|
129
|
+
declare class CodexAdapter extends BaseCodingAdapter {
|
|
130
|
+
readonly adapterType = "codex";
|
|
131
|
+
readonly displayName = "OpenAI Codex";
|
|
132
|
+
readonly installation: InstallationInfo;
|
|
133
|
+
/**
|
|
134
|
+
* Auto-response rules for OpenAI Codex CLI.
|
|
135
|
+
*/
|
|
136
|
+
readonly autoResponseRules: AutoResponseRule[];
|
|
137
|
+
getCommand(): string;
|
|
138
|
+
getArgs(config: SpawnConfig): string[];
|
|
139
|
+
getEnv(config: SpawnConfig): Record<string, string>;
|
|
140
|
+
detectLogin(output: string): LoginDetection;
|
|
141
|
+
/**
|
|
142
|
+
* Detect blocking prompts specific to OpenAI Codex CLI
|
|
143
|
+
*/
|
|
144
|
+
detectBlockingPrompt(output: string): BlockingPromptDetection;
|
|
145
|
+
detectReady(output: string): boolean;
|
|
146
|
+
parseOutput(output: string): ParsedOutput | null;
|
|
147
|
+
getPromptPattern(): RegExp;
|
|
148
|
+
getHealthCheckCommand(): string;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Aider CLI Adapter
|
|
153
|
+
*
|
|
154
|
+
* Adapter for the Aider AI pair programming tool.
|
|
155
|
+
* https://github.com/paul-gauthier/aider
|
|
156
|
+
*/
|
|
157
|
+
|
|
158
|
+
declare class AiderAdapter extends BaseCodingAdapter {
|
|
159
|
+
readonly adapterType = "aider";
|
|
160
|
+
readonly displayName = "Aider";
|
|
161
|
+
readonly installation: InstallationInfo;
|
|
162
|
+
/**
|
|
163
|
+
* Auto-response rules for Aider CLI.
|
|
164
|
+
*/
|
|
165
|
+
readonly autoResponseRules: AutoResponseRule[];
|
|
166
|
+
getCommand(): string;
|
|
167
|
+
getArgs(config: SpawnConfig): string[];
|
|
168
|
+
getEnv(config: SpawnConfig): Record<string, string>;
|
|
169
|
+
detectLogin(output: string): LoginDetection;
|
|
170
|
+
detectBlockingPrompt(output: string): BlockingPromptDetection;
|
|
171
|
+
detectReady(output: string): boolean;
|
|
172
|
+
parseOutput(output: string): ParsedOutput | null;
|
|
173
|
+
getPromptPattern(): RegExp;
|
|
174
|
+
getHealthCheckCommand(): string;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* coding-agent-adapters
|
|
179
|
+
*
|
|
180
|
+
* CLI adapters for AI coding agents.
|
|
181
|
+
* Works with pty-manager to spawn and manage coding agents.
|
|
182
|
+
*
|
|
183
|
+
* @example
|
|
184
|
+
* ```typescript
|
|
185
|
+
* import { PTYManager, AdapterRegistry } from 'pty-manager';
|
|
186
|
+
* import { ClaudeAdapter, GeminiAdapter } from 'coding-agent-adapters';
|
|
187
|
+
*
|
|
188
|
+
* const registry = new AdapterRegistry();
|
|
189
|
+
* registry.register(new ClaudeAdapter());
|
|
190
|
+
* registry.register(new GeminiAdapter());
|
|
191
|
+
*
|
|
192
|
+
* const manager = new PTYManager({ adapters: registry });
|
|
193
|
+
*
|
|
194
|
+
* const session = await manager.spawn({
|
|
195
|
+
* name: 'my-agent',
|
|
196
|
+
* type: 'claude',
|
|
197
|
+
* workdir: '/path/to/project',
|
|
198
|
+
* adapterConfig: {
|
|
199
|
+
* anthropicKey: process.env.ANTHROPIC_API_KEY,
|
|
200
|
+
* },
|
|
201
|
+
* });
|
|
202
|
+
* ```
|
|
203
|
+
*/
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* Create instances of all available adapters
|
|
207
|
+
*/
|
|
208
|
+
declare function createAllAdapters(): (ClaudeAdapter | GeminiAdapter | CodexAdapter | AiderAdapter)[];
|
|
209
|
+
/**
|
|
210
|
+
* Adapter type to class mapping
|
|
211
|
+
*/
|
|
212
|
+
declare const ADAPTER_TYPES: {
|
|
213
|
+
readonly claude: typeof ClaudeAdapter;
|
|
214
|
+
readonly gemini: typeof GeminiAdapter;
|
|
215
|
+
readonly codex: typeof CodexAdapter;
|
|
216
|
+
readonly aider: typeof AiderAdapter;
|
|
217
|
+
};
|
|
218
|
+
type AdapterType = keyof typeof ADAPTER_TYPES;
|
|
219
|
+
/**
|
|
220
|
+
* Create a specific adapter by type
|
|
221
|
+
*/
|
|
222
|
+
declare function createAdapter(type: AdapterType): ClaudeAdapter | GeminiAdapter | CodexAdapter | AiderAdapter;
|
|
223
|
+
/**
|
|
224
|
+
* Result of checking if a CLI is installed
|
|
225
|
+
*/
|
|
226
|
+
interface PreflightResult {
|
|
227
|
+
adapter: string;
|
|
228
|
+
installed: boolean;
|
|
229
|
+
version?: string;
|
|
230
|
+
error?: string;
|
|
231
|
+
installCommand: string;
|
|
232
|
+
docsUrl: string;
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* Check if specific adapters are installed
|
|
236
|
+
*
|
|
237
|
+
* @example
|
|
238
|
+
* ```typescript
|
|
239
|
+
* const results = await checkAdapters(['claude', 'aider']);
|
|
240
|
+
* for (const result of results) {
|
|
241
|
+
* if (!result.installed) {
|
|
242
|
+
* console.log(`${result.adapter} not found. Install: ${result.installCommand}`);
|
|
243
|
+
* }
|
|
244
|
+
* }
|
|
245
|
+
* ```
|
|
246
|
+
*/
|
|
247
|
+
declare function checkAdapters(types: AdapterType[]): Promise<PreflightResult[]>;
|
|
248
|
+
/**
|
|
249
|
+
* Check all available adapters
|
|
250
|
+
*
|
|
251
|
+
* @example
|
|
252
|
+
* ```typescript
|
|
253
|
+
* const results = await checkAllAdapters();
|
|
254
|
+
* const missing = results.filter(r => !r.installed);
|
|
255
|
+
*
|
|
256
|
+
* if (missing.length > 0) {
|
|
257
|
+
* console.log('Missing CLI tools:');
|
|
258
|
+
* for (const m of missing) {
|
|
259
|
+
* console.log(` ${m.adapter}: ${m.installCommand}`);
|
|
260
|
+
* }
|
|
261
|
+
* }
|
|
262
|
+
* ```
|
|
263
|
+
*/
|
|
264
|
+
declare function checkAllAdapters(): Promise<PreflightResult[]>;
|
|
265
|
+
/**
|
|
266
|
+
* Print installation instructions for missing adapters
|
|
267
|
+
*/
|
|
268
|
+
declare function printMissingAdapters(types?: AdapterType[]): Promise<void>;
|
|
269
|
+
|
|
270
|
+
export { ADAPTER_TYPES, type AdapterType, type AgentCredentials, AiderAdapter, BaseCodingAdapter, ClaudeAdapter, CodexAdapter, type CodingAgentConfig, GeminiAdapter, type InstallationInfo, type PreflightResult, checkAdapters, checkAllAdapters, createAdapter, createAllAdapters, printMissingAdapters };
|