nandi/oripublic Fork 0
35061753be581c0ba47a3189520d64e7788c183d
Commits
Clone
git clone https://git.rickub.com/nandi/ori.git
git clone ssh://git@rickub.com/nandi/ori.git

Host key fingerprint (ed25519): SHA256:iycHnxEyq0Q7uyVpB7JlznP0G7JrTPXLYRcAU5CSLhc — verify it before your first connect.

forked from bots-garden/ori

PlanView.tsx · 39 lines · 1.2 KBTypeScript Blame HistoryRaw
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/**
 * PlanView renders the agent's current execution plan (ACP "plan" updates)
 * as a compact checklist, like the plan block of Zed's agent panel.
 *
 * @example
 * <PlanView entries={[{ content: "Read the code", priority: "medium", status: "completed" }]} />
 */

import type { AcpPlanEntry } from "../protocol";
import { InlineText } from "./InlineText";

const statusMarks: Record<string, string> = {
	pending: "○",
	in_progress: "◐",
	completed: "●",
};

export function PlanView({ entries }: { entries: AcpPlanEntry[] }) {
	if (entries.length === 0) {
		return null;
	}
	return (
		<details className="plan" open>
			<summary className="plan-summary">
				Plan ({entries.filter((e) => e.status === "completed").length}/
				{entries.length})
			</summary>
			<ul className="plan-entries">
				{entries.map((entry, index) => (
					// biome-ignore lint/suspicious/noArrayIndexKey: ACP plan entries carry no id and the list is replaced wholesale on every update.
					<li key={index} className={`plan-entry plan-entry-${entry.status}`}>
						<span aria-hidden>{statusMarks[entry.status] ?? "○"}</span>{" "}
						<InlineText text={entry.content} />
					</li>
				))}
			</ul>
		</details>
	);
}