agentmail-toolkit 0.1.10 → 0.1.12

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 CHANGED
@@ -21,15 +21,14 @@ export AGENTMAIL_API_KEY=your-api-key
21
21
  ### Usage
22
22
 
23
23
  ```typescript
24
- import { streamText } from 'ai'
25
24
  import { openai } from '@ai-sdk/openai'
26
25
  import { AgentMailToolkit } from 'agentmail-toolkit/ai-sdk'
26
+ import { streamText } from 'ai'
27
27
 
28
28
  const result = streamText({
29
29
  model: openai('gpt-4o'),
30
30
  messages,
31
- system: 'You are an agent that can send, receive, and manage emails. You were created by AgentMail. When asked to introduce yourself, offer to demonstrate your capabilities.',
31
+ system: 'You are an email agent created by AgentMail that can create and manage inboxes as well as send and receive emails.',
32
32
  tools: new AgentMailToolkit().getTools(),
33
- maxSteps: 4,
34
33
  })
35
34
  ```
package/dist/ai-sdk.d.mts CHANGED
@@ -1,26 +1,12 @@
1
- import { Tool as Tool$1 } from 'ai';
1
+ import { Tool } from 'ai';
2
2
  import { AgentMailClient } from 'agentmail';
3
- import { z } from 'zod';
3
+ import { T as Toolkit, a as Tool$1 } from './toolkit-BonhsWAN.mjs';
4
+ import 'zod';
4
5
 
