Astra: data safety (fencing, history, audit), AP 26D fixes, dry runs via the runner, client polish (56e055deeb3e)
5ce1088 verified Download web/src/pages/run/RunData.tsx from EnergyVenom/patchwise-agent-studio: direct link, hf CLI and curl.
- Browser
- Download file 4.33 kB
-
https://huggingface.co/spaces/EnergyVenom/patchwise-agent-studio/resolve/main/web/src/pages/run/RunData.tsx
- Command line
-
hf download hf://spaces/EnergyVenom/patchwise-agent-studio/web/src/pages/run/RunData.tsx
-
curl -L -o RunData.tsx https://huggingface.co/spaces/EnergyVenom/patchwise-agent-studio/resolve/main/web/src/pages/run/RunData.tsx
4.33 kB
| import { Badge, Card, Loader, Stack, Table, Text, Title } from '@mantine/core'; | |
| import { useDataPlan, useScripts } from '../../api/hooks'; | |
| import { ErrorAlert } from '../../components/common'; | |
| /** A recipe's outputs as "name: value" pairs, not a JSON blob. */ | |
| function outputWords(o: unknown): string { | |
| if (o == null || typeof o !== 'object') return o == null ? '' : String(o); | |
| return Object.entries(o as Record<string, unknown>).map(([k, v]) => `${k}: ${v == null ? '' : typeof v === 'object' ? JSON.stringify(v) : String(v)}`).join(', '); | |
| } | |
| const DATA_COLOR: Record<string, string> = { found: 'teal', not_found: 'red', seeded: 'dark', seed_refused: 'orange', unsupported: 'gray', skipped: 'gray' }; | |
| export function RunData({ id }: { id: string }) { | |
| const q = useDataPlan(id); | |
| if (q.isLoading) return <Loader />; | |
| if (q.error) return <ErrorAlert error={q.error} />; | |
| const d = q.data!; | |
| return ( | |
| <Stack> | |
| <Card withBorder> | |
| <Title order={2} size="h5">Recipes ({Object.keys(d.data_refs).length})</Title> | |
| <Text size="xs" c="dimmed">Read-only finds via the egress gate; seeding only with SEED_ALLOWED=1 on a test pod; BIP is a stub.</Text> | |
| <Table.ScrollContainer minWidth={640}> | |
| <Table fz="xs" aria-label="data recipes"> | |
| <Table.Thead><Table.Tr><Table.Th>Recipe</Table.Th><Table.Th>Strategy</Table.Th><Table.Th>Status</Table.Th><Table.Th>Outputs</Table.Th><Table.Th>Note</Table.Th></Table.Tr></Table.Thead> | |
| <Table.Tbody> | |
| {Object.values(d.data_refs).map((r) => ( | |
| <Table.Tr key={r.recipe_id}><Table.Td>{r.recipe_id}</Table.Td><Table.Td>{r.strategy}</Table.Td> | |
| <Table.Td><Badge size="xs" color={DATA_COLOR[r.status] ?? 'gray'}>{r.status.replace(/_/g, ' ')}</Badge></Table.Td> | |
| <Table.Td>{outputWords(r.outputs)}</Table.Td><Table.Td>{r.note}</Table.Td></Table.Tr> | |
| ))} | |
| </Table.Tbody> | |
| </Table> | |
| </Table.ScrollContainer> | |
| </Card> | |
| <Card withBorder> | |
| <Title order={2} size="h5">Case to recipes</Title> | |
| <Table fz="xs" aria-label="data plan"> | |
| <Table.Tbody> | |
| {Object.entries(d.data_plan).map(([c, rs]) => <Table.Tr key={c}><Table.Td>{c}</Table.Td><Table.Td>{rs.join(', ') || <Text span c="orange" size="xs">no recipe</Text>}</Table.Td></Table.Tr>)} | |
| </Table.Tbody> | |
| </Table> | |
| {d.gaps.length > 0 && <Text c="orange" size="sm">Gaps: {d.gaps.map((g) => `${g.case_id}/${g.recipe_id}: ${g.reason}`).join('; ')}</Text>} | |
| </Card> | |
| </Stack> | |
| ); | |
| } | |
| export function RunScripts({ id }: { id: string }) { | |
| const q = useScripts(id); | |
| if (q.isLoading) return <Loader />; | |
| if (q.error) return <ErrorAlert error={q.error} />; | |
| const rows = Object.values(q.data ?? {}); | |
| const yn = (v: boolean | null) => (v === null ? 'Not checked' : v ? 'Passed' : 'Failed'); | |
| return ( | |
| <Card withBorder> | |
| <Title order={2} size="h5">Scripts ({rows.length}): {rows.filter((r) => r.status === 'existing').length} existing, {rows.filter((r) => r.status === 'generated').length} generated drafts</Title> | |
| <Table.ScrollContainer minWidth={700}> | |
| <Table fz="xs" aria-label="scripts"> | |
| <Table.Thead><Table.Tr><Table.Th>Case</Table.Th><Table.Th>Status</Table.Th><Table.Th>Path</Table.Th><Table.Th>Lint</Table.Th><Table.Th>Dry-run</Table.Th><Table.Th>Last outcome</Table.Th></Table.Tr></Table.Thead> | |
| <Table.Tbody> | |
| {rows.map((s) => ( | |
| <Table.Tr key={s.case_id}><Table.Td>{s.case_id}</Table.Td><Table.Td><Badge size="xs" variant="light" color={s.status === 'existing' ? 'dark' : 'gray'}>{s.status}</Badge></Table.Td> | |
| <Table.Td style={{ wordBreak: 'break-all' }}>{s.path || s.note}</Table.Td><Table.Td>{yn(s.lint_ok)}</Table.Td><Table.Td>{yn(s.dry_run_ok)}</Table.Td> | |
| <Table.Td>{s.last_outcome ? <Badge size="xs" variant="light" color={s.last_outcome === 'passed' ? 'teal' : s.last_outcome === 'failed' ? 'red' : 'gray'}>{s.last_outcome.replace(/_/g, ' ')}</Badge> : <Text span size="xs" c="dimmed">Not run yet</Text>}</Table.Td></Table.Tr> | |
| ))} | |
| </Table.Tbody> | |
| </Table> | |
| </Table.ScrollContainer> | |
| </Card> | |
| ); | |
| } | |