opencode-usage-insights 0.3.1 → 0.4.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/README.md +67 -542
- package/dist/core.d.ts +15 -1
- package/dist/gui-experimental.cjs +3 -3
- package/dist/index.d.ts +0 -47
- package/dist/index.js +1734 -1209
- package/dist/index.js.map +23 -16
- package/dist/line.d.ts +1 -0
- package/dist/panel-data.d.ts +9 -2
- package/dist/recorder.d.ts +1 -0
- package/dist/rpc.d.ts +4 -4
- package/dist/rpc.js +5 -5
- package/dist/rpc.js.map +3 -3
- package/dist/settings-client.d.ts +29 -0
- package/dist/settings-rpc.d.ts +746 -0
- package/dist/settings.d.ts +114 -0
- package/dist/sidebar.d.ts +3 -3
- package/dist/stats/aggregates.d.ts +15 -3
- package/dist/stats/constants.d.ts +7 -0
- package/dist/stats/db.d.ts +8 -128
- package/dist/stats/legacy.d.ts +25 -0
- package/dist/stats/maintenance.d.ts +1 -1
- package/dist/stats/migrate.d.ts +7 -0
- package/dist/stats/ndjson.d.ts +16 -0
- package/dist/stats/open.d.ts +15 -0
- package/dist/stats/paths.d.ts +5 -4
- package/dist/stats/queries.d.ts +30 -35
- package/dist/stats/records.d.ts +94 -0
- package/dist/stats/schema.d.ts +26 -0
- package/dist/stats-client.d.ts +9 -0
- package/dist/stats-worker.js +597 -367
- package/dist/stats-worker.js.map +17 -12
- package/dist/text.d.ts +2 -0
- package/dist/tui-settings.d.ts +18 -0
- package/dist/tui.d.ts +1 -57
- package/dist/tui.js +974 -158
- package/dist/tui.js.map +17 -13
- package/docs/cli.md +24 -0
- package/docs/configuration.md +108 -0
- package/docs/costs.md +44 -0
- package/docs/demo.md +94 -68
- package/docs/desktop.md +91 -0
- package/docs/images/desktop-overview-annotated.png +0 -0
- package/docs/images/desktop-overview.png +0 -0
- package/docs/images/desktop-settings.png +0 -0
- package/docs/images/desktop-turns-go-annotated.png +0 -0
- package/docs/images/desktop-turns.png +0 -0
- package/docs/images/line.png +0 -0
- package/docs/images/panel-cache.png +0 -0
- package/docs/images/panel-help.png +0 -0
- package/docs/images/panel-latency.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 +87 -36
- package/docs/privacy.md +60 -0
- package/docs/tui.md +175 -0
- package/package.json +8 -7
package/dist/line.d.ts
CHANGED
package/dist/panel-data.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type LineFields, type LineLabels, type TurnStats, type TurnTotalsView } from "./core";
|
|
2
|
-
import type {
|
|
2
|
+
import type { LatencyReport, ModelUsage, Overview, Range, SessionUsage, TurnUsage } from "./stats/queries";
|
|
3
|
+
import type { CacheDropRow, TtlEvidenceRow } from "./stats/aggregates";
|
|
3
4
|
import type { DbInfo } from "./stats/maintenance";
|
|
4
5
|
import type { CacheStats, CoverageReport, ProviderRow, ProviderSummary, GapReport, LatencyGroupRow, PeriodGranularity, PeriodRow, SwitchRow } from "./stats/aggregates";
|
|
5
6
|
import { QUOTA_VIEW, type QuotaFetch } from "./quota";
|
|
@@ -82,6 +83,12 @@ export declare function formatMs(value: number | undefined): string;
|
|
|
82
83
|
export declare function formatTps(value: number | undefined): string;
|
|
83
84
|
/** A rate that has to fit a sidebar: whole numbers from 10 up. */
|
|
84
85
|
export declare function formatTpsCompact(value: number | undefined): string;
|
|
86
|
+
/**
|
|
87
|
+
* A bare rate for a line that supplies its own `tps`/`rtps` label. Adding the
|
|
88
|
+
* unit twice (`50/s tps`) is the easy mistake; this formatter exists so no
|
|
89
|
+
* caller has to remember which one carries it.
|
|
90
|
+
*/
|
|
91
|
+
export declare function formatRateValue(value: number | undefined): string;
|
|
85
92
|
/** Idle gaps are read at a glance: seconds, minutes, hours, days. */
|
|
86
93
|
export declare function formatGap(value: number | undefined): string;
|
|
87
94
|
/** Cut a value to the width, dropping control characters first. */
|
|
@@ -175,7 +182,7 @@ export declare function usageBuckets(usage: {
|
|
|
175
182
|
* active view always keeps its full name.
|
|
176
183
|
*/
|
|
177
184
|
export declare function viewBar(view: PanelView, width?: number, views?: readonly PanelView[]): PanelLine;
|
|
178
|
-
export declare function keysFor(of: PanelView): string;
|
|
185
|
+
export declare function keysFor(of: PanelView, range?: RangeKey): string;
|
|
179
186
|
export declare function filterSummary(filters: {
|
|
180
187
|
modelID?: string | undefined;
|
|
181
188
|
providerID?: string | undefined;
|
package/dist/recorder.d.ts
CHANGED
package/dist/rpc.d.ts
CHANGED
|
@@ -731,14 +731,14 @@ export declare const UsageInsights: {
|
|
|
731
731
|
readonly prompts: {
|
|
732
732
|
readonly type: "number";
|
|
733
733
|
};
|
|
734
|
-
readonly
|
|
734
|
+
readonly compactions: {
|
|
735
735
|
readonly type: "number";
|
|
736
736
|
};
|
|
737
737
|
readonly usage: {
|
|
738
738
|
readonly type: "number";
|
|
739
739
|
};
|
|
740
740
|
};
|
|
741
|
-
readonly required: readonly ["steps", "prompts", "
|
|
741
|
+
readonly required: readonly ["steps", "prompts", "compactions", "usage"];
|
|
742
742
|
readonly additionalProperties: false;
|
|
743
743
|
};
|
|
744
744
|
readonly errors: {
|
|
@@ -805,7 +805,7 @@ export declare const UsageInsights: {
|
|
|
805
805
|
readonly prompts: {
|
|
806
806
|
readonly type: "number";
|
|
807
807
|
};
|
|
808
|
-
readonly
|
|
808
|
+
readonly compactions: {
|
|
809
809
|
readonly type: "number";
|
|
810
810
|
};
|
|
811
811
|
readonly usage: {
|
|
@@ -815,7 +815,7 @@ export declare const UsageInsights: {
|
|
|
815
815
|
readonly type: "number";
|
|
816
816
|
};
|
|
817
817
|
};
|
|
818
|
-
readonly required: readonly ["steps", "prompts", "
|
|
818
|
+
readonly required: readonly ["steps", "prompts", "compactions", "usage", "sessions"];
|
|
819
819
|
readonly additionalProperties: false;
|
|
820
820
|
};
|
|
821
821
|
readonly errors: {
|
package/dist/rpc.js
CHANGED
|
@@ -99,10 +99,10 @@ var PruneResultSchema = {
|
|
|
99
99
|
properties: {
|
|
100
100
|
steps: { type: "number" },
|
|
101
101
|
prompts: { type: "number" },
|
|
102
|
-
|
|
102
|
+
compactions: { type: "number" },
|
|
103
103
|
usage: { type: "number" }
|
|
104
104
|
},
|
|
105
|
-
required: ["steps", "prompts", "
|
|
105
|
+
required: ["steps", "prompts", "compactions", "usage"],
|
|
106
106
|
additionalProperties: false
|
|
107
107
|
};
|
|
108
108
|
var WipeResultSchema = {
|
|
@@ -110,11 +110,11 @@ var WipeResultSchema = {
|
|
|
110
110
|
properties: {
|
|
111
111
|
steps: { type: "number" },
|
|
112
112
|
prompts: { type: "number" },
|
|
113
|
-
|
|
113
|
+
compactions: { type: "number" },
|
|
114
114
|
usage: { type: "number" },
|
|
115
115
|
sessions: { type: "number" }
|
|
116
116
|
},
|
|
117
|
-
required: ["steps", "prompts", "
|
|
117
|
+
required: ["steps", "prompts", "compactions", "usage", "sessions"],
|
|
118
118
|
additionalProperties: false
|
|
119
119
|
};
|
|
120
120
|
var BackfillResultSchema = {
|
|
@@ -292,4 +292,4 @@ export {
|
|
|
292
292
|
UsageInsights
|
|
293
293
|
};
|
|
294
294
|
|
|
295
|
-
//# debugId=
|
|
295
|
+
//# debugId=CA8589888C19446A64756E2164756E21
|
package/dist/rpc.js.map
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/rpc.ts", "../src/limits.ts"],
|
|
4
4
|
"sourcesContent": [
|
|
5
|
-
"import { Rpc } from \"@opencode/plugin/rpc\"\nimport { MAX_HISTORY_WIDTH, MAX_PANEL_WIDTH, MAX_TURNS } from \"./limits\"\nimport type { LineFormatOptions, PanelLine, PanelRow, PanelSettings } from \"./panel-data\"\nimport type { BackfillResult, DbInfo, PruneResult } from \"./stats/maintenance\"\nimport type { FilterOption } from \"./stats/queries\"\n\n/**\n * The usage-insights RPC contract. One definition is served by the server\n * part and consumed by the TUI and the desktop GUI, so both clients read the\n * same database through the same validated surface.\n *\n * JSON Schema keeps the contract portable: the server does not need a newer\n * `effect` runtime, and a client can be a TUI, an Electron window or a plain\n * HTTP client. TypeScript types are declared next to the schemas and are the\n * only thing imported with `import type`; the schemas are the runtime truth.\n */\n\nexport type PanelInput = {\n sessionID: string\n settings: PanelSettings\n detail?: PanelRow | undefined\n width: number\n busy?: boolean | undefined\n}\n\nexport type PanelOutput = {\n lines: PanelLine[]\n database?: DbInfo | undefined\n}\n\nexport type TurnsInput = {\n sessionID: string\n limit: number\n width: number\n}\n\nexport type TurnsOutput = {\n summary: PanelLine[]\n history: PanelLine[]\n}\n\nexport type ListCostInput = {\n sessionID: string\n}\n\nexport type ListCostOutput = {\n cost: number\n}\n\nexport type FiltersOutput = {\n models: FilterOption[]\n providers: FilterOption[]\n}\n\nexport type PruneInput = {\n days: number\n confirm: true\n}\n\nexport type WipeInput = {\n confirm: true\n}\n\nexport type VacuumInput = {\n confirm: true\n}\n\nexport type BackfillInput = {\n confirm: true\n}\n\nexport type VacuumOutput = {\n before: number\n after: number\n freed: number\n}\n\nexport type RecordedEvent = {\n sessionID?: string | undefined\n at: number\n}\n\nexport type UsageFormat = LineFormatOptions\n\nconst Tone = { type: \"string\", enum: [\"base\", \"muted\", \"warning\", \"accent\"] } as const\n\nconst PanelRowSchema = {\n type: \"object\",\n properties: {\n kind: { type: \"string\", enum: [\"model\", \"session\", \"period\", \"provider\", \"turn\", \"prune\", \"wipe\"] },\n value: { type: \"string\", maxLength: 500 },\n variant: { type: \"string\", maxLength: 200 },\n },\n required: [\"kind\", \"value\"],\n additionalProperties: false,\n} as const\n\nconst PanelLineSchema = {\n type: \"object\",\n properties: {\n text: { type: \"string\" },\n tone: Tone,\n hint: { type: \"boolean\" },\n row: PanelRowSchema,\n },\n required: [\"text\"],\n additionalProperties: false,\n} as const\n\nconst PanelSettingsSchema = {\n type: \"object\",\n properties: {\n view: { type: \"string\", enum: [\"overview\", \"models\", \"providers\", \"cache\", \"periods\", \"latency\", \"sessions\", \"turns\", \"db\", \"go\"] },\n range: { type: \"string\", enum: [\"session\", \"today\", \"7d\", \"30d\", \"all\"] },\n sort: { type: \"string\", maxLength: 40 },\n sortDesc: { type: \"boolean\" },\n granularity: { type: \"string\", enum: [\"day\", \"week\", \"month\"] },\n turnsScope: { type: \"string\", enum: [\"session\", \"all\"] },\n modelID: { type: \"string\", maxLength: 300 },\n providerID: { type: \"string\", maxLength: 300 },\n },\n required: [\"view\", \"range\", \"sort\", \"sortDesc\", \"granularity\", \"turnsScope\", \"modelID\", \"providerID\"],\n additionalProperties: false,\n} as const\n\nconst TableSizeSchema = {\n type: \"object\",\n properties: {\n name: { type: \"string\" },\n rows: { type: \"number\" },\n },\n required: [\"name\", \"rows\"],\n additionalProperties: false,\n} as const\n\nconst DbInfoSchema = {\n type: \"object\",\n properties: {\n path: { type: \"string\" },\n bytes: { type: \"number\" },\n walBytes: { type: \"number\" },\n schemaVersion: { type: \"number\" },\n tables: { type: \"array\", items: TableSizeSchema },\n firstAt: { type: \"number\" },\n lastAt: { type: \"number\" },\n removable: {\n type: \"array\",\n items: {\n type: \"object\",\n properties: { days: { type: \"number\" }, steps: { type: \"number\" } },\n required: [\"days\", \"steps\"],\n additionalProperties: false,\n },\n },\n unpriced: { type: \"number\" },\n },\n required: [\"path\", \"bytes\", \"schemaVersion\", \"tables\", \"removable\", \"unpriced\"],\n additionalProperties: false,\n} as const\n\nconst FilterOptionSchema = {\n type: \"object\",\n properties: { value: { type: \"string\" }, steps: { type: \"number\" } },\n required: [\"value\", \"steps\"],\n additionalProperties: false,\n} as const\n\nconst PruneResultSchema = {\n type: \"object\",\n properties: {\n steps: { type: \"number\" },\n prompts: { type: \"number\" },\n events: { type: \"number\" },\n usage: { type: \"number\" },\n },\n required: [\"steps\", \"prompts\", \"events\", \"usage\"],\n additionalProperties: false,\n} as const\n\nconst WipeResultSchema = {\n type: \"object\",\n properties: {\n steps: { type: \"number\" },\n prompts: { type: \"number\" },\n events: { type: \"number\" },\n usage: { type: \"number\" },\n sessions: { type: \"number\" },\n },\n required: [\"steps\", \"prompts\", \"events\", \"usage\", \"sessions\"],\n additionalProperties: false,\n} as const\n\nconst BackfillResultSchema = {\n type: \"object\",\n properties: {\n candidates: { type: \"number\" },\n updated: { type: \"number\" },\n },\n required: [\"candidates\", \"updated\"],\n additionalProperties: false,\n} as const\n\nconst VacuumResultSchema = {\n type: \"object\",\n properties: {\n before: { type: \"number\" },\n after: { type: \"number\" },\n freed: { type: \"number\" },\n },\n required: [\"before\", \"after\", \"freed\"],\n additionalProperties: false,\n} as const\n\nconst NoInput = { type: \"object\", properties: {}, additionalProperties: false } as const\n\nconst ErrorSchema = {\n type: \"object\",\n properties: { message: { type: \"string\", maxLength: 500 } },\n additionalProperties: false,\n} as const\n\nconst errors = {\n busy: ErrorSchema,\n unavailable: ErrorSchema,\n disabled: ErrorSchema,\n invalid: ErrorSchema,\n} as const\n\nexport const UsageInsights = Rpc.define({\n id: \"usage-insights\",\n methods: {\n panel: {\n input: {\n type: \"object\",\n properties: {\n sessionID: { type: \"string\", maxLength: 200 },\n settings: PanelSettingsSchema,\n detail: PanelRowSchema,\n width: { type: \"number\", minimum: 20, maximum: MAX_PANEL_WIDTH },\n busy: { type: \"boolean\" },\n },\n required: [\"sessionID\", \"settings\", \"width\"],\n additionalProperties: false,\n },\n output: {\n type: \"object\",\n properties: {\n lines: { type: \"array\", items: PanelLineSchema },\n database: DbInfoSchema,\n },\n required: [\"lines\"],\n additionalProperties: false,\n },\n errors,\n },\n turns: {\n input: {\n type: \"object\",\n properties: {\n sessionID: { type: \"string\", maxLength: 200 },\n limit: { type: \"number\", minimum: 1, maximum: MAX_TURNS },\n width: { type: \"number\", minimum: 20, maximum: MAX_HISTORY_WIDTH },\n },\n required: [\"sessionID\", \"limit\", \"width\"],\n additionalProperties: false,\n },\n output: {\n type: \"object\",\n properties: {\n summary: { type: \"array\", items: PanelLineSchema },\n history: { type: \"array\", items: PanelLineSchema },\n },\n required: [\"summary\", \"history\"],\n additionalProperties: false,\n },\n errors,\n },\n listCost: {\n input: {\n type: \"object\",\n properties: { sessionID: { type: \"string\", maxLength: 200 } },\n required: [\"sessionID\"],\n additionalProperties: false,\n },\n output: {\n type: \"object\",\n properties: { cost: { type: \"number\" } },\n required: [\"cost\"],\n additionalProperties: false,\n },\n errors,\n },\n filters: {\n input: NoInput,\n output: {\n type: \"object\",\n properties: {\n models: { type: \"array\", items: FilterOptionSchema },\n providers: { type: \"array\", items: FilterOptionSchema },\n },\n required: [\"models\", \"providers\"],\n additionalProperties: false,\n },\n errors,\n },\n dbInfo: {\n input: NoInput,\n output: DbInfoSchema,\n errors,\n },\n prune: {\n input: {\n type: \"object\",\n properties: {\n days: { type: \"number\", minimum: 1, maximum: 3650 },\n confirm: { type: \"boolean\", enum: [true] },\n },\n required: [\"days\", \"confirm\"],\n additionalProperties: false,\n },\n output: PruneResultSchema,\n errors,\n },\n wipe: {\n input: {\n type: \"object\",\n properties: { confirm: { type: \"boolean\", enum: [true] } },\n required: [\"confirm\"],\n additionalProperties: false,\n },\n output: WipeResultSchema,\n errors,\n },\n vacuum: {\n input: {\n type: \"object\",\n properties: { confirm: { type: \"boolean\", enum: [true] } },\n required: [\"confirm\"],\n additionalProperties: false,\n },\n output: VacuumResultSchema,\n errors,\n },\n backfill: {\n input: {\n type: \"object\",\n properties: { confirm: { type: \"boolean\", enum: [true] } },\n required: [\"confirm\"],\n additionalProperties: false,\n },\n output: BackfillResultSchema,\n errors,\n },\n },\n events: {\n recorded: {\n schema: {\n type: \"object\",\n properties: {\n sessionID: { type: \"string\", maxLength: 200 },\n at: { type: \"number\" },\n },\n required: [\"at\"],\n additionalProperties: false,\n },\n },\n },\n})\n",
|
|
5
|
+
"import { Rpc } from \"@opencode/plugin/rpc\"\nimport { MAX_HISTORY_WIDTH, MAX_PANEL_WIDTH, MAX_TURNS } from \"./limits\"\nimport type { LineFormatOptions, PanelLine, PanelRow, PanelSettings } from \"./panel-data\"\nimport type { BackfillResult, DbInfo, PruneResult } from \"./stats/maintenance\"\nimport type { FilterOption } from \"./stats/queries\"\n\n/**\n * The usage-insights RPC contract. One definition is served by the server\n * part and consumed by the TUI and the desktop GUI, so both clients read the\n * same database through the same validated surface.\n *\n * JSON Schema keeps the contract portable: the server does not need a newer\n * `effect` runtime, and a client can be a TUI, an Electron window or a plain\n * HTTP client. TypeScript types are declared next to the schemas and are the\n * only thing imported with `import type`; the schemas are the runtime truth.\n */\n\nexport type PanelInput = {\n sessionID: string\n settings: PanelSettings\n detail?: PanelRow | undefined\n width: number\n busy?: boolean | undefined\n}\n\nexport type PanelOutput = {\n lines: PanelLine[]\n database?: DbInfo | undefined\n}\n\nexport type TurnsInput = {\n sessionID: string\n limit: number\n width: number\n}\n\nexport type TurnsOutput = {\n summary: PanelLine[]\n history: PanelLine[]\n}\n\nexport type ListCostInput = {\n sessionID: string\n}\n\nexport type ListCostOutput = {\n cost: number\n}\n\nexport type FiltersOutput = {\n models: FilterOption[]\n providers: FilterOption[]\n}\n\nexport type PruneInput = {\n days: number\n confirm: true\n}\n\nexport type WipeInput = {\n confirm: true\n}\n\nexport type VacuumInput = {\n confirm: true\n}\n\nexport type BackfillInput = {\n confirm: true\n}\n\nexport type VacuumOutput = {\n before: number\n after: number\n freed: number\n}\n\nexport type RecordedEvent = {\n sessionID?: string | undefined\n at: number\n}\n\nexport type UsageFormat = LineFormatOptions\n\nconst Tone = { type: \"string\", enum: [\"base\", \"muted\", \"warning\", \"accent\"] } as const\n\nconst PanelRowSchema = {\n type: \"object\",\n properties: {\n kind: { type: \"string\", enum: [\"model\", \"session\", \"period\", \"provider\", \"turn\", \"prune\", \"wipe\"] },\n value: { type: \"string\", maxLength: 500 },\n variant: { type: \"string\", maxLength: 200 },\n },\n required: [\"kind\", \"value\"],\n additionalProperties: false,\n} as const\n\nconst PanelLineSchema = {\n type: \"object\",\n properties: {\n text: { type: \"string\" },\n tone: Tone,\n hint: { type: \"boolean\" },\n row: PanelRowSchema,\n },\n required: [\"text\"],\n additionalProperties: false,\n} as const\n\nconst PanelSettingsSchema = {\n type: \"object\",\n properties: {\n view: { type: \"string\", enum: [\"overview\", \"models\", \"providers\", \"cache\", \"periods\", \"latency\", \"sessions\", \"turns\", \"db\", \"go\"] },\n range: { type: \"string\", enum: [\"session\", \"today\", \"7d\", \"30d\", \"all\"] },\n sort: { type: \"string\", maxLength: 40 },\n sortDesc: { type: \"boolean\" },\n granularity: { type: \"string\", enum: [\"day\", \"week\", \"month\"] },\n turnsScope: { type: \"string\", enum: [\"session\", \"all\"] },\n modelID: { type: \"string\", maxLength: 300 },\n providerID: { type: \"string\", maxLength: 300 },\n },\n required: [\"view\", \"range\", \"sort\", \"sortDesc\", \"granularity\", \"turnsScope\", \"modelID\", \"providerID\"],\n additionalProperties: false,\n} as const\n\nconst TableSizeSchema = {\n type: \"object\",\n properties: {\n name: { type: \"string\" },\n rows: { type: \"number\" },\n },\n required: [\"name\", \"rows\"],\n additionalProperties: false,\n} as const\n\nconst DbInfoSchema = {\n type: \"object\",\n properties: {\n path: { type: \"string\" },\n bytes: { type: \"number\" },\n walBytes: { type: \"number\" },\n schemaVersion: { type: \"number\" },\n tables: { type: \"array\", items: TableSizeSchema },\n firstAt: { type: \"number\" },\n lastAt: { type: \"number\" },\n removable: {\n type: \"array\",\n items: {\n type: \"object\",\n properties: { days: { type: \"number\" }, steps: { type: \"number\" } },\n required: [\"days\", \"steps\"],\n additionalProperties: false,\n },\n },\n unpriced: { type: \"number\" },\n },\n required: [\"path\", \"bytes\", \"schemaVersion\", \"tables\", \"removable\", \"unpriced\"],\n additionalProperties: false,\n} as const\n\nconst FilterOptionSchema = {\n type: \"object\",\n properties: { value: { type: \"string\" }, steps: { type: \"number\" } },\n required: [\"value\", \"steps\"],\n additionalProperties: false,\n} as const\n\nconst PruneResultSchema = {\n type: \"object\",\n properties: {\n steps: { type: \"number\" },\n prompts: { type: \"number\" },\n compactions: { type: \"number\" },\n usage: { type: \"number\" },\n },\n required: [\"steps\", \"prompts\", \"compactions\", \"usage\"],\n additionalProperties: false,\n} as const\n\nconst WipeResultSchema = {\n type: \"object\",\n properties: {\n steps: { type: \"number\" },\n prompts: { type: \"number\" },\n compactions: { type: \"number\" },\n usage: { type: \"number\" },\n sessions: { type: \"number\" },\n },\n required: [\"steps\", \"prompts\", \"compactions\", \"usage\", \"sessions\"],\n additionalProperties: false,\n} as const\n\nconst BackfillResultSchema = {\n type: \"object\",\n properties: {\n candidates: { type: \"number\" },\n updated: { type: \"number\" },\n },\n required: [\"candidates\", \"updated\"],\n additionalProperties: false,\n} as const\n\nconst VacuumResultSchema = {\n type: \"object\",\n properties: {\n before: { type: \"number\" },\n after: { type: \"number\" },\n freed: { type: \"number\" },\n },\n required: [\"before\", \"after\", \"freed\"],\n additionalProperties: false,\n} as const\n\nconst NoInput = { type: \"object\", properties: {}, additionalProperties: false } as const\n\nconst ErrorSchema = {\n type: \"object\",\n properties: { message: { type: \"string\", maxLength: 500 } },\n additionalProperties: false,\n} as const\n\nconst errors = {\n busy: ErrorSchema,\n unavailable: ErrorSchema,\n disabled: ErrorSchema,\n invalid: ErrorSchema,\n} as const\n\nexport const UsageInsights = Rpc.define({\n id: \"usage-insights\",\n methods: {\n panel: {\n input: {\n type: \"object\",\n properties: {\n sessionID: { type: \"string\", maxLength: 200 },\n settings: PanelSettingsSchema,\n detail: PanelRowSchema,\n width: { type: \"number\", minimum: 20, maximum: MAX_PANEL_WIDTH },\n busy: { type: \"boolean\" },\n },\n required: [\"sessionID\", \"settings\", \"width\"],\n additionalProperties: false,\n },\n output: {\n type: \"object\",\n properties: {\n lines: { type: \"array\", items: PanelLineSchema },\n database: DbInfoSchema,\n },\n required: [\"lines\"],\n additionalProperties: false,\n },\n errors,\n },\n turns: {\n input: {\n type: \"object\",\n properties: {\n sessionID: { type: \"string\", maxLength: 200 },\n limit: { type: \"number\", minimum: 1, maximum: MAX_TURNS },\n width: { type: \"number\", minimum: 20, maximum: MAX_HISTORY_WIDTH },\n },\n required: [\"sessionID\", \"limit\", \"width\"],\n additionalProperties: false,\n },\n output: {\n type: \"object\",\n properties: {\n summary: { type: \"array\", items: PanelLineSchema },\n history: { type: \"array\", items: PanelLineSchema },\n },\n required: [\"summary\", \"history\"],\n additionalProperties: false,\n },\n errors,\n },\n listCost: {\n input: {\n type: \"object\",\n properties: { sessionID: { type: \"string\", maxLength: 200 } },\n required: [\"sessionID\"],\n additionalProperties: false,\n },\n output: {\n type: \"object\",\n properties: { cost: { type: \"number\" } },\n required: [\"cost\"],\n additionalProperties: false,\n },\n errors,\n },\n filters: {\n input: NoInput,\n output: {\n type: \"object\",\n properties: {\n models: { type: \"array\", items: FilterOptionSchema },\n providers: { type: \"array\", items: FilterOptionSchema },\n },\n required: [\"models\", \"providers\"],\n additionalProperties: false,\n },\n errors,\n },\n dbInfo: {\n input: NoInput,\n output: DbInfoSchema,\n errors,\n },\n prune: {\n input: {\n type: \"object\",\n properties: {\n days: { type: \"number\", minimum: 1, maximum: 3650 },\n confirm: { type: \"boolean\", enum: [true] },\n },\n required: [\"days\", \"confirm\"],\n additionalProperties: false,\n },\n output: PruneResultSchema,\n errors,\n },\n wipe: {\n input: {\n type: \"object\",\n properties: { confirm: { type: \"boolean\", enum: [true] } },\n required: [\"confirm\"],\n additionalProperties: false,\n },\n output: WipeResultSchema,\n errors,\n },\n vacuum: {\n input: {\n type: \"object\",\n properties: { confirm: { type: \"boolean\", enum: [true] } },\n required: [\"confirm\"],\n additionalProperties: false,\n },\n output: VacuumResultSchema,\n errors,\n },\n backfill: {\n input: {\n type: \"object\",\n properties: { confirm: { type: \"boolean\", enum: [true] } },\n required: [\"confirm\"],\n additionalProperties: false,\n },\n output: BackfillResultSchema,\n errors,\n },\n },\n events: {\n recorded: {\n schema: {\n type: \"object\",\n properties: {\n sessionID: { type: \"string\", maxLength: 200 },\n at: { type: \"number\" },\n },\n required: [\"at\"],\n additionalProperties: false,\n },\n },\n },\n})\n",
|
|
6
6
|
"/**\n * Shared request bounds.\n *\n * The RPC schemas, the clients and the service use the same numbers: a client\n * must clamp before it calls the RPC, because schema validation runs before the\n * service can clamp. These constants keep the three layers from drifting.\n */\n\n/** Widest panel the server formats. */\nexport const MAX_PANEL_WIDTH = 200\n\n/** Widest turn history the server formats. */\nexport const MAX_HISTORY_WIDTH = 120\n\n/** Most turns the server returns for a history request. */\nexport const MAX_TURNS = 50\n\n/** A finite width within the panel bounds. */\nexport function clampPanelWidth(value: number): number {\n if (!Number.isFinite(value)) return 20\n return Math.min(MAX_PANEL_WIDTH, Math.max(20, Math.round(value)))\n}\n\n/**\n * How many monospace cells fit in a panel body. The GUI measures the body and\n * one glyph; both are CSS pixels, so the division is exact before the floor.\n * A zero measurement means the body is not laid out (hidden or not mounted):\n * the caller keeps its previous width instead of asking for a 20-column panel.\n */\nexport function panelColumns(available: number, charWidth: number): number {\n if (!Number.isFinite(available) || !Number.isFinite(charWidth) || available <= 0 || charWidth <= 0) return 0\n return clampPanelWidth(Math.floor(available / charWidth))\n}\n\n/** A finite turn limit within the history bounds. */\nexport function clampTurnsLimit(value: number): number {\n if (!Number.isFinite(value)) return 1\n return Math.min(MAX_TURNS, Math.max(1, Math.round(value)))\n}\n"
|
|
7
7
|
],
|
|
8
|
-
"mappings": ";;AAAA;;;ACSO,IAAM,kBAAkB;AAGxB,IAAM,oBAAoB;AAG1B,IAAM,YAAY;AAGlB,SAAS,eAAe,CAAC,OAAuB;AAAA,EACrD,IAAI,CAAC,OAAO,SAAS,KAAK;AAAA,IAAG,OAAO;AAAA,EACpC,OAAO,KAAK,IAAI,iBAAiB,KAAK,IAAI,IAAI,KAAK,MAAM,KAAK,CAAC,CAAC;AAAA;AAe3D,SAAS,eAAe,CAAC,OAAuB;AAAA,EACrD,IAAI,CAAC,OAAO,SAAS,KAAK;AAAA,IAAG,OAAO;AAAA,EACpC,OAAO,KAAK,IAAI,WAAW,KAAK,IAAI,GAAG,KAAK,MAAM,KAAK,CAAC,CAAC;AAAA;;;AD+C3D,IAAM,OAAO,EAAE,MAAM,UAAU,MAA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vB;AAAA,QACA,UAAU,CAAC,IAAI;AAAA,QACf,sBAAsB;AAAA,MACxB;AAAA,IACF;AAAA,EACF;AACF,CAAC;",
|
|
9
|
+
"debugId": "CA8589888C19446A64756E2164756E21",
|
|
10
10
|
"names": []
|
|
11
11
|
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { OpenCodeClient } from "@opencode/client";
|
|
2
|
+
import { type UsageSettingsEnvelope, type UsageSettingsPatch } from "./settings";
|
|
3
|
+
/**
|
|
4
|
+
* The settings plumbing shared by the TUI and the desktop app: connect to the
|
|
5
|
+
* server's event stream, refresh on demand, send a partial update, reset, and
|
|
6
|
+
* stop. The two surfaces differ only in when they call these methods and how
|
|
7
|
+
* they show errors.
|
|
8
|
+
*/
|
|
9
|
+
export type SettingsSync = {
|
|
10
|
+
connect(): void;
|
|
11
|
+
refresh(force?: boolean): Promise<void>;
|
|
12
|
+
update(patch: UsageSettingsPatch): Promise<void>;
|
|
13
|
+
reset(): Promise<void>;
|
|
14
|
+
stop(): void;
|
|
15
|
+
};
|
|
16
|
+
export type SettingsSyncOptions = {
|
|
17
|
+
/** Read the client where it is used: it changes after a server restart. */
|
|
18
|
+
readonly client: () => OpenCodeClient;
|
|
19
|
+
readonly set: (next: UsageSettingsEnvelope) => void;
|
|
20
|
+
/** Skip an incoming value while the caller has a local edit pending. */
|
|
21
|
+
readonly canApply?: (next: UsageSettingsEnvelope) => boolean;
|
|
22
|
+
/** Replace the default event acceptance check. Return false to ignore. */
|
|
23
|
+
readonly acceptEvent?: (next: UsageSettingsEnvelope) => boolean;
|
|
24
|
+
/** Load failures: fetch or event subscription. */
|
|
25
|
+
readonly onLoadError?: (message: string) => void;
|
|
26
|
+
/** Save and reset failures. */
|
|
27
|
+
readonly onSaveError?: (message: string) => void;
|
|
28
|
+
};
|
|
29
|
+
export declare function createSettingsSync(options: SettingsSyncOptions): SettingsSync;
|