swarm_cli 2.1.3 → 2.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: de6df6703665661e75ad0727c187c8fd20c1711b3dc24864bba27a4b9dd26ee1
4
- data.tar.gz: 2c58cabd8e53712d73e51df8492cbef03a2b1c34b68021b162ed57e0c8e8402d
3
+ metadata.gz: e122c7785e1681e7a88b131e9c62529c9a79eee0e99b1e7c83d0c510683eef35
4
+ data.tar.gz: '018d08703ab5b57a15945d7a39d26345b737587257cd88fbe0d240deca92b93d'
5
5
  SHA512:
6
- metadata.gz: a23fd6ace54fbbf1e61170f8c39752bb4e547d01f3870cd54b00ff1064a490cbd426b19e5a0b2e9b3bd6fac44f5e67244e54aa86820053d87ca9e2ce80a64ca2
7
- data.tar.gz: 463832c8cea0a8abdf252aa6485e0c70343e3ea4df6de37ba7addaa4e52bd41974425721415ce878ef5fe6b267ac067cb4cacb6b8e91e2d39fff2344c29f24f5
6
+ metadata.gz: d6c446656f75086772b6e59532057825c2ea6ee377d25335c32c757e0dcc7ac721acbf9a19ab2d31d386b63ec16a9746e819e64d424290f67957a79641238750
7
+ data.tar.gz: 8c4ffbfdba471398906de81bbba52ddb439f7a774145425e4bc555bdf8f0a6ad7c557d117181ecef140be45001c0057241c9e235fd3a2bc58055d5f407efb693
@@ -134,8 +134,8 @@ module SwarmCLI
134
134
 
135
135
  def emit_validation_warnings(swarm, formatter)
136
136
  # Setup temporary logging to capture and emit warnings
137
- SwarmSDK::LogCollector.on_log do |log_entry|
138
- formatter.on_log(log_entry) if log_entry[:type] == "model_lookup_warning"
137
+ SwarmSDK::LogCollector.subscribe(filter: { type: "model_lookup_warning" }) do |log_entry|
138
+ formatter.on_log(log_entry)
139
139
  end
140
140
 
141
141
  SwarmSDK::LogStream.emitter = SwarmSDK::LogCollector
@@ -5,7 +5,7 @@ module SwarmCLI
5
5
  #
6
6
  # Supports:
7
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
8
+ # - Ruby DSL files (.rb) - executed and expected to return a SwarmSDK::Swarm or SwarmSDK::Workflow instance
9
9
  #
10
10
  # @example Load YAML config
11
11
  # swarm = ConfigLoader.load("config.yml")
@@ -19,10 +19,10 @@ module SwarmCLI
19
19
  #
20
20
  # Detects file type by extension:
21
21
  # - .yml, .yaml -> Load as YAML using SwarmSDK.load_file
22
- # - .rb -> Execute as Ruby DSL and expect SwarmSDK::Swarm or SwarmSDK::NodeOrchestrator instance
22
+ # - .rb -> Execute as Ruby DSL and expect SwarmSDK::Swarm or SwarmSDK::Workflow instance
23
23
  #
24
24
  # @param path [String, Pathname] Path to configuration file
25
- # @return [SwarmSDK::Swarm, SwarmSDK::NodeOrchestrator] Configured swarm or orchestrator instance
25
+ # @return [SwarmSDK::Swarm, SwarmSDK::Workflow] Configured swarm or workflow 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
@@ -59,27 +59,27 @@ 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 or SwarmSDK::NodeOrchestrator instance. The file should
63
- # use SwarmSDK.build or create a Swarm/NodeOrchestrator instance directly.
62
+ # a SwarmSDK::Swarm or SwarmSDK::Workflow instance. The file should
63
+ # use SwarmSDK.build or SwarmSDK.workflow or create a Swarm/Workflow instance directly.
64
64
  #
65
65
  # @param path [Pathname] Path to Ruby DSL file
66
- # @return [SwarmSDK::Swarm, SwarmSDK::NodeOrchestrator] Configured swarm or orchestrator instance
66
+ # @return [SwarmSDK::Swarm, SwarmSDK::Workflow] Configured swarm or workflow instance
67
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
71
71
 
72
72
  # Execute in a clean binding with SwarmSDK available
73
- # This allows the DSL file to use SwarmSDK.build directly
73
+ # This allows the DSL file to use SwarmSDK.build or SwarmSDK.workflow directly
74
74
  result = eval(content, binding, path.to_s, 1) # rubocop:disable Security/Eval
75
75
 
76
- # Validate result is a Swarm or NodeOrchestrator instance
76
+ # Validate result is a Swarm or Workflow instance
77
77
  # Both have the same execute(prompt) interface
