Class: Kodo::Daemon
- Inherits:
-
Object
- Object
- Kodo::Daemon
- Defined in:
- lib/kodo/daemon.rb
Instance Attribute Summary collapse
-
#channels ⇒ Object
readonly
Returns the value of attribute channels.
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#heartbeat ⇒ Object
readonly
Returns the value of attribute heartbeat.
-
#router ⇒ Object
readonly
Returns the value of attribute router.
Instance Method Summary collapse
-
#initialize(config: nil, heartbeat_interval: nil) ⇒ Daemon
constructor
A new instance of Daemon.
- #start! ⇒ Object
- #stop! ⇒ Object
Constructor Details
#initialize(config: nil, heartbeat_interval: nil) ⇒ Daemon
Returns a new instance of Daemon.
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/kodo/daemon.rb', line 7 def initialize(config: nil, heartbeat_interval: nil) @config = config || Kodo.config @heartbeat_interval = heartbeat_interval || @config.heartbeat_interval passphrase = resolve_passphrase @memory = Memory::Store.new(passphrase: passphrase) @audit = Memory::Audit.new @knowledge = Memory::Knowledge.new(passphrase: passphrase) @reminders = Memory::Reminders.new(passphrase: passphrase) @prompt_assembler = PromptAssembler.new @search_provider = resolve_search_provider @broker = build_broker @router = Router.new( memory: @memory, audit: @audit, prompt_assembler: @prompt_assembler, knowledge: @knowledge, reminders: @reminders, search_provider: @search_provider, broker: @broker, on_secret_stored: method(:on_secret_stored) ) @channels = [] end |
Instance Attribute Details
#channels ⇒ Object (readonly)
Returns the value of attribute channels.
5 6 7 |
# File 'lib/kodo/daemon.rb', line 5 def channels @channels end |
#config ⇒ Object (readonly)
Returns the value of attribute config.
5 6 7 |
# File 'lib/kodo/daemon.rb', line 5 def config @config end |
#heartbeat ⇒ Object (readonly)
Returns the value of attribute heartbeat.
5 6 7 |
# File 'lib/kodo/daemon.rb', line 5 def heartbeat @heartbeat end |
#router ⇒ Object (readonly)
Returns the value of attribute router.
5 6 7 |
# File 'lib/kodo/daemon.rb', line 5 def router @router end |
Instance Method Details
#start! ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/kodo/daemon.rb', line 32 def start! Kodo.logger.info("Kodo v#{VERSION} starting...") Kodo.logger.info(" Home: #{Kodo.home_dir}") Config.ensure_home_dir! @prompt_assembler.ensure_default_files! configure_llm! connect_channels! # Log which prompt files were found %w[persona.md user.md pulse.md origin.md].each do |f| path = File.join(Kodo.home_dir, f) status = File.exist?(path) ? '+' : ' ' Kodo.logger.info(" #{status} #{f}") end Kodo.logger.info(' Memory encryption: enabled') if @config.memory_encryption? Kodo.logger.info(" Search: #{@config.search_provider}") if @search_provider Kodo.logger.info(" Knowledge facts: #{@knowledge.count}") Kodo.logger.info(" Active reminders: #{@reminders.active_count}") start_heartbeat! end |