refactor(minecraft): refactor file structure

This commit is contained in:
Rin
2026-02-18 11:09:57 +08:00
committed by Neko Ayaka
parent 4962c8106a
commit 7c3f9236a9
15 changed files with 24 additions and 24 deletions
@@ -1,10 +1,10 @@
import { messages, system, user } from 'neuri/openai'
import { beforeAll, describe, expect, it } from 'vitest'
import { generateSystemBasicPrompt } from '../../cognitive/conscious/prompt'
import { initBot, useBot } from '../../composables/bot'
import { config, initEnv } from '../../composables/config'
import { createNeuriAgent } from '../../composables/neuri'
import { generateSystemBasicPrompt } from '../../libs/llm-agent/prompt'
import { initLogger } from '../../utils/logger'
describe('openAI agent', { timeout: 0 }, () => {
@@ -7,7 +7,7 @@ import type { PlanStep } from '../planning/adapter'
import { agent } from 'neuri'
import { system, user } from 'neuri/openai'
import { BaseLLMHandler } from '../../libs/llm-agent/handler'
import { BaseLLMHandler } from '../../cognitive/conscious/handler'
import { useLogger } from '../../utils/logger'
import { generateActionSystemPrompt } from './system-prompt'
import { actionsList } from './tools'
@@ -2,10 +2,10 @@ import { sleep } from '@moeru/std'
import { messages, system, user } from 'neuri/openai'
import { beforeAll, describe, expect, it } from 'vitest'
import { generateActionAgentPrompt } from '../../cognitive/conscious/prompt'
import { initBot, useBot } from '../../composables/bot'
import { config, initEnv } from '../../composables/config'
import { createNeuriAgent } from '../../composables/neuri'
import { generateActionAgentPrompt } from '../../libs/llm-agent/prompt'
import { initLogger } from '../../utils/logger'
describe('actions agent', { timeout: 0 }, () => {
@@ -2,7 +2,7 @@ import type { ChatHistory } from './types'
import { system, user } from 'neuri/openai'
import { BaseLLMHandler } from '../../libs/llm-agent/handler'
import { BaseLLMHandler } from '../../cognitive/conscious/handler'
export function generateChatAgentPrompt(): string {
return `You are a Minecraft bot assistant. Your task is to engage in natural conversation with players while helping them achieve their goals.
@@ -5,7 +5,7 @@ import type { Action } from '../../libs/mineflayer/action'
import { agent } from 'neuri'
import { system, user } from 'neuri/openai'
import { BaseLLMHandler } from '../../libs/llm-agent/handler'
import { BaseLLMHandler } from '../../cognitive/conscious/handler'
import { generatePlanningAgentSystemPrompt } from './system-prompt'
export async function createPlanningNeuriAgent(): Promise<Agent> {
@@ -2,7 +2,7 @@ import type { NeuriContext } from 'neuri'
import type { ChatCompletion } from 'neuri/openai'
import type { Logger } from '../../utils/logger'
import type { MineflayerWithAgents } from './types'
import type { MineflayerWithAgents } from '../types'
import { assistant } from 'neuri/openai'
@@ -2,7 +2,7 @@ import type { NeuriContext } from 'neuri'
import type { ChatCompletion, Message } from 'neuri/openai'
import type { Logger } from '../../utils/logger'
import type { LLMConfig, LLMResponse } from './types'
import type { LLMConfig, LLMResponse } from '../types'
import { withRetry } from '@moeru/std'
@@ -1,8 +1,8 @@
import type { Logg } from '@guiiai/logg'
import type { Neuri, NeuriContext } from 'neuri'
import type { EventManager } from './event-manager'
import type { BotEvent, MineflayerWithAgents, UserIntentPayload } from './types'
import type { EventManager } from '../perception/event-manager'
import type { BotEvent, MineflayerWithAgents, UserIntentPayload } from '../types'
import { withRetry } from '@moeru/std'
import { system, user } from 'neuri/openai'
@@ -1,4 +1,4 @@
import type { Mineflayer } from '../mineflayer'
import type { Mineflayer } from '../../libs/mineflayer'
import { listInventory } from '../../skills/actions/inventory'
@@ -4,11 +4,11 @@ import type { Neuri } from 'neuri'
import { useLogg } from '@guiiai/logg'
import { asClass, asFunction, createContainer, InjectionMode } from 'awilix'
import { ActionAgentImpl } from '../../agents/action'
import { ChatAgentImpl } from '../../agents/chat'
import { PlanningAgentImpl } from '../../agents/planning'
import { EventManager } from './event-manager'
import { Orchestrator } from './orchestrator'
import { ActionAgentImpl } from '../agents/action'
import { ChatAgentImpl } from '../agents/chat'
import { PlanningAgentImpl } from '../agents/planning'
import { Orchestrator } from './conscious/orchestrator'
import { EventManager } from './perception/event-manager'
import { ReflexManager } from './reflex/reflex-manager'
export interface ContainerServices {
@@ -1,12 +1,12 @@
import type { MineflayerPlugin } from '../mineflayer'
import type { MineflayerPlugin } from '../libs/mineflayer'
import type { LLMAgentOptions, MineflayerWithAgents } from './types'
import { system } from 'neuri/openai'
import { config } from '../../composables/config'
import { ChatMessageHandler } from '../mineflayer'
import { config } from '../composables/config'
import { ChatMessageHandler } from '../libs/mineflayer'
import { generateActionAgentPrompt } from './conscious/prompt'
import { createAgentContainer } from './container'
import { generateActionAgentPrompt } from './prompt'
export function LLMAgent(options: LLMAgentOptions): MineflayerPlugin {
return {
@@ -1,4 +1,4 @@
import type { BotEvent, EventType } from './types'
import type { BotEvent, EventType } from '../types'
import EventEmitter from 'eventemitter3'
@@ -1,6 +1,6 @@
import type { Logg } from '@guiiai/logg'
import type { EventManager } from '../event-manager'
import type { EventManager } from '../perception/event-manager'
import type { BotEvent, MineflayerWithAgents, UserIntentPayload } from '../types'
export class ReflexManager {
@@ -1,8 +1,8 @@
import type { Client } from '@proj-airi/server-sdk'
import type { Neuri } from 'neuri'
import type { Mineflayer } from '../mineflayer'
import type { ActionAgent, ChatAgent, PlanningAgent } from '../mineflayer/base-agent'
import type { Mineflayer } from '../libs/mineflayer'
import type { ActionAgent, ChatAgent, PlanningAgent } from '../libs/mineflayer/base-agent'
export interface LLMConfig {
agent: Neuri
+1 -1
View File
@@ -9,11 +9,11 @@ import { pathfinder as MineflayerPathfinder } from 'mineflayer-pathfinder'
import { plugin as MineflayerPVP } from 'mineflayer-pvp'
import { plugin as MineflayerTool } from 'mineflayer-tool'
import { LLMAgent } from './cognitive'
import { initBot } from './composables/bot'
import { config, initEnv } from './composables/config'
import { createNeuriAgent } from './composables/neuri'
import { DebugServer } from './debug-server'
import { LLMAgent } from './libs/llm-agent'
import { wrapPlugin } from './libs/mineflayer'
import { initLogger, useLogger } from './utils/logger'