flight-deck
Band tracking session tokens, tool calls, model working time and cache countdown, with a pane that shows each subagent's transcript
何をするか
- 欄・プロンプトの上の帯を描く
- /agent-log を足す
- ツールの呼び出しを見張る(止めることがある)
- agent.spawn・prompt.submit・session.measure・session.start ほか 5 個にフックする
- ターンをまたいで自分の状態を持つ
良いところ
- ネットワークに出ない
- プロセスを起こさない
- TypeScript で書かれている
- デスクトップ専用の分岐がある
作り始めるためのコード
2 種類あります。上のデザインから modscode が書いた雛形と、その Mod 自身のコードのうち描いている部分です。
雛形(register.tsx)
import type { Register } from 'claude-code'
// Drawn like flight-deck by bez (pane, band), as modscode read it from the mod's code:
// https://modscode.com/gallery/tunglt1810-flight-deck/
// 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: "Agents" })
on('ui.render', { component: 'Pane', requestId: 'my-pane' }, async ($, e) => {
const { Box, Text, Button } = $.ui.resolve(e)
const cellText = '…'
const cellText2 = '…'
const cellText3 = '…'
const cellText4 = '…'
const cellText5 = '…'
const cellText6 = '…'
const cellText7 = '…'
const cellText8 = '…'
const cellText9 = '…'
const cellText10 = '…'
const cellText11 = '…'
const cellText12 = '…'
const cellText13 = '…'
const cellText14 = '…'
const cellText15 = '…'
const cellText16 = '…'
const cellText17 = '…'
const name = '…'
const cellText18 = '…'
const cellText19 = '…'
const cellText20 = '…'
const cellText21 = '…'
const cellText22 = '…'
const cellText23 = '…'
const cellText24 = '…'
const cellText25 = '…'
return (
<Box flexDirection="column">
<Box flexDirection="column">
<Box flexShrink={0}>
<Text wrap="truncate">
{cellText}
</Text>
</Box>
<Box flexDirection="row" gap={1}>
dash:head:model
dash:head:cost
dash:head:pct
dash:head:time
dash:head:runs
</Box>
<Box flexDirection="row" gap={1}>
<Box flexShrink={0}>
<Text wrap="truncate">
{cellText2}
</Text>
</Box>
<Box flexShrink={0}>
<Text wrap="truncate">
{cellText3}
</Text>
</Box>
<Box flexShrink={0}>
<Text wrap="truncate">
{cellText4}
</Text>
</Box>
<Box flexShrink={0}>
<Text wrap="truncate">
{cellText5}
</Text>
</Box>
<Box flexShrink={0}>
<Text wrap="truncate">
{cellText6}
</Text>
</Box>
</Box>
<Box flexDirection="row" gap={1}>
<Box flexShrink={0}>
<Text wrap="truncate">
{cellText7}
</Text>
</Box>
<Box flexShrink={0}>
<Text wrap="truncate">
{cellText8}
</Text>
</Box>
<Box flexShrink={0}>
<Text wrap="truncate">
{cellText9}
</Text>
</Box>
<Box flexShrink={0}>
<Text wrap="truncate">
{cellText10}
</Text>
</Box>
<Box flexShrink={0}>
<Text wrap="truncate">
{cellText11}
</Text>
</Box>
</Box>
<Box flexDirection="row" gap={1}>
<Box flexShrink={0}>
<Text wrap="truncate">
{cellText12}
</Text>
</Box>
<Box flexShrink={0}>
<Text wrap="truncate">
{cellText13}
</Text>
</Box>
<Box flexShrink={0}>
<Text wrap="truncate">
{cellText14}
</Text>
</Box>
<Box flexShrink={0}>
<Text wrap="truncate">
{cellText15}
</Text>
</Box>
<Box flexShrink={0}>
<Text wrap="truncate">
{cellText16}
</Text>
</Box>
</Box>
<Text dimColor wrap="truncate">
────────
</Text>
</Box>
<Box flexDirection="row" gap={1}>
head:mark
<Box flexShrink={0}>
head:name
</Box>
head:runs
head:time
</Box>
<Box flexDirection="row" alignItems="center" gap={1}>
<Box flexShrink={0} />
<Box flexShrink={0}>
<Text wrap="truncate">
{cellText17}
</Text>
</Box>
<Box flexShrink={0}>
<Button plain label={`${name}`} />
</Box>
<Box flexShrink={0}>
<Text wrap="truncate">
{cellText18}
</Text>
</Box>
<Box flexShrink={0}>
<Text wrap="truncate">
{cellText19}
</Text>
</Box>
</Box>
<Box flexDirection="row" alignItems="center" gap={1}>
<Box flexShrink={0} />
<Box flexShrink={0}>
<Text wrap="truncate">
{cellText20}
</Text>
</Box>
<Box flexShrink={0}>
<Button plain label={`${name}`} />
</Box>
<Box flexShrink={0}>
<Text wrap="truncate">
{cellText21}
</Text>
</Box>
<Box flexShrink={0}>
<Text wrap="truncate">
{cellText22}
</Text>
</Box>
</Box>
<Box flexDirection="row" alignItems="center" gap={1}>
<Box flexShrink={0} />
<Box flexShrink={0}>
<Text wrap="truncate">
{cellText23}
</Text>
</Box>
<Box flexShrink={0}>
<Button plain label={`${name}`} />
</Box>
<Box flexShrink={0}>
<Text wrap="truncate">
{cellText24}
</Text>
</Box>
<Box flexShrink={0}>
<Text wrap="truncate">
{cellText25}
</Text>
</Box>
</Box>
</Box>
)
})
// the band above the prompt; what else goes there is drawn under it
on('ui.render', { component: 'AbovePrompt' }, async ($, e, next) => {
const { Box, Text, Button } = $.ui.resolve(e)
const text = '…'
const text2 = '…'
const text3 = '…'
const text4 = '…'
const text5 = '…'
const text6 = '…'
return (
<Box flexDirection="column">
<Box flexDirection="row">
<Text wrap="truncate">
<Text>
{text}
</Text>
<Text>
{text2}
</Text>
<Text>
{text3}
</Text>
</Text>
<Button variant="primary" label={`${text}`} />
<Text wrap="truncate">
<Text>
{text4}
</Text>
<Text>
{text5}
</Text>
<Text>
{text6}
</Text>
</Text>
</Box>
{await next(e)}
</Box>
)
})
}
Mod 自身のコード
Mod のライセンス(MIT)に従って載せています。全文は下にあります。写すときは著作権表示を残してください。
mods/flight-deck/hooks/register.tsx 633〜658 行 · ペイン
on('ui.render', { component: 'Pane', requestId: PANE_ID }, async ($, e) => {
// Only `paneData`, the view and (on the terminal) the spinner are read here: each read
// value redraws the pane when it changes.
isPaneFocused = e.props.isFocused
const id = await $.session.id()
const data = await read($, shownData)
const isCurrent = data.sessionId === id
return (
<AgentPane
ui={$.ui.resolve(e)}
entries={isCurrent ? data.entries : {}}
view={await read($, pane)}
stats={isCurrent ? data.stats : null}
dashboard={isCurrent ? data.dashboard : null}
// Only the terminal reads the spinner: a read value redraws the pane when it changes, and
// a desktop drops a click on a button that a redraw replaced. Its cells are `Client`s.
spin={e.surface === 'terminal' ? await read($, spin) : null}
now={await $.clock.now()}
columns={e.props.bodyColumns}
onOpen={(agentId) => act($, { kind: 'open', agentId })}
onBack={() => act($, { kind: 'back' })}
onWrap={() => act($, { kind: 'wrap' })}
onTool={(toolUseId) => act($, { kind: 'tool', toolUseId })}
/>
)
})mods/flight-deck/src/pane.tsx 104〜263 行 · ペイン
export const AgentPane = ({
ui,
entries,
view,
stats,
dashboard,
spin,
now,
columns,
onOpen,
onBack,
onWrap,
onTool,
}: Props) => {
const { Box, Text, Button, Code, Markdown } = ui
const viewed = view.agentId
// State of an older shape (a hot reload) has no flag: the rows are cut then.
const isWrapped = view.isWrapped === true
const codeWrap = isWrapped ? 'wrap' : 'truncate-end'
const isClient = spin === null && 'Client' in ui
const cell = (key: string, c: Cell) =>
isClient ? (
<ui.Client
key={key}
module="./cellClient.tsx"
props={c}
width={c.width ?? cellText(c, 0, now).length}
height={1}
/>
) : (
<Box key={key} flexShrink={0} {...(c.width === undefined ? {} : { width: c.width })}>
<Text
wrap="truncate"
{...(c.color === undefined ? {} : { color: c.color })}
{...(c.dim === true ? { dimColor: true } : {})}
{...(c.bold === true ? { bold: true } : {})}
>
{cellText(c, spin ?? 0, now)}
</Text>
</Box>
)
if (viewed === null) {
const head = (key: string, text: string, width: number, align?: 'right') =>
cell(key, { text, dim: true, width, ...(align === undefined ? {} : { align }) })
const rule = (key: string) => (
<Text key={key} dimColor wrap="truncate">
{'─'.repeat(Math.max(0, columns))}
</Text>
)
// The dashboard: the session's cost, then per model an estimated cost (≈), its share of
// the total (colored by its size), the working time and the runs of its agents.
const board = () => {
if (dashboard === null) return null
const MODEL = Math.min(MAX_MODEL, Math.max(5, ...dashboard.rows.map((r) => r.model.length)))
return (
<Box key="dashboard" flexDirection="column">
{cell('cost', { text: `total ≈$${formatUsd(dashboard.costUsd)}`, bold: true })}
{dashboard.rows.length > 0 && (
<Box key="dash:head" flexDirection="row" gap={1}>
{head('dash:head:model', 'model', MODEL)}
{head('dash:head:cost', 'cost($)', USD_WIDTH, 'right')}
{head('dash:head:pct', 'cost(%)', PCT_WIDTH, 'right')}
{head('dash:head:time', 'time', TIME_WIDTH, 'right')}
{head('dash:head:runs', 'runs', RUNS_WIDTH, 'right')}
</Box>
)}
{dashboard.rows.map((r) => {
const pct = sharePct(r.costUsd, dashboard.costUsd)
return (
<Box key={`dash:${r.model}`} flexDirection="row" gap={1}>
{cell(`dash:model:${r.model}`, { text: cut(r.model, MODEL), width: MODEL })}
{cell(`dash:cost:${r.model}`, {
text: r.costUsd === null ? '—' : `≈${formatUsd(r.costUsd)}`,
width: USD_WIDTH,
align: 'right',
})}
{cell(`dash:pct:${r.model}`, {
text: pct === null ? '' : `${pct}%`,
...(pct === null ? {} : { color: shareColor(pct) }),
width: PCT_WIDTH,
align: 'right',
})}
{cell(`dash:time:${r.model}`, {
text: r.model === SIDE ? '' : formatDuration(r.workMs),
dim: true,
width: TIME_WIDTH,
align: 'right',
})}
{cell(`dash:runs:${r.model}`, {
text: r.model === SIDE ? '' : runsText(r),
dim: true,
width: RUNS_WIDTH,
align: 'right',
})}
</Box>
)
})}
{rule('dash:rule')}
</Box>
)
}
const rows = treeRows(entries)
if (rows.length === 0)
return (
<Box flexDirection="column">
{board()}
<Text dimColor>No agents yet.</Text>
</Box>
)
const t = agentTable(
rows.map((r) => r.agent),
columns,
)
return (
<Box flexDirection="column">
{board()}
<Box key="head" flexDirection="row" gap={1}>
{/* Built as a row is, a mark and a box of the name's width: a desktop sizes a box
and a cell in different units, so only the same parts line up. */}
{head('head:mark', '', MARK_WIDTH)}
<Box key="head:namebox" width={t.name} flexShrink={0}>
{head('head:name', 'agents', t.name)}
</Box>
{head('head:runs', 'runs', t.runs, 'right')}
{head('head:time', 'time', t.time, 'right')}
</Box>
{rows.map(({ agent, depth }) => {
const recent = recency(agent, now)
const tone: Tone = recent === 'old' ? { dim: true } : { color: RECENCY_TONE[recent] }
return (
// A Button takes no color: the status is the colored mark before it, and an ended
// agent's row is dim at rest. The runs and the time take the color of the recency.
<Box key={`row:${agent.id}`} flexDirection="row" alignItems="center" gap={1}>
{depth > 0 && <Box key={`indent:${agent.id}`} width={depth * 2 - 1} flexShrink={0} />}
{cell(`mark:${agent.id}`, agentMark(agent))}
<Box key={`name:${agent.id}`} width={t.name - depth * 2} flexShrink={0}>
<Button
key={`agent:${agent.id}`}
plain
{...(agent.status === 'running' ? {} : { dimColor: true })}
label={cut(name(agent), t.name - depth * 2)}
onPress={() => onOpen(agent.id)}
/>
</Box>
{cell(`runs:${agent.id}`, {
text: String(agent.runs),
...tone,
width: t.runs,
align: 'right',
})}
{cell(`time:${agent.id}`, timeCell(agent, now, 'right', tone, ''))}
</Box>
)
})}
</Box>
)
}
mods/flight-deck/hooks/register.tsx 660〜691 行 · バンド
on('ui.render', { component: 'AbovePrompt' }, async ($, e, next) => {
if (e.props.hasSurvey) return next(e)
const session = await currentMeter($)
const now = (await read($, nowAtom)) || (await $.clock.now())
const tweens = await read($, shown)
// An agent's transcript is on screen: draw that agent's numbers, which are not animated.
const isPaneOpen = (await read($, pane)).isOpen
const viewed = e.props.view.agentId
const snap = viewed === undefined ? session : agentView(session, viewed)
const reg = viewed === undefined ? null : await read($, agents)
const model = modelLabel(viewed === undefined ? undefined : reg?.entries[viewed])
const ttls = (await read($, ttlsAtom)) ?? cacheTtls({}, options.cacheTtl)
return (
<Band
ui={$.ui.resolve(e)}
snap={snap}
shown={
viewed === undefined && tweens.sessionId === session.sessionId
? shownAt(tweens, now)
: undefined
}
isAgentView={viewed !== undefined}
{...(model === undefined ? {} : { model })}
busySince={session.busySince}
now={now}
ttl={viewed === undefined ? ttls.main : ttls.agent}
columns={e.props.bodyColumns ?? 120}
isPaneOpen={isPaneOpen}
onToggle={() => togglePane($)}
/>
)
})mods/flight-deck/src/band.tsx 26〜70 行 · バンド
export const Band = ({
ui,
snap,
shown,
busySince,
now,
ttl,
columns,
isAgentView,
model,
isPaneOpen,
onToggle,
}: Props) => {
const { Box, Text, Button } = ui
const segments = bandSegments({
snap,
shown,
busySince,
now,
ttl,
columns,
isAgentView,
isPaneOpen,
...(model === undefined ? {} : { model }),
})
const run = (segs: Segment[], key: string) => (
<Text key={key} wrap="truncate">
{segs.map((s, i) => (
<Text key={String(i)} color={s.color} bold={s.bold} inverse={s.inverse}>
{s.text}
</Text>
))}
</Text>
)
const at = segments.findIndex((s) => s.isButton)
const button = segments[at]
if (button === undefined) return run(segments, 'all')
return (
<Box flexDirection="row">
{run(segments.slice(0, at), 'before')}
<Button key="agents" variant="primary" label={button.text} onPress={onToggle} />
{run(segments.slice(at + 1), 'after')}
</Box>
)
}ライセンスの全文(MIT)
MIT License Copyright (c) 2026 bez 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 に読んだコミット 8627045db44c のソースから。最初のまとまりが載せる条件で、残りは自分で判断するための材料です。後のコミットは、次に読むまで見ていません。
| 載せる条件: 確かめやすいコード | |
|---|---|
| 入口を読んだ | hooks/hooks.json が名指すモジュールをすべて読んだ。mods/flight-deck/hooks/register.tsx |
| 解析できる | すべてのファイルが TypeScript か JavaScript として解析できる。26 ファイルを解析 |
| コードが 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 のホスト)がコードに書いてあるか。通信なし |
| プログラム | 起動するプログラムの名前がコードに書いてあり、シェル・インタプリタ・通信用の道具でないか。プログラムを起動しない |
| 読んで送る | ファイルや環境変数を読み、かつ通信するか。通信しない |
| ソースの鍵 | ソースに API キーや秘密鍵らしきものがあるか。ソースに鍵なし |
| ライセンス | オープンなライセンス(MIT・Apache-2.0・BSD・ISC・Unlicense・0BSD・CC0)で全文があれば、modscode にコードを載せる。違えばリンクだけ。MIT |
コードの文面を読んだだけで、安全の審査ではありません。動かしてはおらず、起動するプログラムの中で何が起きるかも見えません。入れる前の確認はあなたの役目です。 載せる条件
入れる
入れる前に、必ず自分で確かめてください。Mod はサンドボックスなしで、あなたの権限で動きます。modscode はこのコードの安全を保証しません。下のコードを読み(またはフォルダーで claude plugin validate .)、触るものを見て、読んだコミットを入れてください。
リポジトリの .claude-plugin/marketplace.json にこの Mod が載っていないため、入れる手順は出せません。コードとして読むか、作者の README に従ってください。
Claude に聞く
modscode のコネクタを入れると、Claude がこのデザイン・コードが触るもの・コードを読んで、それをもとに作れます。たとえば:
modscode のデザイン「tunglt1810-flight-deck」をコードごと読んで、同じようなペインを作って似たデザイン
-
Open a file first: /crit-tui file <path>Reopen this one in the crit browser view.Claude に頼む…
-
Claude に頼む…Temper Run◈ TemperIntentUntitled runAcceptance criteria (what must be true) · 3 of 3 metNo criteria found in intent.md.✔ Walk through✔ Walk through✔ Walk throughand 3 more. Open the pane in a wider terminal.Phase · DiscussFix login · paused● build● build● build✓ done ● you are here ○ upcoming ↺ redo14:32Teach meTimeline, oldest firstCheckCheckCheckOpen findings · 3#a1b2c3d high: ResumeFixAccept with reasonExplain#a1b2c3d high: ResumeFixAccept with reasonExplain#a1b2c3d high: ResumeFixAccept with reasonExplainMore actions. Press the number shown.K build K PlanK build K PlanK build K Plan0 Fewer actions 0 Show or hide the other actions.8 Close the game 8 A small game for the wait.
-
Claude に頼む…Mod controlsLive Claude ModCount: 0 / Initial / oneAdd oneName InitialOne**Markdown** with a [link](https://example.com)
const count = 1;
./counter.tsxFill composerAppend noteSuggest draftCopy text -
Claude に頼む…Agents●●●✻ AgentsEditNo agents yet. They show here while they run.Agent──Fix login────────● build ········━━━━━━━━········2h 10m● build ········━━━━━━━━········2h 10m● build ········━━━━━━━━········2h 10m✗ Grepclick an agent to open it · click "done" to hide finished ones
-
Claude に頼む…Workers▾ main a1b2c3d · ok · preview Workers/WorkersDoneWorkersDoneDoneDoneDoneDoneDoneDoneDoneDonelast 3 runs · line = load · red = retry· Workers· Workers· Workers▾ Fix loginNeeds youNeeds youbuildbuildbuildbuildbuildbuildbuildbuildbuildDoneDoneDoneno dataDoneDoneDoneDoneDoneDoneDoneDoneDone▾ Fix loginNeeds youNeeds youbuildbuildbuildbuildbuildbuildbuildbuildbuildDoneDoneDoneno dataDoneDoneDoneDoneDoneDoneDoneDoneDone▾ Fix loginNeeds youNeeds youbuildbuildbuildbuildbuildbuildbuildbuildbuildDoneDoneDoneno dataDoneDoneDoneDoneDoneDoneDoneDoneDoneNeeds you⋯#3 Fix login ok ⚡ conflict#3 Fix login ok ⚡ conflict#3 Fix login ok ⚡ conflict
-
Claude に頼む…Pick a look for builddraw your own with /familiar draw. esc closes●●●●●●●●●clawd 3●●●●●●●●●clawd 3●●●●●●●●●clawd 3