smart_agent 0.1.5 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/smart_agent/mcp_client.rb +18 -2
- data/lib/smart_agent/result.rb +5 -1
- data/lib/smart_agent/tool.rb +13 -0
- data/lib/smart_agent/version.rb +1 -1
- metadata +3 -3
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: a9d530838f77891b2da4815a2161d64bc6b56764366009cc1748830280701c82
         | 
| 4 | 
            +
              data.tar.gz: '0738fd38b3b97eced4d41cf9120ebf4d2baa2f69cca2bf9587de1dc3b6d10388'
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: c3e0feea6bc1a320c288112ed517d099e261d2a496a93b422b2e944e9ef35f894910df80e5dfa20e57a648f5fc4de6b6f30e774afc7c6e83428ca5f14bf5c0a0
         | 
| 7 | 
            +
              data.tar.gz: 5b53a87c47b8bff04ae1178d59b67cba3baeee080d7284acfc4699986921504f37c03279002a1e471a0bff10aeffd842364271696e372fb02626580cefa7951a
         | 
| @@ -10,7 +10,11 @@ module SmartAgent | |
| 10 10 | 
             
                  @context = MCPContext.new
         | 
| 11 11 | 
             
                  @context.instance_eval(&@code)
         | 
| 12 12 | 
             
                  command_path = @context.command_path
         | 
| 13 | 
            -
                   | 
| 13 | 
            +
                  if @context.mcp_type == :stdio
         | 
| 14 | 
            +
                    client = MCP::StdioClient.new(command_path)
         | 
| 15 | 
            +
                  else
         | 
| 16 | 
            +
                    client = MCP::SSEClient.new(command_path)
         | 
| 17 | 
            +
                  end
         | 
| 14 18 | 
             
                  client.start
         | 
| 15 19 | 
             
                  mcp_server_json = client.list_tools
         | 
| 16 20 | 
             
                  if mcp_server_json
         | 
| @@ -25,7 +29,11 @@ module SmartAgent | |
| 25 29 | 
             
                  @context = MCPContext.new
         | 
| 26 30 | 
             
                  @context.instance_eval(&@code)
         | 
| 27 31 | 
             
                  command_path = @context.command_path
         | 
| 28 | 
            -
                   | 
| 32 | 
            +
                  if @context.mcp_type == :stdio
         | 
| 33 | 
            +
                    client = MCP::StdioClient.new(command_path)
         | 
| 34 | 
            +
                  else
         | 
| 35 | 
            +
                    client = MCP::SSEClient.new(command_path)
         | 
| 36 | 
            +
                  end
         | 
| 29 37 | 
             
                  client.start
         | 
| 30 38 | 
             
                  client.call_method(
         | 
| 31 39 | 
             
                    {
         | 
| @@ -63,6 +71,10 @@ module SmartAgent | |
| 63 71 | 
             
                  @mcp_type = mcp_type
         | 
| 64 72 | 
             
                end
         | 
| 65 73 |  | 
| 74 | 
            +
                def mcp_type
         | 
| 75 | 
            +
                  @mcp_type
         | 
| 76 | 
            +
                end
         | 
| 77 | 
            +
             | 
| 66 78 | 
             
                def command_path
         | 
| 67 79 | 
             
                  @command_path
         | 
| 68 80 | 
             
                end
         | 
| @@ -70,5 +82,9 @@ module SmartAgent | |
| 70 82 | 
             
                def command(path)
         | 
| 71 83 | 
             
                  @command_path = path
         | 
| 72 84 | 
             
                end
         | 
| 85 | 
            +
             | 
| 86 | 
            +
                def url(url)
         | 
| 87 | 
            +
                  @command_path = url
         | 
| 88 | 
            +
                end
         | 
| 73 89 | 
             
              end
         | 
| 74 90 | 
             
            end
         | 
    
        data/lib/smart_agent/result.rb
    CHANGED
    
    
    
        data/lib/smart_agent/tool.rb
    CHANGED
    
    | @@ -41,18 +41,31 @@ module SmartAgent | |
| 41 41 | 
             
                    @tools ||= {}
         | 
| 42 42 | 
             
                  end
         | 
| 43 43 |  | 
| 44 | 
            +
                  def tool_groups
         | 
| 45 | 
            +
                    @tool_groups ||= {}
         | 
| 46 | 
            +
                  end
         | 
| 47 | 
            +
             | 
| 44 48 | 
             
                  def define(name, &block)
         | 
| 45 49 | 
             
                    tool = Tool.new(name)
         | 
| 46 50 | 
             
                    tools[name] = tool
         | 
| 47 51 | 
             
                    tool.context.instance_eval(&block)
         | 
| 48 52 | 
             
                  end
         | 
| 49 53 |  | 
| 54 | 
            +
                  def define_group(name, &block)
         | 
| 55 | 
            +
                    tool_group = ToolGroup.new(name)
         | 
| 56 | 
            +
                    tool_groups[name] = tool_group
         | 
| 57 | 
            +
                    tool_group.context.instance_eval(&block)
         | 
| 58 | 
            +
                  end
         | 
| 59 | 
            +
             | 
| 50 60 | 
             
                  def find_tool(name)
         | 
| 51 61 | 
             
                    tools[name]
         | 
| 52 62 | 
             
                  end
         | 
| 53 63 | 
             
                end
         | 
| 54 64 | 
             
              end
         | 
| 55 65 |  | 
| 66 | 
            +
              class ToolGroup
         | 
| 67 | 
            +
              end
         | 
| 68 | 
            +
             | 
| 56 69 | 
             
              class ToolContext
         | 
| 57 70 | 
             
                attr_accessor :input_params, :description, :proc
         | 
| 58 71 |  | 
    
        data/lib/smart_agent/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | @@ -1,13 +1,13 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: smart_agent
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.1. | 
| 4 | 
            +
              version: 0.1.7
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Your Name
         | 
| 8 8 | 
             
            bindir: bin
         | 
| 9 9 | 
             
            cert_chain: []
         | 
| 10 | 
            -
            date:  | 
| 10 | 
            +
            date: 1980-01-02 00:00:00.000000000 Z
         | 
| 11 11 | 
             
            dependencies:
         | 
| 12 12 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 13 13 | 
             
              name: smart_prompt
         | 
| @@ -71,7 +71,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 71 71 | 
             
                - !ruby/object:Gem::Version
         | 
| 72 72 | 
             
                  version: '0'
         | 
| 73 73 | 
             
            requirements: []
         | 
| 74 | 
            -
            rubygems_version: 3.6. | 
| 74 | 
            +
            rubygems_version: 3.6.7
         | 
| 75 75 | 
             
            specification_version: 4
         | 
| 76 76 | 
             
            summary: Intelligent agent framework with DSL and MCP integration
         | 
| 77 77 | 
             
            test_files: []
         |