opencode-mask-j0k3r-dev-rgl 2.0.18 → 2.0.19

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.
Files changed (2) hide show
  1. package/components.tsx +7 -13
  2. package/package.json +1 -1
package/components.tsx CHANGED
@@ -113,23 +113,17 @@ export const SidebarArch = (props: {
113
113
  const lspTotal = lspItems.length
114
114
 
115
115
  // ── Tokens & Cost ─────────────────────────────────────────────────────────
116
- // El contexto actual = tokens del ÚLTIMO mensaje asistente (input acumulado)
117
- // El costo = suma de todos los mensajes de la sesión
116
+ // El contexto = input máximo entre todos los mensajes asistente
117
+ // (el input crece conforme el contexto se acumula; el mayor = el más reciente sustancial)
118
118
  const messages = props.messages ?? []
119
119
  const assistantMsgs = messages.filter(m => m.role === "assistant")
120
- const lastMsg = assistantMsgs[assistantMsgs.length - 1]
121
- const contextTokens = lastMsg?.tokens?.input ?? 0
120
+ const contextTokens = assistantMsgs.reduce((max, m) => Math.max(max, m.tokens?.input ?? 0), 0)
122
121
  const totalCost = assistantMsgs.reduce((s, m) => s + (m.cost ?? 0), 0)
123
122
 
124
- // % used: inferido del input del último mensaje vs su límite de contexto
125
- // OpenCode lo calcula internamente; usamos input/(input+output) del último msg
126
- // como aproximación del % relativo al context window del modelo
127
- const lastInput = lastMsg?.tokens?.input ?? 0
128
- const lastOutput = lastMsg?.tokens?.output ?? 0
129
- const lastTotal = lastInput + lastOutput
130
- // Estimamos el limit del modelo: si el input representa el contexto acumulado,
131
- // el % es proporcional. Usamos 200k como referencia estándar.
132
- const CONTEXT_LIMIT = 200_000
123
+ // % used: OpenCode lo calcula internamente con el context window del modelo.
124
+ // Inferimos el límite desde los datos disponibles: si tenemos tokens y %,
125
+ // podemos intentar inferirlo. Sin esa info, usamos 1M (Claude 3.5/Gemini 1.5).
126
+ const CONTEXT_LIMIT = 1_000_000
133
127
  const contextPct = Math.min(100, Math.round((contextTokens / CONTEXT_LIMIT) * 100))
134
128
  // El % de costo: escalamos $1.00 = 100%
135
129
  const costPct = Math.min(100, Math.round(totalCost * 100))
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
3
  "name": "opencode-mask-j0k3r-dev-rgl",
4
- "version": "2.0.18",
4
+ "version": "2.0.19",
5
5
  "description": "Arch Linux TUI mask for OpenCode — hot pink theme with prominent ASCII logo and j0k3r-dev-rgl@latest legend",
6
6
  "type": "module",
7
7
  "exports": {