modscode EN

modscode / 図鑑 / acp-ui

acp-ui

Restyles the Claude Code terminal like an ACP chat: prompt and tool cards, inline diffs, a status band, footer stats, a /dash pane and a done toast

確かめやすいコードターミナル+デスクトップペインバンドステータスライントーストBoxButtonClientMarkdownText

何をするか

  • プロンプトの上の帯・欄・ステータス行・トーストを描く
  • /dash・/play・/acp-scene・/acp-theme を足す
  • ツールの呼び出しを見張る(止めることがある)
  • agent.spawn・prompt.submit・session.start・turn.complete ほか 2 個にフックする
  • ターンをまたいで自分の状態を持つ

良いところ

  • ネットワークに出ない
  • TypeScript で書かれている
  • ファイルを書かない

作り始めるためのコード

2 種類あります。上のデザインから modscode が書いた雛形と、その Mod 自身のコードのうち描いている部分です。

雛形(register.tsx)

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

// Drawn like acp-ui by Nguyễn Thế Huy (pane, band, status, toast), as modscode read it from the mod's code:
// https://modscode.com/gallery/huydepzai121-acp-ui/
// 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 band above the prompt; what else goes there is drawn under it
  on('ui.render', { component: 'AbovePrompt' }, async ($, e, next) => {
    const { Box, Client, Button, Text } = $.ui.resolve(e)
    const text = '…'
    const text2 = '…'
    const text3 = '…'
    const text4 = '…'
    const text5 = '…'
    const text6 = '…'
    const text7 = '…'
    const text8 = '…'
    const text9 = '…'
    const text10 = '…'
    const text11 = '…'
    const text12 = '…'
    const text13 = '…'
    const text14 = '…'
    const text15 = '…'
    return (
      <Box flexDirection="column">
        <Box flexDirection="column">
          <Client module="./scene.tsx" />
          <Box gap={2}>
            <Button hotkey="j" label="j nhảy" />
            <Button hotkey="q" label="q thoát" />
          </Box>
        </Box>
        <Box>
          <Text>
            <Text>
              ▐
            </Text>
            <Text>
              {text}
            </Text>
            <Text>
              {text2}
            </Text>
            <Text>
              {text3}
            </Text>
            <Text>
              ▌
            </Text>
          </Text>
          <Text>
            <Text>
              ▐
            </Text>
            <Text>
              {text4}
            </Text>
            <Text>
              {text5}
            </Text>
            <Text>
              {text6}
            </Text>
            <Text>
              ▌
            </Text>
          </Text>
          <Text>
            <Text>
              ▐
            </Text>
            <Text>
              {text7}
            </Text>
            <Text>
              {text8}
            </Text>
            <Text>
              {text9}
            </Text>
            <Text>
              ▌
            </Text>
          </Text>
          <Text>
            <Text>
              ▐
            </Text>
            <Text>
              {text10}
            </Text>
            <Text>
              {text11}
            </Text>
            <Text>
              {text12}
            </Text>
            <Text>
              ▌
            </Text>
          </Text>
          <Text>
            <Text>
              ▐
            </Text>
            <Text>
              {text13}
            </Text>
            <Text>
              {text14}
            </Text>
            <Text>
              {text15}
            </Text>
            <Text>
              ▌
            </Text>
          </Text>
          <Button plain label="✨" action="app:toggleDiffPreSession" />
        </Box>
        {await next(e)}
      </Box>
    )
  })

  // the pane: open it with $.ui.open({ id: 'my-pane', title: "Phiên làm việc" })
  on('ui.render', { component: 'Pane', requestId: 'my-pane' }, async ($, e) => {
    const { Box, Text } = $.ui.resolve(e)
    const value = '…'
    const label = '…'
    const value2 = '…'
    const label2 = '…'
    const value3 = '…'
    const label3 = '…'
    const label4 = '…'
    const label5 = '…'
    const label6 = '…'
    const row = '…'
    const row2 = '…'
    const row3 = '…'
    const startLabel = '…'
    const text = '…'
    const name = '…'
    const filled = '…'
    const empty = '…'
    const count = '…'
    const text2 = '…'
    const name2 = '…'
    const filled2 = '…'
    const empty2 = '…'
    const count2 = '…'
    const text3 = '…'
    const name3 = '…'
    const filled3 = '…'
    const empty3 = '…'
    const count3 = '…'
    const status = '…'
    const path = '…'
    const removed = '…'
    const added = '…'
    const status2 = '…'
    const path2 = '…'
    const status3 = '…'
    const path3 = '…'
    const length = '…'
    const text4 = '…'
    const text5 = '…'
    const text6 = '…'
    const head = '…'
    return (
      <Box flexDirection="column" gap={1}>
        <Text>
          <Text>
            <Text bold>
              {value}
            </Text>
            <Text>
              {" "}
              {label}
              {" "}
            </Text>
          </Text>
          <Text>
            <Text bold>
              {value2}
            </Text>
            <Text>
              {" "}
              {label2}
              {" "}
            </Text>
          </Text>
          <Text>
            <Text bold>
              {value3}
            </Text>
            <Text>
              {" "}
              {label3}
              {" "}
            </Text>
          </Text>
        </Text>
        <Box flexDirection="column">
          <Text>
            TIMELINE
            {" "}
            <Text>
              ────────
            </Text>
          </Text>
          <Text>
            <Text>
              ▆
            </Text>
            <Text>
              ▆
            </Text>
            <Text>
              ▆
            </Text>
          </Text>
          <Text>
            <Text>
              <Text>
                ■
              </Text>
              {" "}
              {label4}
              {" "}
            </Text>
            <Text>
              <Text>
                ■
              </Text>
              {" "}
              {label5}
              {" "}
            </Text>
            <Text>
              <Text>
                ■
              </Text>
              {" "}
              {label6}
              {" "}
            </Text>
          </Text>
        </Box>
        <Box flexDirection="column">
          <Text>
            HOẠT ĐỘNG
            {" "}
            <Text>
              ────────
            </Text>
          </Text>
          <Text>
            {row}
          </Text>
          <Text>
            {row2}
          </Text>
          <Text>
            {row3}
          </Text>
          <Text>
            {startLabel}
            bây giờ
          </Text>
        </Box>
        <Box flexDirection="column">
          <Text>
            TOOL
            {" "}
            <Text>
              ────────
            </Text>
          </Text>
          <Text>
            Chưa có tool call nào.
          </Text>
          <Text>
            <Text>
              {text}
              {" "}
            </Text>
            <Text>
              {name}
            </Text>
            <Text>
              {filled}
            </Text>
            <Text>
              {empty}
            </Text>
            <Text>
              {count}
            </Text>
          </Text>
          <Text>
            <Text>
              {text2}
              {" "}
            </Text>
            <Text>
              {name2}
            </Text>
            <Text>
              {filled2}
            </Text>
            <Text>
              {empty2}
            </Text>
            <Text>
              {count2}
            </Text>
          </Text>
          <Text>
            <Text>
              {text3}
              {" "}
            </Text>
            <Text>
              {name3}
            </Text>
            <Text>
              {filled3}
            </Text>
            <Text>
              {empty3}
            </Text>
            <Text>
              {count3}
            </Text>
          </Text>
        </Box>
        <Box flexDirection="column">
          <Text>
            CHANGES
            {" "}
            <Text>
              ────────
            </Text>
          </Text>
          <Text>
            Không có thay đổi.
          </Text>
          <Text>
            <Text bold>
              {status}
              {" "}
            </Text>
            <Text>
              {path}
            </Text>
            <Text>
              {`−${removed}`}
            </Text>
            <Text>
              {`+${added}`}
            </Text>
          </Text>
          <Text>
            <Text bold>
              {status2}
              {" "}
            </Text>
            <Text>
              {path2}
            </Text>
            <Text>
              {`−${removed}`}
            </Text>
            <Text>
              {`+${added}`}
            </Text>
          </Text>
          <Text>
            <Text bold>
              {status3}
              {" "}
            </Text>
            <Text>
              {path3}
            </Text>
            <Text>
              {`−${removed}`}
            </Text>
            <Text>
              {`+${added}`}
            </Text>
          </Text>
          <Text>
            {"… "}
            {length}
            {" file nữa"}
          </Text>
        </Box>
        <Text>
          <Text>
            <Text>
              ▐
            </Text>
            <Text>
              {text4}
            </Text>
            <Text>
              {text5}
            </Text>
            <Text>
              {text6}
            </Text>
            <Text>
              ▌
            </Text>
          </Text>
          <Text>
            {" "}
            {head}
          </Text>
        </Text>
      </Box>
    )
  })

  on('session.start', async ($, e, next) => {
    await $.ui.status(`✨ đang viết lại câu lệnh…`)
    await $.ui.toast(`Không viết lại được lúc này; câu gốc đã được đặt lại vào ô nhập.`)
    await $.ui.toast(`✨ Đã viết lại — xem trong ô nhập, Enter để gửi.`)
    return next(e)
  })
}