5
- type Tool = {
6
- name: string;
7
- methodName: string;
8
- description: string;
9
- paramsSchema: z.ZodObject<any>;
10
- };
11
-
12
- declare abstract class Toolkit<T> {
13
- private readonly client?;
14
- private readonly tools;
15
- constructor(client?: AgentMailClient | undefined);
16
- protected abstract buildTool(tool: Tool): T;
17
- getTools(): Record<string, T>;
18
- callMethod(methodName: string, args: unknown): Promise<any>;
19
- }
20
-
21
- declare class AgentMailToolkit extends Toolkit<Tool$1> {
6
+ declare class AgentMailToolkit extends Toolkit<Tool> {
22
7
  constructor(client?: AgentMailClient);
23
- protected buildTool(tool: Tool): Tool$1;
8
+ protected buildTool(tool: Tool$1): Tool;
9
+ getTools(): Record<string, Tool>;
24
10
  }
25
11
 
26
12
  export { AgentMailToolkit };
package/dist/ai-sdk.d.ts CHANGED
@@ -1,26 +1,12 @@
1
- import { Tool as Tool$1 } from 'ai';
1
+ import { Tool } from 'ai';
2
2
  import { AgentMailClient } from 'agentmail';
3
- import { z } from 'zod';
3
+ import { T as Toolkit, a as Tool$1 } from './toolkit-BonhsWAN.js';
4
+ import 'zod';
4
5
 
5
- type Tool = {
6
- name: string;
7
- methodName: string;
8
- description: string;
9
- paramsSchema: z.ZodObject<any>;
10
- };
11
-
12
- declare abstract class Toolkit<T> {
13
- private readonly client?;
14
- private readonly tools;
15
- constructor(client?: AgentMailClient | undefined);
16
- protected abstract buildTool(tool: Tool): T;
17
- getTools(): Record<string, T>;
18
- callMethod(methodName: string, args: unknown): Promise<any>;
19
- }
20
-
21
- declare class AgentMailToolkit extends Toolkit<Tool$1> {
6
+ declare class AgentMailToolkit extends Toolkit<Tool> {
22
7
  constructor(client?: AgentMailClient);
23
- protected buildTool(tool: Tool): Tool$1;
8
+ protected buildTool(tool: Tool$1): Tool;
9
+ getTools(): Record<string, Tool>;
24
10
  }
25
11
 
26
12
  export { AgentMailToolkit };
package/dist/ai-sdk.js CHANGED
@@ -16,26 +16,6 @@ var __copyProps = (to, from, except, desc) => {
16
16
  return to;
17
17
  };
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var __async = (__this, __arguments, generator) => {
20
- return new Promise((resolve, reject) => {
21
- var fulfilled = (value) => {
22
- try {
23
- step(generator.next(value));
24
- } catch (e) {
25
- reject(e);
26
- }
27
- };
28
- var rejected = (value) => {
29
- try {
30
- step(generator.throw(value));
31
- } catch (e) {
32
- reject(e);
33
- }
34
- };
35
- var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
36
- step((generator = generator.apply(__this, __arguments)).next());
37
- });
38
- };
39
19
 
40
20
  // src/ai-sdk.ts
41
21
  var ai_sdk_exports = {};
@@ -166,7 +146,6 @@ var tools = [
166
146
  var Toolkit = class {
167
147
  constructor(client) {
168
148
  this.client = client;
169
- this.tools = {};
170
149
  if (!this.client) this.client = new import_agentmail.AgentMailClient();
171
150
  this.tools = tools.reduce(
172
151
  (acc, tool) => {
@@ -176,18 +155,17 @@ var Toolkit = class {
176
155
  {}
177
156
  );
178
157
  }
179
- getTools() {
180
- return this.tools;
181
- }
182
- callMethod(methodName, args) {
183
- return __async(this, null, function* () {
184
- const parts = methodName.split(".");
185
- const methodKey = parts.pop();
186
- if (!methodKey) throw new Error("Method name empty");
187
- let parent = this.client;
188
- for (const part of parts) parent = parent[part];
189
- return yield parent[methodKey].call(parent, args);
190
- });
158
+ tools = {};
159
+ // public getTools() {
160
+ // return this.tools
161
+ // }
162
+ async callMethod(methodName, args) {
163
+ const parts = methodName.split(".");
164
+ const methodKey = parts.pop();
165
+ if (!methodKey) throw new Error("Method name empty");
166
+ let parent = this.client;
167
+ for (const part of parts) parent = parent[part];
168
+ return await parent[methodKey].call(parent, args);
191
169
  }
192
170
  };
193
171
 
@@ -203,6 +181,9 @@ var AgentMailToolkit = class extends Toolkit {
203
181
  execute: (args) => this.callMethod(tool.methodName, args)
204
182
  };
205
183
  }
184
+ getTools() {
185
+ return this.tools;
186
+ }
206
187
  };
207
188
  // Annotate the CommonJS export names for ESM import in node:
208
189
  0 && (module.exports = {
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/ai-sdk.ts","../src/toolkit.ts","../src/schemas.ts","../src/tools.ts"],"sourcesContent":["import { type Tool as AiSdkTool } from 'ai'\nimport { AgentMailClient } from 'agentmail'\n\nimport { Toolkit } from './toolkit'\nimport { type Tool } from './tools'\n\nexport class AgentMailToolkit extends Toolkit<AiSdkTool> {\n constructor(client?: AgentMailClient) {\n super(client)\n }\n\n protected buildTool(tool: Tool): AiSdkTool {\n return {\n description: tool.description,\n parameters: tool.paramsSchema,\n execute: (args) => this.callMethod(tool.methodName, args),\n }\n }\n}\n","import { AgentMailClient } from 'agentmail'\nimport { type Tool, tools } from './tools'\n\nexport abstract class Toolkit<T> {\n private readonly tools: Record<string, T> = {}\n\n constructor(private readonly client?: AgentMailClient) {\n if (!this.client) this.client = new AgentMailClient()\n\n this.tools = tools.reduce(\n (acc, tool) => {\n acc[tool.name] = this.buildTool(tool)\n return acc\n },\n {} as Record<string, T>\n )\n }\n\n protected abstract buildTool(tool: Tool): T\n\n public getTools() {\n return this.tools\n }\n\n public async callMethod(methodName: string, args: unknown) {\n const parts = methodName.split('.')\n const methodKey = parts.pop()\n\n if (!methodKey) throw new Error('Method name empty')\n\n let parent: any = this.client\n for (const part of parts) parent = parent[part]\n\n return await parent[methodKey].call(parent, args)\n }\n}\n","import { z } from 'zod'\n\nexport const ListItemsParams = z.object({\n limit: z.number().optional().describe('The maximum number of items to return'),\n last_key: z.string().optional().describe('The last key to use for pagination'),\n})\n\nexport const GetInboxParams = z.object({\n inbox_id: z.string().describe('The ID of the inbox to get'),\n})\n\nexport const CreateInboxParams = z.object({\n username: z.string().optional().describe('The username of the inbox to create.'),\n domain: z.string().optional().describe('The domain of the inbox to create.'),\n display_name: z.string().optional().describe('The display name of the inbox to create.'),\n})\n\nexport const ListThreadsParams = ListItemsParams.extend({\n inbox_id: z.string().describe('The ID of the inbox to list threads for'),\n received: z.boolean().optional().describe('Whether to filter by received threads'),\n sent: z.boolean().optional().describe('Whether to filter by sent threads'),\n})\n\nexport const GetThreadParams = z.object({\n inbox_id: z.string().describe('The ID of the inbox to get the thread for'),\n thread_id: z.string().describe('The ID of the thread to get'),\n})\n\nexport const ListMessagesParams = ListItemsParams.extend({\n inbox_id: z.string().describe('The ID of the inbox to list messages for'),\n})\n\nexport const GetMessageParams = z.object({\n inbox_id: z.string().describe('The ID of the inbox to get the message for'),\n message_id: z.string().describe('The ID of the message to get'),\n})\n\nexport const GetAttachmentParams = z.object({\n inbox_id: z.string().describe('The ID of the inbox to get the attachment for'),\n message_id: z.string().describe('The ID of the message to get the attachment for'),\n attachment_id: z.string().describe('The ID of the attachment to get'),\n})\n\nexport const SendMessageParams = z.object({\n inbox_id: z.string().describe('The ID of the inbox to send the message from'),\n to: z.array(z.string()).describe('The list of recipients'),\n cc: z.array(z.string()).optional().describe('The list of CC recipients'),\n bcc: z.array(z.string()).optional().describe('The list of BCC recipients'),\n subject: z.string().optional().describe('The subject of the message'),\n text: z.string().optional().describe('The plain text body of the message'),\n html: z.string().optional().describe('The HTML body of the message'),\n})\n\nexport const ReplyToMessageParams = z.object({\n inbox_id: z.string().describe('The inboc ID of the inbox to reply to the message from'),\n message_id: z.string().describe('The message ID of the message you wish to reply to'),\n text: z.string().optional().describe('The plain text body of the reply'),\n html: z.string().optional().describe('The HTML body of the reply'),\n})\n","import { z } from 'zod'\n\nimport {\n ListItemsParams,\n GetInboxParams,\n CreateInboxParams,\n ListThreadsParams,\n GetThreadParams,\n ListMessagesParams,\n GetMessageParams,\n GetAttachmentParams,\n SendMessageParams,\n ReplyToMessageParams,\n} from './schemas'\n\nexport type Tool = {\n name: string\n methodName: string\n description: string\n paramsSchema: z.ZodObject<any>\n}\n\nexport const tools: Tool[] = [\n {\n name: 'list_inboxes',\n methodName: 'inboxes.list',\n description: 'List all inboxes',\n paramsSchema: ListItemsParams,\n },\n {\n name: 'get_inbox',\n methodName: 'inboxes.get',\n description: 'Get an inbox by ID',\n paramsSchema: GetInboxParams,\n },\n {\n name: 'create_inbox',\n methodName: 'inboxes.create',\n description: 'Create a new inbox',\n paramsSchema: CreateInboxParams,\n },\n {\n name: 'list_threads',\n methodName: 'threads.list',\n description: 'List all threads',\n paramsSchema: ListThreadsParams,\n },\n {\n name: 'get_thread',\n methodName: 'threads.get',\n description: 'Get a thread by ID',\n paramsSchema: GetThreadParams,\n },\n {\n name: 'list_messages',\n methodName: 'messages.list',\n description: 'List all messages',\n paramsSchema: ListMessagesParams,\n },\n {\n name: 'get_message',\n methodName: 'messages.get',\n description: 'Get a message by ID',\n paramsSchema: GetMessageParams,\n },\n {\n name: 'get_attachment',\n methodName: 'attachments.get',\n description: 'Get an attachment by ID',\n paramsSchema: GetAttachmentParams,\n },\n {\n name: 'send_message',\n methodName: 'messages.send',\n description: 'Send a message',\n paramsSchema: SendMessageParams,\n },\n {\n name: 'reply_to_message',\n methodName: 'messages.reply',\n description: 'Reply to a message',\n paramsSchema: ReplyToMessageParams,\n },\n]\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,uBAAgC;;;ACAhC,iBAAkB;AAEX,IAAM,kBAAkB,aAAE,OAAO;AAAA,EACpC,OAAO,aAAE,OAAO,EAAE,SAAS,EAAE,SAAS,uCAAuC;AAAA,EAC7E,UAAU,aAAE,OAAO,EAAE,SAAS,EAAE,SAAS,oCAAoC;AACjF,CAAC;AAEM,IAAM,iBAAiB,aAAE,OAAO;AAAA,EACnC,UAAU,aAAE,OAAO,EAAE,SAAS,4BAA4B;AAC9D,CAAC;AAEM,IAAM,oBAAoB,aAAE,OAAO;AAAA,EACtC,UAAU,aAAE,OAAO,EAAE,SAAS,EAAE,SAAS,sCAAsC;AAAA,EAC/E,QAAQ,aAAE,OAAO,EAAE,SAAS,EAAE,SAAS,oCAAoC;AAAA,EAC3E,cAAc,aAAE,OAAO,EAAE,SAAS,EAAE,SAAS,0CAA0C;AAC3F,CAAC;AAEM,IAAM,oBAAoB,gBAAgB,OAAO;AAAA,EACpD,UAAU,aAAE,OAAO,EAAE,SAAS,yCAAyC;AAAA,EACvE,UAAU,aAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,uCAAuC;AAAA,EACjF,MAAM,aAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,mCAAmC;AAC7E,CAAC;AAEM,IAAM,kBAAkB,aAAE,OAAO;AAAA,EACpC,UAAU,aAAE,OAAO,EAAE,SAAS,2CAA2C;AAAA,EACzE,WAAW,aAAE,OAAO,EAAE,SAAS,6BAA6B;AAChE,CAAC;AAEM,IAAM,qBAAqB,gBAAgB,OAAO;AAAA,EACrD,UAAU,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AAK;AAAA,EAChB;AAAA,EAEa,WAAW,YAAoB,MAAe;AAAA;AACvD,YAAM,QAAQ,WAAW,MAAM,GAAG;AAClC,YAAM,YAAY,MAAM,IAAI;AAE5B,UAAI,CAAC,UAAW,OAAM,IAAI,MAAM,mBAAmB;AAEnD,UAAI,SAAc,KAAK;AACvB,iBAAW,QAAQ,MAAO,UAAS,OAAO,IAAI;AAE9C,aAAO,MAAM,OAAO,SAAS,EAAE,KAAK,QAAQ,IAAI;AAAA,IACpD;AAAA;AACJ;;;AD7BO,IAAM,mBAAN,cAA+B,QAAmB;AAAA,EACrD,YAAY,QAA0B;AAClC,UAAM,MAAM;AAAA,EAChB;AAAA,EAEU,UAAU,MAAuB;AACvC,WAAO;AAAA,MACH,aAAa,KAAK;AAAA,MAClB,YAAY,KAAK;AAAA,MACjB,SAAS,CAAC,SAAS,KAAK,WAAW,KAAK,YAAY,IAAI;AAAA,IAC5D;AAAA,EACJ;AACJ;","names":[]}
1
+ {"version":3,"sources":["../src/ai-sdk.ts","../src/toolkit.ts","../src/schemas.ts","../src/tools.ts"],"sourcesContent":["import { type Tool as AiSdkTool } from 'ai'\nimport { AgentMailClient } from 'agentmail'\n\nimport { Toolkit } from './toolkit'\nimport { type Tool } from './tools'\n\nexport class AgentMailToolkit extends Toolkit<AiSdkTool> {\n constructor(client?: AgentMailClient) {\n super(client)\n }\n\n protected buildTool(tool: Tool): AiSdkTool {\n return {\n description: tool.description,\n parameters: tool.paramsSchema,\n execute: (args) => this.callMethod(tool.methodName, args),\n }\n }\n\n public getTools() {\n return this.tools\n }\n}\n","import { AgentMailClient } from 'agentmail'\nimport { type Tool, tools } from './tools'\n\nexport abstract class Toolkit<T> {\n protected readonly tools: Record<string, T> = {}\n\n constructor(private readonly client?: AgentMailClient) {\n if (!this.client) this.client = new AgentMailClient()\n\n this.tools = tools.reduce(\n (acc, tool) => {\n acc[tool.name] = this.buildTool(tool)\n return acc\n },\n {} as Record<string, T>\n )\n }\n\n protected abstract buildTool(tool: Tool): T\n\n // public getTools() {\n // return this.tools\n // }\n\n public async callMethod(methodName: string, args: unknown) {\n const parts = methodName.split('.')\n const methodKey = parts.pop()\n\n if (!methodKey) throw new Error('Method name empty')\n\n let parent: any = this.client\n for (const part of parts) parent = parent[part]\n\n return await parent[methodKey].call(parent, args)\n }\n}\n","import { z } from 'zod'\n\nexport const ListItemsParams = z.object({\n limit: z.number().optional().describe('The maximum number of items to return'),\n last_key: z.string().optional().describe('The last key to use for pagination'),\n})\n\nexport const GetInboxParams = z.object({\n inbox_id: z.string().describe('The ID of the inbox to get'),\n})\n\nexport const CreateInboxParams = z.object({\n username: z.string().optional().describe('The username of the inbox to create.'),\n domain: z.string().optional().describe('The domain of the inbox to create.'),\n display_name: z.string().optional().describe('The display name of the inbox to create.'),\n})\n\nexport const ListThreadsParams = ListItemsParams.extend({\n inbox_id: z.string().describe('The ID of the inbox to list threads for'),\n received: z.boolean().optional().describe('Whether to filter by received threads'),\n sent: z.boolean().optional().describe('Whether to filter by sent threads'),\n})\n\nexport const GetThreadParams = z.object({\n inbox_id: z.string().describe('The ID of the inbox to get the thread for'),\n thread_id: z.string().describe('The ID of the thread to get'),\n})\n\nexport const ListMessagesParams = ListItemsParams.extend({\n inbox_id: z.string().describe('The ID of the inbox to list messages for'),\n})\n\nexport const GetMessageParams = z.object({\n inbox_id: z.string().describe('The ID of the inbox to get the message for'),\n message_id: z.string().describe('The ID of the message to get'),\n})\n\nexport const GetAttachmentParams = z.object({\n inbox_id: z.string().describe('The ID of the inbox to get the attachment for'),\n message_id: z.string().describe('The ID of the message to get the attachment for'),\n attachment_id: z.string().describe('The ID of the attachment to get'),\n})\n\nexport const SendMessageParams = z.object({\n inbox_id: z.string().describe('The ID of the inbox to send the message from'),\n to: z.array(z.string()).describe('The list of recipients'),\n cc: z.array(z.string()).optional().describe('The list of CC recipients'),\n bcc: z.array(z.string()).optional().describe('The list of BCC recipients'),\n subject: z.string().optional().describe('The subject of the message'),\n text: z.string().optional().describe('The plain text body of the message'),\n html: z.string().optional().describe('The HTML body of the message'),\n})\n\nexport const ReplyToMessageParams = z.object({\n inbox_id: z.string().describe('The inboc ID of the inbox to reply to the message from'),\n message_id: z.string().describe('The message ID of the message you wish to reply to'),\n text: z.string().optional().describe('The plain text body of the reply'),\n html: z.string().optional().describe('The HTML body of the reply'),\n})\n","import { z } from 'zod'\n\nimport {\n ListItemsParams,\n GetInboxParams,\n CreateInboxParams,\n ListThreadsParams,\n GetThreadParams,\n ListMessagesParams,\n GetMessageParams,\n GetAttachmentParams,\n SendMessageParams,\n ReplyToMessageParams,\n} from './schemas'\n\nexport type Tool = {\n name: string\n methodName: string\n description: string\n paramsSchema: z.ZodObject<any>\n}\n\nexport const tools: Tool[] = [\n {\n name: 'list_inboxes',\n methodName: 'inboxes.list',\n description: 'List all inboxes',\n paramsSchema: ListItemsParams,\n },\n {\n name: 'get_inbox',\n methodName: 'inboxes.get',\n description: 'Get an inbox by ID',\n paramsSchema: GetInboxParams,\n },\n {\n name: 'create_inbox',\n methodName: 'inboxes.create',\n description: 'Create a new inbox',\n paramsSchema: CreateInboxParams,\n },\n {\n name: 'list_threads',\n methodName: 'threads.list',\n description: 'List all threads',\n paramsSchema: ListThreadsParams,\n },\n {\n name: 'get_thread',\n methodName: 'threads.get',\n description: 'Get a thread by ID',\n paramsSchema: GetThreadParams,\n },\n {\n name: 'list_messages',\n methodName: 'messages.list',\n description: 'List all messages',\n paramsSchema: ListMessagesParams,\n },\n {\n name: 'get_message',\n methodName: 'messages.get',\n description: 'Get a message by ID',\n paramsSchema: GetMessageParams,\n },\n {\n name: 'get_attachment',\n methodName: 'attachments.get',\n description: 'Get an attachment by ID',\n paramsSchema: GetAttachmentParams,\n },\n {\n name: 'send_message',\n methodName: 'messages.send',\n description: 'Send a message',\n paramsSchema: SendMessageParams,\n },\n {\n name: 'reply_to_message',\n methodName: 'messages.reply',\n description: 'Reply to a message',\n paramsSchema: ReplyToMessageParams,\n },\n]\n"],"mappings":";;;;;;;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AO,MAAM,OAAO,SAAS,EAAE,KAAK,QAAQ,IAAI;AAAA,EACpD;AACJ;;;AD7BO,IAAM,mBAAN,cAA+B,QAAmB;AAAA,EACrD,YAAY,QAA0B;AAClC,UAAM,MAAM;AAAA,EAChB;AAAA,EAEU,UAAU,MAAuB;AACvC,WAAO;AAAA,MACH,aAAa,KAAK;AAAA,MAClB,YAAY,KAAK;AAAA,MACjB,SAAS,CAAC,SAAS,KAAK,WAAW,KAAK,YAAY,IAAI;AAAA,IAC5D;AAAA,EACJ;AAAA,EAEO,WAAW;AACd,WAAO,KAAK;AAAA,EAChB;AACJ;","names":[]}
package/dist/ai-sdk.mjs CHANGED
@@ -1,170 +1,6 @@
1
- var __async = (__this, __arguments, generator) => {
2
- return new Promise((resolve, reject) => {
3
- var fulfilled = (value) => {
4
- try {
5
- step(generator.next(value));
6
- } catch (e) {
7
- reject(e);
8
- }
9
- };
10
- var rejected = (value) => {
11
- try {
12
- step(generator.throw(value));
13
- } catch (e) {
14
- reject(e);
15
- }
16
- };
17
- var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
18
- step((generator = generator.apply(__this, __arguments)).next());
19
- });
20
- };
21
-
22
- // src/toolkit.ts
23
- import { AgentMailClient } from "agentmail";
24
-
25
- // src/schemas.ts
26
- import { z } from "zod";
27
- var ListItemsParams = z.object({
28
- limit: z.number().optional().describe("The maximum number of items to return"),
29
- last_key: z.string().optional().describe("The last key to use for pagination")
30
- });
31
- var GetInboxParams = z.object({
32
- inbox_id: z.string().describe("The ID of the inbox to get")
33
- });
34
- var CreateInboxParams = z.object({
35
- username: z.string().optional().describe("The username of the inbox to create."),
36
- domain: z.string().optional().describe("The domain of the inbox to create."),
37
- display_name: z.string().optional().describe("The display name of the inbox to create.")
38
- });
39
- var ListThreadsParams = ListItemsParams.extend({
40
- inbox_id: z.string().describe("The ID of the inbox to list threads for"),
41
- received: z.boolean().optional().describe("Whether to filter by received threads"),
42
- sent: z.boolean().optional().describe("Whether to filter by sent threads")
43
- });
44
- var GetThreadParams = z.object({
45
- inbox_id: z.string().describe("The ID of the inbox to get the thread for"),
46
- thread_id: z.string().describe("The ID of the thread to get")
47
- });
48
- var ListMessagesParams = ListItemsParams.extend({
49
- inbox_id: z.string().describe("The ID of the inbox to list messages for")
50
- });
51
- var GetMessageParams = z.object({
52
- inbox_id: z.string().describe("The ID of the inbox to get the message for"),
53
- message_id: z.string().describe("The ID of the message to get")
54
- });
55
- var GetAttachmentParams = z.object({
56
- inbox_id: z.string().describe("The ID of the inbox to get the attachment for"),
57
- message_id: z.string().describe("The ID of the message to get the attachment for"),
58
- attachment_id: z.string().describe("The ID of the attachment to get")
59
- });
60
- var SendMessageParams = z.object({
61
- inbox_id: z.string().describe("The ID of the inbox to send the message from"),
62
- to: z.array(z.string()).describe("The list of recipients"),
63
- cc: z.array(z.string()).optional().describe("The list of CC recipients"),
64
- bcc: z.array(z.string()).optional().describe("The list of BCC recipients"),
65
- subject: z.string().optional().describe("The subject of the message"),
66
- text: z.string().optional().describe("The plain text body of the message"),
67
- html: z.string().optional().describe("The HTML body of the message")
68
- });
69
- var ReplyToMessageParams = z.object({
70
- inbox_id: z.string().describe("The inboc ID of the inbox to reply to the message from"),
71
- message_id: z.string().describe("The message ID of the message you wish to reply to"),
72
- text: z.string().optional().describe("The plain text body of the reply"),
73
- html: z.string().optional().describe("The HTML body of the reply")
74
- });
75
-
76
- // src/tools.ts
77
- var tools = [
78
- {
79
- name: "list_inboxes",
80
- methodName: "inboxes.list",
81
- description: "List all inboxes",
82
- paramsSchema: ListItemsParams
83
- },
84
- {
85
- name: "get_inbox",
86
- methodName: "inboxes.get",
87
- description: "Get an inbox by ID",
88
- paramsSchema: GetInboxParams
89
- },
90
- {
91
- name: "create_inbox",
92
- methodName: "inboxes.create",
93
- description: "Create a new inbox",
94
- paramsSchema: CreateInboxParams
95
- },
96
- {
97
- name: "list_threads",
98
- methodName: "threads.list",
99
- description: "List all threads",
100
- paramsSchema: ListThreadsParams
101
- },
102
- {
103
- name: "get_thread",
104
- methodName: "threads.get",
105
- description: "Get a thread by ID",
106
- paramsSchema: GetThreadParams
107
- },
108
- {
109
- name: "list_messages",
110
- methodName: "messages.list",
111
- description: "List all messages",
112
- paramsSchema: ListMessagesParams
113
- },
114
- {
115
- name: "get_message",
116
- methodName: "messages.get",
117
- description: "Get a message by ID",
118
- paramsSchema: GetMessageParams
119
- },
120
- {
121
- name: "get_attachment",
122
- methodName: "attachments.get",
123
- description: "Get an attachment by ID",
124
- paramsSchema: GetAttachmentParams
125
- },
126
- {
127
- name: "send_message",
128
- methodName: "messages.send",
129
- description: "Send a message",
130
- paramsSchema: SendMessageParams
131
- },
132
- {
133
- name: "reply_to_message",
134
- methodName: "messages.reply",
135
- description: "Reply to a message",
136
- paramsSchema: ReplyToMessageParams
137
- }
138
- ];
139
-
140
- // src/toolkit.ts
141
- var Toolkit = class {
142
- constructor(client) {
143
- this.client = client;
144
- this.tools = {};
145
- if (!this.client) this.client = new AgentMailClient();
146
- this.tools = tools.reduce(
147
- (acc, tool) => {
148
- acc[tool.name] = this.buildTool(tool);
149
- return acc;
150
- },
151
- {}
152
- );
153
- }
154
- getTools() {
155
- return this.tools;
156
- }
157
- callMethod(methodName, args) {
158
- return __async(this, null, function* () {
159
- const parts = methodName.split(".");
160
- const methodKey = parts.pop();
161
- if (!methodKey) throw new Error("Method name empty");
162
- let parent = this.client;
163
- for (const part of parts) parent = parent[part];
164
- return yield parent[methodKey].call(parent, args);
165
- });
166
- }
167
- };
1
+ import {
2
+ Toolkit
3
+ } from "./chunk-UF44LGSE.mjs";
168
4
 
169
5
  // src/ai-sdk.ts
170
6
  var AgentMailToolkit = class extends Toolkit {
@@ -178,6 +14,9 @@ var AgentMailToolkit = class extends Toolkit {
178
14
  execute: (args) => this.callMethod(tool.methodName, args)
179
15
  };
180
16
  }
17
+ getTools() {
18
+ return this.tools;
19
+ }
181
20
  };
182
21
  export {
183
22
  AgentMailToolkit
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/toolkit.ts","../src/schemas.ts","../src/tools.ts","../src/ai-sdk.ts"],"sourcesContent":["import { AgentMailClient } from 'agentmail'\nimport { type Tool, tools } from './tools'\n\nexport abstract class Toolkit<T> {\n private readonly tools: Record<string, T> = {}\n\n constructor(private readonly client?: AgentMailClient) {\n if (!this.client) this.client = new AgentMailClient()\n\n this.tools = tools.reduce(\n (acc, tool) => {\n acc[tool.name] = this.buildTool(tool)\n return acc\n },\n {} as Record<string, T>\n )\n }\n\n protected abstract buildTool(tool: Tool): T\n\n public getTools() {\n return this.tools\n }\n\n public async callMethod(methodName: string, args: unknown) {\n const parts = methodName.split('.')\n const methodKey = parts.pop()\n\n if (!methodKey) throw new Error('Method name empty')\n\n let parent: any = this.client\n for (const part of parts) parent = parent[part]\n\n return await parent[methodKey].call(parent, args)\n }\n}\n","import { z } from 'zod'\n\nexport const ListItemsParams = z.object({\n limit: z.number().optional().describe('The maximum number of items to return'),\n last_key: z.string().optional().describe('The last key to use for pagination'),\n})\n\nexport const GetInboxParams = z.object({\n inbox_id: z.string().describe('The ID of the inbox to get'),\n})\n\nexport const CreateInboxParams = z.object({\n username: z.string().optional().describe('The username of the inbox to create.'),\n domain: z.string().optional().describe('The domain of the inbox to create.'),\n display_name: z.string().optional().describe('The display name of the inbox to create.'),\n})\n\nexport const ListThreadsParams = ListItemsParams.extend({\n inbox_id: z.string().describe('The ID of the inbox to list threads for'),\n received: z.boolean().optional().describe('Whether to filter by received threads'),\n sent: z.boolean().optional().describe('Whether to filter by sent threads'),\n})\n\nexport const GetThreadParams = z.object({\n inbox_id: z.string().describe('The ID of the inbox to get the thread for'),\n thread_id: z.string().describe('The ID of the thread to get'),\n})\n\nexport const ListMessagesParams = ListItemsParams.extend({\n inbox_id: z.string().describe('The ID of the inbox to list messages for'),\n})\n\nexport const GetMessageParams = z.object({\n inbox_id: z.string().describe('The ID of the inbox to get the message for'),\n message_id: z.string().describe('The ID of the message to get'),\n})\n\nexport const GetAttachmentParams = z.object({\n inbox_id: z.string().describe('The ID of the inbox to get the attachment for'),\n message_id: z.string().describe('The ID of the message to get the attachment for'),\n attachment_id: z.string().describe('The ID of the attachment to get'),\n})\n\nexport const SendMessageParams = z.object({\n inbox_id: z.string().describe('The ID of the inbox to send the message from'),\n to: z.array(z.string()).describe('The list of recipients'),\n cc: z.array(z.string()).optional().describe('The list of CC recipients'),\n bcc: z.array(z.string()).optional().describe('The list of BCC recipients'),\n subject: z.string().optional().describe('The subject of the message'),\n text: z.string().optional().describe('The plain text body of the message'),\n html: z.string().optional().describe('The HTML body of the message'),\n})\n\nexport const ReplyToMessageParams = z.object({\n inbox_id: z.string().describe('The inboc ID of the inbox to reply to the message from'),\n message_id: z.string().describe('The message ID of the message you wish to reply to'),\n text: z.string().optional().describe('The plain text body of the reply'),\n html: z.string().optional().describe('The HTML body of the reply'),\n})\n","import { z } from 'zod'\n\nimport {\n ListItemsParams,\n GetInboxParams,\n CreateInboxParams,\n ListThreadsParams,\n GetThreadParams,\n ListMessagesParams,\n GetMessageParams,\n GetAttachmentParams,\n SendMessageParams,\n ReplyToMessageParams,\n} from './schemas'\n\nexport type Tool = {\n name: string\n methodName: string\n description: string\n paramsSchema: z.ZodObject<any>\n}\n\nexport const tools: Tool[] = [\n {\n name: 'list_inboxes',\n methodName: 'inboxes.list',\n description: 'List all inboxes',\n paramsSchema: ListItemsParams,\n },\n {\n name: 'get_inbox',\n methodName: 'inboxes.get',\n description: 'Get an inbox by ID',\n paramsSchema: GetInboxParams,\n },\n {\n name: 'create_inbox',\n methodName: 'inboxes.create',\n description: 'Create a new inbox',\n paramsSchema: CreateInboxParams,\n },\n {\n name: 'list_threads',\n methodName: 'threads.list',\n description: 'List all threads',\n paramsSchema: ListThreadsParams,\n },\n {\n name: 'get_thread',\n methodName: 'threads.get',\n description: 'Get a thread by ID',\n paramsSchema: GetThreadParams,\n },\n {\n name: 'list_messages',\n methodName: 'messages.list',\n description: 'List all messages',\n paramsSchema: ListMessagesParams,\n },\n {\n name: 'get_message',\n methodName: 'messages.get',\n description: 'Get a message by ID',\n paramsSchema: GetMessageParams,\n },\n {\n name: 'get_attachment',\n methodName: 'attachments.get',\n description: 'Get an attachment by ID',\n paramsSchema: GetAttachmentParams,\n },\n {\n name: 'send_message',\n methodName: 'messages.send',\n description: 'Send a message',\n paramsSchema: SendMessageParams,\n },\n {\n name: 'reply_to_message',\n methodName: 'messages.reply',\n description: 'Reply to a message',\n paramsSchema: ReplyToMessageParams,\n },\n]\n","import { type Tool as AiSdkTool } from 'ai'\nimport { AgentMailClient } from 'agentmail'\n\nimport { Toolkit } from './toolkit'\nimport { type Tool } from './tools'\n\nexport class AgentMailToolkit extends Toolkit<AiSdkTool> {\n constructor(client?: AgentMailClient) {\n super(client)\n }\n\n protected buildTool(tool: Tool): AiSdkTool {\n return {\n description: tool.description,\n parameters: tool.paramsSchema,\n execute: (args) => this.callMethod(tool.methodName, args),\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,uBAAuB;;;ACAhC,SAAS,SAAS;AAEX,IAAM,kBAAkB,EAAE,OAAO;AAAA,EACpC,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,uCAAuC;AAAA,EAC7E,UAAU,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,oCAAoC;AACjF,CAAC;AAEM,IAAM,iBAAiB,EAAE,OAAO;AAAA,EACnC,UAAU,EAAE,OAAO,EAAE,SAAS,4BAA4B;AAC9D,CAAC;AAEM,IAAM,oBAAoB,EAAE,OAAO;AAAA,EACtC,UAAU,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,sCAAsC;AAAA,EAC/E,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,oCAAoC;AAAA,EAC3E,cAAc,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,0CAA0C;AAC3F,CAAC;AAEM,IAAM,oBAAoB,gBAAgB,OAAO;AAAA,EACpD,UAAU,EAAE,OAAO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AA,EAClB;AACJ;;;AFhFO,IAAe,UAAf,MAA0B;AAAA,EAG7B,YAA6B,QAA0B;AAA1B;AAF7B,SAAiB,QAA2B,CAAC;AAGzC,QAAI,CAAC,KAAK,OAAQ,MAAK,SAAS,IAAI,gBAAgB;AAEpD,SAAK,QAAQ,MAAM;AAAA,MACf,CAAC,KAAK,SAAS;AACX,YAAI,KAAK,IAAI,IAAI,KAAK,UAAU,IAAI;AACpC,eAAO;AAAA,MACX;AAAA,MACA,CAAC;AAAA,IACL;AAAA,EACJ;AAAA,EAIO,WAAW;AACd,WAAO,KAAK;AAAA,EAChB;AAAA,EAEa,WAAW,YAAoB,MAAe;AAAA;AACvD,YAAM,QAAQ,WAAW,MAAM,GAAG;AAClC,YAAM,YAAY,MAAM,IAAI;AAE5B,UAAI,CAAC,UAAW,OAAM,IAAI,MAAM,mBAAmB;AAEnD,UAAI,SAAc,KAAK;AACvB,iBAAW,QAAQ,MAAO,UAAS,OAAO,IAAI;AAE9C,aAAO,MAAM,OAAO,SAAS,EAAE,KAAK,QAAQ,IAAI;AAAA,IACpD;AAAA;AACJ;;;AG7BO,IAAM,mBAAN,cAA+B,QAAmB;AAAA,EACrD,YAAY,QAA0B;AAClC,UAAM,MAAM;AAAA,EAChB;AAAA,EAEU,UAAU,MAAuB;AACvC,WAAO;AAAA,MACH,aAAa,KAAK;AAAA,MAClB,YAAY,KAAK;AAAA,MACjB,SAAS,CAAC,SAAS,KAAK,WAAW,KAAK,YAAY,IAAI;AAAA,IAC5D;AAAA,EACJ;AACJ;","names":[]}
1
+ {"version":3,"sources":["../src/ai-sdk.ts"],"sourcesContent":["import { type Tool as AiSdkTool } from 'ai'\nimport { AgentMailClient } from 'agentmail'\n\nimport { Toolkit } from './toolkit'\nimport { type Tool } from './tools'\n\nexport class AgentMailToolkit extends Toolkit<AiSdkTool> {\n constructor(client?: AgentMailClient) {\n super(client)\n }\n\n protected buildTool(tool: Tool): AiSdkTool {\n return {\n description: tool.description,\n parameters: tool.paramsSchema,\n execute: (args) => this.callMethod(tool.methodName, args),\n }\n }\n\n public getTools() {\n return this.tools\n }\n}\n"],"mappings":";;;;;AAMO,IAAM,mBAAN,cAA+B,QAAmB;AAAA,EACrD,YAAY,QAA0B;AAClC,UAAM,MAAM;AAAA,EAChB;AAAA,EAEU,UAAU,MAAuB;AACvC,WAAO;AAAA,MACH,aAAa,KAAK;AAAA,MAClB,YAAY,KAAK;AAAA,MACjB,SAAS,CAAC,SAAS,KAAK,WAAW,KAAK,YAAY,IAAI;AAAA,IAC5D;AAAA,EACJ;AAAA,EAEO,WAAW;AACd,WAAO,KAAK;AAAA,EAChB;AACJ;","names":[]}
@@ -0,0 +1,149 @@
1
+ // src/toolkit.ts
2
+ import { AgentMailClient } from "agentmail";
3
+
4
+ // src/schemas.ts
5
+ import { z } from "zod";
6
+ var ListItemsParams = z.object({
7
+ limit: z.number().optional().describe("The maximum number of items to return"),
8
+ last_key: z.string().optional().describe("The last key to use for pagination")
9
+ });
10
+ var GetInboxParams = z.object({
11
+ inbox_id: z.string().describe("The ID of the inbox to get")
12
+ });
13
+ var CreateInboxParams = z.object({
14
+ username: z.string().optional().describe("The username of the inbox to create."),
15
+ domain: z.string().optional().describe("The domain of the inbox to create."),
16
+ display_name: z.string().optional().describe("The display name of the inbox to create.")
17
+ });
18
+ var ListThreadsParams = ListItemsParams.extend({
19
+ inbox_id: z.string().describe("The ID of the inbox to list threads for"),
20
+ received: z.boolean().optional().describe("Whether to filter by received threads"),
21
+ sent: z.boolean().optional().describe("Whether to filter by sent threads")
22
+ });
23
+ var GetThreadParams = z.object({
24
+ inbox_id: z.string().describe("The ID of the inbox to get the thread for"),
25
+ thread_id: z.string().describe("The ID of the thread to get")
26
+ });
27
+ var ListMessagesParams = ListItemsParams.extend({
28
+ inbox_id: z.string().describe("The ID of the inbox to list messages for")
29
+ });
30
+ var GetMessageParams = z.object({
31
+ inbox_id: z.string().describe("The ID of the inbox to get the message for"),
32
+ message_id: z.string().describe("The ID of the message to get")
33
+ });
34
+ var GetAttachmentParams = z.object({
35
+ inbox_id: z.string().describe("The ID of the inbox to get the attachment for"),
36
+ message_id: z.string().describe("The ID of the message to get the attachment for"),
37
+ attachment_id: z.string().describe("The ID of the attachment to get")
38
+ });
39
+ var SendMessageParams = z.object({
40
+ inbox_id: z.string().describe("The ID of the inbox to send the message from"),
41
+ to: z.array(z.string()).describe("The list of recipients"),
42
+ cc: z.array(z.string()).optional().describe("The list of CC recipients"),
43
+ bcc: z.array(z.string()).optional().describe("The list of BCC recipients"),
44
+ subject: z.string().optional().describe("The subject of the message"),
45
+ text: z.string().optional().describe("The plain text body of the message"),
46
+ html: z.string().optional().describe("The HTML body of the message")
47
+ });
48
+ var ReplyToMessageParams = z.object({
49
+ inbox_id: z.string().describe("The inboc ID of the inbox to reply to the message from"),
50
+ message_id: z.string().describe("The message ID of the message you wish to reply to"),
51
+ text: z.string().optional().describe("The plain text body of the reply"),
52
+ html: z.string().optional().describe("The HTML body of the reply")
53
+ });
54
+
55
+ // src/tools.ts
56
+ var tools = [
57
+ {
58
+ name: "list_inboxes",
59
+ methodName: "inboxes.list",
60
+ description: "List all inboxes",
61
+ paramsSchema: ListItemsParams
62
+ },
63
+ {
64
+ name: "get_inbox",
65
+ methodName: "inboxes.get",
66
+ description: "Get an inbox by ID",
67
+ paramsSchema: GetInboxParams
68
+ },
69
+ {
70
+ name: "create_inbox",
71
+ methodName: "inboxes.create",
72
+ description: "Create a new inbox",
73
+ paramsSchema: CreateInboxParams
74
+ },
75
+ {
76
+ name: "list_threads",
77
+ methodName: "threads.list",
78
+ description: "List all threads",
79
+ paramsSchema: ListThreadsParams
80
+ },
81
+ {
82
+ name: "get_thread",
83
+ methodName: "threads.get",
84
+ description: "Get a thread by ID",
85
+ paramsSchema: GetThreadParams
86
+ },
87
+ {
88
+ name: "list_messages",
89
+ methodName: "messages.list",
90
+ description: "List all messages",
91
+ paramsSchema: ListMessagesParams
92
+ },
93
+ {
94
+ name: "get_message",
95
+ methodName: "messages.get",
96
+ description: "Get a message by ID",
97
+ paramsSchema: GetMessageParams
98
+ },
99
+ {
100
+ name: "get_attachment",
101
+ methodName: "attachments.get",
102
+ description: "Get an attachment by ID",
103
+ paramsSchema: GetAttachmentParams
104
+ },
105
+ {
106
+ name: "send_message",
107
+ methodName: "messages.send",
108
+ description: "Send a message",
109
+ paramsSchema: SendMessageParams
110
+ },
111
+ {
112
+ name: "reply_to_message",
113
+ methodName: "messages.reply",
114
+ description: "Reply to a message",
115
+ paramsSchema: ReplyToMessageParams
116
+ }
117
+ ];
118
+
119
+ // src/toolkit.ts
120
+ var Toolkit = class {
121
+ constructor(client) {
122
+ this.client = client;
123
+ if (!this.client) this.client = new AgentMailClient();
124
+ this.tools = tools.reduce(
125
+ (acc, tool) => {
126
+ acc[tool.name] = this.buildTool(tool);
127
+ return acc;
128
+ },
129
+ {}
130
+ );
131
+ }
132
+ tools = {};
133
+ // public getTools() {
134
+ // return this.tools
135
+ // }
136
+ async callMethod(methodName, args) {
137
+ const parts = methodName.split(".");
138
+ const methodKey = parts.pop();
139
+ if (!methodKey) throw new Error("Method name empty");
140
+ let parent = this.client;
141
+ for (const part of parts) parent = parent[part];
142
+ return await parent[methodKey].call(parent, args);
143
+ }
144
+ };
145
+
146
+ export {
147
+ Toolkit
148
+ };
149
+ //# sourceMappingURL=chunk-UF44LGSE.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/toolkit.ts","../src/schemas.ts","../src/tools.ts"],"sourcesContent":["import { AgentMailClient } from 'agentmail'\nimport { type Tool, tools } from './tools'\n\nexport abstract class Toolkit<T> {\n protected readonly tools: Record<string, T> = {}\n\n constructor(private readonly client?: AgentMailClient) {\n if (!this.client) this.client = new AgentMailClient()\n\n this.tools = tools.reduce(\n (acc, tool) => {\n acc[tool.name] = this.buildTool(tool)\n return acc\n },\n {} as Record<string, T>\n )\n }\n\n protected abstract buildTool(tool: Tool): T\n\n // public getTools() {\n // return this.tools\n // }\n\n public async callMethod(methodName: string, args: unknown) {\n const parts = methodName.split('.')\n const methodKey = parts.pop()\n\n if (!methodKey) throw new Error('Method name empty')\n\n let parent: any = this.client\n for (const part of parts) parent = parent[part]\n\n return await parent[methodKey].call(parent, args)\n }\n}\n","import { z } from 'zod'\n\nexport const ListItemsParams = z.object({\n limit: z.number().optional().describe('The maximum number of items to return'),\n last_key: z.string().optional().describe('The last key to use for pagination'),\n})\n\nexport const GetInboxParams = z.object({\n inbox_id: z.string().describe('The ID of the inbox to get'),\n})\n\nexport const CreateInboxParams = z.object({\n username: z.string().optional().describe('The username of the inbox to create.'),\n domain: z.string().optional().describe('The domain of the inbox to create.'),\n display_name: z.string().optional().describe('The display name of the inbox to create.'),\n})\n\nexport const ListThreadsParams = ListItemsParams.extend({\n inbox_id: z.string().describe('The ID of the inbox to list threads for'),\n received: z.boolean().optional().describe('Whether to filter by received threads'),\n sent: z.boolean().optional().describe('Whether to filter by sent threads'),\n})\n\nexport const GetThreadParams = z.object({\n inbox_id: z.string().describe('The ID of the inbox to get the thread for'),\n thread_id: z.string().describe('The ID of the thread to get'),\n})\n\nexport const ListMessagesParams = ListItemsParams.extend({\n inbox_id: z.string().describe('The ID of the inbox to list messages for'),\n})\n\nexport const GetMessageParams = z.object({\n inbox_id: z.string().describe('The ID of the inbox to get the message for'),\n message_id: z.string().describe('The ID of the message to get'),\n})\n\nexport const GetAttachmentParams = z.object({\n inbox_id: z.string().describe('The ID of the inbox to get the attachment for'),\n message_id: z.string().describe('The ID of the message to get the attachment for'),\n attachment_id: z.string().describe('The ID of the attachment to get'),\n})\n\nexport const SendMessageParams = z.object({\n inbox_id: z.string().describe('The ID of the inbox to send the message from'),\n to: z.array(z.string()).describe('The list of recipients'),\n cc: z.array(z.string()).optional().describe('The list of CC recipients'),\n bcc: z.array(z.string()).optional().describe('The list of BCC recipients'),\n subject: z.string().optional().describe('The subject of the message'),\n text: z.string().optional().describe('The plain text body of the message'),\n html: z.string().optional().describe('The HTML body of the message'),\n})\n\nexport const ReplyToMessageParams = z.object({\n inbox_id: z.string().describe('The inboc ID of the inbox to reply to the message from'),\n message_id: z.string().describe('The message ID of the message you wish to reply to'),\n text: z.string().optional().describe('The plain text body of the reply'),\n html: z.string().optional().describe('The HTML body of the reply'),\n})\n","import { z } from 'zod'\n\nimport {\n ListItemsParams,\n GetInboxParams,\n CreateInboxParams,\n ListThreadsParams,\n GetThreadParams,\n ListMessagesParams,\n GetMessageParams,\n GetAttachmentParams,\n SendMessageParams,\n ReplyToMessageParams,\n} from './schemas'\n\nexport type Tool = {\n name: string\n methodName: string\n description: string\n paramsSchema: z.ZodObject<any>\n}\n\nexport const tools: Tool[] = [\n {\n name: 'list_inboxes',\n methodName: 'inboxes.list',\n description: 'List all inboxes',\n paramsSchema: ListItemsParams,\n },\n {\n name: 'get_inbox',\n methodName: 'inboxes.get',\n description: 'Get an inbox by ID',\n paramsSchema: GetInboxParams,\n },\n {\n name: 'create_inbox',\n methodName: 'inboxes.create',\n description: 'Create a new inbox',\n paramsSchema: CreateInboxParams,\n },\n {\n name: 'list_threads',\n methodName: 'threads.list',\n description: 'List all threads',\n paramsSchema: ListThreadsParams,\n },\n {\n name: 'get_thread',\n methodName: 'threads.get',\n description: 'Get a thread by ID',\n paramsSchema: GetThreadParams,\n },\n {\n name: 'list_messages',\n methodName: 'messages.list',\n description: 'List all messages',\n paramsSchema: ListMessagesParams,\n },\n {\n name: 'get_message',\n methodName: 'messages.get',\n description: 'Get a message by ID',\n paramsSchema: GetMessageParams,\n },\n {\n name: 'get_attachment',\n methodName: 'attachments.get',\n description: 'Get an attachment by ID',\n paramsSchema: GetAttachmentParams,\n },\n {\n name: 'send_message',\n methodName: 'messages.send',\n description: 'Send a message',\n paramsSchema: SendMessageParams,\n },\n {\n name: 'reply_to_message',\n methodName: 'messages.reply',\n description: 'Reply to a message',\n paramsSchema: ReplyToMessageParams,\n },\n]\n"],"mappings":";AAAA,SAAS,uBAAuB;;;ACAhC,SAAS,SAAS;AAEX,IAAM,kBAAkB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async = (__this, __arguments, generator) => {
2
+ return new Promise((resolve, reject) => {
3
+ var fulfilled = (value) => {
4
+ try {
5
+ step(generator.next(value))
6
+ } catch (e) {
7
+ reject(e)
8
+ }
9
+ }
10
+ var rejected = (value) => {
11
+ try {
12
+ step(generator.throw(value))
13
+ } catch (e) {
14
+ reject(e)
15
+ }
16
+ }
17
+ var step = (x) => (x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected))
18
+ step((generator = generator.apply(__this, __arguments)).next())
19
+ })
20
+ }
21
+
22
+ // src/toolkit.ts
23
+ import { AgentMailClient } from 'agentmail'
24
+
25
+ // src/schemas.ts
26
+ import { z } from 'zod'
27
+ var ListItemsParams = z.object({
28
+ limit: z.number().optional().describe('The maximum number of items to return'),
29
+ last_key: z.string().optional().describe('The last key to use for pagination'),
30
+ })
31
+ var GetInboxParams = z.object({
32
+ inbox_id: z.string().describe('The ID of the inbox to get'),
33
+ })
34
+ var CreateInboxParams = z.object({
35
+ username: z.string().optional().describe('The username of the inbox to create.'),
36
+ domain: z.string().optional().describe('The domain of the inbox to create.'),
37
+ display_name: z.string().optional().describe('The display name of the inbox to create.'),
38
+ })
39
+ var ListThreadsParams = ListItemsParams.extend({
40
+ inbox_id: z.string().describe('The ID of the inbox to list threads for'),
41
+ received: z.boolean().optional().describe('Whether to filter by received threads'),
42
+ sent: z.boolean().optional().describe('Whether to filter by sent threads'),
43
+ })
44
+ var GetThreadParams = z.object({
45
+ inbox_id: z.string().describe('The ID of the inbox to get the thread for'),
46
+ thread_id: z.string().describe('The ID of the thread to get'),
47
+ })
48
+ var ListMessagesParams = ListItemsParams.extend({
49
+ inbox_id: z.string().describe('The ID of the inbox to list messages for'),
50
+ })
51
+ var GetMessageParams = z.object({
52
+ inbox_id: z.string().describe('The ID of the inbox to get the message for'),
53
+ message_id: z.string().describe('The ID of the message to get'),
54
+ })
55
+ var GetAttachmentParams = z.object({
56
+ inbox_id: z.string().describe('The ID of the inbox to get the attachment for'),
57
+ message_id: z.string().describe('The ID of the message to get the attachment for'),
58
+ attachment_id: z.string().describe('The ID of the attachment to get'),
59
+ })
60
+ var SendMessageParams = z.object({
61
+ inbox_id: z.string().describe('The ID of the inbox to send the message from'),
62
+ to: z.array(z.string()).describe('The list of recipients'),
63
+ cc: z.array(z.string()).optional().describe('The list of CC recipients'),
64
+ bcc: z.array(z.string()).optional().describe('The list of BCC recipients'),
65
+ subject: z.string().optional().describe('The subject of the message'),
66
+ text: z.string().optional().describe('The plain text body of the message'),
67
+ html: z.string().optional().describe('The HTML body of the message'),
68
+ })
69
+ var ReplyToMessageParams = z.object({
70
+ inbox_id: z.string().describe('The inboc ID of the inbox to reply to the message from'),
71
+ message_id: z.string().describe('The message ID of the message you wish to reply to'),
72
+ text: z.string().optional().describe('The plain text body of the reply'),
73
+ html: z.string().optional().describe('The HTML body of the reply'),
74
+ })
75
+
76
+ // src/tools.ts
77
+ var tools = [
78
+ {
79
+ name: 'list_inboxes',
80
+ methodName: 'inboxes.list',
81
+ description: 'List all inboxes',
82
+ paramsSchema: ListItemsParams,
83
+ },
84
+ {
85
+ name: 'get_inbox',
86
+ methodName: 'inboxes.get',
87
+ description: 'Get an inbox by ID',
88
+ paramsSchema: GetInboxParams,
89
+ },
90
+ {
91
+ name: 'create_inbox',
92
+ methodName: 'inboxes.create',
93
+ description: 'Create a new inbox',
94
+ paramsSchema: CreateInboxParams,
95
+ },
96
+ {
97
+ name: 'list_threads',
98
+ methodName: 'threads.list',
99
+ description: 'List all threads',
100
+ paramsSchema: ListThreadsParams,
101
+ },
102
+ {
103
+ name: 'get_thread',
104
+ methodName: 'threads.get',
105
+ description: 'Get a thread by ID',
106
+ paramsSchema: GetThreadParams,
107
+ },
108
+ {
109
+ name: 'list_messages',
110
+ methodName: 'messages.list',
111
+ description: 'List all messages',
112
+ paramsSchema: ListMessagesParams,
113
+ },
114
+ {
115
+ name: 'get_message',
116
+ methodName: 'messages.get',
117
+ description: 'Get a message by ID',
118
+ paramsSchema: GetMessageParams,
119
+ },
120
+ {
121
+ name: 'get_attachment',
122
+ methodName: 'attachments.get',
123
+ description: 'Get an attachment by ID',
124
+ paramsSchema: GetAttachmentParams,
125
+ },
126
+ {
127
+ name: 'send_message',
128
+ methodName: 'messages.send',
129
+ description: 'Send a message',
130
+ paramsSchema: SendMessageParams,
131
+ },
132
+ {
133
+ name: 'reply_to_message',
134
+ methodName: 'messages.reply',
135
+ description: 'Reply to a message',
136
+ paramsSchema: ReplyToMessageParams,
137
+ },
138
+ ]
139
+
140
+ // src/toolkit.ts
141
+ var Toolkit = class {
142
+ constructor(client) {
143
+ this.client = client
144
+ this.tools = {}
145
+ if (!this.client) this.client = new AgentMailClient()
146
+ this.tools = tools.reduce((acc, tool) => {
147
+ acc[tool.name] = this.buildTool(tool)
148
+ return acc
149
+ }, {})
150
+ }
151
+ // public getTools() {
152
+ // return this.tools
153
+ // }
154
+ callMethod(methodName, args) {
155
+ return __async(this, null, function* () {
156
+ const parts = methodName.split('.')
157
+ const methodKey = parts.pop()
158
+ if (!methodKey) throw new Error('Method name empty')
159
+ let parent = this.client
160
+ for (const part of parts) parent = parent[part]
161
+ return yield parent[methodKey].call(parent, args)
162
+ })
163
+ }
164
+ }
165
+
166
+ export { __async, Toolkit }
167
+ //# sourceMappingURL=chunk-ZPF3SOVL.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/toolkit.ts","../src/schemas.ts","../src/tools.ts"],"sourcesContent":["import { AgentMailClient } from 'agentmail'\nimport { type Tool, tools } from './tools'\n\nexport abstract class Toolkit<T> {\n protected readonly tools: Record<string, T> = {}\n\n constructor(private readonly client?: AgentMailClient) {\n if (!this.client) this.client = new AgentMailClient()\n\n this.tools = tools.reduce(\n (acc, tool) => {\n acc[tool.name] = this.buildTool(tool)\n return acc\n },\n {} as Record<string, T>\n )\n }\n\n protected abstract buildTool(tool: Tool): T\n\n // public getTools() {\n // return this.tools\n // }\n\n public async callMethod(methodName: string, args: unknown) {\n const parts = methodName.split('.')\n const methodKey = parts.pop()\n\n if (!methodKey) throw new Error('Method name empty')\n\n let parent: any = this.client\n for (const part of parts) parent = parent[part]\n\n return await parent[methodKey].call(parent, args)\n }\n}\n","import { z } from 'zod'\n\nexport const ListItemsParams = z.object({\n limit: z.number().optional().describe('The maximum number of items to return'),\n last_key: z.string().optional().describe('The last key to use for pagination'),\n})\n\nexport const GetInboxParams = z.object({\n inbox_id: z.string().describe('The ID of the inbox to get'),\n})\n\nexport const CreateInboxParams = z.object({\n username: z.string().optional().describe('The username of the inbox to create.'),\n domain: z.string().optional().describe('The domain of the inbox to create.'),\n display_name: z.string().optional().describe('The display name of the inbox to create.'),\n})\n\nexport const ListThreadsParams = ListItemsParams.extend({\n inbox_id: z.string().describe('The ID of the inbox to list threads for'),\n received: z.boolean().optional().describe('Whether to filter by received threads'),\n sent: z.boolean().optional().describe('Whether to filter by sent threads'),\n})\n\nexport const GetThreadParams = z.object({\n inbox_id: z.string().describe('The ID of the inbox to get the thread for'),\n thread_id: z.string().describe('The ID of the thread to get'),\n})\n\nexport const ListMessagesParams = ListItemsParams.extend({\n inbox_id: z.string().describe('The ID of the inbox to list messages for'),\n})\n\nexport const GetMessageParams = z.object({\n inbox_id: z.string().describe('The ID of the inbox to get the message for'),\n message_id: z.string().describe('The ID of the message to get'),\n})\n\nexport const GetAttachmentParams = z.object({\n inbox_id: z.string().describe('The ID of the inbox to get the attachment for'),\n message_id: z.string().describe('The ID of the message to get the attachment for'),\n attachment_id: z.string().describe('The ID of the attachment to get'),\n})\n\nexport const SendMessageParams = z.object({\n inbox_id: z.string().describe('The ID of the inbox to send the message from'),\n to: z.array(z.string()).describe('The list of recipients'),\n cc: z.array(z.string()).optional().describe('The list of CC recipients'),\n bcc: z.array(z.string()).optional().describe('The list of BCC recipients'),\n subject: z.string().optional().describe('The subject of the message'),\n text: z.string().optional().describe('The plain text body of the message'),\n html: z.string().optional().describe('The HTML body of the message'),\n})\n\nexport const ReplyToMessageParams = z.object({\n inbox_id: z.string().describe('The inboc ID of the inbox to reply to the message from'),\n message_id: z.string().describe('The message ID of the message you wish to reply to'),\n text: z.string().optional().describe('The plain text body of the reply'),\n html: z.string().optional().describe('The HTML body of the reply'),\n})\n","import { z } from 'zod'\n\nimport {\n ListItemsParams,\n GetInboxParams,\n CreateInboxParams,\n ListThreadsParams,\n GetThreadParams,\n ListMessagesParams,\n GetMessageParams,\n GetAttachmentParams,\n SendMessageParams,\n ReplyToMessageParams,\n} from './schemas'\n\nexport type Tool = {\n name: string\n methodName: string\n description: string\n paramsSchema: z.ZodObject<any>\n}\n\nexport const tools: Tool[] = [\n {\n name: 'list_inboxes',\n methodName: 'inboxes.list',\n description: 'List all inboxes',\n paramsSchema: ListItemsParams,\n },\n {\n name: 'get_inbox',\n methodName: 'inboxes.get',\n description: 'Get an inbox by ID',\n paramsSchema: GetInboxParams,\n },\n {\n name: 'create_inbox',\n methodName: 'inboxes.create',\n description: 'Create a new inbox',\n paramsSchema: CreateInboxParams,\n },\n {\n name: 'list_threads',\n methodName: 'threads.list',\n description: 'List all threads',\n paramsSchema: ListThreadsParams,\n },\n {\n name: 'get_thread',\n methodName: 'threads.get',\n description: 'Get a thread by ID',\n paramsSchema: GetThreadParams,\n },\n {\n name: 'list_messages',\n methodName: 'messages.list',\n description: 'List all messages',\n paramsSchema: ListMessagesParams,\n },\n {\n name: 'get_message',\n methodName: 'messages.get',\n description: 'Get a message by ID',\n paramsSchema: GetMessageParams,\n },\n {\n name: 'get_attachment',\n methodName: 'attachments.get',\n description: 'Get an attachment by ID',\n paramsSchema: GetAttachmentParams,\n },\n {\n name: 'send_message',\n methodName: 'messages.send',\n description: 'Send a message',\n paramsSchema: SendMessageParams,\n },\n {\n name: 'reply_to_message',\n methodName: 'messages.reply',\n description: 'Reply to a message',\n paramsSchema: ReplyToMessageParams,\n },\n]\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,uBAAuB;;;ACAhC,SAAS,SAAS;AAEX,IAAM,kBAAkB,EAAE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* as zod from 'zod';
2
+ import { StructuredTool } from '@langchain/core/tools';
3
+ import { AgentMailClient } from 'agentmail';
4
+ import { T as Toolkit, a as Tool } from './toolkit-BonhsWAN.mjs';
5
+
6
+ declare class AgentMailToolkit extends Toolkit<StructuredTool> {
7
+ constructor(client?: AgentMailClient);
8
+ protected buildTool(tool: Tool): StructuredTool;
9
+ getTools(): StructuredTool<zod.ZodObject<any, any, any, any, {
10
+ [x: string]: any;
11
+ }>>[];
12
+ }
13
+
14
+ export { AgentMailToolkit };
@@ -0,0 +1,14 @@
1
+ import * as zod from 'zod';
2
+ import { StructuredTool } from '@langchain/core/tools';
3
+ import { AgentMailClient } from 'agentmail';
4
+ import { T as Toolkit, a as Tool } from './toolkit-BonhsWAN.js';
5
+
6
+ declare class AgentMailToolkit extends Toolkit<StructuredTool> {
7
+ constructor(client?: AgentMailClient);
8
+ protected buildTool(tool: Tool): StructuredTool;
9
+ getTools(): StructuredTool<zod.ZodObject<any, any, any, any, {
10
+ [x: string]: any;
11
+ }>>[];
12
+ }
13
+
14
+ export { AgentMailToolkit };
@@ -0,0 +1,199 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/langchain.ts
21
+ var langchain_exports = {};
22
+ __export(langchain_exports, {
23
+ AgentMailToolkit: () => AgentMailToolkit
24
+ });
25
+ module.exports = __toCommonJS(langchain_exports);
26
+ var import_tools2 = require("@langchain/core/tools");
27
+
28
+ // src/toolkit.ts
29
+ var import_agentmail = require("agentmail");
30
+
31
+ // src/schemas.ts
32
+ var import_zod = require("zod");
33
+ var ListItemsParams = import_zod.z.object({
34
+ limit: import_zod.z.number().optional().describe("The maximum number of items to return"),
35
+ last_key: import_zod.z.string().optional().describe("The last key to use for pagination")
36
+ });
37
+ var GetInboxParams = import_zod.z.object({
38
+ inbox_id: import_zod.z.string().describe("The ID of the inbox to get")
39
+ });
40
+ var CreateInboxParams = import_zod.z.object({
41
+ username: import_zod.z.string().optional().describe("The username of the inbox to create."),
42
+ domain: import_zod.z.string().optional().describe("The domain of the inbox to create."),
43
+ display_name: import_zod.z.string().optional().describe("The display name of the inbox to create.")
44
+ });
45
+ var ListThreadsParams = ListItemsParams.extend({
46
+ inbox_id: import_zod.z.string().describe("The ID of the inbox to list threads for"),
47
+ received: import_zod.z.boolean().optional().describe("Whether to filter by received threads"),
48
+ sent: import_zod.z.boolean().optional().describe("Whether to filter by sent threads")
49
+ });
50
+ var GetThreadParams = import_zod.z.object({
51
+ inbox_id: import_zod.z.string().describe("The ID of the inbox to get the thread for"),
52
+ thread_id: import_zod.z.string().describe("The ID of the thread to get")
53
+ });
54
+ var ListMessagesParams = ListItemsParams.extend({
55
+ inbox_id: import_zod.z.string().describe("The ID of the inbox to list messages for")
56
+ });
57
+ var GetMessageParams = import_zod.z.object({
58
+ inbox_id: import_zod.z.string().describe("The ID of the inbox to get the message for"),
59
+ message_id: import_zod.z.string().describe("The ID of the message to get")
60
+ });
61
+ var GetAttachmentParams = import_zod.z.object({
62
+ inbox_id: import_zod.z.string().describe("The ID of the inbox to get the attachment for"),
63
+ message_id: import_zod.z.string().describe("The ID of the message to get the attachment for"),
64
+ attachment_id: import_zod.z.string().describe("The ID of the attachment to get")
65
+ });
66
+ var SendMessageParams = import_zod.z.object({
67
+ inbox_id: import_zod.z.string().describe("The ID of the inbox to send the message from"),
68
+ to: import_zod.z.array(import_zod.z.string()).describe("The list of recipients"),
69
+ cc: import_zod.z.array(import_zod.z.string()).optional().describe("The list of CC recipients"),
70
+ bcc: import_zod.z.array(import_zod.z.string()).optional().describe("The list of BCC recipients"),
71
+ subject: import_zod.z.string().optional().describe("The subject of the message"),
72
+ text: import_zod.z.string().optional().describe("The plain text body of the message"),
73
+ html: import_zod.z.string().optional().describe("The HTML body of the message")
74
+ });
75
+ var ReplyToMessageParams = import_zod.z.object({
76
+ inbox_id: import_zod.z.string().describe("The inboc ID of the inbox to reply to the message from"),
77
+ message_id: import_zod.z.string().describe("The message ID of the message you wish to reply to"),
78
+ text: import_zod.z.string().optional().describe("The plain text body of the reply"),
79
+ html: import_zod.z.string().optional().describe("The HTML body of the reply")
80
+ });
81
+
82
+ // src/tools.ts
83
+ var tools = [
84
+ {
85
+ name: "list_inboxes",
86
+ methodName: "inboxes.list",
87
+ description: "List all inboxes",
88
+ paramsSchema: ListItemsParams
89
+ },
90
+ {
91
+ name: "get_inbox",
92
+ methodName: "inboxes.get",
93
+ description: "Get an inbox by ID",
94
+ paramsSchema: GetInboxParams
95
+ },
96
+ {
97
+ name: "create_inbox",
98
+ methodName: "inboxes.create",
99
+ description: "Create a new inbox",
100
+ paramsSchema: CreateInboxParams
101
+ },
102
+ {
103
+ name: "list_threads",
104
+ methodName: "threads.list",
105
+ description: "List all threads",
106
+ paramsSchema: ListThreadsParams
107
+ },
108
+ {
109
+ name: "get_thread",
110
+ methodName: "threads.get",
111
+ description: "Get a thread by ID",
112
+ paramsSchema: GetThreadParams
113
+ },
114
+ {
115
+ name: "list_messages",
116
+ methodName: "messages.list",
117
+ description: "List all messages",
118
+ paramsSchema: ListMessagesParams
119
+ },
120
+ {
121
+ name: "get_message",
122
+ methodName: "messages.get",
123
+ description: "Get a message by ID",
124
+ paramsSchema: GetMessageParams
125
+ },
126
+ {
127
+ name: "get_attachment",
128
+ methodName: "attachments.get",
129
+ description: "Get an attachment by ID",
130
+ paramsSchema: GetAttachmentParams
131
+ },
132
+ {
133
+ name: "send_message",
134
+ methodName: "messages.send",
135
+ description: "Send a message",
136
+ paramsSchema: SendMessageParams
137
+ },
138
+ {
139
+ name: "reply_to_message",
140
+ methodName: "messages.reply",
141
+ description: "Reply to a message",
142
+ paramsSchema: ReplyToMessageParams
143
+ }
144
+ ];
145
+
146
+ // src/toolkit.ts
147
+ var Toolkit = class {
148
+ constructor(client) {
149
+ this.client = client;
150
+ if (!this.client) this.client = new import_agentmail.AgentMailClient();
151
+ this.tools = tools.reduce(
152
+ (acc, tool) => {
153
+ acc[tool.name] = this.buildTool(tool);
154
+ return acc;
155
+ },
156
+ {}
157
+ );
158
+ }
159
+ tools = {};
160
+ // public getTools() {
161
+ // return this.tools
162
+ // }
163
+ async callMethod(methodName, args) {
164
+ const parts = methodName.split(".");
165
+ const methodKey = parts.pop();
166
+ if (!methodKey) throw new Error("Method name empty");
167
+ let parent = this.client;
168
+ for (const part of parts) parent = parent[part];
169
+ return await parent[methodKey].call(parent, args);
170
+ }
171
+ };
172
+
173
+ // src/langchain.ts
174
+ var AgentMailToolkit = class extends Toolkit {
175
+ constructor(client) {
176
+ super(client);
177
+ }
178
+ buildTool(tool) {
179
+ return (0, import_tools2.tool)(
180
+ async (args) => {
181
+ const result = await this.callMethod(tool.methodName, args);
182
+ return result.toString();
183
+ },
184
+ {
185
+ name: tool.name,
186
+ description: tool.description,
187
+ schema: tool.paramsSchema
188
+ }
189
+ );
190
+ }
191
+ getTools() {
192
+ return Object.values(this.tools);
193
+ }
194
+ };
195
+ // Annotate the CommonJS export names for ESM import in node:
196
+ 0 && (module.exports = {
197
+ AgentMailToolkit
198
+ });
199
+ //# sourceMappingURL=langchain.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/langchain.ts","../src/toolkit.ts","../src/schemas.ts","../src/tools.ts"],"sourcesContent":["import { type StructuredTool, tool as langchainTool } from '@langchain/core/tools'\nimport { AgentMailClient } from 'agentmail'\n\nimport { Toolkit } from './toolkit'\nimport { type Tool } from './tools'\n\nexport class AgentMailToolkit extends Toolkit<StructuredTool> {\n constructor(client?: AgentMailClient) {\n super(client)\n }\n\n protected buildTool(tool: Tool): StructuredTool {\n return langchainTool(\n async (args) => {\n const result = await this.callMethod(tool.methodName, args)\n return result.toString()\n },\n {\n name: tool.name,\n description: tool.description,\n schema: tool.paramsSchema,\n }\n )\n }\n\n public getTools() {\n return Object.values(this.tools)\n }\n}\n","import { AgentMailClient } from 'agentmail'\nimport { type Tool, tools } from './tools'\n\nexport abstract class Toolkit<T> {\n protected readonly tools: Record<string, T> = {}\n\n constructor(private readonly client?: AgentMailClient) {\n if (!this.client) this.client = new AgentMailClient()\n\n this.tools = tools.reduce(\n (acc, tool) => {\n acc[tool.name] = this.buildTool(tool)\n return acc\n },\n {} as Record<string, T>\n )\n }\n\n protected abstract buildTool(tool: Tool): T\n\n // public getTools() {\n // return this.tools\n // }\n\n public async callMethod(methodName: string, args: unknown) {\n const parts = methodName.split('.')\n const methodKey = parts.pop()\n\n if (!methodKey) throw new Error('Method name empty')\n\n let parent: any = this.client\n for (const part of parts) parent = parent[part]\n\n return await parent[methodKey].call(parent, args)\n }\n}\n","import { z } from 'zod'\n\nexport const ListItemsParams = z.object({\n limit: z.number().optional().describe('The maximum number of items to return'),\n last_key: z.string().optional().describe('The last key to use for pagination'),\n})\n\nexport const GetInboxParams = z.object({\n inbox_id: z.string().describe('The ID of the inbox to get'),\n})\n\nexport const CreateInboxParams = z.object({\n username: z.string().optional().describe('The username of the inbox to create.'),\n domain: z.string().optional().describe('The domain of the inbox to create.'),\n display_name: z.string().optional().describe('The display name of the inbox to create.'),\n})\n\nexport const ListThreadsParams = ListItemsParams.extend({\n inbox_id: z.string().describe('The ID of the inbox to list threads for'),\n received: z.boolean().optional().describe('Whether to filter by received threads'),\n sent: z.boolean().optional().describe('Whether to filter by sent threads'),\n})\n\nexport const GetThreadParams = z.object({\n inbox_id: z.string().describe('The ID of the inbox to get the thread for'),\n thread_id: z.string().describe('The ID of the thread to get'),\n})\n\nexport const ListMessagesParams = ListItemsParams.extend({\n inbox_id: z.string().describe('The ID of the inbox to list messages for'),\n})\n\nexport const GetMessageParams = z.object({\n inbox_id: z.string().describe('The ID of the inbox to get the message for'),\n message_id: z.string().describe('The ID of the message to get'),\n})\n\nexport const GetAttachmentParams = z.object({\n inbox_id: z.string().describe('The ID of the inbox to get the attachment for'),\n message_id: z.string().describe('The ID of the message to get the attachment for'),\n attachment_id: z.string().describe('The ID of the attachment to get'),\n})\n\nexport const SendMessageParams = z.object({\n inbox_id: z.string().describe('The ID of the inbox to send the message from'),\n to: z.array(z.string()).describe('The list of recipients'),\n cc: z.array(z.string()).optional().describe('The list of CC recipients'),\n bcc: z.array(z.string()).optional().describe('The list of BCC recipients'),\n subject: z.string().optional().describe('The subject of the message'),\n text: z.string().optional().describe('The plain text body of the message'),\n html: z.string().optional().describe('The HTML body of the message'),\n})\n\nexport const ReplyToMessageParams = z.object({\n inbox_id: z.string().describe('The inboc ID of the inbox to reply to the message from'),\n message_id: z.string().describe('The message ID of the message you wish to reply to'),\n text: z.string().optional().describe('The plain text body of the reply'),\n html: z.string().optional().describe('The HTML body of the reply'),\n})\n","import { z } from 'zod'\n\nimport {\n ListItemsParams,\n GetInboxParams,\n CreateInboxParams,\n ListThreadsParams,\n GetThreadParams,\n ListMessagesParams,\n GetMessageParams,\n GetAttachmentParams,\n SendMessageParams,\n ReplyToMessageParams,\n} from './schemas'\n\nexport type Tool = {\n name: string\n methodName: string\n description: string\n paramsSchema: z.ZodObject<any>\n}\n\nexport const tools: Tool[] = [\n {\n name: 'list_inboxes',\n methodName: 'inboxes.list',\n description: 'List all inboxes',\n paramsSchema: ListItemsParams,\n },\n {\n name: 'get_inbox',\n methodName: 'inboxes.get',\n description: 'Get an inbox by ID',\n paramsSchema: GetInboxParams,\n },\n {\n name: 'create_inbox',\n methodName: 'inboxes.create',\n description: 'Create a new inbox',\n paramsSchema: CreateInboxParams,\n },\n {\n name: 'list_threads',\n methodName: 'threads.list',\n description: 'List all threads',\n paramsSchema: ListThreadsParams,\n },\n {\n name: 'get_thread',\n methodName: 'threads.get',\n description: 'Get a thread by ID',\n paramsSchema: GetThreadParams,\n },\n {\n name: 'list_messages',\n methodName: 'messages.list',\n description: 'List all messages',\n paramsSchema: ListMessagesParams,\n },\n {\n name: 'get_message',\n methodName: 'messages.get',\n description: 'Get a message by ID',\n paramsSchema: GetMessageParams,\n },\n {\n name: 'get_attachment',\n methodName: 'attachments.get',\n description: 'Get an attachment by ID',\n paramsSchema: GetAttachmentParams,\n },\n {\n name: 'send_message',\n methodName: 'messages.send',\n description: 'Send a message',\n paramsSchema: SendMessageParams,\n },\n {\n name: 'reply_to_message',\n methodName: 'messages.reply',\n description: 'Reply to a message',\n paramsSchema: ReplyToMessageParams,\n },\n]\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAAA,gBAA2D;;;ACA3D,uBAAgC;;;ACAhC,iBAAkB;AAEX,IAAM,kBAAkB,aAAE,OAAO;AAAA,EACpC,OAAO,aAAE,OAAO,EAAE,SAAS,EAAE,SAAS,uCAAuC;AAAA,EAC7E,UAAU,aAAE,OAAO,EAAE,SAAS,EAAE,SAAS,oCAAoC;AACjF,CAAC;AAEM,IAAM,iBAAiB,aAAE,OAAO;AAAA,EACnC,UAAU,aAAE,OAAO,EAAE,SAAS,4BAA4B;AAC9D,CAAC;AAEM,IAAM,oBAAoB,aAAE,OAAO;AAAA,EACtC,UAAU,aAAE,OAAO,EAAE,SAAS,EAAE,SAAS,sCAAsC;AAAA,EAC/E,QAAQ,aAAE,OAAO,EAAE,SAAS,EAAE,SAAS,oCAAoC;AAAA,EAC3E,cAAc,aAAE,OAAO,EAAE,SAAS,EAAE,SAAS,0CAA0C;AAC3F,CAAC;AAEM,IAAM,oBAAoB,gBAAgB,OAAO;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ts
6
+ import { tool as langchainTool } from "@langchain/core/tools";
7
+ var AgentMailToolkit = class extends Toolkit {
8
+ constructor(client) {
9
+ super(client);
10
+ }
11
+ buildTool(tool) {
12
+ return langchainTool(
13
+ async (args) => {
14
+ const result = await this.callMethod(tool.methodName, args);
15
+ return result.toString();
16
+ },
17
+ {
18
+ name: tool.name,
19
+ description: tool.description,
20
+ schema: tool.paramsSchema
21
+ }
22
+ );
23
+ }
24
+ getTools() {
25
+ return Object.values(this.tools);
26
+ }
27
+ };
28
+ export {
29
+ AgentMailToolkit
30
+ };
31
+ //# sourceMappingURL=langchain.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/langchain.ts"],"sourcesContent":["import { type StructuredTool, tool as langchainTool } from '@langchain/core/tools'\nimport { AgentMailClient } from 'agentmail'\n\nimport { Toolkit } from './toolkit'\nimport { type Tool } from './tools'\n\nexport class AgentMailToolkit extends Toolkit<StructuredTool> {\n constructor(client?: AgentMailClient) {\n super(client)\n }\n\n protected buildTool(tool: Tool): StructuredTool {\n return langchainTool(\n async (args) => {\n const result = await this.callMethod(tool.methodName, args)\n return result.toString()\n },\n {\n name: tool.name,\n description: tool.description,\n schema: tool.paramsSchema,\n }\n )\n }\n\n public getTools() {\n return Object.values(this.tools)\n }\n}\n"],"mappings":";;;;;AAAA,SAA8B,QAAQ,qBAAqB;AAMpD,IAAM,mBAAN,cAA+B,QAAwB;AAAA,EAC1D,YAAY,QAA0B;AAClC,UAAM,MAAM;AAAA,EAChB;AAAA,EAEU,UAAU,MAA4B;AAC5C,WAAO;AAAA,MACH,OAAO,SAAS;AACZ,cAAM,SAAS,MAAM,KAAK,WAAW,KAAK,YAAY,IAAI;AAC1D,eAAO,OAAO,SAAS;AAAA,MAC3B;AAAA,MACA;AAAA,QACI,MAAM,KAAK;AAAA,QACX,aAAa,KAAK;AAAA,QAClB,QAAQ,KAAK;AAAA,MACjB;AAAA,IACJ;AAAA,EACJ;AAAA,EAEO,WAAW;AACd,WAAO,OAAO,OAAO,KAAK,KAAK;AAAA,EACnC;AACJ;","names":[]}
@@ -0,0 +1,19 @@
1
+ import { AgentMailClient } from 'agentmail';
2
+ import { z } from 'zod';
3
+
4
+ type Tool = {
5
+ name: string;
6
+ methodName: string;
7
+ description: string;
8
+ paramsSchema: z.ZodObject<any>;
9
+ };
10
+
11
+ declare abstract class Toolkit<T> {
12
+ private readonly client?;
13
+ protected readonly tools: Record<string, T>;
14
+ constructor(client?: AgentMailClient | undefined);
15
+ protected abstract buildTool(tool: Tool): T;
16
+ callMethod(methodName: string, args: unknown): Promise<any>;
17
+ }
18
+
19
+ export { Toolkit as T, type Tool as a };
@@ -0,0 +1,19 @@
1
+ import { AgentMailClient } from 'agentmail';
2
+ import { z } from 'zod';
3
+
4
+ type Tool = {
5
+ name: string;
6
+ methodName: string;
7
+ description: string;
8
+ paramsSchema: z.ZodObject<any>;
9
+ };
10
+
11
+ declare abstract class Toolkit<T> {
12
+ private readonly client?;
13
+ protected readonly tools: Record<string, T>;
14
+ constructor(client?: AgentMailClient | undefined);
15
+ protected abstract buildTool(tool: Tool): T;
16
+ callMethod(methodName: string, args: unknown): Promise<any>;
17
+ }
18
+
19
+ export { Toolkit as T, type Tool as a };
package/package.json CHANGED
@@ -1,35 +1,39 @@
1
1
  {
2
2
  "name": "agentmail-toolkit",
3
- "version": "0.1.10",
3
+ "version": "0.1.12",
4
4
  "description": "AgentMail Toolkit",
5
- "files": [
6
- "dist/**/*"
7
- ],
8
- "exports": {
9
- "./ai-sdk": {
10
- "types": "./dist/ai-sdk.d.ts",
11
- "import": "./dist/ai-sdk.mjs",
12
- "require": "./dist/ai-sdk.js"
13
- }
14
- },
15
5
  "scripts": {
16
6
  "build": "tsup",
17
7
  "lint": "eslint .",
18
- "test": "echo \"Error: no test specified\" && exit 1"
8
+ "test": "echo \"Error: no test specified\" && exit 1",
9
+ "prettier": "prettier --write ."
19
10
  },
20
- "author": "AgentMail",
21
- "license": "ISC",
11
+ "author": "AgentMail <support@agentmail.to>",
12
+ "license": "MIT",
22
13
  "repository": {
23
14
  "type": "git",
24
15
  "url": "git+https://github.com/agentmail-to/agentmail-toolkit.git"
25
16
  },
26
17
  "keywords": [
27
- "Agents",
28
- "Email",
29
18
  "AgentMail",
30
19
  "Toolkit"
31
20
  ],
32
21
  "packageManager": "pnpm@10.6.4",
22
+ "files": [
23
+ "dist"
24
+ ],
25
+ "exports": {
26
+ "./ai-sdk": {
27
+ "types": "./dist/ai-sdk.d.ts",
28
+ "import": "./dist/ai-sdk.mjs",
29
+ "require": "./dist/ai-sdk.js"
30
+ },
31
+ "./langchain": {
32
+ "types": "./dist/langchain.d.ts",
33
+ "import": "./dist/langchain.mjs",
34
+ "require": "./dist/langchain.js"
35
+ }
36
+ },
33
37
  "devDependencies": {
34
38
  "@eslint/js": "^9.22.0",
35
39
  "@types/node": "^22.13.10",
@@ -43,11 +47,11 @@
43
47
  "typescript-eslint": "^8.26.1"
44
48
  },
45
49
  "dependencies": {
46
- "@ai-sdk/openai": "^1.3.4",
47
50
  "agentmail": "^0.0.22",
48
51
  "zod": "^3.24.2"
49
52
  },
50
53
  "peerDependencies": {
54
+ "@langchain/core": "^0.3.43",
51
55
  "ai": "^4.2.8"
52
56
  }
53
57
  }