feat(webui): inspect file context in a live graph sidebar (#6562)
* 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
This commit is contained in:
1 parent
2b44088413
commit
519ed81132
132 files changed
+4673
-1159
No files matched your search
@@ -2,6 +2,7 @@ import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
|
||||
import {
|
||||
changeAutomationChat,
|
||||
parseWebuiThreadPayload,
|
||||
cancelMcpOAuth,
|
||||
configureChannel,
|
||||
completeMcpOAuth,
|
||||
@@ -110,7 +111,7 @@ describe("webui API helpers", () => {
|
||||
await fetchWebuiThread("tok", "websocket:chat-1");
|
||||
|
||||
expect(fetch).toHaveBeenCalledWith(
|
||||
"/api/sessions/websocket%3Achat-1/webui-thread?include_model_requests=1",
|
||||
"/api/sessions/websocket%3Achat-1/webui-thread?include_model_requests=1&context_graph_encoding=references-v1",
|
||||
expect.objectContaining({
|
||||
headers: { Authorization: "Bearer tok" },
|
||||
credentials: "same-origin",
|
||||
@@ -126,7 +127,7 @@ describe("webui API helpers", () => {
|
||||
});
|
||||
|
||||
expect(fetch).toHaveBeenCalledWith(
|
||||
"/api/sessions/websocket%3Achat-1/webui-thread?limit=120&before=abc%2B%2F%3D&include_model_requests=1",
|
||||
"/api/sessions/websocket%3Achat-1/webui-thread?limit=120&before=abc%2B%2F%3D&include_model_requests=1&context_graph_encoding=references-v1",
|
||||
expect.objectContaining({
|
||||
headers: { Authorization: "Bearer tok" },
|
||||
credentials: "same-origin",
|
||||
@@ -172,7 +173,7 @@ describe("webui API helpers", () => {
|
||||
})).resolves.toBe(cached);
|
||||
|
||||
expect(fetch).toHaveBeenCalledWith(
|
||||
"/api/sessions/websocket%3Achat-1/webui-thread?include_model_requests=1",
|
||||
"/api/sessions/websocket%3Achat-1/webui-thread?include_model_requests=1&context_graph_encoding=references-v1",
|
||||
expect.objectContaining({
|
||||
headers: {
|
||||
Authorization: "Bearer tok",
|
||||
@@ -1423,3 +1424,56 @@ describe("webui API helpers", () => {
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe("context graph response dictionaries", () => {
|
||||
const graph = { nodes: [{ path: "/guide.md", name: "guide.md", tokens: 10, state: "loaded" }], edges: [] };
|
||||
const request = (id: string, fields: Record<string, unknown>) => ({
|
||||
event: "model_request", chat_id: "chat", request_id: id, run_id: "run", sequence: 2,
|
||||
phase: "completed", ...fields,
|
||||
});
|
||||
const payload = (events: unknown[], fields: Record<string, unknown> = {}) => ({ schemaVersion: 3, projection: "events", events, ...fields });
|
||||
|
||||
it("resolves repeated graphs and checkpoint graphs into shared domain objects", () => {
|
||||
const result = parseWebuiThreadPayload(payload([
|
||||
request("one", { context_graph_ref: "0", request_usage: { context_tokens: 20 } }),
|
||||
request("two", { context_graph_ref: "0", request_usage: null }),
|
||||
{ event: "context_compaction", chat_id: "chat", compaction_id: "compact", phase: "succeeded",
|
||||
context_snapshot: { graph_ref: "0", estimated_tokens: 10, context_window_tokens: 100 } },
|
||||
], { context_graphs: { "0": { nodes: [0], edges: [] } }, context_graph_nodes: graph.nodes, context_graph_edges: graph.edges }));
|
||||
const requests = result.events.filter((event) => event.event === "model_request");
|
||||
expect(requests[0].context_graph).toBe(requests[1].context_graph);
|
||||
expect(requests[0].context_graph).toEqual(graph);
|
||||
expect(requests[1].request_usage).toBeNull();
|
||||
expect(result.events[2]).toMatchObject({ context_snapshot: { graph } });
|
||||
});
|
||||
|
||||
it("preserves a growing timeline while sharing unchanged node and edge entities", () => {
|
||||
const nodes = Array.from({ length: 300 }, (_, index) => ({ path: `/${index}.md`, name: `${index}.md`, tokens: 10, state: "loaded" }));
|
||||
const edges = nodes.slice(1).map((node, index) => ({ source: nodes[index].path, target: node.path }));
|
||||
const descriptors = Object.fromEntries(Array.from({ length: 50 }, (_, index) => [String(index), {
|
||||
nodes: Array.from({ length: 251 + index }, (_, n) => n),
|
||||
edges: Array.from({ length: 250 + index }, (_, n) => n),
|
||||
}]));
|
||||
const result = parseWebuiThreadPayload(payload(Array.from({ length: 50 }, (_, index) => request(String(index), { context_graph_ref: String(index) })), {
|
||||
context_graphs: descriptors, context_graph_nodes: nodes, context_graph_edges: edges,
|
||||
}));
|
||||
const requests = result.events.filter((event) => event.event === "model_request");
|
||||
for (let index = 0; index < requests.length; index += 1) {
|
||||
expect(requests[index].context_graph?.nodes).toEqual(nodes.slice(0, 251 + index));
|
||||
expect(requests[index].context_graph?.edges).toEqual(edges.slice(0, 250 + index));
|
||||
}
|
||||
expect(requests[0].context_graph).not.toBe(requests[1].context_graph);
|
||||
expect(requests[0].context_graph?.nodes[0]).toBe(requests[49].context_graph?.nodes[0]);
|
||||
expect(requests[0].context_graph?.edges[0]).toBe(requests[49].context_graph?.edges[0]);
|
||||
});
|
||||
|
||||
it("continues to accept inline graphs from older hosts", () => {
|
||||
const result = parseWebuiThreadPayload(payload([request("one", { context_graph: graph })]));
|
||||
expect(result.events[0]).toMatchObject({ context_graph: graph });
|
||||
});
|
||||
|
||||
it("rejects unknown references and invalid dictionary entries", () => {
|
||||
expect(() => parseWebuiThreadPayload(payload([request("one", { context_graph_ref: "missing" })], { context_graphs: {}, context_graph_nodes: [], context_graph_edges: [] }))).toThrow("Unknown context graph reference");
|
||||
expect(() => parseWebuiThreadPayload(payload([], { context_graphs: { "0": { nodes: [], edges: [0] } }, context_graph_nodes: [], context_graph_edges: [{ source: "missing", target: "missing" }] }))).toThrow("Invalid context graph entity table");
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user