mirror of
https://github.com/hanzo-apps/hanzo.ai.git
synced 2026-10-29 07:20:43 +00:00
The index, its boards and the shelf's pages wrap their prose: server pages with <T>, the boards and the library with t(), and copy held in data with phrase(). Figures read from the runs are values, and the fields lib/kai, lib/tools, lib/coding and lib/tally hand a board are drawn through t(), so they translate once those files emit keys. The shared parts (Chapter, Fold, Stat, Tile, Panel, Mark) translate a string where they draw it and take a node from a server page. figures.spec lets the index import @hanzo/i18n: words in, words out, never a figure.
75 lines
2.8 KiB
TypeScript
75 lines
2.8 KiB
TypeScript
'use client'
|
|
|
|
import { type Board } from '@/lib/tools'
|
|
import { useI18n } from '@hanzo/i18n/react'
|
|
import { useTools } from '@/hooks/useTools'
|
|
import { Block, Foot, H2, H3, Inline, Meta, P, Part, Table, Td, Th, Tr } from './kit'
|
|
|
|
/**
|
|
* Hanzo MCP's tool handlers beside the handlers they replaced (lib/tools). The
|
|
* page renders the build-time snapshot (INDEX.tools in lib/bench-data) and
|
|
* `useTools` swaps in what the research API holds when it answers. Each table is
|
|
* one split, held out first; each row says what decides it, read from its run.
|
|
* This file is layout, and e2e/unit/figures.spec.ts fails on a digit in it.
|
|
*/
|
|
export function Tools({ initial }: { initial: Board[] }) {
|
|
const { t } = useI18n()
|
|
const tools = useTools(initial)
|
|
if (!tools.length) return null
|
|
return (
|
|
<Part id="tools">
|
|
<H2>{t('Agent tools')}</H2>
|
|
<P>
|
|
{t(
|
|
'Tool handlers in Hanzo MCP, each run on the same cases as the handler it replaced. Each row says what decides it, rules, BM25 or Kai, as its run records. A rate is shown with its count.',
|
|
)}
|
|
</P>
|
|
{tools.map((b) => (
|
|
<Block key={b.id} id={`tools-${b.slug}`}>
|
|
<H3>{t(b.title)}</H3>
|
|
{b.splits.map((s) => (
|
|
<Block key={s.split} id={`tools-${b.slug}-${s.split}`}>
|
|
<Meta>{t('Split {split}: {definition}', { split: s.split, definition: s.definition })}</Meta>
|
|
<Table>
|
|
<thead>
|
|
<tr>
|
|
<Th left>{t('Handler')}</Th>
|
|
<Th left>{t('What decides')}</Th>
|
|
{s.heads.map((h) => (
|
|
<Th key={h}>{t(h)}</Th>
|
|
))}
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{s.rows.map((r) => (
|
|
<Tr key={r.id}>
|
|
<Td left wrap tone={r.role === 'now' ? 'ours' : 'plain'}>
|
|
{t(r.label)}
|
|
</Td>
|
|
<Td left wrap>
|
|
{t(r.decides)}
|
|
</Td>
|
|
{r.cells.map((c, i) => (
|
|
<Td key={s.heads[i]}>{c}</Td>
|
|
))}
|
|
</Tr>
|
|
))}
|
|
</tbody>
|
|
</Table>
|
|
<Foot>
|
|
{t('Research runs of {id} on split {split}, ended {ended}; the current handler at commit {commit}: {link}', {
|
|
id: b.id,
|
|
split: s.split,
|
|
ended: s.ended,
|
|
commit: s.commit,
|
|
link: <Inline href={b.href}>{`GET /v1/research/runs?org=hanzo&benchmark=${b.id}`}</Inline>,
|
|
})}
|
|
</Foot>
|
|
</Block>
|
|
))}
|
|
</Block>
|
|
))}
|
|
</Part>
|
|
)
|
|
}
|