opencode-mask-j0k3r-dev-rgl 2.0.21 → 2.0.22
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 +3 -5
- package/package.json +1 -1
- package/tui.tsx +19 -12
package/components.tsx
CHANGED
|
@@ -139,9 +139,8 @@ export const SidebarArch = (props: {
|
|
|
139
139
|
</box>
|
|
140
140
|
)}
|
|
141
141
|
|
|
142
|
-
{/* ── Context (tokens + % used + cost) ── */}
|
|
143
|
-
|
|
144
|
-
<box flexDirection="column" alignItems="center" marginTop={1}>
|
|
142
|
+
{/* ── Context (tokens + % used + cost) ── siempre visible */}
|
|
143
|
+
<box flexDirection="column" alignItems="center" marginTop={1}>
|
|
145
144
|
<text fg={t.textMuted} bold={true}>Context</text>
|
|
146
145
|
|
|
147
146
|
{/* tokens */}
|
|
@@ -164,8 +163,7 @@ export const SidebarArch = (props: {
|
|
|
164
163
|
<text fg={t.textMuted}>spent</text>
|
|
165
164
|
</box>
|
|
166
165
|
<ProgressBar value={costPct} width={18} fillColor="#ffd166" emptyColor="#3a3a3a" theme={t} />
|
|
167
|
-
|
|
168
|
-
)}
|
|
166
|
+
</box>
|
|
169
167
|
|
|
170
168
|
{/* ── Todos ── */}
|
|
171
169
|
{totalTodos > 0 && (
|
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.22",
|
|
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
|
@@ -32,24 +32,30 @@ const tui: TuiPlugin = async (api, options) => {
|
|
|
32
32
|
|
|
33
33
|
const [ctxTick, setCtxTick] = createSignal(0)
|
|
34
34
|
|
|
35
|
+
let debugLogged = false
|
|
35
36
|
api.event.on("message.updated", (event) => {
|
|
36
|
-
|
|
37
|
+
// Debug: loguear estructura completa la primera vez
|
|
38
|
+
if (!debugLogged) {
|
|
39
|
+
debugLogged = true
|
|
40
|
+
const propsKeys = Object.keys((event as any).properties ?? {}).join(",")
|
|
41
|
+
const infoKeys = Object.keys(((event as any).properties?.info ?? (event as any).properties) ?? {}).join(",")
|
|
42
|
+
console.error("[j0k3r-mask] event.properties keys:", propsKeys)
|
|
43
|
+
console.error("[j0k3r-mask] info/msg keys:", infoKeys)
|
|
44
|
+
console.error("[j0k3r-mask] full event:", JSON.stringify(event).slice(0, 800))
|
|
45
|
+
api.ui.toast({ variant: "info", message: `props: ${propsKeys} | info: ${infoKeys}`, duration: 8000 })
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// Intentar ambas estructuras: { properties: { info: Message } } o { properties: Message }
|
|
49
|
+
const props = (event as any).properties
|
|
50
|
+
const msg = props?.info ?? props
|
|
37
51
|
if (!msg || msg.role !== "assistant") return
|
|
38
52
|
|
|
39
|
-
|
|
40
|
-
const sid = msg.sessionID ?? msg.session_id ?? msg.parentID ?? null
|
|
53
|
+
const sid: string | undefined = msg.sessionID
|
|
41
54
|
if (!sid) return
|
|
42
55
|
|
|
43
|
-
// Tokens: intentamos todos los campos posibles y tomamos el mayor
|
|
44
56
|
const t = msg.tokens ?? {}
|
|
45
|
-
const tokens =
|
|
46
|
-
|
|
47
|
-
t.total ?? 0,
|
|
48
|
-
(t.input ?? 0) + (t.output ?? 0),
|
|
49
|
-
)
|
|
50
|
-
|
|
51
|
-
// Costo: rastreamos por mensaje para no acumular en updates repetidos
|
|
52
|
-
const msgId = msg.id ?? msg.messageID ?? `${sid}-${Date.now()}`
|
|
57
|
+
const tokens = t.input ?? 0
|
|
58
|
+
const msgId: string = msg.id ?? `${sid}-unknown`
|
|
53
59
|
msgCostTracker.set(`${sid}:${msgId}`, msg.cost ?? 0)
|
|
54
60
|
|
|
55
61
|
const cost = Array.from(msgCostTracker.entries())
|
|
@@ -59,6 +65,7 @@ const tui: TuiPlugin = async (api, options) => {
|
|
|
59
65
|
const prev = ctxStore.get(sid) ?? { tokens: 0, cost: 0 }
|
|
60
66
|
ctxStore.set(sid, { tokens: Math.max(prev.tokens, tokens), cost })
|
|
61
67
|
|
|
68
|
+
console.error(`[j0k3r-mask] sid=${sid} tokens=${tokens} cost=${cost}`)
|
|
62
69
|
setCtxTick(v => v + 1)
|
|
63
70
|
})
|
|
64
71
|
|