agentmail 0.2.14 → 0.2.16

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.
@@ -43,8 +43,8 @@ function normalizeClientOptions(options) {
43
43
  const headers = (0, headers_js_1.mergeHeaders)({
44
44
  "X-Fern-Language": "JavaScript",
45
45
  "X-Fern-SDK-Name": "agentmail",
46
- "X-Fern-SDK-Version": "0.2.14",
47
- "User-Agent": "agentmail/0.2.14",
46
+ "X-Fern-SDK-Version": "0.2.16",
47
+ "User-Agent": "agentmail/0.2.16",
48
48
  "X-Fern-Runtime": core.RUNTIME.type,
49
49
  "X-Fern-Runtime-Version": core.RUNTIME.version,
50
50
  }, options === null || options === void 0 ? void 0 : options.headers);
@@ -4,7 +4,7 @@ import { WebsocketsSocket } from "./Socket.js";
4
4
  export declare namespace WebsocketsClient {
5
5
  type Options = BaseClientOptions;
6
6
  interface ConnectArgs {
7
- apiKey: string;
7
+ apiKey?: string;
8
8
  /** Additional query parameters to send with the websocket connect request. */
9
9
  queryParams?: Record<string, unknown>;
10
10
  /** Arbitrary headers to send with the websocket connect request. */
@@ -18,5 +18,5 @@ export declare namespace WebsocketsClient {
18
18
  export declare class WebsocketsClient {
19
19
  protected readonly _options: NormalizedClientOptionsWithAuth<WebsocketsClient.Options>;
20
20
  constructor(options?: WebsocketsClient.Options);
21
- connect(args: WebsocketsClient.ConnectArgs): Promise<WebsocketsSocket>;
21
+ connect(args?: WebsocketsClient.ConnectArgs): Promise<WebsocketsSocket>;
22
22
  }
@@ -53,8 +53,8 @@ class WebsocketsClient {
53
53
  constructor(options = {}) {
54
54
  this._options = (0, BaseClient_js_1.normalizeClientOptionsWithAuth)(options);
55
55
  }
56
- connect(args) {
57
- return __awaiter(this, void 0, void 0, function* () {
56
+ connect() {
57
+ return __awaiter(this, arguments, void 0, function* (args = {}) {
58
58
  var _a, _b;
59
59
  const { apiKey, queryParams, headers, debug, reconnectAttempts } = args;
60
60
  const _queryParams = {
@@ -11,5 +11,9 @@ export declare const AgentMailEnvironment: {
11
11
  readonly http: "https://x402.api.agentmail.to";
12
12
  readonly websockets: "wss://x402.ws.agentmail.to";
13
13
  };
14
+ readonly EuProd: {
15
+ readonly http: "https://api.agentmail.eu";
16
+ readonly websockets: "wss://ws.agentmail.eu";
17
+ };
14
18
  };
15
- export type AgentMailEnvironment = typeof AgentMailEnvironment.Prod | typeof AgentMailEnvironment.ProdX402;
19
+ export type AgentMailEnvironment = typeof AgentMailEnvironment.Prod | typeof AgentMailEnvironment.ProdX402 | typeof AgentMailEnvironment.EuProd;
@@ -11,4 +11,8 @@ exports.AgentMailEnvironment = {
11
11
  http: "https://x402.api.agentmail.to",
12
12
  websockets: "wss://x402.ws.agentmail.to",
13
13
  },
14
+ EuProd: {
15
+ http: "https://api.agentmail.eu",
16
+ websockets: "wss://ws.agentmail.eu",
17
+ },
14
18
  };
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "0.2.14";
1
+ export declare const SDK_VERSION = "0.2.16";
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SDK_VERSION = void 0;
4
- exports.SDK_VERSION = "0.2.14";
4
+ exports.SDK_VERSION = "0.2.16";
@@ -6,8 +6,8 @@ export function normalizeClientOptions(options) {
6
6
  const headers = mergeHeaders({
7
7
  "X-Fern-Language": "JavaScript",
8
8
  "X-Fern-SDK-Name": "agentmail",
9
- "X-Fern-SDK-Version": "0.2.14",
10
- "User-Agent": "agentmail/0.2.14",
9
+ "X-Fern-SDK-Version": "0.2.16",
10
+ "User-Agent": "agentmail/0.2.16",
11
11
  "X-Fern-Runtime": core.RUNTIME.type,
12
12
  "X-Fern-Runtime-Version": core.RUNTIME.version,
13
13
  }, options === null || options === void 0 ? void 0 : options.headers);
@@ -4,7 +4,7 @@ import { WebsocketsSocket } from "./Socket.mjs";
4
4
  export declare namespace WebsocketsClient {
5
5
  type Options = BaseClientOptions;
6
6
  interface ConnectArgs {
7
- apiKey: string;
7
+ apiKey?: string;
8
8
  /** Additional query parameters to send with the websocket connect request. */
9
9
  queryParams?: Record<string, unknown>;
10
10
  /** Arbitrary headers to send with the websocket connect request. */
@@ -18,5 +18,5 @@ export declare namespace WebsocketsClient {
18
18
  export declare class WebsocketsClient {
19
19
  protected readonly _options: NormalizedClientOptionsWithAuth<WebsocketsClient.Options>;
20
20
  constructor(options?: WebsocketsClient.Options);
21
- connect(args: WebsocketsClient.ConnectArgs): Promise<WebsocketsSocket>;
21
+ connect(args?: WebsocketsClient.ConnectArgs): Promise<WebsocketsSocket>;
22
22
  }
@@ -17,8 +17,8 @@ export class WebsocketsClient {
17
17
  constructor(options = {}) {
18
18
  this._options = normalizeClientOptionsWithAuth(options);
19
19
  }
20
- connect(args) {
21
- return __awaiter(this, void 0, void 0, function* () {
20
+ connect() {
21
+ return __awaiter(this, arguments, void 0, function* (args = {}) {
22
22
  var _a, _b;
23
23
  const { apiKey, queryParams, headers, debug, reconnectAttempts } = args;
24
24
  const _queryParams = {
@@ -11,5 +11,9 @@ export declare const AgentMailEnvironment: {
11
11
  readonly http: "https://x402.api.agentmail.to";
12
12
  readonly websockets: "wss://x402.ws.agentmail.to";
13
13
  };
14
+ readonly EuProd: {
15
+ readonly http: "https://api.agentmail.eu";
16
+ readonly websockets: "wss://ws.agentmail.eu";
17
+ };
14
18
  };
15
- export type AgentMailEnvironment = typeof AgentMailEnvironment.Prod | typeof AgentMailEnvironment.ProdX402;
19
+ export type AgentMailEnvironment = typeof AgentMailEnvironment.Prod | typeof AgentMailEnvironment.ProdX402 | typeof AgentMailEnvironment.EuProd;
@@ -8,4 +8,8 @@ export const AgentMailEnvironment = {
8
8
  http: "https://x402.api.agentmail.to",
9
9
  websockets: "wss://x402.ws.agentmail.to",
10
10
  },
11
+ EuProd: {
12
+ http: "https://api.agentmail.eu",
13
+ websockets: "wss://ws.agentmail.eu",
14
+ },
11
15
  };
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "0.2.14";
1
+ export declare const SDK_VERSION = "0.2.16";
@@ -1 +1 @@
1
- export const SDK_VERSION = "0.2.14";
1
+ export const SDK_VERSION = "0.2.16";
@@ -4593,6 +4593,59 @@ main();
4593
4593
  ***
4594
4594
 
4595
4595
 
4596
+ ***
4597
+
4598
+ title: WebSockets Quickstart
4599
+ subtitle: Get started with real-time email event streaming
4600
+ slug: websockets/quickstart
4601
+ ---------------------------
4602
+
4603
+ ```typescript title="TypeScript"
4604
+ import { AgentMailClient } from "agentmail";
4605
+
4606
+ const client = new AgentMailClient();
4607
+
4608
+ async function main() {
4609
+ const socket = await client.websockets.connect({
4610
+ apiKey: process.env.AGENTMAIL_API_KEY,
4611
+ });
4612
+
4613
+ socket.on("message", async (event) => {
4614
+ if (event.type === "subscribed") {
4615
+ console.log("Subscribed to", event.inboxIds);
4616
+ } else if (event.eventType === "message.received") {
4617
+ console.log(`Received message from: ${event.message.from}`);
4618
+ }
4619
+ });
4620
+
4621
+ await socket.waitForOpen();
4622
+
4623
+ socket.sendSubscribe({
4624
+ type: "subscribe",
4625
+ inboxIds: ["my-agent@agentmail.to"],
4626
+ });
4627
+ }
4628
+
4629
+ main();
4630
+ ```
4631
+
4632
+ ```python title="Python"
4633
+ from agentmail import AgentMail, MessageReceivedEvent, Subscribe, Subscribed
4634
+
4635
+ client = AgentMail()
4636
+
4637
+ with client.websockets.connect() as socket:
4638
+ socket.send_subscribe(Subscribe(inbox_ids=["my-agent@agentmail.to"]))
4639
+
4640
+ for event in socket:
4641
+ if isinstance(event, Subscribed):
4642
+ print(f"Subscribed to {event.inbox_ids}")
4643
+ elif isinstance(event, MessageReceivedEvent):
4644
+ msg = event.message
4645
+ print(f"Received message from: {msg.from_}")
4646
+ ```
4647
+
4648
+
4596
4649
  ***
4597
4650
 
4598
4651
  title: Email Deliverability
@@ -21826,7 +21879,7 @@ channels:
21826
21879
  query:
21827
21880
  type: object
21828
21881
  properties:
21829
- auth_token:
21882
+ api_key:
21830
21883
  type: string
21831
21884
  publish:
21832
21885
  operationId: websockets-publish
package/dist/llms.txt CHANGED
@@ -26,6 +26,7 @@
26
26
  - [Webhook Setup Guide](https://docs.agentmail.to/webhook-setup.mdx): A comprehensive guide to setting up webhooks with ngrok and AgentMail, including account creation, inbox setup, and code examples.
27
27
  - [Verifying Webhooks](https://docs.agentmail.to/webhook-verification.mdx): Learn how to verify webhook signatures to secure your webhook endpoints and prevent spoofed requests.
28
28
  - [WebSockets](https://docs.agentmail.to/websockets.mdx): Learn how to use WebSockets for instant email notifications without webhooks or polling.
29
+ - [WebSockets Quickstart](https://docs.agentmail.to/websockets/quickstart.mdx): Get started with real-time email event streaming
29
30
  - [Email Deliverability](https://docs.agentmail.to/email-deliverability.mdx): Learn the strategies and best practices for maximizing your email deliverability with AgentMail.
30
31
  - [Idempotent Requests](https://docs.agentmail.to/idempotency.mdx): A guide to using the client_id parameter in AgentMail to prevent duplicate resources and safely retry API requests.
31
32
  - [Example: Event-Driven Agent](https://docs.agentmail.to/webhook-agent.mdx): A step-by-step guide to building a sophisticated agent that performs proactive outreach and uses webhooks for inbound message processing.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentmail",
3
- "version": "0.2.14",
3
+ "version": "0.2.16",
4
4
  "private": false,
5
5
  "repository": {
6
6
  "type": "git",