naisys 1.3.0 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/apps/llmail.js
CHANGED
|
@@ -69,6 +69,7 @@ async function init() {
|
|
|
69
69
|
}
|
|
70
70
|
});
|
|
71
71
|
}
|
|
72
|
+
export const waitingForMailMessage = "Waiting for new mail messages...";
|
|
72
73
|
export async function handleCommand(args) {
|
|
73
74
|
const argParams = args.split(" ");
|
|
74
75
|
if (!argParams[0]) {
|
|
@@ -85,6 +86,7 @@ export async function handleCommand(args) {
|
|
|
85
86
|
return `llmail <command>
|
|
86
87
|
users: Get list of users on the system
|
|
87
88
|
send "<users>" "subject" "message": Send a message. ${config.mailMessageTokenMax} token max.
|
|
89
|
+
wait: Pause the session until a new mail message is received
|
|
88
90
|
|
|
89
91
|
* Attachments are not supported, use file paths to refence files in emails as all users are on the same machine`;
|
|
90
92
|
}
|
|
@@ -93,6 +95,7 @@ export async function handleCommand(args) {
|
|
|
93
95
|
no params: List all active threads
|
|
94
96
|
users: Get list of users on the system
|
|
95
97
|
send "<users>" "subject" "message": Send a new mail, starting a new thread
|
|
98
|
+
wait: Pause the session until a new mail message is received
|
|
96
99
|
read <id>: Read a thread
|
|
97
100
|
reply <id> <message>: Reply to a thread
|
|
98
101
|
adduser <id> <username>: Add a user to thread with id
|
|
@@ -106,6 +109,9 @@ export async function handleCommand(args) {
|
|
|
106
109
|
const message = newParams[5];
|
|
107
110
|
return await newThread(usernames, subject, message);
|
|
108
111
|
}
|
|
112
|
+
case "wait": {
|
|
113
|
+
return waitingForMailMessage;
|
|
114
|
+
}
|
|
109
115
|
case "read": {
|
|
110
116
|
const threadId = parseInt(argParams[1]);
|
|
111
117
|
return await readThread(threadId);
|
|
@@ -90,15 +90,17 @@ export async function processCommand(prompt, consoleInput) {
|
|
|
90
90
|
}
|
|
91
91
|
break;
|
|
92
92
|
}
|
|
93
|
-
// With no argument, in debug mode, pause will pause forever,
|
|
94
|
-
// in LLM mode it will pause until a message is receieved
|
|
95
|
-
// Don't want the llm to hang itself, but it still can if it's the only agent or if all the agents pause..
|
|
96
|
-
// The setting only lasts for the next command, next loop it uses the agent default
|
|
97
93
|
case "pause": {
|
|
94
|
+
const pauseSeconds = cmdArgs ? parseInt(cmdArgs) : 0;
|
|
95
|
+
// Don't allow the LLM to hang itself
|
|
96
|
+
if (inputMode.current === InputMode.LLM && !pauseSeconds) {
|
|
97
|
+
await contextManager.append("Puase command requires a number of seconds to pause for");
|
|
98
|
+
break;
|
|
99
|
+
}
|
|
98
100
|
return {
|
|
99
101
|
nextCommandAction: NextCommandAction.Continue,
|
|
100
|
-
pauseSeconds
|
|
101
|
-
wakeOnMessage:
|
|
102
|
+
pauseSeconds,
|
|
103
|
+
wakeOnMessage: false, // llmail has a 'wait' command that is useful in multi-agent situations
|
|
102
104
|
};
|
|
103
105
|
}
|
|
104
106
|
case "cost": {
|
|
@@ -114,6 +116,13 @@ export async function processCommand(prompt, consoleInput) {
|
|
|
114
116
|
case "llmail": {
|
|
115
117
|
const mailResponse = await llmail.handleCommand(cmdArgs);
|
|
116
118
|
await contextManager.append(mailResponse);
|
|
119
|
+
if (mailResponse == llmail.waitingForMailMessage) {
|
|
120
|
+
return {
|
|
121
|
+
nextCommandAction: NextCommandAction.Continue,
|
|
122
|
+
pauseSeconds: 0,
|
|
123
|
+
wakeOnMessage: true,
|
|
124
|
+
};
|
|
125
|
+
}
|
|
117
126
|
break;
|
|
118
127
|
}
|
|
119
128
|
case "context":
|
|
@@ -40,7 +40,9 @@ export async function run() {
|
|
|
40
40
|
await contextManager.append(latestDream);
|
|
41
41
|
}
|
|
42
42
|
for (const initialCommand of config.agent.initialCommands) {
|
|
43
|
-
|
|
43
|
+
const prompt = await promptBuilder.getPrompt(0, false);
|
|
44
|
+
await contextManager.append(prompt, ContentSource.ConsolePrompt);
|
|
45
|
+
await commandHandler.processCommand(prompt, config.resolveConfigVars(initialCommand));
|
|
44
46
|
}
|
|
45
47
|
inputMode.toggle(InputMode.Debug);
|
|
46
48
|
let pauseSeconds = config.agent.debugPauseSeconds;
|
|
@@ -141,12 +143,22 @@ async function handleErrorAndSwitchToDebugMode(e, llmErrorCount, addToContext) {
|
|
|
141
143
|
wakeOnMessage,
|
|
142
144
|
};
|
|
143
145
|
}
|
|
146
|
+
let mailBlackoutCountdown = 0;
|
|
144
147
|
async function checkNewMailNotification() {
|
|
148
|
+
let supressMail = false;
|
|
149
|
+
if (mailBlackoutCountdown > 0) {
|
|
150
|
+
mailBlackoutCountdown--;
|
|
151
|
+
supressMail = true;
|
|
152
|
+
}
|
|
145
153
|
// Check for unread threads
|
|
146
154
|
const unreadThreads = await llmail.getUnreadThreads();
|
|
147
155
|
if (!unreadThreads.length) {
|
|
148
156
|
return;
|
|
149
157
|
}
|
|
158
|
+
if (supressMail) {
|
|
159
|
+
await output.commentAndLog(`New mail notifications blackout in effect. ${mailBlackoutCountdown} cycles remaining.`);
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
150
162
|
// Get the new messages for each thread
|
|
151
163
|
const newMessages = [];
|
|
152
164
|
for (const { threadId, newMsgId } of unreadThreads) {
|
|
@@ -166,10 +178,11 @@ async function checkNewMailNotification() {
|
|
|
166
178
|
for (const unreadThread of unreadThreads) {
|
|
167
179
|
await llmail.markAsRead(unreadThread.threadId);
|
|
168
180
|
}
|
|
181
|
+
mailBlackoutCountdown = config.mailBlackoutCycles;
|
|
169
182
|
}
|
|
170
183
|
else if (llmail.simpleMode) {
|
|
171
184
|
await contextManager.append(`You have new mail, but not enough context to read them.\n` +
|
|
172
|
-
`
|
|
185
|
+
`After you 'endsession' and the context resets, you will be able to read them.`, ContentSource.Console);
|
|
173
186
|
}
|
|
174
187
|
// LLM will in many cases end the session here, when the new session starts
|
|
175
188
|
// this code will run again, and show a full preview of the messages
|
package/dist/config.js
CHANGED
|
@@ -8,10 +8,14 @@ program.argument("<agent-path>", "Path to agent configuration file").parse();
|
|
|
8
8
|
dotenv.config();
|
|
9
9
|
/** The system name that shows after the @ in the command prompt */
|
|
10
10
|
export const hostname = "naisys";
|
|
11
|
-
|
|
12
|
-
export const
|
|
11
|
+
/** Limits the size of files that can be read/wrote */
|
|
12
|
+
export const shellOutputTokenMax = 2500; //
|
|
13
|
+
/** The number of seconds NAISYS will wait for a shell command to complete */
|
|
14
|
+
export const shellCommmandTimeoutSeconds = 15;
|
|
13
15
|
export const webTokenMax = 2500;
|
|
14
16
|
export const mailMessageTokenMax = 400;
|
|
17
|
+
/** Used to prevent the agent from constantly responding to mail and not getting any work done */
|
|
18
|
+
export const mailBlackoutCycles = 3;
|
|
15
19
|
/* .env is used for global configs across naisys, while agent configs are for the specific agent */
|
|
16
20
|
export const naisysFolder = getEnv("NAISYS_FOLDER", true);
|
|
17
21
|
export const websiteFolder = getEnv("WEBSITE_FOLDER");
|
|
@@ -45,7 +45,7 @@ NAISYS Commands: (cannot be used with other commands on the same prompt)
|
|
|
45
45
|
llmail: A local mail system for communicating with your team
|
|
46
46
|
llmynx: A context optimized web browser. Enter 'llmynx help' to learn how to use it
|
|
47
47
|
comment "<thought>": Any non-command output like thinking out loud, prefix with the 'comment' command
|
|
48
|
-
pause <seconds>: Pause for <seconds>
|
|
48
|
+
pause <seconds>: Pause for <seconds>
|
|
49
49
|
endsession "<note>": Ends this session, clears the console log and context.
|
|
50
50
|
The note should help you find your bearings in the next session.
|
|
51
51
|
The note should contain your next goal, and important things should you remember.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "naisys",
|
|
3
3
|
"description": "Node.js Autonomous Intelligence System",
|
|
4
|
-
"version": "1.3.
|
|
4
|
+
"version": "1.3.1",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/naisys.js",
|
|
7
7
|
"preferGlobal": true,
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"naisys": "bin/naisys"
|
|
10
10
|
},
|
|
11
11
|
"scripts": {
|
|
12
|
-
"compile/run/attachable": "tsc && node --inspect dist/naisys.js ./agents/
|
|
12
|
+
"compile/run/attachable": "tsc && node --inspect dist/naisys.js ./agents/juicer.yaml",
|
|
13
13
|
"agent:dev": "node dist/naisys.js ./agents/3-team-dev-db-content/dev.yaml",
|
|
14
14
|
"agent:db": "node dist/naisys.js ./agents/3-team-dev-db-content/db.yaml",
|
|
15
15
|
"agent:content": "node dist/naisys.js ./agents/3-team-dev-db-content/content.yaml",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"dotenv": "16.4.5",
|
|
62
62
|
"escape-html": "1.0.3",
|
|
63
63
|
"js-yaml": "4.1.0",
|
|
64
|
-
"openai": "4.29.
|
|
64
|
+
"openai": "4.29.1",
|
|
65
65
|
"sqlite": "5.1.1",
|
|
66
66
|
"sqlite3": "5.1.7",
|
|
67
67
|
"text-table": "0.2.0",
|