claude_swarm 0.1.20 → 0.2.0
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/.rubocop.yml +9 -66
- data/.rubocop_todo.yml +11 -0
- data/CHANGELOG.md +93 -0
- data/CLAUDE.md +61 -0
- data/README.md +172 -15
- data/Rakefile +1 -1
- data/examples/mixed-provider-swarm.yml +23 -0
- data/lib/claude_swarm/claude_code_executor.rb +7 -12
- data/lib/claude_swarm/claude_mcp_server.rb +26 -12
- data/lib/claude_swarm/cli.rb +293 -165
- data/lib/claude_swarm/commands/ps.rb +22 -24
- data/lib/claude_swarm/commands/show.rb +45 -63
- data/lib/claude_swarm/configuration.rb +137 -8
- data/lib/claude_swarm/mcp_generator.rb +39 -14
- data/lib/claude_swarm/openai/chat_completion.rb +264 -0
- data/lib/claude_swarm/openai/executor.rb +301 -0
- data/lib/claude_swarm/openai/responses.rb +338 -0
- data/lib/claude_swarm/orchestrator.rb +205 -39
- data/lib/claude_swarm/process_tracker.rb +7 -7
- data/lib/claude_swarm/session_cost_calculator.rb +93 -0
- data/lib/claude_swarm/session_path.rb +3 -5
- data/lib/claude_swarm/system_utils.rb +1 -3
- data/lib/claude_swarm/tools/reset_session_tool.rb +24 -0
- data/lib/claude_swarm/tools/session_info_tool.rb +24 -0
- data/lib/claude_swarm/tools/task_tool.rb +43 -0
- data/lib/claude_swarm/version.rb +1 -1
- data/lib/claude_swarm/worktree_manager.rb +13 -20
- data/lib/claude_swarm.rb +23 -10
- data/single.yml +482 -6
- metadata +50 -16
- data/claude-swarm.yml +0 -64
- data/lib/claude_swarm/reset_session_tool.rb +0 -22
- data/lib/claude_swarm/session_info_tool.rb +0 -22
- data/lib/claude_swarm/task_tool.rb +0 -39
- /data/{example → examples}/claude-swarm.yml +0 -0
- /data/{example → examples}/microservices-team.yml +0 -0
- /data/{example → examples}/session-restoration-demo.yml +0 -0
- /data/{example → examples}/test-generation.yml +0 -0
@@ -1,8 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require "fast_mcp_annotations"
|
4
|
-
require "json"
|
5
|
-
|
6
3
|
module ClaudeSwarm
|
7
4
|
class ClaudeMcpServer
|
8
5
|
# Class variables to share state with tool classes
|
@@ -14,7 +11,9 @@ module ClaudeSwarm
|
|
14
11
|
@instance_config = instance_config
|
15
12
|
@calling_instance = calling_instance
|
16
13
|
@calling_instance_id = calling_instance_id
|
17
|
-
|
14
|
+
|
15
|
+
# Create appropriate executor based on provider
|
16
|
+
common_params = {
|
18
17
|
working_directory: instance_config[:directory],
|
19
18
|
model: instance_config[:model],
|
20
19
|
mcp_config: instance_config[:mcp_config_path],
|
@@ -24,8 +23,23 @@ module ClaudeSwarm
|
|
24
23
|
calling_instance: calling_instance,
|
25
24
|
calling_instance_id: calling_instance_id,
|
26
25
|
claude_session_id: instance_config[:claude_session_id],
|
27
|
-
additional_directories: instance_config[:directories][1..] || []
|
28
|
-
|
26
|
+
additional_directories: instance_config[:directories][1..] || [],
|
27
|
+
}
|
28
|
+
|
29
|
+
@executor = if instance_config[:provider] == "openai"
|
30
|
+
OpenAI::Executor.new(
|
31
|
+
**common_params,
|
32
|
+
# OpenAI-specific parameters
|
33
|
+
temperature: instance_config[:temperature],
|
34
|
+
api_version: instance_config[:api_version],
|
35
|
+
openai_token_env: instance_config[:openai_token_env],
|
36
|
+
base_url: instance_config[:base_url],
|
37
|
+
reasoning_effort: instance_config[:reasoning_effort],
|
38
|
+
)
|
39
|
+
else
|
40
|
+
# Default Claude behavior (existing code)
|
41
|
+
ClaudeCodeExecutor.new(**common_params)
|
42
|
+
end
|
29
43
|
|
30
44
|
# Set class variables so tools can access them
|
31
45
|
self.class.executor = @executor
|
@@ -45,20 +59,20 @@ module ClaudeSwarm
|
|
45
59
|
|
46
60
|
server = FastMcp::Server.new(
|
47
61
|
name: @instance_config[:name],
|
48
|
-
version: "1.0.0"
|
62
|
+
version: "1.0.0",
|
49
63
|
)
|
50
64
|
|
51
65
|
# Set dynamic description for TaskTool based on instance config
|
52
66
|
if @instance_config[:description]
|
53
|
-
TaskTool.description
|
67
|
+
Tools::TaskTool.description("Execute a task using Agent #{@instance_config[:name]}. #{@instance_config[:description]}")
|
54
68
|
else
|
55
|
-
TaskTool.description
|
69
|
+
Tools::TaskTool.description("Execute a task using Agent #{@instance_config[:name]}")
|
56
70
|
end
|
57
71
|
|
58
72
|
# Register tool classes (not instances)
|
59
|
-
server.register_tool(TaskTool)
|
60
|
-
server.register_tool(SessionInfoTool)
|
61
|
-
server.register_tool(ResetSessionTool)
|
73
|
+
server.register_tool(Tools::TaskTool)
|
74
|
+
server.register_tool(Tools::SessionInfoTool)
|
75
|
+
server.register_tool(Tools::ResetSessionTool)
|
62
76
|
|
63
77
|
# Start the stdio server
|
64
78
|
server.start
|