Class: Aidp::Workflows::GuidedAgent

Inherits:
Object
  • Object
show all
Includes:
DebugMixin, MessageDisplay
Defined in:
lib/aidp/workflows/guided_agent.rb

Overview

Guided workflow agent that uses AI to help users select appropriate workflows Acts as a copilot to match user intent to AIDP capabilities

Defined Under Namespace

Classes: ConversationError

Constant Summary collapse

PLANNING_STYLES =
{
  "detailed" => {
    label: "Detailed",
    max_question_rounds: 30,
    autonomy: "low",
    question_strategy: "Ask 1-2 sharply scoped questions per round. Avoid assumptions unless the user confirms them."
  },
  "balanced" => {
    label: "Balanced",
    max_question_rounds: 10,
    autonomy: "medium",
    question_strategy: "Ask 1-3 efficient questions per round. Make reasonable decisions when the context is already clear."
  },
  "quick_sketch" => {
    label: "Quick Sketch",
    max_question_rounds: 3,
    autonomy: "high",
    question_strategy: "Ask only the highest-leverage missing questions. Prefer inferring obvious MVP details from repository context and existing configuration."
  }
}.freeze

Constants included from DebugMixin

DebugMixin::DEBUG_BASIC, DebugMixin::DEBUG_OFF, DebugMixin::DEBUG_VERBOSE

Constants included from MessageDisplay

MessageDisplay::COLOR_MAP, MessageDisplay::CRITICAL_TYPES

Instance Attribute 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 included from MessageDisplay

#display_message, included, #message_display_prompt, #quiet_mode?

Constructor Details

#initialize(project_dir, prompt: nil, use_enhanced_input: true, verbose: false, interaction_style: nil, config_manager: nil, provider_manager: nil) ⇒ GuidedAgent

Returns a new instance of GuidedAgent.



47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/aidp/workflows/guided_agent.rb', line 47

def initialize(project_dir, prompt: nil, use_enhanced_input: true, verbose: false, interaction_style: nil, config_manager: nil, provider_manager: nil)
  @project_dir = project_dir

  # Use EnhancedInput with Reline for full readline-style key bindings
  @prompt = if use_enhanced_input && prompt.nil?
    Aidp::CLI::EnhancedInput.new
  else
    prompt || TTY::Prompt.new
  end

  @config_manager = config_manager || Aidp::Harness::ConfigManager.new(project_dir)
  @provider_manager = provider_manager || Aidp::Harness::ProviderManager.new(@config_manager, prompt: @prompt)
  @conversation_history = []
  @user_input = {}
  @verbose = verbose
  @debug_env = debug_level >= Aidp::DebugMixin::DEBUG_BASIC
  @planning_preferences = resolve_planning_preferences(interaction_style)
end

Instance Attribute Details

#config_managerObject (readonly)

Expose for testability



44
45
46
# File 'lib/aidp/workflows/guided_agent.rb', line 44

def config_manager
  @config_manager
end

#conversation_historyObject (readonly)

Expose for testability



44
45
46
# File 'lib/aidp/workflows/guided_agent.rb', line 44

def conversation_history
  @conversation_history
end

#project_dirObject (readonly)

Expose for testability



44
45
46
# File 'lib/aidp/workflows/guided_agent.rb', line 44

def project_dir
  @project_dir
end

#provider_manager=(value) ⇒ Object (writeonly)

Sets the attribute provider_manager

Parameters:

  • value

    the value to set the attribute provider_manager to.



45
46
47
# File 'lib/aidp/workflows/guided_agent.rb', line 45

def provider_manager=(value)
  @provider_manager = value
end

#user_inputObject (readonly)

Expose for testability



44
45
46
# File 'lib/aidp/workflows/guided_agent.rb', line 44

def user_input
  @user_input
end

Instance Method Details

#select_workflowObject

Main entry point for guided workflow selection Uses plan-then-execute approach: iterative planning conversation to identify needed steps, then executes those steps



69
70
71
72
73
74
75
76
77
78
# File 'lib/aidp/workflows/guided_agent.rb', line 69

def select_workflow
  display_message("\n🤖 Welcome to AIDP Guided Workflow!", type: :highlight)
  display_message("I'll help you plan and execute your project.\n", type: :info)

  validate_provider_configuration!

  plan_and_execute_workflow
rescue => e
  raise ConversationError, "Failed to guide workflow selection: #{e.message}"
end