@cesarus777/opencode-cgp 0.2.5 → 0.3.1
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/CHANGELOG.md +19 -0
- package/README.md +56 -5
- package/dist/cli.js +3498 -1029
- package/dist/core.js +311 -102
- package/dist/index.js +873 -836
- package/dist/rpc.js +275 -246
- package/dist/tui.js +679 -627
- package/dist/types/clihelp.d.ts +2 -0
- package/dist/types/core.d.ts +1 -0
- package/dist/types/dashboard/command.d.ts +5 -0
- package/dist/types/dashboard/connection.d.ts +36 -0
- package/dist/types/dashboard/controller.d.ts +57 -0
- package/dist/types/dashboard/inventory.d.ts +17 -0
- package/dist/types/dashboard/port.d.ts +41 -0
- package/dist/types/dashboard/terminal.d.ts +36 -0
- package/dist/types/dashboard/terminalview.d.ts +15 -0
- package/dist/types/dashboard/view.d.ts +83 -0
- package/dist/types/modelanalytics.d.ts +60 -0
- package/dist/types/modelcli.d.ts +1 -0
- package/dist/types/tui/contextchart.d.ts +2 -1
- package/package.json +6 -7
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.3.1 — 2026-10-29
|
|
4
|
+
|
|
5
|
+
- Install the standalone dashboard's pinned OpenTUI renderer automatically with CGP, including its native platform library. Keep renderer loading lazy so server and offline commands still work on Bun >=1.1.34; the dashboard requires Bun >=1.3.0.
|
|
6
|
+
- Clarify CLI launch instructions and add command-specific help with examples.
|
|
7
|
+
|
|
8
|
+
## 0.3.0 — 2026-10-28
|
|
9
|
+
|
|
10
|
+
Changes since 0.2.5:
|
|
11
|
+
|
|
12
|
+
- Add `context-guard dashboard tui` with a root/child session overview, complete snapshot details, retained performance history, search, filters and explicit location selection. Connections recover from interruptions and retain labeled stale values.
|
|
13
|
+
- Add `context-guard models /absolute/history-directory` to compare models across retained sessions. JSON/CSV exports include duration-weighted request TPS, TTFT mean/median/p95, eligibility counts, deduplication and coverage. Filter by exact model/agent and completion-time range.
|
|
14
|
+
- Export harness-independent `aggregateModels` through the core package entry.
|
|
15
|
+
- Correct context chart threshold rendering and stale colors. Held bars preserve the preceding measurement's fractional height. Pauses temporarily mute the latest column; repeated unchanged/held observations reuse it instead of consuming history space.
|
|
16
|
+
|
|
17
|
+
The standalone terminal command requires Bun >=1.3.0 and the optional `@opentui/core@0.5.17` renderer. Server/core and offline diagnostic/analytics commands retain Bun >=1.1.34 support. OpenCode SDK dependencies remain pinned at 2.0.29; local synthetic-provider validation also covers OpenCode 2.1.2.
|
|
18
|
+
|
|
19
|
+
Model analytics uses the bounded retained archive (default seven days / 64 MiB), not permanent history. Its Models screen, analytics RPC and durable request ledger remain planned. The browser dashboard remains planned. Genuine-provider timing and cross-machine terminal validation remain unverified.
|
package/README.md
CHANGED
|
@@ -6,11 +6,11 @@ Targets **`@opencode/plugin@2.0.29`**. The published SDK, official documentation
|
|
|
6
6
|
|
|
7
7
|
## Install
|
|
8
8
|
|
|
9
|
-
The
|
|
9
|
+
The npm package is **`@cesarus777/opencode-cgp`**. The unscoped `opencode-context-guard` name belongs to another project; do not install it expecting this plugin.
|
|
10
10
|
|
|
11
11
|
Minimum supported host: **OpenCode V2 2.0.29**. Versions 2.0.29 and 2.1.2 have been tested locally with a synthetic provider; V1 is unsupported.
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
Register the global package through the native manager:
|
|
14
14
|
|
|
15
15
|
```sh
|
|
16
16
|
opencode plugin add @cesarus777/opencode-cgp@latest
|
|
@@ -41,10 +41,10 @@ Global configuration is `~/.config/opencode/opencode.jsonc` (or the OpenCode con
|
|
|
41
41
|
|
|
42
42
|
Restart/reload OpenCode and look for `context-guard: observe; diagnostics ...`. Observe mode records policy decisions and never requests compaction; OpenCode's own automatic compaction remains active. Inspect diagnostics first, then set `mode` to `enforce` to admit native compaction at runtime step boundaries. The complete [example](examples/opencode.jsonc) includes model, role, and agent policies. **Last matching rule wins**; selectors within a rule are ANDed.
|
|
43
43
|
|
|
44
|
-
Pin the exact published version in the existing entry's `package` field or use the manager. Version `0.
|
|
44
|
+
Pin the exact published version in the existing entry's `package` field or use the manager. Version `0.3.1` installs the standalone dashboard renderer automatically and adds clearer command help. Version `0.3.0` introduced the standalone dashboard, offline model analytics and paused context chart fixes. See the [changelog](CHANGELOG.md).
|
|
45
45
|
|
|
46
46
|
```sh
|
|
47
|
-
opencode plugin add @cesarus777/opencode-cgp@0.
|
|
47
|
+
opencode plugin add @cesarus777/opencode-cgp@0.3.1
|
|
48
48
|
```
|
|
49
49
|
|
|
50
50
|
Manage the configured target with the [official V2 CLI](https://dev.opencode.ai/v2/docs/plugins):
|
|
@@ -64,7 +64,7 @@ For development or unreleased Git revisions, V2 supports npm-compatible Git targ
|
|
|
64
64
|
opencode plugin add 'github:cesarus777/opencode-cgp#master'
|
|
65
65
|
```
|
|
66
66
|
|
|
67
|
-
Replace `master` with a version tag or full commit hash to pin a revision. Git installs require Bun and development dependencies to run `prepare`; unlike npm artifacts they build from source. Prefer an exact published
|
|
67
|
+
Replace `master` with a version tag or full commit hash to pin a revision. Git installs require Bun and development dependencies to run `prepare`; unlike npm artifacts they build from source. Prefer an exact published npm version for reproducible installs. Git preparation has not been verified with the real plugin manager; use a built local checkout if it fails.
|
|
68
68
|
|
|
69
69
|
Contributors can build and register a checkout without publishing:
|
|
70
70
|
|
|
@@ -82,6 +82,55 @@ Use `{"plugins":[{"package":"/absolute/path/to/opencode-cgp","options":{"mode":"
|
|
|
82
82
|
|
|
83
83
|
If loading fails, run `opencode plugin list` and `opencode plugin check`, confirm V2 2.0.29 and the correct configuration scope, and inspect OpenCode's startup logs. A missing `@opencode/plugin` or client module indicates an incomplete package installation: remove/re-add the configured package using the manager. TUI-only missing `solid-js`/OpenTUI modules usually indicate an unsupported host or loading the TUI outside its host runtime. These optional peers are supplied by the native TUI and must share its runtime instances; do not bundle private renderer copies. Standalone renderer tests need the pinned peers and public runtime preload described in [testing](docs/testing.md). Never reset persisted safety state merely to fix loading. For remote clients, check both client installation and server registration in the session's owning location.
|
|
84
84
|
|
|
85
|
+
## Run after installation
|
|
86
|
+
|
|
87
|
+
From your project directory, start OpenCode:
|
|
88
|
+
|
|
89
|
+
```sh
|
|
90
|
+
opencode
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
Inside OpenCode, enter `/context-guard` to open the Context Guard panel. The plugin loads automatically with OpenCode after registration; there is no separate plugin process to start. Observe mode is the default. Press **c** in the panel for history charts, or **q** to close it.
|
|
94
|
+
|
|
95
|
+
The installed diagnostic command is **`context-guard`** (Bun required):
|
|
96
|
+
|
|
97
|
+
```sh
|
|
98
|
+
context-guard --help
|
|
99
|
+
context-guard dashboard tui --help
|
|
100
|
+
context-guard models --help
|
|
101
|
+
context-guard metrics --help
|
|
102
|
+
context-guard charts --help
|
|
103
|
+
context-guard help journal
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
Each command's help explains its inputs and shows an example. In a source checkout, use `bun run inspect` in place of `context-guard`, for example `bun run inspect charts --help`. OpenCode's plugin manager installs the plugin for the host; if `context-guard` is absent from your shell's PATH, you can still use the native panel. To expose the CLI separately, install the same package with your package manager, for example `npm install -g @cesarus777/opencode-cgp@0.3.1`.
|
|
107
|
+
|
|
108
|
+
## Standalone terminal dashboard
|
|
109
|
+
|
|
110
|
+
Run the dashboard with OpenCode's native TUI closed. The server must already be running, with Context Guard registered in the owning location. The standalone command requires **Bun >=1.3.0**. The package automatically installs **`@opentui/core@0.5.17`** and its platform renderer; no separate OpenTUI install is needed. Keep optional dependencies enabled so OpenTUI's native platform library is installed. Server imports and existing diagnostic commands retain Bun >=1.1.34 support. Solid and the native TUI plugin are unnecessary for this command.
|
|
111
|
+
|
|
112
|
+
For an unreleased checkout:
|
|
113
|
+
|
|
114
|
+
```sh
|
|
115
|
+
bun install --frozen-lockfile
|
|
116
|
+
bun run build
|
|
117
|
+
bun dist/cli.js dashboard tui
|
|
118
|
+
bun dist/cli.js dashboard tui --server https://server.example --directory /server/project
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
For a packed artifact, install the tarball into a separate client directory, then launch with Bun >=1.3.0:
|
|
122
|
+
|
|
123
|
+
```sh
|
|
124
|
+
npm install /absolute/path/cesarus777-opencode-cgp-0.3.1.tgz
|
|
125
|
+
bun node_modules/.bin/context-guard dashboard tui
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
Local discovery uses the current directory by default. An explicit server requires an absolute **server-side** `--directory`; it is passed unchanged. Set `CONTEXT_GUARD_PASSWORD` and optional `CONTEXT_GUARD_USERNAME` (default `opencode`) in the environment for remote authentication. Use HTTPS except on loopback. Credentials in URLs are rejected.
|
|
129
|
+
|
|
130
|
+
Use `1` overview, `2` detail, `3` history, arrows or `j/k` to navigate, `/` to search, `f` for exact agent/model filters, `l` for location, `r` to refresh, and `?` for help. History uses Left/Right for six metrics, `w` for 5m/1h/24h/7d, and `[`/`]` to inspect exact samples or requests. Detail scrolls through full IDs and every exposed snapshot field. Editors take precedence over shortcuts; Enter applies and Escape cancels. Quit with `q` or Ctrl+C.
|
|
131
|
+
|
|
132
|
+
The location editor's Tab key cycles up to four remembered owning directories; this is not server-wide discovery. History shows bounded retention, partial/downsampled data and gaps. Unknown measurements stay unknown, while stale occupancy remains labeled and pressure becomes unknown. Browser delivery is a later milestone. See [terminal validation and dependency sizes](docs/validation/dashboard-terminal-2026-10-28.md).
|
|
133
|
+
|
|
85
134
|
## Thresholds
|
|
86
135
|
|
|
87
136
|
| Type | Example | Trigger |
|
|
@@ -104,6 +153,8 @@ Enabling Context Guard after work has already started also shows the last report
|
|
|
104
153
|
|
|
105
154
|
Per-session live TPS, average model throughput, average session throughput and observed TTFT appear in the selected session and child rows. Live TPS and TTFT use `~` to mark estimates; completed rates use provider totals. Configurable local history defaults to seven days with a 64 MiB total cap, independently of diagnostic telemetry. See [metric definitions and history exports](docs/configuration.md#live-performance-and-retained-history).
|
|
106
155
|
|
|
156
|
+
Compare models across retained sessions with `bun run inspect models /absolute/history-directory --model provider/model` (installed: `context-guard models ...`). JSON/CSV summaries include weighted request TPS, TTFT mean/median/p95, eligibility counts and coverage limits. Use `--from`, `--to` and `--agent` to scope the analysis. This offline command precedes the planned TUI Models screen; see [analytics definitions](docs/configuration.md#offline-model-analytics).
|
|
157
|
+
|
|
107
158
|
Press **c** in the Context Guard panel for retained-history terminal charts. View one metric at a time with **Left / Right**, change the time window with **[ / ]**, and select an agent instance with **Up / Down**. Press **c** to return or **q** to close the panel; controls stay visible below the scrollable content. Generate a self-contained interactive browser report with `bun run charts /absolute/history-directory --output report.html`. It includes filters, UTC timestamp tooltips, request statistics and SVG export. Installed packages expose the same command as `context-guard charts ...` (Bun required). See [chart controls and limits](docs/configuration.md#performance-charts).
|
|
108
159
|
|
|
109
160
|
## Inspect
|