codex-ralph 0.4.4 → 0.4.6

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.
@@ -198,13 +198,89 @@ else:
198
198
  PY
199
199
  }
200
200
 
201
+ progress_bar() {
202
+ local completed="$1"
203
+ local total="$2"
204
+ python3 - <<PY
205
+ completed = $completed
206
+ total = $total
207
+ filled = "🟩" * completed
208
+ empty = "⬜️" * (total - completed)
209
+ print(filled + empty)
210
+ PY
211
+ }
212
+
213
+ filter_repeated_diffs() {
214
+ python3 - <<'PYFILTER'
215
+ import sys
216
+ import hashlib
217
+ import re
218
+ from collections import deque
219
+
220
+ # Keep only last 30 diff hashes to avoid memory issues
221
+ seen_hashes = deque(maxlen=30)
222
+ current_block = []
223
+ collecting_diff = False
224
+
225
+ for line in sys.stdin:
226
+ stripped = line.rstrip('\n\r')
227
+
228
+ # Start of a file update block
229
+ if stripped == 'file update:':
230
+ if current_block:
231
+ # Process previous block
232
+ block_text = '\n'.join(current_block)
233
+ block_hash = hashlib.md5(block_text.encode()).hexdigest()
234
+ if block_hash not in seen_hashes:
235
+ sys.stdout.write(block_text + '\n')
236
+ sys.stdout.flush()
237
+ seen_hashes.append(block_hash)
238
+ # else: skip repeated diff
239
+
240
+ current_block = [stripped]
241
+ collecting_diff = True
242
+ elif collecting_diff:
243
+ current_block.append(stripped)
244
+ # Check if we hit a new action (end of diff block)
245
+ if re.match(r'^(thinking|exec):', stripped):
246
+ # End of diff block
247
+ block_text = '\n'.join(current_block)
248
+ block_hash = hashlib.md5(block_text.encode()).hexdigest()
249
+
250
+ if block_hash not in seen_hashes:
251
+ sys.stdout.write(block_text + '\n')
252
+ sys.stdout.flush()
253
+ seen_hashes.append(block_hash)
254
+ else:
255
+ # Skip the diff, only output the new action
256
+ sys.stdout.write(line)
257
+ sys.stdout.flush()
258
+
259
+ current_block = []
260
+ collecting_diff = False
261
+ else:
262
+ # Regular output, pass through immediately
263
+ sys.stdout.write(line)
264
+ sys.stdout.flush()
265
+
266
+ # Output any remaining block
267
+ if current_block:
268
+ block_text = '\n'.join(current_block)
269
+ block_hash = hashlib.md5(block_text.encode()).hexdigest()
270
+ if block_hash not in seen_hashes:
271
+ sys.stdout.write(block_text + '\n')
272
+ sys.stdout.flush()
273
+ PYFILTER
274
+ }
275
+
201
276
  iteration=1
202
277
  while true; do
203
278
  remaining="$(remaining_count)"
204
279
  if [[ "$remaining" == "0" ]]; then
205
280
  total="$(total_count)"
206
281
  session_marker="$(session_emoji)"
207
- send_telegram "${session_marker}"$'\n'" All requirements completed"$'\n'"🎯 ${total} of ${total}"
282
+ progress="$(progress_bar "$total" "$total")"
283
+ send_telegram "${session_marker}"$'\n'"✅ All requirements completed"$'\n'"🎯 ${total} of ${total}"$'\n'"${progress}"
208
284
  echo "All sprint requirements complete."
209
285
  echo "<promise>DONE</promise>"
210
286
  exit 0
@@ -218,8 +294,10 @@ while true; do
218
294
  desc="$(next_description)"
219
295
  total="$(total_count)"
220
296
  current="$(current_index)"
297
+ completed=$((current - 1))
221
298
  session_marker="$(session_emoji)"
222
- send_telegram "${session_marker}"$'\n'"📌 ${desc}"$'\n'"🎯 ${current} of ${total}"
299
+ progress="$(progress_bar "$completed" "$total")"
300
+ send_telegram "${session_marker} ${desc}"$'\n'"🎯 ${current} of ${total}"$'\n'"${progress}"
223
301
  echo "Iteration $iteration - next requirement: $desc"
224
302
 
225
303
  prompt_tmp="$(mktemp)"
@@ -234,9 +312,9 @@ while true; do
234
312
  } > "$prompt_tmp"
235
313
 
236
314
  if [[ "$USE_CURSOR_AGENT" == "true" ]]; then
237
- cursor-agent -f -p < "$prompt_tmp"
315
+ cursor-agent -f -p < "$prompt_tmp" 2>&1 | filter_repeated_diffs
238
316
  else
239
- codex exec - < "$prompt_tmp"
317
+ codex exec - < "$prompt_tmp" 2>&1 | filter_repeated_diffs
240
318
  fi
241
319
 
242
320
  rm -f "$prompt_tmp"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codex-ralph",
3
- "version": "0.4.4",
3
+ "version": "0.4.6",
4
4
  "description": "Ralph Loop sprint runner for Codex.",
5
5
  "bin": {
6
6
  "ralph-loop": "agent/ralph-loop.sh"