Mod 自身のコード

Mod のライセンス(MIT)に従って載せています。全文は下にあります。写すときは著作権表示を残してください。

plugin/hooks/register.tsx 1337〜1394 行 · バンド
  on('ui.render', { component: 'AbovePrompt', surface: 'terminal' }, async ($, e, next) => {
    const [repo, session, runs, sc] = await Promise.all([read($, git), read($, band), read($, agents), read($, scene)])
    const running = Object.values(runs).filter(isRunning).sort((a, b) => a.startedAt - b.startedAt)
    const sceneRows = SCENE_ROWS[sc.playing ? 'game' : 'scene']
    const showScene = sc.enabled && (e.props.isWorking || sc.playing) && e.props.maxRows >= sceneRows + 2
    if (e.props.hasSurvey || (repo === null && session === null && running.length === 0 && !showScene)) return next(e)
    const { Box, Text, Client, Button } = $.ui.resolve(e)
    const sceneProps: SceneProps = {
      mode: sc.playing ? 'game' : 'scene',
      bubble: sc.bubble || 'Đang suy nghĩ…',
      progress: sc.turnTools / (sc.turnTools + 6),
      jumpSeq: sc.jumpSeq,
      width: Math.max(30, e.props.bodyColumns - 2),
      colors: {
        cat: '#E8A35C', eye: '#1E1E1E', nose: '#F28FAD', track: C.track, trackDone: C.accent,
        star: C.yellow, bug: C.red, house: C.soft, roof: C.orange, bubbleBg: C.popup, bubbleFg: C.text, dim: C.dim,
      },
    }
    const sceneBlock = showScene ? (
      <Box flexDirection="column">
        <Client key="scene" module="./scene.tsx" props={sceneProps} height={sceneRows} />
        {sc.playing && (
          <Box gap={2}>
            <Button key="jump" hotkey="j" label="j nhảy" onPress={() => update($, scene, s => ({ ...s, jumpSeq: s.jumpSeq + 1 }))} />
            <Button key="quit" hotkey="q" label="q thoát" onPress={() => update($, scene, s => ({ ...s, playing: false }))} />
          </Box>
        )}
      </Box>
    ) : null
    const percent = session?.ctxPercent ?? null
    const bar = smoothBar((percent ?? 0) / 100, 8)

    return (
      <Box flexDirection="column">
      {sceneBlock}
      <Box>
        {repo && pill(Text, C.tagBlueBg, [{ text: `⎇ ${repo.branch}`, color: C.tagBlueFg }])}
        {repo && repo.files.length > 0 && pill(Text, C.tagYellowBg, [{ text: `${repo.files.length} file đổi`, color: C.tagYellowFg }])}
        {running.length > 0 &&
          pill(Text, C.running, [
            { text: '◆ ', color: C.violet },
            { text: `${running.length} agent: `, color: C.soft },
            { text: running.slice(0, 3).map(r => `${r.type} ◌`).join(' · '), color: C.text },
            ...(running.length > 3 ? [{ text: ` +${running.length - 3}`, color: C.dim }] : []),
          ])}
        {session && pill(Text, C.pill, [{ text: session.model, color: C.soft }])}
        {percent !== null &&
          pill(Text, C.pill, [
            { text: 'ctx ', color: C.dim },
            { text: bar.filled, color: C.accent },
            { text: bar.empty, color: C.track },
            { text: ` ${Math.round(percent)}%`, color: C.soft },
          ])}
        <Button key="enhance" plain label="✨" action={ENHANCE_ACTION} onPress={() => enhancePromptBox($)} />
      </Box>
      </Box>
    )
  })
