@mageyuki/opencode-subagent-statusline 0.0.0-stage → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +265 -2
- package/assets/opencode_full.webp +0 -0
- package/assets/opencode_sidebar.webp +0 -0
- package/assets/subagents_monitor_banner.webp +0 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +1505 -0
- package/dist/metafile-esm.json +1 -0
- package/dist/tui-v1.d.ts +130 -0
- package/dist/tui-v1.js +4380 -0
- package/dist/tui-v2.d.ts +5 -0
- package/dist/tui-v2.js +2922 -0
- package/dist/tui.d.ts +7 -0
- package/dist/tui.js +15 -0
- package/package.json +91 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Joaquin Vesco Aparicio
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,266 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Subagent Monitor
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+

|
|
4
|
+
|
|
5
|
+
See delegated work without leaving OpenCode. **Subagent Monitor** is an MIT-licensed OpenCode TUI sidebar plugin that keeps running, completed, and failed subagents visible, with elapsed time and token/context usage when OpenCode provides it.
|
|
6
|
+
|
|
7
|
+
[](https://www.npmjs.com/package/@mageyuki/opencode-subagent-statusline)
|
|
8
|
+
[](https://www.npmjs.com/package/@mageyuki/opencode-subagent-statusline)
|
|
9
|
+
[](https://github.com/mageyuki/sub-agent-statusline)
|
|
10
|
+
[](LICENSE)
|
|
11
|
+
|
|
12
|
+
> **Unofficial fork.** `@mageyuki/opencode-subagent-statusline` is an unofficial, independently maintained fork of [`opencode-subagent-statusline`](https://github.com/Joaquinvesapa/sub-agent-statusline) by Joaquin Vesco Aparicio ([Joaquinvesapa](https://github.com/Joaquinvesapa)); it is not affiliated with or endorsed by the upstream author. Its code is derived from upstream, and its divergence is the OpenCode V2 (2.0.11) compatibility bridge pinned in this repository. The scoped name starts at `0.7.0` and does not continue the upstream `opencode-subagent-statusline` 1.x version line. `0.7.0` is a prepared candidate that has not been published to npm. Source and issues: [mageyuki/sub-agent-statusline](https://github.com/mageyuki/sub-agent-statusline). Licensed under MIT with the original copyright notice preserved in [LICENSE](LICENSE).
|
|
13
|
+
|
|
14
|
+
## Install
|
|
15
|
+
|
|
16
|
+
This compatibility build preserves **OpenCode V1 `>=1.14.50 <2`** and targets **V2 2.0.11**, not arbitrary V2 releases. V1 qualification covers 1.14.50 and 1.18.29 separately; package installation alone is not actual-host qualification. Node remains `>=22.13`.
|
|
17
|
+
|
|
18
|
+
### V2 2.0.11
|
|
19
|
+
|
|
20
|
+
Register the TUI in global `~/.config/opencode/cli.json` (or `$XDG_CONFIG_HOME/opencode/cli.json`), **not** the server plugin list. An illustrative **new** configuration for a reviewed local build is:
|
|
21
|
+
|
|
22
|
+
```json
|
|
23
|
+
{
|
|
24
|
+
"$schema": "https://opencode.ai/v2/cli.json",
|
|
25
|
+
"plugins": ["/absolute/reviewed-artifact/dist"]
|
|
26
|
+
}
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
The local directory must directly contain `tui.js` and its adjacent adapters; neither the package root nor a direct `tui.js` file is the V2 registration form. Keep the complete installed package/dependencies. For a published release containing this dual bridge, the named-package form is `"plugins": ["@mageyuki/opencode-subagent-statusline@0.7.0"]` (an illustrative future form, not an active configuration); root and `/tui` exports are unchanged. These instructions do not mean this development build has been published to npm.
|
|
30
|
+
|
|
31
|
+
Add only this entry to your existing configuration, preserving unrelated plugins/settings. Register one `subagent-statusline.tui` identity. Configuration can reload immediately: first keep a restrictive-permission backup and a known working artifact for rollback. Remove only the added entry to roll back, or restore the backup only if no other edits occurred. Any normal-TUI restart is user-controlled.
|
|
32
|
+
|
|
33
|
+
### V1
|
|
34
|
+
|
|
35
|
+
Add the package to your OpenCode V1 TUI configuration:
|
|
36
|
+
|
|
37
|
+
```json
|
|
38
|
+
{
|
|
39
|
+
"$schema": "https://opencode.ai/tui.json",
|
|
40
|
+
"plugin": ["@mageyuki/opencode-subagent-statusline"]
|
|
41
|
+
}
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
The configuration usually lives at:
|
|
45
|
+
|
|
46
|
+
```txt
|
|
47
|
+
~/.config/opencode/tui.json
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Restart OpenCode after saving the file. The package name is `@mageyuki/opencode-subagent-statusline` and it requires Node `>=22.13`.
|
|
51
|
+
|
|
52
|
+
## Why Subagent Monitor?
|
|
53
|
+
|
|
54
|
+
Delegating work is powerful, but child sessions can disappear into the background. Without a visible status surface, you have to guess:
|
|
55
|
+
|
|
56
|
+
- Is the review agent still running?
|
|
57
|
+
- Did the test agent finish?
|
|
58
|
+
- Which child session failed?
|
|
59
|
+
- How much context did a subagent use?
|
|
60
|
+
|
|
61
|
+
Subagent Monitor restores that visibility inside OpenCode, so you can keep working while still knowing what your delegated agents are doing.
|
|
62
|
+
|
|
63
|
+
## What you get
|
|
64
|
+
|
|
65
|
+
The sidebar shows:
|
|
66
|
+
|
|
67
|
+
- running subagents;
|
|
68
|
+
- recent completed subagents;
|
|
69
|
+
- failed subagents;
|
|
70
|
+
- elapsed time;
|
|
71
|
+
- token/context usage when available.
|
|
72
|
+
|
|
73
|
+
When subagent activity is active, the plugin also adds a compact summary to the home/footer area.
|
|
74
|
+
|
|
75
|
+
## Gentle AI integration
|
|
76
|
+
|
|
77
|
+
[Gentle AI](https://github.com/Gentleman-Programming/gentle-ai) offers Subagent Monitor as an optional OpenCode community plugin. Select and install it through Gentle AI to add the selected plugin to OpenCode's `tui.json`, or install this package directly using the configuration above.
|
|
78
|
+
|
|
79
|
+
This integration is optional. Subagent Monitor remains an independently installable OpenCode plugin.
|
|
80
|
+
|
|
81
|
+
## Screenshots
|
|
82
|
+
|
|
83
|
+
Full OpenCode context with demo content in Spanish:
|
|
84
|
+
|
|
85
|
+

|
|
86
|
+
|
|
87
|
+
Focused sidebar view:
|
|
88
|
+
|
|
89
|
+

|
|
90
|
+
|
|
91
|
+
## Keyboard navigation
|
|
92
|
+
|
|
93
|
+
Run `Subagents: Focus sidebar list` from the OpenCode command palette, or press `Alt+B`, to focus the subagent sidebar list without using the mouse. List navigation shortcuts are handled only while the sidebar list is focused.
|
|
94
|
+
|
|
95
|
+
| Shortcut | Action |
|
|
96
|
+
| --- | --- |
|
|
97
|
+
| `Alt+B` | Toggle focus between the subagent sidebar list and the prompt. |
|
|
98
|
+
| `j` / `ArrowDown` | Move selection to the next visible subagent. |
|
|
99
|
+
| `k` / `ArrowUp` | Move selection to the previous visible subagent. |
|
|
100
|
+
| `Enter` | Open the selected subagent session. |
|
|
101
|
+
| `c` | Toggle retained completed history in the sidebar. |
|
|
102
|
+
| `h` / `ArrowLeft` | Collapse the subagent section. |
|
|
103
|
+
| `l` / `ArrowRight` | Expand the subagent section. |
|
|
104
|
+
| `Esc` | Leave list focus mode and return to the prompt. |
|
|
105
|
+
|
|
106
|
+
Opening a selected session is a no-op when there is no visible or navigable subagent.
|
|
107
|
+
|
|
108
|
+
Click `Σ` in the sidebar aggregate row to toggle completed history with the mouse. The toggle is not persisted; it resets when OpenCode or the plugin is reloaded. Completed history is bounded retained history, not a full database: terminal rows are kept for up to 3 days with a 1,500-row cap, and rows already pruned from state are not restored.
|
|
109
|
+
|
|
110
|
+
When a child session is opened from the sidebar, return with OpenCode `Up` (`session_parent` on V1, `session.parent` on V2) to type in the parent prompt. V2 leaves focus to the newly mounted host editor rather than refocusing an old editor or the list. Dialogs and hidden sidebars must not capture list input; `Alt/Option+Left` retains host word navigation.
|
|
111
|
+
|
|
112
|
+
<details>
|
|
113
|
+
<summary>Stable public contract</summary>
|
|
114
|
+
|
|
115
|
+
For releases of this scoped package line, including the `0.7.0` candidate, the stable user-facing contract is:
|
|
116
|
+
|
|
117
|
+
- npm package name: `@mageyuki/opencode-subagent-statusline`;
|
|
118
|
+
- TUI plugin entrypoints: `@mageyuki/opencode-subagent-statusline` and `@mageyuki/opencode-subagent-statusline/tui`;
|
|
119
|
+
- OpenCode V1 `tui.json` or V2 `cli.json` TUI configuration;
|
|
120
|
+
- visible sidebar and home/footer behavior;
|
|
121
|
+
- command palette entry, `Alt+B`, and focused-list navigation;
|
|
122
|
+
- local privacy and persistence behavior described in this README;
|
|
123
|
+
- Node, peer dependency, and install contract declared in `package.json`.
|
|
124
|
+
|
|
125
|
+
Experimental or internal surfaces may change without a SemVer-major bump:
|
|
126
|
+
|
|
127
|
+
- `@mageyuki/opencode-subagent-statusline/runtime`, a **V1-only** diagnostic/file-output experiment, not a V2 requirement;
|
|
128
|
+
- diagnostic environment variables;
|
|
129
|
+
- exact `state.json` schema and `status.txt` format;
|
|
130
|
+
- internal source modules and source-level exports.
|
|
131
|
+
|
|
132
|
+
Use the TUI plugin entrypoints for normal OpenCode usage.
|
|
133
|
+
|
|
134
|
+
</details>
|
|
135
|
+
|
|
136
|
+
## Documentation
|
|
137
|
+
|
|
138
|
+
For deeper installation, architecture, event-flow, state, rendering, TUI, configuration, testing, and troubleshooting details:
|
|
139
|
+
|
|
140
|
+
- [English documentation](docs/en/00-index.md)
|
|
141
|
+
- [Documentación en español](docs/es/00-indice.md)
|
|
142
|
+
- [Testing strategy](docs/testing.md)
|
|
143
|
+
|
|
144
|
+
## Troubleshooting
|
|
145
|
+
|
|
146
|
+
### The plugin does not show up
|
|
147
|
+
|
|
148
|
+
Check OpenCode logs:
|
|
149
|
+
|
|
150
|
+
```sh
|
|
151
|
+
grep -n "subagent-statusline\|failed to load tui plugin" ~/.local/share/opencode/log/*.log
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
For V1, restart OpenCode after changing `tui.json`. For V2, check the global `cli.json` and any `OPENCODE_CLI_CONFIG_CONTENT` override; local registration must point to the directory containing `tui.js`. V2 logs normally use `~/.local/share/opencode/log/opencode.log`. Do not restart a shared service just to reload this TUI plugin.
|
|
155
|
+
|
|
156
|
+
### I installed a new version but OpenCode still behaves like the old one
|
|
157
|
+
|
|
158
|
+
OpenCode may be using a cached package. Try clearing the cached package directory under:
|
|
159
|
+
|
|
160
|
+
```txt
|
|
161
|
+
~/.cache/opencode/packages/
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
Then restart OpenCode.
|
|
165
|
+
|
|
166
|
+
### Token/context usage is missing
|
|
167
|
+
|
|
168
|
+
OpenCode event payloads vary by host. V1 retains its existing token/context display. V2 displays cumulative **input + output usage**, not context occupancy; it does not infer a context percentage. Summary/model fields are optional. `Interrupted` and `Status may be stale` are feedback within the existing three states, not new persistent statuses.
|
|
169
|
+
|
|
170
|
+
## Local privacy and persistence
|
|
171
|
+
|
|
172
|
+
The plugin persists a local JSON state file and `status.txt` snapshot under `XDG_RUNTIME_DIR` or the system temp directory by default. Those files can include OpenCode-derived subagent titles and summaries, which may contain short fragments derived from prompts or task descriptions. Files are written best-effort with owner-only permissions and atomic temp-file replacement where Node and the host filesystem support them.
|
|
173
|
+
|
|
174
|
+
V2 uses a `v2` subdirectory under the existing default instance directory, with the same `state.json`/`status.txt` format and terminal retention (3 days, 1,500 rows; active children are not capped). It hydrates the connected host, not saved V1 state. `OPENCODE_SUBAGENT_STATUSLINE_STATE` remains an **exact-path override**: use a distinct path for each concurrent V1/V2/runtime writer. Treat it as trusted local configuration.
|
|
175
|
+
|
|
176
|
+
For token/context backfill, the **V1 TUI only** reads recent local OpenCode SQLite/log data. V2 uses public connected-host session/event/cache APIs, including remote hosts; it does not scrape databases/logs or persist raw events, messages, tool output, credentials, or exception bodies. V1 debug-log/DB/stale-fallback options and runtime startup-preservation options do not acquire those semantics on V2.
|
|
177
|
+
|
|
178
|
+
<details>
|
|
179
|
+
<summary>Development and testing</summary>
|
|
180
|
+
|
|
181
|
+
Use Node `>=22.13` and pnpm `11.2.2`. Install dependencies with lifecycle scripts disabled:
|
|
182
|
+
|
|
183
|
+
```sh
|
|
184
|
+
pnpm install --ignore-scripts
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
Build the plugin:
|
|
188
|
+
|
|
189
|
+
```sh
|
|
190
|
+
pnpm build
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
Test a local **V1** TUI build by pointing OpenCode directly at `dist/tui.js` (V2 uses the directory form above):
|
|
194
|
+
|
|
195
|
+
```json
|
|
196
|
+
{
|
|
197
|
+
"$schema": "https://opencode.ai/tui.json",
|
|
198
|
+
"plugin": ["/absolute/path/to/sub-agent-statusline/dist/tui.js"]
|
|
199
|
+
}
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
`src/tui.tsx` is a host-runtime-free lazy bridge built without bundling. Separate `tui-v1.js`/`tui-v2.js` adapters bundle the shared view using Solid `universal` mode; host API, Solid, OpenTUI and theme runtimes remain external. The build cleans `dist` once before all configurations.
|
|
203
|
+
|
|
204
|
+
Package entrypoints:
|
|
205
|
+
|
|
206
|
+
```txt
|
|
207
|
+
@mageyuki/opencode-subagent-statusline -> TUI plugin
|
|
208
|
+
@mageyuki/opencode-subagent-statusline/tui -> TUI plugin
|
|
209
|
+
@mageyuki/opencode-subagent-statusline/runtime -> experimental/diagnostic runtime mode
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
Useful commands:
|
|
213
|
+
|
|
214
|
+
```sh
|
|
215
|
+
pnpm build
|
|
216
|
+
pnpm typecheck
|
|
217
|
+
pnpm exec tsc --noEmit -p tsconfig.test.json
|
|
218
|
+
pnpm test
|
|
219
|
+
pnpm test:package
|
|
220
|
+
pnpm test:watch
|
|
221
|
+
pnpm test:coverage
|
|
222
|
+
pnpm pack --dry-run
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
`test:package` builds first, packs the artifact and checks its parsed runtime/declaration graph. Ordinary tests exclude that file so they never consume stale `dist`. Both Vitest configurations prohibit `.only` tests.
|
|
226
|
+
|
|
227
|
+
The baseline CI lane remains Node **22.13**. Ordinary Node 22/24 skips native cases only when `node:ffi` is unavailable; the required native lane uses an isolated official Node **26.4.0** and must report **zero skips**. Select that binary as `node`, without replacing your normal runtime, and enable FFI in parent and workers:
|
|
228
|
+
|
|
229
|
+
```sh
|
|
230
|
+
node --experimental-ffi node_modules/vitest/vitest.mjs run --execArgv=--experimental-ffi
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
Neither native Vitest nor synthetic data substitutes for actual packed-host interaction checks or genuine normal-TUI execution acceptance. See the [development guide](docs/en/09-development-and-testing.md) for exact peer combinations and the host matrix.
|
|
234
|
+
|
|
235
|
+
</details>
|
|
236
|
+
|
|
237
|
+
<details>
|
|
238
|
+
<summary>Security hardening for maintainers</summary>
|
|
239
|
+
|
|
240
|
+
Recommended local npm/pnpm hygiene, following guidance from Gentle AI and Liran Tal:
|
|
241
|
+
|
|
242
|
+
- install project dependencies with lifecycle scripts disabled when possible, for example `pnpm install --ignore-scripts`;
|
|
243
|
+
- consider setting user-level `ignore-scripts=true` for npm/pnpm and temporarily opt in only when a trusted package needs scripts;
|
|
244
|
+
- enable dependency age/cooldown policies where supported, for example `npm config set min-release-age 3` or equivalent Renovate/Dependabot cooldowns;
|
|
245
|
+
- block or review git, tarball, URL, and other exotic dependency specs, for example `npm config set allow-git none` where supported;
|
|
246
|
+
- optionally screen new packages with tools such as `npq` or Socket Firewall before adding them.
|
|
247
|
+
|
|
248
|
+
These are maintainer/developer controls, not runtime enforcement by this plugin.
|
|
249
|
+
|
|
250
|
+
Release maintainers should keep the repository `NPM_TOKEN` secret restricted, retain npm provenance, require npm 2FA on maintainer accounts, and protect the release branch in GitHub. See the [release process](docs/releasing.md) for the tag and recovery gates.
|
|
251
|
+
|
|
252
|
+
</details>
|
|
253
|
+
|
|
254
|
+
## Community and releases
|
|
255
|
+
|
|
256
|
+
- [npm package](https://www.npmjs.com/package/@mageyuki/opencode-subagent-statusline)
|
|
257
|
+
- [GitHub repository](https://github.com/mageyuki/sub-agent-statusline)
|
|
258
|
+
- [Releases](https://github.com/mageyuki/sub-agent-statusline/releases)
|
|
259
|
+
- [Issues](https://github.com/mageyuki/sub-agent-statusline/issues)
|
|
260
|
+
- [Contributing](CONTRIBUTING.md)
|
|
261
|
+
- [Code of Conduct](CODE_OF_CONDUCT.md)
|
|
262
|
+
- [Security policy](SECURITY.md)
|
|
263
|
+
|
|
264
|
+
## License
|
|
265
|
+
|
|
266
|
+
[MIT](LICENSE)
|
|
Binary file
|
|
Binary file
|
|
Binary file
|