Count a dated CHANGELOG heading as cut without a tag, read only regular files in rule-hook, stamp asks in ISO UTC, give workers the reading rule, and record the 200k window's measurement

This commit is contained in:
2026-11-04 21:11:09 +01:00
parent b1bbc2490a
commit 5b1f903471
19 changed files with 176 additions and 81 deletions
+11 -4
View File
@@ -13,6 +13,7 @@ import typing
from loop_claude.waiting.ask import Ask, Asking, OpenInInbox, OpenOnTerminal
from loop_claude.running_loops import RunningLoop, Taken
from loop_claude.waiting.talk import TALK
from utc_stamp import seconds
ENTER = "enter"
BACKSPACE = "backspace"
@@ -108,7 +109,7 @@ def listing_lines(screen: Listing, now: float, local_time: typing.Callable[[floa
lines = [*wrapped(head, width), ""]
for number, ask in enumerate(screen.shown, 1):
state = "" if isinstance(ask.state, Asking) else f"; claude is open {where_open(ask.state)}"
lines += wrapped(f"[{number}] {ask.root}, waiting since {local_time(ask.asked)} ({waited(now - ask.asked)}){state}", width)
lines += wrapped(f"[{number}] {ask.root}, {waiting_since(ask, now, local_time)}{state}", width)
lines += cut(wrapped(ask.question, width - len(INDENT) - len(ELLIPSIS)), SHOWN_LINES)
lines.append("")
lines += running_lines(screen.running, screen.shown, width)
@@ -139,7 +140,7 @@ def item_line(item: Taken | None) -> str:
def answering_lines(screen: Answering, now: float, local_time: typing.Callable[[float], str], width: int) -> tuple[list[str], list[str]]:
"""The question, in lines of at most width characters, and its foot, the prompt for the answer."""
ask = screen.ask
head = f"{ask.root}, waiting since {local_time(ask.asked)} ({waited(now - ask.asked)}):"
head = f"{ask.root}, {waiting_since(ask, now, local_time)}:"
return [*wrapped(head, width), "", *wrapped(ask.question, width), ""], typed_after(ANSWER_PROMPT, screen.typed, width)
@@ -168,8 +169,14 @@ def cut(lines: list[str], count: int) -> list[str]:
return [*shown[:-1], f"{shown[-1]}{ELLIPSIS}"] if len(lines) > count else shown
def waited(seconds: float) -> str:
minutes = int(seconds // 60)
def waiting_since(ask: Ask, now: float, local_time: typing.Callable[[float], str]) -> str:
"""When ask's loop asked, in local time, and how long it has waited."""
asked = seconds(ask.asked)
return f"waiting since {local_time(asked)} ({waited(now - asked)})"
def waited(span: float) -> str:
minutes = int(span // 60)
if minutes < 60:
return f"{minutes} min"
hours, minutes = divmod(minutes, 60)