{"_id":"@capybearista/opencode-ram-monitor","_rev":"4-e091af7bac9ddaad7ab3193fe5942f84","name":"@capybearista/opencode-ram-monitor","dist-tags":{"latest":"2.0.0"},"versions":{"0.0.0":{"name":"@capybearista/opencode-ram-monitor","version":"0.0.0","author":{"name":"capyBearista","email":"capybearista@gmail.com"},"license":"MPL-2.0","_id":"@capybearista/opencode-ram-monitor@0.0.0","maintainers":[{"name":"capybearista","email":"capybearista@gmail.com"}],"dist":{"shasum":"ce3421ba91a869bc51eca61d5646b54d0fc34cf7","tarball":"https://registry.npmjs.org/@capybearista/opencode-ram-monitor/-/opencode-ram-monitor-0.0.0.tgz","fileCount":14,"integrity":"sha512-QXV2ebOmRp0moeAFukIUO5Qp00IbytknpDikMG4YS9Ar/gF71IdnrsfO5N6Se7Revi3mzx/2pr88yJErOD+VJw==","signatures":[{"sig":"MEUCIAtvd0FmUt1anmr+Sv3JqAE9xLp2yrcnbijyE6/07zOeAiEArz0nOo12g9eg6L9slg3CPpU0n+2BGD9v94WSrcW1lnw=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":102306},"main":"./dist/server.js","type":"module","types":"./dist/server.d.ts","exports":{".":{"types":"./dist/server.d.ts","default":"./dist/server.js"},"./tui":{"types":"./dist/sidebar.d.ts","default":"./dist/sidebar.js"},"./server":{"types":"./dist/server.d.ts","default":"./dist/server.js"}},"gitHead":"c473624b0f15a8560e22ac793ca01517e038f41d","scripts":{"ci":"bunx @biomejs/biome ci .","lint":"bunx @biomejs/biome check .","test":"bun test","build":"rm -rf dist && tsc --project tsconfig.build.json --emitDeclarationOnly && bun build src/server.ts --outfile=dist/server.js --target=bun --external '@opentui/*' --external 'solid-js' --external 'tree-sitter*' && bun build src/memory.ts --outfile=dist/memory.js --target=bun && bun build src/sidebar-config.ts --outfile=dist/sidebar-config.js --target=bun && bun build src/debug.ts --outfile=dist/debug.js --target=bun && bun build src/sidebar.tsx --outfile=dist/sidebar.js --target=bun --external '@opentui/*' --external 'solid-js' --external 'tree-sitter*'","check":"bunx @biomejs/biome check --write .","typecheck":"tsc --noEmit"},"_npmUser":{"name":"capybearista","email":"capybearista@gmail.com"},"oc-plugin":["server","tui"],"_npmVersion":"11.13.0","description":"Monitor RAM usage of OpenCode sessions","directories":{},"_nodeVersion":"22.18.0","_hasShrinkwrap":false,"devDependencies":{"solid-js":">=1.9.0","@types/bun":"latest","typescript":"^5.8.0","@types/node":"^25.6.0","@opentui/core":">=0.1.103","@opentui/solid":">=0.1.103","@opencode-ai/plugin":">=1.14.24"},"peerDependencies":{"solid-js":">=1.9.0","@opentui/solid":">=0.1.103","@opencode-ai/plugin":">=1.14.24"},"_npmOperationalInternal":{"tmp":"tmp/opencode-ram-monitor_0.0.0_1778436004753_0.25145037959750094","host":"s3://npm-registry-packages-npm-production"}},"1.0.0":{"name":"@capybearista/opencode-ram-monitor","version":"1.0.0","author":{"name":"capyBearista","email":"capybearista@gmail.com"},"license":"MPL-2.0","_id":"@capybearista/opencode-ram-monitor@1.0.0","maintainers":[{"name":"capybearista","email":"capybearista@gmail.com"}],"homepage":"https://github.com/capyBearista/opencode-plugins#readme","bugs":{"url":"https://github.com/capyBearista/opencode-plugins/issues"},"dist":{"shasum":"a8b52d6cc04f9e4e44a9c682cb4e930597ec0149","tarball":"https://registry.npmjs.org/@capybearista/opencode-ram-monitor/-/opencode-ram-monitor-1.0.0.tgz","fileCount":14,"integrity":"sha512-1+Qp6SxZUNwWsuPAXI257pRIGdf7mrFLQFURZtCBVvuTbnFO/SVotKEWzLK8LtBx0fwrJ1e+kOAD4YMXgQrcpA==","signatures":[{"sig":"MEQCIEOA9Z4hzN2z0gd9AoaVtsUF0e/ox4VOYmIIt0aeaQoYAiB+e2ao33xA0jQiNyAbfWpioOVy3BDPOmD5FhXyEg6aSg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@capybearista%2fopencode-ram-monitor@1.0.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":102470},"main":"./dist/server.js","type":"module","types":"./dist/server.d.ts","exports":{".":{"types":"./dist/server.d.ts","default":"./dist/server.js"},"./tui":{"types":"./dist/sidebar.d.ts","default":"./dist/sidebar.js"},"./server":{"types":"./dist/server.d.ts","default":"./dist/server.js"}},"gitHead":"0b0c2871c38db10b6223114bba4c358fa35b78bb","scripts":{"ci":"bunx @biomejs/biome ci .","lint":"bunx @biomejs/biome check .","test":"bun test","build":"rm -rf dist && tsc --project tsconfig.build.json --emitDeclarationOnly && bun build src/server.ts --outfile=dist/server.js --target=bun --external '@opentui/*' --external 'solid-js' --external 'tree-sitter*' && bun build src/memory.ts --outfile=dist/memory.js --target=bun && bun build src/sidebar-config.ts --outfile=dist/sidebar-config.js --target=bun && bun build src/debug.ts --outfile=dist/debug.js --target=bun && bun build src/sidebar.tsx --outfile=dist/sidebar.js --target=bun --external '@opentui/*' --external 'solid-js' --external 'tree-sitter*'","check":"bunx @biomejs/biome check --write .","typecheck":"tsc --noEmit"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:1accb825-1c76-4bf2-9db9-3a6b3b41da42"}},"oc-plugin":["server","tui"],"repository":{"url":"git+https://github.com/capyBearista/opencode-plugins.git","type":"git","directory":"packages/opencode-agents-loader"},"_npmVersion":"11.11.0","description":"Monitor RAM usage of OpenCode sessions","directories":{},"_nodeVersion":"24.14.1","_hasShrinkwrap":false,"devDependencies":{"solid-js":">=1.9.0","@types/bun":"latest","typescript":"^5.8.0","@types/node":"^25.6.0","@opentui/core":">=0.1.103","@opentui/solid":">=0.1.103","@opencode-ai/plugin":">=1.14.24"},"peerDependencies":{"solid-js":">=1.9.0","@opentui/solid":">=0.1.103","@opencode-ai/plugin":">=1.14.24"},"_npmOperationalInternal":{"tmp":"tmp/opencode-ram-monitor_1.0.0_1778437185888_0.8592869694989929","host":"s3://npm-registry-packages-npm-production"}},"1.1.0":{"name":"@capybearista/opencode-ram-monitor","version":"1.1.0","author":{"name":"capyBearista","email":"capybearista@gmail.com"},"license":"MPL-2.0","_id":"@capybearista/opencode-ram-monitor@1.1.0","maintainers":[{"name":"capybearista","email":"capybearista@gmail.com"}],"homepage":"https://github.com/capyBearista/opencode-plugins#readme","bugs":{"url":"https://github.com/capyBearista/opencode-plugins/issues"},"dist":{"shasum":"911c743367ecaaac8126661223ee86a3db14c6de","tarball":"https://registry.npmjs.org/@capybearista/opencode-ram-monitor/-/opencode-ram-monitor-1.1.0.tgz","fileCount":15,"integrity":"sha512-WVSdGmZcW6j111YM3vTql439dNZDudJm+pw0dnLb58PXOAGzNAdBdLfUisgKUTNCSfqaCyLBkUlY0GJtW1k6Mg==","signatures":[{"sig":"MEUCIQCZf8zoCe3/qChux1MhmbTdzZpMxa5LWsNMLGk3m+lZaQIgObcJYe5NE30XWgs9lKkZ2cy1SP18BNq1x9xO+0npNZQ=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@capybearista%2fopencode-ram-monitor@1.1.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":136155},"main":"./dist/server.js","type":"module","types":"./dist/server.d.ts","exports":{".":{"types":"./dist/server.d.ts","default":"./dist/server.js"},"./tui":{"types":"./dist/sidebar.d.ts","default":"./dist/sidebar.js"},"./server":{"types":"./dist/server.d.ts","default":"./dist/server.js"}},"gitHead":"cc9023676df97aebda01d9a9cc8aab17402923cb","scripts":{"ci":"bunx @biomejs/biome ci .","lint":"bunx @biomejs/biome check .","test":"bun test","build":"rm -rf dist && tsc --project tsconfig.build.json --emitDeclarationOnly && bun build src/server.ts --outfile=dist/server.js --target=bun --external '@opentui/*' --external 'solid-js' --external 'tree-sitter*' && bun build src/memory.ts --outfile=dist/memory.js --target=bun && bun build src/sidebar-config.ts --outfile=dist/sidebar-config.js --target=bun && bun build src/debug.ts --outfile=dist/debug.js --target=bun && bun build src/sidebar.tsx --outfile=dist/sidebar.js --target=bun --external '@opentui/*' --external 'solid-js' --external 'tree-sitter*'","check":"bunx @biomejs/biome check --write .","typecheck":"tsc --noEmit"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:1accb825-1c76-4bf2-9db9-3a6b3b41da42"}},"oc-plugin":["server","tui"],"repository":{"url":"git+https://github.com/capyBearista/opencode-plugins.git","type":"git","directory":"packages/opencode-ram-monitor"},"_npmVersion":"11.11.0","description":"Monitor OpenCode's RAM usage in real-time, right from your sidebar.","directories":{},"_nodeVersion":"24.14.1","_hasShrinkwrap":false,"devDependencies":{"solid-js":">=1.9.0","@types/bun":"latest","typescript":"^5.8.0","@types/node":"^25.6.0","@opentui/core":">=0.1.103","@opentui/solid":">=0.1.103","@opencode-ai/plugin":">=1.14.24"},"peerDependencies":{"solid-js":">=1.9.0","@opentui/solid":">=0.1.103","@opencode-ai/plugin":">=1.14.24"},"_npmOperationalInternal":{"tmp":"tmp/opencode-ram-monitor_1.1.0_1778449977346_0.6869385429141155","host":"s3://npm-registry-packages-npm-production"}},"2.0.0":{"_id":"@capybearista/opencode-ram-monitor@2.0.0","bugs":{"url":"https://github.com/capyBearista/opencode-plugins/issues"},"dist":{"shasum":"a31fc561c7e51882333cf45209ee45e5c34fb218","tarball":"https://registry.npmjs.org/@capybearista/opencode-ram-monitor/-/opencode-ram-monitor-2.0.0.tgz","fileCount":14,"integrity":"sha512-zaBzXTcktVULJFkrwuIIiTEZH/R6s2oN+gNtCfrO+00QpKdjb4Ib+wyosf0HqbeE9Os/rap+IU5SOvEKjN1GiQ==","signatures":[{"sig":"MEUCIDKKrzBpzpAh4VwRg0w4DOQUnpY/wb6C8HGBHWP0yEqXAiEAg5dIpIlRVOfxY92RXG9ydvb96dTabkoVNGsnSkG3Y+M=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDZfPbGgrzeMAtZ0v6ppYpVTg0NUKXpEbE21JCHzHQe2wIgQ8mzj64xMk05dm2bK28T1bJgZ4rbW7//sSSd5wOmzFQ="}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@capybearista%2fopencode-ram-monitor@2.0.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":106049},"main":"./dist/server.js","name":"@capybearista/opencode-ram-monitor","type":"module","types":"./dist/server.d.ts","author":{"name":"capyBearista","email":"capybearista@gmail.com"},"exports":{".":{"types":"./dist/server.d.ts","default":"./dist/server.js"},"./tui":{"types":"./dist/tui.d.ts","default":"./dist/tui.js"},"./server":{"types":"./dist/server.d.ts","default":"./dist/server.js"}},"gitHead":"1fa4bbe34b23eea0dac68e42f07d0637a0465742","license":"MPL-2.0","scripts":{"ci":"bunx @biomejs/biome ci .","lint":"bunx @biomejs/biome check .","test":"bun test","build":"rm -rf dist && tsc --project tsconfig.build.json --emitDeclarationOnly && bun build src/server.ts --outfile=dist/server.js --target=bun --external '@opencode/*' && bun build src/tui.ts --outfile=dist/tui.js --target=bun --external '@opencode/*' --external '@opentui/*' --external 'solid-js' --external 'tree-sitter*'","check":"bunx @biomejs/biome check --write .","smoke":"bun run build && bun scripts/smoke-built.ts","start":"node server.js","typecheck":"tsc --noEmit"},"version":"2.0.0","_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:1accb825-1c76-4bf2-9db9-3a6b3b41da42"}},"homepage":"https://github.com/capyBearista/opencode-plugins#readme","repository":{"url":"git+https://github.com/capyBearista/opencode-plugins.git","type":"git","directory":"packages/opencode-ram-monitor"},"_npmVersion":"11.19.0","description":"Monitor OpenCode's RAM usage in real-time, right from your sidebar.","directories":{},"maintainers":[{"name":"capybearista","email":"capybearista@gmail.com"}],"_nodeVersion":"24.11.1","_hasShrinkwrap":false,"devDependencies":{"solid-js":"1.9.12","@types/bun":"latest","typescript":"^5.8.0","@types/node":"^25.8.0","@opentui/core":"0.5.10","@opentui/solid":"0.5.10","@opencode/plugin":"2.0.2"},"peerDependencies":{"solid-js":">=1.9.0","@opentui/core":">=0.5.10","@opentui/solid":">=0.5.10","@opencode/plugin":"2.0.2"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/opencode-ram-monitor_2.0.0_1790338830770_0.8448538336185287"}}},"time":{"created":"2026-05-10T18:00:04.670Z","modified":"2026-09-25T12:20:31.234Z","0.0.0":"2026-05-10T18:00:04.919Z","1.0.0":"2026-05-10T18:19:46.053Z","1.1.0":"2026-05-10T21:52:57.526Z","2.0.0":"2026-09-25T12:20:30.898Z"},"bugs":{"url":"https://github.com/capyBearista/opencode-plugins/issues"},"author":{"name":"capyBearista","email":"capybearista@gmail.com"},"license":"MPL-2.0","homepage":"https://github.com/capyBearista/opencode-plugins#readme","repository":{"url":"git+https://github.com/capyBearista/opencode-plugins.git","type":"git","directory":"packages/opencode-ram-monitor"},"description":"Monitor OpenCode's RAM usage in real-time, right from your sidebar.","maintainers":[{"name":"capybearista","email":"capybearista@gmail.com"}],"readme":"# opencode-ram-monitor\n\n<p align=\"center\">Zero-dependency RAM monitoring for OpenCode sessions</p>\n<p align=\"center\">\n  <a href=\"https://www.npmjs.com/package/@capybearista/opencode-ram-monitor\"><img alt=\"npm\" src=\"https://img.shields.io/npm/v/@capybearista/opencode-ram-monitor?style=flat-square&color=8d60e6\" /></a>\n  <a href=\"https://www.npmjs.com/package/@capybearista/opencode-ram-monitor\"><img alt=\"npm\" src=\"https://img.shields.io/npm/dm/@capybearista/opencode-ram-monitor?style=flat-square&color=6067e6\" /></a>\n  <a href=\"https://opencode.ai\"><img alt=\"opencode\" src=\"https://img.shields.io/badge/OpenCode-Plugin-orange?style=flat-square&color=60a5e6\" /></a>\n  <a href=\"https://opensource.org/licenses/MPL-2.0\"><img alt=\"license\" src=\"https://img.shields.io/badge/License-MPL--2.0-blue.svg?style=flat-square&color=60dfe6\" /></a>\n</p>\n\n[![OpenCode Ram Monitor sidebar](../../.github/assets/ram-monitor-sidebar.webp)]([../../.github/assets/ram-monitor-sidebar.webp](https://github.com/capyBearista/opencode-plugins/tree/main/packages/opencode-ram-monitor))\n\n---\n\n## Why?\n\n> This plugin gives developers real-time, zero-dependency insight into OpenCode session memory. The sidebar shows direct RSS and with-tools RSS for the current session and all sessions. The `/ram` command (and clicking the widget) opens the broader process-tree view in a pop-up.\n\n## Philosophy: Extending OpenCode\n\nOpenCode is designed to be highly extensible. The TUI side is the primary way to use this plugin: a sidebar slot renders a compact card, and `/ram` (or clicking the card) opens the full tree in a modal. The server side is secondary: it registers `/ram` for sessions without a TUI by injecting the tree into the session. It runs locally and falls back cleanly if process sampling fails.\n\n### Architecture\n\n```mermaid\nflowchart TB\n  TUI[\"TUI plugin (primary)\"] --> Widget[\"RAM widget\"]\n  TUI --> Modal[\"/ram modal\"]\n  Widget --> Snapshot[\"Shared process snapshot cache\"]\n  Snapshot --> Metrics[\"RSS + session metrics\"]\n  Modal --> Tree[\"Session process tree\"]\n  Server[\"Server plugin (secondary)\"] --> Headless[\"/ram for non-TUI sessions\"]\n```\n\nCompact sidebar summary on the left. Full process tree in a modal on `/ram` or widget click.\n\n## Features\n\n- **Real-time Sidebar Widget**: View direct and with-tools RAM for the current session and all sessions in a compact OpenCode sidebar card.\n- **Active Session Tracking**: Automatically discovers logical OpenCode sessions and aggregates their RAM.\n- **Cross-Platform**: Uses native commands (`ps` on Unix, `wmic` on Windows) for lightweight zero-dependency metrics.\n- **`/ram` Command**: Opens a detailed, heavy process-tree breakdown across all active OpenCode sessions in a pop-up (also opened by clicking the sidebar widget). In sessions without a TUI, the server entry injects the tree into the chat instead.\n- **Configurable**: Polling interval via plugin `options`, with `experimental.ramMonitor.refreshIntervalMs` config-file keys as fallback.\n\n## Install\n\nThe TUI entry is the primary path. Add the plugin to `cli.json` (global config):\n\n```json\n{\n  \"plugins\": [\"@capybearista/opencode-ram-monitor\"]\n}\n```\n\nFor sessions without a TUI, also add the server entry to `opencode.json` or `opencode.jsonc`:\n\n```json\n{\n  \"plugins\": [\"@capybearista/opencode-ram-monitor\"]\n}\n```\n\nBoth files use the plural `\"plugins\"` key. For a local directory install, point at the package directory (which resolves `tui.js`/`server.js`), not `dist/`.\n\n## Updating\n\nSimply run the following command while no active OpenCode sessions are running:\n\n```bash\nrm -rf ~/.cache/opencode/packages/'opencode-ram-monitor@latest'/\n```\n\nThe next time you open OpenCode, the new version will be installed!\n\n## Usage\n\nOnce installed, the RAM monitor will automatically appear in your OpenCode TUI sidebar, polling your system to display direct and with-tools memory for the current session and the aggregate total across all active sessions.\n\nTo get a detailed heavy process tree of memory usage across all currently active OpenCode sessions, type `/ram` or click the sidebar widget. Both open the same pop-up; `esc` closes it.\n\n## Configuration\n\nPreferred: pass the interval as plugin `options` alongside the plugin entry (server `opencode.json` object form, TUI `cli.json` tuple form):\n\n```json\n{\n  \"plugins\": [\n    [\"@capybearista/opencode-ram-monitor\", { \"refreshIntervalMs\": 2000 }]\n  ]\n}\n```\n\nFallback: add `experimental.ramMonitor.refreshIntervalMs` to any supported config file. Supported files, in load order:\n\n1. `opencode.json` / `opencode.jsonc` - global and worktree configs\n2. `.opencode/opencode.json` / `.opencode/opencode.jsonc` - project-local configs\n3. `tui.json` / `tui.jsonc` and `.opencode/` variants - legacy TUI configs\n4. `cli.json` / `cli.jsonc` and `.opencode/` variants\n\nPlugin `options` win over config files when the value is a valid number; invalid values fall back to files, then the default. Files load the global config dir first (`$OPENCODE_CONFIG_DIR` or `~/.config/opencode/`), then project files — later files override earlier ones.\n\nJSONC comments and trailing commas are supported.\n\n| Property | Type | Default | Description |\n| :--- | :--- | :--- | :--- |\n| `refreshIntervalMs` (plugin options) or `experimental.ramMonitor.refreshIntervalMs` (config file) | `number` | `5000` | Polling interval for the sidebar widget in milliseconds. Clamped between `1000` and `60000`. |\n\nFile-key example:\n```json\n{\n  \"experimental\": {\n    \"ramMonitor\": {\n      \"refreshIntervalMs\": 2000\n    }\n  }\n}\n```\n\nNote: the host only delivers `options` for entries declared in the global `cli.json` (TUI) / `opencode.json` (server) plugin lists — restart OpenCode after changing them.\n\n## Troubleshooting\n\n- **Widget missing from sidebar**: Ensure the TUI plugin is registered in your `cli.json` `plugins` list (project `cli.json` files are not read by the host — use the global one).\n- **Refresh interval did not change**: Prefer plugin `options` (tuple/object entry form) and restart OpenCode — options only apply to declared entries and are read once at startup. File keys remain as fallback.\n- **Config warning shown in the sidebar**: A supported config file could not be parsed, so the widget is using the last valid value it found or the default `5000ms` interval.\n- **Active count seems off**: The plugin tokenizes command lines and parent links to find logical sessions. Deeply nested wrappers or unusual invocation aliases might still be missed.\n- **Sidebar numbers look higher than expected**: The sidebar shows both direct RSS and with-tools RSS. The with-tools column includes child processes spawned by the session.\n- **Total RAM shows `0`**: If sampling fails completely (e.g. `ps` is missing), the plugin falls back to using `process.memoryUsage().rss` of the current process. Ensure standard process utilities are available.\n\n## Debug Logging\n\nDebug logging is disabled by default. To enable diagnostic logs during development:\n\n```bash\nOPENCODE_RAM_MONITOR_DEBUG=1 opencode\n```\n\nWhen enabled, the plugin appends structured JSON log lines to `.opencode-ram-monitor.log` in the current working directory.\n\n## Contributing\n\nThis package lives in the `opencode-plugins` monorepo.\n\n- Run `bun run build`, `bun run typecheck`, `bun run lint`, and `bun test` before opening a PR.\n- Keep the plugin focused on RAM monitoring logic.\n- Prefer small, direct changes.\n\nPlease open an issue or check for existing ones before creating a pull request.\n\n## License\n\n[MPL-2.0](./LICENSE.txt)\n","readmeFilename":"README.md"}