Class: KairosMcp::ActionLog
- Inherits:
-
Object
- Object
- KairosMcp::ActionLog
- Defined in:
- lib/kairos_mcp/action_log.rb
Overview
ActionLog: Records actions for audit trail
This class has been refactored to use the Storage backend abstraction. By default, it uses FileBackend (file-based storage). When SQLite is enabled, it uses SqliteBackend.
Class Method Summary collapse
-
.clear! ⇒ Boolean
Clear all action logs.
-
.history(limit: 50) ⇒ Array<Hash>
Get action history.
-
.record(action:, skill_id: nil, details: nil) ⇒ Boolean
Record an action to the log.
-
.reset_backend! ⇒ Object
Reset the storage backend (useful for testing).
-
.storage_backend=(backend) ⇒ Object
Set a custom storage backend (useful for testing or dependency injection).
-
.storage_type ⇒ Symbol
Get the storage backend type.
Class Method Details
.clear! ⇒ Boolean
Clear all action logs
45 46 47 |
# File 'lib/kairos_mcp/action_log.rb', line 45 def clear! storage_backend.clear_action_log! end |
.history(limit: 50) ⇒ Array<Hash>
Get action history
38 39 40 |
# File 'lib/kairos_mcp/action_log.rb', line 38 def history(limit: 50) storage_backend.action_history(limit: limit) end |
.record(action:, skill_id: nil, details: nil) ⇒ Boolean
Record an action to the log
23 24 25 26 27 28 29 30 31 32 |
# File 'lib/kairos_mcp/action_log.rb', line 23 def record(action:, skill_id: nil, details: nil) entry = { timestamp: Time.now.iso8601, action: action, skill_id: skill_id, details: details } storage_backend.record_action(entry) end |
.reset_backend! ⇒ Object
Reset the storage backend (useful for testing)
56 57 58 |
# File 'lib/kairos_mcp/action_log.rb', line 56 def reset_backend! @storage_backend = nil end |
.storage_backend=(backend) ⇒ Object
Set a custom storage backend (useful for testing or dependency injection)
62 63 64 |
# File 'lib/kairos_mcp/action_log.rb', line 62 def storage_backend=(backend) @storage_backend = backend end |
.storage_type ⇒ Symbol
Get the storage backend type
51 52 53 |
# File 'lib/kairos_mcp/action_log.rb', line 51 def storage_type storage_backend.backend_type end |