fix: reconstruct Cursor request tools and keep dashboard viewer mounted - #432
Conversation
Persist a tools catalog from observed tool_use blocks and recover system prompt text from Cursor store.db so request/Trace panes are not empty, and backfill already stored transcript records. Co-authored-by: Cursor <cursoragent@cursor.com>
Drop updated_at from the dashboard snapshot and refresh session lists silently so proxy logs no longer remount the detail iframe. Co-authored-by: Cursor <cursoragent@cursor.com>
The incremental viewer JS gate requires the new helper functions to run inside the Chromium coverage probe, not only Node unit tests. Co-authored-by: Cursor <cursoragent@cursor.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: cb959283e1
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Keep the English UI label as Trace. zh-CN now uses 轨迹 for the viewer tab, dashboard table/metrics, and related copy. Co-authored-by: Cursor <cursoragent@cursor.com>
Log heartbeats no longer change the dashboard snapshot, so skip remounting only when the fingerprint is unchanged. New records should refresh even if the Full Viewer iframe is already open. Co-authored-by: Cursor <cursoragent@cursor.com>
Historical date dumps put every session into entries. Reconstruct tools from the selected conversation only so one Cursor session does not inherit another session's tool names. Co-authored-by: Cursor <cursoragent@cursor.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 65a1c24f12
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Summary
toolscatalog from observed Cursortool_useblocks, persist it on every synthetic request, and backfill already stored Cursor transcript records.systemprompt text from Cursor CLIstore.dbJSON blobs (role=system) on import and backfill when the local chat store still has it.updated_atheartbeats, SSE/poll refreshes are silent, and an existing iframe is not remounted.中文摘要
tool_use(工具调用)反推 Anthropic 形态的tools(工具目录),写入每条合成请求,并对已经入库的存量记录做回填(backfill)。store.db里还有role=system的 JSON blob,导入和回填时一并写入systemprompt(系统提示)。updated_at,SSE/轮询静默刷新,已有 iframe 保持挂载。Problem
Cursor is transcript-only.
~/.cursor/projects/*/agent-transcripts/*.jsonlstorestext/tool_usemessages, not the original request tool schemas or system prompt. The viewer Request pane therefore had no Tools section, even though the model called tools. Separately,append_logbumpedsessions.updated_at, so a busy logger forced the dashboard to refresh every second and remount the viewer iframe (losing scroll/turn/tab).中文问题
Cursor 是 transcript-only(只读本地对话记录,不 MITM)。JSONL 只有
text/tool_use,没有原始工具 schema 和 system prompt,所以请求默认视图没有 Tools 区块。另外append_log会刷新updated_at,忙碌的日志会让 dashboard 每秒刷新并重装 iframe,滚动位置和当前 turn/tab 丢失。Test plan
uv run ruff check . && uv run ruff format --check .uv run pytest tests/ -x --timeout=60(1075 passed locally before split; targeted suites re-run after commits)agent-transcripts(not fabricated rows)uv run python -m claude_tap --tap-client cursor, hard-reload a previously captured Cursor session, confirm Request Tools + System Prompt, and confirm the detail viewer does not remount while logs stream中文验证
Evidence
Real Cursor transcript import (not fabricated rows).
Source JSONL:
~/.cursor/projects/Users-youngcan-claude-tap/agent-transcripts/0b95c4b6-03e2-4780-8c3a-124f43625297/0b95c4b6-03e2-4780-8c3a-124f43625297.jsonlMatching
store.dbsystem blob staged beside it. Imported withimport_cursor_transcripts()into.traces/cursor-request-tools/traces.sqlite3(57 transcript turns), then captured from the live dashboard viewer.Default view — reconstructed Tools catalog (Read expanded) plus System Prompt:
Trace view — request JSON with persisted
system(andtoolsin the same body):中文证据
真实 Cursor transcript 导入(不是手写行):上述 JSONL +
store.db的 system blob,经import_cursor_transcripts()写入.traces/cursor-request-tools/traces.sqlite3(57 turn),再从 live dashboard viewer 截图。默认视图能看到反推的 Tools 目录;Trace 视图请求 JSON 里有写入后的
system。Limits that still cannot be recovered from JSONL: unused MCP tools, official tool descriptions, and later-request
tool_resulthistory.中文限制
JSONL 仍然补不回来:从未调用过的 MCP 工具、官方工具描述、以及后续请求里的完整
tool_result历史。Type
Privacy