Class: Aidp::Harness::State::UIState

Inherits:
Object
  • Object
show all
Defined in:
lib/aidp/harness/state/ui_state.rb

Overview

Manages UI-specific state and user interactions

Instance Method Summary collapse

Constructor Details

#initialize(persistence) ⇒ UIState

Returns a new instance of UIState.



8
9
10
# File 'lib/aidp/harness/state/ui_state.rb', line 8

def initialize(persistence)
  @persistence = persistence
end

Instance Method Details

#add_user_input(key, value) ⇒ Object



16
17
18
19
20
# File 'lib/aidp/harness/state/ui_state.rb', line 16

def add_user_input(key, value)
  current_input = user_input
  current_input[key] = value
  update_state(user_input: current_input)
end

#current_stepObject



22
23
24
# File 'lib/aidp/harness/state/ui_state.rb', line 22

def current_step
  state[:current_step]
end

#set_current_step(step_name) ⇒ Object



26
27
28
# File 'lib/aidp/harness/state/ui_state.rb', line 26

def set_current_step(step_name)
  update_state(current_step: step_name)
end

#state_metadataObject



30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/aidp/harness/state/ui_state.rb', line 30

def 
  return {} unless @persistence.has_state?

  state_data = state
  {
    mode: state_data[:mode],
    saved_at: state_data[:saved_at],
    current_step: state_data[:current_step],
    state: state_data[:state],
    last_updated: state_data[:last_updated]
  }
end

#user_inputObject



12
13
14
# File 'lib/aidp/harness/state/ui_state.rb', line 12

def user_input
  state[:user_input] || {}
end