opencode-usage-insights 0.1.0 → 0.1.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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "opencode-usage-insights",
3
- "version": "0.1.0",
4
- "description": "OpenCode V2 plugin: a live turn telemetry line plus a persistent SQLite usage record, read back by an interactive /usage panel — models, endpoints, prompt cache, affinity, periods and latency.",
3
+ "version": "0.1.1",
4
+ "description": "OpenCode V2 plugin: a live turn telemetry line plus a persistent SQLite usage record, read back by an interactive /usage panel — models, providers, prompt cache, periods and latency.",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "author": {
@@ -1,46 +0,0 @@
1
- /**
2
- * Endpoint discovery.
3
- *
4
- * OpenCode routes a model through a provider, and the endpoint the request was
5
- * actually sent to is the identity that answers "who ran this inference": a
6
- * gateway names its own routing endpoint in the response headers, and a
7
- * per-operator provider is named by the host of its API. The recorder stores
8
- * that endpoint on the step and nothing else about the route — the operator a
9
- * header happens to mention is not the endpoint, so it is not kept.
10
- *
11
- * Everything here is pure so the discovery can be tested without a network
12
- * stack.
13
- */
14
- /** Header a gateway sets to name the routing endpoint that served the request. */
15
- export declare const ENDPOINT_HEADER: "x-opencode-endpoint-id";
16
- /** Longest endpoint id kept: a routing label, not a sentence. */
17
- export declare const ENDPOINT_MAX = 64;
18
- export type EndpointInfo = {
19
- /** Routing endpoint or host that served the request. */
20
- router?: string | undefined;
21
- /** Where the finding came from: `header:<name>` or `endpoint:<host>`. */
22
- source?: string | undefined;
23
- };
24
- /**
25
- * Endpoint the gateway named in the response headers, when it named one.
26
- *
27
- * The value is a routing label, so it is validated as a token and lowercased:
28
- * a gateway that changes the case between responses would otherwise read as a
29
- * different endpoint and split its own history in two. Anything that is not a
30
- * token (control characters, spaces, an essay) is not an endpoint id.
31
- */
32
- export declare function inferFromHeaders(headers: Headers | Record<string, string | undefined> | undefined): EndpointInfo | undefined;
33
- /**
34
- * True when `host` is `suffix`, a subdomain of it (`cdn.opencode.ai`), or a
35
- * regional host that carries it as a label tail (`us-central1-aiplatform.googleapis.com`).
36
- * The boundary has to fall on a dot or a dash: a host that merely contains a
37
- * known domain (`api.anthropic.com.evil.tld`) names nothing.
38
- *
39
- * A `*` in the pattern stands for one label, for the hosts whose region sits
40
- * in the middle (`bedrock-runtime.*.amazonaws.com`).
41
- */
42
- export declare function hostMatches(host: string, pattern: string): boolean;
43
- /** Endpoint named by the host of the request URL. */
44
- export declare function inferFromUrl(url: string | undefined): EndpointInfo | undefined;
45
- /** First candidate that named an endpoint, headers before the URL. */
46
- export declare function mergeEndpoint(...candidates: readonly (EndpointInfo | undefined)[]): EndpointInfo | undefined;