Class: Aidp::OrchestrationAdapter
- Inherits:
-
Object
- Object
- Aidp::OrchestrationAdapter
- Includes:
- MessageDisplay
- Defined in:
- lib/aidp/orchestration_adapter.rb
Overview
Adapter for orchestration execution Routes to Temporal-based or legacy orchestration based on configuration
When Temporal is enabled:
- Workflows execute through Temporal for durability and observability
- Activities wrap existing AIDP functionality
- State is persisted in Temporal's history
When Temporal is disabled (legacy mode):
- Falls back to existing AsyncWorkLoopRunner and BackgroundRunner
- State is tracked in file-based storage
Migration strategy:
- Enable Temporal in aidp.yml
- Start Temporal worker:
aidp temporal worker - Use
aidp temporal startfor new workflows - Existing jobs continue until complete
Constant Summary
Constants included from MessageDisplay
MessageDisplay::COLOR_MAP, MessageDisplay::CRITICAL_TYPES
Instance Method Summary collapse
-
#cancel_workflow(workflow_id) ⇒ Object
Cancel a workflow.
-
#initialize(project_dir: Dir.pwd) ⇒ OrchestrationAdapter
constructor
A new instance of OrchestrationAdapter.
-
#list_workflows ⇒ Object
List active workflows.
-
#start_issue_workflow(issue_number, options = {}) ⇒ Object
Start an issue-to-PR workflow Routes to Temporal or legacy based on configuration.
-
#start_work_loop(step_name, step_spec, context = {}, options = {}) ⇒ Object
Start a work loop Routes to Temporal or legacy based on configuration.
-
#temporal_enabled? ⇒ Boolean
Check if Temporal orchestration is enabled.
-
#workflow_status(workflow_id) ⇒ Object
Get workflow status.
Methods included from MessageDisplay
#display_message, included, #message_display_prompt, #quiet_mode?
Constructor Details
#initialize(project_dir: Dir.pwd) ⇒ OrchestrationAdapter
Returns a new instance of OrchestrationAdapter.
24 25 26 |
# File 'lib/aidp/orchestration_adapter.rb', line 24 def initialize(project_dir: Dir.pwd) @project_dir = project_dir end |
Instance Method Details
#cancel_workflow(workflow_id) ⇒ Object
Cancel a workflow
72 73 74 75 76 77 78 |
# File 'lib/aidp/orchestration_adapter.rb', line 72 def cancel_workflow(workflow_id) if temporal_enabled? cancel_temporal_workflow(workflow_id) else cancel_legacy_job(workflow_id) end end |
#list_workflows ⇒ Object
List active workflows
81 82 83 84 85 86 87 |
# File 'lib/aidp/orchestration_adapter.rb', line 81 def list_workflows if temporal_enabled? list_temporal_workflows else list_legacy_jobs end end |
#start_issue_workflow(issue_number, options = {}) ⇒ Object
Start an issue-to-PR workflow Routes to Temporal or legacy based on configuration
44 45 46 47 48 49 50 |
# File 'lib/aidp/orchestration_adapter.rb', line 44 def start_issue_workflow(issue_number, = {}) if temporal_enabled? start_temporal_issue_workflow(issue_number, ) else start_legacy_issue_workflow(issue_number, ) end end |
#start_work_loop(step_name, step_spec, context = {}, options = {}) ⇒ Object
Start a work loop Routes to Temporal or legacy based on configuration
54 55 56 57 58 59 60 |
# File 'lib/aidp/orchestration_adapter.rb', line 54 def start_work_loop(step_name, step_spec, context = {}, = {}) if temporal_enabled? start_temporal_work_loop(step_name, step_spec, context, ) else start_legacy_work_loop(step_name, step_spec, context, ) end end |
#temporal_enabled? ⇒ Boolean
Check if Temporal orchestration is enabled
29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/aidp/orchestration_adapter.rb', line 29 def temporal_enabled? return @temporal_enabled if defined?(@temporal_enabled) begin require_relative "temporal" @temporal_enabled = Aidp::Temporal.enabled?(@project_dir) rescue LoadError @temporal_enabled = false end @temporal_enabled end |
#workflow_status(workflow_id) ⇒ Object
Get workflow status
63 64 65 66 67 68 69 |
# File 'lib/aidp/orchestration_adapter.rb', line 63 def workflow_status(workflow_id) if temporal_enabled? temporal_workflow_status(workflow_id) else legacy_job_status(workflow_id) end end |