tuna-agent 0.1.65 → 0.1.67
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -214,7 +214,7 @@ export class ClaudeCodeAdapter {
|
|
|
214
214
|
cwd,
|
|
215
215
|
outputFormat: 'stream-json',
|
|
216
216
|
includePartialMessages: true,
|
|
217
|
-
maxTurns:
|
|
217
|
+
maxTurns: 200,
|
|
218
218
|
resumeSessionId: round > 0 ? sessionId : undefined,
|
|
219
219
|
signal,
|
|
220
220
|
inputFiles: currentInputFiles,
|
|
@@ -276,11 +276,27 @@ export class ClaudeCodeAdapter {
|
|
|
276
276
|
console.log(`[ClaudeCode] Init tools: total=${toolNames.length}, mcp=${mcpTools.length} (${mcpTools.join(', ') || 'none'})`);
|
|
277
277
|
console.log(`[ClaudeCode] All tools: ${toolNames.join(', ')}`);
|
|
278
278
|
}
|
|
279
|
-
//
|
|
279
|
+
// Extract text + tool usage from assistant messages
|
|
280
280
|
if (data.type === 'assistant' && data.message) {
|
|
281
281
|
const msg = data.message;
|
|
282
282
|
const content = msg.content;
|
|
283
283
|
if (content) {
|
|
284
|
+
// Extract full text from assistant message as source of truth
|
|
285
|
+
// (stream_event content_block_delta may miss chunks on rate limits)
|
|
286
|
+
const fullText = content
|
|
287
|
+
.filter(b => b.type === 'text' && b.text)
|
|
288
|
+
.map(b => b.text)
|
|
289
|
+
.join('');
|
|
290
|
+
if (fullText && fullText.length > turnAccumulatedText.length) {
|
|
291
|
+
const missed = fullText.slice(turnAccumulatedText.length);
|
|
292
|
+
if (missed.length > 0) {
|
|
293
|
+
console.log(`[ClaudeCode] 🔧 Stream missed ${missed.length} chars — patching from assistant message`);
|
|
294
|
+
turnAccumulatedText = fullText;
|
|
295
|
+
// Stream the missed portion to app
|
|
296
|
+
ws.sendPMStream(task.id, missed);
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
// Send tool usage to activity tab
|
|
284
300
|
for (const block of content) {
|
|
285
301
|
if (block.type === 'tool_use') {
|
|
286
302
|
const toolName = block.name;
|