ace-herdr 0.10.0 → 0.11.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: 204e5cf8135c02f3feea7086b05a2b3dad61470261dbd526a05b900dd1f5e558
4
- data.tar.gz: b362791611a61f9340055ad044383dd4585b2d5821ffc1d28a4e7356dd6ab6b1
3
+ metadata.gz: 8d943e508273e1c9dfc0bd77d83a0e9330ae304a6cd61fcae7bf087a0af68b69
4
+ data.tar.gz: 2249f16cb6ac3c97d8eec2bbdd08824c2677ef78308999ab8ccbc1e929ca6eb6
5
5
  SHA512:
6
- metadata.gz: 8c564329116783969ae79dc7256f8a414591e308d18b3b8772b751ac1efea5d07b8f4758ee34b23134b50631a571e01d48d7872b20c8510fb637d019f6889b42
7
- data.tar.gz: 7a1be61896fff3f5ca58c7ee00d2c4fa0633e935805c2cd466ceaad12b4a4a3bf04cbf02d7cca7bd43bf3edf28196feb190b14e3282fe736a8e6137e5918a45f
6
+ metadata.gz: f60685eece841a9cd687aa7919f202bba69420ef98e9f267777ac671f309446d72e564154b0e882a8789827f5240820b9c6671efe508ed11432691ff95842600
7
+ data.tar.gz: 7df3e0ceade17e6a326971f4ada8bb591822422d0b50449a74bc96732ca8629f1ac77abbffe1b3725ffca41a89a682de02581ecd1ab3825e1ab5e83f83f5f5df
data/CHANGELOG.md CHANGED
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.11.0] - 2026-11-11
11
+
12
+ ### Added
13
+
14
+ - Add ace-herdr start using native configuration; apply configured binary, socket, native config and toolchain consistently to startup and agent dispatch, including managed Pi extensions.
15
+
10
16
  ## [0.10.0] - 2026-11-10
11
17
 
12
18
  ### Added
data/docs/start.md ADDED
@@ -0,0 +1,37 @@
1
+ # Start from configuration
2
+
3
+ `ace-herdr start` starts or attaches to the native persistent Herdr terminal.
4
+ It replaces the invoking process, retaining the terminal and native exit status.
5
+ Native Herdr owns its server lifecycle and terminal state.
6
+
7
+ Configure the existing `herdr` namespace, for example in `~/.ace/herdr/config.yml`:
8
+
9
+ ```yaml
10
+ binary: /opt/ace/runtime/bin/herdr
11
+ socket: /home/mo/.config/herdr/herdr.sock
12
+ toolchain: installed
13
+ ```
14
+
15
+ `native_config` optionally selects the native TOML configuration file. Omit it
16
+ to use Herdr's normal configuration path. `binary` defaults to `herdr` on PATH.
17
+ The same configuration is applied by ACE's native executor, including commands
18
+ issued by the overseer. An inherited `ACE_TOOLCHAIN=installed` cannot be downgraded
19
+ by configuration. Installed Linux starts check the declared managed Pi extension
20
+ paths before launching; a missing extension is an error, not a source fallback.
21
+
22
+ ```sh
23
+ ace-herdr start
24
+ ```
25
+
26
+ No shell profile needs to be sourced manually. In the terminal, run the configured
27
+ overseer. For a lab coordinator started from a separate operator terminal:
28
+
29
+ ```sh
30
+ cd /lab
31
+ ace-overseer start --scope lab --format json
32
+ ```
33
+
34
+ Overseer configuration should declare `toolchain: installed`; its existing
35
+ `start`, `profiles` and instruction configuration still select the role/model.
36
+ Session credentials and child runtime paths come from the lab's existing role
37
+ configuration. The configured session-runtime socket must match Herdr's socket.
@@ -0,0 +1,39 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "ace/support/cli"
4
+ require_relative "support"
5
+
6
+ module Ace
7
+ module Herdr
8
+ module CLI
9
+ module Commands
10
+ # Native Herdr owns its configuration and persistent terminal lifecycle.
11
+ # Replace this process so the caller retains the terminal and exit status.
12
+ class Start < Ace::Support::Cli::Command
13
+ include Ace::Support::Cli::Base
14
+ include Runtime
15
+
16
+ desc "Start or attach to Herdr using its native configuration"
17
+
18
+ def initialize(launcher: nil, configuration: nil)
19
+ @launcher = launcher || ->(environment, binary) { Kernel.exec(environment, binary) }
20
+ @configuration = configuration
21
+ end
22
+
23
+ def call(**)
24
+ configuration = @configuration || config
25
+ binary = configuration.fetch("binary", "herdr")
26
+ unless binary.is_a?(String) && !binary.empty? && !binary.include?("\0")
27
+ cli_error("herdr binary must be a nonempty executable path")
28
+ end
29
+ environment = Molecules::HerdrExecutor.environment(configuration)
30
+ Molecules::InstalledPiExtensions.arguments(env: ENV.to_h.merge(environment))
31
+ @launcher.call(environment, binary)
32
+ rescue SystemCallError, Ace::Herdr::ExecutorError => e
33
+ cli_error("Cannot start Herdr: #{e.message}")
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
data/lib/ace/herdr/cli.rb CHANGED
@@ -11,6 +11,7 @@ require_relative "cli/commands/close"
11
11
  require_relative "cli/commands/tidy"
