swarm_cli 2.1.0 → 2.1.2
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/lib/swarm_cli/commands/mcp_serve.rb +2 -2
- data/lib/swarm_cli/commands/mcp_tools.rb +3 -3
- data/lib/swarm_cli/config_loader.rb +14 -13
- data/lib/swarm_cli/version.rb +1 -1
- data/lib/swarm_cli.rb +2 -0
- 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: ce573683afe4e8fbb1d144984c0b476db2dac070f490a62b0b1e3b7b32a3622e
|
|
4
|
+
data.tar.gz: e4b3a5f950a7c007ed543f00d55603b17fad3db31748a4fdce6348de680764e7
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 53f75f25ffe8d8a531db038274fc1d5853a56271215eacded92dba259737f3cc2f3d61e9dd9cd20b8c8273884a7156638e6646b58fccd44ece644637a362ba16
|
|
7
|
+
data.tar.gz: 9298ef6cda98c97db7ff9fea9c5f2176a2285dbcc74a24ef729f43ac2cca04a803f3a9d38aed68f8900c45c95f2697c24038e96909362c25e0b932ebaab3d5eb
|
|
@@ -29,7 +29,7 @@ module SwarmCLI
|
|
|
29
29
|
|
|
30
30
|
# Validate the swarm configuration
|
|
31
31
|
begin
|
|
32
|
-
SwarmSDK
|
|
32
|
+
SwarmSDK.load_file(config_path)
|
|
33
33
|
rescue SwarmSDK::ConfigurationError => e
|
|
34
34
|
$stderr.puts "Error: Invalid swarm configuration: #{e.message}"
|
|
35
35
|
exit(1)
|
|
@@ -92,7 +92,7 @@ module SwarmCLI
|
|
|
92
92
|
|
|
93
93
|
define_method(:call) do |task:, description: nil, thinking_budget: nil|
|
|
94
94
|
# Load swarm for each execution (ensures fresh state)
|
|
95
|
-
swarm = SwarmSDK
|
|
95
|
+
swarm = SwarmSDK.load_file(self.class.config_path)
|
|
96
96
|
|
|
97
97
|
# Build prompt with thinking budget if provided
|
|
98
98
|
prompt = task
|
|
@@ -14,9 +14,9 @@ module SwarmCLI
|
|
|
14
14
|
|
|
15
15
|
def initialize(options)
|
|
16
16
|
@options = options
|
|
17
|
-
# Create scratchpad
|
|
18
|
-
|
|
19
|
-
@scratchpad = SwarmSDK::
|
|
17
|
+
# Create volatile scratchpad for MCP server
|
|
18
|
+
# Note: Scratchpad is always volatile - data is not persisted between sessions
|
|
19
|
+
@scratchpad = SwarmSDK::Tools::Stores::ScratchpadStorage.new
|
|
20
20
|
end
|
|
21
21
|
|
|
22
22
|
def execute
|
|
@@ -4,8 +4,8 @@ module SwarmCLI
|
|
|
4
4
|
# ConfigLoader handles loading swarm configurations from both YAML and Ruby DSL files.
|
|
5
5
|
#
|
|
6
6
|
# Supports:
|
|
7
|
-
# - YAML files (.yml, .yaml) - loaded via SwarmSDK
|
|
8
|
-
# - Ruby DSL files (.rb) - executed and expected to return a SwarmSDK::Swarm instance
|
|
7
|
+
# - YAML files (.yml, .yaml) - loaded via SwarmSDK.load_file
|
|
8
|
+
# - Ruby DSL files (.rb) - executed and expected to return a SwarmSDK::Swarm or SwarmSDK::NodeOrchestrator instance
|
|
9
9
|
#
|
|
10
10
|
# @example Load YAML config
|
|
11
11
|
# swarm = ConfigLoader.load("config.yml")
|
|
@@ -18,11 +18,11 @@ module SwarmCLI
|
|
|
18
18
|
# Load a swarm configuration from file (YAML or Ruby DSL)
|
|
19
19
|
#
|
|
20
20
|
# Detects file type by extension:
|
|
21
|
-
# - .yml, .yaml -> Load as YAML using SwarmSDK
|
|
22
|
-
# - .rb -> Execute as Ruby DSL and expect SwarmSDK::Swarm instance
|
|
21
|
+
# - .yml, .yaml -> Load as YAML using SwarmSDK.load_file
|
|
22
|
+
# - .rb -> Execute as Ruby DSL and expect SwarmSDK::Swarm or SwarmSDK::NodeOrchestrator instance
|
|
23
23
|
#
|
|
24
24
|
# @param path [String, Pathname] Path to configuration file
|
|
25
|
-
# @return [SwarmSDK::Swarm] Configured swarm instance
|
|
25
|
+
# @return [SwarmSDK::Swarm, SwarmSDK::NodeOrchestrator] Configured swarm or orchestrator instance
|
|
26
26
|
# @raise [SwarmCLI::ConfigurationError] If file not found or invalid format
|
|
27
27
|
def load(path)
|
|
28
28
|
path = Pathname.new(path).expand_path
|
|
@@ -50,7 +50,7 @@ module SwarmCLI
|
|
|
50
50
|
# @param path [Pathname] Path to YAML file
|
|
51
51
|
# @return [SwarmSDK::Swarm] Configured swarm instance
|
|
52
52
|
def load_yaml(path)
|
|
53
|
-
SwarmSDK
|
|
53
|
+
SwarmSDK.load_file(path.to_s)
|
|
54
54
|
rescue SwarmSDK::ConfigurationError => e
|
|
55
55
|
# Re-raise with CLI context
|
|
56
56
|
raise ConfigurationError, "Configuration error in #{path}: #{e.message}"
|
|
@@ -59,12 +59,12 @@ module SwarmCLI
|
|
|
59
59
|
# Load Ruby DSL configuration file
|
|
60
60
|
#
|
|
61
61
|
# Executes the Ruby file in a clean binding and expects it to return
|
|
62
|
-
# a SwarmSDK::Swarm instance. The file should
|
|
63
|
-
# create a Swarm instance directly.
|
|
62
|
+
# a SwarmSDK::Swarm or SwarmSDK::NodeOrchestrator instance. The file should
|
|
63
|
+
# use SwarmSDK.build or create a Swarm/NodeOrchestrator instance directly.
|
|
64
64
|
#
|
|
65
65
|
# @param path [Pathname] Path to Ruby DSL file
|
|
66
|
-
# @return [SwarmSDK::Swarm] Configured swarm instance
|
|
67
|
-
# @raise [ConfigurationError] If file doesn't return a
|
|
66
|
+
# @return [SwarmSDK::Swarm, SwarmSDK::NodeOrchestrator] Configured swarm or orchestrator instance
|
|
67
|
+
# @raise [ConfigurationError] If file doesn't return a valid instance
|
|
68
68
|
def load_ruby_dsl(path)
|
|
69
69
|
# Read the file content
|
|
70
70
|
content = path.read
|
|
@@ -73,10 +73,11 @@ module SwarmCLI
|
|
|
73
73
|
# This allows the DSL file to use SwarmSDK.build directly
|
|
74
74
|
result = eval(content, binding, path.to_s, 1) # rubocop:disable Security/Eval
|
|
75
75
|
|
|
76
|
-
# Validate result is a Swarm instance
|
|
77
|
-
|
|
76
|
+
# Validate result is a Swarm or NodeOrchestrator instance
|
|
77
|
+
# Both have the same execute(prompt) interface
|
|
78
|
+
unless result.is_a?(SwarmSDK::Swarm) || result.is_a?(SwarmSDK::NodeOrchestrator)
|
|
78
79
|
raise ConfigurationError,
|
|
79
|
-
"Ruby DSL file must return a SwarmSDK::Swarm instance. " \
|
|
80
|
+
"Ruby DSL file must return a SwarmSDK::Swarm or SwarmSDK::NodeOrchestrator instance. " \
|
|
80
81
|
"Got: #{result.class}. " \
|
|
81
82
|
"Use: SwarmSDK.build { ... } or Swarm.new(...)"
|
|
82
83
|
end
|
data/lib/swarm_cli/version.rb
CHANGED
data/lib/swarm_cli.rb
CHANGED
|
@@ -22,7 +22,9 @@ require_relative "swarm_cli/version"
|
|
|
22
22
|
|
|
23
23
|
require "zeitwerk"
|
|
24
24
|
loader = Zeitwerk::Loader.new
|
|
25
|
+
loader.tag = File.basename(__FILE__, ".rb")
|
|
25
26
|
loader.push_dir("#{__dir__}/swarm_cli", namespace: SwarmCLI)
|
|
27
|
+
loader.inflector = Zeitwerk::GemInflector.new(__FILE__)
|
|
26
28
|
loader.inflector.inflect(
|
|
27
29
|
"cli" => "CLI",
|
|
28
30
|
"ui" => "UI",
|