modscode EN

modscode / 図鑑 / a2a-mod

a2a-mod

A2A protocol client for Claude Code: Claude hands tasks to non-Claude worker agents over Agent2Agent and picks up their results.

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

何をするか

  • プロンプトの上の帯・欄・トーストを描く
  • /a2a を足す
  • mcp__a2a-mod__workers・mcp__a2a-mod__add_worker・mcp__a2a-mod__remove_worker・mcp__a2a-mod__send の呼び出しを見張る(止めることがある)
  • prompt.submit・session.start・ui.messageにフックする
  • ターンをまたいで自分の状態を持つ

良いところ

  • TypeScript で書かれている
  • エラーを扱う
  • ファイルを書かない

作り始めるためのコード

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

雛形(register.tsx)

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

// Drawn like a2a-mod by Aliasgar Khimani (pane, band, status, toast), as modscode read it from the mod's code:
// https://modscode.com/gallery/novusedge-a2a-mod/
// 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, Text } = $.ui.resolve(e)
    const text = '…'
    const text2 = '…'
    const text3 = '…'
    const text4 = '…'
    const text5 = '…'
    const text6 = '…'
    const text7 = '…'
    const text8 = '…'
    const text9 = '…'
    const worker = '…'
    const what = '…'
    return (
      <Box flexDirection="column">
        <Box flexDirection="column">
          <Box>
            <Text>
              {text}
            </Text>
            <Text>
              {text2}
            </Text>
            <Text>
              {text3}
            </Text>
          </Box>
          <Box>
            <Text>
              {text4}
            </Text>
            <Text>
              {text5}
            </Text>
            <Text>
              {text6}
            </Text>
          </Box>
          <Box>
            <Text>
              {text7}
            </Text>
            <Text>
              {text8}
            </Text>
            <Text>
              {text9}
            </Text>
          </Box>
        </Box>
        <Box flexWrap="wrap" columnGap={3}>
          <Box>
            <Text>
              ●
            </Text>
            <Text>
              {` ${worker} · ${what}`}
            </Text>
          </Box>
          <Box>
            <Text>
              ●
            </Text>
            <Text>
              {` ${worker} · ${what}`}
            </Text>
          </Box>
          <Box>
            <Text>
              ●
            </Text>
            <Text>
              {` ${worker} · ${what}`}
            </Text>
          </Box>
        </Box>
        {await next(e)}
      </Box>
    )
  })

  // the pane: open it with $.ui.open({ id: 'my-pane', title: "a2a-mod" })
  on('ui.render', { component: 'Pane', requestId: 'my-pane' }, async ($, e) => {
    const { Box, Text, Button, Markdown } = $.ui.resolve(e)
    const name = '…'
    const text = '…'
    const text2 = '…'
    const text3 = '…'
    const text4 = '…'
    const text5 = '…'
    const text6 = '…'
    const text7 = '…'
    const text8 = '…'
    const text9 = '…'
    const label = '…'
    const pad = '…'
    const tail = '…'
    const text10 = '…'
    const text11 = '…'
    const text12 = '…'
    const text13 = '…'
    const text14 = '…'
    const text15 = '…'
    const text16 = '…'
    const text17 = '…'
    const text18 = '…'
    const body = '…'
    const full = '…'
    const text19 = '…'
    const text20 = '…'
    const text21 = '…'
    const text22 = '…'
    const text23 = '…'
    const text24 = '…'
    const text25 = '…'
    const text26 = '…'
    const text27 = '…'
    const text28 = '…'
    const text29 = '…'
    const text30 = '…'
    const text31 = '…'
    const text32 = '…'
    const text33 = '…'
    const text34 = '…'
    const text35 = '…'
    const text36 = '…'
    const text37 = '…'
    const text38 = '…'
    const text39 = '…'
    const text40 = '…'
    const text41 = '…'
    const text42 = '…'
    const text43 = '…'
    const text44 = '…'
    const text45 = '…'
    const text46 = '…'
    const text47 = '…'
    const text48 = '…'
    const text49 = '…'
    const text50 = '…'
    const text51 = '…'
    const text52 = '…'
    const text53 = '…'
    const text54 = '…'
    const text55 = '…'
    const text56 = '…'
    const text57 = '…'
    const text58 = '…'
    const text59 = '…'
    const text60 = '…'
    const text61 = '…'
    const text62 = '…'
    const text63 = '…'
    const text64 = '…'
    const text65 = '…'
    const text66 = '…'
    const text67 = '…'
    const text68 = '…'
    const text69 = '…'
    const text70 = '…'
    const text71 = '…'
    const text72 = '…'
    const text73 = '…'
    const text74 = '…'
    const text75 = '…'
    const text76 = '…'
    const text77 = '…'
    const text78 = '…'
    const text79 = '…'
    const text80 = '…'
    const text81 = '…'
    const text82 = '…'
    const text83 = '…'
    const text84 = '…'
    const text85 = '…'
    const text86 = '…'
    const text87 = '…'
    const text88 = '…'
    const text89 = '…'
    const text90 = '…'
    return (
      <Box flexDirection="column">
        <Text color="inactive">
          ────────
        </Text>
        <Box>
          <Text>
            {"        "}
          </Text>
          <Button plain dimColor label="Clear done" />
        </Box>
        <Box flexDirection="column">
          <Text bold>
            Claude
          </Text>
          <Box>
            <Text color="inactive">
              {"└─ "}
            </Text>
            <Button plain label={`${name}`} />
            <Text>
              {text}
            </Text>
            <Text>
              {text2}
            </Text>
            <Text>
              {text3}
            </Text>
          </Box>
          <Box>
            <Text color="inactive">
              {"└─ "}
            </Text>
            <Button plain label={`${name}`} />
            <Text>
              {text4}
            </Text>
            <Text>
              {text5}
            </Text>
            <Text>
              {text6}
            </Text>
          </Box>
          <Box>
            <Text color="inactive">
              {"└─ "}
            </Text>
            <Button plain label={`${name}`} />
            <Text>
              {text7}
            </Text>
            <Text>
              {text8}
            </Text>
            <Text>
              {text9}
            </Text>
          </Box>
        </Box>
        <Box flexDirection="column" rowGap={1} marginTop={1}>
          <Box flexDirection="column" borderStyle="round" borderColor="inactive" paddingX={1}>
            <Box flexDirection="column">
              <Box flexDirection="column">
                <Box>
                  <Text>
                    {"● "}
                  </Text>
                  <Button plain label={`${label}`} />
                  <Text>
                    {`${pad}${tail}`}
                  </Text>
                </Box>
                <Box flexDirection="column">
                  <Box>
                    <Text>
                      {text10}
                    </Text>
                    <Text>
                      {text11}
                    </Text>
                    <Text>
                      {text12}
                    </Text>
                  </Box>
                  <Box>
                    <Text>
                      {text13}
                    </Text>
                    <Text>
                      {text14}
                    </Text>
                    <Text>
                      {text15}
                    </Text>
                  </Box>
                  <Box>
                    <Text>
                      {text16}
                    </Text>
                    <Text>
                      {text17}
                    </Text>
                    <Text>
                      {text18}
                    </Text>
                  </Box>
                </Box>
                <Box flexDirection="column" marginLeft={2}>
                  <Text color="inactive">
                    answered by you
                  </Text>
                  <Markdown text={`${body}`} />
                  <Box>
                    <Text>
                      {" "}
                    </Text>
                    <Button label={`${full}`} />
                    <Text>
                      {" "}
                    </Text>
                    <Button label={`${full}`} />
                    <Text>
                      {" "}
                    </Text>
                    <Button label={`${full}`} />
                  </Box>
                </Box>
              </Box>
              <Box flexDirection="column">
                <Box>
                  <Text>
                    {"● "}
                  </Text>
                  <Button plain label={`${label}`} />
                  <Text>
                    {`${pad}${tail}`}
                  </Text>
                </Box>
                <Box flexDirection="column">
                  <Box>
                    <Text>
                      {text19}
                    </Text>
                    <Text>
                      {text20}
                    </Text>
                    <Text>
                      {text21}
                    </Text>
                  </Box>
                  <Box>
                    <Text>
                      {text22}
                    </Text>
                    <Text>
                      {text23}
                    </Text>
                    <Text>
                      {text24}
                    </Text>
                  </Box>
                  <Box>
                    <Text>
                      {text25}
                    </Text>
                    <Text>
                      {text26}
                    </Text>
                    <Text>
                      {text27}
                    </Text>
                  </Box>
                </Box>
                <Box flexDirection="column" marginLeft={2}>
                  <Text color="inactive">
                    answered by you
                  </Text>
                  <Markdown text={`${body}`} />
                  <Box>
                    <Text>
                      {" "}
                    </Text>
                    <Button label={`${full}`} />
                    <Text>
                      {" "}
                    </Text>
                    <Button label={`${full}`} />
                    <Text>
                      {" "}
                    </Text>
                    <Button label={`${full}`} />
                  </Box>
                </Box>
              </Box>
              <Box flexDirection="column">
                <Box>
                  <Text>
                    {"● "}
                  </Text>
                  <Button plain label={`${label}`} />
                  <Text>
                    {`${pad}${tail}`}
                  </Text>
                </Box>
                <Box flexDirection="column">
                  <Box>
                    <Text>
                      {text28}
                    </Text>
                    <Text>
                      {text29}
                    </Text>
                    <Text>
                      {text30}
                    </Text>
                  </Box>
                  <Box>
                    <Text>
                      {text31}
                    </Text>
                    <Text>
                      {text32}
                    </Text>
                    <Text>
                      {text33}
                    </Text>
                  </Box>
                  <Box>
                    <Text>
                      {text34}
                    </Text>
                    <Text>
                      {text35}
                    </Text>
                    <Text>
                      {text36}
                    </Text>
                  </Box>
                </Box>
                <Box flexDirection="column" marginLeft={2}>
                  <Text color="inactive">
                    answered by you
                  </Text>
                  <Markdown text={`${body}`} />
                  <Box>
                    <Text>
                      {" "}
                    </Text>
                    <Button label={`${full}`} />
                    <Text>
                      {" "}
                    </Text>
                    <Button label={`${full}`} />
                    <Text>
                      {" "}
                    </Text>
                    <Button label={`${full}`} />
                  </Box>
                </Box>
              </Box>
              <Box marginLeft={2}>
                <Button plain dimColor label="show less" />
              </Box>
            </Box>
          </Box>
          <Box flexDirection="column" borderStyle="round" borderColor="inactive" paddingX={1}>
            <Box flexDirection="column">
              <Box flexDirection="column">
                <Box>
                  <Text>
                    {"● "}
                  </Text>
                  <Button plain label={`${label}`} />
                  <Text>
                    {`${pad}${tail}`}
                  </Text>
                </Box>
                <Box flexDirection="column">
                  <Box>
                    <Text>
                      {text37}
                    </Text>
                    <Text>
                      {text38}
                    </Text>
                    <Text>
                      {text39}
                    </Text>
                  </Box>
                  <Box>
                    <Text>
                      {text40}
                    </Text>
                    <Text>
                      {text41}
                    </Text>
                    <Text>
                      {text42}
                    </Text>
                  </Box>
                  <Box>
                    <Text>
                      {text43}
                    </Text>
                    <Text>
                      {text44}
                    </Text>
                    <Text>
                      {text45}
                    </Text>
                  </Box>
                </Box>
                <Box flexDirection="column" marginLeft={2}>
                  <Text color="inactive">
                    answered by you
                  </Text>
                  <Markdown text={`${body}`} />
                  <Box>
                    <Text>
                      {" "}
                    </Text>
                    <Button label={`${full}`} />
                    <Text>
                      {" "}
                    </Text>
                    <Button label={`${full}`} />
                    <Text>
                      {" "}
                    </Text>
                    <Button label={`${full}`} />
                  </Box>
                </Box>
              </Box>
              <Box flexDirection="column">
                <Box>
                  <Text>
                    {"● "}
                  </Text>
                  <Button plain label={`${label}`} />
                  <Text>
                    {`${pad}${tail}`}
                  </Text>
                </Box>
                <Box flexDirection="column">
                  <Box>
                    <Text>
                      {text46}
                    </Text>
                    <Text>
                      {text47}
                    </Text>
                    <Text>
                      {text48}
                    </Text>
                  </Box>
                  <Box>
                    <Text>
                      {text49}
                    </Text>
                    <Text>
                      {text50}
                    </Text>
                    <Text>
                      {text51}
                    </Text>
                  </Box>
                  <Box>
                    <Text>
                      {text52}
                    </Text>
                    <Text>
                      {text53}
                    </Text>
                    <Text>
                      {text54}
                    </Text>
                  </Box>
                </Box>
                <Box flexDirection="column" marginLeft={2}>
                  <Text color="inactive">
                    answered by you
                  </Text>
                  <Markdown text={`${body}`} />
                  <Box>
                    <Text>
                      {" "}
                    </Text>
                    <Button label={`${full}`} />
                    <Text>
                      {" "}
                    </Text>
                    <Button label={`${full}`} />
                    <Text>
                      {" "}
                    </Text>
                    <Button label={`${full}`} />
                  </Box>
                </Box>
              </Box>
              <Box flexDirection="column">
                <Box>
                  <Text>
                    {"● "}
                  </Text>
                  <Button plain label={`${label}`} />
                  <Text>
                    {`${pad}${tail}`}
                  </Text>
                </Box>
                <Box flexDirection="column">
                  <Box>
                    <Text>
                      {text55}
                    </Text>
                    <Text>
                      {text56}
                    </Text>
                    <Text>
                      {text57}
                    </Text>
                  </Box>
                  <Box>
                    <Text>
                      {text58}
                    </Text>
                    <Text>
                      {text59}
                    </Text>
                    <Text>
                      {text60}
                    </Text>
                  </Box>
                  <Box>
                    <Text>
                      {text61}
                    </Text>
                    <Text>
                      {text62}
                    </Text>
                    <Text>
                      {text63}
                    </Text>
                  </Box>
                </Box>
                <Box flexDirection="column" marginLeft={2}>
                  <Text color="inactive">
                    answered by you
                  </Text>
                  <Markdown text={`${body}`} />
                  <Box>
                    <Text>
                      {" "}
                    </Text>
                    <Button label={`${full}`} />
                    <Text>
                      {" "}
                    </Text>
                    <Button label={`${full}`} />
                    <Text>
                      {" "}
                    </Text>
                    <Button label={`${full}`} />
                  </Box>
                </Box>
              </Box>
              <Box marginLeft={2}>
                <Button plain dimColor label="show less" />
              </Box>
            </Box>
          </Box>
          <Box flexDirection="column" borderStyle="round" borderColor="inactive" paddingX={1}>
            <Box flexDirection="column">
              <Box flexDirection="column">
                <Box>
                  <Text>
                    {"● "}
                  </Text>
                  <Button plain label={`${label}`} />
                  <Text>
                    {`${pad}${tail}`}
                  </Text>
                </Box>
                <Box flexDirection="column">
                  <Box>
                    <Text>
                      {text64}
                    </Text>
                    <Text>
                      {text65}
                    </Text>
                    <Text>
                      {text66}
                    </Text>
                  </Box>
                  <Box>
                    <Text>
                      {text67}
                    </Text>
                    <Text>
                      {text68}
                    </Text>
                    <Text>
                      {text69}
                    </Text>
                  </Box>
                  <Box>
                    <Text>
                      {text70}
                    </Text>
                    <Text>
                      {text71}
                    </Text>
                    <Text>
                      {text72}
                    </Text>
                  </Box>
                </Box>
                <Box flexDirection="column" marginLeft={2}>
                  <Text color="inactive">
                    answered by you
                  </Text>
                  <Markdown text={`${body}`} />
                  <Box>
                    <Text>
                      {" "}
                    </Text>
                    <Button label={`${full}`} />
                    <Text>
                      {" "}
                    </Text>
                    <Button label={`${full}`} />
                    <Text>
                      {" "}
                    </Text>
                    <Button label={`${full}`} />
                  </Box>
                </Box>
              </Box>
              <Box flexDirection="column">
                <Box>
                  <Text>
                    {"● "}
                  </Text>
                  <Button plain label={`${label}`} />
                  <Text>
                    {`${pad}${tail}`}
                  </Text>
                </Box>
                <Box flexDirection="column">
                  <Box>
                    <Text>
                      {text73}
                    </Text>
                    <Text>
                      {text74}
                    </Text>
                    <Text>
                      {text75}
                    </Text>
                  </Box>
                  <Box>
                    <Text>
                      {text76}
                    </Text>
                    <Text>
                      {text77}
                    </Text>
                    <Text>
                      {text78}
                    </Text>
                  </Box>
                  <Box>
                    <Text>
                      {text79}
                    </Text>
                    <Text>
                      {text80}
                    </Text>
                    <Text>
                      {text81}
                    </Text>
                  </Box>
                </Box>
                <Box flexDirection="column" marginLeft={2}>
                  <Text color="inactive">
                    answered by you
                  </Text>
                  <Markdown text={`${body}`} />
                  <Box>
                    <Text>
                      {" "}
                    </Text>
                    <Button label={`${full}`} />
                    <Text>
                      {" "}
                    </Text>
                    <Button label={`${full}`} />
                    <Text>
                      {" "}
                    </Text>
                    <Button label={`${full}`} />
                  </Box>
                </Box>
              </Box>
              <Box flexDirection="column">
                <Box>
                  <Text>
                    {"● "}
                  </Text>
                  <Button plain label={`${label}`} />
                  <Text>
                    {`${pad}${tail}`}
                  </Text>
                </Box>
                <Box flexDirection="column">
                  <Box>
                    <Text>
                      {text82}
                    </Text>
                    <Text>
                      {text83}
                    </Text>
                    <Text>
                      {text84}
                    </Text>
                  </Box>
                  <Box>
                    <Text>
                      {text85}
                    </Text>
                    <Text>
                      {text86}
                    </Text>
                    <Text>
                      {text87}
                    </Text>
                  </Box>
                  <Box>
                    <Text>
                      {text88}
                    </Text>
                    <Text>
                      {text89}
                    </Text>
                    <Text>
                      {text90}
                    </Text>
                  </Box>
                </Box>
                <Box flexDirection="column" marginLeft={2}>
                  <Text color="inactive">
                    answered by you
                  </Text>
                  <Markdown text={`${body}`} />
                  <Box>
                    <Text>
                      {" "}
                    </Text>
                    <Button label={`${full}`} />
                    <Text>
                      {" "}
                    </Text>
                    <Button label={`${full}`} />
                    <Text>
                      {" "}
                    </Text>
                    <Button label={`${full}`} />
                  </Box>
                </Box>
              </Box>
              <Box marginLeft={2}>
                <Button plain dimColor label="show less" />
              </Box>
            </Box>
          </Box>
        </Box>
        <Box flexGrow={1} />
        <Text color="inactive">
          ────────
        </Text>
        <Text color="inactive">
          {"/a2a add <url>"}
        </Text>
        <Text color="inactive">
          tab move · enter press · esc back
        </Text>
      </Box>
    )
  })

  on('session.start', async ($, e, next) => {
    const worker = '…'
    const message = '…'
    await $.ui.toast(`a2a: ${worker} was removed.`)
    await $.ui.toast(`a2a: ${message}`)
    return next(e)
  })
}

