Add stream event logging to worker engine for debugging
Build Claw Telegram / build (push) Successful in 50s
Build Claw Telegram / cleanup (push) Successful in 1s

Logs every SSE event and final message content block types to stdout
to diagnose what the user sees as "full tool calls" in Telegram.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Wylabb
2026-04-08 03:16:39 +02:00
parent aed5b1787f
commit 262dc2ec91
+4 -1
View File
@@ -178,7 +178,7 @@ Current working directory: ${this.config.defaultCwd}`
fullText += text
})
// Process events from the stream
// Process events from the stream — log every event for debugging
for await (const event of stream) {
if (abortController.signal.aborted) {
stream.abort()
@@ -186,6 +186,8 @@ Current working directory: ${this.config.defaultCwd}`
return
}
console.log(`[stream-event] ${JSON.stringify(event)}`)
if (event.type === 'content_block_delta') {
const delta = event.delta as { type?: string; text?: string }
if (delta?.type === 'text_delta' && delta.text) {
@@ -199,6 +201,7 @@ Current working directory: ${this.config.defaultCwd}`
// Get final message for usage
const finalMessage = await stream.finalMessage()
console.log(`[final-message] stop_reason=${finalMessage.stop_reason} content_blocks=${JSON.stringify(finalMessage.content.map(b => ({ type: b.type, ...(b.type === 'tool_use' ? { name: (b as any).name } : {}) })))}`)
// Add assistant response to history
const assistantText =