claude-pace 0.8.1 → 0.8.3
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.
- package/README.md +1 -1
- package/claude-pace.sh +13 -2
- package/package.json +1 -1
package/README.md
CHANGED
package/claude-pace.sh
CHANGED
|
@@ -65,6 +65,17 @@ _write_cache_record() {
|
|
|
65
65
|
printf '%s\n' "$*"
|
|
66
66
|
) >"$tmp" && mv "$tmp" "$path"
|
|
67
67
|
}
|
|
68
|
+
# Avoids rewriting the quota cache when the live snapshot is unchanged.
|
|
69
|
+
_write_quota_snapshot_if_changed() {
|
|
70
|
+
local path="$1" u5="$2" u7="$3" r5="$4" r7="$5"
|
|
71
|
+
if [ -f "$path" ] && [ ! -L "$path" ] && [ -r "$path" ] && _load_cache_record_file "$path"; then
|
|
72
|
+
[[ "${CACHE_FIELDS[0]:-}" == "$u5" ]] &&
|
|
73
|
+
[[ "${CACHE_FIELDS[1]:-}" == "$u7" ]] &&
|
|
74
|
+
[[ "${CACHE_FIELDS[2]:-}" == "$r5" ]] &&
|
|
75
|
+
[[ "${CACHE_FIELDS[3]:-}" == "$r7" ]] && return 0
|
|
76
|
+
fi
|
|
77
|
+
_write_cache_record "$path" "$u5" "$u7" "$r5" "$r7"
|
|
78
|
+
}
|
|
68
79
|
# Computes remaining whole minutes until a future epoch. Missing or expired
|
|
69
80
|
# timestamps return an empty string so callers can skip countdown formatting.
|
|
70
81
|
_minutes_until() {
|
|
@@ -131,7 +142,7 @@ IFS=$'\t' read -r MODEL DIR PCT CTX COST EFF HAS_RL U5 U7 R5 R7 < <(
|
|
|
131
142
|
(.rate_limits.five_hour.resets_at//0),
|
|
132
143
|
(.rate_limits.seven_day.resets_at//0)]|@tsv' <<<"$input"
|
|
133
144
|
)
|
|
134
|
-
case "${EFF:-default}" in high) EF='
|
|
145
|
+
case "${EFF:-default}" in low) EF='◌' ;; high) EF='◎' ;; xhigh) EF='◉' ;; max) EF='●' ;; *) EF='○' ;; esac
|
|
135
146
|
|
|
136
147
|
# ── Context label (needed by MODEL_SHORT and line 2) ──
|
|
137
148
|
if ((CTX >= 1000000)); then
|
|
@@ -214,7 +225,7 @@ if [[ "$HAS_RL" == "1" ]]; then
|
|
|
214
225
|
RM5=$(_minutes_until "$R5")
|
|
215
226
|
RM7=$(_minutes_until "$R7")
|
|
216
227
|
if [[ -n "$QC" ]] && _valid_quota_snapshot "$U5" "$U7" "$R5" "$R7"; then
|
|
217
|
-
|
|
228
|
+
_write_quota_snapshot_if_changed "$QC" "$U5" "$U7" "$R5" "$R7" || true
|
|
218
229
|
fi
|
|
219
230
|
else
|
|
220
231
|
U5="--" U7="--" RM5="" RM7=""
|