Skip to content

Commit 84069e2

Browse files
Lexus2016claude
andcommitted
feat: import thinking blocks from JSONL during CLI session import
- Include thinking blocks in single-pass JSONL parse (correct insertion order: thinking id < text id → displays before text via ORDER BY id ASC) - Fix tool type: use 'tool' instead of 'tool_use' so getMsgsLite hides content and frontend skips tool rows correctly - Backward tool-count scan already skips thinking rows (line 8128) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 479b9c7 commit 84069e2

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

server.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3677,11 +3677,12 @@ app.post('/api/sessions/cli-import', (req, res) => {
36773677
const ts = d.timestamp || sessionTs;
36783678
if (!Array.isArray(mc)) continue;
36793679
for (const block of mc) {
3680-
if (block.type === 'text' && block.text)
3680+
if (block.type === 'thinking' && block.thinking)
3681+
msgs.push({ role: 'assistant', type: 'thinking', content: block.thinking, tool_name: null, ts });
3682+
else if (block.type === 'text' && block.text)
36813683
msgs.push({ role: 'assistant', type: 'text', content: block.text, tool_name: null, ts });
36823684
else if (block.type === 'tool_use' && block.name)
3683-
msgs.push({ role: 'assistant', type: 'tool_use', content: JSON.stringify(block.input || {}), tool_name: block.name, ts });
3684-
// skip thinking blocks
3685+
msgs.push({ role: 'assistant', type: 'tool', content: JSON.stringify(block.input || {}), tool_name: block.name, ts });
36853686
}
36863687
}
36873688
}

0 commit comments

Comments
 (0)