agentmail-toolkit 0.1.11 → 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.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
  }
158
+ tools = {};
179
159
  // public getTools() {
180
160
  // return this.tools
181
161
  // }
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
- });
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
 
@@ -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 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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,uBAAgC;;;ACAhC,iBAAkB;AAEX,IAA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AAN,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":[]}
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":";;;;;;;;;;;;;;;;;;;;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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,IAAI;AAAA,IAC5D;AAAA,EACJ;AAAA,EAEO,WAAW;AACd,WAAO,KAAK;AAAA,EAChB;AACJ;","names":[]}
package/dist/ai-sdk.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Toolkit
3
- } from "./chunk-ZPF3SOVL.mjs";
3
+ } from "./chunk-UF44LGSE.mjs";
4
4
 
5
5
  // src/ai-sdk.ts
6
6
  var AgentMailToolkit = class extends Toolkit {
@@ -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,EAAE,OAAO;AAAA,EACpC,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,uCAAuC;AAAA,EAC7E,UAAU,EAAE,OAAO,EAAE,SAAS,EAAE,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AM;AAAA,IACN,YAAY;AAAA,IACZ,aAAa;AAAA,IACb,cAAc;AAAA,EAClB;AAAA,EACA;AAAA,IACI,MAAM;AAAA,IACN,YAAY;AAAA,IACZ,aAAa;AAAA,IACb,cAAc;AAAA,EAClB;AAAA,EACA;AAAA,IACI,MAAM;AAAA,IACN,YAAY;AAAA,IACZ,aAAa;AAAA,IACb,cAAc;AAAA,EAClB;AAAA,EACA;AAAA,IACI,MAAM;AAAA,IACN,YAAY;AAAA,IACZ,aAAa;AAAA,IACb,cAAc;AAAA,EAClB;AAAA,EACA;AAAA,IACI,MAAM;AAAA,IACN,YAAY;AAAA,IACZ,aAAa;AAAA,IACb,cAAc;AAAA,EAClB;AACJ;;;AFhFO,IAAe,UAAf,MAA0B;AAAA,EAG7B,YAA6B,QAA0B;AAA1B;AACzB,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,EAZmB,QAA2B,CAAC;AAAA;AAAA;AAAA;AAAA,EAoB/C,MAAa,WAAW,YAAoB,MAAe;AACvD,UAAM,QAAQ,WAAW,MAAM,GAAG;AAClC,UAAM,YAAY,MAAM,IAAI;AAE5B,QAAI,CAAC,UAAW,OAAM,IAAI,MAAM,mBAAmB;AAEnD,QAAI,SAAc,KAAK;AACvB,eAAW,QAAQ,MAAO,UAAS,OAAO,IAAI;AAE9C,WAAO,MAAM,OAAO,SAAS,EAAE,KAAK,QAAQ,IAAI;AAAA,EACpD;AACJ;","names":[]}
@@ -1,173 +1,167 @@
1
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
- };
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
21
 
22
22
  // src/toolkit.ts
23
- import { AgentMailClient } from "agentmail";
23
+ import { AgentMailClient } from 'agentmail'
24
24
 
25
25
  // src/schemas.ts
26
- import { z } from "zod";
26
+ import { z } from 'zod'
27
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
- });
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
31
  var GetInboxParams = z.object({
32
- inbox_id: z.string().describe("The ID of the inbox to get")
33
- });
32
+ inbox_id: z.string().describe('The ID of the inbox to get'),
33
+ })
34
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
- });
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
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
- });
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
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
- });
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
48
  var ListMessagesParams = ListItemsParams.extend({
49
- inbox_id: z.string().describe("The ID of the inbox to list messages for")
50
- });
49
+ inbox_id: z.string().describe('The ID of the inbox to list messages for'),
50
+ })
51
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
- });
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
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
- });
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
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
- });
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
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
- });
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
75
 
76
76
  // src/tools.ts
77
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
- ];
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
139
 
140
140
  // src/toolkit.ts
141
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
- // public 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
- };
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
+ }
168
165
 
169
- export {
170
- __async,
171
- Toolkit
172
- };
173
- //# sourceMappingURL=chunk-ZPF3SOVL.mjs.map
166
+ export { __async, Toolkit }
167
+ //# sourceMappingURL=chunk-ZPF3SOVL.mjs.map
package/dist/langchain.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/langchain.ts
41
21
  var langchain_exports = {};
