lex-swarm 0.2.3 → 0.2.4
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/swarm/actors/orphan_sweeper.rb +1 -1
- data/lib/legion/extensions/swarm/actors/stale_check.rb +1 -1
- data/lib/legion/extensions/swarm/helpers/sub_agent.rb +5 -5
- data/lib/legion/extensions/swarm/helpers/workspace_sync.rb +5 -5
- data/lib/legion/extensions/swarm/runners/spawn_child.rb +1 -1
- data/lib/legion/extensions/swarm/runners/swarm.rb +3 -3
- data/lib/legion/extensions/swarm/runners/workspace.rb +2 -2
- data/lib/legion/extensions/swarm/version.rb +1 -1
- data/lib/legion/extensions/swarm.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: 872cfd908e1911c140ec4fa764f8d992c468e0fc258aceb709551254f2723111
|
|
4
|
+
data.tar.gz: f55c01c18b5a46c1c704f626c9b23b8d15312d86467507739cf7fda934386295
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d874292dcff40204e4af91353e0b2b99e02a87282219f949d2000aadce61a47267e44553e6d33a3badc392f9e5fd697c2f90089080ce43d4ea6ed1823d828014
|
|
7
|
+
data.tar.gz: 0eb4bad49126b2864f2258340e01518796d8664585c7502ab66f9d6c97c75c896302a0bb9ecfe45701bcb72f45ee55b59c7495143ca385eaad62d0906539060a
|
data/Gemfile
CHANGED
|
@@ -4,7 +4,7 @@ module Legion
|
|
|
4
4
|
module Extensions
|
|
5
5
|
module Swarm
|
|
6
6
|
module Actor
|
|
7
|
-
class OrphanSweeper < Legion::Extensions::Actors::Every
|
|
7
|
+
class OrphanSweeper < Legion::Extensions::Actors::Every # rubocop:disable Legion/Extension/EveryActorRequiresTime
|
|
8
8
|
def time = 300
|
|
9
9
|
def run_now? = false
|
|
10
10
|
def use_runner? = false
|
|
@@ -6,7 +6,7 @@ module Legion
|
|
|
6
6
|
module Extensions
|
|
7
7
|
module Swarm
|
|
8
8
|
module Actor
|
|
9
|
-
class StaleCheck < Legion::Extensions::Actors::Every
|
|
9
|
+
class StaleCheck < Legion::Extensions::Actors::Every # rubocop:disable Legion/Extension/EveryActorRequiresTime
|
|
10
10
|
def runner_class
|
|
11
11
|
Legion::Extensions::Swarm::Runners::Swarm
|
|
12
12
|
end
|
|
@@ -38,19 +38,19 @@ module Legion
|
|
|
38
38
|
|
|
39
39
|
def max_depth
|
|
40
40
|
Legion::Settings.dig(:swarm, :max_depth) || 3
|
|
41
|
-
rescue StandardError
|
|
41
|
+
rescue StandardError => _e
|
|
42
42
|
3
|
|
43
43
|
end
|
|
44
44
|
|
|
45
45
|
def max_concurrent
|
|
46
46
|
Legion::Settings.dig(:swarm, :max_concurrent) || 20
|
|
47
|
-
rescue StandardError
|
|
47
|
+
rescue StandardError => _e
|
|
48
48
|
20
|
|
49
49
|
end
|
|
50
50
|
|
|
51
51
|
def max_per_parent
|
|
52
52
|
Legion::Settings.dig(:swarm, :max_per_parent) || 10
|
|
53
|
-
rescue StandardError
|
|
53
|
+
rescue StandardError => _e
|
|
54
54
|
10
|
|
55
55
|
end
|
|
56
56
|
|
|
@@ -61,7 +61,7 @@ module Legion
|
|
|
61
61
|
.exclude(parent_id: nil)
|
|
62
62
|
.exclude(status: %w[complete failed])
|
|
63
63
|
.count
|
|
64
|
-
rescue StandardError
|
|
64
|
+
rescue StandardError => _e
|
|
65
65
|
0
|
|
66
66
|
end
|
|
67
67
|
|
|
@@ -72,7 +72,7 @@ module Legion
|
|
|
72
72
|
.where(parent_id: parent_task_id)
|
|
73
73
|
.exclude(status: %w[complete failed])
|
|
74
74
|
.count
|
|
75
|
-
rescue StandardError
|
|
75
|
+
rescue StandardError => _e
|
|
76
76
|
0
|
|
77
77
|
end
|
|
78
78
|
end
|
|
@@ -8,13 +8,13 @@ module Legion
|
|
|
8
8
|
module Swarm
|
|
9
9
|
module Helpers
|
|
10
10
|
class WorkspaceSync
|
|
11
|
-
include Legion::Extensions::Helpers::Lex if Legion::Extensions.const_defined?(:Helpers) &&
|
|
12
|
-
Legion::Extensions::Helpers.const_defined?(:Lex)
|
|
11
|
+
include Legion::Extensions::Helpers::Lex if Legion::Extensions.const_defined?(:Helpers, false) &&
|
|
12
|
+
Legion::Extensions::Helpers.const_defined?(:Lex, false)
|
|
13
13
|
|
|
14
14
|
ROUTING_PREFIX = 'swarm.workspace'
|
|
15
15
|
|
|
16
|
-
def publish_change(charter_id:, key:, operation:, value: nil, author: nil, version: nil, **)
|
|
17
|
-
return { success: true, skipped: :no_transport } unless
|
|
16
|
+
def publish_change(charter_id:, key:, operation:, value: nil, author: nil, version: nil, **)
|
|
17
|
+
return { success: true, skipped: :no_transport } unless Legion.const_defined?(:Transport, false)
|
|
18
18
|
|
|
19
19
|
routing_key = "#{ROUTING_PREFIX}.#{charter_id}"
|
|
20
20
|
payload = { charter_id: charter_id, key: key, value: value,
|
|
@@ -29,7 +29,7 @@ module Legion
|
|
|
29
29
|
{ success: true, skipped: :publish_error, message: e.message }
|
|
30
30
|
end
|
|
31
31
|
|
|
32
|
-
def apply_incoming(charter_id:, key:, operation:, value: nil, author: nil, version: nil, timestamp: nil, **)
|
|
32
|
+
def apply_incoming(charter_id:, key:, operation:, value: nil, author: nil, version: nil, timestamp: nil, **)
|
|
33
33
|
op = operation.to_s
|
|
34
34
|
case op
|
|
35
35
|
when 'put'
|
|
@@ -4,7 +4,7 @@ module Legion
|
|
|
4
4
|
module Extensions
|
|
5
5
|
module Swarm
|
|
6
6
|
module Runners
|
|
7
|
-
module SpawnChild
|
|
7
|
+
module SpawnChild # rubocop:disable Legion/Extension/RunnerIncludeHelpers
|
|
8
8
|
include Helpers::SubAgent if defined?(Helpers::SubAgent)
|
|
9
9
|
|
|
10
10
|
def spawn_child(runner:, function:, payload:, parent_task_id:, **)
|
|
@@ -5,10 +5,10 @@ module Legion
|
|
|
5
5
|
module Swarm
|
|
6
6
|
module Runners
|
|
7
7
|
module Swarm
|
|
8
|
-
include Legion::Extensions::Helpers::Lex if Legion::Extensions.const_defined?(:Helpers) &&
|
|
9
|
-
Legion::Extensions::Helpers.const_defined?(:Lex)
|
|
8
|
+
include Legion::Extensions::Helpers::Lex if Legion::Extensions.const_defined?(:Helpers, false) &&
|
|
9
|
+
Legion::Extensions::Helpers.const_defined?(:Lex, false)
|
|
10
10
|
|
|
11
|
-
def create_swarm(name:, objective:, roles: [], max_agents: 10, timeout: 3600, **)
|
|
11
|
+
def create_swarm(name:, objective:, roles: [], max_agents: 10, timeout: 3600, **)
|
|
12
12
|
charter = Helpers::Charter.new_charter(name: name, objective: objective,
|
|
13
13
|
roles: roles, max_agents: max_agents, timeout: timeout)
|
|
14
14
|
id = swarm_store.create(charter)
|
|
@@ -7,8 +7,8 @@ module Legion
|
|
|
7
7
|
module Swarm
|
|
8
8
|
module Runners
|
|
9
9
|
module Workspace
|
|
10
|
-
include Legion::Extensions::Helpers::Lex if Legion::Extensions.const_defined?(:Helpers) &&
|
|
11
|
-
Legion::Extensions::Helpers.const_defined?(:Lex)
|
|
10
|
+
include Legion::Extensions::Helpers::Lex if Legion::Extensions.const_defined?(:Helpers, false) &&
|
|
11
|
+
Legion::Extensions::Helpers.const_defined?(:Lex, false)
|
|
12
12
|
|
|
13
13
|
def workspace_put(charter_id:, key:, value:, author:, **)
|
|
14
14
|
entry = workspace.put(charter_id, key: key, value: value, author: author)
|
|
@@ -12,7 +12,7 @@ require 'legion/extensions/swarm/runners/workspace'
|
|
|
12
12
|
module Legion
|
|
13
13
|
module Extensions
|
|
14
14
|
module Swarm
|
|
15
|
-
extend Legion::Extensions::Core if Legion::Extensions.const_defined? :Core
|
|
15
|
+
extend Legion::Extensions::Core if Legion::Extensions.const_defined? :Core, false
|
|
16
16
|
end
|
|
17
17
|
end
|
|
18
18
|
end
|