78
- unless result.is_a?(SwarmSDK::Swarm) || result.is_a?(SwarmSDK::NodeOrchestrator)
78
+ unless result.is_a?(SwarmSDK::Swarm) || result.is_a?(SwarmSDK::Workflow)
79
79
  raise ConfigurationError,
80
- "Ruby DSL file must return a SwarmSDK::Swarm or SwarmSDK::NodeOrchestrator instance. " \
80
+ "Ruby DSL file must return a SwarmSDK::Swarm or SwarmSDK::Workflow instance. " \
81
81
  "Got: #{result.class}. " \
82
- "Use: SwarmSDK.build { ... } or Swarm.new(...)"
82
+ "Use: SwarmSDK.build { ... } or SwarmSDK.workflow { ... }"
83
83
  end
84
84
 
85
85
  result
@@ -99,8 +99,6 @@ module SwarmCLI
99
99
  handle_llm_retry_attempt(entry)
100
100
  when "llm_retry_exhausted"
101
101
  handle_llm_retry_exhausted(entry)
102
- when "response_parse_error"
103
- handle_response_parse_error(entry)
104
102
  end
105
103
  end
106
104
 
@@ -647,37 +645,6 @@ module SwarmCLI
647
645
  )
648
646
  end
649
647
 
650
- def handle_response_parse_error(entry)
651
- agent = entry[:agent]
652
- error_class = entry[:error_class]
653
- error_message = entry[:error_message]
654
-
655
- # Stop agent thinking spinner (if active)
656
- unless @quiet
657
- spinner_key = "agent_#{agent}".to_sym
658
- @spinner_manager.stop(spinner_key) if @spinner_manager.active?(spinner_key)
659
- end
660
-
661
- lines = [
662
- @pastel.red("Failed to parse LLM API response"),
663
- @pastel.dim("Error: #{error_class}: #{error_message}"),
664
- ]
665
-
666
- # Add response body preview if available (truncated)
667
- if entry[:response_body]
668
- body_preview = entry[:response_body].to_s[0..200]
669
- body_preview += "..." if entry[:response_body].to_s.length > 200
670
- lines << @pastel.dim("Response: #{body_preview}")
671
- end
672
-
673
- @output.puts @panel.render(
674
- type: :error,
675
- title: "PARSE ERROR #{@agent_badge.render(agent)}",
676
- lines: lines,
677
- indent: @depth_tracker.get(agent),
678
- )
679
- end
680
-
681
648
  def display_todo_list(agent, timestamp)
682
649
  todos = SwarmSDK::Tools::Stores::TodoManager.get_todos(agent.to_sym)
683
650
  indent = @depth_tracker.indent(agent)
@@ -534,7 +534,7 @@ module SwarmCLI
534
534
  lead = @swarm.agent(@swarm.lead_agent)
535
535
 
536
536
  # Clear the agent's conversation history
537
- lead.reset_messages!
537
+ lead.replace_messages([])
538
538
 
539
539
  # Clear REPL conversation history
540
540
  @conversation_history.clear
@@ -575,7 +575,7 @@ module SwarmCLI
575
575
  case tool_name
576
576
  when /^Memory/, "LoadSkill"
577
577
  memory_tools << tool_name
578
- when /^DelegateTaskTo/
578
+ when /^WorkWith/
579
579
  delegation_tools << tool_name
580
580
  when /^mcp__/
581
581
  mcp_tools << tool_name
@@ -31,29 +31,6 @@ module SwarmCLI
31
31
  ARROW_RIGHT = "→"
32
32
  BULLET = "•"
33
33
  COMPRESS = "🗜️"
34
-
35
- # All icons as hash for backward compatibility
36
- ALL = {
37
- thinking: THINKING,
38
- response: RESPONSE,
39
- success: SUCCESS,
40
- error: ERROR,
41
- info: INFO,
42
- warning: WARNING,
43
- agent: AGENT,
44
- tool: TOOL,
45
- delegate: DELEGATE,
46
- result: RESULT,
47
- hook: HOOK,
48
- llm: LLM,
49
- tokens: TOKENS,
50
- cost: COST,
51
- time: TIME,
52
- sparkles: SPARKLES,
53
- arrow_right: ARROW_RIGHT,
54
- bullet: BULLET,
55
- compress: COMPRESS,
56
- }.freeze
57
34
  end
58
35
  end
59
36
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SwarmCLI
4
- VERSION = "2.1.3"
4
+ VERSION = "2.1.4"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: swarm_cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.3
4
+ version: 2.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paulo Arruda