@framers/agentos-ext-channel-email 0.4.3 → 0.5.0

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.
Files changed (46) hide show
  1. package/README.md +74 -9
  2. package/dist/EmailService.d.ts +261 -9
  3. package/dist/EmailService.d.ts.map +1 -1
  4. package/dist/EmailService.js +594 -35
  5. package/dist/EmailService.js.map +1 -1
  6. package/dist/attachments.d.ts +118 -0
  7. package/dist/attachments.d.ts.map +1 -0
  8. package/dist/attachments.js +294 -0
  9. package/dist/attachments.js.map +1 -0
  10. package/dist/headers.d.ts +102 -0
  11. package/dist/headers.d.ts.map +1 -0
  12. package/dist/headers.js +261 -0
  13. package/dist/headers.js.map +1 -0
  14. package/dist/index.d.ts +4 -2
  15. package/dist/index.d.ts.map +1 -1
  16. package/dist/index.js +12 -2
  17. package/dist/index.js.map +1 -1
  18. package/dist/messageHeaders.d.ts +8 -0
  19. package/dist/messageHeaders.d.ts.map +1 -1
  20. package/dist/messageHeaders.js +2 -0
  21. package/dist/messageHeaders.js.map +1 -1
  22. package/dist/preferences/RecipientCapability.d.ts +8 -7
  23. package/dist/preferences/RecipientCapability.d.ts.map +1 -1
  24. package/dist/preferences/RecipientCapability.js +11 -5
  25. package/dist/preferences/RecipientCapability.js.map +1 -1
  26. package/dist/preferences/SuppressionStore.d.ts +2 -2
  27. package/dist/preferences/SuppressionStore.js +2 -2
  28. package/dist/preferences/database.d.ts +4 -2
  29. package/dist/preferences/database.d.ts.map +1 -1
  30. package/dist/preferences/database.js +9 -10
  31. package/dist/preferences/database.js.map +1 -1
  32. package/dist/preferences/index.d.ts +2 -2
  33. package/dist/preferences/index.js +2 -2
  34. package/dist/tools/messages.d.ts +21 -0
  35. package/dist/tools/messages.d.ts.map +1 -0
  36. package/dist/tools/messages.js +18 -0
  37. package/dist/tools/messages.js.map +1 -0
  38. package/dist/tools/read.d.ts +2 -2
  39. package/dist/tools/read.d.ts.map +1 -1
  40. package/dist/tools/read.js +6 -4
  41. package/dist/tools/read.js.map +1 -1
  42. package/dist/tools/search.d.ts.map +1 -1
  43. package/dist/tools/search.js +2 -1
  44. package/dist/tools/search.js.map +1 -1
  45. package/manifest.json +3 -2
  46. package/package.json +4 -4
@@ -13,6 +13,7 @@ exports.recipientCapabilityDdl = recipientCapabilityDdl;
13
13
  * again: a revoked link never works again, and never comes to name another recipient or scope.
14
14
  */
15
15
  const node_crypto_1 = require("node:crypto");
16
+ const node_util_1 = require("node:util");
16
17
  const database_js_1 = require("./database.js");
17
18
  /** A token: 43 base64url characters, 32 bytes without padding. */
18
19
  const TOKEN = /^[A-Za-z0-9_-]{43}$/;
