ace-overseer 0.31.0 → 0.31.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: 66a8676da2ce6fa2dac349814b9e31ecf272bf69592d30144c0f51b5affc0f37
4
- data.tar.gz: c16d235da8c75fd77afbf788278bf720315c09aa77c9b6a74d14c85eb54e9d8b
3
+ metadata.gz: a7bd199f526cd282ebb59d712113fc4d5e3d85231f2bdc0dfc65d3b5a1400e63
4
+ data.tar.gz: 671ee238f79bdb4469592b827b6ca89a535c29ebcb435a6bfd15beb294640167
5
5
  SHA512:
6
- metadata.gz: c2f7496b967aa4a8b1436eddc7535a84a348aff25527be213ac65938f228e818afb5dcd4326bf5e730eda194ea135c88366e177fe5b80a5a73c3726dd9fd8200
7
- data.tar.gz: 6919f93fe0ba5c7a33e422cd840c8f6287ea4cc30adb3c89922276b429df9afd94e5f7fa0aa8ccd241fd827c10adb8ca8cd4d52ddd71e0bc9519a91f808a8aed
6
+ metadata.gz: 9c94a54662c6a9fe25d44a1426c0a4fc8486f812b1e3f889aa2f82749bb5f17232d47b7819e4f3e7181aeede37d25b56b4111942a7fe26fc60a6a3bf1108b3f6
7
+ data.tar.gz: b05613ed67ee5edc6c71fed92805e2e08131475be997f1c07d09a2d4a7709968a1fbe7ca185a76d4489777fab91a5be0cdf83be413e248eaf0e7ab7a68d5c28d
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.1] - 2026-11-15
11
+
12
+ ### Fixed
13
+
14
+ - Read long-lived Pi sessions incrementally and retain only readiness evidence instead of rejecting histories above 64 MiB.
15
+
10
16
  ## [0.31.0] - 2026-11-12
11
17
 
12
18
  ### Changed
@@ -12,7 +12,7 @@ module Ace
12
12
  # Reconstruct Pi's current persisted branch and bind its eyes evidence
13
13
  # to the live Herdr pane and process, without persisting another copy.
14
14
  class EyesSessionEvidence
15
- MAX_BYTES = 64 * 1024 * 1024
15
+ MAX_ENTRY_BYTES = 64 * 1024 * 1024
16
16
  MAX_ENTRIES = 200_000
17
17
  SESSION_PATH = %r{\A/[^\0]*_([0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12})\.jsonl\z}
18
18
 
@@ -54,12 +54,11 @@ module Ace
54
54
  path = before.fetch("path")
55
55
  file = @file_opener.call(path)
56
56
  stat = file.stat
57
- return false unless stat.file? && stat.size.between?(1, MAX_BYTES)
58
- content = file.read(MAX_BYTES + 1)
59
- return false unless content && content.bytesize == stat.size && content.end_with?("\n")
57
+ return false unless stat.file? && stat.size.positive?
58
+ header, branch = branch_for(file, prompt)
60
59
  again = file.stat
61
- return false unless [stat.dev, stat.ino, stat.size, stat.mtime] == [again.dev, again.ino, again.size, again.mtime]
62
- header, branch = branch_for(content)
60
+ return false unless file.pos == stat.size &&
61
+ [stat.dev, stat.ino, stat.size, stat.mtime] == [again.dev, again.ino, again.size, again.mtime]
63
62
  return false unless header["cwd"] == root && header["id"].to_s.downcase == before.fetch("session_id").downcase
64
63
 
65
64
  eye = branch.reverse.find { |entry| entry["type"] == "custom" && entry["customType"] == EyesEvidence::ENTRY }
@@ -104,18 +103,51 @@ module Ace
104
103
  list.is_a?(Array) && list.any? { |row| row.is_a?(Hash) && row["pid"] == pid }
105
104
  end
106
105
 
