feat: deep research module + tool-result loop & citation parser fixes#89
Open
feat: deep research module + tool-result loop & citation parser fixes#89
Conversation
Adds a plan→search→read→reflect→compose research pipeline that reads full pages via Jina Reader and composes a cited markdown report. Backend: - modules/deep_research: StateGraph with planner, search, read, reflect, compose, critique, finalize nodes; registered in GigaAgent and in langgraph.json as a subgraph. - graph_factory: reads config.configurable.deep_research_forced and pins tool_choice="run_deep_research" + injects a <forced_mode> prompt hint so the search tool is actually invoked. - vectorstores/qdrant: skip close() on local SQLite-backed QdrantClient during shutdown (SQLite raised ProgrammingError from worker thread). Frontend: - InputArea: lupa toggle that forces deep research for the next send, wires configurable and requests Notification permission on first use. - ToolMessage / Message / config: progress labels, per-tool rendering for run_deep_research, DeepResearchPlan card with live subquestion status, browser notification when DR tool completes while tab is hidden. - attachments/TextMarkdown + components/deep_research/citations: parse the "## Источники" section, replace inline [N] / [N, M] citations with stacked-favicon chips, open a right-side sources drawer on click (Perplexity-style). - lib/notifications: permission + hidden-tab notification helper. - attachments/HtmlSandbox: sandboxed iframe renderer for generated HTML. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
… limit Middleware used to persist every oversized tool result to sandbox and return "read it via python" — but python/shell themselves pipe that read back through the same middleware, endlessly creating new result_path files. Inline python and shell outputs instead and truncate them to GIGA_AGENT_TOOL_MAX_SIZE with a hint to reshape the code. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The parser only matched "## Источники|Sources" plus "[N] Title: URL" with a strict separator, so common variants (Список/Использованные/References, markdown-linked titles, pipe/parenthesised URLs, bare URLs) silently fell back to plain [N] digits in the report. Accept more heading variants, four line formats, and fall back to the trailing citation block when no heading is recognised. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
backend/giga_agent/modules/deep_research/): planner → search → read → reflect → compose → critique; forced-mode UI, отчёт с нумерованными цитатами[N].python/shellвmiddlewares/tool_result.py. Раньше большой stdout сохранялся в sandbox-файл и LLM получал «читай через python», что порождало новый stdout → новый файл → снова prompt. Теперь дляpython/shellрезультат не сохраняется;outputрежется доGIGA_AGENT_TOOL_MAX_SIZEс подсказкой переписать код (срезы/агрегация).front/src/components/deep_research/citations.tsxраспознавал только строгий шаблон## Источники+[N] Title: URL— иначе цитаты оставались сырыми[1][2]. Теперь поддерживаютсяИсточники/Sources/References/Литература/Библиография, падежи,**bold**-заголовки, markdown-ссылки[Title](URL), разделители| : — –, URL в<…>, и fallback на хвостовой блок без заголовка.Test plan
[1][2].result_path.ToolMessage.tsxдляrun_deep_research(план подсвечивается),TextMarkdown.tsx(иконки в тексте + drawer).🤖 Generated with Claude Code