From 840344706f3a8b0894730b6303ceffd58770dbbb Mon Sep 17 00:00:00 2001 From: Codex Date: Sat, 12 Sep 2026 14:00:52 +0200 Subject: [PATCH] prototype: restore original Core within context shelf alternatives --- frontend/prototypes/context-shelf/App.tsx | 21 +-- .../context-shelf/OriginalCorePreview.tsx | 126 ++++++++++++++++++ frontend/prototypes/context-shelf/README.md | 27 ++++ frontend/prototypes/context-shelf/shelf.css | 9 ++ frontend/vite.context-shelf.config.ts | 2 +- 5 files changed, 175 insertions(+), 10 deletions(-) create mode 100644 frontend/prototypes/context-shelf/OriginalCorePreview.tsx diff --git a/frontend/prototypes/context-shelf/App.tsx b/frontend/prototypes/context-shelf/App.tsx index dcc582ea..a31930c0 100644 --- a/frontend/prototypes/context-shelf/App.tsx +++ b/frontend/prototypes/context-shelf/App.tsx @@ -2,11 +2,12 @@ import { useEffect, useRef, useState } from "react"; import { ArrowLeft, ArrowRight, ArrowUpRight, BookOpen, Check, ChevronDown, ChevronRight, Cpu, Database, FileText, FolderClock, Layers, LayoutDashboard, LockKeyhole, Menu, MessageSquare, Play, Search, Settings2, ShieldCheck, SlidersHorizontal, Terminal, Users, X } from "lucide-react"; import { Content, type ContentProps, type ConnectionValues } from "../application-context/Content"; import { Button } from "../application-context/ui"; +import { OriginalCorePreview } from "./OriginalCorePreview"; import { inventory, type Item, type Scenario, type Surface, type Variant } from "../administration-review/model"; import { models, modules, readLocation, sessions, variants, workspaces, type Job, type Page, type Route, type Session } from "./model"; -// Three complete-app proposals on the established namespaced routes. V3 is a -// disposable simulation, with no API, persistence, authorization or server writes. +// Three context/admin proposals around the unchanged Core layout. V4 is a +// disposable simulation with remembered demo preferences, but no production API writes. const icons = { core: MessageSquare, sessions: FolderClock, database: Database, memory: BookOpen, evidence: FileText, workspace: Layers, pi: Terminal }; const titles: Record = { core: "Analytical workspace", sessions: "Sessions", database: "Database", memory: "Memory", evidence: "Evidence", workspace: "Workspace", pi: "Pi runtime" }; import { SessionRail } from "./SessionRail"; @@ -25,6 +26,7 @@ export function App() { const [width, setWidth] = useState("full"); const [portalOpen, setPortalOpen] = useState(false); const [navOpen, setNavOpen] = useState(false); + const [coreActivityOpen, setCoreActivityOpen] = useState(false); const [shelfOpen, setShelfOpen] = useState(initialPreferences.invalid); const [notice, setNotice] = useState(initialPreferences.invalid ? "A remembered choice is no longer available. Choose a valid workspace and model; no alternative has been selected silently." : ""); const [dirty, setDirty] = useState(false); @@ -41,7 +43,6 @@ export function App() { const [active, setActive] = useState(null); const [resumeTarget, setResumeTarget] = useState(null); const [question, setQuestion] = useState(""); - const [artifact, setArtifact] = useState("Question"); const [scenario, setScenario] = useState("ready"); const model = models.find(m => m.id === modelId); const currentWorkspace = workspaces.find(w => w.id === workspace); @@ -119,7 +120,7 @@ export function App() { } function resume(s: Session) { if (busy || !ready || s.status === "archived" || availability === "needs-preprocessing" || !canLeave()) return; - saveChoice({ workspace: s.workspace }); setActive(s); setResumeTarget(null); resetDetail(); setQuestion(""); setArtifact("Question"); + saveChoice({ workspace: s.workspace }); setActive(s); setResumeTarget(null); resetDetail(); setQuestion(""); writeRoute({ ...route, workspace: s.workspace, page: "core" }); setOperation({ id: Date.now(), label: `Resume: ${s.title}`, workspace: s.workspace, model: modelId, state: "running" }); setNotice("Proposed resume: the original workspace and revision are retained; this run uses the globally selected model. Backend changes are required."); @@ -150,10 +151,12 @@ export function App() { const title = question.trim(); setActive({ id: `demo-${Date.now()}`, title, workspace, revision: "a71c9f2", status: "paused", lastModel: modelId, phase: 1 }); setQuestion(""); setDirty(false); startJob(`Analysis: ${title}`, "llm"); } - const core = <>{pageHeader(active ? active.title : "From a question to a trusted answer", active ? "Persisted artifacts and reviewer decisions guide this session." : "Ask about your data. Review the evidence, approve the interpretation, then build the query.")} - {availability === "needs-preprocessing" &&
Prepare this workspace before starting the core

Workspace and model are selected. Administration remains available so you can complete preprocessing.

} - {active ?
{currentWorkspace?.name}Session revision {active.revision}{active.status === "archived" ? "Read-only archive" : activeJob ? `Run model: ${models.find(m => m.id === activeJob.model)?.name}` : `Next AI operation: ${model?.name}`}
    {["Question", "Schema linking", "SQL draft", "Validation"].map((t,i) =>
  1. {String(i+1).padStart(2,"0")}{t}
  2. )}
Workflow excerpt · 8 phases in production

Persisted artifact · example

{artifact === "Question" ? "Domanda analitica" : artifact === "Schema" ? "Collegamento allo schema" : "Query proposta"}

{artifact === "SQL" ?
{`SELECT COUNT(DISTINCT patient_id)\nFROM ${currentWorkspace?.schema}.visits\nWHERE visited_at >= DATE '2025-01-01'\n  AND visited_at < DATE '2026-01-01';`}
: <>

{artifact === "Question" ? active.title : "La relazione tra pazienti e visite definisce la popolazione osservata. Il conteggio deve mantenere distinti i pazienti."}

Evidence: popolazione di riferimento

Synthetic illustration, not generated from a database.

}

Human review

{active.status === "archived" ? "Retained decisions" : activeJob ? "AI operation in progress" : "Confirm the interpretation"}

{active.status === "archived" ? "This archive can be inspected, but its workflow cannot currently be resumed." : activeJob ? "Workspace and model are locked until this operation finishes. No other operation can start in the meantime." : "Check the proposed population and time range before proceeding."}

{active.status !== "archived" && }

{active.status === "archived" ? "Archived and finalized sessions remain read-only." : "Model output proposes. The reviewer decides."}

:

Start an analytical question

{currentWorkspace?.database} · Evidence and Memory in this workspace

{ e.preventDefault(); submitQuestion(); }}>