diff --git a/apps/epiphany-gui/public/operator-snapshot.sample.json b/apps/epiphany-gui/public/operator-snapshot.sample.json index 91135995..30fd1279 100644 --- a/apps/epiphany-gui/public/operator-snapshot.sample.json +++ b/apps/epiphany-gui/public/operator-snapshot.sample.json @@ -12,6 +12,7 @@ "context", "jobs", "roles", + "planning", "coordinator", "roleLaunch", "roleResult", @@ -109,6 +110,132 @@ } ] }, + "planning": { + "threadId": "019dd9d1-045b-7f13-b0e1-38ed89b31495", + "source": "live", + "stateStatus": "ready", + "stateRevision": 3, + "planning": { + "workspace_root": "E:\\Projects\\EpiphanyAgent", + "captures": [ + { + "id": "capture-github-planning", + "title": "Import GitHub issue into planning inbox", + "body": "Issues should become planning captures before becoming objectives.", + "confidence": "observed", + "status": "inbox", + "speaker": "human", + "tags": ["github", "backlog"], + "source": { + "kind": "github_issue", + "provider": "github", + "repo": "GameCult/EpiphanyAgent", + "issue_number": 42, + "url": "https://github.com/GameCult/EpiphanyAgent/issues/42", + "state": "open", + "labels": ["planning", "mvp"], + "assignees": ["Meta"], + "author": "Meta", + "created_at": "2026-05-01T10:00:00Z", + "updated_at": "2026-05-01T10:05:00Z", + "imported_at": "2026-05-01T10:10:00Z" + }, + "created_at": "2026-05-01T10:10:00Z", + "updated_at": "2026-05-01T10:10:00Z" + }, + { + "id": "capture-chat-planning", + "title": "Draft objectives from chat after bounding them", + "body": "Discussion remains planning material until it becomes a firm artifact.", + "confidence": "medium", + "status": "triaged", + "speaker": "human", + "tags": ["chat", "objective"], + "source": { + "kind": "chat", + "uri": "codex://threads/planning-smoke", + "external_id": "turn-planning-smoke" + }, + "created_at": "2026-05-01T10:12:00Z", + "updated_at": "2026-05-01T10:12:00Z" + } + ], + "backlog_items": [ + { + "id": "backlog-planning-dashboard", + "title": "Expose planning state in the Epiphany dashboard", + "kind": "feature", + "summary": "Show captures, backlog, roadmap streams, and objective drafts.", + "status": "ready", + "horizon": "near", + "priority": { + "value": "high", + "rationale": "Planning needs a visible user review loop before automation.", + "impact": "user-steering", + "urgency": "soon", + "confidence": "medium", + "effort": "small", + "unblocks": ["objective-adoption"] + }, + "confidence": "medium", + "product_area": "epiphany-gui", + "lane_hints": ["imagination", "hands", "soul"], + "acceptance_sketch": ["Dashboard can render typed planning records."], + "source_refs": [], + "updated_at": "2026-05-01T10:15:00Z" + } + ], + "roadmap_streams": [ + { + "id": "stream-user-steering", + "title": "Human-steered planning", + "purpose": "Keep future work visible and bounded before implementation starts.", + "status": "active", + "item_ids": ["backlog-planning-dashboard"], + "near_term_focus": "backlog-planning-dashboard", + "review_cadence": "per objective" + } + ], + "objective_drafts": [ + { + "id": "draft-planning-dashboard", + "title": "Build the planning dashboard slice", + "summary": "Render planning records and let the user adopt one bounded objective.", + "source_item_ids": ["backlog-planning-dashboard"], + "scope": { + "includes": ["read-only planning projection", "objective draft review"], + "excludes": ["automatic objective adoption"] + }, + "acceptance_criteria": [ + "Planning records render without changing thread state.", + "A draft objective remains review-gated." + ], + "evidence_required": ["live smoke", "GUI screenshot"], + "lane_plan": { + "imagination": "organize planning records into a bounded objective candidate", + "eyes": "check prior art and GitHub issue metadata shape", + "hands": "wire dashboard controls after the read-only surface is stable", + "soul": "verify no planning record silently becomes active objective" + }, + "risks": ["accidental objective adoption"], + "review_gates": ["human adoption"], + "status": "draft" + } + ] + }, + "summary": { + "captureCount": 2, + "pendingCaptureCount": 1, + "githubIssueCaptureCount": 1, + "backlogItemCount": 1, + "readyBacklogItemCount": 1, + "roadmapStreamCount": 1, + "objectiveDraftCount": 1, + "draftObjectiveCount": 1, + "activeObjective": "Reach a testable Epiphany MVP through the local GUI/operator workflow.", + "note": "Planning substrate is available. These records are planning state only until a human explicitly adopts an objective." + } + }, "roleResults": { "modeling": { "bindingId": "modeling-checkpoint-worker", diff --git a/apps/epiphany-gui/scripts/visual-smoke.mjs b/apps/epiphany-gui/scripts/visual-smoke.mjs index 795c7419..689382aa 100644 --- a/apps/epiphany-gui/scripts/visual-smoke.mjs +++ b/apps/epiphany-gui/scripts/visual-smoke.mjs @@ -53,9 +53,12 @@ async function smokeViewport(browser, viewport, screenshotPath) { await page.getByRole("heading", { name: "Environment" }).waitFor(); await page.getByText("Unity Editor").waitFor(); await page.getByText("Rider").waitFor(); + await page.getByRole("heading", { name: "Planning", exact: true }).waitFor(); + await page.getByRole("heading", { name: "Build the planning dashboard slice", exact: true }).waitFor(); await page.getByText("Role Lanes").waitFor(); await page.getByText("Artifact Bundles").waitFor(); await page.getByRole("button", { name: "Prepare Checkpoint" }).waitFor(); + await page.getByRole("button", { name: "Adopt Draft" }).waitFor(); await page.getByRole("button", { name: "Launch Modeling" }).waitFor(); await page.getByRole("button", { name: "Read Modeling" }).waitFor(); await page.getByRole("button", { name: "Launch Verification" }).waitFor(); diff --git a/apps/epiphany-gui/src-tauri/src/lib.rs b/apps/epiphany-gui/src-tauri/src/lib.rs index 7d4b7ec0..e9c71dec 100644 --- a/apps/epiphany-gui/src-tauri/src/lib.rs +++ b/apps/epiphany-gui/src-tauri/src/lib.rs @@ -12,6 +12,7 @@ struct StatusRequest { cwd: Option, codex_home: Option, app_server: Option, + planning_draft_id: Option, } #[derive(Debug, Serialize)] @@ -116,6 +117,7 @@ fn run_operator_action( | "launchVerification" | "readVerificationResult" | "acceptVerification" + | "adoptObjectiveDraft" | "launchReorient" | "readReorientResult" | "acceptReorient" @@ -348,6 +350,9 @@ fn run_gui_action_bridge( if let Some(app_server) = request.app_server { command.arg("--app-server").arg(app_server); } + if let Some(planning_draft_id) = request.planning_draft_id { + command.arg("--planning-draft-id").arg(planning_draft_id); + } let value = run_json_command(command, &action)?; Ok(OperatorActionResult { action, diff --git a/apps/epiphany-gui/src/App.tsx b/apps/epiphany-gui/src/App.tsx index e1abba82..e65f74ee 100644 --- a/apps/epiphany-gui/src/App.tsx +++ b/apps/epiphany-gui/src/App.tsx @@ -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 (
@@ -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 (