chore: import Local-Cursor v1.1.8 source snapshot

Includes the current working directory changes. Historical commits and release binaries are excluded to limit Gitea storage.
Source base: d7515973fbfd6dd2001fa156c483455b8081c7cb
This commit is contained in:
FuDie0915
2026-11-10 01:24:28 +08:00
commit db73cf5a39
337 changed files with 147502 additions and 0 deletions

View File

@@ -0,0 +1,36 @@
package historymetrics
type Summary struct {
ProviderCallsTotal int `json:"providerCallsTotal"`
TurnsTotal int `json:"turnsTotal"`
ValidTurnsTotal int `json:"validTurnsTotal"`
InvalidTurnsTotal int `json:"invalidTurnsTotal"`
RequestTokensTotal int64 `json:"requestTokensTotal"`
PromptTokensTotal int64 `json:"promptTokensTotal"`
CacheReadTokens int64 `json:"cacheReadTokens"`
CacheWriteTokens int64 `json:"cacheWriteTokens"`
CacheHitRate *float64 `json:"cacheHitRate"`
}
type Totals struct {
InputTokens int64
OutputTokens int64
CacheReadTokens int64
CacheWriteTokens int64
PromptTokensTotal int64
RequestTokensTotal int64
// IncludeCacheWriteInHitRate 控制 CacheHitRate 分母是否计入缓存写入 Token。
IncludeCacheWriteInHitRate bool
}
func cacheHitRateFromTotals(totals Totals) *float64 {
inputCacheTokensTotal := totals.CacheReadTokens + totals.InputTokens
if totals.IncludeCacheWriteInHitRate {
inputCacheTokensTotal += totals.CacheWriteTokens
}
if inputCacheTokensTotal <= 0 {
return nil
}
value := float64(totals.CacheReadTokens) / float64(inputCacheTokensTotal)
return &value
}