MCPcopy Create free account
hub / github.com/Epic0522/Codex-Remote-Contact / inferDesktopTopicQuery

Function inferDesktopTopicQuery

src/server.js:4705–4714  ·  view source on GitHub ↗
(snippets = [])

Source from the content-addressed store, hash-verified

4703}
4704
4705function inferDesktopTopicQuery(snippets = []) {
4706 const answer = [...snippets].reverse().find((snippet) => isCompletedSnippet(snippet));
4707 if (answer?.text) return answer.text.slice(0, 180);
4708 const user = [...snippets].reverse().find((snippet) => (
4709 snippet.role === "user"
4710 && !isLowValueTopicText(snippet.text)
4711 && textInformationSignal(snippet.text).units > 6
4712 ));
4713 return user?.text?.slice(0, 120) || "";
4714}
4715
4716function isCompletedSnippet(snippet) {
4717 return snippet?.completed === true || ["final_answer", "task_complete"].includes(String(snippet?.phase || ""));

Callers 1

Calls 3

isCompletedSnippetFunction · 0.85
isLowValueTopicTextFunction · 0.85
textInformationSignalFunction · 0.85

Tested by

no test coverage detected