跳到主要内容
    ↑↓ 选择↵ 打开esc 关闭
    federicobordon09-dev

    Hush

    opencode-hush·v0.1.3·Git 与版本控制

    Sidebar telemetry panel for the OpenCode TUI: context pressure, Git branch and family session metrics the host does not draw

    GitHub 星标

    0

    月装机量

    0

    综合评分

    20.0

    生态多维模型

    最近提交

    15 分钟前

    2026-10-21

    快速安装与配置

    opencode.json

    写入当前项目的 opencode.json,只对这个仓库生效。

    opencode.json

    {
      "$schema": "https://opencode.ai/config.json",
      "plugin": ["opencode-hush@0.1.3"]
    }

    OpenCode 启动时会通过内嵌运行时自动加载 npm 依赖并缓存至本地目录,无需手动在全局环境执行安装。

    Minimal telemetry for the OpenCode TUI: the context window's pressure, the Git branch and the secondary session metrics the host does not draw. Quiet while everything is healthy, specific when something needs attention.

    Hush sidebar panel on a light OpenCode theme Hush sidebar panel on a dark OpenCode theme

    Every figure comes from the plugin context; nothing is estimated, scraped, or fetched from outside the local runtime.

    Install

    opencode plugin add opencode-hush
    

    Restart OpenCode afterwards. The command prints no progress, and the first load can take close to a minute while the host fetches and precompiles the plugin.

    What it shows

    Section Content Where it comes from
    Context tokens in the window, model limit, thin pressure bar last assistant message carrying usage, after the last completed compaction and before the revert boundary; limit from ModelInfo.limit.context
    Git current branch data.location.vcs.info()
    Meta model, family cost, family tokens, family cached tokens, elapsed time, active reasoning session store plus session.reasoning.* events

    Sections with no data render nothing. A missing limit still shows tokens, just without a pressure bar.

    • Context ≠ session total. Context is what the current window holds, computed with the host's own usage algorithm. The cumulative figures are labelled Tokens and Cached, so the two are never mixed.
    • Cost, Tokens and Cached describe the same scope: the root session's family, so subagent work is counted once, and cached reads get their own dim row instead of inflating Tokens.
    • Pressure is the only adaptive reading: calm below 70%, warn at 70%, critical at 90%. It colors the Context dot; the bar itself sits on the theme accent — one cell of fill at any usage above zero, the full row at 100%.
    • Reasoning reads active only while reasoning content streams. It is never inferred from a model name.

    The panel paints exclusively with the host theme tokens (text, hue and categorical ramps, with one documented fallback when a theme has no semantic accent), so it reads correctly on OpenCode's light and dark themes.

    Requirements

    • Node.js 22.12+
    • Tested with OpenCode 2.1.x

    Development

    Requires Node.js 22.12+ and pnpm.

    pnpm install
    pnpm test
    pnpm build
    pnpm verify:pack
    

    verify:pack packs the tarball, runs the host's real Host.resolve against the installed layout, imports both entrypoints and fails when either one loses its default export — or when the README ships an image that is not absolute.

    Structure

    src/
      index.ts       Server entrypoint: inert, so the package resolves as a plugin
      tui.tsx        TUI entrypoint: claims slots and releases them on deactivate
      telemetry.ts   Reactive session state: store reads, clock, event subscriptions
      panel.tsx      Presentation: sidebar panel
      core/
        bar.ts       Width contract for the context bar's fill
        format.ts    Token, percent, duration and cost formatting
        usage.ts     Token totals, context window, pressure
    test/            Vitest unit tests
    scripts/         Build helpers
    docs/design/     Design references
    

    License

    MIT, copyright © 2026 Federico Bordón.

    同类生态推荐