@framers/agentos-ext-channel-email 0.4.1 → 0.4.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.
@@ -20,15 +20,22 @@ function requirePrefix(prefix) {
20
20
  throw new RangeError('The table prefix was refused: give a lower-case letter followed by at most 39 lower-case letters, digits or underscores');
21
21
  }
22
22
  /**
23
- * Returns `value` when it is a string of 1 to 512 characters, and otherwise throws a `TypeError` that names `field` and
24
- * never the value.
23
+ * What a text column cannot hold as given: U+0000, which PostgreSQL's text refuses, and a lone surrogate, which UTF-8
24
+ * cannot encode, so a driver writes something else in its place (node-postgres writes U+FFFD): the row would name
25
+ * another value, and two values would meet in one. With the `u` flag a surrogate pair is one code point and does not
26
+ * match.
27
+ */
28
+ const UNSTORABLE = /\u0000|[\uD800-\uDFFF]/u;
29
+ /**
30
+ * Returns `value` when it is a string of 1 to 512 characters that a text column holds as it is, with no U+0000 and no
31
+ * lone surrogate, and otherwise throws a `TypeError` that names `field` and never the value.
25
32
  *
26
33
  * @param field The argument's name, such as `scope`.
27
34
  * @param value The value the caller gave.
28
35
  */
29
36
  function requireName(field, value) {
30
- if (typeof value === 'string' && value.length > 0 && value.length <= 512)
37
+ if (typeof value === 'string' && value.length > 0 && value.length <= 512 && !UNSTORABLE.test(value))
31
38
  return value;
32
- throw new TypeError(`The ${field} was refused: give it as a string of 1 to 512 characters`);
39
+ throw new TypeError(`The ${field} was refused: give it as a string of 1 to 512 characters with no U+0000 and no lone surrogate`);
33
40
  }
34
41
  //# sourceMappingURL=database.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"database.js","sourceRoot":"","sources":["../../src/preferences/database.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAwBH,sCAKC;AASD,kCAGC;AA1BD,sGAAsG;AACtG,MAAM,MAAM,GAAG,wBAAwB,CAAC;AAExC;;;;;GAKG;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;;;;;;GAMG;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;QAAE,OAAO,KAAK,CAAC;IACvF,MAAM,IAAI,SAAS,CAAC,OAAO,KAAK,0DAA0D,CAAC,CAAC;AAC9F,CAAC"}
