Class: LittleGhost::Agent::Skills::CatalogTools
- Inherits:
-
Object
- Object
- LittleGhost::Agent::Skills::CatalogTools
- Defined in:
- lib/little_ghost/agent/skills.rb
Overview
:nodoc:
Class Method Summary collapse
Class Method Details
.tools(binding) ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/little_ghost/agent/skills.rb', line 31 def self.tools(binding) configuration = binding.agent.class.skills_configuration paths = configuration.fetch(:paths) if paths.is_a?(Proc) paths = paths.parameters.empty? ? binding.agent.instance_exec(&paths) : paths.call(binding.run) end paths ||= binding.run.runtime.skill_paths catalog = LittleGhost::Skills::Catalog.new( **configuration.merge( paths:, resource_root: binding.run&.runtime&.skill_resource_root, workspace: binding.workspace, sandbox: binding.sandbox ) ) return [] if catalog.names.empty? [catalog.tool.tap { |tool| tool.define_method(:catalog) { catalog } }] end |