lex-acp 0.1.4 → 0.1.5
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/Gemfile +1 -0
- data/lib/legion/extensions/acp/actors/discovery.rb +2 -2
- data/lib/legion/extensions/acp/helpers/agent_card.rb +2 -2
- data/lib/legion/extensions/acp/helpers/protocol.rb +1 -1
- data/lib/legion/extensions/acp/runners/acp.rb +5 -3
- data/lib/legion/extensions/acp/runners/agent.rb +6 -5
- data/lib/legion/extensions/acp/transport/stdio.rb +3 -3
- data/lib/legion/extensions/acp/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: bf65e81b531dc2fbfaa0fc13bba7e4e88fd652ec9621603088e2816861706dcb
|
|
4
|
+
data.tar.gz: 84585050283f209fc4137f384287fbad457124f2c0cc68e85c460ab9e3811bba
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e0c30718a07b5f5f4cc564dd6cb2687fc7eb8443a782ad208629b792e9a401c811927a2fa12a5fc6daa20511bddd8451003991beaab37dcf4b8cf659726a221d
|
|
7
|
+
data.tar.gz: 9005699bb13b94211cf02bfb6e5461a150f2ba1b3527772d58378a268918716da58f7c93c75aacb38b73acd9d9de812377e280ed616e783badb10ce66bc49557
|
data/Gemfile
CHANGED
|
@@ -4,9 +4,9 @@ module Legion
|
|
|
4
4
|
module Extensions
|
|
5
5
|
module Acp
|
|
6
6
|
module Actor
|
|
7
|
-
class Discovery < (defined?(Legion::Extensions::Actors::Every) ? Legion::Extensions::Actors::Every : Object)
|
|
7
|
+
class Discovery < (defined?(Legion::Extensions::Actors::Every) ? Legion::Extensions::Actors::Every : Object) # rubocop:disable Legion/Extension/ActorInheritance
|
|
8
8
|
class << self
|
|
9
|
-
attr_accessor :time
|
|
9
|
+
attr_accessor :time # rubocop:disable ThreadSafety/ClassAndModuleAttributes
|
|
10
10
|
end
|
|
11
11
|
self.time = 300
|
|
12
12
|
|
|
@@ -37,7 +37,7 @@ module Legion
|
|
|
37
37
|
return nil unless data[:name] && data[:url]
|
|
38
38
|
|
|
39
39
|
data
|
|
40
|
-
rescue StandardError
|
|
40
|
+
rescue StandardError => _e
|
|
41
41
|
nil
|
|
42
42
|
end
|
|
43
43
|
|
|
@@ -52,7 +52,7 @@ module Legion
|
|
|
52
52
|
return nil unless response.is_a?(Net::HTTPSuccess)
|
|
53
53
|
|
|
54
54
|
parse(response.body)
|
|
55
|
-
rescue StandardError
|
|
55
|
+
rescue StandardError => _e
|
|
56
56
|
nil
|
|
57
57
|
end
|
|
58
58
|
end
|
|
@@ -25,7 +25,7 @@ module Legion
|
|
|
25
25
|
return error_response(id: data[:id], code: INVALID_REQUEST, message: 'Invalid Request') if data.key?(:id) && !data.key?(:method)
|
|
26
26
|
|
|
27
27
|
data
|
|
28
|
-
rescue ::JSON::ParserError
|
|
28
|
+
rescue ::JSON::ParserError => _e
|
|
29
29
|
error_response(id: nil, code: PARSE_ERROR, message: 'Parse error')
|
|
30
30
|
end
|
|
31
31
|
|
|
@@ -11,6 +11,8 @@ module Legion
|
|
|
11
11
|
module Acp
|
|
12
12
|
module Runners
|
|
13
13
|
module Acp
|
|
14
|
+
extend self
|
|
15
|
+
|
|
14
16
|
def invoke_agent(agent_url:, task:, timeout: 30, **)
|
|
15
17
|
card = Helpers::AgentCard.fetch(agent_url)
|
|
16
18
|
return { success: false, reason: :unreachable } unless card
|
|
@@ -77,17 +79,17 @@ module Legion
|
|
|
77
79
|
endpoint: agent_url,
|
|
78
80
|
source: :acp
|
|
79
81
|
)
|
|
80
|
-
rescue StandardError
|
|
82
|
+
rescue StandardError => _e
|
|
81
83
|
nil
|
|
82
84
|
end
|
|
83
85
|
|
|
84
86
|
def mesh_registry
|
|
85
|
-
@mesh_registry ||= (
|
|
87
|
+
@mesh_registry ||= (Registry.instance if defined?(Legion::Extensions::Mesh::Helpers::Registry))
|
|
86
88
|
end
|
|
87
89
|
|
|
88
90
|
def acp_settings
|
|
89
91
|
settings[:acp] || {}
|
|
90
|
-
rescue StandardError
|
|
92
|
+
rescue StandardError => _e
|
|
91
93
|
{}
|
|
92
94
|
end
|
|
93
95
|
end
|
|
@@ -6,7 +6,7 @@ module Legion
|
|
|
6
6
|
module Extensions
|
|
7
7
|
module Acp
|
|
8
8
|
module Runners
|
|
9
|
-
class Agent
|
|
9
|
+
class Agent # rubocop:disable Legion/Extension/RunnerMustBeModule
|
|
10
10
|
attr_reader :client_info, :sessions
|
|
11
11
|
|
|
12
12
|
def initialize(transport:)
|
|
@@ -20,7 +20,7 @@ module Legion
|
|
|
20
20
|
method_name = message[:method]
|
|
21
21
|
handler = @handlers[method_name]
|
|
22
22
|
unless handler
|
|
23
|
-
return Helpers::Protocol.error_response(
|
|
23
|
+
return Helpers::Protocol.error_response( # rubocop:disable Legion/Extension/RunnerReturnHash
|
|
24
24
|
id: message[:id],
|
|
25
25
|
code: Helpers::Protocol::METHOD_NOT_FOUND,
|
|
26
26
|
message: "Method not found: #{method_name}"
|
|
@@ -99,13 +99,14 @@ module Legion
|
|
|
99
99
|
|
|
100
100
|
user_text = msg.dig(:params, :prompt, :userMessage, :content) || ''
|
|
101
101
|
|
|
102
|
-
return handle_command(session, user_text) if user_text.start_with?('/')
|
|
102
|
+
return handle_command(session, user_text) if user_text.start_with?('/') # rubocop:disable Legion/Extension/RunnerReturnHash
|
|
103
103
|
|
|
104
104
|
return { error: 'LLM not available — prompt handling requires legion-llm' } unless Helpers::Capabilities.llm_available?
|
|
105
105
|
|
|
106
106
|
session[:cancelled] = false
|
|
107
|
-
chat = Legion::LLM.chat(model:
|
|
108
|
-
|
|
107
|
+
chat = Legion::LLM.chat(model: session[:config]['model'], # rubocop:disable Legion/HelperMigration/DirectLlm
|
|
108
|
+
provider: session[:config]['provider']&.to_sym,
|
|
109
|
+
caller: { extension: 'lex-acp', operation: 'agent', session_id: session[:id] })
|
|
109
110
|
chat.with_instructions("You are LegionIO, an async job engine coding assistant. Mode: #{session[:mode]}.")
|
|
110
111
|
|
|
111
112
|
full_content = +''
|
|
@@ -14,7 +14,7 @@ module Legion
|
|
|
14
14
|
@open = false
|
|
15
15
|
end
|
|
16
16
|
|
|
17
|
-
def run
|
|
17
|
+
def run
|
|
18
18
|
@open = true
|
|
19
19
|
while @open
|
|
20
20
|
msg = Helpers::Protocol.read(@input)
|
|
@@ -27,7 +27,7 @@ module Legion
|
|
|
27
27
|
|
|
28
28
|
is_notification = !msg.key?(:id)
|
|
29
29
|
|
|
30
|
-
result =
|
|
30
|
+
result = yield(msg)
|
|
31
31
|
|
|
32
32
|
next if is_notification
|
|
33
33
|
|
|
@@ -40,7 +40,7 @@ module Legion
|
|
|
40
40
|
end
|
|
41
41
|
send_response(resp)
|
|
42
42
|
end
|
|
43
|
-
rescue Interrupt
|
|
43
|
+
rescue Interrupt => _e
|
|
44
44
|
# Clean exit on SIGINT
|
|
45
45
|
end
|
|
46
46
|
|