hellm 0.0.3 → 0.0.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 85820167c185b4609e3b81e23a3280063d41c85d70c5880b9e3b676dc378a193
4
- data.tar.gz: e24df7e76af2cae1500adfc01bc9f4ef75ffe8641acdbc8a33fad7ffc92c028a
3
+ metadata.gz: 11522217c18c262d67881d31f50efb136d43fb3f9465c3ed25cbf95659b927ef
4
+ data.tar.gz: bf00259cd39073946654e42e8c63a04fe95310fbd94b12d772929c7fc8194b5c
5
5
  SHA512:
6
- metadata.gz: 6c0bedef17b6862c8302f14f51c3c9cdfaace1a07f40523574c9316ce6b3d775e0000edce7f83168bb7da50e1c24c5458ab29d0ce19fde3bdf1290a648e9cc53
7
- data.tar.gz: 50342bcd317ac5427189e1318233e6902e73a80cd3d9bca2cd6521331c95d34d72cf4ae43daf72bbf181df640a4a06fa785c0673e52d96051b42c19bb296fd19
6
+ metadata.gz: cf31d07cca0558b43e1fbbcaf338493e268352867e450b1f98cda732f8728fe5685dbb6a10e23ccb749e7b323d59e3673e0bdaace0a2629c623c83013bb2355d
7
+ data.tar.gz: 48919c27642fba873c2d4348b933fc899bb3735e42e57590639c058cb835462727c3ac91861754ba279aebf4c82eae7d9e737884c4fbae486130e89534d8fea1
data/ARCHITECTURE.md CHANGED
@@ -140,6 +140,24 @@ Responsibilities:
140
140
  - Builds dynamic Langchain tools that proxy calls into sub-agents
141
141
  - Starts a fresh sub-agent session per invocation
142
142
 
143
+ ### Hellm::Tools::WebFetchTool
144
+
145
+ Location: lib/hellm/tools/web_fetch_tool.rb
146
+
147
+ Responsibilities:
148
+ - Reads raw content from HTTP(S) URLs
149
+ - Extracts plain text from HTML pages using Nokogiri
150
+ - Returns resilient error strings for network/parsing failures
151
+
152
+ ### Hellm::Tools::BraveSearchTool
153
+
154
+ Location: lib/hellm/tools/brave_search_tool.rb
155
+
156
+ Responsibilities:
157
+ - Calls Brave::SearchApi for web search requests
158
+ - Exposes query/count/offset/country parameters as a tool function
159
+ - Serializes search responses to JSON for agent consumption
160
+
143
161
  ## Configuration Model
144
162
 
145
163
  Project configuration is stored in a `.hellm` directory with the following structure:
@@ -172,8 +190,8 @@ Current technical risks:
172
190
  - Minimal validation of markdown frontmatter means malformed config errors may surface late.
173
191
 
174
192
  Testing status:
175
- - RSpec covers core behavior for Builder, Registry, tools, and LLM-free Agent logic.
176
- - SimpleCov runs with the suite and writes coverage output to log/coverage.
193
+ - RSpec covers core behavior for Builder, Registry, tool classes (including WebFetchTool and BraveSearchTool), and LLM-free Agent logic.
194
+ - SimpleCov runs with the suite and writes coverage output to log/reports/coverage.
177
195
 
178
196
  ## Future Hardening Priorities
179
197
 
data/README.md CHANGED
@@ -47,8 +47,12 @@ hellm Alfred "Tell me your favorite color and which month fits it."
47
47
 
48
48
  The framework provides the following tools for agents to use:
49
49
 
50
- * `calculator` - a simple calculator for basic arithmetic operations.
51
- * `web` - fetches web pages or other content from URLs.
50
+ | Tool Name | Aliases | Description |
51
+ | ------------- | ----------------------- | ------------------------------------------------------- |
52
+ | `calculator` | | a simple calculator for basic arithmetic operations. |
53
+ | `webfetch` | `web` | fetches web pages or other content from URLs. |
54
+ | `websearch` | `web` | performs web searches and returns search results. |
55
+ | `web` | | combines web fetching and web searching capabilities. |
52
56
 
