ClaudeMods
☰
ZH-TW
● 0 人在線上 · 瀏覽 0 次
贊助提交作品
GitHub 儲存庫 · 發布者 crane-valley

session-band

在終端機與桌面應用程式的 Code 分頁中,顯示於 Claude Code 提示列正上方的工作階段資訊:

crane-valley@crane-valley

crane-valley/claude-plugins/tree/main/plugins/session-band

原貼文圖片1
已翻譯

關於這個 mod

  • 快取:主執行緒提示快取距離過期剩餘的時間,從上一次讀取或寫入快取的主執行緒請求開始計算,因為產生時間也會算入快取生命週期。工作階段恢復或分支後,外掛沒有請求開始時間,只有上一次回應完成的時間(Claude Code 的 SessionStart 欄位 seconds_since_last_response),因此恢復後的倒數只是估計值,最長可能比實際多跑該回應的產生時間;在下一次讀取或寫入快取的主執行緒回應以精確倒數取代它之前,會以暗色文字顯示,並在後面接上 estimated,例如 4:00 estimated。當 Claude Code 在恢復時回報提示快取可能已過期,該列會改為顯示 expired。
  • 工作階段:工作階段依 API 計價的成本,以及已執行的時間。
  • 限制:API 回報的每個速率限制視窗,附有使用量列與距離重設的時間。外掛未命名的視窗(例如組織支出限制)會以原始類型顯示。工作階段的第一個回應回報讀值之前,這一列會隱藏。以使用量點數計費的方案(例如 Enterprise 席位)不會在回應中回報視窗;開啟 showCredits 後,會把每月使用量點數支出加到這一列,標示為 Credits。它會在工作階段啟動時讀取,因此開啟後,即使還沒有任何回應,這一列也可能顯示。
  • 內容脈絡:內容脈絡視窗的填充量,依 /context 使用的顏色拆分成最大的類別。

需求

Function hooks 是 Claude Code 的搶先體驗 API,版本之間可能在未通知的情況下變更。CI 會在 Claude Code 2.1.288 上測試此外掛。如果狀態列沒有出現,請更新 Claude Code;如果某個版本仍預設關閉 function hooks,必須在其環境中設定 CLAUDE_CODE_ENABLE_FUNCTION_HOOKS=1。

安裝

claude plugin marketplace add crane-valley/claude-plugins
claude plugin install session-band@crane-valley

選項

使用 /plugin configure session-band@crane-valley、在 /config 中設定,或在 claude plugin install 上使用 --config KEY=VALUE。未設定的選項會使用下列預設值。

| 選項 | 預設值 | 意義 | | --- | --- | --- | | cacheTtl | 5m | 主執行緒使用的提示快取 TTL(5m 或 1h)。外掛無法從 Claude Code 讀取這個值,因此錯誤的值會顯示錯誤的倒數。 | | showCost | true | 顯示工作階段成本。使用訂閱方案時,這是使用量的 API 價格,不是你實際支付的金額。 | | showCredits | false | 將帳戶每月的使用量點數支出加到 Limits 列,正如 Claude Code 的 /usage 在 Usage credits 下顯示的結果。外掛會使用你的登入資訊,最多每 5 分鐘向同一端點請求一次。該端點沒有公開文件,因此端點變更或回傳錯誤時會省略這一列。它不提供重設時間,所以不會顯示。需要 claude.ai 登入:使用 Bedrock、Vertex、閘道或 API key 時,外掛不會發送請求,也不會顯示 Credits。 |

共用狀態列

提示列上方的狀態列是所有外掛共用的一個位置。session-band 會把自己的列附加到下方外掛已繪製的內容,因此其他外掛的列仍然可見;繪製狀態列卻不呼叫 next(e) 的外掛,會隱藏位於它下方的內容。

授權條款

MIT

安裝

請先查看作者 README,確認 marketplace 與外掛名稱;指令可能隨儲存庫結構而變動。

claude plugin marketplace add crane-valley/claude-plugins
claude plugin install session-band
原文 / README

session-band

Session figures in the band directly above the Claude Code prompt, on the terminal and in the desktop app's Code tab:

session-band in the desktop app's Code tab

  • Cache: time left before the main thread's prompt cache expires, counted from the start of the last main-thread request that read or wrote the cache, since generation time counts against the cache lifetime. After a session is resumed or forked, the plugin has no request start time, only the time the last response finished (Claude Code's SessionStart field seconds_since_last_response), so the restored countdown is an estimate that can run long by up to that response's generation time and is shown followed by the word estimated in dim text, for example 4:00 estimated, until the next main-thread response that reads or writes the cache replaces it with the exact countdown. When Claude Code reports on resume that the prompt cache has likely expired, the row shows expired instead.
  • Session: the session's API-priced cost and how long it has run.
  • Limits: each rate-limit window the API reports, with a usage bar and the time to its reset. Windows the plugin does not name (an organization spend limit, for example) show under their raw kind. The row is hidden until the first response of the session reports a reading. Plans billed in usage credits, such as Enterprise seats, report no window on responses; turn on showCredits to add their monthly credit spend as Credits, which is read when the session starts, so with it the row can show before any response.
  • Context: the context window fill, split by the largest categories in /context's colors.

Requirements

Function hooks are an early-access Claude Code API that may change between releases without notice. CI tests this plugin on Claude Code 2.1.288. If the band does not appear, update Claude Code; a build where function hooks are still off by default needs CLAUDE_CODE_ENABLE_FUNCTION_HOOKS=1 in its environment.

Install

claude plugin marketplace add crane-valley/claude-plugins
claude plugin install session-band@crane-valley

Options

Set them with /plugin configure session-band@crane-valley, in /config, or with --config KEY=VALUE on claude plugin install. Unset options take the defaults below.

| Option | Default | Meaning | | --- | --- | --- | | cacheTtl | 5m | The prompt cache TTL your main thread uses (5m or 1h). The plugin cannot read it from Claude Code, so a wrong value shows a wrong countdown. | | showCost | true | Show the session's cost. On a subscription this is the API price of the usage, not what you are billed. | | showCredits | false | Add the account's monthly usage-credit spend to the Limits row, as Claude Code's /usage shows it under Usage credits. The plugin asks the same endpoint with your own login at most every 5 minutes. The endpoint is undocumented, so when it changes or answers with an error the row is left out. It carries no reset time, so none is shown. It needs a claude.ai login: on Bedrock, Vertex, a gateway or an API key the plugin sends no request and shows no Credits. |

Sharing the band

The band above the prompt is one slot shared by every plugin. session-band appends its rows to whatever the plugins beneath it drew, so other plugins' rows stay visible; a plugin that draws the band without calling next(e) hides the ones beneath it.

License

MIT

其他同名作品

更多類似作品