Mod 自身のコード

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

hooks/register.ts 295〜306 行 · バンド
  on('ui.render', { component: 'AbovePrompt' }, async ($, e, next) => {
    if (ui.layout !== 'full' || e.props.hasSurvey) return next(e)
    const now = await nowOf($)
    const rows = bandRows(await readRecent(hostOf($, settingTokens, ui)), now)
    if (!rows.length) return next(e)
    // The return packet rests with no state change to redraw the band, so a timer does it.
    bandExpiry?.cancel()
    const due = nextRedraw(rows, now, true)
    bandExpiry = due === undefined ? undefined : $.clock.after(due, () => $.ui.invalidate('ui.render'))
    const [pal, theirs] = await Promise.all([paletteOf($), next(e)])
    return bandTree($.ui.resolve(e), { surface: e.surface, width: e.props.bodyColumns, now, anim: ui.animations, pal, rows }, theirs)
  })
hooks/ui/band.tsx 53〜63 行 · バンド
export function bandTree(el: BandEls, d: BandData, theirs: RenderElement | undefined): RenderElement {
  const { Box, Client } = el
  const wire = wireProps(d)
  return (
    <Box flexDirection="column">
      {Client && hasClient(d.surface) ? <Client key="wire" module="./wire.tsx" props={wire} /> : lines(el, [wireCells(wire, 0, 0)])}
      <Box flexWrap="wrap" columnGap={3}>{d.rows.filter(isOpen).map(t => chip(el, t))}</Box>
      {theirs ?? null}
    </Box>
  )
}
hooks/ui/draw.tsx 17〜20 行 · バンド
export function lines(el: Els, rows: readonly (readonly Cell[])[]): RenderElement {
  const { Box } = el
  return <Box flexDirection="column">{rows.map(r => <Box>{cellsOf(el, r)}</Box>)}</Box>
}
hooks/ui/draw.tsx 12〜15 行 · バンド
export function cellsOf(el: Els, cells: readonly Cell[]): RenderElement[] {
  const { Text } = el
  return runs(cells).map(c => <Text {...(c.color ? { color: c.color } : {})} {...(c.bold ? { bold: true } : {})}>{c.text}</Text>)
}
hooks/ui/band.tsx 45〜50 行 · バンド
function chip(el: BandEls, t: RecentTask): RenderElement {
  const { Box, Text } = el
  const look = STATES[t.state]
  const what = isWaiting(t.state) ? 'waiting on Claude' : fit(t.text, 24)
  return <Box><Text color={look.color}>{isRunning(t.state) ? '●' : look.glyph}</Text><Text>{` ${t.worker} · ${what}`}</Text></Box>
}
hooks/register.ts 314〜358 行 · ペイン
  on('ui.render', { component: 'Pane', requestId: 'a2a-workers' }, async ($, e) => {
    const host = hostOf($, settingTokens, ui)
    const now = await nowOf($)
    const [workers, list, stored, durations, pal] = await Promise.all([loadWorkers(host), readRecent(host), read($, paneView), host.readDurations(), paletteOf($)])
    // State saved by an earlier version lacks the newer fields.
    const view: PaneView = { ...EMPTY_VIEW, ...stored }
    const act: PaneActions = {
      cancel: t => cancelFromPane($, host, t),
      // One row open at a time keeps the pane under the engine's 100,000-character tree limit.
      toggleOpen: t => update($, paneView, v => ({ ...v, open: v.open.includes(t.taskId) ? [] : [t.taskId] })),
      toggleBox: alias => update($, paneView, v => ({ ...v, collapsed: toggled(v.collapsed, alias) })),
      toggleAll: alias => update($, paneView, v => ({ ...v, all: toggled(v.all, alias) })),
      // Hides what ended by now from the pane only; the recent list keeps it for the cards.
      clearDone: async () => { const at = await nowOf($); await update($, paneView, v => ({ ...v, clearedAt: at })) },
      copy: async (t, press) => {
        const copied = await $.ui.copy({ text: t.result ?? '', surface: press.surface })
        if (!copied.isCopied) $.ui.toast(`a2a: nothing was copied: ${NOT_COPIED[copied.reason]}.`)
      },
      startReply: async t => {
        await update($, paneView, v => ({ ...v, replying: [...without(v.replying, t.taskId), t.taskId] }))
        // autoFocus applies only when the pane takes the keyboard, and a press does not hand it over.
        // The field shows either way: claude plugin test 2.1.288 rejects every $.ui.focus.
        try { await $.ui.focus({ requestId: PANE.id, key: `input:${t.taskId}` }) } catch {}
      },
      draft: (t, text) => { drafts.set(t.taskId, text) },
      send: async (t, text) => {
        if (!text.trim() || !(await replyFromPane($, host, t, text))) return
        drafts.delete(t.taskId)
        await update($, paneView, v => ({ ...v, replying: without(v.replying, t.taskId) }))
        await update($, replies, r => [...r, { worker: t.worker, taskId: t.taskId, text }])
      },
      discard: async t => {
        drafts.delete(t.taskId)
        await update($, paneView, v => ({ ...v, replying: without(v.replying, t.taskId) }))
      },
    }
    const shown = Object.values(workers).sort((a, b) => a.addedAt - b.addedAt)
    const aging = visible(list, now)
    // A row ages out with no state change to redraw the pane, so a timer does it.
    paneExpiry?.cancel()
    const due = nextRedraw(aging, now, false)
    paneExpiry = due === undefined ? undefined : $.clock.after(due, () => $.ui.invalidate('ui.render'))
    const rows = aging.filter(t => isOpen(t) || (t.endedAt ?? t.startedAt) > view.clearedAt)
    return paneTree($.ui.resolve(e), { surface: e.surface, width: e.props.bodyColumns, height: e.props.scroll.bodyRows, now, anim: ui.animations, pal, workers: shown, rows, durations, view, drafts }, act)
  })
