opencode-usage-insights 0.1.3 → 0.3.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/CONTRIBUTING.md +97 -0
- package/README.md +330 -200
- package/dist/core.d.ts +10 -0
- package/dist/gui-experimental.cjs +8 -0
- package/dist/index.d.ts +29 -4
- package/dist/index.js +3003 -50
- package/dist/index.js.map +17 -8
- package/dist/limits.d.ts +15 -0
- package/dist/panel-build.d.ts +0 -4
- package/dist/panel-data.d.ts +37 -6
- package/dist/panel.d.ts +10 -22
- package/dist/quota-client.d.ts +13 -0
- package/dist/quota.d.ts +114 -0
- package/dist/rpc-client.d.ts +24 -0
- package/dist/rpc.d.ts +1022 -0
- package/dist/rpc.js +294 -0
- package/dist/rpc.js.map +11 -0
- package/dist/service.d.ts +36 -0
- package/dist/sidebar.d.ts +7 -7
- package/dist/stats/db.d.ts +2 -2
- package/dist/stats/maintenance.d.ts +10 -0
- package/dist/stats/queries.d.ts +6 -0
- package/dist/stats-client.d.ts +65 -0
- package/dist/stats-worker.d.ts +1 -0
- package/dist/stats-worker.js +3697 -0
- package/dist/stats-worker.js.map +23 -0
- package/dist/tui.d.ts +22 -10
- package/dist/tui.js +1067 -1604
- package/dist/tui.js.map +14 -14
- package/docs/demo.md +212 -0
- package/docs/images/line.png +0 -0
- package/docs/images/panel-cache.png +0 -0
- package/docs/images/panel-overview.png +0 -0
- package/docs/images/panel-providers.png +0 -0
- package/docs/images/sidebar.png +0 -0
- package/docs/internals.md +455 -0
- package/package.json +43 -18
package/dist/tui.d.ts
CHANGED
|
@@ -8,19 +8,24 @@ import { type PanelView, type RangeKey } from "./panel-data";
|
|
|
8
8
|
* - `session.composer.top`: one telemetry line after every turn with the end
|
|
9
9
|
* time, the delta since the previous prompt, the provider and model that ran
|
|
10
10
|
* it, turn and session token totals, and cache warnings.
|
|
11
|
-
* - `session.panel` + the `/
|
|
12
|
-
* the database written by the server entry.
|
|
11
|
+
* - `session.panel` + the `/usage-insights` slash command: the statistics
|
|
12
|
+
* panel over the database written by the server entry. Its `go` view reads
|
|
13
|
+
* the host's live OpenCode Go allowance; the sidebar carries the compact
|
|
14
|
+
* forecast.
|
|
13
15
|
*
|
|
14
|
-
* The line is computed from the host's transcript alone; the
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* the
|
|
16
|
+
* The line is computed from the host's transcript alone; the panel, the
|
|
17
|
+
* sidebar history and the stored list estimate come from the server's usage
|
|
18
|
+
* RPC. The TUI never opens SQLite, so it works the same against a local or a
|
|
19
|
+
* remote server. When the RPC is unavailable, the line still works and the
|
|
20
|
+
* panel explains itself.
|
|
18
21
|
*/
|
|
19
22
|
export type Options = {
|
|
20
23
|
/** Turn the TUI side off: no line and no panel. */
|
|
21
24
|
enabled?: boolean | undefined;
|
|
22
|
-
/**
|
|
25
|
+
/** Server-side database path override; the TUI reads it through the RPC. */
|
|
23
26
|
db?: string | undefined;
|
|
27
|
+
/** Allow the panel's prune, wipe, vacuum and backfill actions. Defaults to true. */
|
|
28
|
+
maintenance?: boolean | undefined;
|
|
24
29
|
/**
|
|
25
30
|
* List-price estimates for steps the host reports as costing nothing.
|
|
26
31
|
* `off` hides them on the line, in the panel and in the sidebar, and
|
|
@@ -38,11 +43,18 @@ export type Options = {
|
|
|
38
43
|
labels?: Partial<LineLabels> | undefined;
|
|
39
44
|
/** Show the per-prompt history in the session sidebar (default true). */
|
|
40
45
|
sidebar?: boolean | undefined;
|
|
41
|
-
/** How many turns the sidebar history shows (default 8). */
|
|
46
|
+
/** How many turns the sidebar history shows (default 8, clamped to 1–50). */
|
|
42
47
|
sidebarTurns?: number | undefined;
|
|
43
48
|
/**
|
|
44
|
-
*
|
|
45
|
-
* `
|
|
49
|
+
* Read the host's OpenCode Go allowance and show the `go` view and the
|
|
50
|
+
* sidebar forecast. `off` makes no usage-limits request at all.
|
|
51
|
+
*/
|
|
52
|
+
quota?: "auto" | "off" | undefined;
|
|
53
|
+
/** Full subscription label; defaults to the host provider name or OpenCode Go. */
|
|
54
|
+
quotaName?: string | undefined;
|
|
55
|
+
/**
|
|
56
|
+
* Show the `/usage-insights` statistics panel and its command (default
|
|
57
|
+
* true). `false` keeps the live line and the sidebar history.
|
|
46
58
|
*/
|
|
47
59
|
panel?: boolean | undefined;
|
|
48
60
|
};
|