From 260dad7c1662c858d01865277e3046a7be01586e Mon Sep 17 00:00:00 2001 From: Rohit <71192000+rohitsux@users.noreply.github.com> Date: Sat, 18 Jul 2026 19:25:34 +0530 Subject: [PATCH] fix(node-sdk): declare @x402/fetch as an optional peer dependency The node SDK's hand-written wrapper (src/wrapper/x402.ts and src/wrapper/Client.ts) lazily imports @x402/fetch for the opt-in payments feature, but the package was not declared anywhere in package.json. That makes it a phantom optional dependency: bundlers fail with unresolvable-import errors, file tracers cannot materialize the dependency closure, and isolated installers (pnpm, bun) guarantee phantom resolution never works. The wrapper even ships a local module declaration (src/wrapper/x402-types.d.ts) to paper over TypeScript being unable to resolve the undeclared package. package.json in agentmail-node is Fern-generated and not covered by .fernignore, so the durable fix lives here in the generator config: extraPeerDependencies plus extraPeerDependenciesMeta mark @x402/fetch as an optional peer, keeping the payments feature opt-in while letting every toolchain see and resolve the import. All published @x402/fetch versions are 2.x, matching the caret range. --- fern/generators.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/fern/generators.yml b/fern/generators.yml index a5f3a44f..b22396b4 100644 --- a/fern/generators.yml +++ b/fern/generators.yml @@ -40,6 +40,15 @@ groups: noSerdeLayer: false skipResponseValidation: true shouldGenerateWebsocketClients: true + # The hand-written wrapper (src/wrapper/x402.ts, src/wrapper/Client.ts) + # lazily imports @x402/fetch for the opt-in payments feature. Declare it + # as an optional peer dependency so bundlers, file tracers, and isolated + # installers can resolve the import (agentmail-node#24). + extraPeerDependencies: + "@x402/fetch": "^2" + extraPeerDependenciesMeta: + "@x402/fetch": + optional: true packageJson: description: "The email inbox API for AI agents. Send, receive, reply, and