@@ -167,7 +147,6 @@ var tools = [
167
147
  var Toolkit = class {
168
148
  constructor(client) {
169
149
  this.client = client;
170
- this.tools = {};
171
150
  if (!this.client) this.client = new import_agentmail.AgentMailClient();
172
151
  this.tools = tools.reduce(
173
152
  (acc, tool) => {
@@ -177,18 +156,17 @@ var Toolkit = class {
177
156
  {}
178
157
  );
179
158
  }
159
+ tools = {};
180
160
  // public getTools() {
181
161
  // return this.tools
182
162
  // }
183
- callMethod(methodName, args) {
184
- return __async(this, null, function* () {
185
- const parts = methodName.split(".");
186
- const methodKey = parts.pop();
187
- if (!methodKey) throw new Error("Method name empty");
188
- let parent = this.client;
189
- for (const part of parts) parent = parent[part];
190
- return yield parent[methodKey].call(parent, args);
191
- });
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);
192
170
  }
193
171
  };
194
172
 
@@ -199,10 +177,10 @@ var AgentMailToolkit = class extends Toolkit {
199
177
  }
200
178
  buildTool(tool) {
201
179
  return (0, import_tools2.tool)(
202
- (args) => __async(this, null, function* () {
203
- const result = yield this.callMethod(tool.methodName, args);
180
+ async (args) => {
181
+ const result = await this.callMethod(tool.methodName, args);
204
182
  return result.toString();
205
- }),
183
+ },
206
184
  {
207
185
  name: tool.name,
208
186
  description: tool.description,
@@ -1 +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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ACZ,aAAa;AAAA,IACb,cAAc;AAAA,EAClB;AACJ;;;AFhFO,IAAe,UAAf,MAA0B;AAAA,EAG7B,YAA6B,QAA0B;AAA1B;AAF7B,SAAmB,QAA2B,CAAC;AAG3C,QAAI,CAAC,KAAK,OAAQ,MAAK,SAAS,IAAI,iCAAgB;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;AAAA;AAAA;AAAA,EAQa,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,QAAwB;AAAA,EAC1D,YAAY,QAA0B;AAClC,UAAM,MAAM;AAAA,EAChB;AAAA,EAEU,UAAU,MAA4B;AAC5C,eAAO,cAAAC;AAAA,MACH,CAAO,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":["import_tools","langchainTool"]}
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,oBAAo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.mjs";
2
+ Toolkit
3
+ } from "./chunk-UF44LGSE.mjs";
5
4
 
6
5
  // src/langchain.ts
7
6
  import { tool as langchainTool } from "@langchain/core/tools";
@@ -11,10 +10,10 @@ var AgentMailToolkit = class extends Toolkit {
11
10
  }
12
11
  buildTool(tool) {
13
12
  return langchainTool(
14
- (args) => __async(this, null, function* () {
15
- const result = yield this.callMethod(tool.methodName, args);
13
+ async (args) => {
14
+ const result = await this.callMethod(tool.methodName, args);
16
15
  return result.toString();
17
- }),
16
+ },
18
17
  {
19
18
  name: tool.name,
20
19
  description: tool.description,
@@ -1 +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,CAAO,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":[]}
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":[]}
package/package.json CHANGED
@@ -1,9 +1,26 @@
1
1
  {
2
2
  "name": "agentmail-toolkit",
3
- "version": "0.1.11",
3
+ "version": "0.1.12",
4
4
  "description": "AgentMail Toolkit",
5
+ "scripts": {
6
+ "build": "tsup",
7
+ "lint": "eslint .",
8
+ "test": "echo \"Error: no test specified\" && exit 1",
9
+ "prettier": "prettier --write ."
10
+ },
11
+ "author": "AgentMail <support@agentmail.to>",
12
+ "license": "MIT",
13
+ "repository": {
14
+ "type": "git",
15
+ "url": "git+https://github.com/agentmail-to/agentmail-toolkit.git"
16
+ },
17
+ "keywords": [
18
+ "AgentMail",
19
+ "Toolkit"
20
+ ],
21
+ "packageManager": "pnpm@10.6.4",
5
22
  "files": [
6
- "dist/**/*"
23
+ "dist"
7
24
  ],
8
25
  "exports": {
9
26
  "./ai-sdk": {
@@ -17,24 +34,6 @@
17
34
  "require": "./dist/langchain.js"
18
35
  }
19
36
  },
20
- "scripts": {
21
- "build": "tsup",
22
- "lint": "eslint .",
23
- "test": "echo \"Error: no test specified\" && exit 1"
24
- },
25
- "author": "AgentMail",
26
- "license": "ISC",
27
- "repository": {
28
- "type": "git",
29
- "url": "git+https://github.com/agentmail-to/agentmail-toolkit.git"
30
- },
31
- "keywords": [
32
- "Agents",
33
- "Email",
34
- "AgentMail",
35
- "Toolkit"
36
- ],
37
- "packageManager": "pnpm@10.6.4",
38
37
  "devDependencies": {
39
38
  "@eslint/js": "^9.22.0",
40
39
  "@types/node": "^22.13.10",
@@ -48,7 +47,6 @@
48
47
  "typescript-eslint": "^8.26.1"
49
48
  },
50
49
  "dependencies": {
51
- "@ai-sdk/openai": "^1.3.4",
52
50
  "agentmail": "^0.0.22",
53
51
  "zod": "^3.24.2"
54
52
  },