opencode-mailbox 0.0.8 → 0.0.9
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/index.js +15 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -12776,8 +12776,8 @@ function startMailWatch(client, recipient, sessionId, instructions) {
|
|
|
12776
12776
|
}
|
|
12777
12777
|
for (const message of unreadMessages) {
|
|
12778
12778
|
await markMessageAsRead(client, recipient, message.timestamp);
|
|
12779
|
-
await injectMailMessage(client, sessionId, recipient, message, instructions);
|
|
12780
12779
|
}
|
|
12780
|
+
await injectMailMessages(client, sessionId, recipient, unreadMessages, instructions);
|
|
12781
12781
|
} catch (error45) {
|
|
12782
12782
|
if (isDatabaseFileError(error45)) {
|
|
12783
12783
|
console.error(`[Mailbox] Database file error for ${recipient}, resetting connection...`);
|
|
@@ -12799,15 +12799,25 @@ function stopMailWatch(recipient) {
|
|
|
12799
12799
|
activeWatches.delete(recipient);
|
|
12800
12800
|
}
|
|
12801
12801
|
}
|
|
12802
|
-
async function
|
|
12803
|
-
|
|
12804
|
-
|
|
12802
|
+
async function injectMailMessages(client, sessionId, recipient, messages, instructions) {
|
|
12803
|
+
let injectedText = `[MAIL BATCH] You have ${messages.length} new message(s) for ${recipient}
|
|
12804
|
+
|
|
12805
|
+
`;
|
|
12806
|
+
for (const message of messages) {
|
|
12807
|
+
const timestamp = new Date(message.timestamp).toISOString();
|
|
12808
|
+
injectedText += `---
|
|
12809
|
+
From: ${message.from}
|
|
12805
12810
|
To: ${recipient}
|
|
12806
12811
|
Time: ${timestamp}
|
|
12807
12812
|
|
|
12808
12813
|
${message.message}
|
|
12809
12814
|
|
|
12810
|
-
|
|
12815
|
+
`;
|
|
12816
|
+
}
|
|
12817
|
+
injectedText += `---
|
|
12818
|
+
[Instructions: ${instructions}]
|
|
12819
|
+
|
|
12820
|
+
IMPORTANT: remember in order for a sender to see your response, you must send them a mail back`;
|
|
12811
12821
|
try {
|
|
12812
12822
|
await client.session.prompt({
|
|
12813
12823
|
path: { id: sessionId },
|