agent-harness 0.7.1 → 0.7.2

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: 840999010c09f5e1b70d3dd0a1631cf76e15a13738954cb2f259149f7e0df9c3
4
- data.tar.gz: 79f321a55d661a7f1a018372b8fea6b1c0f55ce659bfeb62a4937c2fd5852976
3
+ metadata.gz: c8c1873c6be023d4ab91659139b56b89552b8a0e89c101fed27ef0113c868434
4
+ data.tar.gz: 5bd2792791e5e7f1d8ee7cdd49b93bb9ee7c3d7e762914d2e3d4b4d8bfb014d2
5
5
  SHA512:
6
- metadata.gz: a2092406f7f5f75623eea7e3b4bc3c78c9fd7ffcd6f85b1e90a2e20bdc59f4b5f4bab5d7e9e8dee7fdf8772881e311c02cec7e555ce797c01b1ec7c3f482e023
7
- data.tar.gz: 3670198c4053fb94c3ec4e990cc4649b19977ccf5d7a5a6b3a95f1acb077f53c50055cd57098eda54b0fa1afaab0d1edff3429d4d0a55c3abf8137c4d846cda2
6
+ metadata.gz: e8530d91fec6ebddae4d0c8cb101a75c18df480ee15ae5006957576c20596ac199f0546a72e8d128dbcf8223eb39c7f7af6e7abe7aba05e67e27bda68c6b0bd5
7
+ data.tar.gz: 4ee7d860aa222170d8e3edd9319fd31eae0d174e571a8da0fae540b1fb5f6094c329ca0431a879f6d4927df7396e6a28aa2dedbae4467fa3d4cd8ed744829f34
@@ -1,3 +1,3 @@
1
1
  {
2
- ".": "0.7.1"
2
+ ".": "0.7.2"
3
3
  }
data/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.7.2](https://github.com/viamin/agent-harness/compare/agent-harness/v0.7.1...agent-harness/v0.7.2) (2026-04-15)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * 113: [P1] feat: support disabling tools for text-only send_message calls ([#115](https://github.com/viamin/agent-harness/issues/115)) ([62bc66a](https://github.com/viamin/agent-harness/commit/62bc66a3d34a889de65ba7c4951b8bdb1f388fa9))
9
+
3
10
  ## [0.7.1](https://github.com/viamin/agent-harness/compare/agent-harness/v0.7.0...agent-harness/v0.7.1) (2026-04-15)
4
11
 
5
12
 
@@ -717,6 +717,13 @@ module AgentHarness
717
717
  # @option options [Integer] :timeout timeout in seconds
718
718
  # @option options [String] :session session identifier
719
719
  # @option options [Boolean] :dangerous_mode skip permission checks
720
+ # @option options [Symbol, Array<String>, nil] :tools tool access control.
721
+ # Pass +:none+ to disable all tool access (pure text-in/text-out mode).
722
+ # Pass an Array of tool name strings to selectively disable specific
723
+ # tools via the provider's disallowed-tools mechanism. Defaults to +nil+
724
+ # (tools enabled, provider default behavior).
725
+ # Providers that do not support tool control will emit a warning and
726
+ # ignore this option — it is never a hard failure.
720
727
  # @option options [ProviderRuntime, Hash, nil] :provider_runtime per-request
721
728
  # runtime overrides (model, base_url, api_provider, env, flags, metadata).
722
729
  # For providers that delegate to Providers::Base#send_message, a plain Hash
@@ -839,6 +846,13 @@ module AgentHarness
839
846
  end
840
847
  end
841
848
 
849
+ # Check if provider supports tool access control (disabling tools)
850
+ #
851
+ # @return [Boolean] true if the provider supports the tools: option
852
+ def supports_tool_control?
853
+ false
854
+ end
855
+
842
856
  # Check if provider supports dangerous mode
843
857
  #
844
858
  # @return [Boolean] true if dangerous mode is supported
@@ -317,6 +317,10 @@ module AgentHarness
317
317
  ["--mcp-config", config_path]
318
318
  end
319
319
 
320
+ def supports_tool_control?
321
+ true
322
+ end
323
+
320
324
  def dangerous_mode_flags
321
325
  ["--dangerously-skip-permissions"]
322
326
  end
@@ -401,6 +405,22 @@ module AgentHarness
401
405
 
402
406
  protected
403
407
 
408
+ # All tools the Claude CLI exposes by default.
409
+ # Used to build the --disallowedTools list when tools: :none is requested.
410
+ ALL_CLI_TOOLS = %w[
411
+ Agent
412
+ Bash
413
+ Read
414
+ Edit
415
+ Write
416
+ Grep
417
+ Glob
418
+ WebFetch
419
+ WebSearch
420
+ TodoWrite
421
+ NotebookEdit
422
+ ].freeze
423
+
404
424
  def build_command(prompt, options)
405
425
  cmd = [self.class.binary_name]
406
426
 
@@ -411,6 +431,14 @@ module AgentHarness
411
431
  cmd += ["--model", @config.model]
412
432
  end
413
433
 
434
+ # Add permission mode for tool-disabled requests (belt-and-suspenders)
435
+ if options[:tools]
436
+ # Skip --permission-mode plan when dangerous_mode is active, since
437
+ # --dangerously-skip-permissions would override it anyway.
438
+ # The --disallowedTools flags still provide the primary protection.
439
+ cmd += build_tool_control_flags(options[:tools], skip_permission_mode: options[:dangerous_mode])
440
+ end
441
+
414
442
  # Add dangerous mode if requested
415
443
  if options[:dangerous_mode] && supports_dangerous_mode?
416
444
  cmd += dangerous_mode_flags
@@ -612,6 +640,23 @@ module AgentHarness
612
640
  end
613
641
  end
614
642
 
643
+ def build_tool_control_flags(tools_option, skip_permission_mode: false)
644
+ tool_names = case tools_option
645
+ when :none
646
+ ALL_CLI_TOOLS
647
+ when Array
648
+ tools_option
649
+ else
650
+ return []
651
+ end
652
+
653
+ return [] if tool_names.empty?
654
+
655
+ flags = tool_names.flat_map { |tool| ["--disallowedTools", tool] }
656
+ flags = ["--permission-mode", "plan"] + flags unless skip_permission_mode
657
+ flags
658
+ end
659
+
615
660
  def log_debug(action, **context)
616
661
  @logger&.debug("[AgentHarness::Anthropic] #{action}: #{context.inspect}")
617
662
  end
@@ -104,6 +104,17 @@ module AgentHarness
104
104
  def send_message(prompt:, **options)
105
105
  log_debug("send_message_start", prompt_length: prompt.length, options: options.keys)
106
106
 
107
+ # Warn when tools option is passed to a provider that doesn't support it
108
+ if options[:tools] && !supports_tool_control?
109
+ log_debug("tools_option_unsupported",
110
+ provider: self.class.provider_name,
111
+ tools: options[:tools])
112
+ @logger&.warn(
113
+ "[AgentHarness::#{self.class.provider_name}] tools option is not supported " \
114
+ "by this provider and will be ignored"
115
+ )
116
+ end
117
+
107
118
  # Coerce provider_runtime from Hash if needed
108
119
  options = normalize_provider_runtime(options)
109
120
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module AgentHarness
4
- VERSION = "0.7.1"
4
+ VERSION = "0.7.2"
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.7.1
4
+ version: 0.7.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bart Agapinan