Land GUI planning adoption slice

This commit is contained in:
Meta Vens 2026-05-01 07:57:55 +01:00
commit 218f885e0b
13 changed files with 979 additions and 23 deletions

View file

@ -7,6 +7,7 @@ import {
Eye,
FileText,
GitBranch,
ListChecks,
Play,
RefreshCw,
} from "lucide-react";
@ -25,8 +26,9 @@ const actionButtons: Array<{
requiresModelingPatch?: boolean;
requiresVerificationResult?: boolean;
requiresReorientResult?: boolean;
requiresPlanningDraft?: boolean;
requiresContinueImplementation?: boolean;
icon: "file" | "check" | "play" | "eye" | "accept" | "runtime";
icon: "file" | "check" | "play" | "eye" | "accept" | "runtime" | "plan";
}> = [
{
action: "statusSnapshot",
@ -56,6 +58,16 @@ const actionButtons: Array<{
title: "Seed durable Epiphany state for this GUI operator thread",
icon: "accept",
},
{
action: "adoptObjectiveDraft",
label: "Adopt Draft",
runningLabel: "Adopting",
title: "Adopt the selected Objective Draft as the active implementation objective",
requiresThread: true,
requiresReadyState: true,
requiresPlanningDraft: true,
icon: "plan",
},
{
action: "continueImplementation",
label: "Continue Implementation",
@ -166,6 +178,14 @@ function listText(value: unknown, fallback = "none"): string {
return Array.isArray(value) && value.length > 0 ? value.map(String).join(", ") : fallback;
}
function objectList(value: unknown): any[] {
return Array.isArray(value) ? value.filter((item) => item && typeof item === "object") : [];
}
function countText(value: unknown): string {
return typeof value === "number" ? String(value) : text(value, "0");
}
function statusClass(value: unknown): string {
const lower = text(value).toLowerCase();
if (lower.includes("blocked") || lower.includes("critical") || lower.includes("regather")) return "danger";
@ -246,6 +266,13 @@ export function App() {
return [...lanes].sort((a, b) => roleOrder.indexOf(text(a.id)) - roleOrder.indexOf(text(b.id)));
}, [status]);
const jobs: any[] = Array.isArray(status?.jobs?.jobs) ? status.jobs.jobs : [];
const planningResponse = status?.planning ?? {};
const planningState = planningResponse?.planning ?? {};
const planningSummary = planningResponse?.summary ?? {};
const planningCaptures = objectList(planningState?.captures);
const backlogItems = objectList(planningState?.backlog_items ?? planningState?.backlogItems);
const roadmapStreams = objectList(planningState?.roadmap_streams ?? planningState?.roadmapStreams);
const objectiveDrafts = objectList(planningState?.objective_drafts ?? planningState?.objectiveDrafts);
const roleResults = status?.roleResults ?? {};
const reorientResult = status?.reorientResult ?? {};
const latestArtifact = snapshot?.artifacts?.[0];
@ -269,12 +296,30 @@ export function App() {
const canAcceptVerification = text(roleResults?.verification?.status).toLowerCase() === "completed";
const canAcceptReorient = text(reorientResult?.status).toLowerCase() === "completed";
const canContinueImplementation = text(coordinator.action).toLowerCase() === "continueimplementation";
const selectedDraft = objectiveDrafts.find((draft) => text(draft.id, "") === request.planningDraftId);
const selectedDraftStatus = text(selectedDraft?.status).toLowerCase();
const canAdoptDraft =
Boolean(selectedDraft) && !["adopted", "rejected", "superseded"].includes(selectedDraftStatus);
const unityBridge = latestRuntimeAudit?.editorBridge;
const installedEditors = latestRuntimeAudit?.installedEditors ?? [];
const candidatePaths = latestRuntimeAudit?.candidatePaths ?? [];
const searchRoots = latestRuntimeAudit?.searchRoots ?? [];
const unityBridgeReady = latestRuntimeAudit?.status === "ready" && unityBridge?.exists === true;
useEffect(() => {
if (objectiveDrafts.length === 0) return;
const draftIds = new Set(objectiveDrafts.map((draft) => text(draft.id, "")).filter(Boolean));
setRequest((current) => {
if (current.planningDraftId && draftIds.has(current.planningDraftId)) {
return current;
}
const firstDraft =
objectiveDrafts.find((draft) => text(draft.status).toLowerCase() === "draft") ?? objectiveDrafts[0];
const firstDraftId = text(firstDraft?.id, "");
return firstDraftId ? { ...current, planningDraftId: firstDraftId } : current;
});
}, [objectiveDrafts, setRequest]);
return (
<main className="shell">
<header className="topbar">
@ -314,6 +359,7 @@ export function App() {
const needsModeling = button.requiresModelingPatch && !canAcceptModeling;
const needsVerification = button.requiresVerificationResult && !canAcceptVerification;
const needsReorient = button.requiresReorientResult && !canAcceptReorient;
const needsPlanningDraft = button.requiresPlanningDraft && !canAdoptDraft;
const needsImplementation = button.requiresContinueImplementation && !canContinueImplementation;
const needsNoDiffReview = button.requiresContinueImplementation && implementationNoDiffPending;
const disabled =
@ -323,6 +369,7 @@ export function App() {
needsModeling ||
needsVerification ||
needsReorient ||
needsPlanningDraft ||
needsImplementation ||
needsNoDiffReview;
const title = needsThread
@ -335,11 +382,13 @@ export function App() {
? "Read a completed verification result before accepting it"
: needsReorient
? "Read a completed reorient result before accepting it"
: needsImplementation
? "Run the coordinator and clear review gates before continuing implementation"
: needsNoDiffReview
? "Review the latest no-diff implementation artifact or run another lane before retrying"
: button.title;
: needsPlanningDraft
? "Select a draft objective that has not already been adopted"
: needsImplementation
? "Run the coordinator and clear review gates before continuing implementation"
: needsNoDiffReview
? "Review the latest no-diff implementation artifact or run another lane before retrying"
: button.title;
return (
<button
className="secondaryButton"
@ -450,6 +499,118 @@ export function App() {
</div>
</section>
<section className="sectionBand">
<SectionHeader title="Planning" icon={<ListChecks size={18} />} />
<div className="planningGrid">
<article className="environmentCard planningSummary">
<div className="cardTopline">
<h3>State</h3>
<Pill tone={statusClass(planningResponse?.stateStatus)}>
{text(planningResponse?.stateStatus, "missing")}
</Pill>
</div>
<dl className="facts environmentFacts">
<div><dt>Captures</dt><dd>{countText(planningSummary?.captureCount)}</dd></div>
<div><dt>Pending</dt><dd>{countText(planningSummary?.pendingCaptureCount)}</dd></div>
<div><dt>Backlog</dt><dd>{countText(planningSummary?.backlogItemCount)}</dd></div>
<div><dt>Ready</dt><dd>{countText(planningSummary?.readyBacklogItemCount)}</dd></div>
<div><dt>Streams</dt><dd>{countText(planningSummary?.roadmapStreamCount)}</dd></div>
<div><dt>Drafts</dt><dd>{countText(planningSummary?.objectiveDraftCount)}</dd></div>
</dl>
<label className="draftPicker">
Objective Draft
<select
value={request.planningDraftId ?? ""}
onChange={(event) =>
setRequest({ ...request, planningDraftId: event.target.value || undefined })
}
disabled={objectiveDrafts.length === 0}
>
<option value="">none</option>
{objectiveDrafts.map((draft) => (
<option value={text(draft.id, "")} key={text(draft.id)}>
{text(draft.title)} [{text(draft.status)}]
</option>
))}
</select>
</label>
<PathList title="Roadmap" items={roadmapStreams.map((stream) => `${text(stream.id)}: ${text(stream.title)}`)} />
{planningSummary?.note && <p className="environmentNote">{text(planningSummary.note)}</p>}
</article>
<div className="planningColumn">
<div className="cardTopline planningColumnHeader">
<h3>Objective Drafts</h3>
<Pill tone={objectiveDrafts.length ? "warn" : "neutral"}>{objectiveDrafts.length}</Pill>
</div>
{objectiveDrafts.slice(0, 4).map((draft) => (
<PlanningItem
key={text(draft.id)}
title={text(draft.title)}
status={text(draft.status)}
selected={text(draft.id, "") === request.planningDraftId}
body={text(draft.summary)}
meta={[
text(draft.id),
`${
Array.isArray(draft.acceptance_criteria ?? draft.acceptanceCriteria)
? (draft.acceptance_criteria ?? draft.acceptanceCriteria).length
: 0
} checks`,
listText(draft.source_item_ids ?? draft.sourceItemIds),
]}
/>
))}
{objectiveDrafts.length === 0 && <EmptyState label="No objective drafts loaded." />}
</div>
<div className="planningColumn">
<div className="cardTopline planningColumnHeader">
<h3>Backlog</h3>
<Pill tone={backlogItems.length ? "ok" : "neutral"}>{backlogItems.length}</Pill>
</div>
{backlogItems.slice(0, 4).map((item) => (
<PlanningItem
key={text(item.id)}
title={text(item.title)}
status={text(item.status)}
body={text(item.summary)}
meta={[
text(item.priority?.value),
text(item.horizon),
text(item.product_area ?? item.productArea),
]}
/>
))}
{backlogItems.length === 0 && <EmptyState label="No backlog items loaded." />}
</div>
<div className="planningColumn">
<div className="cardTopline planningColumnHeader">
<h3>Captures</h3>
<Pill tone={planningCaptures.length ? "neutral" : "neutral"}>{planningCaptures.length}</Pill>
</div>
{planningCaptures.slice(0, 4).map((capture) => {
const source = capture.source ?? {};
const sourceLabel =
source.repo && source.issue_number
? `${source.repo}#${source.issue_number}`
: text(source.kind);
return (
<PlanningItem
key={text(capture.id)}
title={text(capture.title)}
status={text(capture.status)}
body={text(capture.body)}
meta={[text(capture.confidence), sourceLabel, listText(capture.tags)]}
/>
);
})}
{planningCaptures.length === 0 && <EmptyState label="No captures loaded." />}
</div>
</div>
</section>
<section className="statusGrid" aria-label="Coordinator summary">
<Panel title="Recommendation" icon={<ClipboardCheck size={18} />}>
<div className={`actionBanner ${statusClass(coordinator.action ?? crrc.action)}`}>
@ -560,12 +721,13 @@ function SectionHeader({ title, icon }: { title: string; icon: React.ReactNode }
);
}
function ActionIcon({ icon }: { icon: "file" | "check" | "play" | "eye" | "accept" | "runtime" }) {
function ActionIcon({ icon }: { icon: "file" | "check" | "play" | "eye" | "accept" | "runtime" | "plan" }) {
if (icon === "file") return <FileText size={16} aria-hidden="true" />;
if (icon === "check") return <ClipboardCheck size={16} aria-hidden="true" />;
if (icon === "play") return <Play size={16} aria-hidden="true" />;
if (icon === "eye") return <Eye size={16} aria-hidden="true" />;
if (icon === "runtime") return <Database size={16} aria-hidden="true" />;
if (icon === "plan") return <ListChecks size={16} aria-hidden="true" />;
return <CheckCircle2 size={16} aria-hidden="true" />;
}
@ -597,6 +759,32 @@ function Finding({ title, result, findingKey = "finding" }: { title: string; res
);
}
function PlanningItem({
title,
status,
body,
meta,
selected = false,
}: {
title: string;
status: string;
body: string;
meta: string[];
selected?: boolean;
}) {
const metaItems = meta.filter((item) => item && item !== "none");
return (
<article className={`planningItem ${selected ? "selected" : ""}`}>
<div className="cardTopline">
<h3>{title}</h3>
<Pill tone={statusClass(status)}>{status}</Pill>
</div>
<p>{body}</p>
{metaItems.length > 0 && <span className="planningMeta">{metaItems.join(" / ")}</span>}
</article>
);
}
function ArtifactOutcome({ artifact }: { artifact: ArtifactBundle }) {
const audit = artifact.implementationAudit;
const runtime = artifact.runtimeAudit;

View file

@ -22,7 +22,8 @@ body {
}
button,
input {
input,
select {
font: inherit;
}
@ -136,7 +137,8 @@ label {
font-weight: 700;
}
input {
input,
select {
width: 100%;
min-height: 38px;
border: 1px solid #ccd4ca;
@ -146,6 +148,24 @@ input {
background: #ffffff;
}
select {
appearance: none;
padding-right: 34px;
background:
linear-gradient(45deg, transparent 50%, #526157 50%),
linear-gradient(135deg, #526157 50%, transparent 50%),
#ffffff;
background-position:
calc(100% - 17px) 16px,
calc(100% - 11px) 16px,
0 0;
background-size:
6px 6px,
6px 6px,
100% 100%;
background-repeat: no-repeat;
}
.notice,
.panel,
.laneCard,
@ -325,6 +345,56 @@ dd {
background: #ffffff;
}
.planningGrid {
display: grid;
grid-template-columns: minmax(260px, 0.9fr) repeat(3, minmax(220px, 1fr));
gap: 12px;
}
.planningColumn {
display: grid;
align-content: start;
gap: 10px;
min-width: 0;
}
.planningColumnHeader {
min-height: 30px;
}
.draftPicker {
margin-top: 12px;
}
.planningItem {
min-width: 0;
border: 1px solid #d9ded5;
border-radius: 8px;
padding: 12px;
background: #ffffff;
}
.planningItem.selected {
border-color: #78a986;
box-shadow: inset 3px 0 0 #2f7a49;
}
.planningItem p {
margin-top: 9px;
color: #435045;
font-size: 0.86rem;
line-height: 1.38;
}
.planningMeta {
display: block;
margin-top: 10px;
overflow-wrap: anywhere;
color: #667168;
font-size: 0.76rem;
font-weight: 700;
}
.environmentFacts {
grid-template-columns: repeat(2, minmax(0, 1fr));
}
@ -471,6 +541,10 @@ code {
.environmentGrid {
grid-template-columns: 1fr;
}
.planningGrid {
grid-template-columns: repeat(2, minmax(220px, 1fr));
}
}
@media (max-width: 640px) {
@ -489,6 +563,7 @@ code {
}
.cardGrid,
.planningGrid,
.facts,
.facts.compact,
.artifactHeader,

View file

@ -3,6 +3,7 @@ export interface StatusRequest {
cwd?: string;
codexHome?: string;
appServer?: string;
planningDraftId?: string;
}
export type OperatorAction =
@ -17,6 +18,7 @@ export type OperatorAction =
| "launchVerification"
| "readVerificationResult"
| "acceptVerification"
| "adoptObjectiveDraft"
| "launchReorient"
| "readReorientResult"
| "acceptReorient";