From 034f0f30af4e9fc9cdd67439d48cfd5452053ebf Mon Sep 17 00:00:00 2001 From: Rin Date: Wed, 4 Feb 2026 21:05:20 +0800 Subject: [PATCH] fix(minecraft): fix repl results not feeding to llm --- services/minecraft/src/cognitive/conscious/brain.test.ts | 2 +- services/minecraft/src/cognitive/conscious/brain.ts | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/services/minecraft/src/cognitive/conscious/brain.test.ts b/services/minecraft/src/cognitive/conscious/brain.test.ts index 480e2700..89504bc1 100644 --- a/services/minecraft/src/cognitive/conscious/brain.test.ts +++ b/services/minecraft/src/cognitive/conscious/brain.test.ts @@ -84,7 +84,7 @@ describe('brain no-action follow-up', () => { expect(queuedEvent).toMatchObject({ type: 'system_alert', source: { type: 'system', id: 'brain:no_action_followup' }, - payload: { reason: 'no_actions' }, + payload: { reason: 'no_actions', returnValue: '2' }, }) }) diff --git a/services/minecraft/src/cognitive/conscious/brain.ts b/services/minecraft/src/cognitive/conscious/brain.ts index f359d077..f8942b13 100644 --- a/services/minecraft/src/cognitive/conscious/brain.ts +++ b/services/minecraft/src/cognitive/conscious/brain.ts @@ -472,8 +472,12 @@ export class Brain { const actionDefs = new Map(this.deps.taskExecutor.getAvailableActions().map(action => [action.name, action])) let turnCancellationToken: CancellationToken | undefined + const codeToEvaluate = this.planner.canEvaluateAsExpression(result) + ? `return (\n${result}\n)` + : result + const runResult = await this.planner.evaluate( - result, + codeToEvaluate, this.deps.taskExecutor.getAvailableActions(), { event,