1
+ {"version":3,"file":"database.js","sourceRoot":"","sources":["../../src/preferences/database.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAwBH,sCAKC;AAiBD,kCAKC;AApCD,sGAAsG;AACtG,MAAM,MAAM,GAAG,wBAAwB,CAAC;AAExC;;;;;GAKG;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;;;;;;GAMG;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,+FAA+F,CAC5G,CAAC;AACJ,CAAC"}
@@ -14,7 +14,7 @@ class EmailExtractCodesTool {
14
14
  this.inputSchema = {
15
15
  type: 'object',
16
16
  properties: {
17
- messageId: { type: 'string', description: 'Message ID of the email to extract codes from' },
17
+ messageId: { type: 'string', description: 'Message ID of the email to extract codes from, as emailRead or emailSearch gives it, such as <id@example.com>' },
18
18
  pattern: { type: 'string', description: 'Optional regex pattern to match codes (default: 4-8 digit numbers)' },
19
19
  },
20
20
  required: ['messageId'],
@@ -1 +1 @@
1
- {"version":3,"file":"extractCodes.js","sourceRoot":"","sources":["../../src/tools/extractCodes.ts"],"names":[],"mappings":";;;AAGA,MAAa,qBAAqB;IAkBhC,YAAoB,OAAqB;QAArB,YAAO,GAAP,OAAO,CAAc;QAjBhC,OAAE,GAAG,mBAAmB,CAAC;QACzB,SAAI,GAAG,mBAAmB,CAAC;QAC3B,gBAAW,GAAG,4BAA4B,CAAC;QAC3C,gBAAW,GAAG,+EAA+E,CAAC;QAC9F,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,SAAS,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,+CAA+C,EAAE;gBAC3F,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,oEAAoE,EAAE;aAC/G;YACD,QAAQ,EAAE,CAAC,WAAW,CAAC;SACxB,CAAC;IAE0C,CAAC;IAE7C,KAAK,CAAC,OAAO,CAAC,IAGb;QACC,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;YAC7E,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;QACzC,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;AA/BD,sDA+BC"}
1
+ {"version":3,"file":"extractCodes.js","sourceRoot":"","sources":["../../src/tools/extractCodes.ts"],"names":[],"mappings":";;;AAGA,MAAa,qBAAqB;IAkBhC,YAAoB,OAAqB;QAArB,YAAO,GAAP,OAAO,CAAc;QAjBhC,OAAE,GAAG,mBAAmB,CAAC;QACzB,SAAI,GAAG,mBAAmB,CAAC;QAC3B,gBAAW,GAAG,4BAA4B,CAAC;QAC3C,gBAAW,GAAG,+EAA+E,CAAC;QAC9F,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,SAAS,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,+GAA+G,EAAE;gBAC3J,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,oEAAoE,EAAE;aAC/G;YACD,QAAQ,EAAE,CAAC,WAAW,CAAC;SACxB,CAAC;IAE0C,CAAC;IAE7C,KAAK,CAAC,OAAO,CAAC,IAGb;QACC,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;YAC7E,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;QACzC,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;AA/BD,sDA+BC"}
@@ -30,7 +30,8 @@ export declare class EmailReplyTool {
30
30
  /**
31
31
  * Sends the reply through `EmailService.replyToEmail`. A `messageId` or `body` that is not a string, or an `html`
32
32
  * that is given and is not one, is refused before the original is read or anything is sent, with
33
- * `{ success: false, error }` naming the field.
33
+ * `{ success: false, error }` naming the field. A `messageId` that is not one message id, or that no message in the
34
+ * inbox has, is answered the same way before anything is sent, with an error that holds none of it.
34
35
  */
35
36
  execute(args: {
36
37
  messageId: string;
@@ -1 +1 @@
1
- {"version":3,"file":"reply.d.ts","sourceRoot":"","sources":["../../src/tools/reply.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEvD,qBAAa,cAAc;IAmBb,OAAO,CAAC,OAAO;IAlB3B,QAAQ,CAAC,EAAE,gBAAgB;IAC3B,QAAQ,CAAC,IAAI,gBAAgB;IAC7B,QAAQ,CAAC,WAAW,oBAAoB;IACxC,QAAQ,CAAC,WAAW,gHAAgH;IACpI,QAAQ,CAAC,QAAQ,mBAAmB;IACpC,QAAQ,CAAC,OAAO,WAAW;IAC3B,QAAQ,CAAC,cAAc,QAAQ;IAE/B,QAAQ,CAAC,WAAW;;;;;;;;;;;;;;;;;MAQlB;gBAEkB,OAAO,EAAE,YAAY;IAEzC;;;;OAIG;IACG,OAAO,CAAC,IAAI,EAAE;QAClB,SAAS,EAAE,MAAM,CAAC;QAClB,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,CAAC,EAAE,MAAM,CAAC;KACf,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":"reply.d.ts","sourceRoot":"","sources":["../../src/tools/reply.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEvD,qBAAa,cAAc;IAmBb,OAAO,CAAC,OAAO;IAlB3B,QAAQ,CAAC,EAAE,gBAAgB;IAC3B,QAAQ,CAAC,IAAI,gBAAgB;IAC7B,QAAQ,CAAC,WAAW,oBAAoB;IACxC,QAAQ,CAAC,WAAW,gHAAgH;IACpI,QAAQ,CAAC,QAAQ,mBAAmB;IACpC,QAAQ,CAAC,OAAO,WAAW;IAC3B,QAAQ,CAAC,cAAc,QAAQ;IAE/B,QAAQ,CAAC,WAAW;;;;;;;;;;;;;;;;;MAQlB;gBAEkB,OAAO,EAAE,YAAY;IAEzC;;;;;OAKG;IACG,OAAO,CAAC,IAAI,EAAE;QAClB,SAAS,EAAE,MAAM,CAAC;QAClB,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,CAAC,EAAE,MAAM,CAAC;KACf,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,IAAI,CAAC,EAAE,GAAG,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CAQ9D"}
@@ -14,7 +14,7 @@ class EmailReplyTool {
14
14
  this.inputSchema = {
15
15
  type: 'object',
16
16
  properties: {
17
- messageId: { type: 'string', description: 'Message ID of the email to reply to' },
17
+ messageId: { type: 'string', description: 'Message ID of the email to reply to, as emailRead or emailSearch gives it, such as <id@example.com>' },
18
18
  body: { type: 'string', description: 'Plain text reply body' },
19
19
  html: { type: 'string', description: 'Optional HTML reply body' },
20
20
  },
@@ -24,7 +24,8 @@ class EmailReplyTool {
24
24
  /**
25
25
  * Sends the reply through `EmailService.replyToEmail`. A `messageId` or `body` that is not a string, or an `html`
26
26
  * that is given and is not one, is refused before the original is read or anything is sent, with
27
- * `{ success: false, error }` naming the field.
27
+ * `{ success: false, error }` naming the field. A `messageId` that is not one message id, or that no message in the
28
+ * inbox has, is answered the same way before anything is sent, with an error that holds none of it.
28
29
  */
29
30
  async execute(args) {
30
31
  try {
@@ -1 +1 @@
1
- {"version":3,"file":"reply.js","sourceRoot":"","sources":["../../src/tools/reply.ts"],"names":[],"mappings":";;;AAGA,MAAa,cAAc;IAmBzB,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OAAO,CAAc;QAlBhC,OAAE,GAAG,YAAY,CAAC;QAClB,SAAI,GAAG,YAAY,CAAC;QACpB,gBAAW,GAAG,gBAAgB,CAAC;QAC/B,gBAAW,GAAG,4GAA4G,CAAC;QAC3H,aAAQ,GAAG,eAAe,CAAC;QAC3B,YAAO,GAAG,OAAO,CAAC;QAClB,mBAAc,GAAG,IAAI,CAAC;QAEtB,gBAAW,GAAG;YACrB,IAAI,EAAE,QAAiB;YACvB,UAAU,EAAE;gBACV,SAAS,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,qGAAqG,EAAE;gBACjJ,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,uBAAuB,EAAE;gBAC9D,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,0BAA0B,EAAE;aAClE;YACD,QAAQ,EAAE,CAAC,WAAW,EAAE,MAAM,CAAC;SAChC,CAAC;IAE0C,CAAC;IAE7C;;;;;OAKG;IACH,KAAK,CAAC,OAAO,CAAC,IAIb;QACC,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;YACrF,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;QACzC,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;AAvCD,wCAuCC"}
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.1",
6
- "description": "Bidirectional email integration: send through SMTP or Resend's HTTPS API, and read, search, extract verification codes and reply through IMAP.",
5
+ "version": "0.4.2",
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.",
7
7
  "categories": ["channel", "communication"],
8
8
  "platforms": ["email"],
9
9
  "sdk": "nodemailer",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@framers/agentos-ext-channel-email",
3
- "version": "0.4.1",
3
+ "version": "0.4.2",
4
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.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",