ace-herdr 0.10.0 → 0.11.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: 204e5cf8135c02f3feea7086b05a2b3dad61470261dbd526a05b900dd1f5e558
4
- data.tar.gz: b362791611a61f9340055ad044383dd4585b2d5821ffc1d28a4e7356dd6ab6b1
3
+ metadata.gz: 34cafec7d5b1076108a40ea6d8e13a4cc3080fc2c46dcf7a9d16f99e9ed2f6a0
4
+ data.tar.gz: dc53fb2035bf16379f5d5709736dad1db1e623df6d50be0793d8f6fb04b94613
5
5
  SHA512:
6
- metadata.gz: 8c564329116783969ae79dc7256f8a414591e308d18b3b8772b751ac1efea5d07b8f4758ee34b23134b50631a571e01d48d7872b20c8510fb637d019f6889b42
7
- data.tar.gz: 7a1be61896fff3f5ca58c7ee00d2c4fa0633e935805c2cd466ceaad12b4a4a3bf04cbf02d7cca7bd43bf3edf28196feb190b14e3282fe736a8e6137e5918a45f
6
+ metadata.gz: 6ca77bbdb7381472639c809b0273fe24378eb94a7e3f95defba964a0b390063aa33ea019a7c1b12ed7021ab8d3bbe04a30a128d6a6fb8f70751880980cecc73b
7
+ data.tar.gz: 605c6aebfb87035502223311f8525f4d540d193eed47e99533ddbd79b210dea135235b6d17cad6975e7375bc84dea0abefa8733f58e22e4c4ed1107ad45d52c7
data/CHANGELOG.md CHANGED
@@ -7,6 +7,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.11.1] - 2026-11-12
11
+
12
+ ### Fixed
13
+
14
+ - Preserve child session, remote and help arguments when launching with an explicit environment.
15
+
16
+ ## [0.11.0] - 2026-11-11
17
+
18
+ ### Added
19
+
20
+ - 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.
21
+
10
22
  ## [0.10.0] - 2026-11-10
11
23
 
12
24
  ### 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
@@ -1,7 +1,7 @@
1
1
  From 7a2e78b4e92d2b694bd8a06c1ef4943915c399b2 Mon Sep 17 00:00:00 2001
2
2
  From: Miguel <mc@cs3b.com>
3
3
  Date: Wed, 7 Oct 2026 00:43:20 +0100
4
- Subject: [PATCH 1/6] feat: guard and permanently drain original-terminal input
4
+ Subject: [PATCH 1/7] feat: guard and permanently drain original-terminal input
5
5
 
6
6
  ---
7
7
  docs/next/api/herdr-api.schema.json | 338 ++++++
@@ -3495,10 +3495,10 @@ index 9171340..a971ef6 100644
3495
3495
  2.54.0 (Apple Git-157)
3496
3496
 
3497
3497
 
3498
- From 78b571c45ebe80425d8e69bc6f19e16357043131 Mon Sep 17 00:00:00 2001
3498
+ From 5d98e178453958691f17b58d26fd20b51a985cd7 Mon Sep 17 00:00:00 2001
3499
3499
  From: Miguel <mc@cs3b.com>
3500
3500
  Date: Wed, 4 Nov 2026 02:57:12 +0000
3501
- Subject: [PATCH 2/6] fix: validate Pi report acknowledgements before accepting
3501
+ Subject: [PATCH 2/7] fix: validate Pi report acknowledgements before accepting
3502
3502
  delivery
3503
3503
 
3504
3504
  ---
@@ -3644,10 +3644,10 @@ index 673225a..546289d 100644
3644
3644
  2.54.0 (Apple Git-157)
3645
3645
 
3646
3646
 
3647
- From 27ff0cfe4255c3b31c81e8e42964b318f1d8fbd4 Mon Sep 17 00:00:00 2001
3647
+ From b6d67f318c260b3c0efcbef89bf1034544852776 Mon Sep 17 00:00:00 2001
3648
3648
  From: Miguel <mc@cs3b.com>
3649
3649
  Date: Wed, 4 Nov 2026 04:17:44 +0000
3650
- Subject: [PATCH 3/6] fix: resolve agent queries by immutable terminal identity
3650
+ Subject: [PATCH 3/7] fix: resolve agent queries by immutable terminal identity
3651
3651
 
