@agentdomain/agentkit-plugin 0.4.0 → 0.5.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 +2 -2
- package/dist/index.d.ts +4 -2
- package/dist/index.js +121 -113
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -10,10 +10,10 @@ The provider exposes actions for:
|
|
|
10
10
|
|
|
11
11
|
- Agent identity registration and quote
|
|
12
12
|
- Registry search
|
|
13
|
-
- Email send/list/batch, monthly usage, signed inbound webhooks, primary address updates, and Starter/Pro/Enterprise aliases
|
|
13
|
+
- Email send/list/delete/batch, monthly usage, signed inbound webhooks, primary address updates, and Starter/Pro/Enterprise aliases
|
|
14
14
|
- DNS list/create/update/delete
|
|
15
15
|
- SSL reconfiguration
|
|
16
16
|
- RenewalVault status, funding, auto-renew, and withdrawal
|
|
17
|
-
- Per-agent Starter, Pro, and Enterprise Premium
|
|
17
|
+
- Per-agent Starter, Pro, and exact Enterprise-tier Premium Plan purchase and renewal selection
|
|
18
18
|
|
|
19
19
|
Default API base: `https://agentdomain.app/api/v1`.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { z } from
|
|
1
|
+
import { z } from 'zod';
|
|
2
2
|
declare const QuoteSchema: z.ZodObject<{
|
|
3
3
|
preferredName: z.ZodString;
|
|
4
4
|
tld: z.ZodDefault<z.ZodEnum<["xyz", "com", "ai", "org", "io", "net", "co", "app"]>>;
|
|
@@ -67,7 +67,7 @@ export interface AgentDomainActionProviderOptions {
|
|
|
67
67
|
apiKey?: string;
|
|
68
68
|
baseRpcUrl?: string;
|
|
69
69
|
renewalVaultAddress?: string;
|
|
70
|
-
network?:
|
|
70
|
+
network?: 'base' | 'base-sepolia';
|
|
71
71
|
}
|
|
72
72
|
export declare class AgentDomainActionProvider {
|
|
73
73
|
readonly name = "agentdomain";
|
|
@@ -161,10 +161,12 @@ export declare class AgentDomainActionProvider {
|
|
|
161
161
|
private getServicePlan;
|
|
162
162
|
private purchaseServicePlan;
|
|
163
163
|
private setRegistryVisibility;
|
|
164
|
+
private scheduleServicePlanRenewal;
|
|
164
165
|
private quote;
|
|
165
166
|
private search;
|
|
166
167
|
private sendEmail;
|
|
167
168
|
private listEmail;
|
|
169
|
+
private deleteEmailMessage;
|
|
168
170
|
private sendEmailBatch;
|
|
169
171
|
private emailUsage;
|
|
170
172
|
private configureEmailWebhook;
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { z } from
|
|
2
|
-
import { AgentDomain } from
|
|
3
|
-
import { AGENTDOMAIN_API_BASE_URL, SERVICE_PLAN_KEYS, SUPPORTED_FRAMEWORKS, SUPPORTED_TLDS, } from
|
|
4
|
-
import { createPublicClient, createWalletClient, http, encodeFunctionData, } from
|
|
5
|
-
import { base, baseSepolia } from
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { AgentDomain } from '@agentdomain/sdk';
|
|
3
|
+
import { AGENTDOMAIN_API_BASE_URL, SERVICE_PLAN_KEYS, SUPPORTED_FRAMEWORKS, SUPPORTED_TLDS, } from '@agentdomain/shared/constants';
|
|
4
|
+
import { createPublicClient, createWalletClient, http, encodeFunctionData, } from 'viem';
|
|
5
|
+
import { base, baseSepolia } from 'viem/chains';
|
|
6
6
|
const RegisterSchema = z.object({
|
|
7
7
|
preferredName: z.string().min(3).max(63),
|
|
8
|
-
tld: z.enum(SUPPORTED_TLDS).default(
|
|
8
|
+
tld: z.enum(SUPPORTED_TLDS).default('xyz'),
|
|
9
9
|
registerBasename: z.boolean().default(true),
|
|
10
10
|
basenameLabel: z.string().min(3).max(63).optional(),
|
|
11
11
|
registerEns: z.boolean().default(false),
|
|
@@ -24,11 +24,11 @@ const RegisterSchema = z.object({
|
|
|
24
24
|
dnsTarget: z.string().url().optional(),
|
|
25
25
|
years: z.number().int().min(1).max(10).default(1),
|
|
26
26
|
autoRenew: z.boolean().default(false),
|
|
27
|
-
premiumPlan: z.enum(SERVICE_PLAN_KEYS).default(
|
|
27
|
+
premiumPlan: z.enum(SERVICE_PLAN_KEYS).default('included'),
|
|
28
28
|
});
|
|
29
29
|
const QuoteSchema = z.object({
|
|
30
30
|
preferredName: z.string(),
|
|
31
|
-
tld: z.enum(SUPPORTED_TLDS).default(
|
|
31
|
+
tld: z.enum(SUPPORTED_TLDS).default('xyz'),
|
|
32
32
|
registerBasename: z.boolean().default(true),
|
|
33
33
|
basenameLabel: z.string().min(3).max(63).optional(),
|
|
34
34
|
registerEns: z.boolean().default(false),
|
|
@@ -41,7 +41,7 @@ const QuoteSchema = z.object({
|
|
|
41
41
|
.regex(/^[a-z0-9](?:[a-z0-9._+-]{0,62}[a-z0-9])?$/)
|
|
42
42
|
.optional(),
|
|
43
43
|
years: z.number().int().min(1).max(10).default(1),
|
|
44
|
-
premiumPlan: z.enum(SERVICE_PLAN_KEYS).default(
|
|
44
|
+
premiumPlan: z.enum(SERVICE_PLAN_KEYS).default('included'),
|
|
45
45
|
});
|
|
46
46
|
const SearchSchema = z.object({
|
|
47
47
|
q: z.string().optional(),
|
|
@@ -60,6 +60,10 @@ const ListEmailSchema = z.object({
|
|
|
60
60
|
agentId: z.string(),
|
|
61
61
|
limit: z.number().int().min(1).max(100).default(20),
|
|
62
62
|
});
|
|
63
|
+
const DeleteEmailMessageSchema = z.object({
|
|
64
|
+
agentId: z.string().uuid(),
|
|
65
|
+
messageId: z.string().uuid(),
|
|
66
|
+
});
|
|
63
67
|
const BatchEmailSchema = z.object({
|
|
64
68
|
agentId: z.string(),
|
|
65
69
|
messages: z.array(SendEmailSchema.omit({ agentId: true })).max(100),
|
|
@@ -69,7 +73,7 @@ const EmailUsageSchema = z.object({ agentId: z.string() });
|
|
|
69
73
|
const EmailWebhookSchema = z.object({
|
|
70
74
|
agentId: z.string(),
|
|
71
75
|
url: z.string().url(),
|
|
72
|
-
payloadMode: z.enum([
|
|
76
|
+
payloadMode: z.enum(['metadata', 'inline_text']).default('metadata'),
|
|
73
77
|
enabled: z.boolean().default(true),
|
|
74
78
|
});
|
|
75
79
|
const RenewalStatusSchema = z.object({
|
|
@@ -77,9 +81,7 @@ const RenewalStatusSchema = z.object({
|
|
|
77
81
|
});
|
|
78
82
|
const FundRenewalSchema = z.object({
|
|
79
83
|
agentId: z.string().min(1),
|
|
80
|
-
amountUsdc: z
|
|
81
|
-
.string()
|
|
82
|
-
.regex(/^\d+(\.\d{1,6})?$/, "Use a USDC amount with up to 6 decimals"),
|
|
84
|
+
amountUsdc: z.string().regex(/^\d+(\.\d{1,6})?$/, 'Use a USDC amount with up to 6 decimals'),
|
|
83
85
|
enableAutoRenew: z.boolean().default(false),
|
|
84
86
|
});
|
|
85
87
|
const EnableAutoRenewSchema = z.object({
|
|
@@ -88,16 +90,7 @@ const EnableAutoRenewSchema = z.object({
|
|
|
88
90
|
const SslReconfigureSchema = z.object({
|
|
89
91
|
agentId: z.string().min(1),
|
|
90
92
|
});
|
|
91
|
-
const DnsRecordTypeSchema = z.enum([
|
|
92
|
-
"A",
|
|
93
|
-
"AAAA",
|
|
94
|
-
"ALIAS",
|
|
95
|
-
"CNAME",
|
|
96
|
-
"MX",
|
|
97
|
-
"TXT",
|
|
98
|
-
"NS",
|
|
99
|
-
"SRV",
|
|
100
|
-
]);
|
|
93
|
+
const DnsRecordTypeSchema = z.enum(['A', 'AAAA', 'ALIAS', 'CNAME', 'MX', 'TXT', 'NS', 'SRV']);
|
|
101
94
|
const ListDnsSchema = z.object({
|
|
102
95
|
agentId: z.string().min(1),
|
|
103
96
|
});
|
|
@@ -119,22 +112,25 @@ const DeleteDnsSchema = z.object({
|
|
|
119
112
|
});
|
|
120
113
|
const WithdrawRenewalSchema = z.object({
|
|
121
114
|
agentId: z.string().min(1),
|
|
122
|
-
amountUsdc: z
|
|
123
|
-
.string()
|
|
124
|
-
.regex(/^\d+(\.\d{1,6})?$/, "Use a USDC amount with up to 6 decimals"),
|
|
115
|
+
amountUsdc: z.string().regex(/^\d+(\.\d{1,6})?$/, 'Use a USDC amount with up to 6 decimals'),
|
|
125
116
|
});
|
|
126
117
|
const ServicePlanStatusSchema = z.object({
|
|
127
118
|
agentId: z.string().min(1),
|
|
128
119
|
});
|
|
129
120
|
const PurchaseServicePlanSchema = z.object({
|
|
130
121
|
agentId: z.string().min(1),
|
|
131
|
-
plan: z.enum([
|
|
122
|
+
plan: z.enum(['starter', 'pro', 'enterprise']),
|
|
132
123
|
planSku: z.custom().optional(),
|
|
133
124
|
});
|
|
134
125
|
const SetRegistryVisibilitySchema = z.object({
|
|
135
126
|
agentId: z.string().min(1),
|
|
136
127
|
registryHidden: z.boolean(),
|
|
137
128
|
});
|
|
129
|
+
const ScheduleServicePlanRenewalSchema = z.object({
|
|
130
|
+
agentId: z.string().uuid(),
|
|
131
|
+
plan: z.enum(['included', 'starter', 'pro', 'enterprise']),
|
|
132
|
+
planSku: z.custom(),
|
|
133
|
+
});
|
|
138
134
|
const UpdatePrimaryEmailSchema = z.object({
|
|
139
135
|
agentId: z.string().min(1),
|
|
140
136
|
username: z
|
|
@@ -149,7 +145,7 @@ const DeleteEmailAliasSchema = z.object({
|
|
|
149
145
|
emailAddress: z.string().email(),
|
|
150
146
|
});
|
|
151
147
|
export class AgentDomainActionProvider {
|
|
152
|
-
name =
|
|
148
|
+
name = 'agentdomain';
|
|
153
149
|
apiUrl;
|
|
154
150
|
apiKey;
|
|
155
151
|
baseRpcUrl;
|
|
@@ -158,17 +154,14 @@ export class AgentDomainActionProvider {
|
|
|
158
154
|
constructor(opts = {}) {
|
|
159
155
|
this.apiUrl = opts.apiUrl ?? AGENTDOMAIN_API_BASE_URL;
|
|
160
156
|
this.apiKey = opts.apiKey;
|
|
161
|
-
this.baseRpcUrl = opts.baseRpcUrl ??
|
|
157
|
+
this.baseRpcUrl = opts.baseRpcUrl ?? 'https://mainnet.base.org';
|
|
162
158
|
this.renewalVaultAddress = opts.renewalVaultAddress;
|
|
163
|
-
this.network = opts.network ??
|
|
159
|
+
this.network = opts.network ?? 'base';
|
|
164
160
|
}
|
|
165
161
|
createAgentDomain(walletProvider) {
|
|
166
162
|
const wallet = walletProvider.getAddress();
|
|
167
|
-
const chain = this.network ===
|
|
168
|
-
const publicClient = createPublicClient({
|
|
169
|
-
chain,
|
|
170
|
-
transport: http(this.baseRpcUrl),
|
|
171
|
-
});
|
|
163
|
+
const chain = this.network === 'base-sepolia' ? baseSepolia : base;
|
|
164
|
+
const publicClient = createPublicClient({ chain, transport: http(this.baseRpcUrl) });
|
|
172
165
|
const walletClient = createWalletClient({
|
|
173
166
|
chain,
|
|
174
167
|
transport: http(this.baseRpcUrl),
|
|
@@ -193,140 +186,152 @@ export class AgentDomainActionProvider {
|
|
|
193
186
|
getActions() {
|
|
194
187
|
return [
|
|
195
188
|
{
|
|
196
|
-
name:
|
|
197
|
-
description:
|
|
189
|
+
name: 'register_agent_identity',
|
|
190
|
+
description: 'Register a complete agent identity bundle on AgentDomain. Domain, DNS, included email setup, SSL certification, AgentID NFT orchestration, and platform fee are included by default. Basename and ENS are optional paid add-ons. Pays in USDC on Base.',
|
|
198
191
|
schema: RegisterSchema,
|
|
199
192
|
invoke: this.register.bind(this),
|
|
200
193
|
},
|
|
201
194
|
{
|
|
202
|
-
name:
|
|
203
|
-
description:
|
|
195
|
+
name: 'quote_agent_registration',
|
|
196
|
+
description: 'Price an agent identity registration before committing. Quote includes the annual platform fee with email setup, SSL certification, and AgentID NFT orchestration; Basename and ENS only charge when enabled.',
|
|
204
197
|
schema: QuoteSchema,
|
|
205
198
|
invoke: this.quote.bind(this),
|
|
206
199
|
},
|
|
207
200
|
{
|
|
208
|
-
name:
|
|
209
|
-
description:
|
|
201
|
+
name: 'search_agents',
|
|
202
|
+
description: 'Search the public AgentDomain registry.',
|
|
210
203
|
schema: SearchSchema,
|
|
211
204
|
invoke: this.search.bind(this),
|
|
212
205
|
},
|
|
213
206
|
{
|
|
214
|
-
name:
|
|
215
|
-
description:
|
|
207
|
+
name: 'send_agent_email',
|
|
208
|
+
description: 'Send text-only email from an agent primary email or active alias via AWS SES.',
|
|
216
209
|
schema: SendEmailSchema,
|
|
217
210
|
invoke: this.sendEmail.bind(this),
|
|
218
211
|
},
|
|
219
212
|
{
|
|
220
|
-
name:
|
|
221
|
-
description:
|
|
213
|
+
name: 'list_agent_email',
|
|
214
|
+
description: 'Query text-only agent email and extracted verification codes.',
|
|
222
215
|
schema: ListEmailSchema,
|
|
223
216
|
invoke: this.listEmail.bind(this),
|
|
224
217
|
},
|
|
225
218
|
{
|
|
226
|
-
name:
|
|
227
|
-
description:
|
|
219
|
+
name: 'delete_agent_email',
|
|
220
|
+
description: 'Permanently delete one email message from an agent inbox.',
|
|
221
|
+
schema: DeleteEmailMessageSchema,
|
|
222
|
+
invoke: this.deleteEmailMessage.bind(this),
|
|
223
|
+
},
|
|
224
|
+
{
|
|
225
|
+
name: 'send_agent_email_batch',
|
|
226
|
+
description: 'Queue up to 100 emails in one API request.',
|
|
228
227
|
schema: BatchEmailSchema,
|
|
229
228
|
invoke: this.sendEmailBatch.bind(this),
|
|
230
229
|
},
|
|
231
230
|
{
|
|
232
|
-
name:
|
|
233
|
-
description:
|
|
231
|
+
name: 'get_agent_email_usage',
|
|
232
|
+
description: 'Get combined monthly sent and received email usage.',
|
|
234
233
|
schema: EmailUsageSchema,
|
|
235
234
|
invoke: this.emailUsage.bind(this),
|
|
236
235
|
},
|
|
237
236
|
{
|
|
238
|
-
name:
|
|
239
|
-
description:
|
|
237
|
+
name: 'configure_email_webhook',
|
|
238
|
+
description: 'Configure signed inbound email events for this agent.',
|
|
240
239
|
schema: EmailWebhookSchema,
|
|
241
240
|
invoke: this.configureEmailWebhook.bind(this),
|
|
242
241
|
},
|
|
243
242
|
{
|
|
244
|
-
name:
|
|
245
|
-
description:
|
|
243
|
+
name: 'get_renewal_status',
|
|
244
|
+
description: 'Get exact next renewal amount, shortfall, vault balance, expiry date, and auto-renew state for an AgentDomain identity.',
|
|
246
245
|
schema: RenewalStatusSchema,
|
|
247
246
|
invoke: this.renewalStatus.bind(this),
|
|
248
247
|
},
|
|
249
248
|
{
|
|
250
|
-
name:
|
|
251
|
-
description:
|
|
249
|
+
name: 'fund_renewal_vault',
|
|
250
|
+
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.',
|
|
252
251
|
schema: FundRenewalSchema,
|
|
253
252
|
invoke: this.fundRenewal.bind(this),
|
|
254
253
|
},
|
|
255
254
|
{
|
|
256
|
-
name:
|
|
257
|
-
description:
|
|
255
|
+
name: 'enable_auto_renew',
|
|
256
|
+
description: 'Enable RenewalVault auto-renew. Requires the wallet provider to be the AgentID NFT owner and support sendTransaction.',
|
|
258
257
|
schema: EnableAutoRenewSchema,
|
|
259
258
|
invoke: this.enableAutoRenew.bind(this),
|
|
260
259
|
},
|
|
261
260
|
{
|
|
262
|
-
name:
|
|
263
|
-
description:
|
|
261
|
+
name: 'reconfigure_ssl',
|
|
262
|
+
description: 'Rebuild the Cloudflare SaaS SSL hostname and sync the required Spaceship DNS validation records for an existing agent.',
|
|
264
263
|
schema: SslReconfigureSchema,
|
|
265
264
|
invoke: this.reconfigureSsl.bind(this),
|
|
266
265
|
},
|
|
267
266
|
{
|
|
268
|
-
name:
|
|
269
|
-
description:
|
|
267
|
+
name: 'list_dns_records',
|
|
268
|
+
description: 'List DNS records for an AgentDomain identity.',
|
|
270
269
|
schema: ListDnsSchema,
|
|
271
270
|
invoke: this.listDns.bind(this),
|
|
272
271
|
},
|
|
273
272
|
{
|
|
274
|
-
name:
|
|
275
|
-
description:
|
|
273
|
+
name: 'create_dns_record',
|
|
274
|
+
description: 'Create a user-managed DNS record and sync it to the domain provider.',
|
|
276
275
|
schema: CreateDnsSchema,
|
|
277
276
|
invoke: this.createDns.bind(this),
|
|
278
277
|
},
|
|
279
278
|
{
|
|
280
|
-
name:
|
|
281
|
-
description:
|
|
279
|
+
name: 'update_dns_record',
|
|
280
|
+
description: 'Update a user-managed DNS record and sync it to the domain provider.',
|
|
282
281
|
schema: UpdateDnsSchema,
|
|
283
282
|
invoke: this.updateDns.bind(this),
|
|
284
283
|
},
|
|
285
284
|
{
|
|
286
|
-
name:
|
|
287
|
-
description:
|
|
285
|
+
name: 'delete_dns_record',
|
|
286
|
+
description: 'Delete a user-managed DNS record and sync the domain provider state.',
|
|
288
287
|
schema: DeleteDnsSchema,
|
|
289
288
|
invoke: this.deleteDns.bind(this),
|
|
290
289
|
},
|
|
291
290
|
{
|
|
292
|
-
name:
|
|
293
|
-
description:
|
|
291
|
+
name: 'withdraw_renewal_vault',
|
|
292
|
+
description: 'Withdraw unused USDC from an AgentID renewal vault. Requires the AgentID NFT owner wallet.',
|
|
294
293
|
schema: WithdrawRenewalSchema,
|
|
295
294
|
invoke: this.withdrawRenewal.bind(this),
|
|
296
295
|
},
|
|
297
296
|
{
|
|
298
|
-
name:
|
|
299
|
-
description:
|
|
297
|
+
name: 'get_service_plan',
|
|
298
|
+
description: 'Get the current per-agent Premium Plan, limits, and billing state.',
|
|
300
299
|
schema: ServicePlanStatusSchema,
|
|
301
300
|
invoke: this.getServicePlan.bind(this),
|
|
302
301
|
},
|
|
303
302
|
{
|
|
304
|
-
name:
|
|
305
|
-
description:
|
|
303
|
+
name: 'purchase_service_plan',
|
|
304
|
+
description: 'Upgrade one agent to an AgentDomain Starter, Pro, or Enterprise Premium Plan using x402 USDC payment.',
|
|
306
305
|
schema: PurchaseServicePlanSchema,
|
|
307
306
|
invoke: this.purchaseServicePlan.bind(this),
|
|
308
307
|
},
|
|
309
308
|
{
|
|
310
|
-
name:
|
|
311
|
-
description:
|
|
309
|
+
name: 'set_registry_visibility',
|
|
310
|
+
description: 'Hide or show one agent in the public AgentDomain registry. Hiding requires an active paid Premium Plan.',
|
|
312
311
|
schema: SetRegistryVisibilitySchema,
|
|
313
312
|
invoke: this.setRegistryVisibility.bind(this),
|
|
314
313
|
},
|
|
315
314
|
{
|
|
316
|
-
name:
|
|
317
|
-
description:
|
|
315
|
+
name: 'schedule_service_plan_renewal',
|
|
316
|
+
description: 'Choose the exact Premium Plan SKU for the next identity renewal, including Enterprise tiers.',
|
|
317
|
+
schema: ScheduleServicePlanRenewalSchema,
|
|
318
|
+
invoke: this.scheduleServicePlanRenewal.bind(this),
|
|
319
|
+
},
|
|
320
|
+
{
|
|
321
|
+
name: 'update_primary_email',
|
|
322
|
+
description: 'Change one agent primary email username. The old primary address stops receiving new mail.',
|
|
318
323
|
schema: UpdatePrimaryEmailSchema,
|
|
319
324
|
invoke: this.updatePrimaryEmail.bind(this),
|
|
320
325
|
},
|
|
321
326
|
{
|
|
322
|
-
name:
|
|
323
|
-
description:
|
|
327
|
+
name: 'create_email_alias',
|
|
328
|
+
description: 'Create an extra receive-and-send alias for one agent. Requires available paid-plan alias capacity.',
|
|
324
329
|
schema: CreateEmailAliasSchema,
|
|
325
330
|
invoke: this.createEmailAlias.bind(this),
|
|
326
331
|
},
|
|
327
332
|
{
|
|
328
|
-
name:
|
|
329
|
-
description:
|
|
333
|
+
name: 'delete_email_alias',
|
|
334
|
+
description: 'Delete one active email alias from an agent.',
|
|
330
335
|
schema: DeleteEmailAliasSchema,
|
|
331
336
|
invoke: this.deleteEmailAlias.bind(this),
|
|
332
337
|
},
|
|
@@ -334,27 +339,23 @@ export class AgentDomainActionProvider {
|
|
|
334
339
|
}
|
|
335
340
|
async register(walletProvider, args) {
|
|
336
341
|
const { ad, wallet } = this.createAgentDomain(walletProvider);
|
|
337
|
-
const result = await ad.register({
|
|
338
|
-
|
|
339
|
-
emailEnabled: true,
|
|
340
|
-
wallet,
|
|
341
|
-
});
|
|
342
|
-
let autoRenewMsg = "";
|
|
342
|
+
const result = await ad.register({ ...args, emailEnabled: true, wallet });
|
|
343
|
+
let autoRenewMsg = '';
|
|
343
344
|
if (args.autoRenew && this.renewalVaultAddress) {
|
|
344
345
|
try {
|
|
345
346
|
if (walletProvider.sendTransaction) {
|
|
346
347
|
const data = encodeFunctionData({
|
|
347
348
|
abi: [
|
|
348
349
|
{
|
|
349
|
-
type:
|
|
350
|
-
name:
|
|
350
|
+
type: 'function',
|
|
351
|
+
name: 'setAutoRenew',
|
|
351
352
|
inputs: [
|
|
352
|
-
{ name:
|
|
353
|
-
{ name:
|
|
353
|
+
{ name: 'tokenId', type: 'uint256' },
|
|
354
|
+
{ name: 'enabled', type: 'bool' },
|
|
354
355
|
],
|
|
355
356
|
},
|
|
356
357
|
],
|
|
357
|
-
functionName:
|
|
358
|
+
functionName: 'setAutoRenew',
|
|
358
359
|
args: [BigInt(result.nftTokenId), true],
|
|
359
360
|
});
|
|
360
361
|
const txHash = await walletProvider.sendTransaction({
|
|
@@ -365,7 +366,7 @@ export class AgentDomainActionProvider {
|
|
|
365
366
|
}
|
|
366
367
|
else {
|
|
367
368
|
autoRenewMsg =
|
|
368
|
-
|
|
369
|
+
' (Cannot enable auto-renew because walletProvider lacks sendTransaction).';
|
|
369
370
|
}
|
|
370
371
|
}
|
|
371
372
|
catch (e) {
|
|
@@ -377,7 +378,7 @@ export class AgentDomainActionProvider {
|
|
|
377
378
|
async renewalStatus(walletProvider, args) {
|
|
378
379
|
const { ad } = this.createAgentDomain(walletProvider);
|
|
379
380
|
const status = await ad.getRenewalStatus(args.agentId);
|
|
380
|
-
return `Renewal status for ${status.domain}: next renewal $${status.nextRenewalAmountUsdc}, vault balance $${status.vaultBalanceUsdc}, shortfall $${status.shortfallUsdc}, expires ${status.expiresAt ??
|
|
381
|
+
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'}.`;
|
|
381
382
|
}
|
|
382
383
|
async fundRenewal(walletProvider, args) {
|
|
383
384
|
const { ad } = this.createAgentDomain(walletProvider);
|
|
@@ -390,31 +391,30 @@ export class AgentDomainActionProvider {
|
|
|
390
391
|
}
|
|
391
392
|
async enableAutoRenew(walletProvider, args) {
|
|
392
393
|
if (!this.renewalVaultAddress) {
|
|
393
|
-
throw new Error(
|
|
394
|
+
throw new Error('renewalVaultAddress is required to enable auto-renew.');
|
|
394
395
|
}
|
|
395
396
|
if (!walletProvider.sendTransaction) {
|
|
396
|
-
throw new Error(
|
|
397
|
+
throw new Error('walletProvider.sendTransaction is required to enable auto-renew.');
|
|
397
398
|
}
|
|
398
399
|
const { ad, wallet } = this.createAgentDomain(walletProvider);
|
|
399
400
|
const status = await ad.getRenewalStatus(args.agentId);
|
|
400
401
|
if (!status.tokenId)
|
|
401
|
-
throw new Error(
|
|
402
|
-
if (status.ownerAddress &&
|
|
403
|
-
status.ownerAddress.toLowerCase() !== wallet.toLowerCase()) {
|
|
402
|
+
throw new Error('AgentID NFT is not minted yet.');
|
|
403
|
+
if (status.ownerAddress && status.ownerAddress.toLowerCase() !== wallet.toLowerCase()) {
|
|
404
404
|
throw new Error(`Only the AgentID NFT owner (${status.ownerAddress}) can enable auto-renew.`);
|
|
405
405
|
}
|
|
406
406
|
const data = encodeFunctionData({
|
|
407
407
|
abi: [
|
|
408
408
|
{
|
|
409
|
-
type:
|
|
410
|
-
name:
|
|
409
|
+
type: 'function',
|
|
410
|
+
name: 'setAutoRenew',
|
|
411
411
|
inputs: [
|
|
412
|
-
{ name:
|
|
413
|
-
{ name:
|
|
412
|
+
{ name: 'tokenId', type: 'uint256' },
|
|
413
|
+
{ name: 'enabled', type: 'bool' },
|
|
414
414
|
],
|
|
415
415
|
},
|
|
416
416
|
],
|
|
417
|
-
functionName:
|
|
417
|
+
functionName: 'setAutoRenew',
|
|
418
418
|
args: [BigInt(status.tokenId), true],
|
|
419
419
|
});
|
|
420
420
|
const txHash = await walletProvider.sendTransaction({
|
|
@@ -452,7 +452,7 @@ export class AgentDomainActionProvider {
|
|
|
452
452
|
}
|
|
453
453
|
async withdrawRenewal(walletProvider, args) {
|
|
454
454
|
if (!walletProvider.sendTransaction) {
|
|
455
|
-
throw new Error(
|
|
455
|
+
throw new Error('walletProvider.sendTransaction is required to withdraw vault funds.');
|
|
456
456
|
}
|
|
457
457
|
const { ad } = this.createAgentDomain(walletProvider);
|
|
458
458
|
const tx = await ad.withdrawFromVault(args.agentId, args.amountUsdc);
|
|
@@ -472,23 +472,26 @@ export class AgentDomainActionProvider {
|
|
|
472
472
|
async purchaseServicePlan(walletProvider, args) {
|
|
473
473
|
const { ad } = this.createAgentDomain(walletProvider);
|
|
474
474
|
const result = await ad.purchaseServicePlan(args);
|
|
475
|
-
return `Purchased ${result.entitlement.plan} Premium Plan for ${result.domain}. Current period ends ${result.entitlement.currentPeriodEnd ??
|
|
475
|
+
return `Purchased ${result.entitlement.plan} Premium Plan for ${result.domain}. Current period ends ${result.entitlement.currentPeriodEnd ?? 'unknown'}.`;
|
|
476
476
|
}
|
|
477
477
|
async setRegistryVisibility(walletProvider, args) {
|
|
478
478
|
const { ad } = this.createAgentDomain(walletProvider);
|
|
479
479
|
const result = await ad.setRegistryVisibility(args.agentId, args.registryHidden);
|
|
480
|
-
return `${result.domain} is now ${result.registryVisibility.hidden ?
|
|
480
|
+
return `${result.domain} is now ${result.registryVisibility.hidden ? 'hidden from' : 'visible in'} the public registry.`;
|
|
481
|
+
}
|
|
482
|
+
async scheduleServicePlanRenewal(walletProvider, args) {
|
|
483
|
+
const { ad } = this.createAgentDomain(walletProvider);
|
|
484
|
+
const result = await ad.scheduleServicePlanRenewal(args.agentId, args);
|
|
485
|
+
return `Scheduled ${result.renewalPlanSku} for the next identity renewal.`;
|
|
481
486
|
}
|
|
482
487
|
async quote(walletProvider, args) {
|
|
483
488
|
const { ad } = this.createAgentDomain(walletProvider);
|
|
484
489
|
const q = await ad.quote(args);
|
|
485
|
-
const basenamePart = Number(q.basenameCostUsdc) > 0
|
|
486
|
-
|
|
487
|
-
: "";
|
|
488
|
-
const ensPart = Number(q.ensCostUsdc) > 0 ? ` + ENS $${q.ensCostUsdc}` : "";
|
|
490
|
+
const basenamePart = Number(q.basenameCostUsdc) > 0 ? ` + Basename $${q.basenameCostUsdc}` : '';
|
|
491
|
+
const ensPart = Number(q.ensCostUsdc) > 0 ? ` + ENS $${q.ensCostUsdc}` : '';
|
|
489
492
|
const planPart = Number(q.premiumPlanFeeUsdc ?? 0) > 0
|
|
490
493
|
? ` + ${q.premiumPlanLabel} $${q.premiumPlanFeeUsdc}`
|
|
491
|
-
:
|
|
494
|
+
: '';
|
|
492
495
|
return `Total: $${q.totalUsdc} USDC (domain $${q.domainCostUsdc} + platform $${q.platformFeeUsdc ?? q.serviceFeeUsdc}, email and SSL included${basenamePart}${ensPart}${planPart})`;
|
|
493
496
|
}
|
|
494
497
|
async search(walletProvider, args) {
|
|
@@ -496,7 +499,7 @@ export class AgentDomainActionProvider {
|
|
|
496
499
|
const result = await ad.search(args);
|
|
497
500
|
return `Found ${result.total} agents. First ${result.items.length}: ${result.items
|
|
498
501
|
.map((a) => a.domain)
|
|
499
|
-
.join(
|
|
502
|
+
.join(', ')}`;
|
|
500
503
|
}
|
|
501
504
|
async sendEmail(walletProvider, args) {
|
|
502
505
|
const { ad } = this.createAgentDomain(walletProvider);
|
|
@@ -513,6 +516,11 @@ export class AgentDomainActionProvider {
|
|
|
513
516
|
const result = await ad.listEmail(args.agentId, { limit: args.limit });
|
|
514
517
|
return JSON.stringify(result, null, 2);
|
|
515
518
|
}
|
|
519
|
+
async deleteEmailMessage(walletProvider, args) {
|
|
520
|
+
const { ad } = this.createAgentDomain(walletProvider);
|
|
521
|
+
await ad.deleteEmailMessage(args.agentId, args.messageId);
|
|
522
|
+
return `Deleted email message ${args.messageId}.`;
|
|
523
|
+
}
|
|
516
524
|
async sendEmailBatch(walletProvider, args) {
|
|
517
525
|
const { ad } = this.createAgentDomain(walletProvider);
|
|
518
526
|
return JSON.stringify(await ad.sendEmailBatch(args.agentId, {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentdomain/agentkit-plugin",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "Coinbase AgentKit action provider for AgentDomain",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": "https://github.com/0xmdrakib/AgentDomain.git",
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"viem": "^2.55.2",
|
|
28
28
|
"zod": "^3.24.1",
|
|
29
|
-
"@agentdomain/
|
|
30
|
-
"@agentdomain/
|
|
29
|
+
"@agentdomain/shared": "^0.5.0",
|
|
30
|
+
"@agentdomain/sdk": "^0.5.0"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
33
|
"@coinbase/agentkit": "^0.1.0"
|