@agenticmail/claudecode 0.1.1 → 0.1.2
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.
|
@@ -36,6 +36,20 @@ function loadPersonaForAgent(opts) {
|
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
// src/dispatcher.ts
|
|
39
|
+
function extractSubject(event) {
|
|
40
|
+
if (typeof event.subject === "string") return event.subject;
|
|
41
|
+
if (event.message && typeof event.message.subject === "string") return event.message.subject;
|
|
42
|
+
return void 0;
|
|
43
|
+
}
|
|
44
|
+
function extractFrom(event) {
|
|
45
|
+
if (typeof event.from === "string") return event.from;
|
|
46
|
+
if (event.message && Array.isArray(event.message.from)) {
|
|
47
|
+
const first = event.message.from[0];
|
|
48
|
+
if (first?.address) return first.address;
|
|
49
|
+
if (first?.name) return first.name;
|
|
50
|
+
}
|
|
51
|
+
return void 0;
|
|
52
|
+
}
|
|
39
53
|
var SEEN_CAP = 1024;
|
|
40
54
|
function rememberBounded(set, item) {
|
|
41
55
|
set.add(item);
|
|
@@ -119,8 +133,8 @@ function wrapSignal(signal) {
|
|
|
119
133
|
return c;
|
|
120
134
|
}
|
|
121
135
|
function newMailPrompt(agent, event) {
|
|
122
|
-
const from = event
|
|
123
|
-
const subject = event
|
|
136
|
+
const from = extractFrom(event) ?? "unknown sender";
|
|
137
|
+
const subject = extractSubject(event) ?? "(no subject)";
|
|
124
138
|
const uid = event.uid;
|
|
125
139
|
return [
|
|
126
140
|
`You have new mail.`,
|
|
@@ -212,9 +226,10 @@ var Dispatcher = class {
|
|
|
212
226
|
if (event.type === "new" && typeof event.uid === "number") {
|
|
213
227
|
const ch = this.channels.get(account.id);
|
|
214
228
|
if (ch?.seenUids.has(event.uid)) return;
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
229
|
+
const subject = extractSubject(event);
|
|
230
|
+
if (ch && Date.now() < ch.suppressTaskMailUntilMs && isTaskNotificationSubject(subject)) {
|
|
231
|
+
this.log("info", `[dispatcher] suppressed task-notification mail wake for "${account.name}" (uid=${event.uid}, subject="${subject}") \u2014 task event already dispatched`);
|
|
232
|
+
rememberBounded(ch.seenUids, event.uid);
|
|
218
233
|
return;
|
|
219
234
|
}
|
|
220
235
|
if (ch) rememberBounded(ch.seenUids, event.uid);
|
package/dist/dispatcher-bin.js
CHANGED
package/dist/dispatcher.d.ts
CHANGED
|
@@ -45,7 +45,19 @@ interface SSEEvent {
|
|
|
45
45
|
type?: string;
|
|
46
46
|
uid?: number;
|
|
47
47
|
from?: string;
|
|
48
|
+
/**
|
|
49
|
+
* Subject MAY appear at top-level on some code paths AND nested under
|
|
50
|
+
* `message.subject` on others (the master API enriches new-mail events
|
|
51
|
+
* with the full IMAP envelope, which lands under `message`). Always use
|
|
52
|
+
* `extractSubject(event)` rather than reading either path directly.
|
|
53
|
+
*/
|
|
48
54
|
subject?: string;
|
|
55
|
+
message?: {
|
|
56
|
+
subject?: string;
|
|
57
|
+
from?: unknown;
|
|
58
|
+
to?: unknown;
|
|
59
|
+
messageId?: string;
|
|
60
|
+
};
|
|
49
61
|
taskId?: string;
|
|
50
62
|
taskType?: string;
|
|
51
63
|
task?: string;
|
package/dist/dispatcher.js
CHANGED
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agenticmail/claudecode",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Claude Code integration for AgenticMail — surfaces every AgenticMail agent as a native Claude Code subagent so any Claude Code session can delegate to them with the Agent tool",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|