swarm_sdk 2.0.0.pre.2 → 2.0.1

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.
data/lib/swarm_sdk.rb CHANGED
@@ -48,6 +48,11 @@ module SwarmSDK
48
48
  # log level to suppress those messages, which is useful for CLI tools
49
49
  # that want clean output.
50
50
  #
51
+ # If model refresh fails (e.g., missing API keys, invalid keys, network
52
+ # unavailable), the error is silently caught and execution continues
53
+ # using the bundled models.json. This allows SwarmSDK to work offline
54
+ # and with dummy keys for local proxies.
55
+ #
51
56
  # @example
52
57
  # SwarmSDK.refresh_models_silently
53
58
  #
@@ -57,6 +62,11 @@ module SwarmSDK
57
62
  RubyLLM.logger.level = Logger::ERROR
58
63
 
59
64
  RubyLLM.models.refresh!
65
+ rescue StandardError => e
66
+ # Silently ignore all refresh failures
67
+ # Models will use bundled models.json instead
68
+ RubyLLM.logger.debug("Model refresh skipped: #{e.class} - #{e.message}")
69
+ nil
60
70
  ensure
61
71
  RubyLLM.logger.level = original_level
62
72
  end
@@ -67,3 +77,66 @@ module SwarmSDK
67
77
  end
68
78
  end
69
79
  end
80
+
81
+ # Automatically configure RubyLLM from environment variables
82
+ # This makes SwarmSDK "just work" when users set standard ENV variables
83
+ RubyLLM.configure do |config|
84
+ # Only set if config not already set (||= handles nil ENV values gracefully)
85
+
86
+ # OpenAI
87
+ config.openai_api_key ||= ENV["OPENAI_API_KEY"]
88
+ config.openai_api_base ||= ENV["OPENAI_API_BASE"]
89
+ config.openai_organization_id ||= ENV["OPENAI_ORG_ID"]
90
+ config.openai_project_id ||= ENV["OPENAI_PROJECT_ID"]
91
+
92
+ # Anthropic
93
+ config.anthropic_api_key ||= ENV["ANTHROPIC_API_KEY"]
94
+
95
+ # Google Gemini
96
+ config.gemini_api_key ||= ENV["GEMINI_API_KEY"]
97
+
98
+ # Google Vertex AI (note: vertexai, not vertex_ai)
99
+ config.vertexai_project_id ||= ENV["GOOGLE_CLOUD_PROJECT"] || ENV["VERTEXAI_PROJECT_ID"]
100
+ config.vertexai_location ||= ENV["GOOGLE_CLOUD_LOCATION"] || ENV["VERTEXAI_LOCATION"]
101
+
102
+ # DeepSeek
103
+ config.deepseek_api_key ||= ENV["DEEPSEEK_API_KEY"]
104
+
105
+ # Mistral
106
+ config.mistral_api_key ||= ENV["MISTRAL_API_KEY"]
107
+
108
+ # Perplexity
109
+ config.perplexity_api_key ||= ENV["PERPLEXITY_API_KEY"]
110
+
111
+ # OpenRouter
112
+ config.openrouter_api_key ||= ENV["OPENROUTER_API_KEY"]
113
+
114
+ # AWS Bedrock
115
+ config.bedrock_api_key ||= ENV["AWS_ACCESS_KEY_ID"]
116
+ config.bedrock_secret_key ||= ENV["AWS_SECRET_ACCESS_KEY"]
117
+ config.bedrock_region ||= ENV["AWS_REGION"]
118
+ config.bedrock_session_token ||= ENV["AWS_SESSION_TOKEN"]
119
+
120
+ # Ollama (local)
121
+ config.ollama_api_base ||= ENV["OLLAMA_API_BASE"]
122
+
123
+ # GPUStack (local)
124
+ config.gpustack_api_base ||= ENV["GPUSTACK_API_BASE"]
125
+ config.gpustack_api_key ||= ENV["GPUSTACK_API_KEY"]
126
+ end
127
+
128
+ # monkey patch ruby_llm/mcp to add `id` when sending "notifications/initialized" message
129
+ # https://github.com/patvice/ruby_llm-mcp/issues/65
130
+ require "ruby_llm/mcp/notifications/initialize"
131
+
132
+ module RubyLLM
133
+ module MCP
134
+ module Notifications
135
+ class Initialize
136
+ def call
137
+ @coordinator.request(notification_body, add_id: true, wait_for_response: false)
138
+ end
139
+ end
140
+ end
141
+ end
142
+ end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: swarm_sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0.pre.2
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paulo Arruda
8
- bindir: exe
8
+ bindir: bin
9
9
  cert_chain: []
10
- date: 2025-10-14 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: async
@@ -103,6 +103,11 @@ files:
103
103
  - lib/swarm_sdk/log_collector.rb
104
104
  - lib/swarm_sdk/log_stream.rb
105
105
  - lib/swarm_sdk/markdown_parser.rb
106
+ - lib/swarm_sdk/node/agent_config.rb
107
+ - lib/swarm_sdk/node/builder.rb
108
+ - lib/swarm_sdk/node/transformer_executor.rb
109
+ - lib/swarm_sdk/node_context.rb
110
+ - lib/swarm_sdk/node_orchestrator.rb
106
111
  - lib/swarm_sdk/permissions/config.rb
107
112
  - lib/swarm_sdk/permissions/error_formatter.rb
108
113
  - lib/swarm_sdk/permissions/path_matcher.rb
@@ -163,7 +168,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
163
168
  - !ruby/object:Gem::Version
164
169
  version: '0'
165
170
  requirements: []
166
- rubygems_version: 3.6.2
171
+ rubygems_version: 3.6.9
167
172
  specification_version: 4
168
173
  summary: Lightweight multi-agent AI orchestration using RubyLLM
169
174
  test_files: []