Class: Aidp::Providers::Anthropic
- Includes:
- DebugMixin
- Defined in:
- lib/aidp/providers/anthropic.rb
Constant Summary
Constants included from DebugMixin
DebugMixin::DEBUG_BASIC, DebugMixin::DEBUG_OFF, DebugMixin::DEBUG_VERBOSE
Constants inherited from Base
Base::ACTIVITY_STATES, Base::DEFAULT_STUCK_TIMEOUT
Instance Attribute Summary
Attributes inherited from Base
#activity_state, #last_activity_time, #start_time, #step_name, #stuck_timeout
Class Method Summary collapse
Instance Method Summary collapse
Methods included from DebugMixin
#debug_basic?, #debug_command, #debug_enabled?, #debug_error, #debug_execute_command, #debug_level, #debug_log, #debug_logger, #debug_provider, #debug_step, #debug_timing, #debug_verbose?, included, shared_logger
Methods inherited from Base
#activity_summary, #execution_time, #harness_config, #harness_health_status, #harness_healthy?, #harness_metrics, #harness_mode?, #initialize, #mark_completed, #mark_failed, #record_activity, #record_harness_request, #send_with_harness, #set_harness_context, #set_job_context, #setup_activity_monitoring, #stuck?, #supports_activity_monitoring?, #time_since_last_activity, #update_activity_state
Constructor Details
This class inherits a constructor from Aidp::Providers::Base
Class Method Details
Instance Method Details
#available? ⇒ Boolean
19 20 21 |
# File 'lib/aidp/providers/anthropic.rb', line 19 def available? self.class.available? end |
#name ⇒ Object
15 16 17 |
# File 'lib/aidp/providers/anthropic.rb', line 15 def name "anthropic" end |
#send(prompt:, session: nil) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/aidp/providers/anthropic.rb', line 23 def send(prompt:, session: nil) raise "claude CLI not available" unless self.class.available? # Smart timeout calculation timeout_seconds = calculate_timeout debug_provider("claude", "Starting execution", {timeout: timeout_seconds}) debug_log("📝 Sending prompt to claude...", level: :info) begin # Use debug_execute_command for better debugging result = debug_execute_command("claude", args: ["--print"], input: prompt, timeout: timeout_seconds) # Log the results debug_command("claude", args: ["--print"], input: prompt, output: result.out, error: result.err, exit_code: result.exit_status) if result.exit_status == 0 result.out else debug_error(StandardError.new("claude failed"), {exit_code: result.exit_status, stderr: result.err}) raise "claude failed with exit code #{result.exit_status}: #{result.err}" end rescue => e debug_error(e, {provider: "claude", prompt_length: prompt.length}) raise end end |