opencode-mask-j0k3r-dev-rgl 2.0.19 → 2.0.20
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/components.tsx +4 -14
- package/package.json +1 -1
- package/tui.tsx +13 -0
package/components.tsx
CHANGED
|
@@ -84,17 +84,12 @@ export const SidebarArch = (props: {
|
|
|
84
84
|
lspItems?: ReadonlyArray<TuiSidebarLspItem>
|
|
85
85
|
todos?: ReadonlyArray<TuiSidebarTodoItem>
|
|
86
86
|
messages?: ReadonlyArray<Message>
|
|
87
|
+
contextLimit?: number
|
|
87
88
|
}) => {
|
|
88
89
|
if (!props.config.show_sidebar) return null
|
|
89
90
|
|
|
90
91
|
const t = props.theme
|
|
91
92
|
|
|
92
|
-
// ── Files ─────────────────────────────────────────────────────────────────
|
|
93
|
-
const files = props.files ?? []
|
|
94
|
-
const totalAdditions = files.reduce((s, f) => s + f.additions, 0)
|
|
95
|
-
const totalDeletions = files.reduce((s, f) => s + f.deletions, 0)
|
|
96
|
-
const totalChanges = totalAdditions + totalDeletions
|
|
97
|
-
|
|
98
93
|
// ── Todos ─────────────────────────────────────────────────────────────────
|
|
99
94
|
const todos = props.todos ?? []
|
|
100
95
|
const doneTodos = todos.filter(t => t.status === "completed").length
|
|
@@ -113,19 +108,14 @@ export const SidebarArch = (props: {
|
|
|
113
108
|
const lspTotal = lspItems.length
|
|
114
109
|
|
|
115
110
|
// ── Tokens & Cost ─────────────────────────────────────────────────────────
|
|
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
111
|
const messages = props.messages ?? []
|
|
119
112
|
const assistantMsgs = messages.filter(m => m.role === "assistant")
|
|
120
113
|
const contextTokens = assistantMsgs.reduce((max, m) => Math.max(max, m.tokens?.input ?? 0), 0)
|
|
121
114
|
const totalCost = assistantMsgs.reduce((s, m) => s + (m.cost ?? 0), 0)
|
|
122
115
|
|
|
123
|
-
//
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
const CONTEXT_LIMIT = 1_000_000
|
|
127
|
-
const contextPct = Math.min(100, Math.round((contextTokens / CONTEXT_LIMIT) * 100))
|
|
128
|
-
// El % de costo: escalamos $1.00 = 100%
|
|
116
|
+
// context window real del modelo via api.state.provider → model.limit.context
|
|
117
|
+
const contextLimit = props.contextLimit ?? 1_000_000
|
|
118
|
+
const contextPct = Math.min(100, Math.round((contextTokens / contextLimit) * 100))
|
|
129
119
|
const costPct = Math.min(100, Math.round(totalCost * 100))
|
|
130
120
|
|
|
131
121
|
const fmtTokens = (n: number) => n >= 1000 ? `${(n / 1000).toFixed(1)}k` : `${n}`
|
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.
|
|
4
|
+
"version": "2.0.20",
|
|
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": {
|
package/tui.tsx
CHANGED
|
@@ -48,6 +48,18 @@ const tui: TuiPlugin = async (api, options) => {
|
|
|
48
48
|
const mcpItems = api.state.mcp()
|
|
49
49
|
const lspItems = api.state.lsp()
|
|
50
50
|
|
|
51
|
+
// Resolver el context window real del modelo activo
|
|
52
|
+
// api.state.config.model = "providerID/modelID"
|
|
53
|
+
// api.state.provider = ReadonlyArray<Provider> donde Provider.models[modelID].limit.context
|
|
54
|
+
let contextLimit: number | undefined
|
|
55
|
+
try {
|
|
56
|
+
const modelStr = api.state.config?.model ?? ""
|
|
57
|
+
const [providerID, modelID] = modelStr.split("/")
|
|
58
|
+
const provider = api.state.provider.find(p => p.id === providerID)
|
|
59
|
+
const model = provider?.models?.[modelID]
|
|
60
|
+
if (model?.limit?.context) contextLimit = model.limit.context
|
|
61
|
+
} catch (_) {}
|
|
62
|
+
|
|
51
63
|
return (
|
|
52
64
|
<SidebarArch
|
|
53
65
|
theme={ctx.theme.current}
|
|
@@ -59,6 +71,7 @@ const tui: TuiPlugin = async (api, options) => {
|
|
|
59
71
|
messages={messages}
|
|
60
72
|
mcpItems={mcpItems}
|
|
61
73
|
lspItems={lspItems}
|
|
74
|
+
contextLimit={contextLimit}
|
|
62
75
|
/>
|
|
63
76
|
)
|
|
64
77
|
},
|