From b20d55508ea6b0d1fe4c2d0d6e8767156982f53b Mon Sep 17 00:00:00 2001 From: Rin Date: Tue, 3 Feb 2026 08:13:46 +0800 Subject: [PATCH] feat(minecraft): (does it work???)use native reasoning field instead of [REASONING] prefix hack Replace manual reasoning prefix concatenation with proper reasoning field in Message type, enable reasoning with configurable effort (default: low) in LLM calls, extract reasoningText from response instead of reasoning property --- services/minecraft/src/cognitive/conscious/brain.ts | 11 +++++++---- .../minecraft/src/cognitive/conscious/llm-agent.ts | 7 +++++-- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/services/minecraft/src/cognitive/conscious/brain.ts b/services/minecraft/src/cognitive/conscious/brain.ts index 5a8d61fa6..0bc41c5d1 100644 --- a/services/minecraft/src/cognitive/conscious/brain.ts +++ b/services/minecraft/src/cognitive/conscious/brain.ts @@ -235,10 +235,13 @@ export class Brain { // Only append to conversation history after successful parsing (avoid dirty data on retry) this.conversationHistory.push({ role: 'user', content: userMessage }) - const assistantContent = capturedReasoning - ? `[REASONING] ${capturedReasoning}\n\n${result}` - : result - this.conversationHistory.push({ role: 'assistant', content: assistantContent }) + // Store reasoning in the assistant message's reasoning field (if available) + // Reasoning is transient thinking and doesn't need the [REASONING] prefix hack anymore + this.conversationHistory.push({ + role: 'assistant', + content: result, + ...(capturedReasoning && { reasoning: capturedReasoning }), + } as Message) if (action.tool === 'skip') { this.deps.logger.log('INFO', 'Brain: Skipping turn (observing)') diff --git a/services/minecraft/src/cognitive/conscious/llm-agent.ts b/services/minecraft/src/cognitive/conscious/llm-agent.ts index ec47238c8..4b596c5c2 100644 --- a/services/minecraft/src/cognitive/conscious/llm-agent.ts +++ b/services/minecraft/src/cognitive/conscious/llm-agent.ts @@ -11,6 +11,7 @@ export interface LLMConfig { export interface LLMCallOptions { messages: Message[] responseFormat?: { type: 'json_object' } + reasoning?: { effort: 'low' | 'medium' | 'high' } } export interface LLMResult { @@ -35,11 +36,13 @@ export class LLMAgent { model: this.config.model, messages: options.messages, ...(options.responseFormat && { responseFormat: options.responseFormat }), - }) + // Enable reasoning with configurable effort (default: low) + reasoning: options.reasoning ?? { effort: 'low' }, + } as Parameters[0]) return { text: response.text ?? '', - reasoning: (response as any).reasoning, + reasoning: (response as any).reasoningText, usage: response.usage, } }