107
- def branch_for(content)
108
- lines = content.lines
109
- raise ArgumentError, "session entry limit" unless lines.size.between?(2, MAX_ENTRIES + 1)
110
- header = JSON.parse(lines.shift, create_additions: false, max_nesting: 64, allow_duplicate_key: false)
106
+ # Bound individual records, not the lifetime of an otherwise healthy
107
+ # session. Retain only evidence fields; tool output and acknowledged
108
+ # event maps can dwarf the readiness proof in long-running sessions.
109
+ def read_entry(file)
110
+ line = file.gets(MAX_ENTRY_BYTES + 1)
111
+ return unless line
112
+ raise ArgumentError, "invalid session record size or terminator" unless
113
+ line.bytesize <= MAX_ENTRY_BYTES && line.end_with?("\n")
114
+ entry = JSON.parse(line, create_additions: false, max_nesting: 64, allow_duplicate_key: false)
115
+ raise ArgumentError, "session record must be an object" unless entry.is_a?(Hash)
116
+ entry
117
+ end
118
+
119
+ def readiness_entry(entry, prompt)
120
+ result = entry.slice("id", "parentId", "type", "timestamp", "customType")
121
+ if entry["type"] == "message" && entry["message"].is_a?(Hash)
122
+ message = entry["message"]
123
+ result["message"] = message.slice("role", "stopReason")
124
+ content = message["content"]
125
+ matched = content == prompt || content.is_a?(Array) && content.any? do |part|
126
+ part.is_a?(Hash) && part["type"] == "text" && part["text"] == prompt
127
+ end
128
+ result["message"]["content"] = prompt if matched
129
+ elsif entry["type"] == "custom" && entry["data"].is_a?(Hash)
130
+ keys = case entry["customType"]
131
+ when EyesEvidence::BINDING then %w[ownerCwd process]
132
+ when EyesEvidence::ENTRY then %w[ownerCwd enabled retired breaker errors config observerEvidence]
133
+ else []
134
+ end
135
+ result["data"] = entry["data"].slice(*keys)
136
+ end
137
+ result
138
+ end
139
+
140
+ def branch_for(file, prompt)
141
+ header = read_entry(file)
111
142
  raise ArgumentError, "invalid Pi session" unless header.is_a?(Hash) && header["type"] == "session" && header["version"] == 3
112
143
  entries = {}
113
144
  last = nil
114
- lines.each do |line|
115
- entry = JSON.parse(line, create_additions: false, max_nesting: 64, allow_duplicate_key: false)
145
+ while (entry = read_entry(file))
146
+ raise ArgumentError, "session entry limit" if entries.size >= MAX_ENTRIES
116
147
  raise ArgumentError, "invalid session entry" unless entry.is_a?(Hash) && entry["id"].is_a?(String) &&
117
148
  !entry["id"].empty? && !entries.key?(entry["id"]) &&
118
149
  (entry["parentId"].nil? || entries.key?(entry["parentId"]))
150
+ entry = readiness_entry(entry, prompt)
119
151
  entries[entry["id"]] = entry
120
152
  last = entry
121
153
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Ace
4
4
  module Overseer
5
- VERSION = "0.31.0"
5
+ VERSION = "0.31.1"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ace-overseer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.31.0
4
+ version: 0.31.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michal Czyz
8
8
  bindir: exe
9
9
  cert_chain: []
10
- date: 2026-11-12 00:00:00.000000000 Z
10
+ date: 2026-11-15 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: ace-support-cli
@@ -234,7 +234,7 @@ dependencies:
234
234
  version: '0.11'
235
235
  - - ">="
236
236
  - !ruby/object:Gem::Version
237
- version: 0.11.2
237
+ version: 0.11.3
238
238
  type: :runtime
239
239
  prerelease: false
240
240
  version_requirements: !ruby/object:Gem::Requirement
@@ -244,7 +244,7 @@ dependencies:
244
244
  version: '0.11'
245
245
  - - ">="
246
246
  - !ruby/object:Gem::Version
247
- version: 0.11.2
247
+ version: 0.11.3
248
248
  - !ruby/object:Gem::Dependency
249
249
  name: ace-lab
250
250
  requirement: !ruby/object:Gem::Requirement