legion-mcp 0.4.2 → 0.4.3
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/CHANGELOG.md +5 -0
- data/lib/legion/mcp/auth.rb +1 -0
- data/lib/legion/mcp/capability_generator.rb +9 -4
- data/lib/legion/mcp/cold_start.rb +3 -1
- data/lib/legion/mcp/context_guard.rb +2 -1
- data/lib/legion/mcp/embedding_index.rb +4 -2
- data/lib/legion/mcp/observer.rb +2 -1
- data/lib/legion/mcp/pattern_compiler.rb +2 -1
- data/lib/legion/mcp/pattern_exchange.rb +1 -0
- data/lib/legion/mcp/pattern_gossip.rb +4 -2
- data/lib/legion/mcp/pattern_store.rb +12 -6
- data/lib/legion/mcp/resources/extension_info.rb +3 -1
- data/lib/legion/mcp/resources/runner_catalog.rb +3 -1
- data/lib/legion/mcp/tier_router.rb +6 -4
- data/lib/legion/mcp/tools/ask_peer.rb +1 -0
- data/lib/legion/mcp/tools/broadcast_peers.rb +1 -0
- data/lib/legion/mcp/tools/create_chain.rb +3 -1
- data/lib/legion/mcp/tools/create_relationship.rb +3 -1
- data/lib/legion/mcp/tools/create_schedule.rb +3 -1
- data/lib/legion/mcp/tools/dataset_list.rb +3 -1
- data/lib/legion/mcp/tools/dataset_show.rb +3 -1
- data/lib/legion/mcp/tools/delete_chain.rb +3 -1
- data/lib/legion/mcp/tools/delete_relationship.rb +3 -1
- data/lib/legion/mcp/tools/delete_schedule.rb +3 -1
- data/lib/legion/mcp/tools/delete_task.rb +3 -1
- data/lib/legion/mcp/tools/describe_runner.rb +3 -1
- data/lib/legion/mcp/tools/disable_extension.rb +3 -1
- data/lib/legion/mcp/tools/discover_tools.rb +1 -0
- data/lib/legion/mcp/tools/do_action.rb +7 -3
- data/lib/legion/mcp/tools/enable_extension.rb +3 -1
- data/lib/legion/mcp/tools/eval_list.rb +3 -1
- data/lib/legion/mcp/tools/eval_results.rb +5 -2
- data/lib/legion/mcp/tools/eval_run.rb +3 -1
- data/lib/legion/mcp/tools/experiment_results.rb +5 -2
- data/lib/legion/mcp/tools/get_config.rb +1 -0
- data/lib/legion/mcp/tools/get_extension.rb +3 -1
- data/lib/legion/mcp/tools/get_status.rb +7 -3
- data/lib/legion/mcp/tools/get_task.rb +3 -1
- data/lib/legion/mcp/tools/get_task_logs.rb +3 -1
- data/lib/legion/mcp/tools/list_chains.rb +3 -1
- data/lib/legion/mcp/tools/list_extensions.rb +3 -1
- data/lib/legion/mcp/tools/list_peers.rb +1 -0
- data/lib/legion/mcp/tools/list_relationships.rb +3 -1
- data/lib/legion/mcp/tools/list_schedules.rb +3 -1
- data/lib/legion/mcp/tools/list_tasks.rb +3 -1
- data/lib/legion/mcp/tools/list_workers.rb +3 -1
- data/lib/legion/mcp/tools/mesh_status.rb +1 -0
- data/lib/legion/mcp/tools/notify_peer.rb +1 -0
- data/lib/legion/mcp/tools/plan_action.rb +3 -1
- data/lib/legion/mcp/tools/prompt_list.rb +3 -1
- data/lib/legion/mcp/tools/prompt_run.rb +3 -1
- data/lib/legion/mcp/tools/prompt_show.rb +3 -1
- data/lib/legion/mcp/tools/rbac_assignments.rb +1 -0
- data/lib/legion/mcp/tools/rbac_check.rb +1 -0
- data/lib/legion/mcp/tools/rbac_grants.rb +1 -0
- data/lib/legion/mcp/tools/routing_stats.rb +3 -1
- data/lib/legion/mcp/tools/run_task.rb +2 -0
- data/lib/legion/mcp/tools/show_worker.rb +3 -1
- data/lib/legion/mcp/tools/team_summary.rb +3 -1
- data/lib/legion/mcp/tools/update_chain.rb +3 -1
- data/lib/legion/mcp/tools/update_relationship.rb +3 -1
- data/lib/legion/mcp/tools/update_schedule.rb +4 -2
- data/lib/legion/mcp/tools/worker_costs.rb +3 -1
- data/lib/legion/mcp/tools/worker_lifecycle.rb +4 -1
- data/lib/legion/mcp/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: 7362dbecf86cb589f761eef73d7444b057d5f31a6ccbf36af3a91633da9df67f
|
|
4
|
+
data.tar.gz: '09f0e9f262917a137ecd372d431407aabefca81e8b8c2768eb719626426f7e74'
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e3919e395c2a3c3a38e10da5abab8432820b98675e61ff348db285babcb5d4d71aa6c8328fe8864104f9f9a9232a0f7244fe7570c0df69a4a4d5d607611fdeef
|
|
7
|
+
data.tar.gz: 33ea01de8b3dd09ad64ffc1172345a284dca03f2b6012c0708eefdb1ef5ed367590299352a1f967130c459777ea1a119f4f368ab1c43c4e4c8977544fca1f525
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
# legion-mcp Changelog
|
|
2
2
|
|
|
3
|
+
## [0.4.3] - 2026-03-22
|
|
4
|
+
|
|
5
|
+
### Changed
|
|
6
|
+
- Added `Legion::Logging.debug`/`.warn` calls to all previously silent rescue blocks across lib/legion/mcp/ and all tool files; silent rescues now surface failures through the logging subsystem when available
|
|
7
|
+
|
|
3
8
|
## [0.4.2] - 2026-03-22
|
|
4
9
|
|
|
5
10
|
### Added
|
data/lib/legion/mcp/auth.rb
CHANGED
|
@@ -34,6 +34,7 @@ module Legion
|
|
|
34
34
|
{ authenticated: true, identity: { user_id: claims[:sub], risk_tier: claims[:risk_tier]&.to_sym,
|
|
35
35
|
tenant_id: claims[:tenant_id], worker_id: claims[:worker_id] } }
|
|
36
36
|
rescue StandardError => e
|
|
37
|
+
Legion::Logging.warn("Auth#verify_jwt failed: #{e.message}") if defined?(Legion::Logging)
|
|
37
38
|
{ authenticated: false, error: e.message }
|
|
38
39
|
end
|
|
39
40
|
|
|
@@ -26,6 +26,7 @@ module Legion
|
|
|
26
26
|
|
|
27
27
|
proposal
|
|
28
28
|
rescue StandardError => e
|
|
29
|
+
Legion::Logging.warn("CapabilityGenerator#generate_from_gap failed: #{e.message}") if defined?(Legion::Logging)
|
|
29
30
|
{ error: e.message, source_gap: gap }
|
|
30
31
|
end
|
|
31
32
|
|
|
@@ -39,7 +40,8 @@ module Legion
|
|
|
39
40
|
client = Legion::Extensions::Eval::Client.new
|
|
40
41
|
eval_result = client.evaluate(code: runner_code, criteria: 'code_quality')
|
|
41
42
|
result[:eval_score] = eval_result[:score] if eval_result[:success]
|
|
42
|
-
rescue StandardError
|
|
43
|
+
rescue StandardError => e
|
|
44
|
+
Legion::Logging.warn("CapabilityGenerator#validate eval failed: #{e.message}") if defined?(Legion::Logging)
|
|
43
45
|
nil
|
|
44
46
|
end
|
|
45
47
|
end
|
|
@@ -78,7 +80,8 @@ module Legion
|
|
|
78
80
|
'Include proper error handling. Return ONLY the Ruby code.'
|
|
79
81
|
|
|
80
82
|
Legion::LLM.ask(prompt)
|
|
81
|
-
rescue StandardError
|
|
83
|
+
rescue StandardError => e
|
|
84
|
+
Legion::Logging.warn("CapabilityGenerator#generate_runner failed: #{e.message}") if defined?(Legion::Logging)
|
|
82
85
|
nil
|
|
83
86
|
end
|
|
84
87
|
|
|
@@ -90,14 +93,16 @@ module Legion
|
|
|
90
93
|
'Use described_class pattern. Return ONLY the Ruby code.'
|
|
91
94
|
|
|
92
95
|
Legion::LLM.ask(prompt)
|
|
93
|
-
rescue StandardError
|
|
96
|
+
rescue StandardError => e
|
|
97
|
+
Legion::Logging.warn("CapabilityGenerator#generate_spec failed: #{e.message}") if defined?(Legion::Logging)
|
|
94
98
|
nil
|
|
95
99
|
end
|
|
96
100
|
|
|
97
101
|
def syntax_valid?(code)
|
|
98
102
|
RubyVM::InstructionSequence.compile(code)
|
|
99
103
|
true
|
|
100
|
-
rescue SyntaxError
|
|
104
|
+
rescue SyntaxError => e
|
|
105
|
+
Legion::Logging.debug("CapabilityGenerator#syntax_valid? syntax error: #{e.message}") if defined?(Legion::Logging)
|
|
101
106
|
false
|
|
102
107
|
end
|
|
103
108
|
|
|
@@ -16,6 +16,7 @@ module Legion
|
|
|
16
16
|
|
|
17
17
|
PatternExchange.import_from_file(path, trust_level: :community)
|
|
18
18
|
rescue StandardError => e
|
|
19
|
+
Legion::Logging.error("ColdStart#load_community_patterns failed: #{e.message}") if defined?(Legion::Logging)
|
|
19
20
|
{ error: e.message, imported: 0 }
|
|
20
21
|
end
|
|
21
22
|
|
|
@@ -23,7 +24,8 @@ module Legion
|
|
|
23
24
|
return nil unless defined?(Legion::Settings)
|
|
24
25
|
|
|
25
26
|
Legion::Settings.dig(:mcp, :cold_start, :patterns_path)
|
|
26
|
-
rescue StandardError
|
|
27
|
+
rescue StandardError => e
|
|
28
|
+
Legion::Logging.warn("ColdStart#configured_path failed: #{e.message}") if defined?(Legion::Logging)
|
|
27
29
|
nil
|
|
28
30
|
end
|
|
29
31
|
end
|
|
@@ -75,7 +75,8 @@ module Legion
|
|
|
75
75
|
return nil unless defined?(Legion::Settings)
|
|
76
76
|
|
|
77
77
|
Legion::Settings.dig(:mcp, :tier0, :guards, key)
|
|
78
|
-
rescue StandardError
|
|
78
|
+
rescue StandardError => e
|
|
79
|
+
Legion::Logging.warn("ContextGuard#setting failed for key #{key}: #{e.message}") if defined?(Legion::Logging)
|
|
79
80
|
nil
|
|
80
81
|
end
|
|
81
82
|
|
|
@@ -97,7 +97,8 @@ module Legion
|
|
|
97
97
|
return nil unless result.is_a?(Array) && !result.empty?
|
|
98
98
|
|
|
99
99
|
result
|
|
100
|
-
rescue StandardError
|
|
100
|
+
rescue StandardError => e
|
|
101
|
+
Legion::Logging.debug("EmbeddingIndex#safe_embed failed: #{e.message}") if defined?(Legion::Logging)
|
|
101
102
|
nil
|
|
102
103
|
end
|
|
103
104
|
|
|
@@ -105,7 +106,8 @@ module Legion
|
|
|
105
106
|
return nil unless defined?(Legion::LLM) && Legion::LLM.respond_to?(:started?) && Legion::LLM.started?
|
|
106
107
|
|
|
107
108
|
->(text) { Legion::LLM.embed(text)[:vector] }
|
|
108
|
-
rescue StandardError
|
|
109
|
+
rescue StandardError => e
|
|
110
|
+
Legion::Logging.debug("EmbeddingIndex#default_embedder failed: #{e.message}") if defined?(Legion::Logging)
|
|
109
111
|
nil
|
|
110
112
|
end
|
|
111
113
|
end
|
data/lib/legion/mcp/observer.rb
CHANGED
|
@@ -49,6 +49,7 @@ module Legion
|
|
|
49
49
|
patterns = [patterns] if patterns.is_a?(Hash)
|
|
50
50
|
import_all(patterns, trust_level: trust_level)
|
|
51
51
|
rescue StandardError => e
|
|
52
|
+
Legion::Logging.error("PatternExchange#import_from_file failed: #{e.message}") if defined?(Legion::Logging)
|
|
52
53
|
{ error: e.message, imported: 0 }
|
|
53
54
|
end
|
|
54
55
|
end
|
|
@@ -30,7 +30,8 @@ module Legion
|
|
|
30
30
|
).publish
|
|
31
31
|
|
|
32
32
|
{ published: true, pattern_id: exported[:pattern_id] }
|
|
33
|
-
rescue StandardError
|
|
33
|
+
rescue StandardError => e
|
|
34
|
+
Legion::Logging.warn("PatternGossip#announce failed: #{e.message}") if defined?(Legion::Logging)
|
|
34
35
|
nil
|
|
35
36
|
end
|
|
36
37
|
|
|
@@ -38,7 +39,8 @@ module Legion
|
|
|
38
39
|
return nil unless message.is_a?(Hash) && message[:pattern]
|
|
39
40
|
|
|
40
41
|
PatternSchema.import(message[:pattern], trust_level: :org)
|
|
41
|
-
rescue StandardError
|
|
42
|
+
rescue StandardError => e
|
|
43
|
+
Legion::Logging.warn("PatternGossip#receive failed: #{e.message}") if defined?(Legion::Logging)
|
|
42
44
|
nil
|
|
43
45
|
end
|
|
44
46
|
|
|
@@ -199,7 +199,8 @@ module Legion
|
|
|
199
199
|
mutex.synchronize { patterns_l0[pattern[:intent_hash]] = pattern }
|
|
200
200
|
persist_l1(pattern[:intent_hash], pattern)
|
|
201
201
|
end
|
|
202
|
-
rescue StandardError
|
|
202
|
+
rescue StandardError => e
|
|
203
|
+
Legion::Logging.warn("PatternStore#hydrate_from_l2 failed: #{e.message}") if defined?(Legion::Logging)
|
|
203
204
|
nil
|
|
204
205
|
end
|
|
205
206
|
|
|
@@ -232,7 +233,8 @@ module Legion
|
|
|
232
233
|
return unless defined?(Legion::Cache) && Legion::Cache.respond_to?(:connected?) && Legion::Cache.connected?
|
|
233
234
|
|
|
234
235
|
Legion::Cache.set("tbi:pattern:#{intent_hash}", Legion::JSON.dump(pattern), 3600)
|
|
235
|
-
rescue StandardError
|
|
236
|
+
rescue StandardError => e
|
|
237
|
+
Legion::Logging.warn("PatternStore#persist_l1 failed: #{e.message}") if defined?(Legion::Logging)
|
|
236
238
|
nil
|
|
237
239
|
end
|
|
238
240
|
|
|
@@ -241,7 +243,8 @@ module Legion
|
|
|
241
243
|
|
|
242
244
|
raw = Legion::Cache.get("tbi:pattern:#{intent_hash}")
|
|
243
245
|
raw ? Legion::JSON.load(raw) : nil
|
|
244
|
-
rescue StandardError
|
|
246
|
+
rescue StandardError => e
|
|
247
|
+
Legion::Logging.warn("PatternStore#lookup_l1 failed: #{e.message}") if defined?(Legion::Logging)
|
|
245
248
|
nil
|
|
246
249
|
end
|
|
247
250
|
|
|
@@ -257,7 +260,8 @@ module Legion
|
|
|
257
260
|
else
|
|
258
261
|
table.insert(data)
|
|
259
262
|
end
|
|
260
|
-
rescue StandardError
|
|
263
|
+
rescue StandardError => e
|
|
264
|
+
Legion::Logging.warn("PatternStore#persist_l2 failed: #{e.message}") if defined?(Legion::Logging)
|
|
261
265
|
nil
|
|
262
266
|
end
|
|
263
267
|
|
|
@@ -267,7 +271,8 @@ module Legion
|
|
|
267
271
|
table = ensure_local_table
|
|
268
272
|
row = table.where(intent_hash: intent_hash).first
|
|
269
273
|
row ? deserialize_pattern(row) : nil
|
|
270
|
-
rescue StandardError
|
|
274
|
+
rescue StandardError => e
|
|
275
|
+
Legion::Logging.warn("PatternStore#lookup_l2 failed: #{e.message}") if defined?(Legion::Logging)
|
|
271
276
|
nil
|
|
272
277
|
end
|
|
273
278
|
|
|
@@ -284,7 +289,8 @@ module Legion
|
|
|
284
289
|
|
|
285
290
|
table = ensure_local_table
|
|
286
291
|
table.where(intent_hash: intent_hash).delete
|
|
287
|
-
rescue StandardError
|
|
292
|
+
rescue StandardError => e
|
|
293
|
+
Legion::Logging.warn("PatternStore#archive_l2 failed: #{e.message}") if defined?(Legion::Logging)
|
|
288
294
|
nil
|
|
289
295
|
end
|
|
290
296
|
|
|
@@ -49,6 +49,7 @@ module Legion
|
|
|
49
49
|
|
|
50
50
|
[{ uri: uri, mimeType: 'application/json', text: Legion::JSON.dump(result) }]
|
|
51
51
|
rescue StandardError => e
|
|
52
|
+
Legion::Logging.warn("ExtensionInfo#read failed: #{e.message}") if defined?(Legion::Logging)
|
|
52
53
|
[{ uri: uri, mimeType: 'application/json',
|
|
53
54
|
text: Legion::JSON.dump({ error: "Failed to read extension: #{e.message}" }) }]
|
|
54
55
|
end
|
|
@@ -57,7 +58,8 @@ module Legion
|
|
|
57
58
|
|
|
58
59
|
def data_connected?
|
|
59
60
|
Legion::Settings[:data][:connected]
|
|
60
|
-
rescue StandardError
|
|
61
|
+
rescue StandardError => e
|
|
62
|
+
Legion::Logging.warn("ExtensionInfo#data_connected? failed: #{e.message}") if defined?(Legion::Logging)
|
|
61
63
|
false
|
|
62
64
|
end
|
|
63
65
|
end
|
|
@@ -48,12 +48,14 @@ module Legion
|
|
|
48
48
|
|
|
49
49
|
Legion::JSON.dump(catalog)
|
|
50
50
|
rescue StandardError => e
|
|
51
|
+
Legion::Logging.warn("RunnerCatalog#catalog_json failed: #{e.message}") if defined?(Legion::Logging)
|
|
51
52
|
Legion::JSON.dump({ error: "Failed to build catalog: #{e.message}" })
|
|
52
53
|
end
|
|
53
54
|
|
|
54
55
|
def data_connected?
|
|
55
56
|
Legion::Settings[:data][:connected]
|
|
56
|
-
rescue StandardError
|
|
57
|
+
rescue StandardError => e
|
|
58
|
+
Legion::Logging.warn("RunnerCatalog#data_connected? failed: #{e.message}") if defined?(Legion::Logging)
|
|
57
59
|
false
|
|
58
60
|
end
|
|
59
61
|
end
|
|
@@ -12,7 +12,7 @@ module Legion
|
|
|
12
12
|
|
|
13
13
|
module_function
|
|
14
14
|
|
|
15
|
-
def route(intent:, params: {}, context: {})
|
|
15
|
+
def route(intent:, params: {}, context: {}) # rubocop:disable Metrics/AbcSize
|
|
16
16
|
start_time = ::Process.clock_gettime(::Process::CLOCK_MONOTONIC)
|
|
17
17
|
normalized = normalize_intent(intent)
|
|
18
18
|
intent_hash = Digest::SHA256.hexdigest(normalized)
|
|
@@ -47,6 +47,7 @@ module Legion
|
|
|
47
47
|
pattern_confidence: pattern[:confidence]
|
|
48
48
|
}
|
|
49
49
|
rescue StandardError => e
|
|
50
|
+
Legion::Logging.warn("TierRouter#route tool chain failed: #{e.message}") if defined?(Legion::Logging)
|
|
50
51
|
PatternStore.record_miss(intent_hash)
|
|
51
52
|
tier1_response(pattern, "tool chain failed: #{e.message}")
|
|
52
53
|
end
|
|
@@ -77,8 +78,8 @@ module Legion
|
|
|
77
78
|
client = Legion::Extensions::Transformer::Client.new
|
|
78
79
|
rendered = client.transform(transformation: template, payload: { results: results })
|
|
79
80
|
return rendered[:result] if rendered[:success]
|
|
80
|
-
rescue StandardError
|
|
81
|
-
#
|
|
81
|
+
rescue StandardError => e
|
|
82
|
+
Legion::Logging.debug("TierRouter#generate_response transformer failed: #{e.message}") if defined?(Legion::Logging)
|
|
82
83
|
end
|
|
83
84
|
end
|
|
84
85
|
|
|
@@ -95,7 +96,8 @@ module Legion
|
|
|
95
96
|
return nil unless intent_vector
|
|
96
97
|
|
|
97
98
|
PatternStore.lookup_semantic(intent_vector)
|
|
98
|
-
rescue StandardError
|
|
99
|
+
rescue StandardError => e
|
|
100
|
+
Legion::Logging.debug("TierRouter#try_semantic_lookup failed: #{e.message}") if defined?(Legion::Logging)
|
|
99
101
|
nil
|
|
100
102
|
end
|
|
101
103
|
|
|
@@ -23,6 +23,7 @@ module Legion
|
|
|
23
23
|
record = Legion::Data::Model::Chain[id]
|
|
24
24
|
text_response(record.values)
|
|
25
25
|
rescue StandardError => e
|
|
26
|
+
Legion::Logging.warn("CreateChain#call failed: #{e.message}") if defined?(Legion::Logging)
|
|
26
27
|
error_response("Failed to create chain: #{e.message}")
|
|
27
28
|
end
|
|
28
29
|
|
|
@@ -30,7 +31,8 @@ module Legion
|
|
|
30
31
|
|
|
31
32
|
def data_connected?
|
|
32
33
|
Legion::Settings[:data][:connected]
|
|
33
|
-
rescue StandardError
|
|
34
|
+
rescue StandardError => e
|
|
35
|
+
Legion::Logging.warn("CreateChain#data_connected? failed: #{e.message}") if defined?(Legion::Logging)
|
|
34
36
|
false
|
|
35
37
|
end
|
|
36
38
|
|
|
@@ -24,6 +24,7 @@ module Legion
|
|
|
24
24
|
record = Legion::Data::Model::Relationship[id]
|
|
25
25
|
text_response(record.values)
|
|
26
26
|
rescue StandardError => e
|
|
27
|
+
Legion::Logging.warn("CreateRelationship#call failed: #{e.message}") if defined?(Legion::Logging)
|
|
27
28
|
error_response("Failed to create relationship: #{e.message}")
|
|
28
29
|
end
|
|
29
30
|
|
|
@@ -31,7 +32,8 @@ module Legion
|
|
|
31
32
|
|
|
32
33
|
def data_connected?
|
|
33
34
|
Legion::Settings[:data][:connected]
|
|
34
|
-
rescue StandardError
|
|
35
|
+
rescue StandardError => e
|
|
36
|
+
Legion::Logging.warn("CreateRelationship#data_connected? failed: #{e.message}") if defined?(Legion::Logging)
|
|
35
37
|
false
|
|
36
38
|
end
|
|
37
39
|
|
|
@@ -37,6 +37,7 @@ module Legion
|
|
|
37
37
|
record = Legion::Extensions::Scheduler::Data::Model::Schedule[id]
|
|
38
38
|
text_response(record.values)
|
|
39
39
|
rescue StandardError => e
|
|
40
|
+
Legion::Logging.warn("CreateSchedule#call failed: #{e.message}") if defined?(Legion::Logging)
|
|
40
41
|
error_response("Failed to create schedule: #{e.message}")
|
|
41
42
|
end
|
|
42
43
|
|
|
@@ -44,7 +45,8 @@ module Legion
|
|
|
44
45
|
|
|
45
46
|
def data_connected?
|
|
46
47
|
Legion::Settings[:data][:connected]
|
|
47
|
-
rescue StandardError
|
|
48
|
+
rescue StandardError => e
|
|
49
|
+
Legion::Logging.warn("CreateSchedule#data_connected? failed: #{e.message}") if defined?(Legion::Logging)
|
|
48
50
|
false
|
|
49
51
|
end
|
|
50
52
|
|
|
@@ -18,6 +18,7 @@ module Legion
|
|
|
18
18
|
result = client.list_datasets
|
|
19
19
|
text_response(result)
|
|
20
20
|
rescue StandardError => e
|
|
21
|
+
Legion::Logging.warn("DatasetList#call failed: #{e.message}") if defined?(Legion::Logging)
|
|
21
22
|
error_response("Failed to list datasets: #{e.message}")
|
|
22
23
|
end
|
|
23
24
|
|
|
@@ -26,7 +27,8 @@ module Legion
|
|
|
26
27
|
def extension_loaded?(name)
|
|
27
28
|
require "legion/extensions/#{name}"
|
|
28
29
|
true
|
|
29
|
-
rescue LoadError
|
|
30
|
+
rescue LoadError => e
|
|
31
|
+
Legion::Logging.debug("DatasetList#extension_loaded? #{name} not available: #{e.message}") if defined?(Legion::Logging)
|
|
30
32
|
false
|
|
31
33
|
end
|
|
32
34
|
|
|
@@ -24,6 +24,7 @@ module Legion
|
|
|
24
24
|
result = client.get_dataset(name: name, version: version)
|
|
25
25
|
text_response(result)
|
|
26
26
|
rescue StandardError => e
|
|
27
|
+
Legion::Logging.warn("DatasetShow#call failed: #{e.message}") if defined?(Legion::Logging)
|
|
27
28
|
error_response("Failed to fetch dataset: #{e.message}")
|
|
28
29
|
end
|
|
29
30
|
|
|
@@ -32,7 +33,8 @@ module Legion
|
|
|
32
33
|
def extension_loaded?(name)
|
|
33
34
|
require "legion/extensions/#{name}"
|
|
34
35
|
true
|
|
35
|
-
rescue LoadError
|
|
36
|
+
rescue LoadError => e
|
|
37
|
+
Legion::Logging.debug("DatasetShow#extension_loaded? #{name} not available: #{e.message}") if defined?(Legion::Logging)
|
|
36
38
|
false
|
|
37
39
|
end
|
|
38
40
|
|
|
@@ -25,6 +25,7 @@ module Legion
|
|
|
25
25
|
record.delete
|
|
26
26
|
text_response({ deleted: true, id: id })
|
|
27
27
|
rescue StandardError => e
|
|
28
|
+
Legion::Logging.warn("DeleteChain#call failed: #{e.message}") if defined?(Legion::Logging)
|
|
28
29
|
error_response("Failed to delete chain: #{e.message}")
|
|
29
30
|
end
|
|
30
31
|
|
|
@@ -32,7 +33,8 @@ module Legion
|
|
|
32
33
|
|
|
33
34
|
def data_connected?
|
|
34
35
|
Legion::Settings[:data][:connected]
|
|
35
|
-
rescue StandardError
|
|
36
|
+
rescue StandardError => e
|
|
37
|
+
Legion::Logging.warn("DeleteChain#data_connected? failed: #{e.message}") if defined?(Legion::Logging)
|
|
36
38
|
false
|
|
37
39
|
end
|
|
38
40
|
|
|
@@ -25,6 +25,7 @@ module Legion
|
|
|
25
25
|
record.delete
|
|
26
26
|
text_response({ deleted: true, id: id })
|
|
27
27
|
rescue StandardError => e
|
|
28
|
+
Legion::Logging.warn("DeleteRelationship#call failed: #{e.message}") if defined?(Legion::Logging)
|
|
28
29
|
error_response("Failed to delete relationship: #{e.message}")
|
|
29
30
|
end
|
|
30
31
|
|
|
@@ -32,7 +33,8 @@ module Legion
|
|
|
32
33
|
|
|
33
34
|
def data_connected?
|
|
34
35
|
Legion::Settings[:data][:connected]
|
|
35
|
-
rescue StandardError
|
|
36
|
+
rescue StandardError => e
|
|
37
|
+
Legion::Logging.warn("DeleteRelationship#data_connected? failed: #{e.message}") if defined?(Legion::Logging)
|
|
36
38
|
false
|
|
37
39
|
end
|
|
38
40
|
|
|
@@ -25,6 +25,7 @@ module Legion
|
|
|
25
25
|
record.delete
|
|
26
26
|
text_response({ deleted: true, id: id })
|
|
27
27
|
rescue StandardError => e
|
|
28
|
+
Legion::Logging.warn("DeleteSchedule#call failed: #{e.message}") if defined?(Legion::Logging)
|
|
28
29
|
error_response("Failed to delete schedule: #{e.message}")
|
|
29
30
|
end
|
|
30
31
|
|
|
@@ -32,7 +33,8 @@ module Legion
|
|
|
32
33
|
|
|
33
34
|
def data_connected?
|
|
34
35
|
Legion::Settings[:data][:connected]
|
|
35
|
-
rescue StandardError
|
|
36
|
+
rescue StandardError => e
|
|
37
|
+
Legion::Logging.warn("DeleteSchedule#data_connected? failed: #{e.message}") if defined?(Legion::Logging)
|
|
36
38
|
false
|
|
37
39
|
end
|
|
38
40
|
|
|
@@ -24,6 +24,7 @@ module Legion
|
|
|
24
24
|
task.delete
|
|
25
25
|
text_response({ deleted: true, id: id })
|
|
26
26
|
rescue StandardError => e
|
|
27
|
+
Legion::Logging.warn("DeleteTask#call failed: #{e.message}") if defined?(Legion::Logging)
|
|
27
28
|
error_response("Failed to delete task: #{e.message}")
|
|
28
29
|
end
|
|
29
30
|
|
|
@@ -31,7 +32,8 @@ module Legion
|
|
|
31
32
|
|
|
32
33
|
def data_connected?
|
|
33
34
|
Legion::Settings[:data][:connected]
|
|
34
|
-
rescue StandardError
|
|
35
|
+
rescue StandardError => e
|
|
36
|
+
Legion::Logging.warn("DeleteTask#data_connected? failed: #{e.message}") if defined?(Legion::Logging)
|
|
35
37
|
false
|
|
36
38
|
end
|
|
37
39
|
|
|
@@ -22,6 +22,7 @@ module Legion
|
|
|
22
22
|
|
|
23
23
|
runner ? describe_single(runner) : describe_all
|
|
24
24
|
rescue StandardError => e
|
|
25
|
+
Legion::Logging.warn("DescribeRunner#call failed: #{e.message}") if defined?(Legion::Logging)
|
|
25
26
|
error_response("Failed to describe runners: #{e.message}")
|
|
26
27
|
end
|
|
27
28
|
|
|
@@ -29,7 +30,8 @@ module Legion
|
|
|
29
30
|
|
|
30
31
|
def data_connected?
|
|
31
32
|
Legion::Settings[:data][:connected]
|
|
32
|
-
rescue StandardError
|
|
33
|
+
rescue StandardError => e
|
|
34
|
+
Legion::Logging.warn("DescribeRunner#data_connected? failed: #{e.message}") if defined?(Legion::Logging)
|
|
33
35
|
false
|
|
34
36
|
end
|
|
35
37
|
|
|
@@ -25,6 +25,7 @@ module Legion
|
|
|
25
25
|
ext.refresh
|
|
26
26
|
text_response(ext.values)
|
|
27
27
|
rescue StandardError => e
|
|
28
|
+
Legion::Logging.warn("DisableExtension#call failed: #{e.message}") if defined?(Legion::Logging)
|
|
28
29
|
error_response("Failed to disable extension: #{e.message}")
|
|
29
30
|
end
|
|
30
31
|
|
|
@@ -32,7 +33,8 @@ module Legion
|
|
|
32
33
|
|
|
33
34
|
def data_connected?
|
|
34
35
|
Legion::Settings[:data][:connected]
|
|
35
|
-
rescue StandardError
|
|
36
|
+
rescue StandardError => e
|
|
37
|
+
Legion::Logging.warn("DisableExtension#data_connected? failed: #{e.message}") if defined?(Legion::Logging)
|
|
36
38
|
false
|
|
37
39
|
end
|
|
38
40
|
|
|
@@ -63,6 +63,7 @@ module Legion
|
|
|
63
63
|
record_feedback(intent, matched_name, success: true)
|
|
64
64
|
result
|
|
65
65
|
rescue StandardError => e
|
|
66
|
+
Legion::Logging.warn("DoAction#call failed: #{e.message}") if defined?(Legion::Logging)
|
|
66
67
|
record_feedback(intent, matched_name, success: false) if defined?(matched_name)
|
|
67
68
|
error_response("Failed: #{e.message}")
|
|
68
69
|
end
|
|
@@ -84,7 +85,8 @@ module Legion
|
|
|
84
85
|
|
|
85
86
|
hint = "Known pattern: #{pattern[:intent_text]}. Tools: #{Array(pattern[:tool_chain]).join(', ')}. "
|
|
86
87
|
Legion::LLM.ask("#{hint}User intent: #{intent}")
|
|
87
|
-
rescue StandardError
|
|
88
|
+
rescue StandardError => e
|
|
89
|
+
Legion::Logging.debug("DoAction#try_tier1 failed: #{e.message}") if defined?(Legion::Logging)
|
|
88
90
|
nil
|
|
89
91
|
end
|
|
90
92
|
|
|
@@ -94,7 +96,8 @@ module Legion
|
|
|
94
96
|
catalog = ContextCompiler.respond_to?(:compressed_catalog) ? ContextCompiler.compressed_catalog : []
|
|
95
97
|
context_str = catalog.any? ? "Available tools: #{Legion::JSON.dump(catalog)}. " : ''
|
|
96
98
|
Legion::LLM.ask("#{context_str}User intent: #{intent}")
|
|
97
|
-
rescue StandardError
|
|
99
|
+
rescue StandardError => e
|
|
100
|
+
Legion::Logging.debug("DoAction#try_tier2 failed: #{e.message}") if defined?(Legion::Logging)
|
|
98
101
|
nil
|
|
99
102
|
end
|
|
100
103
|
|
|
@@ -106,7 +109,8 @@ module Legion
|
|
|
106
109
|
params: params.transform_keys(&:to_sym),
|
|
107
110
|
context: context.transform_keys(&:to_sym)
|
|
108
111
|
)
|
|
109
|
-
rescue StandardError
|
|
112
|
+
rescue StandardError => e
|
|
113
|
+
Legion::Logging.debug("DoAction#try_tier0 failed: #{e.message}") if defined?(Legion::Logging)
|
|
110
114
|
nil
|
|
111
115
|
end
|
|
112
116
|
|
|
@@ -25,6 +25,7 @@ module Legion
|
|
|
25
25
|
ext.refresh
|
|
26
26
|
text_response(ext.values)
|
|
27
27
|
rescue StandardError => e
|
|
28
|
+
Legion::Logging.warn("EnableExtension#call failed: #{e.message}") if defined?(Legion::Logging)
|
|
28
29
|
error_response("Failed to enable extension: #{e.message}")
|
|
29
30
|
end
|
|
30
31
|
|
|
@@ -32,7 +33,8 @@ module Legion
|
|
|
32
33
|
|
|
33
34
|
def data_connected?
|
|
34
35
|
Legion::Settings[:data][:connected]
|
|
35
|
-
rescue StandardError
|
|
36
|
+
rescue StandardError => e
|
|
37
|
+
Legion::Logging.warn("EnableExtension#data_connected? failed: #{e.message}") if defined?(Legion::Logging)
|
|
36
38
|
false
|
|
37
39
|
end
|
|
38
40
|
|
|
@@ -18,6 +18,7 @@ module Legion
|
|
|
18
18
|
result = client.list_evaluators
|
|
19
19
|
text_response(result)
|
|
20
20
|
rescue StandardError => e
|
|
21
|
+
Legion::Logging.warn("EvalList#call failed: #{e.message}") if defined?(Legion::Logging)
|
|
21
22
|
error_response("Failed to list evaluators: #{e.message}")
|
|
22
23
|
end
|
|
23
24
|
|
|
@@ -26,7 +27,8 @@ module Legion
|
|
|
26
27
|
def extension_loaded?(name)
|
|
27
28
|
require "legion/extensions/#{name}"
|
|
28
29
|
true
|
|
29
|
-
rescue LoadError
|
|
30
|
+
rescue LoadError => e
|
|
31
|
+
Legion::Logging.debug("EvalList#extension_loaded? #{name} not available: #{e.message}") if defined?(Legion::Logging)
|
|
30
32
|
false
|
|
31
33
|
end
|
|
32
34
|
|
|
@@ -23,6 +23,7 @@ module Legion
|
|
|
23
23
|
result = fetch_experiment(client, experiment_name)
|
|
24
24
|
text_response(result)
|
|
25
25
|
rescue StandardError => e
|
|
26
|
+
Legion::Logging.warn("EvalResults#call failed: #{e.message}") if defined?(Legion::Logging)
|
|
26
27
|
error_response("Failed to fetch eval results: #{e.message}")
|
|
27
28
|
end
|
|
28
29
|
|
|
@@ -43,7 +44,8 @@ module Legion
|
|
|
43
44
|
|
|
44
45
|
summary = begin
|
|
45
46
|
::JSON.parse(exp[:summary], symbolize_names: true)
|
|
46
|
-
rescue StandardError
|
|
47
|
+
rescue StandardError => e
|
|
48
|
+
Legion::Logging.debug("EvalResults#fetch_experiment summary parse failed: #{e.message}") if defined?(Legion::Logging)
|
|
47
49
|
{}
|
|
48
50
|
end
|
|
49
51
|
|
|
@@ -55,7 +57,8 @@ module Legion
|
|
|
55
57
|
def extension_loaded?(name)
|
|
56
58
|
require "legion/extensions/#{name}"
|
|
57
59
|
true
|
|
58
|
-
rescue LoadError
|
|
60
|
+
rescue LoadError => e
|
|
61
|
+
Legion::Logging.debug("EvalResults#extension_loaded? #{name} not available: #{e.message}") if defined?(Legion::Logging)
|
|
59
62
|
false
|
|
60
63
|
end
|
|
61
64
|
|