9
193
近 7 天 164
42.2
生态多维模型
7 天前
2026-08-13
快速安装与配置
opencode.json写入当前项目的 opencode.json,只对这个仓库生效。
opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["@alexandroheredia/opencode-last-activity@0.1.1"]
}写入 ~/.config/opencode/opencode.json,对所有项目生效。
~/.config/opencode/opencode.json
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["@alexandroheredia/opencode-last-activity@0.1.1"]
}若你要在本地改造这个插件,先装到项目里再从本地路径引用。
shell
pnpm add -D @alexandroheredia/opencode-last-activityopencode 启动时会通过内嵌运行时自动加载 npm 依赖并缓存至本地目录,无需手动在全局环境执行安装。
OpenCode TUI plugin that shows a relative last-activity indicator in session_prompt_right so you can tell whether the current session is active, waiting, retrying, or possibly stalled.
Demo
https://github.com/user-attachments/assets/8dccc64a-ed73-4582-b981-beead5537dc5
Features
- shows
active nowwhile work is happening - shows
last activity 8s agowhen the session is idle - shows
waiting on permissionandwaiting on questionwhen input is blocked - shows
possibly stalled 2m agowhen the session stays busy without recent activity - optional inactivity-only mode that stays hidden until the session goes quiet
- optional compact mode for tighter prompt layouts
Install
Install the package with OpenCode:
opencode plugin @alexandroheredia/opencode-last-activity
Then quit and restart OpenCode.
Manual Config
If you prefer to edit tui.json directly:
{
"$schema": "https://opencode.ai/tui.json",
"plugin": [
[
"@alexandroheredia/opencode-last-activity",
{
"compact": false,
"activeWindowMs": 5000,
"inactivityNoticeMs": 30000,
"stalledWindowMs": 60000,
"visibility": "always"
}
]
]
}
Options
| Option | Type | Default | Description |
|---|---|---|---|
compact |
boolean |
false |
Uses shorter labels such as active, 2m ago, and stalled 2m ago. |
visibility |
"always" | "inactivity-only" |
"always" |
Controls whether the indicator is always visible or only after inactivity. |
activeWindowMs |
number |
5000 |
Age threshold that still counts as active. |
inactivityNoticeMs |
number |
30000 |
In inactivity-only mode, how long to wait before showing quiet sessions. |
stalledWindowMs |
number |
60000 |
Age threshold for switching a busy session to stalled. |
If inactivityNoticeMs is set lower than activeWindowMs, the plugin raises it to match the active window. If stalledWindowMs is set lower than inactivityNoticeMs, the plugin pushes it above the inactivity threshold so labels stay sane.
Inactivity-Only Example
If you only want to see the indicator when OpenCode has gone quiet for a while:
{
"$schema": "https://opencode.ai/tui.json",
"plugin": [
[
"@alexandroheredia/opencode-last-activity",
{
"visibility": "inactivity-only",
"inactivityNoticeMs": 30000,
"stalledWindowMs": 60000
}
]
]
}
In this mode, active sessions stay hidden until there has been no output for at least inactivityNoticeMs. Permission prompts, questions, and retries still show immediately.
Label Examples
Full mode:
active nowlast activity just nowwaiting on permissionwaiting on questionretrying 12s agopossibly stalled 3m ago
Compact mode:
activejust nowpermissionquestionretry 12s agostalled 3m ago
Contributing
Development setup and local testing notes live in CONTRIBUTING.md.