@rejacky/opencode-insights 0.1.3 → 0.1.4
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/README.md +22 -2
- package/dist/{capture-gQauLsdn.d.ts → capture-DkASdFpu.d.ts} +3 -0
- package/dist/cli.d.ts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +11 -8
- package/dist/tui.js +1 -40
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -47,10 +47,11 @@ npm rm @rejacky/opencode-insights
|
|
|
47
47
|
|
|
48
48
|
## What You Get
|
|
49
49
|
|
|
50
|
-
- Live TPS, average TPS, and average TTFT in the OpenCode prompt zone.
|
|
51
|
-
-
|
|
50
|
+
- Live TPS, average TPS, and average TTFT in the OpenCode session prompt zone.
|
|
51
|
+
- Subagent status (running, done, failed, elapsed time, and token/context usage) in the sidebar.
|
|
52
52
|
- Local capture of OpenCode hook/event data without redaction.
|
|
53
53
|
- A local web viewer for sessions, messages, hooks, request context, system/messages transforms, and assistant responses.
|
|
54
|
+
- Native OpenCode footer components (project directory and version) remain visible — the plugin does not override `sidebar_footer` or `home_prompt_right` slots.
|
|
54
55
|
|
|
55
56
|
## Open The Viewer
|
|
56
57
|
|
|
@@ -164,6 +165,25 @@ This plugin intentionally does not redact anything. It stores data locally exact
|
|
|
164
165
|
|
|
165
166
|
Captured data can include prompts, system messages, provider metadata, API keys exposed inside hook payloads, tool arguments, headers, reasoning text, and response events. Use it only on machines where local full-fidelity capture is acceptable.
|
|
166
167
|
|
|
168
|
+
## Experimental Features
|
|
169
|
+
|
|
170
|
+
The request-interception hooks (`chat.headers`, `experimental.chat.messages.transform`, `experimental.chat.system.transform`) are disabled by default. They capture additional request context (HTTP headers, transformed messages, system prompts) but are not yet mature.
|
|
171
|
+
|
|
172
|
+
To enable them, pass `experimental: true` in the plugin options:
|
|
173
|
+
|
|
174
|
+
```json
|
|
175
|
+
{
|
|
176
|
+
"plugin": [
|
|
177
|
+
[
|
|
178
|
+
"@rejacky/opencode-insights",
|
|
179
|
+
{
|
|
180
|
+
"experimental": true
|
|
181
|
+
}
|
|
182
|
+
]
|
|
183
|
+
]
|
|
184
|
+
}
|
|
185
|
+
```
|
|
186
|
+
|
|
167
187
|
## Captured Hooks
|
|
168
188
|
|
|
169
189
|
The viewer labels OpenCode hook records as `HOOK` because they are not raw HTTP requests.
|
|
@@ -17,6 +17,9 @@ type CaptureStore = {
|
|
|
17
17
|
type InsightsOptions = {
|
|
18
18
|
dataDir?: unknown;
|
|
19
19
|
dbPath?: unknown;
|
|
20
|
+
/** Enable experimental request capture (chat.headers, messages/system transforms).
|
|
21
|
+
* Disabled by default — these hooks intercept request data and are not yet mature. */
|
|
22
|
+
experimental?: boolean;
|
|
20
23
|
};
|
|
21
24
|
declare function defaultDataDir(): string;
|
|
22
25
|
declare function resolveCapturePath(options?: InsightsOptions): string;
|
package/dist/cli.d.ts
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Plugin } from '@opencode-ai/plugin';
|
|
2
2
|
import { TuiPlugin } from '@opencode-ai/plugin/tui';
|
|
3
|
-
export { a as CaptureKind, C as CaptureRecord, b as CaptureStore, I as InsightsOptions, J as JsonlCaptureStore, S as SqliteCaptureStore, c as createCaptureStore, d as defaultDataDir, n as normalizeChatHeadersCapture, e as normalizeChatMessageCapture, f as normalizeChatParamsCapture, g as normalizeEventCapture, h as normalizeExperimentalChatMessagesTransformCapture, i as normalizeExperimentalChatSystemTransformCapture, j as normalizeToolCapture, r as resolveCapturePath } from './capture-
|
|
3
|
+
export { a as CaptureKind, C as CaptureRecord, b as CaptureStore, I as InsightsOptions, J as JsonlCaptureStore, S as SqliteCaptureStore, c as createCaptureStore, d as defaultDataDir, n as normalizeChatHeadersCapture, e as normalizeChatMessageCapture, f as normalizeChatParamsCapture, g as normalizeEventCapture, h as normalizeExperimentalChatMessagesTransformCapture, i as normalizeExperimentalChatSystemTransformCapture, j as normalizeToolCapture, r as resolveCapturePath } from './capture-DkASdFpu.js';
|
|
4
4
|
|
|
5
5
|
type StreamSample = {
|
|
6
6
|
at: number;
|
package/dist/index.js
CHANGED
|
@@ -32,6 +32,7 @@ import {
|
|
|
32
32
|
// src/index.ts
|
|
33
33
|
var OpenCodeInsights = async (_input, options) => {
|
|
34
34
|
const store = createCaptureStore(options);
|
|
35
|
+
const experimental = options?.experimental ?? false;
|
|
35
36
|
try {
|
|
36
37
|
await store.initialize?.();
|
|
37
38
|
} catch {
|
|
@@ -55,14 +56,16 @@ var OpenCodeInsights = async (_input, options) => {
|
|
|
55
56
|
"chat.params": async (input, output) => {
|
|
56
57
|
await capture(normalizeChatParamsCapture(input, output));
|
|
57
58
|
},
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
59
|
+
...experimental && {
|
|
60
|
+
"chat.headers": async (input, output) => {
|
|
61
|
+
await capture(normalizeChatHeadersCapture(input, output));
|
|
62
|
+
},
|
|
63
|
+
"experimental.chat.messages.transform": async (input, output) => {
|
|
64
|
+
await capture(normalizeExperimentalChatMessagesTransformCapture(input, output));
|
|
65
|
+
},
|
|
66
|
+
"experimental.chat.system.transform": async (input, output) => {
|
|
67
|
+
await capture(normalizeExperimentalChatSystemTransformCapture(input, output));
|
|
68
|
+
}
|
|
66
69
|
},
|
|
67
70
|
"tool.execute.before": async (input, output) => {
|
|
68
71
|
await capture(normalizeToolCapture("tool.execute.before", input, output));
|
package/dist/tui.js
CHANGED
|
@@ -6,8 +6,7 @@ import {
|
|
|
6
6
|
recordAssistantDelta,
|
|
7
7
|
recordAssistantMessage,
|
|
8
8
|
recordToolActivity,
|
|
9
|
-
renderMetricsText
|
|
10
|
-
renderSubagentFooter
|
|
9
|
+
renderMetricsText
|
|
11
10
|
} from "./chunk-36ZNCLI3.js";
|
|
12
11
|
|
|
13
12
|
// src/tui.tsx
|
|
@@ -41,27 +40,6 @@ function PromptRight(props) {
|
|
|
41
40
|
}
|
|
42
41
|
);
|
|
43
42
|
}
|
|
44
|
-
function ReactiveText(props) {
|
|
45
|
-
let text;
|
|
46
|
-
const sync = () => {
|
|
47
|
-
if (!text) return;
|
|
48
|
-
text.content = props.text();
|
|
49
|
-
props.api.renderer.requestRender();
|
|
50
|
-
};
|
|
51
|
-
const unsubscribe = props.subscribe(sync);
|
|
52
|
-
onCleanup(unsubscribe);
|
|
53
|
-
return /* @__PURE__ */ jsx(
|
|
54
|
-
"text",
|
|
55
|
-
{
|
|
56
|
-
ref: (ref) => {
|
|
57
|
-
text = ref;
|
|
58
|
-
sync();
|
|
59
|
-
},
|
|
60
|
-
fg: props.api.theme.current.textMuted,
|
|
61
|
-
children: props.text()
|
|
62
|
-
}
|
|
63
|
-
);
|
|
64
|
-
}
|
|
65
43
|
function SubagentSidebar(props) {
|
|
66
44
|
let text;
|
|
67
45
|
const [collapsed, setCollapsed] = createSignal(false);
|
|
@@ -202,15 +180,6 @@ var tui = async (api) => {
|
|
|
202
180
|
}
|
|
203
181
|
}
|
|
204
182
|
),
|
|
205
|
-
home_prompt_right: () => /* @__PURE__ */ jsx(
|
|
206
|
-
PromptRight,
|
|
207
|
-
{
|
|
208
|
-
api,
|
|
209
|
-
sessionID: "",
|
|
210
|
-
subscribe,
|
|
211
|
-
text: () => ""
|
|
212
|
-
}
|
|
213
|
-
),
|
|
214
183
|
sidebar_content: (_ctx, props) => /* @__PURE__ */ jsx(
|
|
215
184
|
SubagentSidebar,
|
|
216
185
|
{
|
|
@@ -219,14 +188,6 @@ var tui = async (api) => {
|
|
|
219
188
|
state: subagents,
|
|
220
189
|
subscribe
|
|
221
190
|
}
|
|
222
|
-
),
|
|
223
|
-
sidebar_footer: (_ctx, props) => /* @__PURE__ */ jsx(
|
|
224
|
-
ReactiveText,
|
|
225
|
-
{
|
|
226
|
-
api,
|
|
227
|
-
subscribe,
|
|
228
|
-
text: () => renderSubagentFooter(subagents, props.session_id)
|
|
229
|
-
}
|
|
230
191
|
)
|
|
231
192
|
}
|
|
232
193
|
});
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package.json",
|
|
3
3
|
"name": "@rejacky/opencode-insights",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.4",
|
|
5
5
|
"description": "OpenCode plugin for local request capture, TPS metrics, and subagent status visibility.",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"author": "opencode-insights contributors",
|