* feat(webui): inspect file context in a live graph sidebar * refactor(webui): place preview controls in the shared sidebar header * fix(webui): synchronize npm lockfile for graph dependencies * fix(webui): preserve compacted context and refine graph inspection * fix(context): harden provenance, request usage, and drawer lifecycle * fix(webui): align source skeleton and browser fixtures * perf(context): reuse source analysis and capture request graphs once * perf(webui): compact graph history and render graph motion on canvas * fix(webui): remove redundant context sidebar header * style(webui): clarify context replay icon * perf(webui): pace context replay on an adaptive timeline * feat(webui): briefly reveal labels for new context nodes * fix(webui): reveal new labels only for loaded context files * fix(webui): restart graph animation clock after idle * fix(webui): reveal labels when replay reverses node exit * refactor(context): project file-use facts without retention tracking * refactor(context): observe file reads outside agent execution * fix(webui): animate context sidebar closing * refactor(context): remove unused graph and usage panel code * refactor(context): isolate prompt observation from execution metadata * fix(webui): clarify cache rate and show context token usage * fix(webui): abbreviate context token counts in thousands * fix(webui): omit token unit from context usage details * fix(webui): restore large source preview highlighting and panel elevation * fix(webui): distinguish modifier scrolling from keyboard focus * fix(webui): align preview tab and panel corner radii * fix(webui): attach file tabs to the header divider * fix(webui): use one action to toggle file preview mode * fix(webui): use hover hint for context replay * fix(webui): share composer layout between graph and file sidebars * fix(webui): align sidebar bottom with composer surface * fix(webui): restore mobile graph drawing and touch file details * test(webui): align legacy cache assertions with current label * perf(context): retain source analysis and bound graph animation work * style(webui): add light elevation to user messages * test(webui): await lazy graph scene before replay assertions * fix(webui): align preview skeleton and browser contracts
40 lines
2.9 KiB
TypeScript
40 lines
2.9 KiB
TypeScript
import { useState } from "react";
|
|
import { createRoot } from "react-dom/client";
|
|
import { ContextInspector } from "@/components/thread/ContextInspector";
|
|
import { ComposerUsagePopover } from "@/components/thread/ComposerUsagePopover";
|
|
import { TooltipProvider } from "@/components/ui/tooltip";
|
|
import { initializeI18n } from "@/i18n";
|
|
import type { ContextSnapshot } from "@/lib/types";
|
|
import "../src/globals.css";
|
|
|
|
const snapshots: ContextSnapshot[] = [
|
|
{ id: "first", contextWindowTokens: 10000, usage: { prompt_tokens: 1000 }, graph: {
|
|
nodes: [{ path: "/a.md", name: "a.md", state: "loaded", tokens: 100 }], edges: [],
|
|
} },
|
|
{ id: "second", contextWindowTokens: 10000, usage: { prompt_tokens: 2000 }, graph: {
|
|
nodes: [{ path: "/a.md", name: "a.md", state: "loaded", tokens: 100 }, { path: "/b.md", name: "b.md", state: "discovered", tokens: 0 }],
|
|
edges: [{ source: "/a.md", target: "/b.md" }],
|
|
} },
|
|
];
|
|
const largeNodes = Array.from({ length: 500 }, (_, index) => ({ path: `/file-${index}.md`, name: `file-${index}.md`, state: "loaded" as const, tokens: 100 }));
|
|
const large: ContextSnapshot[] = [{ id: "large", contextWindowTokens: 100000, usage: { prompt_tokens: 50000 }, graph: {
|
|
nodes: largeNodes, edges: largeNodes.slice(1).map((node, index) => ({ source: largeNodes[Math.floor(index / 2)].path, target: node.path })),
|
|
} }];
|
|
function Fixture() {
|
|
const [showLarge, setShowLarge] = useState(false);
|
|
const [pythonLoaded, setPythonLoaded] = useState(false);
|
|
const frames = new URLSearchParams(location.search).has("single") ? snapshots.map((snapshot) => ({ ...snapshot, graph: snapshots[0].graph })) : snapshots;
|
|
const inspectedFrames = pythonLoaded ? [...frames, { ...frames[1], id: "python", graph: {
|
|
nodes: [...frames[1].graph.nodes, { path: "/worker.py", name: "worker.py", state: "loaded" as const, tokens: 200 }], edges: frames[1].graph.edges,
|
|
} }] : frames;
|
|
const [opened, setOpened] = useState("");
|
|
const [sidebarHost, setSidebarHost] = useState<HTMLElement | null>(null);
|
|
if (new URLSearchParams(location.search).has("drawer")) return <main ref={setSidebarHost} className="relative" style={{ height: "100dvh" }}>
|
|
<ComposerUsagePopover sidebarHost={sidebarHost} context={null} rounds={[]} snapshots={frames} onOpenFile={setOpened} />
|
|
<output>{opened}</output>
|
|
</main>;
|
|
return <main className="mx-auto max-w-2xl p-4"><ContextInspector context={null} rounds={[]} snapshots={showLarge ? large : inspectedFrames} onOpenFile={setOpened} /><output>{opened}</output>{new URLSearchParams(location.search).has("pair") && <section aria-label="Second graph"><ContextInspector context={null} rounds={[]} snapshots={frames} /></section>}<button onClick={() => setShowLarge(true)}>Load 500 nodes</button><button onClick={() => setPythonLoaded(true)}>Read Python file</button></main>;
|
|
}
|
|
await initializeI18n();
|
|
createRoot(document.getElementById("root")!).render(<TooltipProvider><Fixture /></TooltipProvider>);
|