ace-overseer 0.31.4 → 0.31.5

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: 34e69489b6b9efe9e75ec3d31d871b36afab9faf0c65180927a40b8d243ddc1e
4
- data.tar.gz: 0e1a7f29c7bc2d8eff0016a687c9a418df0e56dd260e9f791b87b580cee49f06
3
+ metadata.gz: d3a56abb156f1d4c2c0a8d3342637b515514de934ded1057f4891ed50deb8dfa
4
+ data.tar.gz: be1e80207d1402fe0008b7b574344b25e17b4d55fb7c259cf2f1c3d1b3aa5ed4
5
5
  SHA512:
6
- metadata.gz: af91e3c0cdab68a66b9588557d7e92bd90e86aff2f431714bbaa8dfd9f453bb90f02354200dd456f8e334259a51452e21d104fc11051a08d151c8caf8c3e2ccf
7
- data.tar.gz: 8f3b5c6f1982cff1eff25d9347a8620dc8742e4526ffc3f3ec8eb237d1fd0f31dca5466b00adc67ae872109fa03df1a4a8d6e3460e080adaa48969084025eb25
6
+ metadata.gz: 2756e928c3d58a0f56eab504ce468f45543252c75aac72e627d7abe08e4f303dbcff3bb13d85324f8522f54098857226f5b51c225cd8e24684f36a5bfb57e3d2
7
+ data.tar.gz: 17adfc899350ed9132bba358c7258d1f7db117468435165dae76b54411b6de758b8a0c371371be677011c92dcf147b60dfc085e67a5e00204ec57958fa39d18a
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.31.5] - 2026-11-17
11
+
12
+ ### Changed
13
+
14
+ - Read Eyes readiness from the canonical ace-watch actor checkpoint and verify its live runner and Pi binding. Retain read compatibility for existing Pi sessions until host cutover; an invalid new binding never falls back to stale session evidence.
15
+
10
16
  ## [0.31.4] - 2026-11-17
11
17
 
12
18
  ### Fixed
data/docs/usage.md CHANGED
@@ -594,3 +594,15 @@ Foreground bootstrap pins the two built-in start guides to their packaged
594
594
  files. An explicit custom instruction source remains configurable; missing
595
595
  files block before launching Pi. Project development dependencies do not select
596
596
  the operational runtime when installed mode is chosen.
597
+
598
+ ## CLI-owned Eyes state
599
+
600
+ With ace-wake 0.6.0, ace-watch owns the actor checkpoint; Pi stores only a
601
+ binding to that state. Readiness verifies the live runner, current Pi process,
602
+ private state path, healthy source evidence and the existing completed-turn
603
+ contract. Legacy sessions remain readable until explicit host cutover; an
604
+ invalid new binding never falls back to old healthy snapshots.
605
+
606
+ Humans and any agent can use ace-watch --actor NAME eyes status/observe, exact
607
+ revision ACK, report processing and resume without starting Pi or a model.
608
+ See ace-wake/README.md and docs/lab-flow.md for the shared owner contract.
@@ -61,6 +61,8 @@ module Ace
61
61
  [stat.dev, stat.ino, stat.size, stat.mtime] == [again.dev, again.ino, again.size, again.mtime]
62
62
  return false unless header["cwd"] == root && header["id"].to_s.downcase == before.fetch("session_id").downcase
63
63
 
64
+ branch, core_still_current = core_branch(branch, root, stat.uid)
65
+
64
66
  eye = branch.reverse.find { |entry| entry["type"] == "custom" && entry["customType"] == EyesEvidence::ENTRY }
65
67
  pid = eye&.dig("data", "observerEvidence", "process", "pid")
66
68
  return false unless pid.is_a?(Integer) && pid.positive? && foreground?(executor, pane, pid)
@@ -72,7 +74,7 @@ module Ace
72
74
  return false unless @identity.capture(pid) == process && foreground?(executor, pane, pid) && pane_binding(executor, pane) == before
73
75
  final = file.stat
74
76
  named = File.lstat(path)
75
- named.file? && !named.symlink? &&
77
+ (!core_still_current || core_still_current.call) && named.file? && !named.symlink? &&
76
78
  [stat.dev, stat.ino, stat.size, stat.mtime] == [final.dev, final.ino, final.size, final.mtime] &&
77
79
  [stat.dev, stat.ino] == [named.dev, named.ino]
78
80
  rescue Ace::Herdr::ExecutorError, SystemCallError, IOError, JSON::ParserError, ArgumentError, TypeError, KeyError
@@ -83,6 +85,60 @@ module Ace
83
85
 
84
86
  private
85
87
 
