mirror of
https://github.com/kolbytn/mindcraft.git
synced 2025-04-29 19:44:53 +02:00
Merge branch 'main' into agent-chat
This commit is contained in:
commit
271d17f650
1 changed files with 12 additions and 12 deletions
|
@ -285,40 +285,40 @@ async function execute(mode, agent, func, timeout=-1) {
|
||||||
}
|
}
|
||||||
|
|
||||||
let _agent = null;
|
let _agent = null;
|
||||||
|
const modes_map = {};
|
||||||
|
for (let mode of modes_list) {
|
||||||
|
modes_map[mode.name] = mode;
|
||||||
|
}
|
||||||
|
|
||||||
class ModeController {
|
class ModeController {
|
||||||
/*
|
/*
|
||||||
SECURITY WARNING:
|
SECURITY WARNING:
|
||||||
This object is accessible by LLM generated code, as are all of its references.
|
ModesController must be isolated. Do not store references to external objects like `agent`.
|
||||||
This can be used to access sensitive information like API keys by malicious human prompters.
|
This object is accessible by LLM generated code, so any stored references are also accessible.
|
||||||
Do not store references to anything outside this object to prevent this.
|
This can be used to expose sensitive information by malicious human prompters.
|
||||||
*/
|
*/
|
||||||
constructor() {
|
constructor() {
|
||||||
this.modes_map = {};
|
|
||||||
this.behavior_log = '';
|
this.behavior_log = '';
|
||||||
for (let mode of modes_list) {
|
|
||||||
this.modes_map[mode.name] = mode;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
exists(mode_name) {
|
exists(mode_name) {
|
||||||
return this.modes_map[mode_name] != null;
|
return modes_map[mode_name] != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
setOn(mode_name, on) {
|
setOn(mode_name, on) {
|
||||||
this.modes_map[mode_name].on = on;
|
modes_map[mode_name].on = on;
|
||||||
}
|
}
|
||||||
|
|
||||||
isOn(mode_name) {
|
isOn(mode_name) {
|
||||||
return this.modes_map[mode_name].on;
|
return modes_map[mode_name].on;
|
||||||
}
|
}
|
||||||
|
|
||||||
pause(mode_name) {
|
pause(mode_name) {
|
||||||
this.modes_map[mode_name].paused = true;
|
modes_map[mode_name].paused = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
unpause(mode_name) {
|
unpause(mode_name) {
|
||||||
this.modes_map[mode_name].paused = false;
|
modes_map[mode_name].paused = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
unPauseAll() {
|
unPauseAll() {
|
||||||
|
|
Loading…
Add table
Reference in a new issue