Fixed blocked_actions to resolve merge in agent.js

This commit is contained in:
Ayush Maniar 2025-03-07 18:59:33 -08:00
parent c484ff8b82
commit c655370e16

View file

@ -3,7 +3,7 @@ import { Coder } from './coder.js';
import { Prompter } from '../models/prompter.js'; import { Prompter } from '../models/prompter.js';
import { initModes } from './modes.js'; import { initModes } from './modes.js';
import { initBot } from '../utils/mcdata.js'; import { initBot } from '../utils/mcdata.js';
import { containsCommand, commandExists, executeCommand, truncCommandMessage, isAction } from './commands/index.js'; import { containsCommand, commandExists, executeCommand, truncCommandMessage, isAction, blacklistCommands } from './commands/index.js';
import { ActionManager } from './action_manager.js'; import { ActionManager } from './action_manager.js';
import { NPCContoller } from './npc/controller.js'; import { NPCContoller } from './npc/controller.js';
import { MemoryBank } from './memory_bank.js'; import { MemoryBank } from './memory_bank.js';
@ -13,13 +13,10 @@ import { handleTranslation, handleEnglishTranslation } from '../utils/translator
import { addViewer } from './viewer.js'; import { addViewer } from './viewer.js';
import settings from '../../settings.js'; import settings from '../../settings.js';
import { serverProxy } from './agent_proxy.js'; import { serverProxy } from './agent_proxy.js';
// import { TechTreeHarvestValidator } from '../../tasks/validation_functions/task_validator.js';
import {getPosition} from './library/world.js'
import { Task } from './tasks.js'; import { Task } from './tasks.js';
export class Agent { export class Agent {
async start(profile_fp, load_mem=false, init_message=null, count_id=0, task_path=null, task_id=null) { async start(profile_fp, load_mem=false, init_message=null, count_id=0, task_path=null, task_id=null) {
this.last_sender = null; this.last_sender = null;
this.count_id = count_id; this.count_id = count_id;
try { try {
@ -50,7 +47,8 @@ export class Agent {
await this.prompter.initExamples(); await this.prompter.initExamples();
console.log('Initializing task...'); console.log('Initializing task...');
this.task = new Task(this, task_path, task_id); this.task = new Task(this, task_path, task_id);
this.blocked_actions = this.task.blocked_actions || []; const blocked_actions = settings.blocked_actions.concat(this.task.blocked_actions || []);
blacklistCommands(blocked_actions);
serverProxy.connect(this); serverProxy.connect(this);