@agentdomain/agentkit-plugin 0.1.0

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 ADDED
@@ -0,0 +1,19 @@
1
+ # @agentdomain/agentkit-plugin
2
+
3
+ Coinbase AgentKit action provider for AgentDomain.
4
+
5
+ ```bash
6
+ npm install @agentdomain/agentkit-plugin
7
+ ```
8
+
9
+ The provider exposes actions for:
10
+
11
+ - Agent identity registration and quote
12
+ - Registry search
13
+ - Email send/list
14
+ - DNS list/create/update/delete
15
+ - SSL reconfiguration
16
+ - RenewalVault status, funding, auto-renew, and withdrawal
17
+ - Per-agent Pro and Enterprise service plans
18
+
19
+ Default API base: `https://agentdomain.app/api/v1`.
@@ -0,0 +1,162 @@
1
+ import { z } from 'zod';
2
+ declare const QuoteSchema: z.ZodObject<{
3
+ preferredName: z.ZodString;
4
+ tld: z.ZodDefault<z.ZodEnum<["xyz", "com", "ai", "org", "io", "net", "co", "app"]>>;
5
+ registerBasename: z.ZodDefault<z.ZodBoolean>;
6
+ basenameLabel: z.ZodOptional<z.ZodString>;
7
+ registerEns: z.ZodDefault<z.ZodBoolean>;
8
+ ensLabel: z.ZodOptional<z.ZodString>;
9
+ emailEnabled: z.ZodDefault<z.ZodBoolean>;
10
+ years: z.ZodDefault<z.ZodNumber>;
11
+ discountCode: z.ZodOptional<z.ZodString>;
12
+ }, "strip", z.ZodTypeAny, {
13
+ preferredName: string;
14
+ tld: "xyz" | "com" | "ai" | "org" | "io" | "net" | "co" | "app";
15
+ registerBasename: boolean;
16
+ registerEns: boolean;
17
+ emailEnabled: boolean;
18
+ years: number;
19
+ basenameLabel?: string | undefined;
20
+ ensLabel?: string | undefined;
21
+ discountCode?: string | undefined;
22
+ }, {
23
+ preferredName: string;
24
+ tld?: "xyz" | "com" | "ai" | "org" | "io" | "net" | "co" | "app" | undefined;
25
+ registerBasename?: boolean | undefined;
26
+ basenameLabel?: string | undefined;
27
+ registerEns?: boolean | undefined;
28
+ ensLabel?: string | undefined;
29
+ emailEnabled?: boolean | undefined;
30
+ years?: number | undefined;
31
+ discountCode?: string | undefined;
32
+ }>;
33
+ declare const SearchSchema: z.ZodObject<{
34
+ q: z.ZodOptional<z.ZodString>;
35
+ framework: z.ZodOptional<z.ZodEnum<["agentkit", "eliza", "crewai", "langchain", "openai", "anthropic"]>>;
36
+ capability: z.ZodOptional<z.ZodString>;
37
+ limit: z.ZodDefault<z.ZodNumber>;
38
+ }, "strip", z.ZodTypeAny, {
39
+ limit: number;
40
+ q?: string | undefined;
41
+ framework?: "agentkit" | "eliza" | "crewai" | "langchain" | "openai" | "anthropic" | undefined;
42
+ capability?: string | undefined;
43
+ }, {
44
+ q?: string | undefined;
45
+ framework?: "agentkit" | "eliza" | "crewai" | "langchain" | "openai" | "anthropic" | undefined;
46
+ capability?: string | undefined;
47
+ limit?: number | undefined;
48
+ }>;
49
+ declare const RenewalStatusSchema: z.ZodObject<{
50
+ agentId: z.ZodString;
51
+ }, "strip", z.ZodTypeAny, {
52
+ agentId: string;
53
+ }, {
54
+ agentId: string;
55
+ }>;
56
+ interface WalletProvider {
57
+ getAddress(): string;
58
+ signTypedData?: (data: unknown) => Promise<string>;
59
+ signMessage?: (message: string) => Promise<string>;
60
+ sendTransaction?: (tx: unknown) => Promise<string>;
61
+ }
62
+ export interface AgentDomainActionProviderOptions {
63
+ apiUrl?: string;
64
+ apiKey?: string;
65
+ baseRpcUrl?: string;
66
+ renewalVaultAddress?: string;
67
+ network?: 'base' | 'base-sepolia';
68
+ }
69
+ export declare class AgentDomainActionProvider {
70
+ readonly name = "agentdomain";
71
+ private readonly apiUrl;
72
+ private readonly apiKey?;
73
+ private readonly baseRpcUrl;
74
+ private readonly renewalVaultAddress?;
75
+ private readonly network;
76
+ constructor(opts?: AgentDomainActionProviderOptions);
77
+ private createAgentDomain;
78
+ getActions(): ({
79
+ name: string;
80
+ description: string;
81
+ schema: z.ZodObject<{
82
+ preferredName: z.ZodString;
83
+ tld: z.ZodDefault<z.ZodEnum<["xyz", "com", "ai", "org", "io", "net", "co", "app"]>>;
84
+ registerBasename: z.ZodDefault<z.ZodBoolean>;
85
+ basenameLabel: z.ZodOptional<z.ZodString>;
86
+ registerEns: z.ZodDefault<z.ZodBoolean>;
87
+ ensLabel: z.ZodOptional<z.ZodString>;
88
+ emailEnabled: z.ZodDefault<z.ZodBoolean>;
89
+ years: z.ZodDefault<z.ZodNumber>;
90
+ discountCode: z.ZodOptional<z.ZodString>;
91
+ }, "strip", z.ZodTypeAny, {
92
+ preferredName: string;
93
+ tld: "xyz" | "com" | "ai" | "org" | "io" | "net" | "co" | "app";
94
+ registerBasename: boolean;
95
+ registerEns: boolean;
96
+ emailEnabled: boolean;
97
+ years: number;
98
+ basenameLabel?: string | undefined;
99
+ ensLabel?: string | undefined;
100
+ discountCode?: string | undefined;
101
+ }, {
102
+ preferredName: string;
103
+ tld?: "xyz" | "com" | "ai" | "org" | "io" | "net" | "co" | "app" | undefined;
104
+ registerBasename?: boolean | undefined;
105
+ basenameLabel?: string | undefined;
106
+ registerEns?: boolean | undefined;
107
+ ensLabel?: string | undefined;
108
+ emailEnabled?: boolean | undefined;
109
+ years?: number | undefined;
110
+ discountCode?: string | undefined;
111
+ }>;
112
+ invoke: (walletProvider: WalletProvider, args: z.infer<typeof QuoteSchema>) => Promise<string>;
113
+ } | {
114
+ name: string;
115
+ description: string;
116
+ schema: z.ZodObject<{
117
+ q: z.ZodOptional<z.ZodString>;
118
+ framework: z.ZodOptional<z.ZodEnum<["agentkit", "eliza", "crewai", "langchain", "openai", "anthropic"]>>;
119
+ capability: z.ZodOptional<z.ZodString>;
120
+ limit: z.ZodDefault<z.ZodNumber>;
121
+ }, "strip", z.ZodTypeAny, {
122
+ limit: number;
123
+ q?: string | undefined;
124
+ framework?: "agentkit" | "eliza" | "crewai" | "langchain" | "openai" | "anthropic" | undefined;
125
+ capability?: string | undefined;
126
+ }, {
127
+ q?: string | undefined;
128
+ framework?: "agentkit" | "eliza" | "crewai" | "langchain" | "openai" | "anthropic" | undefined;
129
+ capability?: string | undefined;
130
+ limit?: number | undefined;
131
+ }>;
132
+ invoke: (walletProvider: WalletProvider, args: z.infer<typeof SearchSchema>) => Promise<string>;
133
+ } | {
134
+ name: string;
135
+ description: string;
136
+ schema: z.ZodObject<{
137
+ agentId: z.ZodString;
138
+ }, "strip", z.ZodTypeAny, {
139
+ agentId: string;
140
+ }, {
141
+ agentId: string;
142
+ }>;
143
+ invoke: (walletProvider: WalletProvider, args: z.infer<typeof RenewalStatusSchema>) => Promise<string>;
144
+ })[];
145
+ private register;
146
+ private renewalStatus;
147
+ private fundRenewal;
148
+ private enableAutoRenew;
149
+ private reconfigureSsl;
150
+ private listDns;
151
+ private createDns;
152
+ private updateDns;
153
+ private deleteDns;
154
+ private withdrawRenewal;
155
+ private getServicePlan;
156
+ private purchaseServicePlan;
157
+ private quote;
158
+ private search;
159
+ private sendEmail;
160
+ private listEmail;
161
+ }
162
+ export default AgentDomainActionProvider;
package/dist/index.js ADDED
@@ -0,0 +1,404 @@
1
+ import { z } from 'zod';
2
+ import { AgentDomain } from '@agentdomain/sdk';
3
+ import { AGENTDOMAIN_API_BASE_URL, SUPPORTED_FRAMEWORKS, SUPPORTED_TLDS, } from '@agentdomain/shared/constants';
4
+ import { createPublicClient, createWalletClient, http, encodeFunctionData, } from 'viem';
5
+ import { base, baseSepolia } from 'viem/chains';
6
+ const RegisterSchema = z.object({
7
+ preferredName: z.string().min(3).max(63),
8
+ tld: z.enum(SUPPORTED_TLDS).default('xyz'),
9
+ registerBasename: z.boolean().default(true),
10
+ basenameLabel: z.string().min(3).max(63).optional(),
11
+ registerEns: z.boolean().default(false),
12
+ ensLabel: z.string().min(3).max(63).optional(),
13
+ ownerAddress: z
14
+ .string()
15
+ .regex(/^0x[a-fA-F0-9]{40}$/)
16
+ .optional(),
17
+ emailEnabled: z.boolean().default(false),
18
+ dnsTarget: z.string().url().optional(),
19
+ years: z.number().int().min(1).max(10).default(1),
20
+ autoRenew: z.boolean().default(false),
21
+ discountCode: z.string().max(50).optional(),
22
+ });
23
+ const QuoteSchema = z.object({
24
+ preferredName: z.string(),
25
+ tld: z.enum(SUPPORTED_TLDS).default('xyz'),
26
+ registerBasename: z.boolean().default(true),
27
+ basenameLabel: z.string().min(3).max(63).optional(),
28
+ registerEns: z.boolean().default(false),
29
+ ensLabel: z.string().min(3).max(63).optional(),
30
+ emailEnabled: z.boolean().default(false),
31
+ years: z.number().int().min(1).max(10).default(1),
32
+ discountCode: z.string().max(50).optional(),
33
+ });
34
+ const SearchSchema = z.object({
35
+ q: z.string().optional(),
36
+ framework: z.enum(SUPPORTED_FRAMEWORKS).optional(),
37
+ capability: z.string().optional(),
38
+ limit: z.number().default(20),
39
+ });
40
+ const SendEmailSchema = z.object({
41
+ agentId: z.string(),
42
+ to: z.union([z.string().email(), z.array(z.string().email()).min(1).max(10)]),
43
+ subject: z.string().min(1).max(200),
44
+ text: z.string().min(1).max(20_000),
45
+ });
46
+ const ListEmailSchema = z.object({
47
+ agentId: z.string(),
48
+ limit: z.number().int().min(1).max(100).default(20),
49
+ });
50
+ const RenewalStatusSchema = z.object({
51
+ agentId: z.string().min(1),
52
+ });
53
+ const FundRenewalSchema = z.object({
54
+ agentId: z.string().min(1),
55
+ amountUsdc: z.string().regex(/^\d+(\.\d{1,6})?$/, 'Use a USDC amount with up to 6 decimals'),
56
+ enableAutoRenew: z.boolean().default(false),
57
+ });
58
+ const EnableAutoRenewSchema = z.object({
59
+ agentId: z.string().min(1),
60
+ });
61
+ const SslReconfigureSchema = z.object({
62
+ agentId: z.string().min(1),
63
+ });
64
+ const DnsRecordTypeSchema = z.enum(['A', 'AAAA', 'ALIAS', 'CNAME', 'MX', 'TXT', 'NS', 'SRV']);
65
+ const ListDnsSchema = z.object({
66
+ agentId: z.string().min(1),
67
+ });
68
+ const CreateDnsSchema = z.object({
69
+ agentId: z.string().min(1),
70
+ type: DnsRecordTypeSchema,
71
+ name: z.string().min(1).max(253),
72
+ value: z.string().min(1).max(4096),
73
+ ttl: z.number().int().min(60).max(3600).default(3600),
74
+ priority: z.number().int().min(0).optional(),
75
+ });
76
+ const UpdateDnsSchema = CreateDnsSchema.partial().extend({
77
+ agentId: z.string().min(1),
78
+ recordId: z.string().min(1),
79
+ });
80
+ const DeleteDnsSchema = z.object({
81
+ agentId: z.string().min(1),
82
+ recordId: z.string().min(1),
83
+ });
84
+ const WithdrawRenewalSchema = z.object({
85
+ agentId: z.string().min(1),
86
+ amountUsdc: z.string().regex(/^\d+(\.\d{1,6})?$/, 'Use a USDC amount with up to 6 decimals'),
87
+ });
88
+ const ServicePlanStatusSchema = z.object({
89
+ agentId: z.string().min(1),
90
+ });
91
+ const PurchaseServicePlanSchema = z.object({
92
+ agentId: z.string().min(1),
93
+ plan: z.enum(['pro', 'enterprise']),
94
+ interval: z.enum(['monthly', 'yearly']),
95
+ autoRenew: z.boolean().default(false),
96
+ prepayPeriods: z.number().int().min(1).max(12).default(1),
97
+ });
98
+ export class AgentDomainActionProvider {
99
+ name = 'agentdomain';
100
+ apiUrl;
101
+ apiKey;
102
+ baseRpcUrl;
103
+ renewalVaultAddress;
104
+ network;
105
+ constructor(opts = {}) {
106
+ this.apiUrl = opts.apiUrl ?? AGENTDOMAIN_API_BASE_URL;
107
+ this.apiKey = opts.apiKey;
108
+ this.baseRpcUrl = opts.baseRpcUrl ?? 'https://mainnet.base.org';
109
+ this.renewalVaultAddress = opts.renewalVaultAddress;
110
+ this.network = opts.network ?? 'base';
111
+ }
112
+ createAgentDomain(walletProvider) {
113
+ const wallet = walletProvider.getAddress();
114
+ const chain = this.network === 'base-sepolia' ? baseSepolia : base;
115
+ const publicClient = createPublicClient({ chain, transport: http(this.baseRpcUrl) });
116
+ const walletClient = createWalletClient({
117
+ chain,
118
+ transport: http(this.baseRpcUrl),
119
+ account: {
120
+ address: wallet,
121
+ signTypedData: walletProvider.signTypedData,
122
+ signMessage: walletProvider.signMessage
123
+ ? (parameters) => walletProvider.signMessage(parameters.message)
124
+ : undefined,
125
+ },
126
+ });
127
+ const ad = new AgentDomain({
128
+ apiUrl: this.apiUrl,
129
+ apiKey: this.apiKey,
130
+ network: this.network,
131
+ renewalVaultAddress: this.renewalVaultAddress,
132
+ walletClient: walletClient,
133
+ publicClient: publicClient,
134
+ });
135
+ return { ad, wallet, walletClient, publicClient, chain };
136
+ }
137
+ getActions() {
138
+ return [
139
+ {
140
+ name: 'register_agent_identity',
141
+ description: 'Register a complete agent identity bundle on AgentDomain. Domain, DNS, SSL certification, and service fee are mandatory. Set registerBasename/registerEns/emailEnabled false to skip those optional costs. Pays in USDC on Base.',
142
+ schema: RegisterSchema,
143
+ invoke: this.register.bind(this),
144
+ },
145
+ {
146
+ name: 'quote_agent_registration',
147
+ description: 'Price an agent identity registration before committing. Quote includes mandatory SSL certification fee; optional Basename, ENS, and email only charge when enabled.',
148
+ schema: QuoteSchema,
149
+ invoke: this.quote.bind(this),
150
+ },
151
+ {
152
+ name: 'search_agents',
153
+ description: 'Search the public AgentDomain registry.',
154
+ schema: SearchSchema,
155
+ invoke: this.search.bind(this),
156
+ },
157
+ {
158
+ name: 'send_agent_email',
159
+ description: 'Send text-only email from an email-enabled agent via AWS SES.',
160
+ schema: SendEmailSchema,
161
+ invoke: this.sendEmail.bind(this),
162
+ },
163
+ {
164
+ name: 'list_agent_email',
165
+ description: 'Query text-only agent email and extracted verification codes.',
166
+ schema: ListEmailSchema,
167
+ invoke: this.listEmail.bind(this),
168
+ },
169
+ {
170
+ name: 'get_renewal_status',
171
+ description: 'Get exact next renewal amount, shortfall, vault balance, expiry date, and auto-renew state for an AgentDomain identity.',
172
+ schema: RenewalStatusSchema,
173
+ invoke: this.renewalStatus.bind(this),
174
+ },
175
+ {
176
+ name: 'fund_renewal_vault',
177
+ description: 'Deposit USDC from the connected wallet into one AgentID renewal vault. Anyone can fund; only the AgentID owner can withdraw or enable auto-renew. Call get_renewal_status first and usually deposit the returned shortfall.',
178
+ schema: FundRenewalSchema,
179
+ invoke: this.fundRenewal.bind(this),
180
+ },
181
+ {
182
+ name: 'enable_auto_renew',
183
+ description: 'Enable RenewalVault auto-renew. Requires the wallet provider to be the AgentID NFT owner and support sendTransaction.',
184
+ schema: EnableAutoRenewSchema,
185
+ invoke: this.enableAutoRenew.bind(this),
186
+ },
187
+ {
188
+ name: 'reconfigure_ssl',
189
+ description: 'Rebuild the Cloudflare SaaS SSL hostname and sync the required Spaceship DNS validation records for an existing agent.',
190
+ schema: SslReconfigureSchema,
191
+ invoke: this.reconfigureSsl.bind(this),
192
+ },
193
+ {
194
+ name: 'list_dns_records',
195
+ description: 'List DNS records for an AgentDomain identity.',
196
+ schema: ListDnsSchema,
197
+ invoke: this.listDns.bind(this),
198
+ },
199
+ {
200
+ name: 'create_dns_record',
201
+ description: 'Create a user-managed DNS record and sync it to the domain provider.',
202
+ schema: CreateDnsSchema,
203
+ invoke: this.createDns.bind(this),
204
+ },
205
+ {
206
+ name: 'update_dns_record',
207
+ description: 'Update a user-managed DNS record and sync it to the domain provider.',
208
+ schema: UpdateDnsSchema,
209
+ invoke: this.updateDns.bind(this),
210
+ },
211
+ {
212
+ name: 'delete_dns_record',
213
+ description: 'Delete a user-managed DNS record and sync the domain provider state.',
214
+ schema: DeleteDnsSchema,
215
+ invoke: this.deleteDns.bind(this),
216
+ },
217
+ {
218
+ name: 'withdraw_renewal_vault',
219
+ description: 'Withdraw unused USDC from an AgentID renewal vault. Requires the AgentID NFT owner wallet.',
220
+ schema: WithdrawRenewalSchema,
221
+ invoke: this.withdrawRenewal.bind(this),
222
+ },
223
+ {
224
+ name: 'get_service_plan',
225
+ description: 'Get the current per-agent service plan, limits, and billing state.',
226
+ schema: ServicePlanStatusSchema,
227
+ invoke: this.getServicePlan.bind(this),
228
+ },
229
+ {
230
+ name: 'purchase_service_plan',
231
+ description: 'Upgrade one agent to AgentDomain Pro or Enterprise using x402 USDC payment.',
232
+ schema: PurchaseServicePlanSchema,
233
+ invoke: this.purchaseServicePlan.bind(this),
234
+ },
235
+ ];
236
+ }
237
+ async register(walletProvider, args) {
238
+ const { ad, wallet } = this.createAgentDomain(walletProvider);
239
+ const result = await ad.register({ ...args, wallet });
240
+ let autoRenewMsg = '';
241
+ if (args.autoRenew && this.renewalVaultAddress) {
242
+ try {
243
+ if (walletProvider.sendTransaction) {
244
+ const data = encodeFunctionData({
245
+ abi: [
246
+ {
247
+ type: 'function',
248
+ name: 'setAutoRenew',
249
+ inputs: [
250
+ { name: 'tokenId', type: 'uint256' },
251
+ { name: 'enabled', type: 'bool' },
252
+ ],
253
+ },
254
+ ],
255
+ functionName: 'setAutoRenew',
256
+ args: [BigInt(result.nftTokenId), true],
257
+ });
258
+ const txHash = await walletProvider.sendTransaction({
259
+ to: this.renewalVaultAddress,
260
+ data,
261
+ });
262
+ autoRenewMsg = ` Auto-renew enabled via tx ${txHash}.`;
263
+ }
264
+ else {
265
+ autoRenewMsg =
266
+ ' (Cannot enable auto-renew because walletProvider lacks sendTransaction).';
267
+ }
268
+ }
269
+ catch (e) {
270
+ autoRenewMsg = ` Failed to enable auto-renew: ${String(e)}`;
271
+ }
272
+ }
273
+ return `Registered identity ${result.domain} (token #${result.nftTokenId}).${autoRenewMsg}`;
274
+ }
275
+ async renewalStatus(walletProvider, args) {
276
+ const { ad } = this.createAgentDomain(walletProvider);
277
+ const status = await ad.getRenewalStatus(args.agentId);
278
+ return `Renewal status for ${status.domain}: next renewal $${status.nextRenewalAmountUsdc}, vault balance $${status.vaultBalanceUsdc}, shortfall $${status.shortfallUsdc}, expires ${status.expiresAt ?? 'unknown'}, renewable from ${status.renewableFrom ?? 'unknown'}, auto-renew ${status.autoRenewEnabled ? 'enabled' : 'off'}.`;
279
+ }
280
+ async fundRenewal(walletProvider, args) {
281
+ const { ad } = this.createAgentDomain(walletProvider);
282
+ const result = await ad.fundRenewalVault(args.agentId, args.amountUsdc);
283
+ let message = `Deposited $${args.amountUsdc} USDC into the renewal vault for ${result.domain}. Vault balance is now ${result.vaultBalance} atomic USDC.`;
284
+ if (args.enableAutoRenew) {
285
+ message += ` ${await this.enableAutoRenew(walletProvider, { agentId: args.agentId })}`;
286
+ }
287
+ return message;
288
+ }
289
+ async enableAutoRenew(walletProvider, args) {
290
+ if (!this.renewalVaultAddress) {
291
+ throw new Error('renewalVaultAddress is required to enable auto-renew.');
292
+ }
293
+ if (!walletProvider.sendTransaction) {
294
+ throw new Error('walletProvider.sendTransaction is required to enable auto-renew.');
295
+ }
296
+ const { ad, wallet } = this.createAgentDomain(walletProvider);
297
+ const status = await ad.getRenewalStatus(args.agentId);
298
+ if (!status.tokenId)
299
+ throw new Error('AgentID NFT is not minted yet.');
300
+ if (status.ownerAddress && status.ownerAddress.toLowerCase() !== wallet.toLowerCase()) {
301
+ throw new Error(`Only the AgentID NFT owner (${status.ownerAddress}) can enable auto-renew.`);
302
+ }
303
+ const data = encodeFunctionData({
304
+ abi: [
305
+ {
306
+ type: 'function',
307
+ name: 'setAutoRenew',
308
+ inputs: [
309
+ { name: 'tokenId', type: 'uint256' },
310
+ { name: 'enabled', type: 'bool' },
311
+ ],
312
+ },
313
+ ],
314
+ functionName: 'setAutoRenew',
315
+ args: [BigInt(status.tokenId), true],
316
+ });
317
+ const txHash = await walletProvider.sendTransaction({
318
+ to: this.renewalVaultAddress,
319
+ data,
320
+ });
321
+ return `Auto-renew enabled via tx ${txHash}.`;
322
+ }
323
+ async reconfigureSsl(walletProvider, args) {
324
+ const { ad } = this.createAgentDomain(walletProvider);
325
+ const result = await ad.reconfigureSsl(args.agentId);
326
+ return `SSL reconfigured for ${result.domain}. Cloudflare hostname ${result.cloudflareCustomHostnameId} is ${result.sslStatus} and ${result.validationRecordsCount} validation record(s) were synced.`;
327
+ }
328
+ async listDns(walletProvider, args) {
329
+ const { ad } = this.createAgentDomain(walletProvider);
330
+ const records = await ad.listDnsRecords(args.agentId);
331
+ return JSON.stringify(records, null, 2);
332
+ }
333
+ async createDns(walletProvider, args) {
334
+ const { ad } = this.createAgentDomain(walletProvider);
335
+ const { agentId, ...record } = args;
336
+ const result = await ad.createDnsRecord(agentId, record);
337
+ return `Created ${result.type} record ${result.name} -> ${result.value}.`;
338
+ }
339
+ async updateDns(walletProvider, args) {
340
+ const { ad } = this.createAgentDomain(walletProvider);
341
+ const { agentId, recordId, ...record } = args;
342
+ const result = await ad.updateDnsRecord(agentId, recordId, record);
343
+ return `Updated ${result.type} record ${result.name} -> ${result.value}.`;
344
+ }
345
+ async deleteDns(walletProvider, args) {
346
+ const { ad } = this.createAgentDomain(walletProvider);
347
+ await ad.deleteDnsRecord(args.agentId, args.recordId);
348
+ return `Deleted DNS record ${args.recordId}.`;
349
+ }
350
+ async withdrawRenewal(walletProvider, args) {
351
+ if (!walletProvider.sendTransaction) {
352
+ throw new Error('walletProvider.sendTransaction is required to withdraw vault funds.');
353
+ }
354
+ const { ad } = this.createAgentDomain(walletProvider);
355
+ const tx = await ad.withdrawFromVault(args.agentId, args.amountUsdc);
356
+ const txHash = await walletProvider.sendTransaction({
357
+ to: tx.to,
358
+ data: tx.data,
359
+ value: tx.value,
360
+ chainId: tx.chainId,
361
+ });
362
+ return `Submitted renewal vault withdrawal for $${args.amountUsdc} USDC via tx ${txHash}.`;
363
+ }
364
+ async getServicePlan(walletProvider, args) {
365
+ const { ad } = this.createAgentDomain(walletProvider);
366
+ const result = await ad.getServicePlan(args.agentId);
367
+ return `Service plan for ${result.domain}: ${result.entitlement.plan} (${result.entitlement.status}), email ${result.entitlement.limits.emailPerHour}/hour and ${result.entitlement.limits.emailPerDay}/day, ${result.entitlement.limits.apiKeys} API key(s), ${result.entitlement.limits.dnsRecords} DNS records.`;
368
+ }
369
+ async purchaseServicePlan(walletProvider, args) {
370
+ const { ad } = this.createAgentDomain(walletProvider);
371
+ const result = await ad.purchaseServicePlan(args);
372
+ return `Purchased ${result.entitlement.plan} ${args.interval} for ${result.domain}. Current period ends ${result.entitlement.currentPeriodEnd ?? 'unknown'}.`;
373
+ }
374
+ async quote(walletProvider, args) {
375
+ const { ad } = this.createAgentDomain(walletProvider);
376
+ const q = await ad.quote(args);
377
+ const emailPart = Number(q.emailFeeUsdc) > 0 ? ` + email $${q.emailFeeUsdc}` : '';
378
+ const basenamePart = Number(q.basenameCostUsdc) > 0 ? ` + Basename $${q.basenameCostUsdc}` : '';
379
+ const ensPart = Number(q.ensCostUsdc) > 0 ? ` + ENS $${q.ensCostUsdc}` : '';
380
+ return `Total: $${q.totalUsdc} USDC (domain $${q.domainCostUsdc} + SSL $${q.sslCertificationFeeUsdc} + service $${q.serviceFeeUsdc}${emailPart}${basenamePart}${ensPart})`;
381
+ }
382
+ async search(walletProvider, args) {
383
+ const { ad } = this.createAgentDomain(walletProvider);
384
+ const result = await ad.search(args);
385
+ return `Found ${result.total} agents. First ${result.items.length}: ${result.items
386
+ .map((a) => a.domain)
387
+ .join(', ')}`;
388
+ }
389
+ async sendEmail(walletProvider, args) {
390
+ const { ad } = this.createAgentDomain(walletProvider);
391
+ const result = await ad.sendEmail(args.agentId, {
392
+ to: args.to,
393
+ subject: args.subject,
394
+ text: args.text,
395
+ });
396
+ return `Email sent via SES: ${result.id}`;
397
+ }
398
+ async listEmail(walletProvider, args) {
399
+ const { ad } = this.createAgentDomain(walletProvider);
400
+ const result = await ad.listEmail(args.agentId, { limit: args.limit });
401
+ return JSON.stringify(result, null, 2);
402
+ }
403
+ }
404
+ export default AgentDomainActionProvider;
package/package.json ADDED
@@ -0,0 +1,41 @@
1
+ {
2
+ "name": "@agentdomain/agentkit-plugin",
3
+ "version": "0.1.0",
4
+ "description": "Coinbase AgentKit action provider for AgentDomain",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "main": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/index.js"
13
+ }
14
+ },
15
+ "files": [
16
+ "dist",
17
+ "README.md",
18
+ "package.json"
19
+ ],
20
+ "publishConfig": {
21
+ "access": "public"
22
+ },
23
+ "scripts": {
24
+ "build": "tsc",
25
+ "prepublishOnly": "pnpm run build",
26
+ "typecheck": "tsc --noEmit",
27
+ "lint": "echo \"no lint\""
28
+ },
29
+ "dependencies": {
30
+ "@agentdomain/sdk": "workspace:^",
31
+ "@agentdomain/shared": "workspace:^",
32
+ "viem": "^2.21.55",
33
+ "zod": "^3.24.1"
34
+ },
35
+ "peerDependencies": {
36
+ "@coinbase/agentkit": "^0.1.0"
37
+ },
38
+ "devDependencies": {
39
+ "typescript": "^5.7.2"
40
+ }
41
+ }