12
12
  require_relative "cli/commands/list"
13
13
  require_relative "cli/commands/status"
14
+ require_relative "cli/commands/start"
14
15
  require_relative "cli/commands/send"
15
16
  require_relative "cli/commands/capture"
16
17
  require_relative "cli/commands/workspace"
@@ -28,6 +29,7 @@ module Ace
28
29
 
29
30
  # Application commands with descriptions (for help output)
30
31
  REGISTERED_COMMANDS = [
32
+ ["start", "Start or attach to Herdr using its native configuration"],
31
33
  ["deliver", "Push an answer to an agent pane (ace-hitl delivery contract)"],
32
34
  ["inbox", "Durable agent message queue and reconciliation"],
33
35
  ["dispatch", "Start an agent in one command: tab + agent + prompt"],
@@ -77,6 +79,7 @@ module Ace
77
79
  register "native-source", CLI::Commands::NativeSource.new
78
80
  register "list", CLI::Commands::List.new
79
81
  register "status", CLI::Commands::Status.new
82
+ register "start", CLI::Commands::Start.new
80
83
  register "send", CLI::Commands::Send.new
81
84
  register "capture", CLI::Commands::Capture.new
82
85
  register "wait", CLI::Commands::Wait.new
@@ -19,8 +19,26 @@ module Ace
19
19
  WAKE_OUTPUT_LIMIT = 65_536
20
20
  DEFAULT_PROBE_TIMEOUT_S = 60
21
21
 
22
- def initialize(binary: DEFAULT_BINARY, process: BoundedProcess)
23
- @binary = binary
22
+ def self.environment(config)
23
+ {"socket" => "HERDR_SOCKET_PATH", "native_config" => "HERDR_CONFIG_PATH", "toolchain" => "ACE_TOOLCHAIN"}
24
+ .each_with_object({}) do |(key, variable), environment|
25
+ next unless config.key?(key)
26
+ value = config.fetch(key)
27
+ unless value.is_a?(String) && !value.empty? && !value.include?("\0")
28
+ raise ExecutorUnavailableError, "invalid Herdr configuration: #{key}"
29
+ end
30
+ if key == "toolchain"
31
+ raise ExecutorUnavailableError, "toolchain must be auto or installed" unless %w[auto installed].include?(value)
32
+ value = "installed" if ENV["ACE_TOOLCHAIN"] == "installed"
33
+ end
34
+ environment[variable] = value
35
+ end
36
+ end
37
+
38
+ def initialize(binary: nil, process: BoundedProcess, config: nil)
39
+ config ||= Ace::Herdr.config
40
+ @binary = binary || config.fetch("binary", DEFAULT_BINARY)
41
+ @environment = self.class.environment(config)
24
42
  @process = process
25
43
  end
26
44
 
@@ -38,7 +56,7 @@ module Ace
38
56
  # killed at the deadline and the timeout classifies as a retryable
39
57
  # pre-submission failure.
40
58
  def pane_get_bounded(pane, timeout_s: DEFAULT_PROBE_TIMEOUT_S)
41
- result = @process.call([@binary, "pane", "get", pane], stdin_data: "",
59
+ result = @process.call(native_command([@binary, "pane", "get", pane]), stdin_data: "",
42
60
  timeout_s: timeout_s, output_limit: WAKE_OUTPUT_LIMIT)
43
61
  execution = ExecutionResult.new(
44
62
  stdout: result.stdout.strip, stderr: result.stderr.strip,
@@ -61,7 +79,7 @@ module Ace
61
79
  # after `--` (e.g. pi's --model/--thinking/--append-system-prompt;
62
80
  # the overseer start contract, 8xs.t.pu0.1).
63
81
  def agent_start(name:, kind:, pane:, timeout_ms:, args: [], env_file: nil)
64
- managed = kind == "pi" ? InstalledPiExtensions.arguments : []
82
+ managed = kind == "pi" ? InstalledPiExtensions.arguments(env: ENV.to_h.merge(@environment)) : []
65
83
  InstalledPiExtensions.reject_override!(args) unless managed.empty?
66
84
  args = managed + args
67
85
  cmd = [@binary, "agent", "start", name, "--kind", kind,
@@ -92,7 +110,7 @@ module Ace
92
110
  # keep the inbox event lock through Open3.capture3 cleanup.
93
111
  def agent_prompt_bounded(pane:, text:, timeout_ms:)
94
112
  cmd = [@binary, "agent", "prompt", pane, text]
95
- result = @process.call(cmd, stdin_data: "",
113
+ result = @process.call(native_command(cmd), stdin_data: "",
96
114
  timeout_s: timeout_ms / 1000.0, output_limit: WAKE_OUTPUT_LIMIT)
97
115
  execution = ExecutionResult.new(
98
116
  stdout: result.stdout.strip, stderr: result.stderr.strip,
@@ -257,6 +275,11 @@ module Ace
257
275
 
258
276
  private
259
277
 
278
+ def native_command(command)
279
+ return command if @environment.empty?
280
+ ["env", *@environment.map { |key, value| "#{key}=#{value}" }, *command]
281
+ end
282
+
260
283
  def run!(cmd)
261
284
  result = run(cmd)
262
285
  raise classify(result, cmd) unless result.success?
@@ -274,7 +297,7 @@ module Ace
274
297
  end
275
298
 
276
299
  def run(cmd)
277
- stdout, stderr, status = Open3.capture3(*cmd)
300
+ stdout, stderr, status = Open3.capture3(*native_command(cmd))
278
301
  ExecutionResult.new(
279
302
  stdout: stdout.strip, stderr: stderr.strip,
280
303
  success: status.success?, exit_code: status.exitstatus || -1
@@ -284,7 +307,7 @@ module Ace
284
307
  end
285
308
 
286
309
  def run_raw_stdout(cmd)
287
- stdout, stderr, status = Open3.capture3(*cmd)
310
+ stdout, stderr, status = Open3.capture3(*native_command(cmd))
288
311
  ExecutionResult.new(
289
312
  stdout: stdout, stderr: stderr.strip,
290
313
  success: status.success?, exit_code: status.exitstatus || -1
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Ace
4
4
  module Herdr
5
- VERSION = "0.10.0"
5
+ VERSION = "0.11.0"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ace-herdr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.0
4
+ version: 0.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michal Czyz
8
8
  bindir: exe
9
9
  cert_chain: []
10
- date: 2026-11-10 00:00:00.000000000 Z
10
+ date: 2026-11-11 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: websocket-driver
@@ -227,6 +227,7 @@ files:
227
227
  - README.md
228
228
  - Rakefile
229
229
  - docs/native-source.md
230
+ - docs/start.md
230
231
  - docs/usage.md
231
232
  - exe/ace-herdr
232
233
  - lib/ace/herdr.rb
@@ -243,6 +244,7 @@ files:
243
244
  - lib/ace/herdr/cli/commands/list_presets.rb
244
245
  - lib/ace/herdr/cli/commands/native_source.rb
245
246
  - lib/ace/herdr/cli/commands/send.rb
247
+ - lib/ace/herdr/cli/commands/start.rb
246
248
  - lib/ace/herdr/cli/commands/status.rb
247
249
  - lib/ace/herdr/cli/commands/support.rb
248
250
  - lib/ace/herdr/cli/commands/tab.rb