agent-harness 0.19.0 → 0.20.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 35805e09786006c623325c10d579dc95c8be7863536ae52b0440332403f108da
4
- data.tar.gz: 162638a405a7b1cfadbd5d03396cd898142ecf4fa57a9d811726644c0329e485
3
+ metadata.gz: 7794b96e000b44164e63bbe2e8ee57acdc1a20044f47e56a623b866410371acf
4
+ data.tar.gz: 89f2f661af0a621c005cabfa1784c7b7419d06ad9a9b303654ea6e1d03977831
5
5
  SHA512:
6
- metadata.gz: b624b8380ae5d7e0759be8ef02b1affafff2180773172e4cd7d9d715678570d6e04d1090ffad50461c5d9a8500f756191a0c7705df042603d02d359dc45ac8e6
7
- data.tar.gz: 8c8de046b361f532a701d5121550fe41ce47b4f9bab3799b5754dfb7db01803a42e3f898782af8dfdf2e7b5d783f9981e42ddd95db7d3ccf3775a70e74272cf6
6
+ metadata.gz: 2c5bd53d4fe6eb1093b2c248a88b5e1556f706a1fb35564b11a3507f34eec271085fc5a0a4fc14ccc7dd25b7f709e01f04288a79ac5dc71e40aa9440043b574a
7
+ data.tar.gz: 1ebcbfe97039d0945066d35fcd080048c7d661b7992c6b43117c9eb13e54f1aff154253e4b960dba93a3679b432b79bafcb5a293c740e0e01750570dee642748
@@ -1,3 +1,3 @@
1
1
  {
2
- ".": "0.19.0"
2
+ ".": "0.20.1"
3
3
  }
data/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.20.1](https://github.com/viamin/agent-harness/compare/agent-harness/v0.20.0...agent-harness/v0.20.1) (2026-06-09)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * **anthropic:** --mcp-config space-form swallows the positional prompt (variadic flag) ([e52d38f](https://github.com/viamin/agent-harness/commit/e52d38fe97cdcc093860f4fda1de9e10c08f54c7))
9
+ * **anthropic:** use equals form for mcp config ([481d734](https://github.com/viamin/agent-harness/commit/481d734e389e66056bfc82d4dfeb31ba76ba1128))
10
+
11
+ ## [0.20.0](https://github.com/viamin/agent-harness/compare/agent-harness/v0.19.0...agent-harness/v0.20.0) (2026-05-30)
12
+
13
+
14
+ ### Features
15
+
16
+ * suppress Claude CLI .mcp.json auto-discovery when no MCP servers configured ([e07a25e](https://github.com/viamin/agent-harness/commit/e07a25e463becfd77da97058cb0a760eaec0920b))
17
+
3
18
  ## [0.19.0](https://github.com/viamin/agent-harness/compare/agent-harness/v0.18.2...agent-harness/v0.19.0) (2026-05-29)
4
19
 
5
20
 
@@ -183,7 +183,12 @@ module AgentHarness
183
183
  def parse_cli_json_envelope(json_string)
184
184
  return nil if json_string.nil? || json_string.empty?
185
185
 
186
- parsed = JSON.parse(json_string)
186
+ cleaned = json_string.lines.reject { |line|
187
+ line.include?('"type":"session.') || line.include?('"type": "session.')
188
+ }.join.strip
189
+ return nil if cleaned.empty?
190
+
191
+ parsed = JSON.parse(cleaned)
187
192
  return nil unless parsed.is_a?(Hash) && parsed.key?("result")
188
193
 
189
194
  output = parsed["result"]
@@ -415,10 +420,8 @@ module AgentHarness
415
420
  end
416
421
 
417
422
  def build_mcp_flags(mcp_servers, working_dir: nil)
418
- return [] if mcp_servers.empty?
419
-
420
423
  config_path = write_mcp_config_file(mcp_servers, working_dir: working_dir)
421
- ["--mcp-config", config_path]
424
+ ["--mcp-config=#{config_path}"]
422
425
  end
423
426
 
424
427
  def supports_tool_control?
@@ -583,9 +586,16 @@ module AgentHarness
583
586
 
584
587
  cmd += ["--print", "--output-format=json"]
585
588
 
586
- # Add model if specified
587
- if @config.model && !@config.model.empty?
588
- cmd += ["--model", @config.model]
589
+ # Add model if specified — prefer config, fall back to runtime override
590
+ runtime = options[:provider_runtime]
591
+ runtime = ProviderRuntime.wrap(runtime) if runtime.is_a?(Hash)
592
+ model = if @config.model && !@config.model.empty?
593
+ @config.model
594
+ else
595
+ runtime&.model
596
+ end
597
+ if model && !model.empty?
598
+ cmd += ["--model", model]
589
599
  end
590
600
 
591
601
  # Add permission mode for tool-disabled requests (belt-and-suspenders)
@@ -601,10 +611,10 @@ module AgentHarness
601
611
  cmd += dangerous_mode_flags
602
612
  end
603
613
 
604
- # Add MCP server flags (validated/normalized by Base#send_message)
605
- if options[:mcp_servers]&.any?
606
- cmd += build_mcp_flags(options[:mcp_servers])
607
- end
614
+ # Add MCP server flags (validated/normalized by Base#send_message).
615
+ # Always pass --mcp-config, even with an empty server list, to suppress
616
+ # the Claude CLI's auto-discovery of .mcp.json in the working directory.
617
+ cmd += build_mcp_flags(options[:mcp_servers] || [])
608
618
 
609
619
  # Add custom flags from config
610
620
  cmd += @config.default_flags if @config.default_flags&.any?
@@ -720,11 +730,20 @@ module AgentHarness
720
730
  def parse_json_output(output)
721
731
  return nil if output.nil? || output.empty?
722
732
 
723
- JSON.parse(output)
733
+ cleaned = strip_claude_streaming_events(output)
734
+ return nil if cleaned.empty?
735
+
736
+ JSON.parse(cleaned)
724
737
  rescue JSON::ParserError
725
738
  nil
726
739
  end
727
740
 
741
+ def strip_claude_streaming_events(output)
742
+ output.lines.reject { |line|
743
+ line.include?('"type":"session.') || line.include?('"type": "session.')
744
+ }.join.strip
745
+ end
746
+
728
747
  # Delegate to class-level implementations so both instance and class
729
748
  # methods share a single definition.
730
749
  def extract_envelope_metadata(parsed)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module AgentHarness
4
- VERSION = "0.19.0"
4
+ VERSION = "0.20.1"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: agent-harness
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.19.0
4
+ version: 0.20.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bart Agapinan