MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / followedTopic

Function followedTopic

graph-ui/src/browser-ai/chat-context.ts:56–66  ·  view source on GitHub ↗
(turns: readonly BrowserChatTurn[], scope: string)

Source from the content-addressed store, hash-verified

54/** A question without its own context follows up on explicitly attached code or context
55 * in the same view. A selection or file that is gone leaves nothing to follow up on. */
56export function followedTopic(turns: readonly BrowserChatTurn[], scope: string): ChatTopic | undefined {
57 for (let index = turns.length - 1; index >= 0; index--) {
58 const topic = turns[index].topic;
59 if (!topic || turns[index].answeredFrom === 'local' || turns[index].answeredFrom === 'hint') continue;
60 // Stored history is data: a damaged key ends the follow-up instead of the send.
61 let turnScope: unknown;
62 try { [turnScope] = JSON.parse(topic.key) as unknown[]; } catch { return undefined; }
63 return turnScope === scope && (topic.kind === 'attachment' || topic.kind === 'context') ? topic : undefined;
64 }
65 return undefined;
66}
67
68/** German when the question reads German; the chat's own replies follow the question.
69 * "was" and "die" are English words too and decide nothing on their own. Short questions

Callers 2

sendFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected