@accodev/hairline 0.47.2 → 0.48.0

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.
Files changed (3) hide show
  1. package/README.md +1 -1
  2. package/package.json +1 -1
  3. package/pi/line.ts +4 -2
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  ![hairline](https://raw.githubusercontent.com/accodev/hairline/screenshots/line.png)
4
4
 
5
- Hairline is a Claude Code mod and a [Pi](https://pi.dev) extension that adds a status line under the prompt. In the terminal it is two rows of four columns over a context bar that spans the terminal. The rows show the repository with the worktree and the branch, the context use with its auto-compact mark, the activity: output tokens per second, eased every 400 ms, over a filled graph that moves every frame; while a request waits, "waiting", the seconds in white and a blue mark that runs along a dim track; while tools run, their count and each name and argument. Under it the token split: input, output, cache read and cache write in one muted gray, joined by `/`. Then 5h and 7d limits, and the month's extra usage spend against its cap while extra usage is on and the 5h or 7d limit is full. The spend comes from claude.ai's undocumented usage endpoint once a minute, with a Claude subscription login only; when that call fails, or with `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC` set, the figure stays hidden. While idle the line reads the account's 5h and 7d use from the same endpoint once a minute, so other sessions' use shows too. Click the token split for cost, cache use, subagent share and how fast each limit fills. Click the model or effort to pick another, and click the session ID to copy it. Hairline takes its colors from your terminal's own palette. Hairline is tested on Claude Code 2.1.312 in the terminal. In the Claude desktop app it draws in the band above the prompt, without the folder, branch, model and effort that the app shows already. The idle mark is a white circle everywhere. In the terminal the tool glyph comes from a Nerd Font when one is installed; without one, its place stays blank. Hairline looks for one only once and keeps the answer. After you install or remove a Nerd Font, run `/hairline-fonts` to look again. The desktop app shows an emoji for it.
5
+ Hairline is a Claude Code mod and a [Pi](https://pi.dev) extension that adds a status line under the prompt. In the terminal it is two rows of four columns over a context bar that spans the terminal. The rows show the repository with the worktree and the branch, the context use with its auto-compact mark, the activity: output tokens per second, eased every 400 ms, over a filled graph that moves every frame; while a request waits, "waiting", the seconds in white and a blue mark that runs along a dim track; while tools run, their count and each name and argument. Under it the token split: input, output, cache read and cache write in one muted gray, joined by `/`. Then 5h and 7d limits, and the month's extra usage spend against its cap while extra usage is on and the 5h or 7d limit is at 95% or more. The spend comes from claude.ai's undocumented usage endpoint once a minute, with a Claude subscription login only; when that call fails, or with `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC` set, the figure stays hidden. While idle the line reads the account's 5h and 7d use from the same endpoint once a minute, so other sessions' use shows too. Click the token split for cost, cache use, subagent share and how fast each limit fills. Click the model or effort to pick another, and click the session ID to copy it. Hairline takes its colors from your terminal's own palette. Hairline is tested on Claude Code 2.1.312 in the terminal. In the Claude desktop app it draws in the band above the prompt, without the folder, branch, model and effort that the app shows already. The idle mark is a white circle everywhere. In the terminal the tool glyph comes from a Nerd Font when one is installed; without one, its place stays blank. Hairline looks for one only once and keeps the answer. After you install or remove a Nerd Font, run `/hairline-fonts` to look again. The desktop app shows an emoji for it.
6
6
 
7
7
  ![Streaming](https://raw.githubusercontent.com/accodev/hairline/screenshots/streaming.png)
8
8
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@accodev/hairline",
3
- "version": "0.47.2",
3
+ "version": "0.48.0",
4
4
  "description": "A status line for Claude Code and Pi.",
5
5
  "license": "MIT",
6
6
  "type": "module",
package/pi/line.ts CHANGED
@@ -246,10 +246,12 @@ export function amount(value: number, currency: string): string {
246
246
  return new Intl.NumberFormat(undefined, { style: 'currency', currency, minimumFractionDigits: digits, maximumFractionDigits: 2 }).format(value)
247
247
  }
248
248
 
249
- // Extra usage is billed only after the 5h or 7d window is full, so the spend shows only then.
249
+ // Extra usage is billed only after the 5h or 7d window is full. The spend shows from EXTRA_SHOWN_FROM,
250
+ // so the cap is in view before the first billed request.
251
+ export const EXTRA_SHOWN_FROM = 95 // percent of the 5h or 7d window
250
252
  function extraSpend(v: View): string {
251
253
  const x = v.extra
252
- const isCapped = RATE_LIMIT_WINDOWS.some(({ kind }) => (v.limits.find(l => l.kind === kind)?.percentUsed ?? 0) >= 100)
254
+ const isCapped = RATE_LIMIT_WINDOWS.some(({ kind }) => (v.limits.find(l => l.kind === kind)?.percentUsed ?? 0) >= EXTRA_SHOWN_FROM)
253
255
  return x && isCapped ?`${SEP}${dim('extra ')}${paint(amount(x.used, x.currency), { color: severity(x.pct) })}${dim(`/${amount(x.limit, x.currency)}`)}` : ''
254
256
  }
255
257