diff options
| author | Danilo M. <danix@danix.xyz> | 2026-09-26 08:34:55 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-09-26 08:34:55 +0200 |
| commit | 4a357b335f74ae64714800527ac3e95b7057a3ce (patch) | |
| tree | 299f39e8c3788b36d0f4fe779dd4b994a77619bd /examples/tools/mail.sh | |
| parent | 3b6f56f93c829a741df4ded189a4b8c98ce7fdff (diff) | |
| download | desktop-assistant-4a357b335f74ae64714800527ac3e95b7057a3ce.tar.gz desktop-assistant-4a357b335f74ae64714800527ac3e95b7057a3ce.zip | |
Fix mail counts and finance ranges found testing live
- mail printed threads and the model called them emails; it now
reports messages and threads.
- finance spending takes a since date (default the first of the month)
instead of a day count, and an optional asset account. The
per-account listing needs an end date or the API rejects it; an
unknown account name gets the user's accounts back.
- Tool errors are capped at 2000 characters like normal output.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'examples/tools/mail.sh')
| -rwxr-xr-x | examples/tools/mail.sh | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/examples/tools/mail.sh b/examples/tools/mail.sh index 4e0e9c1..bd7219d 100755 --- a/examples/tools/mail.sh +++ b/examples/tools/mail.sh @@ -23,8 +23,11 @@ set -uo pipefail query="${1:-tag:unread and tag:inbox}" -json=$("${MAILCTL:-mailctl.py}" search "$query" --json) || { echo "mail search failed" >&2; exit 1; } -jq -r 'length as $n - | if $n == 0 then "no threads match" - else "\($n) threads", (.[:10][] | "\(.date_relative), \(.authors): \(.subject)") +mailctl="${MAILCTL:-mailctl.py}" +json=$("$mailctl" search "$query" --json) || { echo "mail search failed" >&2; exit 1; } +# Messages and threads both: the model otherwise calls threads "emails". +msgs=$("$mailctl" count "$query" | awk '{print $1}') || { echo "mail count failed" >&2; exit 1; } +jq -r --arg msgs "$msgs" 'length as $n + | if $n == 0 then "no messages match" + else "\($msgs) messages in \($n) threads", (.[:10][] | "\(.date_relative), \(.authors): \(.subject)") end' <<<"$json" |
