opencode-cache-hit 0.2.0 → 0.2.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/AGENTS.md +2 -1
- package/README.md +5 -18
- package/README.zh-CN.md +155 -96
- package/docs/assets/cache-hit-panel.v3.png +0 -0
- package/docs/en/design.md +22 -4
- package/docs/en/timeline-duplicate-writes.md +125 -0
- package/docs/en/timeline.md +17 -13
- package/docs/zh-CN/design.md +23 -5
- package/docs/zh-CN/timeline.md +18 -15
- package/package.json +1 -1
- package/scripts/README.md +63 -0
- package/scripts/timeline-dashboard.ts +728 -0
- package/src/agents-view.tsx +8 -8
- package/src/cache-ttl-view.tsx +3 -8
- package/src/format-cost.ts +70 -0
- package/src/format-model.ts +227 -0
- package/src/sidebar-host.tsx +6 -6
- package/src/timeline/collector.ts +40 -87
- package/src/timeline/records.ts +0 -30
- package/src/tui-panel/README.md +2 -2
- package/src/tui-panel/README.zh-CN.md +2 -2
- package/src/tui-panel/components.tsx +31 -4
- package/src/tui-panel/index.ts +6 -1
- package/src/tui-panel/palette.ts +5 -0
- package/src/version.ts +4 -1
- package/docs/assets/.gitkeep +0 -0
- package/docs/assets/cache-hit-panel.png +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** @jsxImportSource @opentui/solid */
|
|
2
2
|
import { Show, type JSX } from "solid-js"
|
|
3
|
-
import { padBeforeTitleSummary, sepAfterPrefix, visualWidth } from "./layout.ts"
|
|
3
|
+
import { padBeforeTitleSummary, sepAfterPrefix, UNIT_GAP, visualWidth } from "./layout.ts"
|
|
4
4
|
import type { PanelLayout } from "./use-panel-layout.ts"
|
|
5
5
|
import type { PanelPalette } from "./palette.ts"
|
|
6
6
|
|
|
@@ -126,18 +126,45 @@ export function TuiSection(props: {
|
|
|
126
126
|
)
|
|
127
127
|
}
|
|
128
128
|
|
|
129
|
+
function metricRowGap(label: string, value: string, unit: string, gauge: number): number {
|
|
130
|
+
const used =
|
|
131
|
+
visualWidth(label) + visualWidth(value) + (unit ? visualWidth(unit) + UNIT_GAP : 0)
|
|
132
|
+
return Math.max(1, gauge - used)
|
|
133
|
+
}
|
|
134
|
+
|
|
129
135
|
export function TuiMetricRow(props: {
|
|
130
136
|
pal: PanelPalette
|
|
131
137
|
layout: PanelLayout
|
|
132
138
|
label: string
|
|
133
139
|
value: string
|
|
134
140
|
unit?: string
|
|
141
|
+
/** Whole line (label + value + unit). Ignored when `labelFg` / `valueFg` set. */
|
|
135
142
|
fg?: string
|
|
143
|
+
/** Label-only color (e.g. sub-agent model); value stays `valueFg` or muted. */
|
|
144
|
+
labelFg?: string
|
|
145
|
+
valueFg?: string
|
|
136
146
|
}) {
|
|
137
|
-
const
|
|
147
|
+
const unit = props.unit ?? ""
|
|
148
|
+
const unitSuffix = unit ? " " + unit : ""
|
|
149
|
+
const split = props.labelFg !== undefined || props.valueFg !== undefined
|
|
150
|
+
if (split) {
|
|
151
|
+
const gap = metricRowGap(props.label, props.value, unit, props.layout.gauge())
|
|
152
|
+
const labelColor = props.labelFg ?? props.fg ?? props.pal.muted
|
|
153
|
+
const valueColor = props.valueFg ?? props.fg ?? props.pal.muted
|
|
154
|
+
return (
|
|
155
|
+
<text>
|
|
156
|
+
<span style={{ fg: labelColor }}>{props.label}</span>
|
|
157
|
+
{" ".repeat(gap)}
|
|
158
|
+
<span style={{ fg: valueColor }}>
|
|
159
|
+
{props.value}
|
|
160
|
+
{unitSuffix}
|
|
161
|
+
</span>
|
|
162
|
+
</text>
|
|
163
|
+
)
|
|
164
|
+
}
|
|
138
165
|
return (
|
|
139
|
-
<text fg={fg}>
|
|
140
|
-
{props.layout.row(props.label, props.value,
|
|
166
|
+
<text fg={props.fg ?? props.pal.muted}>
|
|
167
|
+
{props.layout.row(props.label, props.value, unit)}
|
|
141
168
|
</text>
|
|
142
169
|
)
|
|
143
170
|
}
|
package/src/tui-panel/index.ts
CHANGED
|
@@ -19,7 +19,12 @@ export {
|
|
|
19
19
|
padBeforeTitleSummary,
|
|
20
20
|
} from "./layout.ts"
|
|
21
21
|
|
|
22
|
-
export {
|
|
22
|
+
export {
|
|
23
|
+
buildPanelPalette,
|
|
24
|
+
themeColorToHex,
|
|
25
|
+
toneBrandHex,
|
|
26
|
+
type PanelPalette,
|
|
27
|
+
} from "./palette.ts"
|
|
23
28
|
|
|
24
29
|
export {
|
|
25
30
|
createPanelLayout,
|
package/src/tui-panel/palette.ts
CHANGED
|
@@ -79,6 +79,11 @@ export function themeColorToHex(raw: unknown, fallback: string): string {
|
|
|
79
79
|
return "#" + [c.r, c.g, c.b].map((v) => v.toString(16).padStart(2, "0")).join("")
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
+
/** Tone a vendor brand hex for dark TUI panels (same max saturation as theme colors). */
|
|
83
|
+
export function toneBrandHex(hex: string, fallback: string): string {
|
|
84
|
+
return desaturateTo(hex, MAX_SAT, fallback)
|
|
85
|
+
}
|
|
86
|
+
|
|
82
87
|
export function buildPanelPalette(theme: Record<string, unknown>): PanelPalette {
|
|
83
88
|
const sat = (k: string, fb: string) => desaturateTo(theme[k], MAX_SAT, fb)
|
|
84
89
|
return {
|
package/src/version.ts
CHANGED
package/docs/assets/.gitkeep
DELETED
|
File without changes
|
|
Binary file
|