agent-harness 0.2.2 → 0.4.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 +4 -4
- data/.release-please-manifest.json +1 -1
- data/CHANGELOG.md +35 -0
- data/lib/agent_harness/command_executor.rb +3 -1
- data/lib/agent_harness/docker_command_executor.rb +74 -0
- data/lib/agent_harness/providers/base.rb +2 -1
- data/lib/agent_harness/version.rb +1 -1
- data/lib/agent_harness.rb +1 -0
- metadata +2 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a3f57fefa5527c5cdc436d4da8c10e5f638c69363b32e689213feb9bdccadf7d
|
|
4
|
+
data.tar.gz: ae98c1fc1f1a919adf7919f8d4dc0dc308286f1cb0e02d4a719d9060e29451b4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: eeafca1c0fe7183572056d50caf4e30f28e7a410a5fdb0f2bd3271ae3c0ef5a679f48c559266143a14cd03130de714a6e9af286d7e6e990eb8977fa3972c74df
|
|
7
|
+
data.tar.gz: c29ad51bcd248190e44d089d28daf6914a319a800536a3dfce25be6ad9b993a1582b6f317bf7df5f0989864c0a6b663cbb76de1921155b2c2f1aad10037bdd9e
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,40 @@
|
|
|
1
1
|
## [Unreleased]
|
|
2
2
|
|
|
3
|
+
## [0.4.0](https://github.com/viamin/agent-harness/compare/agent-harness/v0.3.0...agent-harness/v0.4.0) (2026-02-16)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* add DockerCommandExecutor for container-based command execution ([85826e5](https://github.com/viamin/agent-harness/commit/85826e5ece76d9f073329902769093f846cfd8b7))
|
|
9
|
+
* add DockerCommandExecutor for container-based command execution ([cb18f2e](https://github.com/viamin/agent-harness/commit/cb18f2e2f1d16ef52ea2ce54c51970d73fcae6c8))
|
|
10
|
+
|
|
11
|
+
## [0.3.0](https://github.com/viamin/agent-harness/compare/agent-harness-v0.2.2...agent-harness/v0.3.0) (2026-01-26)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Features
|
|
15
|
+
|
|
16
|
+
* initial extraction of agent-harness code from aidp ([a87e4ec](https://github.com/viamin/agent-harness/commit/a87e4ecfd50415bb2f4dacb5946cdd84160617bf))
|
|
17
|
+
* initial extraction of agent-harness code from aidp ([8563466](https://github.com/viamin/agent-harness/commit/856346661e06962d5b2c05710a4928f484526931))
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Bug Fixes
|
|
21
|
+
|
|
22
|
+
* add Gemfile.lock to extra-files in release-please config ([11fa4d7](https://github.com/viamin/agent-harness/commit/11fa4d7edd29e5c30ed4d074687097bc2db5d6fa))
|
|
23
|
+
* add Gemfile.lock to extra-files in release-please config ([e94f431](https://github.com/viamin/agent-harness/commit/e94f431fbee36da72ce768a14ed927728e197551))
|
|
24
|
+
* add workflow to update release-please lockfile automatically ([0c01f92](https://github.com/viamin/agent-harness/commit/0c01f92b26eb7f1aa12c5a71776b889756240f1f))
|
|
25
|
+
* remove extra-files configuration from release-please config ([3fa12df](https://github.com/viamin/agent-harness/commit/3fa12df710b6b6e6e0ec8f1f8da2de86bc3e8503))
|
|
26
|
+
* remove update-release-please-lockfile workflow ([5482b8d](https://github.com/viamin/agent-harness/commit/5482b8d9a285de03bfc227f598ff917785baf5a1))
|
|
27
|
+
* remove update-release-please-lockfile workflow ([1ef7268](https://github.com/viamin/agent-harness/commit/1ef7268616bf1f56f466a0b4b36edc8a815f0ee8))
|
|
28
|
+
* update .gitignore to include /vendor/bundle/ and remove Gemfile.… ([beba6aa](https://github.com/viamin/agent-harness/commit/beba6aa197363a3375df4370e891010ac56bb6b0))
|
|
29
|
+
* update .gitignore to include /vendor/bundle/ and remove Gemfile.lock from release-please config ([cb15c77](https://github.com/viamin/agent-harness/commit/cb15c77b1fef400451be9542321e10f2f8d766af))
|
|
30
|
+
* update agent-harness version in Gemfile.lock to 0.2.1 ([32ff4e4](https://github.com/viamin/agent-harness/commit/32ff4e4f95173fafa196345c69dd0b38b113d928))
|
|
31
|
+
* update release-please config to include Gemfile.lock as extra file ([be91fff](https://github.com/viamin/agent-harness/commit/be91fff227cc56c0fd9850ac54a2bec09755f8d6))
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
### Improvements
|
|
35
|
+
|
|
36
|
+
* streamline command execution and error handling in various modules ([7f0e50c](https://github.com/viamin/agent-harness/commit/7f0e50c9dc00e8b2a81af8738f46fb894b629a2f))
|
|
37
|
+
|
|
3
38
|
## [0.2.2](https://github.com/viamin/agent-harness/compare/agent-harness/v0.2.1...agent-harness/v0.2.2) (2026-01-26)
|
|
4
39
|
|
|
5
40
|
|
|
@@ -87,7 +87,7 @@ module AgentHarness
|
|
|
87
87
|
!which(binary).nil?
|
|
88
88
|
end
|
|
89
89
|
|
|
90
|
-
|
|
90
|
+
protected
|
|
91
91
|
|
|
92
92
|
def normalize_command(command)
|
|
93
93
|
case command
|
|
@@ -100,6 +100,8 @@ module AgentHarness
|
|
|
100
100
|
end
|
|
101
101
|
end
|
|
102
102
|
|
|
103
|
+
private
|
|
104
|
+
|
|
103
105
|
def execute_with_timeout(cmd_array, timeout:, env:, stdin_data:)
|
|
104
106
|
stdout = ""
|
|
105
107
|
stderr = ""
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module AgentHarness
|
|
4
|
+
# Executes commands inside a Docker container
|
|
5
|
+
#
|
|
6
|
+
# Wraps commands with `docker exec` so they run inside
|
|
7
|
+
# the specified container rather than on the host.
|
|
8
|
+
#
|
|
9
|
+
# @example Basic usage
|
|
10
|
+
# executor = AgentHarness::DockerCommandExecutor.new(container_id: "abc123")
|
|
11
|
+
# result = executor.execute(["python", "script.py"])
|
|
12
|
+
#
|
|
13
|
+
# @example With environment variables
|
|
14
|
+
# result = executor.execute("echo $FOO", env: { "FOO" => "bar" })
|
|
15
|
+
class DockerCommandExecutor < CommandExecutor
|
|
16
|
+
attr_reader :container_id
|
|
17
|
+
|
|
18
|
+
# Initialize the Docker command executor
|
|
19
|
+
#
|
|
20
|
+
# @param container_id [String] the Docker container ID or name
|
|
21
|
+
# @param logger [Logger, nil] optional logger
|
|
22
|
+
# @raise [CommandExecutionError] if Docker CLI is not found on the host
|
|
23
|
+
def initialize(container_id:, logger: nil)
|
|
24
|
+
raise ArgumentError, "container_id cannot be nil or empty" if container_id.nil? || container_id.empty?
|
|
25
|
+
|
|
26
|
+
super(logger: logger)
|
|
27
|
+
@container_id = container_id
|
|
28
|
+
validate_docker!
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
# Execute a command inside the Docker container
|
|
32
|
+
#
|
|
33
|
+
# Wraps the given command with `docker exec` and delegates
|
|
34
|
+
# to the parent class for actual process execution.
|
|
35
|
+
#
|
|
36
|
+
# @param command [Array<String>, String] command to execute
|
|
37
|
+
# @param timeout [Integer, nil] timeout in seconds
|
|
38
|
+
# @param env [Hash] environment variables to set in the container
|
|
39
|
+
# @param stdin_data [String, nil] data to send to stdin
|
|
40
|
+
# @return [Result] execution result
|
|
41
|
+
def execute(command, timeout: nil, env: {}, stdin_data: nil)
|
|
42
|
+
docker_cmd = build_docker_command(command, env: env, stdin_data: stdin_data)
|
|
43
|
+
super(docker_cmd, timeout: timeout, env: {}, stdin_data: stdin_data)
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
# Check if a binary exists inside the container
|
|
47
|
+
#
|
|
48
|
+
# @param binary [String] binary name
|
|
49
|
+
# @return [String, nil] full path or nil
|
|
50
|
+
def which(binary)
|
|
51
|
+
result = execute(["which", binary], timeout: 5)
|
|
52
|
+
result.success? ? result.stdout.strip : nil
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
private
|
|
56
|
+
|
|
57
|
+
def validate_docker!
|
|
58
|
+
return if ENV["PATH"]&.split(File::PATH_SEPARATOR)&.any? { |path| File.executable?(File.join(path, "docker")) }
|
|
59
|
+
|
|
60
|
+
raise CommandExecutionError, "Docker CLI not found on host PATH"
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
def build_docker_command(command, env:, stdin_data:)
|
|
64
|
+
cmd = ["docker", "exec"]
|
|
65
|
+
|
|
66
|
+
env.each { |key, value| cmd.push("--env", "#{key}=#{value}") }
|
|
67
|
+
cmd.push("-i") if stdin_data
|
|
68
|
+
|
|
69
|
+
cmd.push(@container_id)
|
|
70
|
+
|
|
71
|
+
cmd.concat(normalize_command(command))
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
end
|
data/lib/agent_harness.rb
CHANGED
|
@@ -89,6 +89,7 @@ end
|
|
|
89
89
|
require_relative "agent_harness/errors"
|
|
90
90
|
require_relative "agent_harness/configuration"
|
|
91
91
|
require_relative "agent_harness/command_executor"
|
|
92
|
+
require_relative "agent_harness/docker_command_executor"
|
|
92
93
|
require_relative "agent_harness/response"
|
|
93
94
|
require_relative "agent_harness/token_tracker"
|
|
94
95
|
require_relative "agent_harness/error_taxonomy"
|
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.
|
|
4
|
+
version: 0.4.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Bart Agapinan
|
|
@@ -78,6 +78,7 @@ files:
|
|
|
78
78
|
- lib/agent_harness.rb
|
|
79
79
|
- lib/agent_harness/command_executor.rb
|
|
80
80
|
- lib/agent_harness/configuration.rb
|
|
81
|
+
- lib/agent_harness/docker_command_executor.rb
|
|
81
82
|
- lib/agent_harness/error_taxonomy.rb
|
|
82
83
|
- lib/agent_harness/errors.rb
|
|
83
84
|
- lib/agent_harness/orchestration/circuit_breaker.rb
|