diff --git a/debian/changelog b/debian/changelog index 1c7b125..33cce5a 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,13 @@ +devdesk (0.10.1) bookworm; urgency=medium + + * Everything in 0.10.0, which was never published: its CI test for the + usage ping depended on attaching a tmux client. + * The usage ping counts you as away the same way "Claude needs you" does: + no DevDesk tab in view for ~2 minutes. A forgotten background tab no + longer silences it. + + -- Jared Vititoe Mon, 12 Oct 2026 01:45:00 -0400 + devdesk (0.10.0) bookworm; urgency=medium * Matrix "Claude needs you" is quieter and says what is asked (#50): @@ -13,7 +23,7 @@ devdesk (0.10.0) bookworm; urgency=medium worktree if it is clean, and the branch if it is merged. * Plan meters show when each window resets. If the pace so far would use a window up before then, they warn instead. Matrix gets one message per - 5-hour window past DEVDESK_USAGE_WARN (90%) when you're away (#45). + 5-hour window past DEVDESK_USAGE_WARN (90%) when no tab is in view (#45). * Repo panel lists the changed files; a click opens the diff (#46). * Copy Claude's last reply as Markdown: a session button and a palette entry, backed by `--last-reply` (#47). diff --git a/etc/env b/etc/env index 767bd17..5280454 100644 --- a/etc/env +++ b/etc/env @@ -54,7 +54,7 @@ DEVDESK_MATRIX_WEBHOOK_FILE=/etc/devdesk/matrix-webhook DEVDESK_MATRIX_DELAY=60 DEVDESK_MATRIX_QUIET=600 # DEVDESK_USAGE_WARN: post to the same room once per 5-hour window when plan usage -# passes this percent while no browser tab or SSH client is attached (devdesk#45). +# passes this percent while no DevDesk tab is in view (devdesk#45). DEVDESK_USAGE_WARN=90 # 0 turns off the guard that makes Claude ask before destructive commands diff --git a/libexec/devdesk-notify-matrix b/libexec/devdesk-notify-matrix index 600a45d..086a364 100755 --- a/libexec/devdesk-notify-matrix +++ b/libexec/devdesk-notify-matrix @@ -25,8 +25,8 @@ post() { # devdesk-notify-matrix --usage PCT RESETS_AT (devdesk#45): started by the status # line when the 5-hour plan window passes DEVDESK_USAGE_WARN percent. Once per -# window, and only when no client is attached to any session (you're away; a -# browser tab shows its own warning). +# window, and only when no DevDesk tab has been in view for ~2 minutes (presence +# markers; you're away. A tab in view shows its own warning). if [ "${1:-}" = --usage ]; then pct=${2:-} resets=${3:-} [[ $pct =~ ^[0-9]+$ && $resets =~ ^[0-9]+$ ]] || exit 0 @@ -36,7 +36,7 @@ if [ "${1:-}" = --usage ]; then [ "$(cat "$marker" 2>/dev/null)" != "$resets" ] || exit 0 printf '%s\n' "$resets" >"$marker" [ -r "$DEVDESK_MATRIX_WEBHOOK_FILE" ] || exit 0 - [ -z "$(dd_tmux list-clients -F x 2>/dev/null)" ] || exit 0 + [ -z "$(find "$DEVDESK_PRESENCE_DIR" -type f 2>/dev/null | head -n 1)" ] || exit 0 at=$(date -d "@$resets" '+%H:%M %Z') post "$(jq -cMn --arg p "$pct" --arg at "$at" --arg h "$(hostname)" \ '{kind: "usage", host: $h, text: "Claude plan usage is at \($p)% of the 5-hour window; it resets at \($at)."}')" diff --git a/tests/attach.bats b/tests/attach.bats index cf40351..54d7e39 100644 --- a/tests/attach.bats +++ b/tests/attach.bats @@ -1173,12 +1173,11 @@ JSONL sleep 0.5 [ "$(posts)" -eq 1 ] [[ "$(jq -r .text "$TMP/posts")" == *"91% of the 5-hour window"* ]] - # next window, but a client is attached: no post, and that window is done - tmux -S "$DEVDESK_SOCKET" new-session -d -s watcher 'sleep 30' - script -qc "tmux -S '$DEVDESK_SOCKET' attach -t =alpha" /dev/null /dev/null 2>&1 & - for _ in $(seq 1 30); do [ -n "$(tmux -S "$DEVDESK_SOCKET" list-clients -F x)" ] && break; sleep 0.1; done + # next window, but a DevDesk tab is in view: no post, and that window is done + mkdir -p "$DEVDESK_PRESENCE_DIR" && touch "$DEVDESK_PRESENCE_DIR/1" sl 95 2000018000 - sleep 1 + for _ in $(seq 1 30); do [ "$(cat "$DEVDESK_STATE_DIR/usage-warned")" = 2000018000 ] && break; sleep 0.1; done + sleep 0.5 [ "$(posts)" -eq 1 ] [ "$(cat "$DEVDESK_STATE_DIR/usage-warned")" = 2000018000 ] }