@@ -35,9 +36,13 @@ function capabilityToken(nonce, key) {
35
36
  function capabilityTokenHash(token) {
36
37
  return (0, node_crypto_1.createHash)('sha256').update(token, 'utf8').digest('hex');
37
38
  }
38
- /** Returns the key when it holds 32 bytes or more, and otherwise throws a `TypeError` that never holds the key. */
39
+ /**
40
+ * Returns the key when it is a `Uint8Array`, such as a `Buffer`, of 32 bytes or more, and otherwise throws a `TypeError`
41
+ * that never holds the key. The check reads the value, not its prototype, so a key made in another realm, such as a vm
42
+ * context or a test runner's sandbox, passes as the same bytes made here: `instanceof Uint8Array` is false for it.
43
+ */
39
44
  function requireKey(key) {
40
- if (key instanceof Uint8Array && key.byteLength >= KEY_BYTES)
45
+ if (node_util_1.types.isUint8Array(key) && key.byteLength >= KEY_BYTES)
41
46
  return key;
42
47
  throw new TypeError(`The key was refused: give it as ${KEY_BYTES} bytes or more, such as a Buffer`);
43
48
  }
@@ -86,8 +91,8 @@ function isRevoked(row) {
86
91
  * with `ON DELETE CASCADE` or by hand, never issues their nonces again, and a host that cannot promise that calls
87
92
  * `revoke` with each deletion and keeps the rows.
88
93
  *
89
- * @param prefix A lower-case letter followed by at most 39 lower-case letters, digits or underscores, other than
90
- * `sqlite` and a prefix beginning `sqlite_`.
94
+ * @param prefix A lower-case letter followed by at most 39 lower-case letters, digits or underscores. On SQLite, a
95
+ * prefix other than `sqlite` and those beginning `sqlite_`, whose tables SQLite keeps for itself and refuses to create.
91
96
  * @throws RangeError when the prefix does not fit.
92
97
  */
93
98
  function recipientCapabilityDdl(prefix) {
@@ -161,7 +166,8 @@ class SqlRecipientCapability {
161
166
  }
162
167
  async revoke(recipient) {
163
168
  const name = (0, database_js_1.requireName)('recipient', recipient);
164
- // The rows stay, so `issue` can refuse their nonces; only the live ones are marked and counted.
169
+ // The rows stay, so `issue` can refuse their nonces; those not revoked before are marked and counted, a token past
170
+ // its expiry among them.
165
171
  const result = await this.db.run(`UPDATE ${this.table} SET revoked_at = ? WHERE recipient = ? AND revoked_at IS NULL`, [revokedAtOf(this.now()), name]);
166
172
  return (0, database_js_1.changesOf)(result);
167
173
  }
@@ -1 +1 @@
1
- {"version":3,"file":"RecipientCapability.js","sourceRoot":"","sources":["../../src/preferences/RecipientCapability.ts"],"names":[],"mappings":";;;AA6FA,0CAEC;AAOD,kDAEC;AAoED,wDAYC;AAxLD;;;;;;;GAOG;AACH,6CAAsE;AAEtE,+CAAsE;AAuEtE,kEAAkE;AAClE,MAAM,KAAK,GAAG,qBAAqB,CAAC;AAEpC,gHAAgH;AAChH,MAAM,SAAS,GAAG,EAAE,CAAC;AAErB;;;;;GAKG;AACH,SAAgB,eAAe,CAAC,KAAa,EAAE,GAAe;IAC5D,OAAO,IAAA,wBAAU,EAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;AAC7E,CAAC;AAED;;;;GAIG;AACH,SAAgB,mBAAmB,CAAC,KAAa;IAC/C,OAAO,IAAA,wBAAU,EAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAClE,CAAC;AAED,mHAAmH;AACnH,SAAS,UAAU,CAAC,GAAY;IAC9B,IAAI,GAAG,YAAY,UAAU,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OAAO,IAAI,CAAC;QAChC,MAAM,SAAS,GAAG,QAAQ,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;QAC3C,kFAAkF;QAClF,IAAI,SAAS,KAAK,IAAI,IAAI,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,SAAS,CAAC;YAAE,OAAO,IAAI,CAAC;QACjE,OAAO,EAAE,SAAS,EAAE,GAAG,CAAC,SAAS,EAAE,KAAK,EAAE,GAAG,CAAC,KAAK,EAAE,CAAC;IACxD,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,SAAiB;QAC5B,MAAM,IAAI,GAAG,IAAA,yBAAW,EAAC,WAAW,EAAE,SAAS,CAAC,CAAC;QACjD,mHAAmH;QACnH,yBAAyB;QACzB,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,EAAE,CAAC,GAAG,CAC9B,UAAU,IAAI,CAAC,KAAK,gEAAgE,EACpF,CAAC,WAAW,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,EAAE,IAAI,CAAC,CAChC,CAAC;QACF,OAAO,IAAA,uBAAS,EAAC,MAAM,CAAC,CAAC;IAC3B,CAAC;CACF;AA/ED,wDA+EC"}
@@ -54,8 +54,8 @@ export interface SuppressionStore {
54
54
  * PostgreSQL, from one process at a time: PostgreSQL does not promise that two processes making one new table at once
55
55
  * both succeed.
56
56
  *
57
- * @param prefix A lower-case letter followed by at most 39 lower-case letters, digits or underscores, other than
58
- * `sqlite` and a prefix beginning `sqlite_`.
57
+ * @param prefix A lower-case letter followed by at most 39 lower-case letters, digits or underscores. On SQLite, a
58
+ * prefix other than `sqlite` and those beginning `sqlite_`, whose tables SQLite keeps for itself and refuses to create.
59
59
  * @throws RangeError when the prefix does not fit.
60
60
  */
61
61
  export declare function suppressionStoreDdl(prefix: string): string;
@@ -51,8 +51,8 @@ function requireDay(value) {
51
51
  * PostgreSQL, from one process at a time: PostgreSQL does not promise that two processes making one new table at once
52
52
  * both succeed.
53
53
  *
54
- * @param prefix A lower-case letter followed by at most 39 lower-case letters, digits or underscores, other than
55
- * `sqlite` and a prefix beginning `sqlite_`.
54
+ * @param prefix A lower-case letter followed by at most 39 lower-case letters, digits or underscores. On SQLite, a
55
+ * prefix other than `sqlite` and those beginning `sqlite_`, whose tables SQLite keeps for itself and refuses to create.
56
56
  * @throws RangeError when the prefix does not fit.
57
57
  */
58
58
  function suppressionStoreDdl(prefix) {
@@ -32,8 +32,10 @@ export declare function changesOf(result: {
32
32
  } | null | undefined): number;
33
33
  /**
34
34
  * Returns the prefix when it is a lower-case letter followed by at most 39 lower-case letters, digits or underscores,
35
- * other than `sqlite` and a prefix beginning `sqlite_`, and otherwise throws a `RangeError`. The prefix is written into
36
- * the SQL as it is, so nothing else passes, and every prefix that passes makes tables on SQLite and on PostgreSQL.
35
+ * and otherwise throws a `RangeError`. The prefix is written into the SQL as it is, so nothing else passes. Every
36
+ * prefix that passes makes tables on PostgreSQL. On SQLite, `sqlite` and a prefix beginning `sqlite_` make names that
37
+ * SQLite keeps for its own tables, and its `CREATE TABLE` refuses them (https://www.sqlite.org/lang_createtable.html),
38
+ * so a host there takes another prefix.
37
39
  *
38
40
  * @param prefix The table prefix the caller gave.
39
41
  */
@@ -1 +1 @@
1
- {"version":3,"file":"database.d.ts","sourceRoot":"","sources":["../../src/preferences/database.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;GAKG;AACH,MAAM,WAAW,kBAAkB;IACjC;;;;OAIG;IACH,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC;QAAE,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACpE,6FAA6F;IAC7F,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,CAAC,GAAG,IAAI,GAAG,SAAS,CAAC,CAAC;CACxE;AAED;;;;;;GAMG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE;IAAE,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,CAG3F;AAWD;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,CAMrD;AAUD;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,MAAM,CAKjE"}
1
+ {"version":3,"file":"database.d.ts","sourceRoot":"","sources":["../../src/preferences/database.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;GAKG;AACH,MAAM,WAAW,kBAAkB;IACjC;;;;OAIG;IACH,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC;QAAE,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACpE,6FAA6F;IAC7F,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,CAAC,GAAG,IAAI,GAAG,SAAS,CAAC,CAAC;CACxE;AAED;;;;;;GAMG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE;IAAE,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,CAG3F;AAQD;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,CAKrD;AAUD;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,MAAM,CAKjE"}
@@ -18,25 +18,24 @@ function changesOf(result) {
18
18
  const changes = result?.changes;
19
19
  return typeof changes === 'number' && Number.isSafeInteger(changes) && changes >= 0 ? changes : 0;
20
20
  }
21
- /** A table prefix: a lower-case letter, then at most 39 lower-case letters, digits or underscores. */
22
- const PREFIX = /^[a-z][a-z0-9_]{0,39}$/;
23
21
  /**
24
- * A prefix whose tables would begin `sqlite_`: SQLite keeps those names for its own tables and refuses to create one
25
- * (https://www.sqlite.org/lang_createtable.html).
22
+ * A table prefix: a lower-case letter, then at most 39 lower-case letters, digits or underscores, the rule of AgentOS's
23
+ * `durableInboxDdl`.
26
24
  */
27
- const SQLITE_OWN = /^sqlite(?:_|$)/;
25
+ const PREFIX = /^[a-z][a-z0-9_]{0,39}$/;
28
26
  /**
29
27
  * Returns the prefix when it is a lower-case letter followed by at most 39 lower-case letters, digits or underscores,
30
- * other than `sqlite` and a prefix beginning `sqlite_`, and otherwise throws a `RangeError`. The prefix is written into
31
- * the SQL as it is, so nothing else passes, and every prefix that passes makes tables on SQLite and on PostgreSQL.
28
+ * and otherwise throws a `RangeError`. The prefix is written into the SQL as it is, so nothing else passes. Every
29
+ * prefix that passes makes tables on PostgreSQL. On SQLite, `sqlite` and a prefix beginning `sqlite_` make names that
30
+ * SQLite keeps for its own tables, and its `CREATE TABLE` refuses them (https://www.sqlite.org/lang_createtable.html),
31
+ * so a host there takes another prefix.
32
32
  *
33
33
  * @param prefix The table prefix the caller gave.
34
34
  */
35
35
  function requirePrefix(prefix) {
36
- if (typeof prefix === 'string' && PREFIX.test(prefix) && !SQLITE_OWN.test(prefix))
36
+ if (typeof prefix === 'string' && PREFIX.test(prefix))
37
37
  return prefix;
38
- throw new RangeError('The table prefix was refused: give a lower-case letter followed by at most 39 lower-case letters, digits or ' +
39
- 'underscores, other than sqlite and a prefix beginning sqlite_, whose tables SQLite keeps for itself');
38
+ throw new RangeError('The table prefix was refused: give a lower-case letter followed by at most 39 lower-case letters, digits or underscores');
40
39
  }
41
40
  /**
42
41
  * What a text column cannot hold as given: U+0000, which PostgreSQL's text refuses, and a lone surrogate, which UTF-8
@@ -1 +1 @@
1
- {"version":3,"file":"database.js","sourceRoot":"","sources":["../../src/preferences/database.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AA0BH,8BAGC;AAkBD,sCAMC;AAkBD,kCAKC;AAzDD;;;;;;GAMG;AACH,SAAgB,SAAS,CAAC,MAAyD;IACjF,MAAM,OAAO,GAAG,MAAM,EAAE,OAAO,CAAC;IAChC,OAAO,OAAO,OAAO,KAAK,QAAQ,IAAI,MAAM,CAAC,aAAa,CAAC,OAAO,CAAC,IAAI,OAAO,IAAI,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;AACpG,CAAC;AAED,sGAAsG;AACtG,MAAM,MAAM,GAAG,wBAAwB,CAAC;AAExC;;;GAGG;AACH,MAAM,UAAU,GAAG,gBAAgB,CAAC;AAEpC;;;;;;GAMG;AACH,SAAgB,aAAa,CAAC,MAAe;IAC3C,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC;QAAE,OAAO,MAAM,CAAC;IACjG,MAAM,IAAI,UAAU,CAClB,8GAA8G;QAC5G,qGAAqG,CACxG,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,GAAG,yBAAyB,CAAC;AAE7C;;;;;;;GAOG;AACH,SAAgB,WAAW,CAAC,KAAa,EAAE,KAAc;IACvD,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,IAAI,KAAK,CAAC,MAAM,IAAI,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IAClH,MAAM,IAAI,SAAS,CACjB,OAAO,KAAK,sGAAsG,CACnH,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"database.js","sourceRoot":"","sources":["../../src/preferences/database.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AA0BH,8BAGC;AAiBD,sCAKC;AAkBD,kCAKC;AAvDD;;;;;;GAMG;AACH,SAAgB,SAAS,CAAC,MAAyD;IACjF,MAAM,OAAO,GAAG,MAAM,EAAE,OAAO,CAAC;IAChC,OAAO,OAAO,OAAO,KAAK,QAAQ,IAAI,MAAM,CAAC,aAAa,CAAC,OAAO,CAAC,IAAI,OAAO,IAAI,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;AACpG,CAAC;AAED;;;GAGG;AACH,MAAM,MAAM,GAAG,wBAAwB,CAAC;AAExC;;;;;;;;GAQG;AACH,SAAgB,aAAa,CAAC,MAAe;IAC3C,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC;QAAE,OAAO,MAAM,CAAC;IACrE,MAAM,IAAI,UAAU,CAClB,yHAAyH,CAC1H,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,GAAG,yBAAyB,CAAC;AAE7C;;;;;;;GAOG;AACH,SAAgB,WAAW,CAAC,KAAa,EAAE,KAAc;IACvD,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,IAAI,KAAK,CAAC,MAAM,IAAI,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IAClH,MAAM,IAAI,SAAS,CACjB,OAAO,KAAK,sGAAsG,CACnH,CAAC;AACJ,CAAC"}
@@ -8,8 +8,8 @@ export type { RecipientCapability, RecipientCapabilityIssueOptions, RecipientGra
8
8
  * migration makes both. A host whose tables come from different migrations runs `suppressionStoreDdl` and
9
9
  * `recipientCapabilityDdl` where each belongs.
10
10
  *
11
- * @param prefix A lower-case letter followed by at most 39 lower-case letters, digits or underscores, other than
12
- * `sqlite` and a prefix beginning `sqlite_`.
11
+ * @param prefix A lower-case letter followed by at most 39 lower-case letters, digits or underscores. On SQLite, a
12
+ * prefix other than `sqlite` and those beginning `sqlite_`, whose tables SQLite keeps for itself and refuses to create.
13
13
  * @throws RangeError when the prefix does not fit.
14
14
  */
15
15
  export declare function emailPreferencesDdl(prefix: string): string;
@@ -21,8 +21,8 @@ Object.defineProperty(exports, "recipientCapabilityDdl", { enumerable: true, get
21
21
  * migration makes both. A host whose tables come from different migrations runs `suppressionStoreDdl` and
22
22
  * `recipientCapabilityDdl` where each belongs.
23
23
  *
24
- * @param prefix A lower-case letter followed by at most 39 lower-case letters, digits or underscores, other than
25
- * `sqlite` and a prefix beginning `sqlite_`.
24
+ * @param prefix A lower-case letter followed by at most 39 lower-case letters, digits or underscores. On SQLite, a
25
+ * prefix other than `sqlite` and those beginning `sqlite_`, whose tables SQLite keeps for itself and refuses to create.
26
26
  * @throws RangeError when the prefix does not fit.
27
27
  */
28
28
  function emailPreferencesDdl(prefix) {
@@ -0,0 +1,21 @@
1
+ /**
2
+ * @fileoverview A message as the `emailRead` and `emailSearch` tools answer it. A tool's answer goes to a model and may
3
+ * be cloned or written as JSON, so it carries plain data alone: each attachment's name, type and size without its
4
+ * `read()`, and the text once, as `body`, without the HTML part, which `EmailService`'s reads give a host.
5
+ */
6
+ import type { EmailMessage } from '../EmailService.js';
7
+ /** A message as the tools answer it: an `EmailMessage` without `html`, `text` and each attachment's `read()`. */
8
+ export type ToolMessage = Omit<EmailMessage, 'html' | 'text' | 'attachments'> & {
9
+ attachments: Array<{
10
+ name: string;
11
+ type: string;
12
+ bytes: number;
13
+ }>;
14
+ };
15
+ /**
16
+ * `message` as the tools answer it.
17
+ *
18
+ * @param message A message `readInbox` or `searchEmails` gave.
19
+ */
20
+ export declare function toolMessageOf(message: EmailMessage): ToolMessage;
21
+ //# sourceMappingURL=messages.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../src/tools/messages.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEvD,iHAAiH;AACjH,MAAM,MAAM,WAAW,GAAG,IAAI,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,GAAG,aAAa,CAAC,GAAG;IAC9E,WAAW,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACnE,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,YAAY,GAAG,WAAW,CAGhE"}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ /**
3
+ * @fileoverview A message as the `emailRead` and `emailSearch` tools answer it. A tool's answer goes to a model and may
4
+ * be cloned or written as JSON, so it carries plain data alone: each attachment's name, type and size without its
5
+ * `read()`, and the text once, as `body`, without the HTML part, which `EmailService`'s reads give a host.
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.toolMessageOf = toolMessageOf;
9
+ /**
10
+ * `message` as the tools answer it.
11
+ *
12
+ * @param message A message `readInbox` or `searchEmails` gave.
13
+ */
14
+ function toolMessageOf(message) {
15
+ const { html: _html, text: _text, attachments, ...rest } = message;
16
+ return { ...rest, attachments: attachments.map(({ name, type, bytes }) => ({ name, type, bytes })) };
17
+ }
18
+ //# sourceMappingURL=messages.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"messages.js","sourceRoot":"","sources":["../../src/tools/messages.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;AAcH,sCAGC;AARD;;;;GAIG;AACH,SAAgB,aAAa,CAAC,OAAqB;IACjD,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,WAAW,EAAE,GAAG,IAAI,EAAE,GAAG,OAAO,CAAC;IACnE,OAAO,EAAE,GAAG,IAAI,EAAE,WAAW,EAAE,WAAW,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,EAAE,CAAC;AACvG,CAAC"}
@@ -24,8 +24,8 @@ export declare class EmailReadTool {
24
24
  };
25
25
  constructor(service: EmailService);
26
26
  /**
27
- * Reads the folder through `EmailService.readInbox`. A `limit` that is not a whole number of at least 1 is refused
28
- * before any mail is read, with `{ success: false, error }`.
27
+ * Reads the folder through `EmailService.readInbox`. A `limit` that is not a whole number of at least 1, or a `folder`
28
+ * that is not a name, is refused before any mail is read, with `{ success: false, error }`.
29
29
  */
30
30
  execute(args: {
31
31
  folder?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"read.d.ts","sourceRoot":"","sources":["../../src/tools/read.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEvD,qBAAa,aAAa;IAiBZ,OAAO,CAAC,OAAO;IAhB3B,QAAQ,CAAC,EAAE,eAAe;IAC1B,QAAQ,CAAC,IAAI,eAAe;IAC5B,QAAQ,CAAC,WAAW,gBAAgB;IACpC,QAAQ,CAAC,WAAW,sFAAsF;IAC1G,QAAQ,CAAC,QAAQ,mBAAmB;IACpC,QAAQ,CAAC,OAAO,WAAW;IAC3B,QAAQ,CAAC,cAAc,SAAS;IAEhC,QAAQ,CAAC,WAAW;;;;;;;;;;;;;MAMlB;gBAEkB,OAAO,EAAE,YAAY;IAEzC;;;OAGG;IACG,OAAO,CAAC,IAAI,EAAE;QAClB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,IAAI,CAAC,EAAE,GAAG,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CAQ9D"}
1
+ {"version":3,"file":"read.d.ts","sourceRoot":"","sources":["../../src/tools/read.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAGvD,qBAAa,aAAa;IAiBZ,OAAO,CAAC,OAAO;IAhB3B,QAAQ,CAAC,EAAE,eAAe;IAC1B,QAAQ,CAAC,IAAI,eAAe;IAC5B,QAAQ,CAAC,WAAW,gBAAgB;IACpC,QAAQ,CAAC,WAAW,sFAAsF;IAC1G,QAAQ,CAAC,QAAQ,mBAAmB;IACpC,QAAQ,CAAC,OAAO,WAAW;IAC3B,QAAQ,CAAC,cAAc,SAAS;IAEhC,QAAQ,CAAC,WAAW;;;;;;;;;;;;;MAMlB;gBAEkB,OAAO,EAAE,YAAY;IAEzC;;;OAGG;IACG,OAAO,CAAC,IAAI,EAAE;QAClB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,IAAI,CAAC,EAAE,GAAG,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CAS9D"}
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.EmailReadTool = void 0;
4
+ const messages_js_1 = require("./messages.js");
4
5
  class EmailReadTool {
5
6
  constructor(service) {
6
7
  this.service = service;
@@ -20,13 +21,14 @@ class EmailReadTool {
20
21
  };
21
22
  }
22
23
  /**
23
- * Reads the folder through `EmailService.readInbox`. A `limit` that is not a whole number of at least 1 is refused
24
- * before any mail is read, with `{ success: false, error }`.
24
+ * Reads the folder through `EmailService.readInbox`. A `limit` that is not a whole number of at least 1, or a `folder`
25
+ * that is not a name, is refused before any mail is read, with `{ success: false, error }`.
25
26
  */
26
27
  async execute(args) {
27
28
  try {
28
- const messages = await this.service.readInbox(args.folder ?? 'INBOX', args.limit ?? 20);
29
- return { success: true, data: { messages, count: messages.length } };
29
+ // Named in one object, so a folder a model gives as anything but text is refused as a folder, never read as options.
30
+ const messages = await this.service.readInbox({ folder: args.folder ?? 'INBOX', limit: args.limit ?? 20 });
31
+ return { success: true, data: { messages: messages.map(messages_js_1.toolMessageOf), count: messages.length } };
30
32
  }
31
33
  catch (err) {
32
34
  return { success: false, error: err.message };
@@ -1 +1 @@
1
- {"version":3,"file":"read.js","sourceRoot":"","sources":["../../src/tools/read.ts"],"names":[],"mappings":";;;AAGA,MAAa,aAAa;IAiBxB,YAAoB,OAAqB;QAArB,YAAO,GAAP,OAAO,CAAc;QAhBhC,OAAE,GAAG,WAAW,CAAC;QACjB,SAAI,GAAG,WAAW,CAAC;QACnB,gBAAW,GAAG,YAAY,CAAC;QAC3B,gBAAW,GAAG,kFAAkF,CAAC;QACjG,aAAQ,GAAG,eAAe,CAAC;QAC3B,YAAO,GAAG,OAAO,CAAC;QAClB,mBAAc,GAAG,KAAK,CAAC;QAEvB,gBAAW,GAAG;YACrB,IAAI,EAAE,QAAiB;YACvB,UAAU,EAAE;gBACV,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,sCAAsC,EAAE;gBAC/E,KAAK,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,EAAE,WAAW,EAAE,kFAAkF,EAAE;aACxI;SACF,CAAC;IAE0C,CAAC;IAE7C;;;OAGG;IACH,KAAK,CAAC,OAAO,CAAC,IAGb;QACC,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,IAAI,OAAO,EAAE,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC;YACxF,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,CAAC,MAAM,EAAE,EAAE,CAAC;QACvE,CAAC;QAAC,OAAO,GAAQ,EAAE,CAAC;YAClB,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,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E,KAAK,EAAE,KAAK,EAAE,GAAG,CAAC,OAAO,EAAE,CAAC;QAChD,CAAC;IACH,CAAC;CACF;AAnCD,sCAmCC"}
@@ -1 +1 @@
1
- {"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../src/tools/search.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEvD,qBAAa,eAAe;IAuBd,OAAO,CAAC,OAAO;IAtB3B,QAAQ,CAAC,EAAE,iBAAiB;IAC5B,QAAQ,CAAC,IAAI,iBAAiB;IAC9B,QAAQ,CAAC,WAAW,mBAAmB;IACvC,QAAQ,CAAC,WAAW,4EAA4E;IAChG,QAAQ,CAAC,QAAQ,mBAAmB;IACpC,QAAQ,CAAC,OAAO,WAAW;IAC3B,QAAQ,CAAC,cAAc,SAAS;IAEhC,QAAQ,CAAC,WAAW;;;;;;;;;;;;;;;;;MAYlB;gBAEkB,OAAO,EAAE,YAAY;IAEzC;;;OAGG;IACG,OAAO,CAAC,IAAI,EAAE;QAClB,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,IAAI,CAAC,EAAE,GAAG,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CAY9D"}
1
+ {"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../src/tools/search.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAGvD,qBAAa,eAAe;IAuBd,OAAO,CAAC,OAAO;IAtB3B,QAAQ,CAAC,EAAE,iBAAiB;IAC5B,QAAQ,CAAC,IAAI,iBAAiB;IAC9B,QAAQ,CAAC,WAAW,mBAAmB;IACvC,QAAQ,CAAC,WAAW,4EAA4E;IAChG,QAAQ,CAAC,QAAQ,mBAAmB;IACpC,QAAQ,CAAC,OAAO,WAAW;IAC3B,QAAQ,CAAC,cAAc,SAAS;IAEhC,QAAQ,CAAC,WAAW;;;;;;;;;;;;;;;;;MAYlB;gBAEkB,OAAO,EAAE,YAAY;IAEzC;;;OAGG;IACG,OAAO,CAAC,IAAI,EAAE;QAClB,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,IAAI,CAAC,EAAE,GAAG,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CAY9D"}
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.EmailSearchTool = void 0;
4
+ const messages_js_1 = require("./messages.js");
4
5
  class EmailSearchTool {
5
6
  constructor(service) {
6
7
  this.service = service;
@@ -35,7 +36,7 @@ class EmailSearchTool {
35
36
  folder: args.folder,
36
37
  since: args.since,
37
38
  });
38
- return { success: true, data: { messages, count: messages.length } };
39
+ return { success: true, data: { messages: messages.map(messages_js_1.toolMessageOf), count: messages.length } };
39
40
  }
40
41
  catch (err) {
41
42
  return { success: false, error: err.message };
@@ -1 +1 @@
1
- {"version":3,"file":"search.js","sourceRoot":"","sources":["../../src/tools/search.ts"],"names":[],"mappings":";;;AAGA,MAAa,eAAe;IAuB1B,YAAoB,OAAqB;QAArB,YAAO,GAAP,OAAO,CAAc;QAtBhC,OAAE,GAAG,aAAa,CAAC;QACnB,SAAI,GAAG,aAAa,CAAC;QACrB,gBAAW,GAAG,eAAe,CAAC;QAC9B,gBAAW,GAAG,wEAAwE,CAAC;QACvF,aAAQ,GAAG,eAAe,CAAC;QAC3B,YAAO,GAAG,OAAO,CAAC;QAClB,mBAAc,GAAG,KAAK,CAAC;QAEvB,gBAAW,GAAG;YACrB,IAAI,EAAE,Q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,mBAAc,GAAG,KAAK,CAAC;QAEvB,gBAAW,GAAG;YACrB,IAAI,EAAE,QAAiB;YACvB,UAAU,EAAE;gBACV,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,kDAAkD,EAAE;gBAC1F,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,wCAAwC,EAAE;gBACjF,KAAK,EAAE;oBACL,IAAI,EAAE,QAAQ;oBACd,WAAW,EACT,sIAAsI;iBACzI;aACF;YACD,QAAQ,EAAE,CAAC,OAAO,CAAC;SACpB,CAAC;IAE0C,CAAC;IAE7C;;;OAGG;IACH,KAAK,CAAC,OAAO,CAAC,IAIb;QACC,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC;gBAC/C,KAAK,EAAE,IAAI,CAAC,KAAK;gBACjB,MAAM,EAAE,IAAI,CAAC,MAAM;gBACnB,KAAK,EAAE,IAAI,CAAC,KAAK;aAClB,CAAC,CAAC;YACH,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,QAAQ,EAAE,QAAQ,CAAC,GAAG,CAAC,2BAAa,CAAC,EAAE,KAAK,EAAE,QAAQ,CAAC,MAAM,EAAE,EAAE,CAAC;QACpG,CAAC;QAAC,OAAO,GAAQ,EAAE,CAAC;YAClB,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,CAAC,OAAO,EAAE,CAAC;QAChD,CAAC;IACH,CAAC;CACF;AA7CD,0CA6CC"}
package/manifest.json CHANGED
@@ -2,8 +2,8 @@
2
2
  "$schema": "https://agentos.sh/schemas/extension-manifest-v1.json",
3
3
  "id": "com.framers.channels.email",
4
4
  "name": "Email Channel Extension",
5
- "version": "0.4.3",
6
- "description": "Bidirectional email integration: send through SMTP or Resend's HTTPS API; read, search, extract verification codes and reply through IMAP; keep a suppression record and unsubscribe tokens on a SQL database.",
5
+ "version": "0.5.0",
6
+ "description": "Bidirectional email integration: send through SMTP or Resend's HTTPS API; read, search, extract verification codes, reply, move, label, flag and delete through IMAP; keep a suppression record and unsubscribe tokens on a SQL database.",
7
7
  "categories": ["channel", "communication"],
8
8
  "platforms": ["email"],
9
9
  "sdk": "nodemailer",
@@ -23,6 +23,7 @@
23
23
  "Search emails by query, folder, and date range",
24
24
  "Extract verification codes and OTPs from email bodies",
25
25
  "Reply to email threads maintaining conversation context",
26
+ "Read every recipient, the threading and authentication headers, bounded text and HTML parts and attachments after a UID; move, label, flag and delete one message by UID",
26
27
  "Keep a suppression record and opaque unsubscribe tokens, stored as hashes, on a SQL database"
27
28
  ]
28
29
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@framers/agentos-ext-channel-email",
3
- "version": "0.4.3",
4
- "description": "Email channel adapter for AgentOS: send through SMTP or Resend's HTTPS API; read, search, extract codes and reply through IMAP; keep a suppression record and unsubscribe tokens on a SQL database.",
3
+ "version": "0.5.0",
4
+ "description": "Email channel adapter for AgentOS: send through SMTP or Resend's HTTPS API; read, search, extract codes, reply, move, label, flag and delete through IMAP; keep a suppression record and unsubscribe tokens on a SQL database.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "license": "Apache-2.0",
@@ -22,11 +22,11 @@
22
22
  "nodemailer": "^10.0.16"
23
23
  },
24
24
  "devDependencies": {
25
- "@framers/sql-storage-adapter": "^0.6.14",
25
+ "@framers/sql-storage-adapter": "^0.8.1",
26
26
  "@types/node": "^20.0.0",
27
27
  "typescript": "^5.0.0",
28
28
  "vitest": "^3.2.7",
29
- "@framers/agentos": "^0.13.134"
29
+ "@framers/agentos": "^0.14.25"
30
30
  },
31
31
  "repository": {
32
32
  "type": "git",