plugin/hooks/register.tsx 359〜369 行 · バンド
function pill(Text: TextEl, bg: string, segs: Seg[]): RenderElement {
  return (
    <Text>
      <Text color={bg}>▐</Text>
      {segs.map(s => (
        <Text backgroundColor={bg} color={s.color} bold={s.bold}>{s.text}</Text>
      ))}
      <Text color={bg}>▌</Text>
    </Text>
  )
}
plugin/hooks/register.tsx 1450〜1555 行 · ペイン
  on('ui.render', { component: 'Pane', requestId: DASH }, async ($, e) => {
    const { Box, Text } = $.ui.resolve(e)
    const [s, repo, beatList, counts, now] = await Promise.all([
      read($, stats), read($, git), read($, beats), read($, activity), $.clock.now(),
    ])
    const files = repo?.files ?? []
    const added = files.reduce((sum, f) => sum + f.added, 0)
    const removed = files.reduce((sum, f) => sum + f.removed, 0)
    const ranked = Object.entries(s.tools).sort((a, b) => b[1] - a[1]).slice(0, 6)
    const top = ranked[0]?.[1] ?? 1
    const width = Math.max(24, Math.min(e.props.bodyColumns - 2, 48))
    const barWidth = Math.max(6, width - 16)
    const pathWidth = Math.max(8, Math.min(width - 14, Math.max(0, ...files.map(f => cells(f.path)))))
    const tiles: Array<[string, string, string]> = [
      [String(s.total), 'tool call', C.text],
      [`+${added}`, 'dòng thêm', C.green],
      [`−${removed}`, 'dòng xoá', C.red],
    ]

    // Tool calls per minute over the last `columns` minutes, 4 rows tall.
    const columns = Math.max(6, Math.min(24, Math.floor(width / 2)))
    const nowMinute = Math.floor(now / 60000)
    const perMinute = Array.from({ length: columns }, (_, i) => counts[String(nowMinute - columns + 1 + i)] ?? 0)
    const peak = Math.max(1, ...perMinute)
    const chartRows = [3, 2, 1, 0].map(level =>
      perMinute.map(v => LEVELS[Math.max(0, Math.min(8, Math.round((v / peak) * 32) - level * 8))] ?? ' ').join(' '),
    )
    const firstMinute = new Date((nowMinute - columns + 1) * 60000)
    const startLabel = `${String(firstMinute.getHours()).padStart(2, '0')}:${String(firstMinute.getMinutes()).padStart(2, '0')}`
    const shownBeats = beatList.slice(-width)

    return (
      <Box flexDirection="column" gap={1}>
        {width >= 38 ? (
          <Box gap={1}>
            {tiles.map(([value, label, color]) =>
              card(Box, Text, C.snippet, 12, [
                paint(Text, C.snippet, 12, [{ text: value, color, bold: true }]),
                paint(Text, C.snippet, 12, [{ text: label, color: C.dim }]),
              ], 0),
            )}
          </Box>
        ) : (
          <Text>
            {tiles.map(([value, label, color]) => (
              <Text><Text bold color={color}>{value}</Text><Text color={C.dim}> {label}  </Text></Text>
            ))}
          </Text>
        )}
        <Box flexDirection="column">
          {section(Text, 'TIMELINE', width)}
          {shownBeats.length === 0 ? (
            <Text color={C.faint}>Chưa có hoạt động.</Text>
          ) : (
            <Text>{shownBeats.map(b => <Text color={beatColor(b)}>▆</Text>)}</Text>
          )}
          <Text color={C.dim}>
            {BEAT_LABEL.map(([b, label]) => (
              <Text><Text color={beatColor(b)}>■</Text> {label} </Text>
            ))}
          </Text>
        </Box>
        <Box flexDirection="column">
          {section(Text, 'HOẠT ĐỘNG', width, `${columns} phút`)}
          {chartRows.map(row => <Text color={C.accent}>{row}</Text>)}
          <Text color={C.faint}>{startLabel.padEnd(columns * 2 - 8)}bây giờ</Text>
        </Box>
        <Box flexDirection="column">
          {section(Text, 'TOOL', width)}
          {ranked.length === 0 && <Text color={C.faint}>Chưa có tool call nào.</Text>}
          {ranked.map(([name, count]) => {
            const bar = smoothBar(count / top, barWidth)
            const icon = iconOf(kindOf(name))
            return (
              <Text>
                <Text color={icon.color}>{icon.text} </Text>
                <Text color={C.text}>{fit(name, 6).padEnd(7)}</Text>
                <Text color={C.accent}>{bar.filled}</Text>
                <Text color={C.pill}>{bar.empty}</Text>
                <Text color={C.soft}>{String(count).padStart(4)}</Text>
              </Text>
            )
          })}
        </Box>
        <Box flexDirection="column">
          {section(Text, 'CHANGES', width)}
          {files.length === 0 && <Text color={C.faint}>Không có thay đổi.</Text>}
          {files.slice(0, 12).map(f => (
            <Text key={`file-${f.path}`}>
              <Text bold color={statusColor(f.status)}>{f.status} </Text>
              <Text color={C.text}>{fit(f.path, pathWidth).padEnd(pathWidth)}</Text>
              <Text color={C.red}>{`−${f.removed}`.padStart(5)}</Text>
              <Text color={C.green}>{`+${f.added}`.padStart(5)}</Text>
            </Text>
          ))}
          {files.length > 12 && <Text color={C.faint}>… {files.length - 12} file nữa</Text>}
        </Box>
        {repo && (
          <Text>
            {pill(Text, C.tagBlueBg, [{ text: `⎇ ${repo.branch}`, color: C.tagBlueFg }])}
            <Text color={C.dim}> {repo.head}</Text>
          </Text>
        )}
      </Box>
    )
  })
