opencode-usage-insights 0.1.2 → 0.2.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 +286 -202
- package/dist/gui-experimental.cjs +8 -0
- package/dist/index.d.ts +22 -4
- package/dist/index.js +3158 -195
- package/dist/index.js.map +17 -9
- package/dist/limits.d.ts +15 -0
- package/dist/line.d.ts +0 -4
- package/dist/panel-build.d.ts +0 -4
- package/dist/panel-data.d.ts +11 -3
- package/dist/panel.d.ts +2 -21
- package/dist/recorder.d.ts +4 -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 +2 -7
- package/dist/stats/aggregates.d.ts +13 -3
- package/dist/stats/db.d.ts +27 -4
- package/dist/stats/maintenance.d.ts +12 -0
- package/dist/stats/queries.d.ts +41 -5
- package/dist/stats-client.d.ts +65 -0
- package/dist/stats-worker.d.ts +1 -0
- package/dist/stats-worker.js +3466 -0
- package/dist/stats-worker.js.map +22 -0
- package/dist/tui.d.ts +9 -6
- package/dist/tui.js +946 -1561
- package/dist/tui.js.map +14 -16
- package/docs/demo.md +207 -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 +387 -0
- package/package.json +42 -19
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import type { Service, ServiceErrorCode, ServiceOptions } from "./service";
|
|
2
|
+
import type { PriceTable } from "./pricing";
|
|
3
|
+
/**
|
|
4
|
+
* Server-side client for the database worker. It starts the worker lazily,
|
|
5
|
+
* keeps a bounded queue in front of it, and falls back to an in-process
|
|
6
|
+
* service when a worker cannot start (development, unsupported runtime).
|
|
7
|
+
*
|
|
8
|
+
* The worker runs every panel query off the server's event loop. A request
|
|
9
|
+
* that hangs is terminated with the worker and reported as `unavailable`; the
|
|
10
|
+
* next request starts a fresh one.
|
|
11
|
+
*/
|
|
12
|
+
export type StatsErrorCode = ServiceErrorCode;
|
|
13
|
+
export declare class StatsError extends Error {
|
|
14
|
+
readonly code: StatsErrorCode;
|
|
15
|
+
constructor(code: StatsErrorCode, message: string);
|
|
16
|
+
}
|
|
17
|
+
export type StatsMethod = "panel" | "turns" | "listCost" | "filters" | "dbInfo" | "prune" | "wipe" | "vacuum" | "backfill";
|
|
18
|
+
export type StatsClientOptions = {
|
|
19
|
+
/** Absolute database path, resolved by the server plugin. */
|
|
20
|
+
dbPath: string;
|
|
21
|
+
/** Options passed to the worker's service. */
|
|
22
|
+
options: Omit<ServiceOptions, "path" | "priceTable">;
|
|
23
|
+
/** Current server catalog for a backfill. */
|
|
24
|
+
priceTable?: (() => PriceTable | undefined) | undefined;
|
|
25
|
+
/** In-process service used when the worker cannot start. */
|
|
26
|
+
fallback: () => Service;
|
|
27
|
+
/** Worker entrypoint override, for tests. */
|
|
28
|
+
workerUrl?: (() => URL | undefined) | undefined;
|
|
29
|
+
/** Timeout overrides, for tests. */
|
|
30
|
+
timeouts?: {
|
|
31
|
+
read?: number;
|
|
32
|
+
maintenance?: number;
|
|
33
|
+
start?: number;
|
|
34
|
+
} | undefined;
|
|
35
|
+
/** Diagnostics sink. */
|
|
36
|
+
log?: ((message: string) => void) | undefined;
|
|
37
|
+
};
|
|
38
|
+
export declare class StatsClient {
|
|
39
|
+
private readonly config;
|
|
40
|
+
private worker;
|
|
41
|
+
private startPromise;
|
|
42
|
+
private starting;
|
|
43
|
+
private startAbort;
|
|
44
|
+
private fallbackService;
|
|
45
|
+
private fallbackMode;
|
|
46
|
+
private stopped;
|
|
47
|
+
private nextID;
|
|
48
|
+
private readonly pending;
|
|
49
|
+
constructor(config: StatsClientOptions);
|
|
50
|
+
/** A request with no caller-side cancellation. */
|
|
51
|
+
request<T>(method: StatsMethod, input: unknown, options?: {
|
|
52
|
+
signal?: AbortSignal | undefined;
|
|
53
|
+
}): Promise<T>;
|
|
54
|
+
stop(): void;
|
|
55
|
+
private callService;
|
|
56
|
+
private ensureWorker;
|
|
57
|
+
private attach;
|
|
58
|
+
private receive;
|
|
59
|
+
private timeoutFor;
|
|
60
|
+
private send;
|
|
61
|
+
private settle;
|
|
62
|
+
private rejectAll;
|
|
63
|
+
private hardReset;
|
|
64
|
+
private useFallback;
|
|
65
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|