Download web/src/pages/dev/DevFixtures.tsx from EnergyVenom/patchwise-agent-studio: direct link, hf CLI and curl.
- Browser
- Download file 5.27 kB
-
https://huggingface.co/spaces/EnergyVenom/patchwise-agent-studio/resolve/main/web/src/pages/dev/DevFixtures.tsx
- Command line
-
hf download hf://spaces/EnergyVenom/patchwise-agent-studio/web/src/pages/dev/DevFixtures.tsx
-
curl -L -o DevFixtures.tsx https://huggingface.co/spaces/EnergyVenom/patchwise-agent-studio/resolve/main/web/src/pages/dev/DevFixtures.tsx
5.27 kB
| // DEV ONLY: fixture screens for design review. Loaded only when import.meta.env.DEV (never in the production build). | |
| import { SimpleGrid, Stack } from '@mantine/core'; | |
| import { useState } from 'react'; | |
| import type { LlmCall } from '../../domain/agents'; | |
| import { PageHeader } from '../../components/common'; | |
| import type { RunEvent } from '../../hooks/useRunStream'; | |
| import { ApprovalCard, type Decision } from '../run/ScenarioReview'; | |
| import { TeamBoardView } from '../run/TeamBoard'; | |
| const T0 = Date.parse('2026-10-17T10:00:00Z'); | |
| const at = (s: number) => new Date(T0 + s * 1000).toISOString(); | |
| let seq = 0; | |
| const ev = (s: number, node: string | null, kind: string, summary: Record<string, unknown> = {}): RunEvent => ({ seq: ++seq, ts: at(s), node, kind, summary }); | |
| // A full browser run whose Test runner failed (the error the backend logs when the browser produces no report). | |
| const EVENTS: RunEvent[] = [ | |
| ev(0, 'scout', 'started'), ev(21, 'scout', 'finished', { ms: 21000 }), | |
| ev(21, 'research_module', 'started', { module: 'P2P' }), ev(24, 'research_module', 'finished', { n_research: 1, module: 'P2P', ms: 3000 }), | |
| ev(24, 'synthesizer', 'started'), ev(25, 'synthesizer', 'finished', { ms: 500 }), | |
| ev(25, 'test_generator', 'started'), ev(26, 'test_generator', 'finished', { n_test_cases: 10, ms: 900 }), | |
| ev(26, 'approval_gate', 'started'), ev(28, 'approval_gate', 'interrupted', { ms: 2000 }), | |
| ev(40, 'approval_gate', 'started'), ev(41, 'approval_gate', 'finished', { n_test_cases: 10, ms: 800 }), | |
| ev(41, 'data_planner', 'started'), ev(44, 'data_planner', 'finished', { ms: 3000 }), | |
| ev(44, 'data_executor', 'started'), ev(48, 'data_executor', 'finished', { ms: 4000 }), | |
| ev(48, 'script_builder', 'started'), ev(49, 'script_builder', 'finished', { ms: 100 }), | |
| ev(49, 'executor', 'started'), | |
| ev(112, 'executor', 'error', { error: 'Playwright produced no JSON report at attempt-0.json (exit 1); see the run folder' }), | |
| ev(112, null, 'status', { status: 'failed' }), | |
| ]; | |
| const CALLS: LlmCall[] = [ | |
| { node: 'research_module', task: 'pod_probe', route: 'stub', provider: 'stub', model: 'deterministic', fallback: null }, | |
| { node: 'synthesizer', task: 'synthesize', route: 'stub', provider: 'stub', model: 'deterministic', fallback: null }, | |
| { node: 'test_generator', task: 'generate_tests', route: 'stub', provider: 'stub', model: 'deterministic', fallback: null }, | |
| { node: 'data_planner', task: 'plan_data', route: 'stub', provider: 'stub', model: 'deterministic', fallback: 'local failed: ConnectError: [WinError 10061] No connection could be made' }, | |
| ]; | |
| export function DevFixtures() { | |
| return ( | |
| <Stack gap="md"> | |
| <PageHeader crumbs={[]} title="Dev fixture: team board with a failed agent" /> | |
| <TeamBoardView runId="fixture" status="failed" error="node executor failed" events={EVENTS} quick={false} llmCalls={CALLS} /> | |
| </Stack> | |
| ); | |
| } | |
| // AI-written scenarios as approval cards (the practice pod's quick simulations do not write any). | |
| const DRY = { status: 'passed' as const, failed_step: null, message: null, pod: 'Local mock pod', at: '2026-10-17T11:23:00', simulated: false }; | |
| const aiScenario = (id: string, title: string, pw: string) => ({ id, title, module: 'P2P', process: 'Requisition', step: 'Requisition', priority: pw === 'Critical' ? 'P1' : 'P2', | |
| priority_words: pw, roles: [], preconditions: [], steps: [], expected_result: '', test_data: [], why: [], verification: 'UNVERIFIED', map_ids: [], approval_status: 'draft', origin: 'ai' }); | |
| const aiPending = (id: string, dry: typeof DRY | (Omit<typeof DRY, 'simulated'> & { simulated: boolean }), n: number) => ({ id, title: id, module: 'P2P', priority: 'P1' as const, origin: 'ai' as const, | |
| changed_by_patch: true, new_or_changed: true, yaml_path: null, diff: null, ai: { id, title: id, module: 'P2P', priority: 'P1', written_by: 'ai', model: 'mistral-large-2512', why: null, | |
| status: 'staged', runnable: true, dry_run: dry, problems: [], steps: Array.from({ length: n }, (_, i) => ({ n: i + 1, action: 'fill', field: null, value: null, expected: null, text: '' })), expected_result: null } }); | |
| export function DevApprovalFixtures() { | |
| const [d, setD] = useState<Record<string, Decision>>({ c: 'approve' }); | |
| return ( | |
| <Stack gap="md"> | |
| <PageHeader crumbs={[]} title="Dev fixture: AI-written scenarios to approve" /> | |
| <SimpleGrid cols={{ base: 1, xl: 2 }} spacing="sm"> | |
| <ApprovalCard s={aiScenario('a', 'Requisition below threshold is approved by the first approver', 'Critical')} p={aiPending('a', DRY, 7)} editable decision={d.a} onDecision={(x) => setD((s) => ({ ...s, a: x }))} onShowSteps={() => undefined} /> | |
| <ApprovalCard s={aiScenario('b', 'Invoice above PO price is held for matching', 'High')} p={aiPending('b', { ...DRY, simulated: true }, 5)} editable decision={d.b} onDecision={(x) => setD((s) => ({ ...s, b: x }))} onShowSteps={() => undefined} /> | |
| <ApprovalCard s={aiScenario('c', 'Supplier bank account change needs a second approver', 'Critical')} p={aiPending('c', DRY, 9)} editable decision={d.c} onDecision={(x) => setD((s) => ({ ...s, c: x }))} onShowSteps={() => undefined} /> | |
| </SimpleGrid> | |
| </Stack> | |
| ); | |
| } | |