@ghostpaw/email 0.4.1 → 0.5.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/README.md +169 -16
- package/dist/cli.js +9987 -9747
- package/dist/index.cjs +14 -17
- package/dist/index.js +14 -17
- package/dist/mcp-server.js +25 -23
- package/dist/mcp.cjs +24 -22
- package/dist/mcp.d.cts +10 -0
- package/dist/mcp.d.ts +10 -0
- package/dist/mcp.js +24 -22
- package/package.json +15 -5
package/dist/index.cjs
CHANGED
|
@@ -3514,6 +3514,15 @@ function createNetworkSurface(db, options) {
|
|
|
3514
3514
|
}
|
|
3515
3515
|
return session;
|
|
3516
3516
|
}
|
|
3517
|
+
async function pullFolders(s3) {
|
|
3518
|
+
const result = [];
|
|
3519
|
+
for (const f of await s3.listFolders()) {
|
|
3520
|
+
result.push(
|
|
3521
|
+
upsertFolder(db, { accountId, path: f.path, delimiter: f.delimiter, role: f.role })
|
|
3522
|
+
);
|
|
3523
|
+
}
|
|
3524
|
+
return result;
|
|
3525
|
+
}
|
|
3517
3526
|
return {
|
|
3518
3527
|
connect: async () => {
|
|
3519
3528
|
await requireSession().connect();
|
|
@@ -3545,7 +3554,8 @@ function createNetworkSurface(db, options) {
|
|
|
3545
3554
|
},
|
|
3546
3555
|
sync: async (syncOptions) => {
|
|
3547
3556
|
const s3 = requireSession();
|
|
3548
|
-
|
|
3557
|
+
let folders = listFolders2(db, accountId);
|
|
3558
|
+
if (!folders.length) folders = await pullFolders(s3);
|
|
3549
3559
|
const results = [];
|
|
3550
3560
|
let totalNew = 0;
|
|
3551
3561
|
let totalExpunged = 0;
|
|
@@ -3584,21 +3594,7 @@ function createNetworkSurface(db, options) {
|
|
|
3584
3594
|
}
|
|
3585
3595
|
}
|
|
3586
3596
|
},
|
|
3587
|
-
refreshFolders: async () =>
|
|
3588
|
-
const s3 = requireSession();
|
|
3589
|
-
const imapFolders = await s3.listFolders();
|
|
3590
|
-
const result = [];
|
|
3591
|
-
for (const f of imapFolders) {
|
|
3592
|
-
const upserted = upsertFolder(db, {
|
|
3593
|
-
accountId,
|
|
3594
|
-
path: f.path,
|
|
3595
|
-
delimiter: f.delimiter,
|
|
3596
|
-
role: f.role
|
|
3597
|
-
});
|
|
3598
|
-
result.push(upserted);
|
|
3599
|
-
}
|
|
3600
|
-
return result;
|
|
3601
|
-
},
|
|
3597
|
+
refreshFolders: async () => pullFolders(requireSession()),
|
|
3602
3598
|
searchRemote: async (folder, query) => {
|
|
3603
3599
|
const s3 = requireSession();
|
|
3604
3600
|
if (s3.selectedFolder !== folder) {
|
|
@@ -4474,7 +4470,8 @@ function createWriteSurface(db, options) {
|
|
|
4474
4470
|
async function sendComposed(composed) {
|
|
4475
4471
|
const raw2 = composed.toString("utf8");
|
|
4476
4472
|
const fromMatch = raw2.match(/^From:\s*(.+?)$/m);
|
|
4477
|
-
const
|
|
4473
|
+
const fromParts = fromMatch?.[1]?.match(/<(.+?)>|(\S+@\S+)/);
|
|
4474
|
+
const fromAddr = fromParts?.[1] ?? fromParts?.[2] ?? "";
|
|
4478
4475
|
const toMatch = [...raw2.matchAll(/^(?:To|Cc|Bcc):\s*(.+?)$/gm)];
|
|
4479
4476
|
const toAddrs = toMatch.flatMap(
|
|
4480
4477
|
(m) => (m[1] ?? "").split(",").map((a) => (a.match(/<(.+?)>|(\S+@\S+)/)?.[1] ?? a).trim())
|
package/dist/index.js
CHANGED
|
@@ -3490,6 +3490,15 @@ function createNetworkSurface(db, options) {
|
|
|
3490
3490
|
}
|
|
3491
3491
|
return session;
|
|
3492
3492
|
}
|
|
3493
|
+
async function pullFolders(s3) {
|
|
3494
|
+
const result = [];
|
|
3495
|
+
for (const f of await s3.listFolders()) {
|
|
3496
|
+
result.push(
|
|
3497
|
+
upsertFolder(db, { accountId, path: f.path, delimiter: f.delimiter, role: f.role })
|
|
3498
|
+
);
|
|
3499
|
+
}
|
|
3500
|
+
return result;
|
|
3501
|
+
}
|
|
3493
3502
|
return {
|
|
3494
3503
|
connect: async () => {
|
|
3495
3504
|
await requireSession().connect();
|
|
@@ -3521,7 +3530,8 @@ function createNetworkSurface(db, options) {
|
|
|
3521
3530
|
},
|
|
3522
3531
|
sync: async (syncOptions) => {
|
|
3523
3532
|
const s3 = requireSession();
|
|
3524
|
-
|
|
3533
|
+
let folders = listFolders2(db, accountId);
|
|
3534
|
+
if (!folders.length) folders = await pullFolders(s3);
|
|
3525
3535
|
const results = [];
|
|
3526
3536
|
let totalNew = 0;
|
|
3527
3537
|
let totalExpunged = 0;
|
|
@@ -3560,21 +3570,7 @@ function createNetworkSurface(db, options) {
|
|
|
3560
3570
|
}
|
|
3561
3571
|
}
|
|
3562
3572
|
},
|
|
3563
|
-
refreshFolders: async () =>
|
|
3564
|
-
const s3 = requireSession();
|
|
3565
|
-
const imapFolders = await s3.listFolders();
|
|
3566
|
-
const result = [];
|
|
3567
|
-
for (const f of imapFolders) {
|
|
3568
|
-
const upserted = upsertFolder(db, {
|
|
3569
|
-
accountId,
|
|
3570
|
-
path: f.path,
|
|
3571
|
-
delimiter: f.delimiter,
|
|
3572
|
-
role: f.role
|
|
3573
|
-
});
|
|
3574
|
-
result.push(upserted);
|
|
3575
|
-
}
|
|
3576
|
-
return result;
|
|
3577
|
-
},
|
|
3573
|
+
refreshFolders: async () => pullFolders(requireSession()),
|
|
3578
3574
|
searchRemote: async (folder, query) => {
|
|
3579
3575
|
const s3 = requireSession();
|
|
3580
3576
|
if (s3.selectedFolder !== folder) {
|
|
@@ -4450,7 +4446,8 @@ function createWriteSurface(db, options) {
|
|
|
4450
4446
|
async function sendComposed(composed) {
|
|
4451
4447
|
const raw2 = composed.toString("utf8");
|
|
4452
4448
|
const fromMatch = raw2.match(/^From:\s*(.+?)$/m);
|
|
4453
|
-
const
|
|
4449
|
+
const fromParts = fromMatch?.[1]?.match(/<(.+?)>|(\S+@\S+)/);
|
|
4450
|
+
const fromAddr = fromParts?.[1] ?? fromParts?.[2] ?? "";
|
|
4454
4451
|
const toMatch = [...raw2.matchAll(/^(?:To|Cc|Bcc):\s*(.+?)$/gm)];
|
|
4455
4452
|
const toAddrs = toMatch.flatMap(
|
|
4456
4453
|
(m) => (m[1] ?? "").split(",").map((a) => (a.match(/<(.+?)>|(\S+@\S+)/)?.[1] ?? a).trim())
|
package/dist/mcp-server.js
CHANGED
|
@@ -10,8 +10,13 @@ import { randomUUID } from 'node:crypto';
|
|
|
10
10
|
|
|
11
11
|
var __defProp = Object.defineProperty;
|
|
12
12
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
13
|
-
var __esm = (fn, res) => function __init() {
|
|
14
|
-
|
|
13
|
+
var __esm = (fn, res, err) => function __init() {
|
|
14
|
+
if (err) throw err[0];
|
|
15
|
+
try {
|
|
16
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
17
|
+
} catch (e) {
|
|
18
|
+
throw err = [e], e;
|
|
19
|
+
}
|
|
15
20
|
};
|
|
16
21
|
var __export = (target, all) => {
|
|
17
22
|
for (var name in all)
|
|
@@ -251,7 +256,7 @@ var init_mcp_stdio = __esm({
|
|
|
251
256
|
var emailVersion;
|
|
252
257
|
var init_version = __esm({
|
|
253
258
|
"src/version.ts"() {
|
|
254
|
-
emailVersion = "0.
|
|
259
|
+
emailVersion = "0.5.1";
|
|
255
260
|
}
|
|
256
261
|
});
|
|
257
262
|
|
|
@@ -4611,7 +4616,8 @@ function createWriteSurface(db, options) {
|
|
|
4611
4616
|
async function sendComposed(composed) {
|
|
4612
4617
|
const raw2 = composed.toString("utf8");
|
|
4613
4618
|
const fromMatch = raw2.match(/^From:\s*(.+?)$/m);
|
|
4614
|
-
const
|
|
4619
|
+
const fromParts = fromMatch?.[1]?.match(/<(.+?)>|(\S+@\S+)/);
|
|
4620
|
+
const fromAddr = fromParts?.[1] ?? fromParts?.[2] ?? "";
|
|
4615
4621
|
const toMatch = [...raw2.matchAll(/^(?:To|Cc|Bcc):\s*(.+?)$/gm)];
|
|
4616
4622
|
const toAddrs = toMatch.flatMap(
|
|
4617
4623
|
(m) => (m[1] ?? "").split(",").map((a) => (a.match(/<(.+?)>|(\S+@\S+)/)?.[1] ?? a).trim())
|
|
@@ -5937,6 +5943,15 @@ function createNetworkSurface(db, options) {
|
|
|
5937
5943
|
}
|
|
5938
5944
|
return session;
|
|
5939
5945
|
}
|
|
5946
|
+
async function pullFolders(s3) {
|
|
5947
|
+
const result = [];
|
|
5948
|
+
for (const f of await s3.listFolders()) {
|
|
5949
|
+
result.push(
|
|
5950
|
+
upsertFolder(db, { accountId, path: f.path, delimiter: f.delimiter, role: f.role })
|
|
5951
|
+
);
|
|
5952
|
+
}
|
|
5953
|
+
return result;
|
|
5954
|
+
}
|
|
5940
5955
|
return {
|
|
5941
5956
|
connect: async () => {
|
|
5942
5957
|
await requireSession().connect();
|
|
@@ -5968,7 +5983,8 @@ function createNetworkSurface(db, options) {
|
|
|
5968
5983
|
},
|
|
5969
5984
|
sync: async (syncOptions) => {
|
|
5970
5985
|
const s3 = requireSession();
|
|
5971
|
-
|
|
5986
|
+
let folders = listFolders(db, accountId);
|
|
5987
|
+
if (!folders.length) folders = await pullFolders(s3);
|
|
5972
5988
|
const results = [];
|
|
5973
5989
|
let totalNew = 0;
|
|
5974
5990
|
let totalExpunged = 0;
|
|
@@ -6007,21 +6023,7 @@ function createNetworkSurface(db, options) {
|
|
|
6007
6023
|
}
|
|
6008
6024
|
}
|
|
6009
6025
|
},
|
|
6010
|
-
refreshFolders: async () =>
|
|
6011
|
-
const s3 = requireSession();
|
|
6012
|
-
const imapFolders = await s3.listFolders();
|
|
6013
|
-
const result = [];
|
|
6014
|
-
for (const f of imapFolders) {
|
|
6015
|
-
const upserted = upsertFolder(db, {
|
|
6016
|
-
accountId,
|
|
6017
|
-
path: f.path,
|
|
6018
|
-
delimiter: f.delimiter,
|
|
6019
|
-
role: f.role
|
|
6020
|
-
});
|
|
6021
|
-
result.push(upserted);
|
|
6022
|
-
}
|
|
6023
|
-
return result;
|
|
6024
|
-
},
|
|
6026
|
+
refreshFolders: async () => pullFolders(requireSession()),
|
|
6025
6027
|
searchRemote: async (folder, query) => {
|
|
6026
6028
|
const s3 = requireSession();
|
|
6027
6029
|
if (s3.selectedFolder !== folder) {
|
|
@@ -6080,13 +6082,13 @@ var init_network = __esm({
|
|
|
6080
6082
|
});
|
|
6081
6083
|
|
|
6082
6084
|
// src/surface/email_surface_tools.ts
|
|
6083
|
-
var
|
|
6085
|
+
var emailMcpTools;
|
|
6084
6086
|
var init_email_surface_tools = __esm({
|
|
6085
6087
|
"src/surface/email_surface_tools.ts"() {
|
|
6086
6088
|
init_read();
|
|
6087
6089
|
init_store();
|
|
6088
6090
|
init_aligned();
|
|
6089
|
-
|
|
6091
|
+
emailMcpTools = emailTools2.map((tool) => ({
|
|
6090
6092
|
...tool,
|
|
6091
6093
|
inputSchema: { ...tool.inputSchema, type: "object" },
|
|
6092
6094
|
async handler(db, input) {
|
|
@@ -6152,7 +6154,7 @@ function emailMcpOptions(context) {
|
|
|
6152
6154
|
version: emailVersion,
|
|
6153
6155
|
title: "Email",
|
|
6154
6156
|
instructions: emailMcpInstructions,
|
|
6155
|
-
tools:
|
|
6157
|
+
tools: emailMcpTools,
|
|
6156
6158
|
context,
|
|
6157
6159
|
annotations: (tool) => ({
|
|
6158
6160
|
readOnlyHint: tool.readOnly ?? false,
|
package/dist/mcp.cjs
CHANGED
|
@@ -33,8 +33,13 @@ var zlib__namespace = /*#__PURE__*/_interopNamespace(zlib);
|
|
|
33
33
|
|
|
34
34
|
var __defProp = Object.defineProperty;
|
|
35
35
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
36
|
-
var __esm = (fn, res) => function __init() {
|
|
37
|
-
|
|
36
|
+
var __esm = (fn, res, err) => function __init() {
|
|
37
|
+
if (err) throw err[0];
|
|
38
|
+
try {
|
|
39
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
40
|
+
} catch (e) {
|
|
41
|
+
throw err = [e], e;
|
|
42
|
+
}
|
|
38
43
|
};
|
|
39
44
|
var __export = (target, all) => {
|
|
40
45
|
for (var name in all)
|
|
@@ -3536,7 +3541,8 @@ function createWriteSurface(db, options) {
|
|
|
3536
3541
|
async function sendComposed(composed) {
|
|
3537
3542
|
const raw2 = composed.toString("utf8");
|
|
3538
3543
|
const fromMatch = raw2.match(/^From:\s*(.+?)$/m);
|
|
3539
|
-
const
|
|
3544
|
+
const fromParts = fromMatch?.[1]?.match(/<(.+?)>|(\S+@\S+)/);
|
|
3545
|
+
const fromAddr = fromParts?.[1] ?? fromParts?.[2] ?? "";
|
|
3540
3546
|
const toMatch = [...raw2.matchAll(/^(?:To|Cc|Bcc):\s*(.+?)$/gm)];
|
|
3541
3547
|
const toAddrs = toMatch.flatMap(
|
|
3542
3548
|
(m) => (m[1] ?? "").split(",").map((a) => (a.match(/<(.+?)>|(\S+@\S+)/)?.[1] ?? a).trim())
|
|
@@ -4862,6 +4868,15 @@ function createNetworkSurface(db, options) {
|
|
|
4862
4868
|
}
|
|
4863
4869
|
return session;
|
|
4864
4870
|
}
|
|
4871
|
+
async function pullFolders(s3) {
|
|
4872
|
+
const result = [];
|
|
4873
|
+
for (const f of await s3.listFolders()) {
|
|
4874
|
+
result.push(
|
|
4875
|
+
upsertFolder(db, { accountId, path: f.path, delimiter: f.delimiter, role: f.role })
|
|
4876
|
+
);
|
|
4877
|
+
}
|
|
4878
|
+
return result;
|
|
4879
|
+
}
|
|
4865
4880
|
return {
|
|
4866
4881
|
connect: async () => {
|
|
4867
4882
|
await requireSession().connect();
|
|
@@ -4893,7 +4908,8 @@ function createNetworkSurface(db, options) {
|
|
|
4893
4908
|
},
|
|
4894
4909
|
sync: async (syncOptions) => {
|
|
4895
4910
|
const s3 = requireSession();
|
|
4896
|
-
|
|
4911
|
+
let folders = listFolders(db, accountId);
|
|
4912
|
+
if (!folders.length) folders = await pullFolders(s3);
|
|
4897
4913
|
const results = [];
|
|
4898
4914
|
let totalNew = 0;
|
|
4899
4915
|
let totalExpunged = 0;
|
|
@@ -4932,21 +4948,7 @@ function createNetworkSurface(db, options) {
|
|
|
4932
4948
|
}
|
|
4933
4949
|
}
|
|
4934
4950
|
},
|
|
4935
|
-
refreshFolders: async () =>
|
|
4936
|
-
const s3 = requireSession();
|
|
4937
|
-
const imapFolders = await s3.listFolders();
|
|
4938
|
-
const result = [];
|
|
4939
|
-
for (const f of imapFolders) {
|
|
4940
|
-
const upserted = upsertFolder(db, {
|
|
4941
|
-
accountId,
|
|
4942
|
-
path: f.path,
|
|
4943
|
-
delimiter: f.delimiter,
|
|
4944
|
-
role: f.role
|
|
4945
|
-
});
|
|
4946
|
-
result.push(upserted);
|
|
4947
|
-
}
|
|
4948
|
-
return result;
|
|
4949
|
-
},
|
|
4951
|
+
refreshFolders: async () => pullFolders(requireSession()),
|
|
4950
4952
|
searchRemote: async (folder, query) => {
|
|
4951
4953
|
const s3 = requireSession();
|
|
4952
4954
|
if (s3.selectedFolder !== folder) {
|
|
@@ -5005,7 +5007,7 @@ var init_network = __esm({
|
|
|
5005
5007
|
});
|
|
5006
5008
|
|
|
5007
5009
|
// src/version.ts
|
|
5008
|
-
var emailVersion = "0.
|
|
5010
|
+
var emailVersion = "0.5.1";
|
|
5009
5011
|
|
|
5010
5012
|
// src/surface/email_mcp_instructions.ts
|
|
5011
5013
|
var emailMcpInstructions = "Read and search cached email offline. Configure live accounts with email account add before network operations. Inspect messages before replying or changing folders. Confirm recipients and content before sending; trash and folder deletion can remove mail. Credentials use the existing email CLI account configuration or EMAIL_* environment variables.";
|
|
@@ -5852,7 +5854,7 @@ var emailTools2 = emailTools.map((tool) => ({
|
|
|
5852
5854
|
}));
|
|
5853
5855
|
|
|
5854
5856
|
// src/surface/email_surface_tools.ts
|
|
5855
|
-
var
|
|
5857
|
+
var emailMcpTools = emailTools2.map((tool) => ({
|
|
5856
5858
|
...tool,
|
|
5857
5859
|
inputSchema: { ...tool.inputSchema, type: "object" },
|
|
5858
5860
|
async handler(db, input) {
|
|
@@ -5916,7 +5918,7 @@ function emailMcpOptions(context) {
|
|
|
5916
5918
|
version: emailVersion,
|
|
5917
5919
|
title: "Email",
|
|
5918
5920
|
instructions: emailMcpInstructions,
|
|
5919
|
-
tools:
|
|
5921
|
+
tools: emailMcpTools,
|
|
5920
5922
|
context,
|
|
5921
5923
|
annotations: (tool) => ({
|
|
5922
5924
|
readOnlyHint: tool.readOnly ?? false,
|
package/dist/mcp.d.cts
CHANGED
|
@@ -19,6 +19,16 @@ interface JsonSchema {
|
|
|
19
19
|
}
|
|
20
20
|
interface SurfaceTool<TCtx> {
|
|
21
21
|
name: string;
|
|
22
|
+
cli?: {
|
|
23
|
+
noun?: string;
|
|
24
|
+
verb: string;
|
|
25
|
+
positionals?: string[];
|
|
26
|
+
action?: {
|
|
27
|
+
property: string;
|
|
28
|
+
verbs?: Record<string, string>;
|
|
29
|
+
positionals?: Record<string, string[]>;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
22
32
|
title?: string;
|
|
23
33
|
description: string;
|
|
24
34
|
inputSchema: JsonSchema & {
|
package/dist/mcp.d.ts
CHANGED
|
@@ -19,6 +19,16 @@ interface JsonSchema {
|
|
|
19
19
|
}
|
|
20
20
|
interface SurfaceTool<TCtx> {
|
|
21
21
|
name: string;
|
|
22
|
+
cli?: {
|
|
23
|
+
noun?: string;
|
|
24
|
+
verb: string;
|
|
25
|
+
positionals?: string[];
|
|
26
|
+
action?: {
|
|
27
|
+
property: string;
|
|
28
|
+
verbs?: Record<string, string>;
|
|
29
|
+
positionals?: Record<string, string[]>;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
22
32
|
title?: string;
|
|
23
33
|
description: string;
|
|
24
34
|
inputSchema: JsonSchema & {
|
package/dist/mcp.js
CHANGED
|
@@ -9,8 +9,13 @@ import { randomUUID } from 'node:crypto';
|
|
|
9
9
|
|
|
10
10
|
var __defProp = Object.defineProperty;
|
|
11
11
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
12
|
-
var __esm = (fn, res) => function __init() {
|
|
13
|
-
|
|
12
|
+
var __esm = (fn, res, err) => function __init() {
|
|
13
|
+
if (err) throw err[0];
|
|
14
|
+
try {
|
|
15
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
16
|
+
} catch (e) {
|
|
17
|
+
throw err = [e], e;
|
|
18
|
+
}
|
|
14
19
|
};
|
|
15
20
|
var __export = (target, all) => {
|
|
16
21
|
for (var name in all)
|
|
@@ -3512,7 +3517,8 @@ function createWriteSurface(db, options) {
|
|
|
3512
3517
|
async function sendComposed(composed) {
|
|
3513
3518
|
const raw2 = composed.toString("utf8");
|
|
3514
3519
|
const fromMatch = raw2.match(/^From:\s*(.+?)$/m);
|
|
3515
|
-
const
|
|
3520
|
+
const fromParts = fromMatch?.[1]?.match(/<(.+?)>|(\S+@\S+)/);
|
|
3521
|
+
const fromAddr = fromParts?.[1] ?? fromParts?.[2] ?? "";
|
|
3516
3522
|
const toMatch = [...raw2.matchAll(/^(?:To|Cc|Bcc):\s*(.+?)$/gm)];
|
|
3517
3523
|
const toAddrs = toMatch.flatMap(
|
|
3518
3524
|
(m) => (m[1] ?? "").split(",").map((a) => (a.match(/<(.+?)>|(\S+@\S+)/)?.[1] ?? a).trim())
|
|
@@ -4838,6 +4844,15 @@ function createNetworkSurface(db, options) {
|
|
|
4838
4844
|
}
|
|
4839
4845
|
return session;
|
|
4840
4846
|
}
|
|
4847
|
+
async function pullFolders(s3) {
|
|
4848
|
+
const result = [];
|
|
4849
|
+
for (const f of await s3.listFolders()) {
|
|
4850
|
+
result.push(
|
|
4851
|
+
upsertFolder(db, { accountId, path: f.path, delimiter: f.delimiter, role: f.role })
|
|
4852
|
+
);
|
|
4853
|
+
}
|
|
4854
|
+
return result;
|
|
4855
|
+
}
|
|
4841
4856
|
return {
|
|
4842
4857
|
connect: async () => {
|
|
4843
4858
|
await requireSession().connect();
|
|
@@ -4869,7 +4884,8 @@ function createNetworkSurface(db, options) {
|
|
|
4869
4884
|
},
|
|
4870
4885
|
sync: async (syncOptions) => {
|
|
4871
4886
|
const s3 = requireSession();
|
|
4872
|
-
|
|
4887
|
+
let folders = listFolders(db, accountId);
|
|
4888
|
+
if (!folders.length) folders = await pullFolders(s3);
|
|
4873
4889
|
const results = [];
|
|
4874
4890
|
let totalNew = 0;
|
|
4875
4891
|
let totalExpunged = 0;
|
|
@@ -4908,21 +4924,7 @@ function createNetworkSurface(db, options) {
|
|
|
4908
4924
|
}
|
|
4909
4925
|
}
|
|
4910
4926
|
},
|
|
4911
|
-
refreshFolders: async () =>
|
|
4912
|
-
const s3 = requireSession();
|
|
4913
|
-
const imapFolders = await s3.listFolders();
|
|
4914
|
-
const result = [];
|
|
4915
|
-
for (const f of imapFolders) {
|
|
4916
|
-
const upserted = upsertFolder(db, {
|
|
4917
|
-
accountId,
|
|
4918
|
-
path: f.path,
|
|
4919
|
-
delimiter: f.delimiter,
|
|
4920
|
-
role: f.role
|
|
4921
|
-
});
|
|
4922
|
-
result.push(upserted);
|
|
4923
|
-
}
|
|
4924
|
-
return result;
|
|
4925
|
-
},
|
|
4927
|
+
refreshFolders: async () => pullFolders(requireSession()),
|
|
4926
4928
|
searchRemote: async (folder, query) => {
|
|
4927
4929
|
const s3 = requireSession();
|
|
4928
4930
|
if (s3.selectedFolder !== folder) {
|
|
@@ -4981,7 +4983,7 @@ var init_network = __esm({
|
|
|
4981
4983
|
});
|
|
4982
4984
|
|
|
4983
4985
|
// src/version.ts
|
|
4984
|
-
var emailVersion = "0.
|
|
4986
|
+
var emailVersion = "0.5.1";
|
|
4985
4987
|
|
|
4986
4988
|
// src/surface/email_mcp_instructions.ts
|
|
4987
4989
|
var emailMcpInstructions = "Read and search cached email offline. Configure live accounts with email account add before network operations. Inspect messages before replying or changing folders. Confirm recipients and content before sending; trash and folder deletion can remove mail. Credentials use the existing email CLI account configuration or EMAIL_* environment variables.";
|
|
@@ -5828,7 +5830,7 @@ var emailTools2 = emailTools.map((tool) => ({
|
|
|
5828
5830
|
}));
|
|
5829
5831
|
|
|
5830
5832
|
// src/surface/email_surface_tools.ts
|
|
5831
|
-
var
|
|
5833
|
+
var emailMcpTools = emailTools2.map((tool) => ({
|
|
5832
5834
|
...tool,
|
|
5833
5835
|
inputSchema: { ...tool.inputSchema, type: "object" },
|
|
5834
5836
|
async handler(db, input) {
|
|
@@ -5892,7 +5894,7 @@ function emailMcpOptions(context) {
|
|
|
5892
5894
|
version: emailVersion,
|
|
5893
5895
|
title: "Email",
|
|
5894
5896
|
instructions: emailMcpInstructions,
|
|
5895
|
-
tools:
|
|
5897
|
+
tools: emailMcpTools,
|
|
5896
5898
|
context,
|
|
5897
5899
|
annotations: (tool) => ({
|
|
5898
5900
|
readOnlyHint: tool.readOnly ?? false,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ghostpaw/email",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"description": "Standalone IMAP/SMTP email engine for Node.js — SQLite local cache, threading, sync, zero dependencies, with a built-in LLM tool facade",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -66,7 +66,10 @@
|
|
|
66
66
|
"check:api": "node scripts/guard/api.mjs",
|
|
67
67
|
"check:consumer": "node scripts/guard/consumer.mjs",
|
|
68
68
|
"check:startup": "node scripts/guard/startup.mjs",
|
|
69
|
-
"mcpb": "node scripts/mcpb/build.mjs"
|
|
69
|
+
"mcpb": "node scripts/mcpb/build.mjs",
|
|
70
|
+
"sea": "node scripts/sea/build.mjs",
|
|
71
|
+
"sea:smoke": "node scripts/sea/smoke.mjs",
|
|
72
|
+
"sea:bench": "node scripts/sea/bench.mjs"
|
|
70
73
|
},
|
|
71
74
|
"engines": {
|
|
72
75
|
"node": ">=24"
|
|
@@ -99,7 +102,11 @@
|
|
|
99
102
|
"mcp-server",
|
|
100
103
|
"model-context-protocol",
|
|
101
104
|
"agent-skills",
|
|
102
|
-
"cli"
|
|
105
|
+
"cli",
|
|
106
|
+
"ghostpaw",
|
|
107
|
+
"ai-agents",
|
|
108
|
+
"llm-tools",
|
|
109
|
+
"node-sqlite"
|
|
103
110
|
],
|
|
104
111
|
"license": "MIT",
|
|
105
112
|
"repository": {
|
|
@@ -126,10 +133,13 @@
|
|
|
126
133
|
"@biomejs/biome": "2.4.4",
|
|
127
134
|
"@types/node": "^25.3.0",
|
|
128
135
|
"citty": "^0.1.6",
|
|
129
|
-
"esbuild": "^0.
|
|
136
|
+
"esbuild": "^0.28.1",
|
|
130
137
|
"fflate": "0.8.3",
|
|
131
138
|
"tsup": "^8.4.0",
|
|
132
139
|
"typescript": "^5.9.3"
|
|
133
140
|
},
|
|
134
|
-
"mcpName": "io.github.GhostPawJS/email"
|
|
141
|
+
"mcpName": "io.github.GhostPawJS/email",
|
|
142
|
+
"overrides": {
|
|
143
|
+
"esbuild": "$esbuild"
|
|
144
|
+
}
|
|
135
145
|
}
|