plugin/hooks/register.tsx 349〜357 行 · ペイン
function card(Box: BoxEl, Text: TextEl, bg: string, width: number, rows: RenderElement[], marginTop = 1): RenderElement {
  return (
    <Box flexDirection="column" marginTop={marginTop}>
      {edgeTop(Text, bg, width)}
      {rows}
      {edgeBottom(Text, bg, width)}
    </Box>
  )
}
plugin/hooks/register.tsx 341〜343 行 · ペイン
const edgeTop = (Text: TextEl, bg: string, width: number): RenderElement => (
  <Text color={bg}>{`▗${'▄'.repeat(Math.max(0, width - 2))}▖`}</Text>
)
plugin/hooks/register.tsx 345〜347 行 · ペイン
const edgeBottom = (Text: TextEl, bg: string, width: number): RenderElement => (
  <Text color={bg}>{`▝${'▀'.repeat(Math.max(0, width - 2))}▘`}</Text>
)
ライセンスの全文(MIT)
MIT License

Copyright (c) 2026 Nguyễn Thế Huy

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.

コードが呼ぶもの

プログラム起動Claude を動かすツール呼び出し保存

コードから読み取ったデザイン

読み取ったコミットのソースから描いたもので、動かした結果ではありません。一覧は 3 回描き、条件はデスクトップアプリで描く最初の分岐を取り、動かしたときにだけ決まる値は仮の例(点線の下線)にするか省きます。色と書体はこのサイトのものです。

