Class: ActiveAgent::Dashboard::RecordingAction
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- ActiveAgent::Dashboard::RecordingAction
- Defined in:
- lib/active_agent/dashboard/app/models/active_agent/dashboard/recording_action.rb
Overview
Represents a single browser action within a session recording.
Actions capture user and agent interactions like clicks, typing, navigation, and form submissions.
Constant Summary collapse
- ACTION_TYPES =
%w[ navigate click type scroll snapshot select hover drag file_upload dialog evaluate wait form_fill key_press focus submit handoff user_action completion ].freeze
Instance Method Summary collapse
-
#as_json_for_api ⇒ Object
Format for API response.
-
#browser_state ⇒ Object
Get browser state at this action (for handoff).
-
#dom_snapshot_content ⇒ Object
Get the DOM snapshot content.
-
#screenshot_url(expires_in: 15.minutes) ⇒ Object
Get the screenshot URL (signed URL from storage).
Methods inherited from ApplicationRecord
for_owner, owner_association, table_name
Instance Method Details
#as_json_for_api ⇒ Object
Format for API response
58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/active_agent/dashboard/app/models/active_agent/dashboard/recording_action.rb', line 58 def as_json_for_api { id: id, action_type: action_type, sequence: sequence, timestamp_ms: , selector: selector, value: redacted_value, screenshot_url: screenshot_url, has_dom_snapshot: dom_snapshot_key.present?, metadata: , created_at: created_at.iso8601 } end |
#browser_state ⇒ Object
Get browser state at this action (for handoff)
74 75 76 77 78 79 80 81 82 |
# File 'lib/active_agent/dashboard/app/models/active_agent/dashboard/recording_action.rb', line 74 def browser_state { url: extract_url, form_values: ["form_values"], scroll_position: ["scroll_position"], active_element: selector, action_type: action_type } end |
#dom_snapshot_content ⇒ Object
Get the DOM snapshot content
51 52 53 54 55 |
# File 'lib/active_agent/dashboard/app/models/active_agent/dashboard/recording_action.rb', line 51 def dom_snapshot_content return nil unless dom_snapshot_key.present? ActiveAgent::Dashboard.storage_service&.fetch_snapshot(dom_snapshot_key) end |
#screenshot_url(expires_in: 15.minutes) ⇒ Object
Get the screenshot URL (signed URL from storage)
44 45 46 47 48 |
# File 'lib/active_agent/dashboard/app/models/active_agent/dashboard/recording_action.rb', line 44 def screenshot_url(expires_in: 15.minutes) return nil unless screenshot_key.present? ActiveAgent::Dashboard.storage_service&.signed_url_for(screenshot_key, expires_in: expires_in) end |