Plan review
Check the agent's plan, edit steps, then let it run. Free and MIT licensed, as HTML, a typed React component or an Astro component, in three styles with light and dark mode.
Need this designed into your product? Book a call
Install
Add it to your project with the CLI.
HTML, CSS and JS
npx designme add plan-reviewReact
npx designme add plan-review --reactAstro
npx designme add plan-review --astroshadcn, React
npx shadcn@latest add https://designme.dev/r/shadcn/plan-review.json shadcn, Astro
npx shadcn@latest add https://designme.dev/r/shadcn/astro/plan-review.json The CLI copies the source into your project, so you own it and can change anything. Where each version lands, what it needs and the shadcn theme bridge: Installation.
About
What it is for and what it does.
Plan review shows the plan an agent proposes before it starts work, as a numbered list a person can change. They can rewrite a step, skip one, add their own, and then approve so the agent runs through the steps in the same view.
- When a task is large enough that people should agree on the steps before the agent touches anything.
- When a person wants to drop a step or rewrite it in their own words without starting over.
- When you want the approved plan to double as a progress list while the agent runs.
- When the person needs a Stop button once the agent is under way.
- Three phases:
reviewlets people edit steps,runningshows progress and a Stop button (the footer has no line of its own then), anddoneshows See changes. In Soft and Blueprint the footer sits under a hairline divider in every phase; in Studio it is the card's off-white foot strip. - In review, clicking a step makes its text editable. Enter saves it, and the step is marked as edited only if the words really changed.
- Each step has a skip button. Skipped steps stay in the list, struck through, and lose their number until they are included again.
- Add a step appends a new row and puts the cursor in it with the text selected.
- Steps can show
state: 'run'while the agent works on them, with a spinner and a highlight sweeping across the text (and across itsdetail, like "Retrying"),'retry'in amber while it waits out a problem like a rate limit, and a check oncedone. The step's number, spinner, clock and tick crossfade into one another. - Each step can report a
detailline under it, like "6 frames and 42 tokens read". It opens under the step and crossfades when it changes. - The status line defaults to about how many minutes the steps left in take (the list shows how many there are).
statusandnotereplace the defaults.metaadds quiet text at the end of the header, like an elapsed time while the agent works; the demo clears it once the run is over, as a finished plan shows no clock. Whilephaseisrunningthe status line has the same sweep.
- In review, each step's text has
role="textbox"and anaria-labellike "Step 2". - The skip button's
aria-labelswitches between "Skip step" and "Include step". - Pressing Enter in a step ends the edit instead of adding a new line.
Usage
Import it in React and drive it from your own state, or place it in an Astro page.
React
import { PlanReview } from '@/components/designme/plan-review/PlanReview';React example
The demo above as a React component, 74 lines you can copy.
'use client';
// The animated preview from designme.dev, rebuilt from the React component: an example of driving it from your own state.
import { useEffect, useRef, useState } from 'react';
import { PlanReview, type PlanPhase, type PlanReviewStep } from './PlanReview';
import { useScript, useStory } from '../lib/useScript';
/* ---------- Plan review: rewrite a step, approve, and the agent works through a rate limit to the end ---------- */
const PLAN: [text: string, done: string][] = [
['Read the pricing frames and the brand tokens', '6 frames and 42 tokens read'],
['Compare against the three competitor pages', '3 pages compared'],
['Simplify the plan cards to one CTA each', 'Plan cards now have one CTA each'],
['Move the FAQ below the comparison table', 'FAQ now sits under the table'],
['Write a summary of every change', 'Summary added to Pricing v4']
];
const DONE = new Map(PLAN.map(([text, done], i) => ['s' + i, { text, done }]));
const clock = (ms: number) => { const s = Math.floor(ms / 1000); return Math.floor(s / 60) + ':' + String(s % 60).padStart(2, '0'); };
export default function PlanReviewDemo() {
const ref = useRef<HTMLDivElement>(null);
const [steps, setSteps] = useState<PlanReviewStep[]>(() => PLAN.map(([text], i) => ({ id: 's' + i, text })));
const [phase, setPhase] = useState<PlanPhase>('review');
const [status, setStatus] = useState<string>();
const [note, setNote] = useState<string>();
const [ms, setMs] = useState<number>();
const live = useRef(steps);
useEffect(() => { live.current = steps; });
const stop = useRef(false);
useScript(async ({ wait }) => {
if (phase !== 'running') return;
const t0 = performance.now(), tick = setInterval(() => setMs(performance.now() - t0), 250); setMs(0);
const on = live.current.filter(s => !s.skipped);
const mark = (id: string, change: Partial<PlanReviewStep>) => setSteps(ss => ss.map(s => s.id === id ? { ...s, ...change } : s));
try {
for (let i = 0; i < on.length && !stop.current; i++) {
const s = on[i], plan = DONE.get(s.id);
let done = !plan ? 'Done' : s.edited ? 'Done as you wrote it' : plan.done;
mark(s.id, { state: 'run' }); setStatus(`About ${Math.max(1, Math.round((on.length - i) * .8))} min left`); await wait(900);
// the second step hits a rate limit: the agent waits it out, counting down, and tries again
if (s.id === 's1') {
for (let k = 3; k > 0 && !stop.current; k--) { mark(s.id, { state: 'retry', detail: `Rate limited by the browser tool. Retrying in ${k}s` }); await wait(1000); }
if (stop.current) { mark(s.id, { state: undefined, detail: 'Not started' }); break; }
mark(s.id, { state: 'run', detail: 'Retrying' }); await wait(700);
done += ', after 1 retry';
}
mark(s.id, { state: 'done', detail: done });
}
} finally { clearInterval(tick); }
setMs(performance.now() - t0);
setStatus(stop.current ? 'Stopped, progress kept' : `Done in ${clock(performance.now() - t0)}. 4 frames updated`); setPhase('done');
}, [phase === 'running']);
// the preview's story: the person rewrites the third step, then approves
useStory(ref, async ({ wait }) => {
await wait(2000);
const was = PLAN[2][0], now = 'Simplify the plan cards to one CTA, annual price first';
for (let n = was.length; n >= was.length - 5; n--) { setSteps(ss => ss.map(s => s.id === 's2' ? { ...s, text: was.slice(0, n) } : s)); await wait(60); }
for (let n = was.length - 5; n <= now.length; n++) { setSteps(ss => ss.map(s => s.id === 's2' ? { ...s, text: now.slice(0, n), edited: true } : s)); await wait(45); }
await wait(1500);
stop.current = false; setNote(undefined); setPhase('running');
});
// the header's clock runs while the agent works; a finished plan has none (owner, 18 Nov), its status line says how long it took
return (
<div ref={ref} style={{ width: '100%' }}>
<PlanReview title="Plan: redesign the pricing page" steps={steps} onStepsChange={setSteps} phase={phase} status={status} note={note}
meta={ms === undefined || phase === 'done' ? undefined : clock(ms)}
onRequestChanges={() => setNote('Tell the agent what to change in chat')}
onApprove={() => { stop.current = false; setNote(undefined); setPhase('running'); }}
onStop={() => { stop.current = true; }} onSeeChanges={() => {}} />
</div>
);
}
Astro
In a page in src/pages. It plays the demo above; change its plan-review.js to show your own data. Attributes like class go on its root element.
---
import PlanReview from '../components/designme/plan-review/PlanReview.astro';
---
<PlanReview />
<PlanReview data-style="soft" class="my-class" />Props
Everything PlanReview takes.
| Prop | Type | What it does |
|---|---|---|
titlerequired | string | Like "Plan: redesign the pricing page" |
steps | PlanReviewStep[] | The steps. Leave `steps` out to let the person edit, skip and add steps on their own |
defaultSteps | PlanReviewStep[] | |
onStepsChange | (steps: PlanReviewStep[]) => void | |
phase | PlanPhase | review (steps can be edited), running (the agent works through them) or done |
status | string | The line under the title. Defaults to roughly how long the steps left in take (the list shows how many there are) |
note | string | The quiet line in the footer. Defaults to a hint for each phase |
meta | ReactNode | Quiet text at the end of the header, like an elapsed time "0:04" |
onApprove | () => void | |
onRequestChanges | () => void | |
onStop | () => void | |
onSeeChanges | () => void | |
bare | boolean | Draws its own container (the default, as on designme.dev). Set true to sit it flat in a chat thread |
className | string |
Code
The full source, as the CLI installs it.
PlanReview.tsxReact · 138 lines
'use client';
import { useEffect, useRef, useState, type ReactNode } from 'react';
import { cx } from '../lib/cx';
import { useControllable } from '../lib/hooks';
import { Icon } from '../lib/icons';
import { Spin, Swap, SwapIcon, Think, Tip, useGrow } from '../lib/motion';
import { useHoverGlide } from '../lib/glide';
import '../designme.css';
import './plan-review.css';
export interface PlanReviewStep {
id: string;
text: string;
/** Left out of the plan; it stays in the list, struck through */
skipped?: boolean;
/** Marks a step the person rewrote */
edited?: boolean;
/** run while the agent works on it, retry while it waits out a problem (a rate limit, a timeout), done once it has */
state?: 'run' | 'retry' | 'done';
/** The line the step reports, under it: what it found, or what it waits on. Opens and crossfades when it changes */
detail?: string;
}
export type PlanPhase = 'review' | 'running' | 'done';
export interface PlanReviewProps {
/** Like "Plan: redesign the pricing page" */
title: string;
/** The steps. Leave `steps` out to let the person edit, skip and add steps on their own */
steps?: PlanReviewStep[];
defaultSteps?: PlanReviewStep[];
onStepsChange?: (steps: PlanReviewStep[]) => void;
/** review (steps can be edited), running (the agent works through them) or done */
phase?: PlanPhase;
/** The line under the title. Defaults to roughly how long the steps left in take (the list shows how many there are) */
status?: string;
/** The quiet line in the footer. Defaults to a hint for each phase */
note?: string;
/** Quiet text at the end of the header, like an elapsed time "0:04" */
meta?: ReactNode;
onApprove?: () => void;
onRequestChanges?: () => void;
onStop?: () => void;
onSeeChanges?: () => void;
/** Draws its own container (the default, as on designme.dev). Set true to sit it flat in a chat thread */
bare?: boolean;
className?: string;
}
// the foot never repeats the head: while the plan runs it has only Stop (owner, 18 Nov)
const NOTE: Record<PlanPhase, string> = { review: 'Click a step to edit it', running: '', done: '' };
let added = 0;
/** A plan the agent proposes before it starts: edit a step, skip it, add one, then approve. */
export function PlanReview({ title, steps, defaultSteps = [], onStepsChange, phase = 'review', status, note, meta, onApprove, onRequestChanges, onStop, onSeeChanges, bare = false, className }: PlanReviewProps) {
// Studio's one hover glides from step to step
const listRef = useRef<HTMLOListElement>(null);
useHoverGlide(listRef, '.dm-plx-s');
const [list, setList] = useControllable(steps, defaultSteps, onStepsChange);
const live = useRef(list);
useEffect(() => { live.current = list; });
// each step remembers the words it came with, so "edited" shows only when they really changed
const original = useRef(new Map<string, string>());
list.forEach(s => { if (!original.current.has(s.id)) original.current.set(s.id, s.text); });
// the rows stagger in once; after that the entrance comes off so a skipped step can fade
const [entered, setEntered] = useState<Set<string>>(() => new Set());
const first = useRef(new Set(list.map(s => s.id)));
const focusId = useRef<string | null>(null);
const textRefs = useRef(new Map<string, HTMLSpanElement>());
useEffect(() => {
const id = focusId.current, el = id && textRefs.current.get(id); if (!el) return;
focusId.current = null; el.focus(); getSelection()?.selectAllChildren(el);
});
const update = (id: string, change: Partial<PlanReviewStep>) => setList(live.current.map(s => s.id === id ? { ...s, ...change } : s));
const included = list.filter(s => !s.skipped);
const editable = phase === 'review';
let n = 0;
// the panel grows with the plan (owner, 17 Nov): its height eases to its content, nothing kept for the final state
const [growRef, growIn] = useGrow();
return (
<div data-dm="" ref={growRef} className={cx('dm-plx', 'dm-growing dm-mx-grow', !bare && 'dm-panel', className)}>
<div className="dm-grow" ref={growIn}>
<div className="dm-plx-h">
<Think on={phase === 'running'} className="dm-plx-mk" />
<div className="dm-plx-ht"><b>{title}</b><Swap className={cx('dm-muted dm-plx-st', phase === 'running' && 'dm-shim')}>{status ?? `About ${Math.max(1, Math.round(included.length * .8))} min`}</Swap></div>
{meta !== undefined && <span className="dm-plx-tm dm-num">{meta}</span>}
</div>
<ol ref={listRef} className="dm-plx-list dm-mx-glide dm-mx-ic">
{list.map((s, i) => {
const num = s.skipped ? '–' : String(++n);
const entering = !entered.has(s.id);
return (
<li key={s.id} className={cx('dm-plx-s', entering && 'dm-enter', s.skipped && 'dm-off', s.state && 'dm-' + s.state, s.edited && 'dm-edited')}
style={entering ? { animationDelay: (first.current.has(s.id) ? 100 + i * 60 : 0) + 'ms' } : undefined}
onAnimationEnd={e => { if (e.target === e.currentTarget) setEntered(prev => new Set(prev).add(s.id)); }}>
<span className="dm-n">{s.state ? <SwapIcon id={s.state}>{s.state === 'done' ? <Icon name="check" size="xs" /> : s.state === 'run' ? <Spin /> : s.state === 'retry' ? <Icon name="clock" size="xs" /> : num}</SwapIcon> : num}</span>
<span className="dm-b">
<span className={cx('dm-t', s.state === 'run' && 'dm-shim')} ref={el => { if (el) textRefs.current.set(s.id, el); else textRefs.current.delete(s.id); }}
contentEditable={editable} suppressContentEditableWarning spellCheck={false} role={editable ? 'textbox' : undefined} aria-label={editable ? `Step ${num}` : undefined}
onKeyDown={e => { if (e.key === 'Enter') { e.preventDefault(); e.currentTarget.blur(); } }}
onBlur={e => { const text = e.currentTarget.textContent ?? ''; if (text !== s.text) update(s.id, { text, edited: text.trim() !== original.current.get(s.id) }); }}>
{s.text}
</span>
<span className={cx('dm-d', s.detail && 'dm-on', s.state === 'retry' && 'dm-warn')}><Swap className={s.state === 'run' && s.detail ? 'dm-shim' : undefined}>{s.detail ?? ''}</Swap></span>
</span>
{editable && (
<Tip label={s.skipped ? 'Include step' : 'Skip step'}>
<button type="button" className="dm-ib dm-plx-x dm-mx-press" aria-label={s.skipped ? 'Include step' : 'Skip step'} onClick={() => update(s.id, { skipped: !s.skipped })}>
<SwapIcon id={s.skipped ? 'undo' : 'x'}><Icon name={s.skipped ? 'undo' : 'x'} size="xs" /></SwapIcon>
</button>
</Tip>
)}
</li>
);
})}
</ol>
{editable && (
<button type="button" className="dm-plx-add" onClick={() => { const id = `new-${++added}`; focusId.current = id; setList([...live.current, { id, text: 'New step' }]); }}>
<Icon name="plus" size="xs" />Add a step
</button>
)}
<div className="dm-plx-f" key={phase}>
<Swap className="dm-muted dm-plx-n">{note ?? NOTE[phase]}</Swap>
{phase === 'review' && <>
<button type="button" className="dm-pill dm-ghost dm-sm dm-plx-chg dm-mx-press" onClick={onRequestChanges}>Ask for changes</button>
<button type="button" className="dm-pill dm-primary dm-sm dm-plx-go" onClick={onApprove}>Approve plan</button>
</>}
{phase === 'running' && <button type="button" className="dm-pill dm-ghost dm-sm dm-plx-stop dm-mx-press dm-enter" style={{ animationDelay: '50ms' }} onClick={onStop}><Icon name="stop" size="xs" />Stop</button>}
{phase === 'done' && <button type="button" className="dm-pill dm-line dm-sm dm-mx-press dm-enter" onClick={onSeeChanges}><Icon name="eye" size="xs" />See changes</button>}
</div>
</div>
</div>
);
}
plan-review.cssReact · 91 lines
/* Generated from designme.dev by scripts/sync.mjs. Edit the site, then sync. */
/* ---------- Plan review ---------- */
/* the plan the agent posts in the chat: no container; with .panel it becomes a card */
.dm-plx{padding:14px 0;display:flex;flex-direction:column;gap:10px;--dm-row:color-mix(in srgb,var(--dm-fg) 5%,transparent)}
.dm-plx.dm-panel{padding:var(--dm-s-4)}
/* its motion (the core's motion pieces, owner, 26 Nov): one highlight glides from step to step in every style (.mx-glide); a
press shows at once (.mx-press, no scale); a step's number, spinner, clock and tick crossfade, as Skip's cross and undo do
(.mx-ic); and the plan grows on the spring as its lines arrive (.mx-grow) */
.dm-plx-h{display:flex;align-items:center;gap:10px}
/* the header's mark sits in the steps' 32px number column, centred */
.dm-plx-mk{color:var(--dm-accent-fg,var(--dm-accent));margin-inline:9px}
.dm-plx-ht{display:flex;flex-direction:column;min-width:0}
.dm-plx-ht b{font-weight:500;font-size:13.5px}
.dm-plx-st{font-size:12.5px}
/* every part on shared columns, in every style (owner, 18 Nov): the header's mark and each step's number are centred in one
32px column, so the steps' words start where the title's do, and a step's buttons and time end on the content's right edge;
a step's hover fill reaches 8px out round it, into the padding, as Add a step's does (owner, 26 Nov) */
.dm-plx-list{list-style:none;margin:0 calc(-1 * var(--dm-s-2));padding:0;display:flex;flex-direction:column;counter-reset:s}
.dm-plx-s{display:flex;align-items:flex-start;gap:10px;padding:7px var(--dm-s-2);border-radius:calc(10px * var(--dm-rk-m,var(--dm-rk)));font-size:13px;transition:background .25s,opacity .35s;position:relative}
@media (hover:hover) and (pointer:fine){.dm-plx-s:hover{background:var(--dm-row)}}
.dm-plx-s .dm-n{width:20px;height:20px;margin:1px 6px 0;border-radius:50%;background:var(--dm-chip);display:grid;place-items:center;font-size:11px;font-variant-numeric:tabular-nums;color:var(--dm-muted);flex:none;transition:background .35s,color .35s}
@media (hover:hover) and (pointer:fine){.dm-plx-s:hover .dm-n{background:var(--dm-surface)}}
.dm-plx-s .dm-b{flex:1;min-width:0;display:flex;flex-direction:column}
/* (a 20px line, with the number on it: the number and the words share one centre, with even room above and below) */
.dm-plx-s .dm-t{min-width:0;outline:0;border-radius:var(--dm-r-tiny,5px);padding:1px 3px;margin:0 -3px;line-height:20px}
/* the line a step reports: it opens under the step, in the step's colour while it waits on something */
.dm-plx-s .dm-d{font-size:12px;color:var(--dm-muted);display:grid;grid-template-rows:0fr;transition:grid-template-rows .32s var(--dm-ease)}
.dm-plx-s .dm-d.dm-on{grid-template-rows:1fr}
.dm-plx-s .dm-d>span{overflow:hidden;min-height:0}
/* a running step's note ("Retrying") has the loader's sweep; the note it replaces fades out in its own colour, unswept */
.dm-plx-s .dm-d>.dm-shim.dm-out{color:inherit;background:none;animation:none}
.dm-plx-s .dm-d.dm-warn{color:var(--dm-warn)}
.dm-plx-tm{margin-left:auto;font-size:12px;color:var(--dm-muted)}
.dm-plx-tm:empty{display:none}
.dm-plx-s .dm-n .dm-spin{width:10px;height:10px}
.dm-plx-s .dm-t:focus{background:var(--dm-surface);box-shadow:0 0 0 1px color-mix(in srgb,var(--dm-field-line-strong) 50%,transparent)}
/* (the skip button takes no more height than a step's line, so a step has the same room above and below its words) */
.dm-plx-s .dm-ib{width:24px;height:24px;margin-block:-1.25px;opacity:0;transition:opacity .2s}
.dm-plx-s .dm-ib:focus-visible{opacity:1}
@media (hover:hover) and (pointer:fine){.dm-plx-s:hover .dm-ib{opacity:1}}
.dm-plx-s.dm-off{opacity:.45}
.dm-plx-s.dm-off .dm-t{text-decoration:line-through}
.dm-plx-s.dm-run .dm-n{background:var(--dm-accent-bg);color:var(--dm-accent-fg,var(--dm-accent))}
/* a finished step is neutral with the green tick, no green fill (owner, 18 Nov) */
.dm-plx-s.dm-done .dm-n{background:var(--dm-chip);color:var(--dm-ok)}
.dm-plx-s.dm-retry .dm-n{background:var(--dm-warn-bg);color:var(--dm-warn)}
.dm-plx-s.dm-edited .dm-t::after{content:"edited";margin-left:6px;font-size:11px;color:var(--dm-accent-fg,var(--dm-accent))}
.dm-plx-add{display:flex;align-items:center;gap:10px;font-size:12.5px;color:var(--dm-fg2);margin-inline:calc(-1 * var(--dm-s-2));padding:6px var(--dm-s-2);align-self:stretch;border-radius:calc(10px * var(--dm-rk-m,var(--dm-rk)))}
.dm-plx-add .dm-i{margin-inline:10px}
@media (hover:hover) and (pointer:fine){.dm-plx-add:hover{color:var(--dm-fg);background:var(--dm-row)}}
/* the footer's buttons end on the content's right edge, also on a phone, where the note beside them is left out */
.dm-plx-f{display:flex;align-items:center;justify-content:flex-end;gap:6px}
/* the footer sits under a hairline in Soft and Blueprint, in every state (owner, 21 Nov: "shouldn't there be a divider line
there?"), 16px under the last step and 16px over its buttons, as the card's own edges are; Studio's is a foot strip (below) */
.dm-plx-f{margin-top:6px;padding-top:var(--dm-s-4);border-top:1px solid color-mix(in srgb,var(--dm-line) 50%,transparent)}
.dm-plx-n{flex:1;font-size:12px;min-width:0}
@media (max-width:480px){.dm-plx-n{display:none}}
/* Studio (lead and owner, 18 Nov): a card with the plan and an off-white foot strip, everything on shared columns. Its
content sits 16px in from every edge: the header's mark sits in a 32px neutral tile, and each step's number circle is
centred in that same 32px column, as Add a step's plus is, so every step's words start where the title's do. A step's
hover fill spans the content, from the tile's left edge to the content's right edge, never wider; the skip button is
centred in a 32px column at its end. The foot strip's hint starts at the content's left edge, and its buttons sit 8px from
the card's edges, the 28px buttons' 14px ends and 8px making the card's 22px corner. A queued step is a hairline circle with its number, the step in hand a spinner ring in the accent (white in dark mode), one
waiting out a problem an orange ring with its clock, a finished one a neutral circle with a green ring and tick (no green
fill, as a finished row has none): two hues, and only on
steps that run or have run. Each step's line comes in only once the agent has done it (or is waiting on something), and
the header sums the run up only once it is over. "edited" is quiet grey text */
:root[data-style="studio"] .dm-plx.dm-panel,:root [data-style="studio"] .dm-plx.dm-panel,:root [data-style="studio"].dm-plx.dm-panel{padding:16px 16px 0}
:root[data-style="studio"] .dm-plx.dm-panel.dm-growing,:root [data-style="studio"] .dm-plx.dm-panel.dm-growing,:root [data-style="studio"].dm-plx.dm-panel.dm-growing{overflow-clip-margin:0px}
:root[data-style="studio"] .dm-plx-h,:root [data-style="studio"] .dm-plx-h,:root [data-style="studio"].dm-plx-h{position:relative;gap:12px}
:root[data-style="studio"] .dm-plx-h::before,:root [data-style="studio"] .dm-plx-h::before,:root [data-style="studio"].dm-plx-h::before{content:"";position:absolute;left:0;top:50%;width:32px;height:32px;margin-top:-16px;border-radius:calc(9px * var(--dm-rk-m,var(--dm-rk)));background:var(--dm-chip);box-shadow:inset 0 0 0 1px var(--dm-hair)}
:root[data-style="studio"] .dm-plx-mk,:root [data-style="studio"] .dm-plx-mk,:root [data-style="studio"].dm-plx-mk{margin-inline:9px;color:var(--dm-accent-mark)}
:root[data-style="studio"] .dm-plx-ht b,:root [data-style="studio"] .dm-plx-ht b,:root [data-style="studio"].dm-plx-ht b{line-height:20px}
:root[data-style="studio"] .dm-plx-st,:root [data-style="studio"] .dm-plx-st,:root [data-style="studio"].dm-plx-st{line-height:18px}
:root[data-style="studio"] .dm-plx-tm,:root [data-style="studio"] .dm-plx-tm,:root [data-style="studio"].dm-plx-tm{font-variant-numeric:tabular-nums}
:root[data-style="studio"] .dm-plx-list,:root [data-style="studio"] .dm-plx-list,:root [data-style="studio"].dm-plx-list{margin:0 calc(-1 * var(--dm-s-2))}
:root[data-style="studio"] .dm-plx-s,:root [data-style="studio"] .dm-plx-s,:root [data-style="studio"].dm-plx-s{gap:12px;padding:7px var(--dm-s-2);border-radius:calc(7px * var(--dm-rk-m,var(--dm-rk)));transition:background-color var(--dm-t-fast) var(--dm-ease),opacity var(--dm-t-fast) var(--dm-ease)}
:root[data-style="studio"] .dm-plx-s .dm-n,:root [data-style="studio"] .dm-plx-s .dm-n,:root [data-style="studio"].dm-plx-s .dm-n{margin:1px 6px 0;background:none;box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--dm-line-strong) 50%,transparent);transition:background-color var(--dm-t-fast) var(--dm-ease),box-shadow var(--dm-t-fast) var(--dm-ease),color var(--dm-t-fast) var(--dm-ease)}
@media (hover:hover) and (pointer:fine){:root[data-style="studio"] .dm-plx-s:hover .dm-n,:root [data-style="studio"] .dm-plx-s:hover .dm-n,:root [data-style="studio"].dm-plx-s:hover .dm-n{background:var(--dm-surface)}}
:root[data-style="studio"] .dm-plx-s.dm-run .dm-n,:root [data-style="studio"] .dm-plx-s.dm-run .dm-n,:root [data-style="studio"].dm-plx-s.dm-run .dm-n{box-shadow:none;color:var(--dm-fg)}
:root[data-style="studio"] .dm-plx-s.dm-run .dm-n .dm-spin,:root [data-style="studio"] .dm-plx-s.dm-run .dm-n .dm-spin,:root [data-style="studio"].dm-plx-s.dm-run .dm-n .dm-spin{width:20px;height:20px;border:1.5px solid var(--dm-line);border-top-color:var(--dm-accent-mark);animation-duration:.9s}
:root[data-style="studio"] .dm-plx-s.dm-retry .dm-n,:root [data-style="studio"] .dm-plx-s.dm-retry .dm-n,:root [data-style="studio"].dm-plx-s.dm-retry .dm-n{background:none;box-shadow:inset 0 0 0 1.5px var(--dm-warn-mark);color:var(--dm-warn-mark)}
:root[data-style="studio"] .dm-plx-s.dm-done .dm-n,:root [data-style="studio"] .dm-plx-s.dm-done .dm-n,:root [data-style="studio"].dm-plx-s.dm-done .dm-n{background:var(--dm-surface);box-shadow:inset 0 0 0 1.5px var(--dm-ok-mark);color:var(--dm-ok-mark)}
:root[data-style="studio"] .dm-plx-s.dm-done .dm-n .dm-i,:root [data-style="studio"] .dm-plx-s.dm-done .dm-n .dm-i,:root [data-style="studio"].dm-plx-s.dm-done .dm-n .dm-i{width:11px;height:11px;stroke-width:2.4}
:root[data-style="studio"] .dm-plx-s.dm-edited .dm-t::after,:root [data-style="studio"] .dm-plx-s.dm-edited .dm-t::after,:root [data-style="studio"].dm-plx-s.dm-edited .dm-t::after{color:var(--dm-muted)}
:root[data-style="studio"] .dm-plx-add,:root [data-style="studio"] .dm-plx-add,:root [data-style="studio"].dm-plx-add{align-self:stretch;gap:12px;margin:-4px calc(-1 * var(--dm-s-2)) 0;padding:6px var(--dm-s-2);border-radius:calc(7px * var(--dm-rk-m,var(--dm-rk)));transition:background-color var(--dm-t-fast) var(--dm-ease),color var(--dm-t-fast) var(--dm-ease)}
:root[data-style="studio"] .dm-plx-add .dm-i,:root [data-style="studio"] .dm-plx-add .dm-i,:root [data-style="studio"].dm-plx-add .dm-i{margin-inline:10px}
:root[data-style="studio"] .dm-plx.dm-panel .dm-plx-f .dm-plx-stop,:root [data-style="studio"] .dm-plx.dm-panel .dm-plx-f .dm-plx-stop,:root [data-style="studio"].dm-plx.dm-panel .dm-plx-f .dm-plx-stop{margin-right:0}
:root[data-style="studio"] .dm-plx.dm-panel .dm-plx-f,:root [data-style="studio"] .dm-plx.dm-panel .dm-plx-f,:root [data-style="studio"].dm-plx.dm-panel .dm-plx-f{justify-content:flex-end;gap:4px;margin:6px -16px 0;padding:var(--dm-strip-y) 16px;border-top:1px solid var(--dm-line);background:var(--dm-strip);border-radius:0 0 var(--dm-r-card) var(--dm-r-card)}
:root[data-style="studio"] .dm-plx.dm-panel .dm-plx-n,:root [data-style="studio"] .dm-plx.dm-panel .dm-plx-n,:root [data-style="studio"].dm-plx.dm-panel .dm-plx-n{padding-left:0}
PlanReview.astroAstro · 29 lines
---
// Generated from designme.dev by scripts/sync.mjs. Edit the site, then sync.
// Plan review: Check the agent's plan, edit steps, then let it run.
// The markup, CSS and script are designme.dev's own, run by the shared core in ../core, which mounts the component when it scrolls
// into view and plays its demo. To show your own data, change plan-review.js. The markup is kept exactly as it is (is:raw).
import type { HTMLAttributes } from 'astro/types';
import '../core/designme.css';
import './plan-review.css';
export interface Props extends HTMLAttributes<'div'> {
/** "soft" or "studio" draws it in that style. Leave it out for Blueprint, or for the style set on <html> (data-style="soft" or "studio") */
'data-style'?: 'soft' | 'studio';
}
const { class: className, ...rest } = Astro.props;
---
<div class:list={['card', className]} data-c="plan-review" {...rest}>
<div class="stage-in"><Fragment is:raw>
<div class="plx panel mx-grow">
<div class="plx-h"><span class="think plx-mk"><i></i><i></i><i></i><i></i></span><div class="plx-ht"><b>Plan: redesign the pricing page</b><span class="muted plx-st">About 4 min</span></div><span class="plx-tm num" aria-label="Elapsed"></span></div>
<ol class="plx-list mx-glide mx-ic"></ol>
<button class="plx-add"><svg class="i xs"><use href="#i-plus"/></svg>Add a step</button>
<div class="plx-f"><span class="muted plx-n">Click a step to edit it</span><button class="pill ghost sm plx-chg mx-press">Ask for changes</button><button class="pill primary sm plx-go">Approve plan</button></div>
</div>
</Fragment></div>
</div>
<script>
import './plan-review.js';
</script>
plan-review.htmlHTML · 11 lines
<div class="card" data-c="plan-review">
<div class="stage-in">
<div class="plx panel mx-grow">
<div class="plx-h"><span class="think plx-mk"><i></i><i></i><i></i><i></i></span><div class="plx-ht"><b>Plan: redesign the pricing page</b><span class="muted plx-st">About 4 min</span></div><span class="plx-tm num" aria-label="Elapsed"></span></div>
<ol class="plx-list mx-glide mx-ic"></ol>
<button class="plx-add"><svg class="i xs"><use href="#i-plus"/></svg>Add a step</button>
<div class="plx-f"><span class="muted plx-n">Click a step to edit it</span><button class="pill ghost sm plx-chg mx-press">Ask for changes</button><button class="pill primary sm plx-go">Approve plan</button></div>
</div>
</div>
</div>
plan-review.cssHTML · 90 lines
/* ---------- Plan review ---------- */
/* the plan the agent posts in the chat: no container; with .panel it becomes a card */
.plx{padding:14px 0;display:flex;flex-direction:column;gap:10px;--dm-row:color-mix(in srgb,var(--dm-fg) 5%,transparent)}
.plx.panel{padding:var(--dm-s-4)}
/* its motion (the core's motion pieces, owner, 26 Nov): one highlight glides from step to step in every style (.mx-glide); a
press shows at once (.mx-press, no scale); a step's number, spinner, clock and tick crossfade, as Skip's cross and undo do
(.mx-ic); and the plan grows on the spring as its lines arrive (.mx-grow) */
.plx-h{display:flex;align-items:center;gap:10px}
/* the header's mark sits in the steps' 32px number column, centred */
.plx-mk{color:var(--dm-accent-fg,var(--dm-accent));margin-inline:9px}
.plx-ht{display:flex;flex-direction:column;min-width:0}
.plx-ht b{font-weight:500;font-size:13.5px}
.plx-st{font-size:12.5px}
/* every part on shared columns, in every style (owner, 18 Nov): the header's mark and each step's number are centred in one
32px column, so the steps' words start where the title's do, and a step's buttons and time end on the content's right edge;
a step's hover fill reaches 8px out round it, into the padding, as Add a step's does (owner, 26 Nov) */
.plx-list{list-style:none;margin:0 calc(-1 * var(--dm-s-2));padding:0;display:flex;flex-direction:column;counter-reset:s}
.plx-s{display:flex;align-items:flex-start;gap:10px;padding:7px var(--dm-s-2);border-radius:calc(10px * var(--dm-rk-m,var(--dm-rk)));font-size:13px;transition:background .25s,opacity .35s;position:relative}
@media (hover:hover) and (pointer:fine){.plx-s:hover{background:var(--dm-row)}}
.plx-s .n{width:20px;height:20px;margin:1px 6px 0;border-radius:50%;background:var(--dm-chip);display:grid;place-items:center;font-size:11px;font-variant-numeric:tabular-nums;color:var(--dm-muted);flex:none;transition:background .35s,color .35s}
@media (hover:hover) and (pointer:fine){.plx-s:hover .n{background:var(--dm-surface)}}
.plx-s .b{flex:1;min-width:0;display:flex;flex-direction:column}
/* (a 20px line, with the number on it: the number and the words share one centre, with even room above and below) */
.plx-s .t{min-width:0;outline:0;border-radius:var(--dm-r-tiny,5px);padding:1px 3px;margin:0 -3px;line-height:20px}
/* the line a step reports: it opens under the step, in the step's colour while it waits on something */
.plx-s .d{font-size:12px;color:var(--dm-muted);display:grid;grid-template-rows:0fr;transition:grid-template-rows .32s var(--dm-ease)}
.plx-s .d.on{grid-template-rows:1fr}
.plx-s .d>span{overflow:hidden;min-height:0}
/* a running step's note ("Retrying") has the loader's sweep; the note it replaces fades out in its own colour, unswept */
.plx-s .d>.shim.out{color:inherit;background:none;animation:none}
.plx-s .d.warn{color:var(--dm-warn)}
.plx-tm{margin-left:auto;font-size:12px;color:var(--dm-muted)}
.plx-tm:empty{display:none}
.plx-s .n .spin{width:10px;height:10px}
.plx-s .t:focus{background:var(--dm-surface);box-shadow:0 0 0 1px color-mix(in srgb,var(--dm-field-line-strong) 50%,transparent)}
/* (the skip button takes no more height than a step's line, so a step has the same room above and below its words) */
.plx-s .ib{width:24px;height:24px;margin-block:-1.25px;opacity:0;transition:opacity .2s}
.plx-s .ib:focus-visible{opacity:1}
@media (hover:hover) and (pointer:fine){.plx-s:hover .ib{opacity:1}}
.plx-s.off{opacity:.45}
.plx-s.off .t{text-decoration:line-through}
.plx-s.run .n{background:var(--dm-accent-bg);color:var(--dm-accent-fg,var(--dm-accent))}
/* a finished step is neutral with the green tick, no green fill (owner, 18 Nov) */
.plx-s.done .n{background:var(--dm-chip);color:var(--dm-ok)}
.plx-s.retry .n{background:var(--dm-warn-bg);color:var(--dm-warn)}
.plx-s.edited .t::after{content:"edited";margin-left:6px;font-size:11px;color:var(--dm-accent-fg,var(--dm-accent))}
.plx-add{display:flex;align-items:center;gap:10px;font-size:12.5px;color:var(--dm-fg2);margin-inline:calc(-1 * var(--dm-s-2));padding:6px var(--dm-s-2);align-self:stretch;border-radius:calc(10px * var(--dm-rk-m,var(--dm-rk)))}
.plx-add .i{margin-inline:10px}
@media (hover:hover) and (pointer:fine){.plx-add:hover{color:var(--dm-fg);background:var(--dm-row)}}
/* the footer's buttons end on the content's right edge, also on a phone, where the note beside them is left out */
.plx-f{display:flex;align-items:center;justify-content:flex-end;gap:6px}
/* the footer sits under a hairline in Soft and Blueprint, in every state (owner, 21 Nov: "shouldn't there be a divider line
there?"), 16px under the last step and 16px over its buttons, as the card's own edges are; Studio's is a foot strip (below) */
.plx-f{margin-top:6px;padding-top:var(--dm-s-4);border-top:1px solid color-mix(in srgb,var(--dm-line) 50%,transparent)}
.plx-n{flex:1;font-size:12px;min-width:0}
@media (max-width:480px){.plx-n{display:none}}
/* Studio (lead and owner, 18 Nov): a card with the plan and an off-white foot strip, everything on shared columns. Its
content sits 16px in from every edge: the header's mark sits in a 32px neutral tile, and each step's number circle is
centred in that same 32px column, as Add a step's plus is, so every step's words start where the title's do. A step's
hover fill spans the content, from the tile's left edge to the content's right edge, never wider; the skip button is
centred in a 32px column at its end. The foot strip's hint starts at the content's left edge, and its buttons sit 8px from
the card's edges, the 28px buttons' 14px ends and 8px making the card's 22px corner. A queued step is a hairline circle with its number, the step in hand a spinner ring in the accent (white in dark mode), one
waiting out a problem an orange ring with its clock, a finished one a neutral circle with a green ring and tick (no green
fill, as a finished row has none): two hues, and only on
steps that run or have run. Each step's line comes in only once the agent has done it (or is waiting on something), and
the header sums the run up only once it is over. "edited" is quiet grey text */
:root[data-style="studio"] .plx.panel,:root [data-style="studio"] .plx.panel,:root [data-style="studio"].plx.panel{padding:16px 16px 0}
:root[data-style="studio"] .plx.panel.growing,:root [data-style="studio"] .plx.panel.growing,:root [data-style="studio"].plx.panel.growing{overflow-clip-margin:0px}
:root[data-style="studio"] .plx-h,:root [data-style="studio"] .plx-h,:root [data-style="studio"].plx-h{position:relative;gap:12px}
:root[data-style="studio"] .plx-h::before,:root [data-style="studio"] .plx-h::before,:root [data-style="studio"].plx-h::before{content:"";position:absolute;left:0;top:50%;width:32px;height:32px;margin-top:-16px;border-radius:calc(9px * var(--dm-rk-m,var(--dm-rk)));background:var(--dm-chip);box-shadow:inset 0 0 0 1px var(--dm-hair)}
:root[data-style="studio"] .plx-mk,:root [data-style="studio"] .plx-mk,:root [data-style="studio"].plx-mk{margin-inline:9px;color:var(--dm-accent-mark)}
:root[data-style="studio"] .plx-ht b,:root [data-style="studio"] .plx-ht b,:root [data-style="studio"].plx-ht b{line-height:20px}
:root[data-style="studio"] .plx-st,:root [data-style="studio"] .plx-st,:root [data-style="studio"].plx-st{line-height:18px}
:root[data-style="studio"] .plx-tm,:root [data-style="studio"] .plx-tm,:root [data-style="studio"].plx-tm{font-variant-numeric:tabular-nums}
:root[data-style="studio"] .plx-list,:root [data-style="studio"] .plx-list,:root [data-style="studio"].plx-list{margin:0 calc(-1 * var(--dm-s-2))}
:root[data-style="studio"] .plx-s,:root [data-style="studio"] .plx-s,:root [data-style="studio"].plx-s{gap:12px;padding:7px var(--dm-s-2);border-radius:calc(7px * var(--dm-rk-m,var(--dm-rk)));transition:background-color var(--dm-t-fast) var(--dm-ease),opacity var(--dm-t-fast) var(--dm-ease)}
:root[data-style="studio"] .plx-s .n,:root [data-style="studio"] .plx-s .n,:root [data-style="studio"].plx-s .n{margin:1px 6px 0;background:none;box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--dm-line-strong) 50%,transparent);transition:background-color var(--dm-t-fast) var(--dm-ease),box-shadow var(--dm-t-fast) var(--dm-ease),color var(--dm-t-fast) var(--dm-ease)}
@media (hover:hover) and (pointer:fine){:root[data-style="studio"] .plx-s:hover .n,:root [data-style="studio"] .plx-s:hover .n,:root [data-style="studio"].plx-s:hover .n{background:var(--dm-surface)}}
:root[data-style="studio"] .plx-s.run .n,:root [data-style="studio"] .plx-s.run .n,:root [data-style="studio"].plx-s.run .n{box-shadow:none;color:var(--dm-fg)}
:root[data-style="studio"] .plx-s.run .n .spin,:root [data-style="studio"] .plx-s.run .n .spin,:root [data-style="studio"].plx-s.run .n .spin{width:20px;height:20px;border:1.5px solid var(--dm-line);border-top-color:var(--dm-accent-mark);animation-duration:.9s}
:root[data-style="studio"] .plx-s.retry .n,:root [data-style="studio"] .plx-s.retry .n,:root [data-style="studio"].plx-s.retry .n{background:none;box-shadow:inset 0 0 0 1.5px var(--dm-warn-mark);color:var(--dm-warn-mark)}
:root[data-style="studio"] .plx-s.done .n,:root [data-style="studio"] .plx-s.done .n,:root [data-style="studio"].plx-s.done .n{background:var(--dm-surface);box-shadow:inset 0 0 0 1.5px var(--dm-ok-mark);color:var(--dm-ok-mark)}
:root[data-style="studio"] .plx-s.done .n .i,:root [data-style="studio"] .plx-s.done .n .i,:root [data-style="studio"].plx-s.done .n .i{width:11px;height:11px;stroke-width:2.4}
:root[data-style="studio"] .plx-s.edited .t::after,:root [data-style="studio"] .plx-s.edited .t::after,:root [data-style="studio"].plx-s.edited .t::after{color:var(--dm-muted)}
:root[data-style="studio"] .plx-add,:root [data-style="studio"] .plx-add,:root [data-style="studio"].plx-add{align-self:stretch;gap:12px;margin:-4px calc(-1 * var(--dm-s-2)) 0;padding:6px var(--dm-s-2);border-radius:calc(7px * var(--dm-rk-m,var(--dm-rk)));transition:background-color var(--dm-t-fast) var(--dm-ease),color var(--dm-t-fast) var(--dm-ease)}
:root[data-style="studio"] .plx-add .i,:root [data-style="studio"] .plx-add .i,:root [data-style="studio"].plx-add .i{margin-inline:10px}
:root[data-style="studio"] .plx.panel .plx-f .plx-stop,:root [data-style="studio"] .plx.panel .plx-f .plx-stop,:root [data-style="studio"].plx.panel .plx-f .plx-stop{margin-right:0}
:root[data-style="studio"] .plx.panel .plx-f,:root [data-style="studio"] .plx.panel .plx-f,:root [data-style="studio"].plx.panel .plx-f{justify-content:flex-end;gap:4px;margin:6px -16px 0;padding:var(--dm-strip-y) 16px;border-top:1px solid var(--dm-line);background:var(--dm-strip);border-radius:0 0 var(--dm-r-card) var(--dm-r-card)}
:root[data-style="studio"] .plx.panel .plx-n,:root [data-style="studio"] .plx.panel .plx-n,:root [data-style="studio"].plx.panel .plx-n{padding-left:0}
plan-review.jsHTML · 79 lines
DM.def('plan-review', (r, c) => {
r.innerHTML = r.innerHTML.replace('{plus}', I('plus','xs'));
// each step, and the line it reports when it's done
const S = [
['Read the pricing frames and the brand tokens', '6 frames and 42 tokens read'],
['Compare against the three competitor pages', '3 pages compared'],
['Simplify the plan cards to one CTA each', 'Plan cards now have one CTA each'],
['Move the FAQ below the comparison table', 'FAQ now sits under the table'],
['Write a summary of every change', 'Summary added to Pricing v4']
];
const list = $('.plx-list', r), st = $('.plx-st', r), tm = $('.plx-tm', r), go = $('.plx-go', r), f = $('.plx-f', r);
if (!r.closest('.ahx')) c.offs.push(hoverGlide(list, '.plx-s'));
const row = (t, i) => `<li class="plx-s"><span class="n">${i + 1}</span><span class="b"><span class="t" contenteditable="true" spellcheck="false" role="textbox" aria-label="Step ${i + 1}">${t[0]}</span><span class="d"><span></span></span></span><button class="ib plx-x mx-press" aria-label="Skip step" data-tip="Skip step">${I('x','xs')}</button></li>`;
list.innerHTML = S.map(row).join(''); stagger($$('.plx-s', list), 60, 100);
const count = () => { const on = $$('.plx-s:not(.off)', list); on.forEach((s, i) => $('.n', s).textContent = i + 1); $$('.plx-s.off .n', list).forEach(n => n.textContent = '–'); swap(st, 'About ' + Math.max(1, Math.round(on.length * .8)) + ' min'); };
function bind(s, done){
const t = $('.t', s), orig = t.textContent; s._done = done || 'Done';
t.onkeydown = e => { if (e.key === 'Enter'){ e.preventDefault(); t.blur(); } };
t.onblur = () => { const ed = t.textContent.trim() !== orig; s.classList.toggle('edited', ed); if (ed) s._done = 'Done as you wrote it'; };
$('.plx-x', s).onclick = () => { const off = s.classList.toggle('off'); $('.plx-x', s).dataset.tip = off ? 'Include step' : 'Skip step'; $('.plx-x', s).setAttribute('aria-label', off ? 'Include step' : 'Skip step'); const xb = $('.plx-x', s); iconSwap(xb, () => { xb.innerHTML = I(off ? 'undo' : 'x', 'xs'); }, { inner:true }); count(); };
}
$$('.plx-s', list).forEach((s, i) => bind(s, S[i][1]));
// the panel grows with the plan (owner, 17 Nov): no room kept for the final state, the height eases open as done lines
// and notes arrive, and the panel stays centred in its stage as it grows
const root = $('.plx', r);
c.offs.push(grow(root));
$('.plx-add', r).onclick = () => { const s = html(row(['New step'], $$('.plx-s', list).length)); list.appendChild(s); enter(s); bind(s); count(); const t = $('.t', s); t.focus({ preventScroll:true }); document.getSelection().selectAllChildren(t); };
$('.plx-chg', r).onclick = () => { swap($('.plx-n', r), 'Tell the agent what to change in chat'); };
const clock = ms => { const s = Math.floor(ms / 1000); return Math.floor(s / 60) + ':' + String(s % 60).padStart(2, '0'); };
const note = (s, text, tone) => { const d = $('.d', s); d.className = 'd on' + (tone ? ' ' + tone : ''); swap(d.firstElementChild, text); };
// the person's turn (editing and approving the plan) holds under a resting mouse, so it never moves what they are about to
// click; once approved, the agent's run keeps working under it, as an agent at work does (DM.PLAYS): its waits go through a
// controller of its own, which nothing holds, and stop with the demo
const agent = ctl(); c.offs.push(() => agent.stop());
go.onclick = () => c.run(async () => {
$$('.t', list).forEach(t => { t.contentEditable = 'false'; t.removeAttribute('role'); }); $('.plx-add', r).hidden = true;
// the approved plan is fixed: the skip buttons keep their space but can't be used
$$('.plx-x', list).forEach(b => { b.disabled = true; b.style.visibility = 'hidden'; });
// the status line says it is running and how long is left; the foot keeps only Stop (no line repeating the head)
f.innerHTML = `<span class="muted plx-n"></span><button class="pill ghost sm plx-stop mx-press">${I('stop','xs')}Stop</button>`; stagger([...f.children], 50);
let stop = false; $('.plx-stop', f).onclick = () => stop = true;
$('.plx-mk', r).classList.add('on');
const t0 = performance.now(), tick = agent.every(250, () => tm.textContent = clock(performance.now() - t0)); tm.textContent = '0:00'; enter(tm);
const on = $$('.plx-s:not(.off)', list), n = s => $('.n', s), txt = s => $('.t', s);
try {
for (let i = 0; i < on.length && !stop; i++){
const s = on[i]; s.classList.add('run'); txt(s).classList.add('shim'); n(s).innerHTML = '<span class="spin"></span>'; st.classList.add('shim'); swap(st, 'About ' + Math.max(1, Math.round((on.length - i) * .8)) + ' min left'); await agent.wait(900);
// the second step hits a rate limit: the agent waits it out, counting down, and tries again
if (s === $$('.plx-s', list)[1] && !stop){
s.classList.replace('run', 'retry'); txt(s).classList.remove('shim'); iconSwap(n(s), () => { n(s).innerHTML = I('clock','xs'); }, { inner:true });
for (let k = 3; k > 0 && !stop; k--){ note(s, `Rate limited by the browser tool. Retrying in ${k}s`, 'warn'); await agent.wait(1000); }
if (stop) break;
s.classList.replace('retry', 'run'); txt(s).classList.add('shim'); iconSwap(n(s), () => { n(s).innerHTML = '<span class="spin"></span>'; }, { inner:true }); note(s, 'Retrying'); $('.d>span', s).classList.add('shim'); await agent.wait(700);
s._done += ', after 1 retry';
}
s.classList.remove('run'); txt(s).classList.remove('shim'); $('.d>span', s).classList.remove('shim'); s.classList.add('done'); iconSwap(n(s), () => { n(s).innerHTML = I('check','xs'); }, { inner:true }); note(s, s._done);
}
} finally { clearInterval(tick); }
$('.plx-mk', r).classList.remove('on');
$$('.plx-s.run', list).forEach(s => { s.classList.remove('run', 'retry'); txt(s).classList.remove('shim'); $('.d>span', s).classList.remove('shim'); n(s).textContent = '–'; note(s, 'Not started'); });
// a finished plan has no elapsed clock (owner, 18 Nov): the status line says how long it took
// See changes is the white outlined secondary (owner, 23 Nov); inside Agent harness (Phase II) it keeps its grey one for now
tm.textContent = ''; st.classList.remove('shim');
swap(st, stop ? 'Stopped, progress kept' : 'Done in ' + clock(performance.now() - t0) + '. 4 frames updated'); f.innerHTML = `<span class="muted plx-n"></span><button class="pill ${r.closest('.ahx') ? 'soft' : 'line mx-press'} sm">${I('eye','xs')}See changes</button>`; enter(f.lastElementChild);
});
// the preview's story: rewrite a step, approve, and watch the agent work through a rate limit to the end
c.story(async s => {
await s.beat(3);
const step = $$('.plx-s', list)[2], t = $('.t', step);
// the demo types into the step without taking the focus: a caret would make the page follow it
await s.tap(t); await s.beat(1);
for (const ch of ' each'){ t.textContent = t.textContent.slice(0, -1); await s.beat(.12); }
for (const ch of ', annual price first'){ t.textContent += ch; await s.beat(.09); }
await s.beat(1); t.onblur(); await s.beat(2);
await s.tap(go); s.away();
await s.until(() => $('.plx-f .pill:is(.line,.soft)', r));
});
});
Questions
What people ask about it.
- How do I start the agent once the plan is approved?
- Handle
onApprove, setphasetorunning, and mark steps withstate: 'run'and'done'as your agent works. Setphasetodoneat the end. - How do I get the edited plan back?
- Pass
stepsandonStepsChangeto control the list. Each step comes back with its newtext, pluseditedandskippedflags you can send to the agent. - Can I stop the agent halfway?
- In the
runningphase the footer shows a Stop button that callsonStop. Stopping the agent and updating the phase is up to your code. - Can it sit on its own instead of inside a chat?
- Yes. It draws its own container by default. Set
bareto sit it flat in a chat thread.
More in Review and approve
Moments where a person checks, steers or signs off on the agent's work.