Attempt Picker
Several attempts at one task side by side, with progress while they run, then lines changed, tests passing and a suggested pick, and one to apply while the rest are discarded.
Fix rounding in the cart total
0 of 3 doneInstallation
npx shadcn@latest add "@aiellie/attempt-picker"shadcn needs the @aiellie registry in components.json first. npx aiellie add attempt-picker adds it on its first run, then installs the same way.
Attempt Picker lays out several attempts at the same task, from different models or approaches, so you can pick one. While they run, each shows its progress. Once they're done, each shows the lines it added and removed and how many tests pass, and the one you select opens to its summary, files, cost and time.
It suggests one: the most tests passing, then the smallest change. It waits until every attempt has reported, so an early finisher isn't suggested over the rest. Applying one discards the others.
Getting started
Pass the attempts
Update
attemptsas they report.onApplyadds the button; setappliedonce it's done.components/attempts.tsximport { AttemptPicker } from "@/components/aiellie/attempt-picker" export function Attempts({ run }: { run: Run }) { const [applied, setApplied] = useState<string>() return ( <AttemptPicker task={run.task} attempts={run.attempts} applied={applied} onApply={async (id) => { await run.apply(id) setApplied(id) }} /> ) }
Anatomy
<div data-slot="attempt-picker" data-state="ready" role="group">
<div data-slot="attempt-picker-header" />
<div role="radiogroup">
<div data-slot="attempt-picker-attempt" data-state="done" data-selected role="radio" />
</div>
<button data-slot="attempt-picker-apply" />
</div>The attempts are a radio group: the arrow keys move the selection. Failing tests and failed attempts take the destructive colour, and the suggested one carries a quiet tag.
suggestAttempt is exported too, if you'd rather show the suggestion somewhere else.
Examples
No suggestion
Pass suggested={null} when there's nothing to measure, like two drafts of the same text.
Write the release announcement
2 attemptsThree sentences: what changed, who it's for, the link.
Adds a before and after for each change, and a FAQ.
API reference
AttemptPicker
| Prop | Type | Default | Description |
|---|---|---|---|
task | string | required | What every attempt was given. |
attempts | Attempt[] | required | |
selected, defaultSelected, onSelectedChange | string | the first | |
suggested | string | null | suggestAttempt(attempts) | null for none. |
applied | string | The others show as discarded. | |
onApply | (id: string) => void | Adds Apply. |
All other div props are forwarded.
Attempt
| Field | Type | Default | Description |
|---|---|---|---|
id, label | string | required | |
state | "running" | "done" | "failed" | required | |
progress | number | From 0 to 1 while running. | |
summary | string | What it did, in a sentence. | |
additions, deletions, files | number | ||
tests | { passed: number; total: number } | ||
cost | string | Already formatted: "$0.42". | |
seconds | number |