From 0ee3adf3e0c914768569735544341a1ba40f1e26 Mon Sep 17 00:00:00 2001 From: mmaheshwari2 Date: Mon, 3 Mar 2025 12:24:59 -0800 Subject: [PATCH 1/2] debugging merge --- andy.json | 2 +- jill.json | 2 +- settings.js | 2 +- src/agent/tasks.js | 59 ++++++---------------------------------------- 4 files changed, 10 insertions(+), 55 deletions(-) diff --git a/andy.json b/andy.json index 1d47168..0278fca 100644 --- a/andy.json +++ b/andy.json @@ -1,7 +1,7 @@ { "name": "andy", - "model": "gpt-4o", + "model": "gpt-4o-mini", "conversation_examples": [ [ diff --git a/jill.json b/jill.json index d81be99..07adabe 100644 --- a/jill.json +++ b/jill.json @@ -1,7 +1,7 @@ { "name": "jill", - "model": "gpt-4o", + "model": "gpt-4o-mini", "conversation_examples": [ [ diff --git a/settings.js b/settings.js index e51d54d..a8ce77f 100644 --- a/settings.js +++ b/settings.js @@ -35,7 +35,7 @@ export default "language": "en", // translate to/from this language. Supports these language names: https://cloud.google.com/translate/docs/languages "show_bot_views": false, // show bot's view in browser at localhost:3000, 3001... - "allow_insecure_coding": false, // allows newAction command and model can write/run code on your computer. enable at own risk + "allow_insecure_coding": true, // allows newAction command and model can write/run code on your computer. enable at own risk "code_timeout_mins": -1, // minutes code is allowed to run. -1 for no timeout "relevant_docs_count": 5, // Parameter: -1 = all, 0 = no references, 5 = five references. If exceeding the maximum, all reference documents are returned. diff --git a/src/agent/tasks.js b/src/agent/tasks.js index 9e12dd2..40de11a 100644 --- a/src/agent/tasks.js +++ b/src/agent/tasks.js @@ -3,9 +3,7 @@ import { executeCommand } from './commands/index.js'; import { getPosition } from './library/world.js'; import settings from '../../settings.js'; import { CookingTaskInitiator } from './task_types/cooking_tasks.js'; -import { Vec3 } from 'vec3'; import { ConstructionTaskValidator, Blueprint } from './construction_tasks.js'; -import {autoBuild, autoDelete} from "../../test/test_blueprint_layout.js"; /** * Validates the presence of required items in an agent's inventory @@ -124,7 +122,7 @@ export class Task { this.blocked_actions = []; this.task_id = task_id; if (task_path && task_id) { - this.data = this.loadTask(task_path, task_id); //todo: does this even return anything? + this.data = this.loadTask(task_path, task_id); this.task_type = this.data.type; if (this.task_type === 'construction' && this.data.blueprint) { this.blueprint = new Blueprint(this.data.blueprint); @@ -183,7 +181,7 @@ export class Task { } // If goal is an object, get the goal for this agent's count_id - if (typeof this.data.goal === 'object' && this.data.goal !== null) { + if (typeof this.data.goal === 'object') { const agentId = this.agent.count_id.toString(); return (this.data.goal[agentId] || '') + add_string; } @@ -212,7 +210,7 @@ export class Task { } isDone() { - if (this.validator && this.validator()) + if (this.validator && this.validator.validate()) //todo: error here return {"message": 'Task successful', "code": 2}; let other_names = this.available_agents.filter(n => n !== this.name); @@ -257,7 +255,7 @@ export class Task { if (this.data.initial_inventory) { console.log("Setting inventory..."); - let initialInventory = {}; + let initialInventory; // Handle multi-agent inventory assignment if (this.data.agent_count > 1) { @@ -364,8 +362,8 @@ export class Task { if (this.data.agent_count && this.data.agent_count > 1) { // TODO wait for other bots to join await new Promise((resolve) => setTimeout(resolve, 10000)); - if (available_agents.length < this.data.agent_count) { - console.log(`Missing ${this.data.agent_count - available_agents.length} bot(s).`); + if (this.available_agents.length < this.data.agent_count) { + console.log(`Missing ${this.data.agent_count - this.available_agents.length} bot(s).`); this.agent.killAll(); } } @@ -376,7 +374,7 @@ export class Task { } if (this.conversation && this.agent.count_id === 0) { - let other_name = available_agents.filter(n => n !== name)[0]; + let other_name = this.available_agents.filter(n => n !== this.name)[0]; await executeCommand(this.agent, `!startConversation("${other_name}", "${this.conversation}")`); } @@ -397,47 +395,4 @@ export class Task { } } } -} - -export function giveBlueprint(agent, blueprint) { - let bot = agent.bot; - let name = agent.name; - let blueprint_name = blueprint.name; - let blueprint_count = blueprint.count; - bot.chat(`/clear ${name}`); - console.log(`Cleared ${name}'s inventory.`); - bot.chat(`/give ${name} ${blueprint_name} ${blueprint_count}`); - console.log(`Gave ${name} ${blueprint_count} ${blueprint_name}(s).`); -} - -/** - * Auto-builds blueprint in minecraft world - * @param agent - * @param blueprint must be of the blueprint class - */ -export function buildBlueprint(agent, blueprint){ - let bot = agent.bot - const result = blueprint.autoBuild(); - // const result = clearHouse(blueprint) - const commands = result.commands; - const nearbyPosition = result.nearbyPosition; - for (const command of commands) { - bot.chat(command); - } -} - - -/** - * auto-deletes a built blueprint - * @param agent - * @param blueprint must be of the blueprint class - */ -export function deleteBlueprint(agent, blueprint){ - let bot = agent.bot - const result = blueprint.autoDelete() - const commands = result.commands; - const nearbyPosition = result.nearbyPosition; - for (const command of commands) { - bot.chat(command); - } } \ No newline at end of file From 173e7c54b8bab829063f60b63a44fb0bf98c4825 Mon Sep 17 00:00:00 2001 From: Ayush Maniar Date: Tue, 4 Mar 2025 10:37:05 -0800 Subject: [PATCH 2/2] Replaced items in the chest --- src/agent/task_types/cooking_tasks.js | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/agent/task_types/cooking_tasks.js b/src/agent/task_types/cooking_tasks.js index 9f97d9b..6c42d74 100644 --- a/src/agent/task_types/cooking_tasks.js +++ b/src/agent/task_types/cooking_tasks.js @@ -326,12 +326,8 @@ export class CookingTaskInitiator { ['minecraft:honey_bottle', 1], // Non-stackable ['minecraft:glow_berries', 64], ['minecraft:bowl', 64], - ['minecraft:golden_carrot', 64], - ['minecraft:golden_apple', 64], - ['minecraft:enchanted_golden_apple', 64], - ['minecraft:cooked_mutton', 64], - ['minecraft:cooked_salmon', 64], - ['minecraft:cooked_cod', 64] + ['minecraft:gold_ingot', 64], + ['minecraft:oak_planks', 64], ]; // Fill the chest with random cooking items