53
57
 
54
58
  ### Custom Tools
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.3
1
+ 0.0.4
@@ -0,0 +1,34 @@
1
+ module Brave
2
+ module SearchApi
3
+ class Client
4
+ BASE_URL = "https://api.search.brave.com/res/v1/web/search"
5
+
6
+ def initialize(api_key)
7
+ @api_key = api_key
8
+ end
9
+
10
+ def search(query, country: nil, count: 10, offset: 0)
11
+ uri = URI(BASE_URL)
12
+ params = {
13
+ q: query,
14
+ count: count,
15
+ offset: offset,
16
+ country: country
17
+ }
18
+
19
+ headers = {
20
+ "X-Subscription-Token" => @api_key,
21
+ "Content-Type" => "application/json"
22
+ }
23
+
24
+ response = Net::HTTP.post(uri, params.to_json, headers)
25
+
26
+ if response.is_a?(Net::HTTPSuccess)
27
+ JSON.parse(response.body)
28
+ else
29
+ raise "Brave Search API request failed with status #{response.code}: #{response.message}"
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,10 @@
1
+ require_relative "search_api/client"
2
+
3
+ module Brave
4
+ module SearchApi
5
+ def self.search(query, country: nil, count: 10, offset: 0)
6
+ client = Client.new(Brave.api_key)
7
+ client.search(query, country: country, count: count, offset: offset)
8
+ end
9
+ end
10
+ end
data/lib/brave.rb ADDED
@@ -0,0 +1,7 @@
1
+ require_relative "brave/search_api"
2
+
3
+ module Brave
4
+ def self.api_key
5
+ ENV["BRAVE_API_KEY"]
6
+ end
7
+ end
data/lib/hellm/agent.rb CHANGED
@@ -41,8 +41,6 @@ class Hellm::Agent
41
41
  self.stream_adapter = stream_adapter || Hellm::StreamAdapter.new
42
42
  self.agents = agents || []
43
43
  self.tools = tools || []
44
- # remove "agent" from tools, this ability is controlled by the presence of agents
45
- self.tools.reject!{|t| t == "agent"}
46
44
  end
47
45
 
48
46
 
data/lib/hellm/builder.rb CHANGED
@@ -3,7 +3,8 @@ require_relative "stream_adapter"
3
3
  require_relative "agent"
4
4
  require_relative "skill"
5
5
  require_relative "tools/skill_tool"
6
- require_relative "tools/web_tool"
6
+ require_relative "tools/web_fetch_tool"
7
+ require_relative "tools/brave_search_tool"
7
8
 
8
9
  class Hellm::Builder
9
10
  attr_accessor :project_dir, :hellm_dir, :stream_adapter
@@ -43,7 +44,8 @@ class Hellm::Builder
43
44
  private
44
45
  def add_builtin_tools_to_registry
45
46
  Hellm::Tools::Registry.instance.add(:calculator) { Langchain::Tool::Calculator.new }
46
- Hellm::Tools::Registry.instance.add(:web) { Hellm::Tools::WebTool.new }
47
+ Hellm::Tools::Registry.instance.add(:bravesearch) { Hellm::Tools::BraveSearchTool.new }
48
+ Hellm::Tools::Registry.instance.add(:webfetch) { Hellm::Tools::WebFetchTool.new }
47
49
  end
48
50
 
49
51
  def get_skills_from_project_dir
@@ -71,7 +73,7 @@ class Hellm::Builder
71
73
  markdown_file = Hellm::MarkdownFile.read(file)
72
74
 
73
75
  tools = markdown_file.fetch("tools", [])
74
- tools << "skill"
76
+ tools << "default"
75
77
 