3652
3652
  ---
3653
3653
  src/app/terminal_targets.rs | 35 +++++++++++++++++++++++++++++++++++
@@ -3710,10 +3710,10 @@ index 658eeaa..003c30c 100644
3710
3710
  2.54.0 (Apple Git-157)
3711
3711
 
3712
3712
 
3713
- From 18242eabb417277aa2ab987c000e63c6ffc208e2 Mon Sep 17 00:00:00 2001
3713
+ From 93e768dcacbfd63171957935ae9e2637a91689e6 Mon Sep 17 00:00:00 2001
3714
3714
  From: Miguel <mc@cs3b.com>
3715
3715
  Date: Tue, 10 Nov 2026 22:59:15 +0000
3716
- Subject: [PATCH 4/6] feat: launch ordinary agents with private explicit
3716
+ Subject: [PATCH 4/7] feat: launch ordinary agents with private explicit
3717
3717
  environments
3718
3718
 
3719
3719
  ---
@@ -4801,10 +4801,10 @@ index 0000000..afe8c3a
4801
4801
  2.54.0 (Apple Git-157)
4802
4802
 
4803
4803
 
4804
- From 4462e31354e9fe88c929f5961023fd75694768c1 Mon Sep 17 00:00:00 2001
4804
+ From 83939be994e8b911140adbb9ba64aa4858cce96b Mon Sep 17 00:00:00 2001
4805
4805
  From: Miguel <mc@cs3b.com>
4806
4806
  Date: Tue, 10 Nov 2026 23:06:09 +0000
4807
- Subject: [PATCH 5/6] fix: require fresh environments on cold agent restoration
4807
+ Subject: [PATCH 5/7] fix: require fresh environments on cold agent restoration
4808
4808
 
4809
4809
  ---
4810
4810
  src/app/agents.rs | 3 ++
@@ -4916,10 +4916,10 @@ index b6d6187..66ae240 100644
4916
4916
  2.54.0 (Apple Git-157)
4917
4917
 
4918
4918
 
4919
- From b6eef16bbbeb5210f5414b67104d2656576e0e5c Mon Sep 17 00:00:00 2001
4919
+ From f475b86b1fc0a72103fbdf5cc0aba7dfc54cdcb4 Mon Sep 17 00:00:00 2001
4920
4920
  From: Miguel <mc@cs3b.com>
4921
4921
  Date: Tue, 10 Nov 2026 23:16:46 +0000
4922
- Subject: [PATCH 6/6] fix: clean ordinary session credentials when agents exit
4922
+ Subject: [PATCH 6/7] fix: clean ordinary session credentials when agents exit
4923
4923
 
4924
4924
  ---
4925
4925
  src/persist/restore.rs | 13 +--
@@ -5267,3 +5267,82 @@ index afe8c3a..9dedb83 100644
5267
5267
  --
5268
5268
  2.54.0 (Apple Git-157)
5269
5269
 
