mindcraft/main.js

44 lines
1.1 KiB
JavaScript
Raw Normal View History

2023-12-21 15:11:38 -07:00
import { AgentProcess } from './src/process/agent-process.js';
2024-05-29 21:49:45 -05:00
import settings from './settings.js';
2024-09-08 21:07:25 -04:00
import yargs from 'yargs';
import { hideBin } from 'yargs/helpers';
import { createMindServer } from './src/server/mind_server.js';
2023-12-09 21:40:53 -06:00
2024-09-08 21:07:25 -04:00
function parseArguments() {
return yargs(hideBin(process.argv))
.option('profiles', {
type: 'array',
describe: 'List of agent profile paths',
})
.help()
.alias('help', 'h')
.parse();
}
2024-09-08 21:07:25 -04:00
function getProfiles(args) {
return args.profiles || settings.profiles;
2024-09-08 21:07:25 -04:00
}
2024-11-25 17:15:23 -06:00
async function main() {
2024-11-19 22:21:17 -06:00
if (settings.host_mindserver) {
const mindServer = createMindServer();
}
2024-09-08 21:07:25 -04:00
const args = parseArguments();
const profiles = getProfiles(args);
console.log(profiles);
2024-09-08 21:07:25 -04:00
const { load_memory, init_message } = settings;
for (let i=0; i<profiles.length; i++) {
2024-09-08 21:07:25 -04:00
const agent = new AgentProcess();
agent.start(profiles[i], load_memory, init_message, i);
2024-11-25 17:15:23 -06:00
await new Promise(resolve => setTimeout(resolve, 1000));
2024-09-08 21:07:25 -04:00
}
}
try {
main();
} catch (error) {
console.error('An error occurred:', error);
process.exit(1);
}