modscode JA

modscode / Gallery / painel-vivo

painel-vivo

Painel com o que está rodando: saída ao vivo, porcentagem, subagentes, contexto e cota, registro da sessão, explicação para leigo e glossário

Code you can checkTerminal + desktopPaneBoxButtonMarkdownText

What it does

  • Draws a pane
  • Adds /painel, /glossario
  • Watches tool calls
  • Hooks agent.spawn, session.measure, session.start, turn.complete and 1 more
  • Keeps its own state between turns

Good points

  • No network calls
  • Written in TypeScript
  • Handles errors
  • Writes no files

Code to start from

Two kinds: a starter modscode writes from the design above, and the lines of the mod's own code that draw it.

Starter (register.tsx)

register.tsx
import type { Register } from 'claude-code'

// Drawn like painel-vivo by Marcelo Diego (pane), as modscode read it from the mod's code:
// https://modscode.com/gallery/diegocamara89-painel-vivo/
// Written by modscode from that reading, not copied from the mod: use it as you like.
// Each value below stands for one the mod works out at run time; put in your own.
export const register: Register = on => {
  // the pane: open it with $.ui.open({ id: 'my-pane', title: "Em execução" })
  on('ui.render', { component: 'Pane', requestId: 'my-pane' }, async ($, e) => {
    const { Box, Text, Button, Markdown } = $.ui.resolve(e)
    const length = '…'
    const calados = '…'
    const modeloCurto = '…'
    const esforcoTxt = '…'
    const titulo = '…'
    const sinal = '…'
    const agoraTxt = '…'
    const barra = '…'
    const bolinhas = '…'
    const passos = '…'
    const tempo = '…'
    const cauda = '…'
    const sinal2 = '…'
    const agoraTxt2 = '…'
    const barra2 = '…'
    const bolinhas2 = '…'
    const tempo2 = '…'
    const cauda2 = '…'
    const sinal3 = '…'
    const agoraTxt3 = '…'
    const barra3 = '…'
    const bolinhas3 = '…'
    const tempo3 = '…'
    const cauda3 = '…'
    const desc = '…'
    const tool = '…'
    const cmd = '…'
    const l = '…'
    const explicacao = '…'
    const hora = '…'
    const split = '…'
    const hora2 = '…'
    const split2 = '…'
    const hora3 = '…'
    const split3 = '…'
    const n = '…'
    const agVivos = '…'
    const agTotal = '…'
    const barra4 = '…'
    const mil = '…'
    const cota5h = '…'
    const semana = '…'
    return (
      <Box flexDirection="column">
        <Box flexDirection="row" justifyContent="space-between">
          <Text>
            <Text bold>
              {length}
            </Text>
            {" trabalhando"}
            <Text color="yellow">
              {`  ·  ${calados} calado`}
            </Text>
            <Text color="red">
              {`  ·  ${length} erros para ver`}
            </Text>
            <Text dimColor>
              {`  ·  ${length} ações`}
            </Text>
          </Text>
          <Button plain label={`Glossário (${length})`} />
        </Box>
        <Text>
          <Text bold color="blue">
            {modeloCurto}
          </Text>
          <Text dimColor>
            {" · principal"}
          </Text>
          <Text dimColor>
            {"  ·  esforço "}
            <Text color="yellow">
              {esforcoTxt}
            </Text>
          </Text>
        </Text>
        <Text dimColor>
          <Text color="blue">
            ■
          </Text>
          {" subagente  "}
          <Text color="gray">
            ■
          </Text>
          {" comando  "}
          <Text color="magenta">
            ■
          </Text>
          {" agy  "}
          <Text color="cyan">
            ■
          </Text>
          {" Codex  "}
          <Text color="green">
            ■
          </Text>
          {" feito  "}
          <Text color="red">
            ■
          </Text>
          {" falhou"}
        </Text>
        <Text dimColor>
          Ninguém trabalhando agora.
        </Text>
        <Box flexDirection="row" flexWrap="wrap" columnGap={1}>
          <Box flexDirection="column" borderStyle="round" paddingX={1}>
            <Box flexDirection="row" justifyContent="space-between">
              <Button plain label={`${titulo}`} />
              <Text>
                {sinal}
              </Text>
            </Box>
            <Text dimColor>
              {`esforço ${esforcoTxt}`}
            </Text>
            <Text bold wrap="truncate-end">
              {agoraTxt}
            </Text>
            <Text color="cyan">
              {barra}
            </Text>
            <Text wrap="truncate-end">
              {bolinhas}
              <Text dimColor>
                {`  ${passos} passos · ${tempo}`}
              </Text>
            </Text>
            <Text dimColor>
              {tempo}
            </Text>
            <Text dimColor wrap="truncate-end">
              {cauda}
            </Text>
          </Box>
          <Box flexDirection="column" borderStyle="round" paddingX={1}>
            <Box flexDirection="row" justifyContent="space-between">
              <Button plain label={`${titulo}`} />
              <Text>
                {sinal2}
              </Text>
            </Box>
            <Text dimColor>
              {`esforço ${esforcoTxt}`}
            </Text>
            <Text bold wrap="truncate-end">
              {agoraTxt2}
            </Text>
            <Text color="cyan">
              {barra2}
            </Text>
            <Text wrap="truncate-end">
              {bolinhas2}
              <Text dimColor>
                {`  ${passos} passos · ${tempo}`}
              </Text>
            </Text>
            <Text dimColor>
              {tempo2}
            </Text>
            <Text dimColor wrap="truncate-end">
              {cauda2}
            </Text>
          </Box>
          <Box flexDirection="column" borderStyle="round" paddingX={1}>
            <Box flexDirection="row" justifyContent="space-between">
              <Button plain label={`${titulo}`} />
              <Text>
                {sinal3}
              </Text>
            </Box>
            <Text dimColor>
              {`esforço ${esforcoTxt}`}
            </Text>
            <Text bold wrap="truncate-end">
              {agoraTxt3}
            </Text>
            <Text color="cyan">
              {barra3}
            </Text>
            <Text wrap="truncate-end">
              {bolinhas3}
              <Text dimColor>
                {`  ${passos} passos · ${tempo}`}
              </Text>
            </Text>
            <Text dimColor>
              {tempo3}
            </Text>
            <Text dimColor wrap="truncate-end">
              {cauda3}
            </Text>
          </Box>
        </Box>
        <Box flexDirection="column" borderStyle="round" borderColor="blue" paddingX={1} marginTop={1}>
          <Box flexDirection="row" justifyContent="space-between">
            <Text bold wrap="truncate-end">
              {desc}
            </Text>
            <Button plain label="fechar" />
          </Box>
          <Text dimColor wrap="truncate-end">
            {`${tool}: ${cmd}`}
          </Text>
          <Text wrap="truncate-end">
            {`  ▶ ${desc} · ${tempo}`}
          </Text>
          <Text wrap="truncate-end">
            {`  ▶ ${desc} · ${tempo}`}
          </Text>
          <Text wrap="truncate-end">
            {`  ▶ ${desc} · ${tempo}`}
          </Text>
          <Text dimColor wrap="truncate-end">
            {`  ${l}`}
          </Text>
          <Text dimColor wrap="truncate-end">
            {`  ${l}`}
          </Text>
          <Text dimColor wrap="truncate-end">
            {`  ${l}`}
          </Text>
          <Text dimColor>
            explicando…
          </Text>
          <Markdown text={`${explicacao}`} />
        </Box>
        <Box flexDirection="row" columnGap={2}>
          <Text color="red">
            Para ver
          </Text>
          <Button plain label="dispensar todos" />
        </Box>
        <Box flexDirection="row" flexWrap="wrap" columnGap={2}>
          <Button plain label={`✕ ${titulo} · ${tempo}`} />
          <Button plain label={`✕ ${titulo} · ${tempo}`} />
          <Button plain label={`✕ ${titulo} · ${tempo}`} />
        </Box>
        <Box flexDirection="column" borderStyle="round" borderColor="gray" paddingX={1}>
          <Text dimColor>
            registro da sessão
          </Text>
          <Box flexDirection="row" columnGap={1}>
            <Text dimColor>
              {hora}
            </Text>
            <Text color="red" wrap="truncate-end">
              {split}
            </Text>
            <Button plain label={`${desc} · começou`} />
          </Box>
          <Box flexDirection="row" columnGap={1}>
            <Text dimColor>
              {hora2}
            </Text>
            <Text color="red" wrap="truncate-end">
              {split2}
            </Text>
            <Button plain label={`${desc} · começou`} />
          </Box>
          <Box flexDirection="row" columnGap={1}>
            <Text dimColor>
              {hora3}
            </Text>
            <Text color="red" wrap="truncate-end">
              {split3}
            </Text>
            <Button plain label={`${desc} · começou`} />
          </Box>
        </Box>
        <Button plain label={`▾ Histórico (${length})`} />
        <Text dimColor>
          {`  ✓ ${n} leituras, buscas e edições`}
        </Text>
        <Text dimColor>
          {`  ✓ ${n} leituras, buscas e edições`}
        </Text>
        <Text dimColor>
          {`  ✓ ${n} leituras, buscas e edições`}
        </Text>
        <Text>
          <Text dimColor>
            {"subagentes "}
          </Text>
          <Text color="blue">
            {`[${agVivos}/${agTotal}]`}
          </Text>
          <Text dimColor>
            {"   contexto "}
            <Text>
              {barra4}
            </Text>
            {`  ${mil} de ${mil}`}
          </Text>
          <Text dimColor>
            {"   cota 5h "}
            <Text>
              {`${cota5h}%`}
            </Text>
          </Text>
          <Text dimColor>
            {"   semana "}
            <Text>
              {`${semana}%`}
            </Text>
          </Text>
        </Text>
      </Box>
    )
  })
}

