orbit
A globe of everything your Claude session talks to: tool calls, sockets and bytes traced to hosts, countries and orgs, with a deny-list that blocks before a call runs.
何をするか
- 欄・トーストを描く
- /orbit を足す
- ツールの呼び出しを見張る(止めることがある)
- session.end・session.start・turn.step・ui.closeにフックする
- ターンをまたいで自分の状態を持つ
良いところ
- TypeScript で書かれている
- デスクトップ専用の分岐がある
- エラーを扱う
作り始めるためのコード
2 種類あります。上のデザインから modscode が書いた雛形と、その Mod 自身のコードのうち描いている部分です。
雛形(register.tsx)
import type { Register } from 'claude-code'
// Drawn like orbit by jamubc (pane, status, toast), as modscode read it from the mod's code:
// https://modscode.com/gallery/jamubc-orbit/
// 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: "orbit: allow this connection?" })
on('ui.render', { component: 'Pane', requestId: 'my-pane' }, async ($, e) => {
const { Box, Button, Text } = $.ui.resolve(e)
const badge = '…'
const label = '…'
const geoNote = '…'
const capabilityLine = '…'
const file = '…'
const count = '…'
const clock = '…'
const speed = '…'
const scrub = '…'
const line = '…'
const line2 = '…'
const line3 = '…'
const describeRule = '…'
const length = '…'
return (
<Box flexDirection="column">
<Box flexDirection="row" gap={1} flexWrap="wrap">
<Button plain>
session
</Button>
<Button plain>
● all sessions
</Button>
<Text dimColor>
│
</Text>
<Button plain>
◀
</Button>
<Button plain>
⌂
</Button>
<Button plain>
▶
</Button>
<Text dimColor>
│
</Text>
<Button plain>
export
</Button>
<Button plain dimColor>
clear
</Button>
<Text dimColor>
{"│ "}
watching
</Text>
</Box>
<Box flexDirection="row">
<Box flexDirection="column" paddingX={1} flexGrow={1}>
<Text bold wrap="wrap">
{badge}
</Text>
<Text>
≋ Anthropic stream breathing…
</Text>
<Box flexDirection="column">
<Text wrap="truncate">
{`━ ${label} (this one)`}
</Text>
<Text wrap="truncate">
{`━ ${label} (this one)`}
</Text>
<Text wrap="truncate">
{`━ ${label} (this one)`}
</Text>
<Text dimColor>
dashed: inbound
</Text>
</Box>
<Text color="#ffa726" wrap="wrap">
No home yet: set it in /config → Where you are, or /orbit locate (one public-IP lookup).
</Text>
<Box flexDirection="column">
<Text color="#ffa726" wrap="wrap">
{`No geo database: connections cannot be placed on the globe yet. ${geoNote}`}
</Text>
<Box flexDirection="row" gap={1}>
<Button variant="primary">
Download DB-IP city (~130 MB)
</Button>
<Button>
country only (~10 MB)
</Button>
</Box>
</Box>
<Text dimColor wrap="wrap">
{capabilityLine}
</Text>
</Box>
</Box>
<Box flexDirection="column">
<Text color="#ba68c8" wrap="truncate">
{`replay ${file} · ${count} events · ${clock}`}
</Text>
<Box flexDirection="row" gap={1}>
<Button plain>
⏮
</Button>
<Button plain>
⏸
</Button>
<Button plain>
⏭
</Button>
<Button plain>
{`${speed}×`}
</Button>
<Text color="#ba68c8">
{scrub}
</Text>
<Button plain dimColor>
close
</Button>
</Box>
</Box>
<Box flexDirection="column" paddingX={1} borderStyle="round" borderDimColor>
<Text wrap="truncate">
{line}
</Text>
<Text wrap="truncate">
{line2}
</Text>
<Text wrap="truncate">
{line3}
</Text>
<Box flexDirection="row" gap={1}>
<Button plain>
block this host
</Button>
<Button plain>
block this server
</Button>
<Button plain>
allow it
</Button>
<Button plain dimColor>
close
</Button>
</Box>
</Box>
<Box flexDirection="row" gap={1} flexWrap="wrap">
<Text dimColor>
rules:
</Text>
<Button plain dimColor>
{`${describeRule} ✕`}
</Button>
<Button plain dimColor>
{`${describeRule} ✕`}
</Button>
<Button plain dimColor>
{`${describeRule} ✕`}
</Button>
<Text dimColor>
{`+${length} more (/orbit rules)`}
</Text>
</Box>
<Box flexDirection="column">
<Text dimColor>
Nothing yet: tool calls, sockets of this session's processes and proxied connections will appear here.
</Text>
<Button plain />
<Button plain />
<Button plain />
</Box>
</Box>
)
})
on('session.start', async ($, e, next) => {
const tool = '…'
const subject = '…'
await $.ui.toast(`This terminal cannot show the globe as pixels; drawing it in colored blocks instead.`)
await $.ui.toast(`orbit: ${tool} wants ${subject}: widen the terminal to answer, or it is denied in 8 s.`)
return next(e)
})
}
Mod 自身のコード
Mod のライセンス(MIT)に従って載せています。全文は下にあります。写すときは著作権表示を残してください。
plugins/orbit/hooks/register.tsx 938〜974 行 · ペイン
on('ui.render', { component: 'Pane', requestId: PANE }, async ($, e) => {
// Drawn from what this process kept after a /clear; the host gets it back off the render.
if (!(await read($, seeded))) $.clock.after(0, () => void reseed($).catch(() => {}))
const { events: shownEvents, mode: m, scope: s, home: h, selectedId: sel, capabilities: c, replay: r, sessions: all, renderer: rend, spin: sp } = await read($, snapshot)
const listed = replay ? eventsAt(replay, replay.position) : s === 'all' ? shownEvents : shownEvents.filter(ev => ev.sessionPid === c.self || ev.sessionPid === 0)
let globe: GlobeBox | null = null
if (e.surface === 'terminal') {
const width = e.props.bodyColumns
const sideBySide = width >= 96
const columns = Math.max(16, Math.min(sideBySide ? 48 : width - 2, 64))
const rows = Math.max(8, Math.round(columns / 2))
const view: View = { requestId: PANE, columns, rows, renderer: rend }
views = [...views.filter(v => v.requestId !== PANE), view]
const scene = sceneFor(view, now(), replay ? replay.position : now(), listed as TraceEvent[])
const painted = paint(view, scene)
globe = { columns, rows, renderer: rend, cells: painted.cells ?? '', png: painted.png ?? '' }
lastFrameAt = now()
}
return drawPane($.ui.resolve(e) as Table, {
surface: e.surface,
bodyColumns: e.props.bodyColumns,
viewportRows: e.viewport?.rows ?? 40,
events: listed as TraceEvent[],
summary: summarize(listed as TraceEvent[]),
scope: s,
mode: m,
rules: currentRules,
home: h,
selectedId: sel,
capabilities: c,
replay: r,
sessions: all,
globe,
isGenerating: now() < generatingUntil,
spin: sp,
}, actionsFor($))
})plugins/orbit/hooks/pane.tsx 117〜276 行 · ペイン
export function drawPane(ui: Table, m: PaneModel, a: Actions) {
const { Box, Text, Button } = ui
const width = Math.max(30, m.bodyColumns)
const isAll = m.scope === 'all'
const sessionPids = [...new Set(m.events.map(ev => ev.sessionPid))].sort((x, y) => x - y)
const selected = m.events.find(ev => ev.id === m.selectedId)
const header = (
<Box flexDirection="row" gap={1} flexWrap="wrap">
<Button key="scope-session" plain dimColor={isAll} onPress={() => a.setScope('session')}>{isAll ? 'session' : '● session'}</Button>
<Button key="scope-all" plain dimColor={!isAll} onPress={() => a.setScope('all')}>{isAll ? '● all sessions' : 'all sessions'}</Button>
<Text dimColor>│</Text>
<Button key="spin-left" plain onPress={() => a.spin(-20)}>◀</Button>
<Button key="spin-home" plain dimColor={m.spin === null} onPress={() => a.spin(null)}>⌂</Button>
<Button key="spin-right" plain onPress={() => a.spin(20)}>▶</Button>
<Text dimColor>│</Text>
<Button key="export" plain onPress={a.exportTrace}>export</Button>
<Button key="clear" plain dimColor onPress={a.clear}>clear</Button>
<Text dimColor>│ {m.mode === 'off' ? 'watching' : `enforcing: ${m.mode}`}</Text>
</Box>
)
const legend = isAll ? (
<Box flexDirection="column">
{sessionPids.map(pid => {
const s = m.sessions.find(x => x.pid === pid)
const label = m.events.find(ev => ev.sessionPid === pid)?.session || (s ? `${folder(s.cwd)} ${s.tty}` : `pid ${pid}`)
return <Text color={hex(sessionColor(pid, sessionPids))} wrap="truncate">{`━ ${label}${pid === m.capabilities.self ? ' (this one)' : ''}`}</Text>
})}
<Text dimColor>dashed: inbound</Text>
</Box>
) : (
<Box flexDirection="row" gap={2}>
<Text color={hex(OUTBOUND)}>━ out</Text>
<Text color={hex(INBOUND)}>━ in</Text>
<Text color={hex(BLOCKED)}>╌ blocked</Text>
<Text color={hex(HOME)}>● you</Text>
</Box>
)
const homeLine =
m.home.source === 'none' ? (
<Text color="#ffa726" wrap="wrap">No home yet: set it in /config → Where you are, or /orbit locate (one public-IP lookup).</Text>
) : (
<Text dimColor wrap="truncate">{`you: ${m.home.label || `${m.home.lat.toFixed(2)}, ${m.home.lon.toFixed(2)}`}${m.home.source === 'lookup' ? ' (from your public IP)' : ''}`}</Text>
)
const geoLine =
m.capabilities.geo === 'ready' ? null : m.capabilities.geo === 'downloading' ? (
<Text color="#4dd0e1" wrap="wrap">{`Downloading the geo database… ${m.capabilities.geoNote}`}</Text>
) : m.capabilities.geo === 'no-node' ? (
<Text color="#ffa726" wrap="wrap">Places need Node.js for the geo helper: install node, or set its path in /config.</Text>
) : (
<Box flexDirection="column">
<Text color="#ffa726" wrap="wrap">{`No geo database: connections cannot be placed on the globe yet.${m.capabilities.geoNote ? ' ' + m.capabilities.geoNote : ''}`}</Text>
<Box flexDirection="row" gap={1}>
<Button key="geo-city" variant="primary" onPress={() => a.downloadGeo('city')}>Download DB-IP city (~130 MB)</Button>
<Button key="geo-country" onPress={() => a.downloadGeo('country')}>country only (~10 MB)</Button>
</Box>
</Box>
)
const replay = m.replay ? (
<Box flexDirection="column">
<Text color="#ba68c8" wrap="truncate">{`replay ${m.replay.file.slice(m.replay.file.lastIndexOf('/') + 1)} · ${m.replay.count} events · ${clock(m.replay.position)}`}</Text>
<Box flexDirection="row" gap={1}>
<Button key="rp-back" plain onPress={() => a.replaySeek(-1)}>⏮</Button>
<Button key="rp-toggle" plain onPress={a.replayToggle}>{m.replay.isPlaying ? '⏸' : '▶'}</Button>
<Button key="rp-fwd" plain onPress={() => a.replaySeek(1)}>⏭</Button>
<Button key="rp-speed" plain onPress={a.replaySpeed}>{`${m.replay.speed}×`}</Button>
<Text color="#ba68c8">{scrub(m.replay, Math.max(8, Math.min(width - 24, 60)))}</Text>
<Button key="rp-close" plain dimColor onPress={a.replayClose}>close</Button>
</Box>
</Box>
) : null
const side = (
<Box flexDirection="column" paddingX={1} flexGrow={1}>
<Text bold wrap="wrap">{badge(m)}</Text>
{m.isGenerating && <Text color={hex(OUTBOUND)}>≋ Anthropic stream breathing…</Text>}
{legend}
{homeLine}
{geoLine}
<Text dimColor wrap="wrap">{capabilityLine(m.capabilities)}</Text>
</Box>
)
let globe: any = null
if (m.surface === 'terminal' && m.globe) {
const { Raster, Image } = ui
globe =
m.globe.renderer === 'image' ? (
<Image key="globe" source={{ png: m.globe.png }} columns={m.globe.columns} rows={m.globe.rows} alt="the globe" />
) : (
<Raster key="globe" columns={m.globe.columns} rows={m.globe.rows} cells={m.globe.cells} />
)
} else if (m.surface !== 'terminal') {
globe = <Text dimColor wrap="wrap">The globe draws in the terminal; here is the trace.</Text>
}
const sideBySide = m.globe !== null && width >= m.globe.columns + 44
const globeRows = m.globe ? m.globe.rows : 1
const used = 2 + (sideBySide ? Math.max(globeRows, 8) : globeRows + 8) + (m.replay ? 2 : 0) + (selected ? 5 : 0) + 2
const room = Math.max(3, m.viewportRows - used)
const listed = [...m.events].sort((x, y) => y.t - x.t).slice(0, room)
const log = (
<Box flexDirection="column">
{listed.length === 0 && <Text dimColor>Nothing yet: tool calls, sockets of this session's processes and proxied connections will appear here.</Text>}
{listed.map(ev => (
<Button key={`ev:${ev.id}`} plain dimColor={ev.id !== m.selectedId && ev.status !== 'open'} onPress={() => a.select(ev.id)}>
{eventLine(ev, width - 1, isAll)}
</Button>
))}
</Box>
)
const detail = selected ? (
<Box flexDirection="column" paddingX={1} borderStyle="round" borderDimColor>
{detailLines(selected).map(line => (
<Text wrap="truncate">{line}</Text>
))}
<Box flexDirection="row" gap={1}>
{(selected.host || selected.ip) && selected.status !== 'blocked' && (
<Button key="detail-block" plain onPress={() => a.block(selected.host && !selected.host.startsWith('mcp:') ? selected.host : selected.ip)}>block this host</Button>
)}
{selected.host.startsWith('mcp:') && <Button key="detail-block-mcp" plain onPress={() => a.block(selected.host)}>block this server</Button>}
{selected.status === 'blocked' && <Button key="detail-allow" plain onPress={() => a.allow(selected.note.replace(/^.*?(host|mcp|tool):/, '$1:'))}>allow it</Button>}
<Button key="detail-close" plain dimColor onPress={() => a.select('')}>close</Button>
</Box>
</Box>
) : null
const rules =
m.rules.length > 0 ? (
<Box flexDirection="row" gap={1} flexWrap="wrap">
<Text dimColor>rules:</Text>
{m.rules.slice(0, 8).map(r => (
<Button key={`rule:${r.kind}:${r.pattern}`} plain dimColor onPress={() => a.unrule(r)}>{`${describeRule(r)} ✕`}</Button>
))}
{m.rules.length > 8 && <Text dimColor>{`+${m.rules.length - 8} more (/orbit rules)`}</Text>}
</Box>
) : null
return (
<Box flexDirection="column">
{header}
{sideBySide ? (
<Box flexDirection="row">
{globe}
{side}
</Box>
) : (
<Box flexDirection="column">
{globe}
{side}
</Box>
)}
{replay}
{detail}ライセンスの全文(MIT)
MIT License Copyright (c) 2026 jamubc 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.
コードが呼ぶもの
通信プログラム起動ファイル書き込み環境変数ツール呼び出し保存
コードから読み取ったデザイン
読み取ったコミットのソースから描いたもので、動かした結果ではありません。一覧は 3 回描き、条件はデスクトップアプリで描く最初の分岐を取り、動かしたときにだけ決まる値は仮の例(点線の下線)にするか省きます。色と書体はこのサイトのものです。
コードから読めること
2026-10-06 に読んだコミット 3027e57e6edc のソースから。最初のまとまりが載せる条件で、残りは自分で判断するための材料です。後のコミットは、次に読むまで見ていません。
| 載せる条件: 確かめやすいコード | |
|---|---|
| 入口を読んだ | hooks/hooks.json が名指すモジュールをすべて読んだ。plugins/orbit/hooks/register.tsx |
| 解析できる | すべてのファイルが TypeScript か JavaScript として解析できる。12 ファイルを解析 |
| コードが 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 のホスト)がコードに書いてあるか。https://api.ipify.org, https://ipinfo.io |
| プログラム | 起動するプログラムの名前がコードに書いてあり、シェル・インタプリタ・通信用の道具でないか。plugins/orbit/hooks/register.tsx:192 実行時に決まるプログラム; plugins/orbit/hooks/register.tsx:524 実行時に決まるプログラム; plugins/orbit/hooks/register.tsx:572 実行時に決まるプログラム |
| 読んで送る | ファイルや環境変数を読み、かつ通信するか。reads environment variables and files and reaches the network |
| ソースの鍵 | ソースに API キーや秘密鍵らしきものがあるか。ソースに鍵なし |
| ライセンス | オープンなライセンス(MIT・Apache-2.0・BSD・ISC・Unlicense・0BSD・CC0)で全文があれば、modscode にコードを載せる。違えばリンクだけ。MIT |
コードの文面を読んだだけで、安全の審査ではありません。動かしてはおらず、起動するプログラムの中で何が起きるかも見えません。入れる前の確認はあなたの役目です。 載せる条件
入れる
入れる前に、必ず自分で確かめてください。Mod はサンドボックスなしで、あなたの権限で動きます。modscode はこのコードの安全を保証しません。下のコードを読み(またはフォルダーで claude plugin validate .)、触るものを見て、読んだコミットを入れてください。
リポジトリがそのままマーケットプレイスです。このマーケットプレイスを足し(ターミナルでは次のコマンド、デスクトップアプリではプラグインの設定)、そこから Mod を入れます。
/plugin marketplace add jamubc/toolbox/plugin install orbit@toolbox入るのはマーケットプレイスの最新のコミットで、ここで読んだもの(3027e57e6edc)と違うことがあります。入れる前に見比べてください。
Claude に聞く
modscode のコネクタを入れると、Claude がこのデザイン・コードが触るもの・コードを読んで、それをもとに作れます。たとえば:
modscode のデザイン「jamubc-orbit」をコードごと読んで、同じようなペインを作って似たデザイン
-
Claude に頼む…2h 10m · █████░░░✓ build ✓ build ✓ buildJavaKotlin3 Python■ ok 3 ■ ok 3 ■ ok 3 Razor proven 3 Razor proven 3 Razor proven 3Phases ──────── 3/3build Pythonbuild Pythonbuild Python… 3 more phasesLua ──────── 3/Kotlin■ the whole upgrade Ruby■ build build Ruby■ build build Ruby■ build build Ruby … 3 moreNext ──────── PythonRuby (by hand)Podsclick a button, or ctrl+x tab then Tab, EnterAttention ──────── 3! Scala ! Scala ! Scala … 3 moreSession ──────── okJava
-
Open a file first: /crit-tui file <path>Reopen this one in the crit browser view.Claude に頼む…
-
Claude に頼む…TodayOct 63 left · Mar overdueRemCTL: Sep✓ All done for today.● build3● Fix login ● ⚑Jul · build✓● Fix login ● ⚑Jul · build✓● Fix login ● ⚑Jul · build✓● build3● Fix login ● ⚑Jul · build✓● Fix login ● ⚑Jul · build✓● Fix login ● ⚑Jul · build✓● build3● Fix login ● ⚑Jul · build✓● Fix login ● ⚑Jul · build✓● Fix login ● ⚑Jul · build✓Updated 14:32UndoRefresh
-
Claude に頼む…TO graph› Fix login › Fix login › Fix loginScopeThis featureWhole projectHide done stepsReconnect
-
Claude に頼む…Replay TheaterStep Prev1/3 write Next[31][31][31]Prev pNext nClose q────────● Prev● Prev● Prev
-
Claude に頼む…great_cto: 3 gate waiting — /gatesGatesmy-app · 3 waiting · checked Gates UTCGates — Fix logina1b2c3dExpensive to undo. To approve, type Gates and press Enter.approve: Gates approveGates — Fix logina1b2c3dExpensive to undo. To approve, type Gates and press Enter.approve: Gates approveGates — Fix logina1b2c3dExpensive to undo. To approve, type Gates and press Enter.approve: Gates approve