88
+ # New adapters persist a binding only. Read the wake owner's current
89
+ # checkpoint for readiness; never keep a second mutable session snapshot.
90
+ # Legacy sessions remain readable until their host-controlled cutover.
91
+ def core_branch(branch, root, uid)
92
+ entry = branch.reverse.find { |row| row["customType"] == EyesEvidence::BINDING }
93
+ binding = entry&.fetch("data", nil)
94
+ return [branch, nil] unless entry
95
+ raise ArgumentError, "invalid wake binding" unless binding.is_a?(Hash)
96
+ return [branch, nil] unless %w[statePath actor target].any? { |key| binding.key?(key) }
97
+
98
+ actor = binding.fetch("actor")
99
+ raise ArgumentError, "invalid actor binding" unless actor.is_a?(String) && actor.match?(/\A[a-zA-Z0-9][a-zA-Z0-9_-]{0,63}\z/)
100
+ expected = File.join(root, ".ace-local/wake", actor, "state.json")
101
+ raise ArgumentError, "foreign actor state" unless binding["ownerCwd"] == root && binding["statePath"] == expected
102
+ %W[#{root}/.ace-local/wake #{root}/.ace-local/wake/#{actor}].each do |directory|
103
+ st = File.lstat(directory)
104
+ raise ArgumentError, "unsafe actor directory" unless st.directory? && !st.symlink? && st.uid == uid && (st.mode & 0o077).zero?
105
+ end
106
+ state, stat = File.open(expected, File::RDONLY | File::NOFOLLOW | File::NONBLOCK) do |file|
107
+ st = file.stat
108
+ raise ArgumentError, "unsafe actor state" unless st.file? && st.uid == uid && (st.mode & 0o077).zero? && st.size <= 16 * 1024 * 1024
109
+ [JSON.parse(file.read, max_nesting: 64, allow_duplicate_key: false), st]
110
+ end
111
+ raise ArgumentError, "actor owner mismatch" unless state.is_a?(Hash) && state["schema"] == "ace.wake.actor/v1" && state["actor"] == actor && state["cwd"] == root
112
+ raise ArgumentError, "invalid actor checkpoints" unless %w[targets runner observerEvidence eyes].all? { |key| state[key].is_a?(Hash) }
113
+ target = state.fetch("targets").fetch(binding.fetch("target"))
114
+ raise ArgumentError, "invalid delivery target" unless target.is_a?(Hash) && target["process"].is_a?(Hash)
115
+ identity = target.fetch("process")
116
+ raise ArgumentError, "adapter process mismatch" unless binding["process"] == {"pid" => identity["pid"], "startedAt" => identity["started_at"]}
117
+ runner = state.fetch("runner")
118
+ raise ArgumentError, "wake runner is not live" unless same_runner?(runner, uid)
119
+ evidence = state.fetch("observerEvidence")
120
+ raise ArgumentError, "invalid source health" unless evidence["sources"].is_a?(Hash) && evidence["sources"].values.all? { |value| value.is_a?(Hash) }
121
+ sources = evidence.fetch("sources").transform_values { |source| source.fetch("status") }
122
+ data = state.fetch("eyes").slice("enabled", "retired", "breaker", "errors", "config")
123
+ data["ownerCwd"] = root
124
+ data["observerEvidence"] = {"process" => binding.fetch("process"),
125
+ "observedAt" => evidence.fetch("observedAt"), "sources" => sources}
126
+ snapshot = {"type" => "custom", "customType" => EyesEvidence::ENTRY, "data" => data}
127
+ still_current = lambda do
128
+ current = File.lstat(expected)
129
+ current.file? && !current.symlink? &&
130
+ [current.dev, current.ino, current.size, current.mtime] == [stat.dev, stat.ino, stat.size, stat.mtime] &&
131
+ same_runner?(runner, uid)
132
+ end
133
+ [branch + [snapshot], still_current]
134
+ end
135
+
136
+ def same_runner?(runner, uid)
137
+ captured = @identity.capture(runner.fetch("pid"))
138
+ captured && captured["uid"] == uid &&
139
+ captured.slice("pid", "uid", "started_at") == runner.slice("pid", "uid", "started_at")
140
+ end
141
+
86
142
  def pane_binding(executor, pane)
87
143
  json = executor.pane_get(pane).parsed_json
88
144
  row = json.is_a?(Hash) && json["result"].is_a?(Hash) ? json["result"]["pane"] : nil
@@ -128,7 +184,7 @@ module Ace
128
184
  result["message"]["content"] = prompt if matched
129
185
  elsif entry["type"] == "custom" && entry["data"].is_a?(Hash)
130
186
  keys = case entry["customType"]
131
- when EyesEvidence::BINDING then %w[ownerCwd process]
187
+ when EyesEvidence::BINDING then %w[ownerCwd process actor statePath target]
132
188
  when EyesEvidence::ENTRY then %w[ownerCwd enabled retired breaker errors config observerEvidence]
133
189
  else []
134
190
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Ace
4
4
  module Overseer
5
- VERSION = "0.31.4"
5
+ VERSION = "0.31.5"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ace-overseer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.31.4
4
+ version: 0.31.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michal Czyz