legionio 1.4.87 → 1.4.88
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 +6 -0
- data/lib/legion/api/acp.rb +57 -53
- 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: a74cfb0fe16b4a0aee1ee3d1e168e016b32757ff3ad0157cd365d65c9a0059b5
|
|
4
|
+
data.tar.gz: 9ca67b98685002f0f6b7e4c3067aef1dc13e057c1d1b449b3b938eaf98ace26c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 75e82377d58ee04c1113c273840e32a83454bb02f4966634c7a5db83e72b226f9f1b566de31b5f6289073567d0d8c6e76944aa1b3b5847b373027f2af2c427af
|
|
7
|
+
data.tar.gz: 61385f336e097ebf5ff8536cc50a2f7b1f1f230e0be5bae33c2164d0f6cd8a169e664edb3eff3a7af047ac9062d7817226451e05fde75add0cf35d637b152b90
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Legion Changelog
|
|
2
2
|
|
|
3
|
+
## [1.4.88] - 2026-03-20
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
- ACP provider spec: 25 tests covering agent card discovery, task submission, task status, task cancellation stub, and status translation
|
|
7
|
+
- Refactored ACP helpers into `Legion::API::Helpers::Acp` module for testability
|
|
8
|
+
|
|
3
9
|
## [1.4.87] - 2026-03-20
|
|
4
10
|
|
|
5
11
|
### Added
|
data/lib/legion/api/acp.rb
CHANGED
|
@@ -2,9 +2,66 @@
|
|
|
2
2
|
|
|
3
3
|
module Legion
|
|
4
4
|
class API < Sinatra::Base
|
|
5
|
+
module Helpers
|
|
6
|
+
module Acp
|
|
7
|
+
def build_agent_card
|
|
8
|
+
name = begin
|
|
9
|
+
Legion::Settings[:client][:name]
|
|
10
|
+
rescue StandardError
|
|
11
|
+
'legion'
|
|
12
|
+
end
|
|
13
|
+
port = begin
|
|
14
|
+
settings.port || 4567
|
|
15
|
+
rescue StandardError
|
|
16
|
+
4567
|
|
17
|
+
end
|
|
18
|
+
{
|
|
19
|
+
name: name,
|
|
20
|
+
description: 'LegionIO digital worker',
|
|
21
|
+
url: "http://#{request.host}:#{port}/api/acp",
|
|
22
|
+
version: '2.0',
|
|
23
|
+
protocol: 'acp/1.0',
|
|
24
|
+
capabilities: discover_capabilities,
|
|
25
|
+
authentication: { schemes: ['bearer'] },
|
|
26
|
+
defaultInputModes: ['text/plain', 'application/json'],
|
|
27
|
+
defaultOutputModes: ['text/plain', 'application/json']
|
|
28
|
+
}
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def discover_capabilities
|
|
32
|
+
if defined?(Legion::Extensions::Mesh::Helpers::Registry)
|
|
33
|
+
Legion::Extensions::Mesh::Helpers::Registry.new.capabilities.keys.map(&:to_s)
|
|
34
|
+
else
|
|
35
|
+
[]
|
|
36
|
+
end
|
|
37
|
+
rescue StandardError
|
|
38
|
+
[]
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def find_task(id)
|
|
42
|
+
return nil unless defined?(Legion::Data)
|
|
43
|
+
|
|
44
|
+
Legion::Data::Model::Task[id.to_i]&.values
|
|
45
|
+
rescue StandardError
|
|
46
|
+
nil
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def translate_status(status)
|
|
50
|
+
case status&.to_s
|
|
51
|
+
when /completed/ then 'completed'
|
|
52
|
+
when /exception|failed/ then 'failed'
|
|
53
|
+
when /queued|scheduled/ then 'queued'
|
|
54
|
+
else 'in_progress'
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
|
|
5
60
|
module Routes
|
|
6
61
|
module Acp
|
|
7
62
|
def self.registered(app)
|
|
63
|
+
app.helpers Legion::API::Helpers::Acp
|
|
64
|
+
|
|
8
65
|
app.get '/.well-known/agent.json' do
|
|
9
66
|
card = build_agent_card
|
|
10
67
|
content_type :json
|
|
@@ -44,58 +101,5 @@ module Legion
|
|
|
44
101
|
end
|
|
45
102
|
end
|
|
46
103
|
end
|
|
47
|
-
|
|
48
|
-
helpers do
|
|
49
|
-
def build_agent_card
|
|
50
|
-
name = begin
|
|
51
|
-
Legion::Settings[:client][:name]
|
|
52
|
-
rescue StandardError
|
|
53
|
-
'legion'
|
|
54
|
-
end
|
|
55
|
-
port = begin
|
|
56
|
-
settings.port || 4567
|
|
57
|
-
rescue StandardError
|
|
58
|
-
4567
|
|
59
|
-
end
|
|
60
|
-
{
|
|
61
|
-
name: name,
|
|
62
|
-
description: 'LegionIO digital worker',
|
|
63
|
-
url: "http://#{request.host}:#{port}/api/acp",
|
|
64
|
-
version: '2.0',
|
|
65
|
-
protocol: 'acp/1.0',
|
|
66
|
-
capabilities: discover_capabilities,
|
|
67
|
-
authentication: { schemes: ['bearer'] },
|
|
68
|
-
defaultInputModes: ['text/plain', 'application/json'],
|
|
69
|
-
defaultOutputModes: ['text/plain', 'application/json']
|
|
70
|
-
}
|
|
71
|
-
end
|
|
72
|
-
|
|
73
|
-
def discover_capabilities
|
|
74
|
-
if defined?(Legion::Extensions::Mesh::Helpers::Registry)
|
|
75
|
-
Legion::Extensions::Mesh::Helpers::Registry.new.capabilities.keys.map(&:to_s)
|
|
76
|
-
else
|
|
77
|
-
[]
|
|
78
|
-
end
|
|
79
|
-
rescue StandardError
|
|
80
|
-
[]
|
|
81
|
-
end
|
|
82
|
-
|
|
83
|
-
def find_task(id)
|
|
84
|
-
return nil unless defined?(Legion::Data)
|
|
85
|
-
|
|
86
|
-
Legion::Data::Model::Task[id.to_i]&.values
|
|
87
|
-
rescue StandardError
|
|
88
|
-
nil
|
|
89
|
-
end
|
|
90
|
-
|
|
91
|
-
def translate_status(status)
|
|
92
|
-
case status&.to_s
|
|
93
|
-
when /completed/ then 'completed'
|
|
94
|
-
when /exception|failed/ then 'failed'
|
|
95
|
-
when /queued|scheduled/ then 'queued'
|
|
96
|
-
else 'in_progress'
|
|
97
|
-
end
|
|
98
|
-
end
|
|
99
|
-
end
|
|
100
104
|
end
|
|
101
105
|
end
|
data/lib/legion/version.rb
CHANGED