Class: Aidp::Temporal::Activities::ExecuteCliCommandActivity

Inherits:
BaseActivity
  • Object
show all
Defined in:
lib/aidp/temporal/activities/execute_cli_command_activity.rb

Instance Method Summary collapse

Methods inherited from BaseActivity

#activity_context, #cancellation_requested?, #check_cancellation!, #heartbeat

Instance Method Details

#execute(input) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/aidp/temporal/activities/execute_cli_command_activity.rb', line 10

def execute(input)
  with_activity_context do
    project_dir = input[:project_dir]
    command = input[:command]
    role = input[:role]
    request = input[:request] || {}

    runner = Aidp::StrategyExecution::CliProtocol::Runner.new(project_dir: project_dir)

    # The CLI invocation blocks for the full duration of the external
    # agent/evaluator (often minutes). Heartbeat on a background thread so
    # Temporal does not mark the activity timed out and retry the
    # side-effecting command while the original subprocess is still running.
    heartbeat_thread = start_heartbeat_thread(role: role)
    begin
      runner.execute(command: command, role: role, request: request)
    ensure
      heartbeat_thread&.kill
    end
  end
end