コードから読めること

2026-10-06 に読んだコミット 7cdf168388f9 のソースから。最初のまとまりが載せる条件で、残りは自分で判断するための材料です。後のコミットは、次に読むまで見ていません。

載せる条件: 確かめやすいコード
入口を読んだhooks/hooks.json が名指すモジュールをすべて読んだ。plugin/hooks/register.tsx
解析できるすべてのファイルが TypeScript か JavaScript として解析できる。2 ファイルを解析
コードが Mod の中で完結import は Mod 自身のファイルかエンジンのモジュールだけ。パッケージも require もない。コードはすべて Mod の中
読める圧縮した行・eval・new Function・計算した道の import()・符号化した塊がない。圧縮・eval・符号化した塊なし
呼び出しが見える通信とプログラム起動はその場で $.http.fetch・$.process.run と書き、他へ渡さない。外への呼び出しはすべてその場の $ で
入れる前に自分で判断する材料
描く場所コードから読んだ、描く先。ターミナル・デスクトップアプリ・両方・何も描かない(フックだけ: 見張りやプロンプトの書き換え)のどれか。出すだけで、外す理由にはしない。ターミナルとデスクトップアプリに描く(デスクトップ用の分岐あり)
入れる手順リポジトリ自身の .claude-plugin/marketplace.json にこの Mod が載っていて、ページに書いた手順でそのマーケットプレイスから入れられるか。リポジトリの .claude-plugin/marketplace.json に載っており、そこから入れられる
Windows のプログラム$.process で起動するプログラムが Windows にあるか(tail・date・open・osascript・/usr/… などは無い)。Windows にないプログラムを使わない
通信fetch の送り先(https のホスト)がコードに書いてあるか。通信なし
プログラム起動するプログラムの名前がコードに書いてあり、シェル・インタプリタ・通信用の道具でないか。git(通信する)
読んで送るファイルや環境変数を読み、かつ通信するか。通信するが、ファイルも環境変数も読まない
ソースの鍵ソースに API キーや秘密鍵らしきものがあるか。ソースに鍵なし
ライセンスオープンなライセンス(MIT・Apache-2.0・BSD・ISC・Unlicense・0BSD・CC0)で全文があれば、modscode にコードを載せる。違えばリンクだけ。MIT

コードの文面を読んだだけで、安全の審査ではありません。動かしてはおらず、起動するプログラムの中で何が起きるかも見えません。入れる前の確認はあなたの役目です。 載せる条件

入れる

入れる前に、必ず自分で確かめてください。Mod はサンドボックスなしで、あなたの権限で動きます。modscode はこのコードの安全を保証しません。下のコードを読み(またはフォルダーで claude plugin validate .)、触るものを見て、読んだコミットを入れてください。

リポジトリがそのままマーケットプレイスです。このマーケットプレイスを足し(ターミナルでは次のコマンド、デスクトップアプリではプラグインの設定)、そこから Mod を入れます。

/plugin marketplace add huydepzai121/claude-acp-ui
/plugin install acp-ui@claude-acp-ui

入るのはマーケットプレイスの最新のコミットで、ここで読んだもの(7cdf168388f9)と違うことがあります。入れる前に見比べてください。

Claude に聞く

modscode のコネクタを入れると、Claude がこのデザイン・コードが触るもの・コードを読んで、それをもとに作れます。たとえば:

modscode のデザイン「huydepzai121-acp-ui」をコードごと読んで、同じようなペインを作って

Claude から探す: MCP コネクタ

似たデザイン