Module: Aidp::Interfaces::ActivityMonitorInterface
- Included in:
- ActivityMonitor, NullActivityMonitor
- Defined in:
- lib/aidp/interfaces/activity_monitor_interface.rb
Overview
ActivityMonitorInterface defines the contract for activity monitoring implementations. Activity monitoring tracks the state of long-running provider operations, detecting stuck processes and enabling timeout/cancellation logic.
States:
- :idle - No operation in progress
- :working - Active and producing output
- :stuck - No activity detected for stuck_timeout seconds
- :completed - Operation finished successfully
- :failed - Operation failed with an error
Constant Summary collapse
- STATES =
Valid activity states
[:idle, :working, :stuck, :completed, :failed].freeze
Instance Method Summary collapse
-
#complete ⇒ void
Mark the operation as completed successfully.
-
#elapsed_time ⇒ Float
Get elapsed time since start.
-
#fail(error_message = nil) ⇒ void
Mark the operation as failed.
-
#record_activity(message = nil) ⇒ void
Record activity, resetting the stuck timer.
-
#start(step_name:, stuck_timeout:, on_state_change: nil) ⇒ void
Start monitoring an operation.
-
#state ⇒ Symbol
Get the current activity state.
-
#stuck? ⇒ Boolean
Check if the operation appears to be stuck.
-
#summary ⇒ Hash
Get a summary of the monitoring session.
Instance Method Details
#complete ⇒ void
This method returns an undefined value.
Mark the operation as completed successfully.
57 58 59 |
# File 'lib/aidp/interfaces/activity_monitor_interface.rb', line 57 def complete raise NotImplementedError, "#{self.class} must implement #complete" end |
#elapsed_time ⇒ Float
Get elapsed time since start.
86 87 88 |
# File 'lib/aidp/interfaces/activity_monitor_interface.rb', line 86 def elapsed_time raise NotImplementedError, "#{self.class} must implement #elapsed_time" end |
#fail(error_message = nil) ⇒ void
This method returns an undefined value.
Mark the operation as failed.
65 66 67 |
# File 'lib/aidp/interfaces/activity_monitor_interface.rb', line 65 def fail( = nil) raise NotImplementedError, "#{self.class} must implement #fail" end |
#record_activity(message = nil) ⇒ void
This method returns an undefined value.
Record activity, resetting the stuck timer.
50 51 52 |
# File 'lib/aidp/interfaces/activity_monitor_interface.rb', line 50 def record_activity( = nil) raise NotImplementedError, "#{self.class} must implement #record_activity" end |
#start(step_name:, stuck_timeout:, on_state_change: nil) ⇒ void
This method returns an undefined value.
Start monitoring an operation.
42 43 44 |
# File 'lib/aidp/interfaces/activity_monitor_interface.rb', line 42 def start(step_name:, stuck_timeout:, on_state_change: nil) raise NotImplementedError, "#{self.class} must implement #start" end |
#state ⇒ Symbol
Get the current activity state.
79 80 81 |
# File 'lib/aidp/interfaces/activity_monitor_interface.rb', line 79 def state raise NotImplementedError, "#{self.class} must implement #state" end |
#stuck? ⇒ Boolean
Check if the operation appears to be stuck.
72 73 74 |
# File 'lib/aidp/interfaces/activity_monitor_interface.rb', line 72 def stuck? raise NotImplementedError, "#{self.class} must implement #stuck?" end |
#summary ⇒ Hash
Get a summary of the monitoring session.
93 94 95 |
# File 'lib/aidp/interfaces/activity_monitor_interface.rb', line 93 def summary raise NotImplementedError, "#{self.class} must implement #summary" end |