Repository navigation
feat(mcp,web): add annotated timeline scenes to render_timelines - #1253
Conversation
…hout unwrap (#1227) * feat(khifile): add ResolveStructStringField to read struct fields without unwrap * perf(khifile): avoid IndexByte scan in matchFieldKeySegments
…metadata (#1218) * feat(workbench): strip managedFields by default and expose log query metadata * refactor(workbench): return named structs for revision bounds and log query metadata * test(workbench): use raw string literals for multiline test fixtures
…d fit stage dimensions to content (#1219) * feat(mcp): render timeline screenshots at Retina 2x resolution * fix(mcp,web): remove width input and size timeline renders to fit content * fix(mcp,web): drop render image metadata and generalize font loading * refactor(web): rely directly on document.fonts.ready in timeline renderer * fix(web): wait for document.fonts.ready in CDP bridge functions
…1220) * feat(mcp): add timeline scene spec types and named palette registry * perf(mcp): replace JSON round-trip with slice cloning in cloneAnnotations * refactor(mcp): simplify scene spec types and use integer IDs and enums * fix(mcp): remove width field from timeline scene spec and document
* feat(mcp): add in-memory timeline scene store and patch merging * refactor(mcp): adapt scene store to updated scene spec types * fix(mcp): drop width merging from timeline scene store * refactor(mcp): remove unnecessary Stored.clone and cloneDocument
…ner (#1222) * feat(web): add timeline scene overlay schema and session jump URL opener * refactor(web): document palette color tokens and unify excerpt line kinds * refactor(web): promote session URL sync to core service and drop redundant checks * refactor(web): simplify selection query parameter sync
* feat(web): add marker and span scene ViewModel * fix(web): compute timeline scene stage width from fitted index pane * refactor(web): split timeline scene ViewModel builders into tested helpers * refactor(web): split timeline scene types from ViewModel builders and use math-util
…Model (#1224) * feat(web): add row highlight, connector, callout, and deck scene ViewModel * test(web): use TimelineExcerptLineKind.CONTEXT in deck scene spec * feat(web): expand timeline stage width for role badges and evidence deck cards * refactor(web): extract switch-based connector SVG path builders
…1231) * feat(mcp): add multi-window search and structured log excerpt slicer * fix(mcp): guard rune boundary check and ignore YAML comment lines
* feat(mcp): add unified diff excerpt slicer * fix(mcp): render mixed unchanged and skipped diff hunk gaps * test(mcp): use raw string literals in slice diff tests
* feat(mcp): add timeline anchor and subtree scope resolution * fix(mcp): check search index readiness and auto-include scoped subtrees * fix(mcp): replace anchor field count with direct boolean check * test(mcp): use whole-struct want in TestResolveAnchor
…solver (#1234) * feat(mcp): add marker, span, row highlight, connector, and callout resolver * test(mcp): update resolve error tests for anchor precedence * test(mcp): use raw string literals in resolver tests
#1235) * feat(mcp): add excerpt card resolver and co-anchor palette inheritance * fix(mcp): hoist search index lookup out of log excerpt loop
* feat(web): add timeline scene overlay component * fix(web): enable hover on non-navigable markers and clean up span borders * refactor(web): simplify scene overlay class bindings and capture scene with @let
…erlay (#1237) * test(web): add unit tests and Storybook stories for timeline scene overlay * refactor(web): import buildTimelineSceneViewModel from scene builder in overlay specs
* feat(web): add timeline evidence deck component * fix(web): use idiomatic class bindings, direct property access in spec, and update builder imports * feat(web): add Storybook stories for timeline evidence deck * refactor(web): capture deck with @let in evidence deck template
…eRenderSmartComponent (#1240) * feat(web): integrate scene overlays and interactive mode into TimelineRenderSmartComponent * fix(web): extract session ID dynamically, guard destroyed state, and update builder imports
…er_timelines (#1241) * feat(mcp): wire stateful scenes, annotations, and dual URLs into render_timelines * fix(mcp): return structured ErrorResult on scene store and template failures * fix(mcp): update interactive URL to /render/mcp-timeline
…1250) * fix(web): route multi-row evidence deck tethers behind upper cards * perf(web): avoid forced layout reads on every render in evidence deck
* test(core): disable Chrome launch in TestDefaultInitializers_Resolution * test(mcp): scope timeouts per subtest in TestChromeTimelineImageRenderer * test(api/v1): wait for async indexManager before TempDir cleanup * test(mcp): ensure deterministic loading state in TestWorkbenchHandler_AcquireWorkbench
There was a problem hiding this comment.
Code Review
This pull request introduces a comprehensive scene management system for timeline rendering, enabling scene branching and persistent state via the new scene package. Key changes include updates to the Workbench API to support managed field filtering in diffs, the addition of ResolveStructStringField for efficient data access in InternPool, and significant updates to the frontend to support the new MCP timeline rendering flow, including a new McpTimelineRenderSmartComponent and associated layout components. The review comment regarding high-frequency polling in mcp-timeline-render-smart.component.ts is valid and highlights a potential performance issue that should be addressed by adopting an event-driven approach.
Part of #1193
Fixes #1205
Background
render_timelinescould only return a plain screenshot of the timeline view. When an AI agent writes an incident report, it needs to point at specific moments, highlight the affected resources, connect cause and effect, and show the matching manifest diffs and log lines next to the timeline. Before this change, agents had to explain all of that in prose, and a reader had to find each item in the KHI UI by hand.Approach
This merges the
epic/mcp-annotated-timelinebranch. It adds annotated, stateful timeline scenes torender_timelines.pkg/server/mcp/scene): Agents describe a scene with a shared color palette and annotation layers: markers, spans, row highlights, connectors, callouts, and diff and log excerpt cards. Anchors accept a log ID, a revision index, or a time. The resolver checks every anchor against the inspection and returns clear errors such asINVALID_ANCHOR,ANCHOR_OUT_OF_VIEWPORT, andSLICE_QUERY_NOT_FOUND. Excerpt cards slice unified diffs and structured log bodies with query windows, and items on the same anchor inherit palette colors.sceneId. A later call can passparentSceneIdto refine filters and annotations, or to branch a variant withclearLayersandremoveIds. Scene documents are served at/api/v1/mcp-scenes/:sceneId./render/mcp-timelinepage backed byMcpTimelineRenderSmartComponent./render/timelinestays as a standalone page that users can open in a browser with query parameters.get_resource_manifestandget_resource_diffomitmetadata.managedFieldsby default. PassincludeManagedFields: trueto include it. Log excerpts include the loginsertIdand timestamp, so readers can find the same entry in Cloud Logging.UI / Output Changes
Annotated overview scene (
render_timelines, UTC, Retina 2x)Branched zoom scene (
parentSceneIdwithtimezoneShiftHours: 9,clearLayers, andremoveIds)Sample
render_timelinesMarkdown text outputBehavior Changes
render_timelinesno longer acceptswidth. The output PNG is rendered at 2x scale, so it has about 4 times as many pixels as before. It falls back to 1x when a side would exceed 8192 physical pixels.render_timelinesacceptsannotationsandparentSceneId. Its response includessceneId, an image URL, and an interactive URL.GETandHEAD/api/v1/mcp-scenes/:sceneId.get_resource_manifestandget_resource_diffomitmetadata.managedFieldsunlessincludeManagedFieldsistrue..khifile format is unchanged.Included PRs
#1227, #1218, #1219, #1244, #1220, #1221, #1222, #1223, #1224, #1231, #1232, #1233, #1234, #1235, #1236, #1237, #1238, #1239, #1240, #1241, #1242, #1247, #1249, #1250, #1251, #1252
Follow-ups
plugins/khi/skills/khi-investigation/SKILL.mdto describe scene annotations,parentSceneId, and the interactive URL.render_timelinesor the timeline render page (feat(mcp): pad render_timelines viewport and decouple it from the filter range #1215, refactor(mcp): reuse shared normalization for render_timelines maxNodes #1229, feat(web): hide interactive-only index controls in timeline renders #1243) need a rebase. The changes for headless renders should move toMcpTimelineRenderSmartComponent.CDPBrowserInitializerthat uses a fake Chrome executable.