feat(ui): the Flow strip — how one symbol reaches another, one card per hop (CG-50)

Ask "how does execute reach getFile" in the search box and the viewer draws the
call path between them, left to right, opening every card at the exact line that
makes the next call. Dynamic-dispatch hops are dashed and name the site they
were wired at; "Read as flow" turns a trail walked by hand into the same strip.

The path finder is NOT new. `codegraph_explore` already leads its answers with
the longest call chain among the symbols an agent named, and a viewer that drew
a different path would get the two quoted against each other in a review. So the
search moved out of `ToolHandler` into `src/graph/named-symbol-flow.ts` and both
callers ride it — same tokens, same overload rules, same synthesized edges. What
stayed behind in `tools.ts` is the prose.

A pinned from/to question is the same search with two options changed, because
both ends being named is the evidence explore's one-unnamed-bridge cap stands in
for: it bridges freely, keeps twelve candidates per endpoint instead of six
(the CLI's own `main` sorts seventh of ten), and searches from both ends at once
— identical paths to the one-way walk on twelve measured pairs, 3-6x faster.

`/api/flow` is deliberately the one endpoint with no cache: its cards carry
source read from disk, and a drift verdict changes without the index changing.

Verified on this repo (`execute` to `rowToFileRecord`, 8 hops; `main` to
`resolveOne`, 7) and on a fresh excalidraw index, where `mutateElement` to
`renderStaticScene` crosses callback, react-render and jsx-child hops and lists
exactly the hops `codegraph_explore` prints.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Colby McHenry
2026-08-27 03:19:24 -05:00
co-authored by Claude Opus 5
parent 6d0f60f32c
commit 62e0a89b0e
24 changed files with 3326 additions and 313 deletions
+12 -2
View File
@@ -124,16 +124,26 @@ describe('the palette', () => {
expect(interleaveResults(a, [result({ id: 'a2' })]).map((r) => r.id)).toEqual(['a1', 'a2']);
});
it('explains that a flow question is answered by both endpoints for now', () => {
it('offers the flow FIRST for a flow question, then what each name matches', () => {
const palette = buildSearchPalette(
[answer([result({ id: 'a', name: 'sync' })]), answer([result({ id: 'b', name: 'read' })])],
{ from: 'sync', to: 'read' }
);
expect(palette.items.map((i) => i.id)).toEqual(['a', 'b']);
// First row, so Enter opens the path: the question asked for the path.
expect(palette.sections[0]?.title).toBe('Flow');
expect(palette.items[0]).toMatchObject({ type: 'flow', from: 'sync', to: 'read' });
expect(palette.items.map((i) => i.id).slice(1)).toEqual(['a', 'b']);
expect(palette.items).toEqual(palette.sections.flatMap((s) => s.items));
expect(palette.hint).toContain('sync');
expect(palette.hint).toContain('read');
});
it('offers no flow row when the query is not a flow question', () => {
const palette = buildSearchPalette([answer([result({ id: 'a' })])], null);
expect(palette.sections.some((s) => s.title === 'Flow')).toBe(false);
expect(palette.items.every((i) => i.type !== 'flow')).toBe(true);
});
it('names a kind bucket in sentence case, singular when there is one', () => {
expect(kindGroupTitle('method', 3)).toBe('Methods');
expect(kindGroupTitle('method', 1)).toBe('Method');