ライセンスの全文(MIT)
MIT License

Copyright (c) 2026 Aliasgar Khimani

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 に読んだコミット 510e3a68c457 のソースから。最初のまとまりが載せる条件で、残りは自分で判断するための材料です。後のコミットは、次に読むまで見ていません。

載せる条件: 確かめやすいコード
入口を読んだhooks/hooks.json が名指すモジュールをすべて読んだ。hooks/register.ts
解析できるすべてのファイルが TypeScript か JavaScript として解析できる。23 ファイルを解析
コードが 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 のホスト)がコードに書いてあるか。hooks/register.ts:56 fetch(url)
プログラム起動するプログラムの名前がコードに書いてあり、シェル・インタプリタ・通信用の道具でないか。hooks/register.ts:60 実行時に決まるプログラム
読んで送るファイルや環境変数を読み、かつ通信するか。読んだうえで通信する
ソースの鍵ソースに API キーや秘密鍵らしきものがあるか。ソースに鍵なし
ライセンスオープンなライセンス(MIT・Apache-2.0・BSD・ISC・Unlicense・0BSD・CC0)で全文があれば、modscode にコードを載せる。違えばリンクだけ。MIT

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

入れる

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

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

/plugin marketplace add NovusEdge/a2a-mod
/plugin install a2a-mod@a2a-mod

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

Claude に聞く

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

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

Claude から探す: MCP コネクタ

似たデザイン