76
78
  Hellm::Agent.new(
77
79
  model: markdown_file.fetch("model"),
@@ -0,0 +1,20 @@
1
+ require "brave"
2
+
3
+ module Hellm::Tools
4
+ class BraveSearchTool
5
+ extend Langchain::ToolDefinition
6
+
7
+ define_function :search, description: "Performs a web search using 'Brave Search' search engine." do
8
+ property :query, type: "string", description: "The search query.", required: true
9
+ property :count, type: "integer", description: "The number of search results to return.", required: false
10
+ property :offset, type: "integer", description: "The offset for the search results.", required: false
11
+ property :country, type: "string", description: "The 2-letter country code for the search results.", required: false
12
+ end
13
+
14
+ def search(query:, count: 10, offset: 0, country: nil)
15
+ results = Brave::SearchApi.search(query, count: count, offset: offset, country: country)
16
+ results.to_json
17
+ end
18
+
19
+ end
20
+ end
@@ -2,6 +2,14 @@ require_relative "agent_tool_factory"
2
2
 
3
3
  module Hellm::Tools
4
4
  class Registry
5
+ ALIASES = {
6
+ "default" => ["skill"],
7
+ "web" => ["webfetch", "bravesearch"],
8
+ "websearch" => ["bravesearch"],
9
+ "agent" => [] # agent tools are dynamically generated from registered agents
10
+ }
11
+
12
+
5
13
  def self.instance
6
14
  @instance ||= new
7
15
  end
@@ -19,6 +27,7 @@ module Hellm::Tools
19
27
  end
20
28
 
21
29
  def get(*tool_names)
30
+ tool_names = resolve_aliases(*tool_names)
22
31
  tools = tool_names.map do |tool_name|
23
32
  entry = @tools[tool_name.to_s]
24
33
  if entry.nil?
@@ -49,5 +58,11 @@ module Hellm::Tools
49
58
  def agent_tool_name(agent_name)
50
59
  "agent_tool_" + agent_name.gsub(/[\s-]+/, "_").downcase
51
60
  end
61
+
62
+ def resolve_aliases(*tool_names)
63
+ tool_names.map do |tool_name|
64
+ ALIASES.fetch(tool_name.to_s, [tool_name.to_s])
65
+ end.flatten
66
+ end
52
67
  end
53
68
  end
@@ -2,7 +2,7 @@ require "open-uri"
2
2
  require "nokogiri"
3
3
 
4
4
  module Hellm::Tools
5
- class WebTool
5
+ class WebFetchTool
6
6
  extend Langchain::ToolDefinition
7
7
 
8
8
  define_function :read, description: "Reads content from a URL. Use this function when you want to get text/binary raw data from the response, e.g. to check the HTML-code of a page." do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hellm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - ubity UG
@@ -81,19 +81,19 @@ dependencies:
81
81
  - !ruby/object:Gem::Version
82
82
  version: 1.19.4
83
83
  - !ruby/object:Gem::Dependency
84
- name: google_search_results
84
+ name: gsearch-parser
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: 2.2.0
89
+ version: 0.2.2
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: 2.2.0
96
+ version: 0.2.2
97
97
  description: |
98
98
  Declarative agentic framework for LLMs, allowing you to build autonomous agents that can perform complex tasks and interact with the world, without writing code.
99
99
  Agents and skills are defined in markdown files, quite similar to how Github Copilot works.
@@ -118,6 +118,9 @@ files:
118
118
  - example/.hellm/skills/farben/SKILL.md
119
119
  - example/example1.sh
120
120
  - example/example2.sh
121
+ - lib/brave.rb
122
+ - lib/brave/search_api.rb
123
+ - lib/brave/search_api/client.rb
121
124
  - lib/hellm.rb
122
125
  - lib/hellm/agent.rb
123
126
  - lib/hellm/builder.rb
@@ -125,9 +128,10 @@ files:
125
128
  - lib/hellm/skill.rb
126
129
  - lib/hellm/stream_adapter.rb
127
130
  - lib/hellm/tools/agent_tool_factory.rb
131
+ - lib/hellm/tools/brave_search_tool.rb
128
132
  - lib/hellm/tools/registry.rb
129
133
  - lib/hellm/tools/skill_tool.rb
130
- - lib/hellm/tools/web_tool.rb
134
+ - lib/hellm/tools/web_fetch_tool.rb
131
135
  - lib/hellm/version.rb
132
136
  - sig/hellm.rbs
133
137
  homepage: https://gitlab.com/ubity/gems/hellm