ConversationGraph builds a graph of EVERYTHING in the current session, not just the message thread: a session root hub connects the conversation thread (turns colored by role, with the tools each turn invoked) AND everything attached to the session — context bases with their files, and knowledge-mod
()
| 83 | // corpora. So "graph everything we're talking about" includes what was attached |
| 84 | // with /context, not only what was typed. |
| 85 | func (a *graphViewPluginAdapter) ConversationGraph() (plugins.GraphData, error) { |
| 86 | data := &plugins.GraphData{} |
| 87 | |
| 88 | // Session root hub: everything hangs off it, so the graph has a clear center. |
| 89 | rootID := "session:root" |
| 90 | rootLabel := strings.TrimSpace(a.cli.currentSessionName) |
| 91 | if rootLabel == "" { |
| 92 | rootLabel = "session" |
| 93 | } |
| 94 | data.Nodes = append(data.Nodes, plugins.GraphNode{ID: rootID, Label: "◉ " + rootLabel, Kind: "session", Weight: 4}) |
| 95 | |
| 96 | a.addConversationThread(data, rootID) |
| 97 | a.addAttachedToGraph(data, rootID) |
| 98 | |
| 99 | // Only the root and nothing else → treat as empty so the caller shows the |
| 100 | // friendly empty-graph message instead of a lone dot. |
| 101 | if len(data.Nodes) <= 1 { |
| 102 | return plugins.GraphData{}, nil |
| 103 | } |
| 104 | return *data, nil |
| 105 | } |
| 106 | |
| 107 | // addConversationThread appends the turn thread and the tools it invoked, |
| 108 | // anchoring the first turn to the session root. |