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

    Turn Stats

    opencode-turn-stats·v1.0.0·可观测与分析

    Current-turn processed-token count for the OpenCode sidebar

    GitHub 星标

    0

    月装机量

    175

    近 7 天 6

    综合评分

    33.0

    生态多维模型

    最近提交

    21 天前

    2026-09-13

    快速安装与配置

    opencode.json

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

    opencode.json

    {
      "$schema": "https://opencode.ai/config.json",
      "plugin": ["opencode-turn-stats@1.0.0"]
    }

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

    OpenCode sidebar showing current-turn processed tokens

    OpenCode Turn Stats adds one line to the OpenCode sidebar:

    This turn 13k processed
    

    It counts uncached work reported for the current user turn. The count includes input, cache writes, visible output, and reasoning across tool-call continuations. It excludes cache reads.

    The plugin uses only synchronised OpenCode host state. It makes no provider requests, reads no transcript files, starts no subprocesses, and stores no usage history. If the host records cannot support the number, the row is omitted instead of estimated.

    OpenCode exposes synchronised, bounded snapshots without a completeness marker. The plugin omits the row when a missing or inconsistent record is detectable. A pathological snapshot that loses an earlier step while retaining a matching latest step is indistinguishable from complete host state.

    OpenCode 1.18.30 or later is required.

    Install

    Install the published package:

    opencode plugin opencode-turn-stats --global
    

    Restart OpenCode. Show the sidebar. The row appears below built-in Context and above MCP. OpenCode does not currently expose an insertion point inside the built-in Context component.

    For an unpublished checkout:

    bun install --frozen-lockfile
    bun run build
    

    Add the built entry to the plugin array in ~/.config/opencode/tui.json:

    {
      "$schema": "https://opencode.ai/tui.json",
      "plugin": ["file:///absolute/path/to/opencode-turn-stats/dist/tui.js"]
    }
    

    On Windows, use a URL such as file:///C:/projects/opencode-turn-stats/dist/tui.js.

    Development

    Run all checks:

    bun run verify
    

    Create and check the release archive without publishing it:

    bun pm pack
    bun run package:check --packed
    

    Licence

    MIT - see LICENSE.

    同类生态推荐