legionio 1.8.13 → 1.8.14

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: c042d58a82a2fa41362a6d703994b6be36a800d1db93310252659ccd3d8271bd
4
- data.tar.gz: 3b9e2fb94de2aa84b21373dd8518970335a762a8782ff55fdca70b9155ed225d
3
+ metadata.gz: 47d2f43298e4d606c1a6817bddee1bc2e09fe63c78bcae858c45cdc29622ab85
4
+ data.tar.gz: 6043356cca31ed43034509f3c4e0f6de5b37dc8cc72011c4442cf50c072e392a
5
5
  SHA512:
6
- metadata.gz: eb054a7db4ee94ba4932490c5068fe74af6bdf6c7db722fab13ab85d6336d497ca2621806b585cd06b95f5e17357fc667638888cc99a8dcba8e63ee031f262a5
7
- data.tar.gz: 1c79f10e9930f24d62c32ef7b15d63462547afb973ac96cb10086059d0e48259dc8da20dda444e132bd113f41149f8d4ac130efb788d608b52d0cc58e51f7d02
6
+ metadata.gz: 29daf6503fc9a0fa6fd893d50b1dc05ac35040c6ed3b49024cb46df6863efe173a69b87c0bee65a5aaa65f6779b50f16784487cddde26c8ed92dfedc816a12c9
7
+ data.tar.gz: 90d6980b55176786950d8da78ace2f902c5974f1c2d5887a73eab97b7fb690a2cdb9fde657eeeddd44ee839d42d0fda4bbfe83dda2d9ee8f75cbef08e7b4941b
data/.gitignore CHANGED
@@ -1,6 +1,6 @@
1
1
  /.bundle/
2
2
  /.yardoc
3
- /Gemfile.lock
3
+ Gemfile.lock
4
4
  /_yardoc/
5
5
  /coverage/
6
6
  /doc/
data/CHANGELOG.md CHANGED
@@ -2,6 +2,13 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [1.8.14] - 2026-04-18
6
+
7
+ ### Fixed
8
+ - Optional subsystem `LoadError`s (RBAC, Data, LLM, Apollo, Gaia, Telemetry) now log at the caller-specified level instead of always ERROR with a full stack trace — `handle_exception` respects the `level:` kwarg. Fixes #155
9
+ - `web_fetch` tool in `/api/llm/*` endpoints now delegates to `Legion::CLI::Chat::WebFetch.fetch` instead of bare `Net::HTTP.get`, gaining SSL, redirect-following, HTML-to-markdown conversion, and `maxLength` support. Fixes #153
10
+ - `web_search` tool in `/api/llm/*` endpoints no longer falls through to the generic "not executable server-side" error — added dispatch branch delegating to `Legion::CLI::Chat::WebSearch.search`. Fixes #154
11
+
5
12
  ## [1.8.13] - 2026-04-17
6
13
 
7
14
  ### Added
@@ -2,6 +2,9 @@
2
2
 
3
3
  require 'securerandom'
4
4
  require 'open3'
5
+ require 'resolv'
6
+ require 'ipaddr'
7
+ require 'uri'
5
8
 
6
9
  module Legion
7
10
  class API < Sinatra::Base
@@ -69,9 +72,36 @@ module Legion
69
72
  Dir.glob(pattern).first(100).join("\n")
70
73
  when 'web_fetch'
71
74
  url = kwargs[:url] || kwargs.values.first.to_s
72
- require 'net/http'
73
- uri = URI(url)
74
- Net::HTTP.get(uri)
75
+ raw_length = (kwargs[:maxLength] || kwargs[:max_length])&.to_i
76
+ max_length = raw_length&.positive? ? raw_length : nil
77
+ parsed = begin
78
+ URI.parse(url)
79
+ rescue StandardError
80
+ nil
81
+ end
82
+ raise 'Invalid or non-HTTP URL' unless parsed.is_a?(URI::HTTP)
83
+
84
+ addr = begin
85
+ ::Resolv.getaddress(parsed.host)
86
+ rescue StandardError
87
+ nil
88
+ end
89
+ if addr
90
+ ip = ::IPAddr.new(addr)
91
+ raise 'SSRF: private/loopback targets are not permitted' if
92
+ ip.loopback? || ip.private? || ip.link_local?
93
+ end
94
+ require 'legion/cli/chat/web_fetch'
95
+ content = Legion::CLI::Chat::WebFetch.fetch(url)
96
+ max_length ? content[0, max_length] : content
97
+ when 'web_search'
98
+ query = kwargs[:query] || kwargs.values.first.to_s
99
+ raw_results = (kwargs[:max_results] || kwargs[:maxResults]).to_i
100
+ max_results = raw_results.positive? ? [raw_results, 50].min : 5
101
+ require 'legion/cli/chat/web_search'
102
+ results = Legion::CLI::Chat::WebSearch.search(query, max_results: max_results,
103
+ auto_fetch: false)
104
+ results[:results].map { |r| "### #{r[:title]}\n#{r[:url]}\n#{r[:snippet]}" }.join("\n\n")
75
105
  else
76
106
  "Tool #{tool_ref} is not executable server-side. Use a legion_ prefixed tool instead."
77
107
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Legion
4
- VERSION = '1.8.13'
4
+ VERSION = '1.8.14'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: legionio
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.13
4
+ version: 1.8.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Esity