claude-pace 0.9.0 → 0.9.1
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/claude-pace.sh +19 -3
- package/package.json +1 -1
package/claude-pace.sh
CHANGED
|
@@ -105,14 +105,14 @@ done
|
|
|
105
105
|
_stale() { [ ! -f "$1" ] || [ $((NOW - $(stat -f%m "$1" 2>/dev/null || stat -c%Y "$1" 2>/dev/null || echo 0))) -gt "$2" ]; }
|
|
106
106
|
|
|
107
107
|
# ── Parse stdin + settings in one jq call ──
|
|
108
|
-
# Fields: MODEL DIR PCT CTX COST EFF HAS_RL U5 U7 R5 R7
|
|
108
|
+
# Fields: MODEL DIR PCT CTX COST EFF HAS_RL U5 U7 R5 R7 TIN
|
|
109
109
|
# Read settings into a shell var rather than process substitution so the jq
|
|
110
110
|
# --argjson path works on Windows Git Bash (where /proc/<pid>/fd/N used by
|
|
111
111
|
# <(...) is unavailable and --slurpfile silently fails, yielding empty fields).
|
|
112
112
|
HAS_RL=0
|
|
113
113
|
_SETTINGS=$(cat "$HOME/.claude/settings.json" 2>/dev/null)
|
|
114
114
|
echo "$_SETTINGS" | jq -e . >/dev/null 2>&1 || _SETTINGS='{}'
|
|
115
|
-
IFS=$'\t' read -r MODEL DIR PCT CTX COST EFF HAS_RL U5 U7 R5 R7 < <(
|
|
115
|
+
IFS=$'\t' read -r MODEL DIR PCT CTX COST EFF HAS_RL U5 U7 R5 R7 TIN < <(
|
|
116
116
|
jq -r --argjson cfg "$_SETTINGS" \
|
|
117
117
|
'[(.model.display_name//"?"),(.workspace.project_dir//"."),
|
|
118
118
|
(.context_window.used_percentage//0|floor),(.context_window.context_window_size//0),
|
|
@@ -122,10 +122,26 @@ IFS=$'\t' read -r MODEL DIR PCT CTX COST EFF HAS_RL U5 U7 R5 R7 < <(
|
|
|
122
122
|
(.rate_limits.five_hour.used_percentage//null|if type=="number" then floor else "--" end),
|
|
123
123
|
(.rate_limits.seven_day.used_percentage//null|if type=="number" then floor else "--" end),
|
|
124
124
|
(.rate_limits.five_hour.resets_at//0),
|
|
125
|
-
(.rate_limits.seven_day.resets_at//0)
|
|
125
|
+
(.rate_limits.seven_day.resets_at//0),
|
|
126
|
+
(.context_window.total_input_tokens//0|floor)]|@tsv' <<<"$input"
|
|
126
127
|
)
|
|
127
128
|
case "${EFF:-default}" in low) EF='low' ;; high) EF='high' ;; xhigh) EF='xhigh' ;; max) EF='max' ;; *) EF='medium' ;; esac
|
|
128
129
|
|
|
130
|
+
# ── Auto-compact window: track usage against the compaction threshold ──
|
|
131
|
+
# When CLAUDE_CODE_AUTO_COMPACT_WINDOW is set, compaction fires at that token
|
|
132
|
+
# count, not the model's full window. Recompute PCT against it and relabel CTX
|
|
133
|
+
# so the bar measures "distance to compaction", matching the desktop app's bar
|
|
134
|
+
# (e.g. 49.8k / 400.0k). Falls back to the full window when unset or when token
|
|
135
|
+
# data is missing (early session, before the first API response).
|
|
136
|
+
ACW="${CLAUDE_CODE_AUTO_COMPACT_WINDOW:-0}"
|
|
137
|
+
if [[ "$ACW" =~ ^[0-9]+$ ]] && ((ACW > 0)) && [[ "$TIN" =~ ^[0-9]+$ ]] && ((TIN > 0)); then
|
|
138
|
+
# Compaction can't exceed the real window; clamp so the label stays honest.
|
|
139
|
+
((CTX > 0 && ACW > CTX)) && ACW=$CTX
|
|
140
|
+
PCT=$((TIN * 100 / ACW))
|
|
141
|
+
((PCT > 100)) && PCT=100
|
|
142
|
+
CTX=$ACW
|
|
143
|
+
fi
|
|
144
|
+
|
|
129
145
|
# ── Context label (needed by MODEL_SHORT and line 2) ──
|
|
130
146
|
if ((CTX >= 1000000)); then
|
|
131
147
|
CL="$((CTX / 1000000))M"
|