legionio 1.8.13 → 1.8.15
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/.gitignore +1 -1
- data/CHANGELOG.md +12 -0
- data/lib/legion/api/knowledge.rb +1 -2
- data/lib/legion/api/llm.rb +33 -3
- data/lib/legion/cli/knowledge_command.rb +3 -2
- data/lib/legion/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 0e89dd57228cd0a6289346f6e88acc388a955843b32f7d7e2b77e1431b20bd67
|
|
4
|
+
data.tar.gz: 42d1ba78b03b822f55d1a961eed3ea4590ac80611c0002396ffd13172240595a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3e088fa7bf6bf5d5175b42d6b6e9a4c814a89d44d055713172de17d9b2344082f6ea05738092020b55f080d4bad55e984dc636ac437b82048a43444ba3e645da
|
|
7
|
+
data.tar.gz: b09b41ef56ba5d471594e7c83e422f53da41b3488816dabf0692456efccf246db61f35a5a5207fa8db8d879b1891fff1e4241b37fcf94865afc24820e4559858
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
## [Unreleased]
|
|
4
4
|
|
|
5
|
+
## [1.8.15] - 2026-04-22
|
|
6
|
+
|
|
7
|
+
### Fixed
|
|
8
|
+
- `legionio knowledge ingest <file>` no longer returns `API 500 for /api/knowledge/ingest`. Two halves of the same contract mismatch: (a) the CLI previously forwarded `dry_run:` on every call (now only when `--dry-run` is passed), and (b) the `/api/knowledge/ingest` route forwarded `dry_run:` to `Legion::Extensions::Knowledge::Runners::Ingest.ingest_file`, whose signature in `lex-knowledge` 0.6.7 is `ingest_file(file_path:, force:)` — causing `ArgumentError: unknown keyword: :dry_run`. The kwarg remains honored for directory (corpus) ingests, which support preview scans. Adds regression coverage in `spec/legion/cli/knowledge_command_spec.rb` (negative-case for file ingest) and a new `spec/api/knowledge_spec.rb` covering the file/directory/dry_run branches of the route.
|
|
9
|
+
|
|
10
|
+
## [1.8.14] - 2026-04-18
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
- 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
|
|
14
|
+
- `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
|
|
15
|
+
- `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
|
|
16
|
+
|
|
5
17
|
## [1.8.13] - 2026-04-17
|
|
6
18
|
|
|
7
19
|
### Added
|
data/lib/legion/api/knowledge.rb
CHANGED
data/lib/legion/api/llm.rb
CHANGED
|
@@ -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
|
-
|
|
73
|
-
|
|
74
|
-
|
|
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
|
|
@@ -320,8 +320,9 @@ module Legion
|
|
|
320
320
|
option :force, type: :boolean, default: false, desc: 'Re-ingest even unchanged files'
|
|
321
321
|
option :dry_run, type: :boolean, default: false, desc: 'Preview without writing'
|
|
322
322
|
def ingest(path)
|
|
323
|
-
|
|
324
|
-
|
|
323
|
+
payload = { path: ::File.expand_path(path), force: options[:force] }
|
|
324
|
+
payload[:dry_run] = options[:dry_run] if options[:dry_run]
|
|
325
|
+
result = api_post('/api/knowledge/ingest', **payload)
|
|
325
326
|
out = formatter
|
|
326
327
|
if options[:json]
|
|
327
328
|
out.json(result)
|
data/lib/legion/version.rb
CHANGED