@agenticmail/core 0.7.2 → 0.7.4
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/README.md +17 -1
- package/dist/index.cjs +29 -0
- package/dist/index.d.cts +7 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +29 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="https://raw.githubusercontent.com/agenticmail/agenticmail/main/docs/images/logo-200.png" alt="AgenticMail logo (pink bow)" width="180" />
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
<h1 align="center">@agenticmail/core</h1>
|
|
2
6
|
|
|
3
7
|
Core SDK for [AgenticMail](https://github.com/agenticmail/agenticmail) — the first platform to give AI agents real email addresses and phone numbers.
|
|
4
8
|
|
|
@@ -6,6 +10,18 @@ This is the foundation layer that everything else builds on. If the API server,
|
|
|
6
10
|
|
|
7
11
|
Every other AgenticMail package depends on this one.
|
|
8
12
|
|
|
13
|
+
## ✨ What's new in 0.7.4
|
|
14
|
+
|
|
15
|
+
- **⭐ `MailReceiver.setStarred(uid, starred, mailbox?)`** — toggles IMAP's `\Flagged` flag via `messageFlagsAdd` / `messageFlagsRemove`. Same on-disk bit Gmail's star uses. Underpins the new `POST /mail/messages/:uid/star` route in `@agenticmail/api`.
|
|
16
|
+
- **📐 Task `output_schema` column** — migration `014_task_output_schema.sql` adds an optional `output_schema TEXT` column to `agent_tasks`. Stores the assigner-supplied JSON Schema for typed task contracts. `NULL` means "no schema, accept anything", fully back-compat with the v0.8.x task model.
|
|
17
|
+
|
|
18
|
+
## ✨ Earlier — 0.7.2
|
|
19
|
+
|
|
20
|
+
- **`list_inbox` / `inbox_digest` consistency fix** — `MailReceiver.listEnvelopes` no longer trusts the stale cached `mailbox.exists` count and early-returns empty when an internal mail just landed. `getMailboxInfo` now issues an IMAP `NOOP` to refresh state before reading `client.mailbox`. `SEARCH` is the authoritative source; `list_inbox` and `inbox_digest` now agree.
|
|
21
|
+
- **Custom outgoing headers** — the `headers` field on `SendMailOptions` is fully plumbed through to nodemailer, so callers (the API, the MCP server) can set `X-AgenticMail-Wake` and other custom headers for downstream consumers to read.
|
|
22
|
+
|
|
23
|
+
The wake / thread-close / web UI features live in the API and dispatcher layers above this package; `core` provides the primitives they all share.
|
|
24
|
+
|
|
9
25
|
---
|
|
10
26
|
|
|
11
27
|
## Table of Contents
|
package/dist/index.cjs
CHANGED
|
@@ -1011,6 +1011,24 @@ var MailReceiver = class {
|
|
|
1011
1011
|
lock.release();
|
|
1012
1012
|
}
|
|
1013
1013
|
}
|
|
1014
|
+
/**
|
|
1015
|
+
* Flag / unflag a message. IMAP uses `\Flagged` for what Gmail
|
|
1016
|
+
* calls "starred" — same on-disk bit, different vocabulary. We
|
|
1017
|
+
* expose it as `setStarred(uid, true|false)` so the web UI can
|
|
1018
|
+
* call a single endpoint with a boolean.
|
|
1019
|
+
*/
|
|
1020
|
+
async setStarred(uid, starred, mailbox = "INBOX") {
|
|
1021
|
+
const lock = await this.client.getMailboxLock(mailbox);
|
|
1022
|
+
try {
|
|
1023
|
+
if (starred) {
|
|
1024
|
+
await this.client.messageFlagsAdd(String(uid), ["\\Flagged"], { uid: true });
|
|
1025
|
+
} else {
|
|
1026
|
+
await this.client.messageFlagsRemove(String(uid), ["\\Flagged"], { uid: true });
|
|
1027
|
+
}
|
|
1028
|
+
} finally {
|
|
1029
|
+
lock.release();
|
|
1030
|
+
}
|
|
1031
|
+
}
|
|
1014
1032
|
/** Move a message to another folder */
|
|
1015
1033
|
async moveMessage(uid, fromMailbox, toMailbox) {
|
|
1016
1034
|
const lock = await this.client.getMailboxLock(fromMailbox);
|
|
@@ -3470,6 +3488,17 @@ CREATE INDEX IF NOT EXISTS idx_pending_outbound_agent ON pending_outbound(agent_
|
|
|
3470
3488
|
"013_pending_notification_id.sql": `
|
|
3471
3489
|
ALTER TABLE pending_outbound ADD COLUMN notification_message_id TEXT;
|
|
3472
3490
|
CREATE INDEX IF NOT EXISTS idx_pending_notification ON pending_outbound(notification_message_id);
|
|
3491
|
+
`,
|
|
3492
|
+
"014_task_output_schema.sql": `
|
|
3493
|
+
-- Typed task contracts: when an assigner cares about the shape of the
|
|
3494
|
+
-- deliverable, they can attach a JSON Schema describing what
|
|
3495
|
+
-- submit_result must look like. The API validates against it before
|
|
3496
|
+
-- accepting the result, so workers can't return free-form prose when
|
|
3497
|
+
-- a structured object was requested.
|
|
3498
|
+
--
|
|
3499
|
+
-- Column is optional; NULL means "no schema, accept anything" (the
|
|
3500
|
+
-- v0.8.x behaviour, fully back-compat).
|
|
3501
|
+
ALTER TABLE agent_tasks ADD COLUMN output_schema TEXT;
|
|
3473
3502
|
`
|
|
3474
3503
|
};
|
|
3475
3504
|
function runMigrations(database) {
|
package/dist/index.d.cts
CHANGED
|
@@ -473,6 +473,13 @@ declare class MailReceiver {
|
|
|
473
473
|
deleteMessage(uid: number, mailbox?: string): Promise<void>;
|
|
474
474
|
/** Mark a message as unseen (unread) */
|
|
475
475
|
markUnseen(uid: number, mailbox?: string): Promise<void>;
|
|
476
|
+
/**
|
|
477
|
+
* Flag / unflag a message. IMAP uses `\Flagged` for what Gmail
|
|
478
|
+
* calls "starred" — same on-disk bit, different vocabulary. We
|
|
479
|
+
* expose it as `setStarred(uid, true|false)` so the web UI can
|
|
480
|
+
* call a single endpoint with a boolean.
|
|
481
|
+
*/
|
|
482
|
+
setStarred(uid: number, starred: boolean, mailbox?: string): Promise<void>;
|
|
476
483
|
/** Move a message to another folder */
|
|
477
484
|
moveMessage(uid: number, fromMailbox: string, toMailbox: string): Promise<void>;
|
|
478
485
|
/** List all IMAP folders/mailboxes */
|
package/dist/index.d.ts
CHANGED
|
@@ -473,6 +473,13 @@ declare class MailReceiver {
|
|
|
473
473
|
deleteMessage(uid: number, mailbox?: string): Promise<void>;
|
|
474
474
|
/** Mark a message as unseen (unread) */
|
|
475
475
|
markUnseen(uid: number, mailbox?: string): Promise<void>;
|
|
476
|
+
/**
|
|
477
|
+
* Flag / unflag a message. IMAP uses `\Flagged` for what Gmail
|
|
478
|
+
* calls "starred" — same on-disk bit, different vocabulary. We
|
|
479
|
+
* expose it as `setStarred(uid, true|false)` so the web UI can
|
|
480
|
+
* call a single endpoint with a boolean.
|
|
481
|
+
*/
|
|
482
|
+
setStarred(uid: number, starred: boolean, mailbox?: string): Promise<void>;
|
|
476
483
|
/** Move a message to another folder */
|
|
477
484
|
moveMessage(uid: number, fromMailbox: string, toMailbox: string): Promise<void>;
|
|
478
485
|
/** List all IMAP folders/mailboxes */
|
package/dist/index.js
CHANGED
|
@@ -257,6 +257,24 @@ var MailReceiver = class {
|
|
|
257
257
|
lock.release();
|
|
258
258
|
}
|
|
259
259
|
}
|
|
260
|
+
/**
|
|
261
|
+
* Flag / unflag a message. IMAP uses `\Flagged` for what Gmail
|
|
262
|
+
* calls "starred" — same on-disk bit, different vocabulary. We
|
|
263
|
+
* expose it as `setStarred(uid, true|false)` so the web UI can
|
|
264
|
+
* call a single endpoint with a boolean.
|
|
265
|
+
*/
|
|
266
|
+
async setStarred(uid, starred, mailbox = "INBOX") {
|
|
267
|
+
const lock = await this.client.getMailboxLock(mailbox);
|
|
268
|
+
try {
|
|
269
|
+
if (starred) {
|
|
270
|
+
await this.client.messageFlagsAdd(String(uid), ["\\Flagged"], { uid: true });
|
|
271
|
+
} else {
|
|
272
|
+
await this.client.messageFlagsRemove(String(uid), ["\\Flagged"], { uid: true });
|
|
273
|
+
}
|
|
274
|
+
} finally {
|
|
275
|
+
lock.release();
|
|
276
|
+
}
|
|
277
|
+
}
|
|
260
278
|
/** Move a message to another folder */
|
|
261
279
|
async moveMessage(uid, fromMailbox, toMailbox) {
|
|
262
280
|
const lock = await this.client.getMailboxLock(fromMailbox);
|
|
@@ -2712,6 +2730,17 @@ CREATE INDEX IF NOT EXISTS idx_pending_outbound_agent ON pending_outbound(agent_
|
|
|
2712
2730
|
"013_pending_notification_id.sql": `
|
|
2713
2731
|
ALTER TABLE pending_outbound ADD COLUMN notification_message_id TEXT;
|
|
2714
2732
|
CREATE INDEX IF NOT EXISTS idx_pending_notification ON pending_outbound(notification_message_id);
|
|
2733
|
+
`,
|
|
2734
|
+
"014_task_output_schema.sql": `
|
|
2735
|
+
-- Typed task contracts: when an assigner cares about the shape of the
|
|
2736
|
+
-- deliverable, they can attach a JSON Schema describing what
|
|
2737
|
+
-- submit_result must look like. The API validates against it before
|
|
2738
|
+
-- accepting the result, so workers can't return free-form prose when
|
|
2739
|
+
-- a structured object was requested.
|
|
2740
|
+
--
|
|
2741
|
+
-- Column is optional; NULL means "no schema, accept anything" (the
|
|
2742
|
+
-- v0.8.x behaviour, fully back-compat).
|
|
2743
|
+
ALTER TABLE agent_tasks ADD COLUMN output_schema TEXT;
|
|
2715
2744
|
`
|
|
2716
2745
|
};
|
|
2717
2746
|
function runMigrations(database) {
|