agent-harness 0.18.2 → 0.20.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ac0dc1fc90803175d52bbdd01e287c26cac5e2e19b65805390b5a2339fc0937f
4
- data.tar.gz: d892428011318adc0f716660914c03404463204f2e8d2e8bda399cc9c967c791
3
+ metadata.gz: f7d3dd9864119fc75abc2a4c7eebf2f2d6bf9239b6d02313fd63d15712074d5c
4
+ data.tar.gz: 9c8ac795a33027da1981fe170334a7456685c8f1f494d42680cc1e8c29f5cce9
5
5
  SHA512:
6
- metadata.gz: fba3f02f5616bf997f2b6c8264ed02abbf26fa7a83a5db143f98c980f0fdeafe2f2cb16de0d0987476e25e137e6717e39f1e7153ca994724251e478e793a6222
7
- data.tar.gz: cdcd6cfa27c6ad1ec3401c8dee63feabc6a3e4c15dc71cef3c54d1e063364c3791f6e49cbaef843bba15e6ee16ea1d11d465cc21600d6556e112397a0c39de56
6
+ metadata.gz: 446d1544846e9047c1cdd06f1d08ce50d4567fed6436efbdd4b3fcbfd6404c8203acdf508db2f3e2be3f04feb2cc6f54ff55c90f51f10edb27f413812c8a5c04
7
+ data.tar.gz: 0a0aed2a47548fce2007cca6aa351c2f675581d7340bb25853b3b306d622575a722be294c9e51be2c15e22b3d545d4106d179c562d98a61ad94a8d840fc4b9f5
@@ -1,3 +1,3 @@
1
1
  {
2
- ".": "0.18.2"
2
+ ".": "0.20.0"
3
3
  }
data/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.20.0](https://github.com/viamin/agent-harness/compare/agent-harness/v0.19.0...agent-harness/v0.20.0) (2026-05-30)
4
+
5
+
6
+ ### Features
7
+
8
+ * suppress Claude CLI .mcp.json auto-discovery when no MCP servers configured ([e07a25e](https://github.com/viamin/agent-harness/commit/e07a25e463becfd77da97058cb0a760eaec0920b))
9
+
10
+ ## [0.19.0](https://github.com/viamin/agent-harness/compare/agent-harness/v0.18.2...agent-harness/v0.19.0) (2026-05-29)
11
+
12
+
13
+ ### Features
14
+
15
+ * opencode-ai install contract should support postinstall (native binary download) ([b3eed97](https://github.com/viamin/agent-harness/commit/b3eed971b9bc46ce2bb2976b70dfd65b15ae5e9b))
16
+ * **opencode:** add requires_postinstall and postinstall_command to install contract ([d6808fd](https://github.com/viamin/agent-harness/commit/d6808fd62476289b199202b0c20c65fc4966bfcc)), closes [#223](https://github.com/viamin/agent-harness/issues/223)
17
+
3
18
  ## [0.18.2](https://github.com/viamin/agent-harness/compare/agent-harness/v0.18.1...agent-harness/v0.18.2) (2026-05-17)
4
19
 
5
20
 
@@ -22,7 +22,7 @@ module AgentHarness
22
22
  source = contract[:source]
23
23
  install_command = contract[:install_command]&.dup
24
24
 
25
- {
25
+ normalized = {
26
26
  provider: provider_name.to_sym,
27
27
  source_type: normalize_metadata_source_type(contract[:source_type] || source),
28
28
  package_name: metadata_package_name(contract, source),
@@ -35,6 +35,11 @@ module AgentHarness
35
35
  install_command: install_command,
36
36
  install_command_string: contract[:install_command_string] || install_command&.join(" ")
37
37
  }
38
+
39
+ normalized[:requires_postinstall] = contract[:requires_postinstall] if contract.key?(:requires_postinstall)
40
+ normalized[:postinstall_command] = contract[:postinstall_command] if contract.key?(:postinstall_command)
41
+
42
+ normalized
38
43
  end
39
44
 
40
45
  def self.normalize_metadata_source_type(source)
@@ -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,8 +420,6 @@ 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
424
  ["--mcp-config", config_path]
422
425
  end
@@ -601,10 +604,10 @@ module AgentHarness
601
604
  cmd += dangerous_mode_flags
602
605
  end
603
606
 
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
607
+ # Add MCP server flags (validated/normalized by Base#send_message).
608
+ # Always pass --mcp-config, even with an empty server list, to suppress
609
+ # the Claude CLI's auto-discovery of .mcp.json in the working directory.
610
+ cmd += build_mcp_flags(options[:mcp_servers] || [])
608
611
 
609
612
  # Add custom flags from config
610
613
  cmd += @config.default_flags if @config.default_flags&.any?
@@ -720,11 +723,20 @@ module AgentHarness
720
723
  def parse_json_output(output)
721
724
  return nil if output.nil? || output.empty?
722
725
 
723
- JSON.parse(output)
726
+ cleaned = strip_claude_streaming_events(output)
727
+ return nil if cleaned.empty?
728
+
729
+ JSON.parse(cleaned)
724
730
  rescue JSON::ParserError
725
731
  nil
726
732
  end
727
733
 
734
+ def strip_claude_streaming_events(output)
735
+ output.lines.reject { |line|
736
+ line.include?('"type":"session.') || line.include?('"type": "session.')
737
+ }.join.strip
738
+ end
739
+
728
740
  # Delegate to class-level implementations so both instance and class
729
741
  # methods share a single definition.
730
742
  def extract_envelope_metadata(parsed)
@@ -14,6 +14,7 @@ module AgentHarness
14
14
  SUPPORTED_CLI_REQUIREMENT = Gem::Requirement.new(">= #{SUPPORTED_CLI_VERSION}", "< 1.4.0").freeze
15
15
  INSTALL_COMMAND_PREFIX = ["npm", "install", "-g", "--ignore-scripts"].freeze
16
16
  SUPPORTED_CLI_VERSIONS = [SUPPORTED_CLI_VERSION].freeze
17
+ POSTINSTALL_COMMAND = "node $(npm root -g)/opencode-ai/postinstall.mjs"
17
18
  VERSION_REQUIREMENT_STRINGS = SUPPORTED_CLI_REQUIREMENT.requirements
18
19
  .map { |op, ver| "#{op} #{ver}".freeze }
19
20
  .freeze
@@ -89,6 +90,8 @@ module AgentHarness
89
90
  binary_name: binary_name,
90
91
  install_command_prefix: INSTALL_COMMAND_PREFIX,
91
92
  install_command: install_command,
93
+ requires_postinstall: true,
94
+ postinstall_command: POSTINSTALL_COMMAND,
92
95
  supported_versions: SUPPORTED_CLI_VERSIONS
93
96
  }
94
97
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module AgentHarness
4
- VERSION = "0.18.2"
4
+ VERSION = "0.20.0"
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.18.2
4
+ version: 0.20.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bart Agapinan
@@ -169,7 +169,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
169
169
  - !ruby/object:Gem::Version
170
170
  version: '0'
171
171
  requirements: []
172
- rubygems_version: 4.0.6
172
+ rubygems_version: 4.0.10
173
173
  specification_version: 4
174
174
  summary: Unified interface for CLI-based AI coding agents
175
175
  test_files: []