ClaudeMods
☰
ZH-CN
● 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

其他同名作品

更多类似作品