The mod's own code

Shown under the mod's licence (MIT); its text is below. Keep the notice if you copy these lines.

mods/painel-vivo/hooks/register.tsx lines 393–552 · Pane
  on('ui.render', { component: 'Pane', requestId: PANE }, async ($, e) => {
    const { Box, Text, Button, Markdown } = $.ui.resolve(e)
    const lista = await read($, chamadas)
    const sel = await read($, aberta)
    const vg = await read($, verGlossario)
    const glos = await read($, glossario)
    const ctx = await read($, contexto)
    const pri = await read($, principal)
    const agentesM = await read($, agentes)
    const vistosL = await read($, vistos)
    const histAberto = await read($, historicoAberto)
    const agora = await $.clock.now()

    if (vg) {
      return (
        <Box flexDirection="column">
          <Button plain label="← voltar" onPress={() => update($, verGlossario, () => false)} />
          <Text bold>Glossário ({glos.length} termos)</Text>
          {glos.length === 0 && <Text dimColor>Vazio. Abra uma tarefa e use "Explicar isto".</Text>}
          {glos.map(t => (
            <Text>
              <Text bold>{t.termo}</Text>: {t.definicao}
            </Text>
          ))}
        </Box>
      )
    }

    const ids = new Set(lista.map(c => c.id))
    const filhos = new Map<string, Chamada[]>()
    for (const c of lista) if (c.pai && ids.has(c.pai)) filhos.set(c.pai, [...(filhos.get(c.pai) ?? []), c])
    const topo = lista.filter(c => !c.pai || !ids.has(c.pai))
    const vistosS = new Set(vistosL)
    const vida = (c: Chamada) =>
      Math.max(c.ultimaSaida ?? 0, c.inicio, ...(filhos.get(c.id) ?? []).map(f => Math.max(f.fim ?? 0, f.ultimaSaida ?? 0, f.inicio)))

    const dura = (c: Chamada) => (c.fim ?? agora) - c.inicio
    const importante = (c: Chamada) =>
      c.tool === 'Agent' || c.rotulo === 'agy' || c.rotulo === 'Codex' || (c.tool === 'Bash' && dura(c) >= MESA_MS)
    const naMesa = (c: Chamada) => importante(c) && (c.fim === undefined || agora - c.fim < FICA_MS)
    const paraVer = topo.filter(c => c.erro && !vistosS.has(c.id))
    const mesas = topo.filter(c => naMesa(c) && !(c.erro && !vistosS.has(c.id)))
    const recentes = topo.filter(c => c.fim !== undefined && importante(c) && !naMesa(c) && !(c.erro && !vistosS.has(c.id))).slice(-5).reverse()
    const noRecente = new Set([...recentes, ...mesas, ...paraVer].map(c => c.id))
    const antigos = topo.filter(c => c.fim !== undefined && !noRecente.has(c.id)).reverse()

    const trabalhando = topo.filter(c => c.fim === undefined && importante(c))
    const calados = trabalhando.filter(c => agora - vida(c) >= 10_000).length

    const abrir = (c: Chamada) => async () => {
      if (c.erro) await update($, vistos, v => (v.includes(c.id) ? v : [...v, c.id].slice(-200)))
      await update($, aberta, v => (v === c.id ? '' : c.id))
    }

    const cartao = (c: Chamada, largura: string) => {
      const vivo = c.fim === undefined
      const calado = vivo ? agora - vida(c) : 0
      const sinal = !vivo ? (c.erro ? '✕ erro' : '✓ feito') : calado < 10_000 ? 'ativo' : `calado ${tempo(calado)}`
      const corSinal = !vivo ? (c.erro ? 'red' : 'green') : calado < 10_000 ? 'green' : calado < 60_000 ? 'yellow' : 'red'
      const borda = c.erro ? 'red' : !vivo ? 'green' : calado >= 10_000 ? corSinal : corDe(c)
      const ag = c.tool === 'Agent' ? Object.values(agentesM).find(a => a.pai === c.id) : undefined
      const fs = filhos.get(c.id) ?? []
      const g = (c.agys ?? []).slice(-1)[0]
      const passos = g ? g.passos : fs.filter(f => !INTERNAS.has(f.tool)).length
      const uteis = fs.filter(f => !INTERNAS.has(f.tool))
      const filhoVivo = uteis.filter(f => f.fim === undefined).slice(-1)[0] ?? (vivo ? uteis.slice(-1)[0] : undefined)
      const agoraTxt = g && !g.fim ? traduzir(g.agora)
        : filhoVivo ? fazendo(filhoVivo)
        : c.tool === 'Agent' && vivo ? 'pensando'
        : c.rotulo === 'Codex' ? (c.cauda ?? []).filter(l => l.startsWith('[codex]')).slice(-1)[0]?.replace('[codex] ', '') ?? c.desc
        : c.desc
      return (
        <Box flexDirection="column" width={largura} borderStyle="round" borderColor={borda} paddingX={1}>
          <Box flexDirection="row" justifyContent="space-between">
            <Button plain label={titulo(c, g)} onPress={abrir(c)} />
            <Text color={corSinal}>{sinal}</Text>
          </Box>
          {ag?.esforco && <Text dimColor>{`esforço ${esforcoTxt(ag.esforco)}`}</Text>}
          <Text bold wrap="truncate-end">{agoraTxt}</Text>
          {c.pct !== undefined && vivo && <Text color="cyan">{barra(c.pct)}</Text>}
          {passos > 0 && <Text wrap="truncate-end">{bolinhas(passos, vivo)}<Text dimColor>{`  ${passos} passos · ${tempo(dura(c))}`}</Text></Text>}
          {passos === 0 && <Text dimColor>{tempo(dura(c))}</Text>}
          {c.pct === undefined && vivo && (c.cauda ?? []).length > 0 && (
            <Text dimColor wrap="truncate-end">{(c.cauda ?? []).slice(-1)[0]}</Text>
          )}
        </Box>
      )
    }

    const etiqueta = (c: Chamada, _cor?: string) => (
      <Button plain label={`${c.erro ? '✕' : '✓'} ${titulo(c, (c.agys ?? []).slice(-1)[0])} · ${tempo(dura(c))}`} onPress={abrir(c)} />
    )

    const detalhe = (c: Chamada) => {
      const fs = filhos.get(c.id) ?? []
      return (
        <Box flexDirection="column" borderStyle="round" borderColor="blue" paddingX={1} marginTop={1}>
          <Box flexDirection="row" justifyContent="space-between">
            <Text bold wrap="truncate-end">{c.desc}</Text>
            <Button plain label="fechar" onPress={() => update($, aberta, () => '')} />
          </Box>
          <Text dimColor wrap="truncate-end">{`${c.tool}: ${c.cmd}`}</Text>
          {fs.slice(-8).map(f => (
            <Text dimColor={f.fim !== undefined} wrap="truncate-end">{`  ${f.fim === undefined ? '▶' : f.erro ? '✕' : '✓'} ${f.desc} · ${tempo(dura(f))}`}</Text>
          ))}
          {(c.cauda ?? []).slice(-12).map(l => <Text dimColor wrap="truncate-end">{`  ${l}`}</Text>)}
          {!c.explicacao && (c.explicando
            ? <Text dimColor>explicando…</Text>
            : <Button label="Explicar isto" onPress={() => void explicar($, c.id)} />)}
          {c.explicacao && <Markdown text={c.explicacao} />}
        </Box>
      )
    }

    // Registro: cada trabalho importante entra na hora em que começou ou terminou; os 6 mais novos.
    const registro = topo.filter(importante)
      .map(c => ({ c, t: c.fim ?? c.inicio }))
      .sort((a, b) => a.t - b.t)
      .slice(-6)
    const agentesTopo = topo.filter(c => c.tool === 'Agent')
    const agVivos = agentesTopo.filter(c => c.fim === undefined).length
    const agTotal = agentesTopo.length
    const tom = (p: number) => (p >= 85 ? 'red' : p >= 70 ? 'yellow' : 'green')

    const selC = sel ? lista.find(c => c.id === sel) : undefined
    const largura = (e.props as any)?.bodyColumns ?? e.viewport?.columns ?? 80
    const duas = largura >= 70

    return (
      <Box flexDirection="column">
        <Box flexDirection="row" justifyContent="space-between">
          <Text>
            <Text bold>{trabalhando.length}</Text> trabalhando
            {calados > 0 && <Text color="yellow">{`  ·  ${calados} calado`}</Text>}
            {paraVer.length > 0 && <Text color="red">{`  ·  ${paraVer.length} ${paraVer.length > 1 ? 'erros' : 'erro'} para ver`}</Text>}
            <Text dimColor>{`  ·  ${lista.length} ações`}</Text>
          </Text>
          <Button plain label={`Glossário (${glos.length})`} onPress={() => update($, verGlossario, () => true)} />
        </Box>
        {pri.modelo && (
          <Text>
            <Text bold color="blue">{modeloCurto(pri.modelo)}</Text>
            <Text dimColor>{' · principal'}</Text>
            {pri.esforco && <Text dimColor>{`  ·  esforço `}<Text color="yellow">{esforcoTxt(pri.esforco)}</Text></Text>}
          </Text>
        )}
        <Text dimColor>
          <Text color="blue">■</Text>{' subagente  '}<Text color="gray">■</Text>{' comando  '}<Text color="magenta">■</Text>{' agy  '}
          <Text color="cyan">■</Text>{' Codex  '}<Text color="green">■</Text>{' feito  '}<Text color="red">■</Text>{' falhou'}
        </Text>

        {mesas.length === 0 && <Text dimColor>Ninguém trabalhando agora.</Text>}
        <Box flexDirection="row" flexWrap="wrap" columnGap={1}>
          {mesas.slice(-6).map(c => cartao(c, duas ? '49%' : '100%'))}
        </Box>

        {selC && detalhe(selC)}

        {paraVer.length > 0 && (
          <Box flexDirection="row" columnGap={2}>
Licence text (MIT)
MIT License

Copyright (c) 2026 Marcelo Diego

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

What its code calls

runs programsreads filesenv varsdrives Claudetool callsremembers

The design, read from code

Drawn from the mod's source at the commit read, not from a run: a list is drawn three times, a condition takes its first branch that draws in the desktop app, and a value only the run time knows is shown as a made-up sample (dotted underline) or left out. Colours and type are this site's.

What its code shows

Read from the source at commit 0edaf159a2fc on 2026-10-06. The first group decides whether a mod is listed; the rest is for you to weigh. A later commit is not read until the next crawl.

Decides the listing: code you can check
Entry readEvery module hooks/hooks.json names was read.mods/painel-vivo/hooks/register.tsx
ParsesEvery file parses as TypeScript or JavaScript.1 files parsed
All its code is in the modEvery import is a file of the mod or the engine's own module; no packages, no require.all its code is in the mod
ReadableNo minified lines, no eval or new Function, no import of a computed path, no encoded blobs.no minified code, no eval, no encoded blobs
Calls in the openNetwork and programs are reached as $.http.fetch and $.process.run in place, never passed around.every call outside goes through $ in the open
For you to weigh before installing
Where it drawsThe terminal, the desktop app, both, or nothing (hooks only: a guard or a prompt rewriter), as its code says. Shown, never a reason to leave a mod out.draws in the terminal and the desktop app, the same in both
Install lineWhether its repository's own .claude-plugin/marketplace.json lists it, so it installs from that marketplace with the lines on its page.listed in its repository's .claude-plugin/marketplace.json: installs from there
Programs on WindowsWhether every program it starts through $.process exists on Windows (tail, date, open, osascript, /usr/… do not).mods/painel-vivo/hooks/register.tsx:108 tail (not on Windows)
NetworkWhether every fetch names its https host in the code.no network
ProgramsWhether every program it starts is named in the code and is not a shell, an interpreter or a network tool.rtk, tail
Reads and sendsWhether it both reads files or environment variables and reaches the network.reaches no network
Keys in the sourceWhether the source holds what looks like an API key or a private key.no keys in the source
LicenceAn open licence (MIT, Apache-2.0, BSD, ISC, Unlicense, 0BSD, CC0) with its text lets modscode show its code; otherwise the code is linked.MIT

This is a reading of the code text, not a security review: it does not run the mod, and it cannot see what a program the mod starts does. The check before installing is yours. How mods are chosen

Install it

Check it yourself before you install it. Mods run unsandboxed, with your permissions, and modscode does not vouch for what this code does. Read the code below (or run claude plugin validate . in its folder), weigh what it reaches, and install the commit you read.

Its repository is its marketplace. Add that marketplace (in the terminal with these commands, or in the desktop app's plugin settings) and install the mod from it:

/plugin marketplace add diegocamara89/claude-mods
/plugin install painel-vivo@claude-mods-diego

This installs the marketplace's latest commit, which may not be the one read here (0edaf159a2fc). Compare them before you install.

Ask Claude about it

With the modscode connector added, Claude can read this design, what its code reaches and its code, and build on them. Ask it like this:

Read the modscode design "diegocamara89-painel-vivo" with its code and make me a pane like it

Search them from Claude: the MCP connector

Similar designs