5270
+
5271
+ From 5176d899a567985490682c37eb7f0198eab159b0 Mon Sep 17 00:00:00 2001
5272
+ From: Miguel <mc@cs3b.com>
5273
+ Date: Wed, 11 Nov 2026 23:46:22 +0000
5274
+ Subject: [PATCH 7/7] fix: preserve child options in explicit environment
5275
+ launcher
5276
+
5277
+ ---
5278
+ src/main.rs | 9 +++++++++
5279
+ tests/process_environment.rs | 36 ++++++++++++++++++++++++++++++++++++
5280
+ 2 files changed, 45 insertions(+)
5281
+
5282
+ diff --git a/src/main.rs b/src/main.rs
5283
+ index 45a6409..eb5a40d 100644
5284
+ --- a/src/main.rs
5285
+ +++ b/src/main.rs
5286
+ @@ -512,6 +512,15 @@ fn main() -> io::Result<()> {
5287
+ std::process::exit(2);
5288
+ }
5289
+ };
5290
+ + // Everything after exec-env's executable belongs to the child, including
5291
+ + // --session, --remote and --help. Do not parse it as Herdr options.
5292
+ + if raw_args.get(1).map(String::as_str) == Some("agent")
5293
+ + && raw_args.get(2).map(String::as_str) == Some("exec-env")
5294
+ + {
5295
+ + return finish_cli(
5296
+ + platform::process_environment::exec(&raw_args[3..]).map(cli::CommandOutcome::Handled),
5297
+ + );
5298
+ + }
5299
+ if let Some(outcome) = cli::maybe_run_machine(&raw_args) {
5300
+ return finish_cli(outcome);
5301
+ }
5302
+ diff --git a/tests/process_environment.rs b/tests/process_environment.rs
5303
+ index 9dedb83..64d4645 100644
5304
+ --- a/tests/process_environment.rs
5305
+ +++ b/tests/process_environment.rs
5306
+ @@ -193,3 +193,39 @@ fn process_environment_cleanup_forwards_termination_and_keeps_evidence() {
5307
+ assert!(directory.join("session.jsonl").exists());
5308
+ std::fs::remove_dir_all(environment.parent().unwrap()).unwrap();
5309
+ }
5310
+ +
5311
+ +#[test]
5312
+ +fn process_environment_child_flags_are_not_global_herdr_options() {
5313
+ + let path = environment_file("{}");
5314
+ + let session = format!("/tmp/{}/session.jsonl", "long-session-path".repeat(8));
5315
+ + for flags in [
5316
+ + vec!["--session", session.as_str()],
5317
+ + vec!["--remote", "child-target"],
5318
+ + vec!["--help"],
5319
+ + vec!["--version"],
5320
+ + ] {
5321
+ + let output = Command::new(env!("CARGO_BIN_EXE_herdr"))
5322
+ + .args([
5323
+ + "agent",
5324
+ + "exec-env",
5325
+ + path.to_str().unwrap(),
5326
+ + "/bin/sh",
5327
+ + "-c",
5328
+ + "printf '%s\\n' \"$@\"",
5329
+ + "child",
5330
+ + ])
5331
+ + .args(&flags)
5332
+ + .output()
5333
+ + .unwrap();
5334
+ + assert!(
5335
+ + output.status.success(),
5336
+ + "{}",
5337
+ + String::from_utf8_lossy(&output.stderr)
5338
+ + );
5339
+ + assert_eq!(
5340
+ + String::from_utf8(output.stdout).unwrap(),
5341
+ + format!("{}\n", flags.join("\n"))
5342
+ + );
5343
+ + }
5344
+ + std::fs::remove_dir_all(path.parent().unwrap()).unwrap();
5345
+ +}
5346
+ --
5347
+ 2.54.0 (Apple Git-157)
5348
+
@@ -2,10 +2,10 @@
2
2
  "schema": "ace.herdr.native-source/v1",
3
3
  "repository": "https://github.com/herdrdev/herdr.git",
4
4
  "baseline_commit": "7b116c05bfda646af39d2524c54e70c751f57ee8",
5
- "source_commit": "f475b86b1fc0a72103fbdf5cc0aba7dfc54cdcb4",
6
- "source_tree": "61d414a2d7377d1ec3f10fa433b26a80be26e235",
5
+ "source_commit": "5176d899a567985490682c37eb7f0198eab159b0",
6
+ "source_tree": "1cf8206e2d7b3a559d0bb3a036fa54d7228e7c99",
7
7
  "patch_file": "guarded-prompt.patch",
8
- "patch_sha256": "f6c60630cf64472e2bb9d9a6ff11590730191f88fc5793e0e5fb171004514429",
8
+ "patch_sha256": "5aebc2fe2b61b80f96cc5fb5ef63fe41ee9b69c8b5921ce0fbf3cb4c10ae98a6",
9
9
  "cargo_lock_sha256": "bb3ab17351af496a2cc316a11c81a97f90959cd37c3d5625f2f8028c0133ffca",
10
10
  "rust_toolchain_sha256": "0d9298c075817aba62477d23dcda3534cd836b5d5cf1960bd2de54df675ceffd",
11
11
  "rust_version": "1.96.1",
@@ -15,7 +15,7 @@
15
15
  "committer": {
16
16
  "name": "Miguel",
17
17
  "email": "mc@cs3b.com",
18
- "date": "2026-11-10T23:16:46+00:00"
18
+ "date": "2026-11-11T23:46:22+00:00"
19
19
  },
20
20
  "targets": [
21
21
  "x86_64-unknown-linux-musl",
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Ace
4
4
  module Herdr
5
- VERSION = "0.10.0"
5
+ VERSION = "0.11.1"
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.1
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-12 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