diff --git a/tools/watch.py b/tools/watch.py index d412ae0..816d011 100644 --- a/tools/watch.py +++ b/tools/watch.py @@ -57,6 +57,8 @@ def main(): ap.add_argument("--every", type=float, default=60) ap.add_argument("--stall", type=float, default=15, help="minutes without a tool call before a running agent " "counts as stalled (0: off)") + ap.add_argument("--quiet-traffic", action="store_true", + help="skip review items and messages (helpers handle them); wake only on stalls, stops and resting") args = ap.parse_args() project = projects.resolve(args.project) conn = sqlite3.connect(f"file:{project.db}?mode=ro", uri=True, timeout=30) @@ -70,13 +72,14 @@ def main(): found = [] for eid, item, state, agent in conn.execute( "SELECT id, item_id, to_state, agent FROM item_events WHERE id > ? ORDER BY id", (last_event,)): - if state in ("submitted", "approved", "changes_requested") and agent != args.me: # not my own moves + if state in ("submitted", "approved", "changes_requested") and agent != args.me and not args.quiet_traffic: # not my own moves title = conn.execute("SELECT title FROM items WHERE id=?", (item,)).fetchone()[0] found.append(f"item #{item} {state} by {agent}: {title}") for mid, sender, body in conn.execute( "SELECT m.id, m.sender, m.body FROM messages m JOIN deliveries d ON d.message_id=m.id WHERE d.agent=? " "AND m.id > ? AND m.origin != 'system' ORDER BY m.id", (args.me, last_msg)): - found.append(f"message #{mid} from {sender}: {body.splitlines()[0][:140]}") + if not args.quiet_traffic: + found.append(f"message #{mid} from {sender}: {(body.splitlines() or [''])[0][:140]}") if now["flags"] != start["flags"]: found.append("stop flags changed") if now["resting"] != start["resting"] and now["resting"]: