refactor tasks to task folder, readd license

This commit is contained in:
MaxRobinsonTheGreat 2025-04-21 12:20:06 -05:00
parent bfd55a6791
commit 475311d8e6
9 changed files with 40 additions and 22 deletions

21
LICENSE Normal file
View file

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2024 Kolby Nottingham
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View file

@ -14,7 +14,7 @@ import { handleTranslation, handleEnglishTranslation } from '../utils/translator
import { addBrowserViewer } from './vision/browser_viewer.js';
import settings from '../../settings.js';
import { serverProxy } from './agent_proxy.js';
import { Task } from './tasks.js';
import { Task } from './tasks/tasks.js';
import { say } from './speak.js';
export class Agent {
@ -62,7 +62,6 @@ export class Agent {
} else {
taskStart = Date.now();
}
// incorporate new restart time into task
this.task = new Task(this, task_path, task_id, taskStart);
this.blocked_actions = settings.blocked_actions.concat(this.task.blocked_actions || []);
blacklistCommands(this.blocked_actions);

View file

@ -2,7 +2,7 @@ import * as world from '../library/world.js';
import * as mc from '../../utils/mcdata.js';
import { getCommandDocs } from './index.js';
import convoManager from '../conversation.js';
import { checkLevelBlueprint, checkBlueprint } from '../task_types/construction_tasks.js';
import { checkLevelBlueprint, checkBlueprint } from '../tasks/construction_tasks.js';
import { load } from 'cheerio';
const pad = (str) => {

View file

@ -1,10 +1,9 @@
import { readFileSync , writeFileSync, existsSync} from 'fs';
import { executeCommand } from './commands/index.js';
import { getPosition } from './library/world.js';
import settings from '../../settings.js';
import { Vec3 } from 'vec3';
import { ConstructionTaskValidator, Blueprint } from './task_types/construction_tasks.js';
import { CookingTaskInitiator } from './task_types/cooking_tasks.js';
import { executeCommand } from '../commands/index.js';
import { getPosition } from '../library/world.js';
import settings from '../../../settings.js';
import { ConstructionTaskValidator, Blueprint } from './construction_tasks.js';
import { CookingTaskInitiator } from './cooking_tasks.js';
const PROGRESS_FILE = './hells_kitchen_progress.json';
@ -237,27 +236,23 @@ export class Task {
constructor(agent, task_path, task_id, taskStartTime = null) {
this.agent = agent;
this.data = null;
console.log("task start time", taskStartTime);
if (taskStartTime !== null)
this.taskStartTime = taskStartTime;
else
this.taskStartTime = Date.now();
console.log(this.taskStartTime);
this.validator = null;
this.reset_function = null;
this.blocked_actions = [];
this.task_id = task_id;
console.log('Task ID:', task_id);
// Reset hells_kitchen progress when a new task starts
if (task_id && task_id.endsWith('hells_kitchen')) {
hellsKitchenProgressManager.resetTask(task_id);
console.log('Reset Hells Kitchen progress for new task');
}
if (task_path && task_id) {
console.log('Starting task', task_id);
if (task_id.endsWith('hells_kitchen')) {
// Reset hells_kitchen progress when a new task starts
hellsKitchenProgressManager.resetTask(task_id);
console.log('Reset Hells Kitchen progress for new task');
}
this.data = this.loadTask(task_path, task_id);
this.task_type = this.data.type;
if (this.task_type === 'construction' && this.data.blueprint) {
@ -292,6 +287,9 @@ export class Task {
if (this.conversation)
this.blocked_actions.push('!endConversation');
}
else {
console.log('No task.');
}
this.name = this.agent.name;
this.available_agents = settings.profiles.map((p) => JSON.parse(readFileSync(p, 'utf8')).name);

View file

@ -31,4 +31,4 @@ The generation code is documented to help with customization.
- `profiles/task_construct.json` - Default configuration profile
- `tasks/construction_tasks/test_multiagent_construction_tasks.json` - Training task definitions (initalized with 5 variants)
- `tasks/construction_tasks/test_multiagent_construction_tasks.json` - Test task definitions (initalized with 1 variant)
- `src/agent/task_types/construction_tasks.js` - Blueprint Class, Construction Validation Class, and Procedural Generation Function
- `src/agent/tasks/construction_tasks.js` - Blueprint Class, Construction Validation Class, and Procedural Generation Function

View file

@ -1,6 +1,6 @@
import fs from 'fs';
import path from 'path';
import {proceduralGeneration} from "../../src/agent/task_types/construction_tasks.js";
import {proceduralGeneration} from "../../src/agent/tasks/construction_tasks.js";
//note 'main' (script to run generation of tasks) is at bottom of page

View file

@ -1,5 +1,5 @@
import mineflayer from 'mineflayer';
import { worldToBlueprint, blueprintToTask } from '../../src/agent/task_types/construction_tasks.js';
import { worldToBlueprint, blueprintToTask } from '../../src/agent/tasks/construction_tasks.js';
import fs from 'fs';
import { start } from 'repl';