@agentdomain/agentkit-plugin 0.3.0 → 0.4.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 +13 -10
- package/dist/index.js +156 -85
- 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, primary address
|
|
13
|
+
- Email send/list/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 Pro and Enterprise Premium Plans
|
|
17
|
+
- Per-agent Starter, Pro, and Enterprise Premium Plans
|
|
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"]>>;
|
|
@@ -9,7 +9,7 @@ declare const QuoteSchema: z.ZodObject<{
|
|
|
9
9
|
emailEnabled: z.ZodDefault<z.ZodBoolean>;
|
|
10
10
|
emailUsername: z.ZodOptional<z.ZodString>;
|
|
11
11
|
years: z.ZodDefault<z.ZodNumber>;
|
|
12
|
-
premiumPlan: z.ZodDefault<z.ZodEnum<["included", "pro", "enterprise"]>>;
|
|
12
|
+
premiumPlan: z.ZodDefault<z.ZodEnum<["included", "starter", "pro", "enterprise"]>>;
|
|
13
13
|
}, "strip", z.ZodTypeAny, {
|
|
14
14
|
preferredName: string;
|
|
15
15
|
tld: "xyz" | "com" | "ai" | "org" | "io" | "net" | "co" | "app";
|
|
@@ -17,7 +17,7 @@ declare const QuoteSchema: z.ZodObject<{
|
|
|
17
17
|
registerEns: boolean;
|
|
18
18
|
emailEnabled: boolean;
|
|
19
19
|
years: number;
|
|
20
|
-
premiumPlan: "included" | "pro" | "enterprise";
|
|
20
|
+
premiumPlan: "included" | "starter" | "pro" | "enterprise";
|
|
21
21
|
basenameLabel?: string | undefined;
|
|
22
22
|
ensLabel?: string | undefined;
|
|
23
23
|
emailUsername?: string | undefined;
|
|
@@ -31,7 +31,7 @@ declare const QuoteSchema: z.ZodObject<{
|
|
|
31
31
|
emailEnabled?: boolean | undefined;
|
|
32
32
|
emailUsername?: string | undefined;
|
|
33
33
|
years?: number | undefined;
|
|
34
|
-
premiumPlan?: "included" | "pro" | "enterprise" | undefined;
|
|
34
|
+
premiumPlan?: "included" | "starter" | "pro" | "enterprise" | undefined;
|
|
35
35
|
}>;
|
|
36
36
|
declare const SearchSchema: z.ZodObject<{
|
|
37
37
|
q: z.ZodOptional<z.ZodString>;
|
|
@@ -49,7 +49,7 @@ declare const SearchSchema: z.ZodObject<{
|
|
|
49
49
|
capability?: string | undefined;
|
|
50
50
|
limit?: number | undefined;
|
|
51
51
|
}>;
|
|
52
|
-
declare const
|
|
52
|
+
declare const EmailUsageSchema: z.ZodObject<{
|
|
53
53
|
agentId: z.ZodString;
|
|
54
54
|
}, "strip", z.ZodTypeAny, {
|
|
55
55
|
agentId: string;
|
|
@@ -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";
|
|
@@ -91,7 +91,7 @@ export declare class AgentDomainActionProvider {
|
|
|
91
91
|
emailEnabled: z.ZodDefault<z.ZodBoolean>;
|
|
92
92
|
emailUsername: z.ZodOptional<z.ZodString>;
|
|
93
93
|
years: z.ZodDefault<z.ZodNumber>;
|
|
94
|
-
premiumPlan: z.ZodDefault<z.ZodEnum<["included", "pro", "enterprise"]>>;
|
|
94
|
+
premiumPlan: z.ZodDefault<z.ZodEnum<["included", "starter", "pro", "enterprise"]>>;
|
|
95
95
|
}, "strip", z.ZodTypeAny, {
|
|
96
96
|
preferredName: string;
|
|
97
97
|
tld: "xyz" | "com" | "ai" | "org" | "io" | "net" | "co" | "app";
|
|
@@ -99,7 +99,7 @@ export declare class AgentDomainActionProvider {
|
|
|
99
99
|
registerEns: boolean;
|
|
100
100
|
emailEnabled: boolean;
|
|
101
101
|
years: number;
|
|
102
|
-
premiumPlan: "included" | "pro" | "enterprise";
|
|
102
|
+
premiumPlan: "included" | "starter" | "pro" | "enterprise";
|
|
103
103
|
basenameLabel?: string | undefined;
|
|
104
104
|
ensLabel?: string | undefined;
|
|
105
105
|
emailUsername?: string | undefined;
|
|
@@ -113,7 +113,7 @@ export declare class AgentDomainActionProvider {
|
|
|
113
113
|
emailEnabled?: boolean | undefined;
|
|
114
114
|
emailUsername?: string | undefined;
|
|
115
115
|
years?: number | undefined;
|
|
116
|
-
premiumPlan?: "included" | "pro" | "enterprise" | undefined;
|
|
116
|
+
premiumPlan?: "included" | "starter" | "pro" | "enterprise" | undefined;
|
|
117
117
|
}>;
|
|
118
118
|
invoke: (walletProvider: WalletProvider, args: z.infer<typeof QuoteSchema>) => Promise<string>;
|
|
119
119
|
} | {
|
|
@@ -146,7 +146,7 @@ export declare class AgentDomainActionProvider {
|
|
|
146
146
|
}, {
|
|
147
147
|
agentId: string;
|
|
148
148
|
}>;
|
|
149
|
-
invoke: (walletProvider: WalletProvider, args: z.infer<typeof
|
|
149
|
+
invoke: (walletProvider: WalletProvider, args: z.infer<typeof EmailUsageSchema>) => Promise<string>;
|
|
150
150
|
})[];
|
|
151
151
|
private register;
|
|
152
152
|
private renewalStatus;
|
|
@@ -165,6 +165,9 @@ export declare class AgentDomainActionProvider {
|
|
|
165
165
|
private search;
|
|
166
166
|
private sendEmail;
|
|
167
167
|
private listEmail;
|
|
168
|
+
private sendEmailBatch;
|
|
169
|
+
private emailUsage;
|
|
170
|
+
private configureEmailWebhook;
|
|
168
171
|
private updatePrimaryEmail;
|
|
169
172
|
private createEmailAlias;
|
|
170
173
|
private deleteEmailAlias;
|
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,12 +60,26 @@ 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 BatchEmailSchema = z.object({
|
|
64
|
+
agentId: z.string(),
|
|
65
|
+
messages: z.array(SendEmailSchema.omit({ agentId: true })).max(100),
|
|
66
|
+
idempotencyKey: z.string().max(256).optional(),
|
|
67
|
+
});
|
|
68
|
+
const EmailUsageSchema = z.object({ agentId: z.string() });
|
|
69
|
+
const EmailWebhookSchema = z.object({
|
|
70
|
+
agentId: z.string(),
|
|
71
|
+
url: z.string().url(),
|
|
72
|
+
payloadMode: z.enum(["metadata", "inline_text"]).default("metadata"),
|
|
73
|
+
enabled: z.boolean().default(true),
|
|
74
|
+
});
|
|
63
75
|
const RenewalStatusSchema = z.object({
|
|
64
76
|
agentId: z.string().min(1),
|
|
65
77
|
});
|
|
66
78
|
const FundRenewalSchema = z.object({
|
|
67
79
|
agentId: z.string().min(1),
|
|
68
|
-
amountUsdc: z
|
|
80
|
+
amountUsdc: z
|
|
81
|
+
.string()
|
|
82
|
+
.regex(/^\d+(\.\d{1,6})?$/, "Use a USDC amount with up to 6 decimals"),
|
|
69
83
|
enableAutoRenew: z.boolean().default(false),
|
|
70
84
|
});
|
|
71
85
|
const EnableAutoRenewSchema = z.object({
|
|
@@ -74,7 +88,16 @@ const EnableAutoRenewSchema = z.object({
|
|
|
74
88
|
const SslReconfigureSchema = z.object({
|
|
75
89
|
agentId: z.string().min(1),
|
|
76
90
|
});
|
|
77
|
-
const DnsRecordTypeSchema = z.enum([
|
|
91
|
+
const DnsRecordTypeSchema = z.enum([
|
|
92
|
+
"A",
|
|
93
|
+
"AAAA",
|
|
94
|
+
"ALIAS",
|
|
95
|
+
"CNAME",
|
|
96
|
+
"MX",
|
|
97
|
+
"TXT",
|
|
98
|
+
"NS",
|
|
99
|
+
"SRV",
|
|
100
|
+
]);
|
|
78
101
|
const ListDnsSchema = z.object({
|
|
79
102
|
agentId: z.string().min(1),
|
|
80
103
|
});
|
|
@@ -96,14 +119,17 @@ const DeleteDnsSchema = z.object({
|
|
|
96
119
|
});
|
|
97
120
|
const WithdrawRenewalSchema = z.object({
|
|
98
121
|
agentId: z.string().min(1),
|
|
99
|
-
amountUsdc: z
|
|
122
|
+
amountUsdc: z
|
|
123
|
+
.string()
|
|
124
|
+
.regex(/^\d+(\.\d{1,6})?$/, "Use a USDC amount with up to 6 decimals"),
|
|
100
125
|
});
|
|
101
126
|
const ServicePlanStatusSchema = z.object({
|
|
102
127
|
agentId: z.string().min(1),
|
|
103
128
|
});
|
|
104
129
|
const PurchaseServicePlanSchema = z.object({
|
|
105
130
|
agentId: z.string().min(1),
|
|
106
|
-
plan: z.enum([
|
|
131
|
+
plan: z.enum(["starter", "pro", "enterprise"]),
|
|
132
|
+
planSku: z.custom().optional(),
|
|
107
133
|
});
|
|
108
134
|
const SetRegistryVisibilitySchema = z.object({
|
|
109
135
|
agentId: z.string().min(1),
|
|
@@ -123,7 +149,7 @@ const DeleteEmailAliasSchema = z.object({
|
|
|
123
149
|
emailAddress: z.string().email(),
|
|
124
150
|
});
|
|
125
151
|
export class AgentDomainActionProvider {
|
|
126
|
-
name =
|
|
152
|
+
name = "agentdomain";
|
|
127
153
|
apiUrl;
|
|
128
154
|
apiKey;
|
|
129
155
|
baseRpcUrl;
|
|
@@ -132,14 +158,17 @@ export class AgentDomainActionProvider {
|
|
|
132
158
|
constructor(opts = {}) {
|
|
133
159
|
this.apiUrl = opts.apiUrl ?? AGENTDOMAIN_API_BASE_URL;
|
|
134
160
|
this.apiKey = opts.apiKey;
|
|
135
|
-
this.baseRpcUrl = opts.baseRpcUrl ??
|
|
161
|
+
this.baseRpcUrl = opts.baseRpcUrl ?? "https://mainnet.base.org";
|
|
136
162
|
this.renewalVaultAddress = opts.renewalVaultAddress;
|
|
137
|
-
this.network = opts.network ??
|
|
163
|
+
this.network = opts.network ?? "base";
|
|
138
164
|
}
|
|
139
165
|
createAgentDomain(walletProvider) {
|
|
140
166
|
const wallet = walletProvider.getAddress();
|
|
141
|
-
const chain = this.network ===
|
|
142
|
-
const publicClient = createPublicClient({
|
|
167
|
+
const chain = this.network === "base-sepolia" ? baseSepolia : base;
|
|
168
|
+
const publicClient = createPublicClient({
|
|
169
|
+
chain,
|
|
170
|
+
transport: http(this.baseRpcUrl),
|
|
171
|
+
});
|
|
143
172
|
const walletClient = createWalletClient({
|
|
144
173
|
chain,
|
|
145
174
|
transport: http(this.baseRpcUrl),
|
|
@@ -164,122 +193,140 @@ export class AgentDomainActionProvider {
|
|
|
164
193
|
getActions() {
|
|
165
194
|
return [
|
|
166
195
|
{
|
|
167
|
-
name:
|
|
168
|
-
description:
|
|
196
|
+
name: "register_agent_identity",
|
|
197
|
+
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.",
|
|
169
198
|
schema: RegisterSchema,
|
|
170
199
|
invoke: this.register.bind(this),
|
|
171
200
|
},
|
|
172
201
|
{
|
|
173
|
-
name:
|
|
174
|
-
description:
|
|
202
|
+
name: "quote_agent_registration",
|
|
203
|
+
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.",
|
|
175
204
|
schema: QuoteSchema,
|
|
176
205
|
invoke: this.quote.bind(this),
|
|
177
206
|
},
|
|
178
207
|
{
|
|
179
|
-
name:
|
|
180
|
-
description:
|
|
208
|
+
name: "search_agents",
|
|
209
|
+
description: "Search the public AgentDomain registry.",
|
|
181
210
|
schema: SearchSchema,
|
|
182
211
|
invoke: this.search.bind(this),
|
|
183
212
|
},
|
|
184
213
|
{
|
|
185
|
-
name:
|
|
186
|
-
description:
|
|
214
|
+
name: "send_agent_email",
|
|
215
|
+
description: "Send text-only email from an agent primary email or active alias via AWS SES.",
|
|
187
216
|
schema: SendEmailSchema,
|
|
188
217
|
invoke: this.sendEmail.bind(this),
|
|
189
218
|
},
|
|
190
219
|
{
|
|
191
|
-
name:
|
|
192
|
-
description:
|
|
220
|
+
name: "list_agent_email",
|
|
221
|
+
description: "Query text-only agent email and extracted verification codes.",
|
|
193
222
|
schema: ListEmailSchema,
|
|
194
223
|
invoke: this.listEmail.bind(this),
|
|
195
224
|
},
|
|
196
225
|
{
|
|
197
|
-
name:
|
|
198
|
-
description:
|
|
226
|
+
name: "send_agent_email_batch",
|
|
227
|
+
description: "Queue up to 100 emails in one API request.",
|
|
228
|
+
schema: BatchEmailSchema,
|
|
229
|
+
invoke: this.sendEmailBatch.bind(this),
|
|
230
|
+
},
|
|
231
|
+
{
|
|
232
|
+
name: "get_agent_email_usage",
|
|
233
|
+
description: "Get combined monthly sent and received email usage.",
|
|
234
|
+
schema: EmailUsageSchema,
|
|
235
|
+
invoke: this.emailUsage.bind(this),
|
|
236
|
+
},
|
|
237
|
+
{
|
|
238
|
+
name: "configure_email_webhook",
|
|
239
|
+
description: "Configure signed inbound email events for this agent.",
|
|
240
|
+
schema: EmailWebhookSchema,
|
|
241
|
+
invoke: this.configureEmailWebhook.bind(this),
|
|
242
|
+
},
|
|
243
|
+
{
|
|
244
|
+
name: "get_renewal_status",
|
|
245
|
+
description: "Get exact next renewal amount, shortfall, vault balance, expiry date, and auto-renew state for an AgentDomain identity.",
|
|
199
246
|
schema: RenewalStatusSchema,
|
|
200
247
|
invoke: this.renewalStatus.bind(this),
|
|
201
248
|
},
|
|
202
249
|
{
|
|
203
|
-
name:
|
|
204
|
-
description:
|
|
250
|
+
name: "fund_renewal_vault",
|
|
251
|
+
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.",
|
|
205
252
|
schema: FundRenewalSchema,
|
|
206
253
|
invoke: this.fundRenewal.bind(this),
|
|
207
254
|
},
|
|
208
255
|
{
|
|
209
|
-
name:
|
|
210
|
-
description:
|
|
256
|
+
name: "enable_auto_renew",
|
|
257
|
+
description: "Enable RenewalVault auto-renew. Requires the wallet provider to be the AgentID NFT owner and support sendTransaction.",
|
|
211
258
|
schema: EnableAutoRenewSchema,
|
|
212
259
|
invoke: this.enableAutoRenew.bind(this),
|
|
213
260
|
},
|
|
214
261
|
{
|
|
215
|
-
name:
|
|
216
|
-
description:
|
|
262
|
+
name: "reconfigure_ssl",
|
|
263
|
+
description: "Rebuild the Cloudflare SaaS SSL hostname and sync the required Spaceship DNS validation records for an existing agent.",
|
|
217
264
|
schema: SslReconfigureSchema,
|
|
218
265
|
invoke: this.reconfigureSsl.bind(this),
|
|
219
266
|
},
|
|
220
267
|
{
|
|
221
|
-
name:
|
|
222
|
-
description:
|
|
268
|
+
name: "list_dns_records",
|
|
269
|
+
description: "List DNS records for an AgentDomain identity.",
|
|
223
270
|
schema: ListDnsSchema,
|
|
224
271
|
invoke: this.listDns.bind(this),
|
|
225
272
|
},
|
|
226
273
|
{
|
|
227
|
-
name:
|
|
228
|
-
description:
|
|
274
|
+
name: "create_dns_record",
|
|
275
|
+
description: "Create a user-managed DNS record and sync it to the domain provider.",
|
|
229
276
|
schema: CreateDnsSchema,
|
|
230
277
|
invoke: this.createDns.bind(this),
|
|
231
278
|
},
|
|
232
279
|
{
|
|
233
|
-
name:
|
|
234
|
-
description:
|
|
280
|
+
name: "update_dns_record",
|
|
281
|
+
description: "Update a user-managed DNS record and sync it to the domain provider.",
|
|
235
282
|
schema: UpdateDnsSchema,
|
|
236
283
|
invoke: this.updateDns.bind(this),
|
|
237
284
|
},
|
|
238
285
|
{
|
|
239
|
-
name:
|
|
240
|
-
description:
|
|
286
|
+
name: "delete_dns_record",
|
|
287
|
+
description: "Delete a user-managed DNS record and sync the domain provider state.",
|
|
241
288
|
schema: DeleteDnsSchema,
|
|
242
289
|
invoke: this.deleteDns.bind(this),
|
|
243
290
|
},
|
|
244
291
|
{
|
|
245
|
-
name:
|
|
246
|
-
description:
|
|
292
|
+
name: "withdraw_renewal_vault",
|
|
293
|
+
description: "Withdraw unused USDC from an AgentID renewal vault. Requires the AgentID NFT owner wallet.",
|
|
247
294
|
schema: WithdrawRenewalSchema,
|
|
248
295
|
invoke: this.withdrawRenewal.bind(this),
|
|
249
296
|
},
|
|
250
297
|
{
|
|
251
|
-
name:
|
|
252
|
-
description:
|
|
298
|
+
name: "get_service_plan",
|
|
299
|
+
description: "Get the current per-agent Premium Plan, limits, and billing state.",
|
|
253
300
|
schema: ServicePlanStatusSchema,
|
|
254
301
|
invoke: this.getServicePlan.bind(this),
|
|
255
302
|
},
|
|
256
303
|
{
|
|
257
|
-
name:
|
|
258
|
-
description:
|
|
304
|
+
name: "purchase_service_plan",
|
|
305
|
+
description: "Upgrade one agent to an AgentDomain Starter, Pro, or Enterprise Premium Plan using x402 USDC payment.",
|
|
259
306
|
schema: PurchaseServicePlanSchema,
|
|
260
307
|
invoke: this.purchaseServicePlan.bind(this),
|
|
261
308
|
},
|
|
262
309
|
{
|
|
263
|
-
name:
|
|
264
|
-
description:
|
|
310
|
+
name: "set_registry_visibility",
|
|
311
|
+
description: "Hide or show one agent in the public AgentDomain registry. Hiding requires an active paid Premium Plan.",
|
|
265
312
|
schema: SetRegistryVisibilitySchema,
|
|
266
313
|
invoke: this.setRegistryVisibility.bind(this),
|
|
267
314
|
},
|
|
268
315
|
{
|
|
269
|
-
name:
|
|
270
|
-
description:
|
|
316
|
+
name: "update_primary_email",
|
|
317
|
+
description: "Change one agent primary email username. The old primary address stops receiving new mail.",
|
|
271
318
|
schema: UpdatePrimaryEmailSchema,
|
|
272
319
|
invoke: this.updatePrimaryEmail.bind(this),
|
|
273
320
|
},
|
|
274
321
|
{
|
|
275
|
-
name:
|
|
276
|
-
description:
|
|
322
|
+
name: "create_email_alias",
|
|
323
|
+
description: "Create an extra receive-and-send alias for one agent. Requires available paid-plan alias capacity.",
|
|
277
324
|
schema: CreateEmailAliasSchema,
|
|
278
325
|
invoke: this.createEmailAlias.bind(this),
|
|
279
326
|
},
|
|
280
327
|
{
|
|
281
|
-
name:
|
|
282
|
-
description:
|
|
328
|
+
name: "delete_email_alias",
|
|
329
|
+
description: "Delete one active email alias from an agent.",
|
|
283
330
|
schema: DeleteEmailAliasSchema,
|
|
284
331
|
invoke: this.deleteEmailAlias.bind(this),
|
|
285
332
|
},
|
|
@@ -287,23 +334,27 @@ export class AgentDomainActionProvider {
|
|
|
287
334
|
}
|
|
288
335
|
async register(walletProvider, args) {
|
|
289
336
|
const { ad, wallet } = this.createAgentDomain(walletProvider);
|
|
290
|
-
const result = await ad.register({
|
|
291
|
-
|
|
337
|
+
const result = await ad.register({
|
|
338
|
+
...args,
|
|
339
|
+
emailEnabled: true,
|
|
340
|
+
wallet,
|
|
341
|
+
});
|
|
342
|
+
let autoRenewMsg = "";
|
|
292
343
|
if (args.autoRenew && this.renewalVaultAddress) {
|
|
293
344
|
try {
|
|
294
345
|
if (walletProvider.sendTransaction) {
|
|
295
346
|
const data = encodeFunctionData({
|
|
296
347
|
abi: [
|
|
297
348
|
{
|
|
298
|
-
type:
|
|
299
|
-
name:
|
|
349
|
+
type: "function",
|
|
350
|
+
name: "setAutoRenew",
|
|
300
351
|
inputs: [
|
|
301
|
-
{ name:
|
|
302
|
-
{ name:
|
|
352
|
+
{ name: "tokenId", type: "uint256" },
|
|
353
|
+
{ name: "enabled", type: "bool" },
|
|
303
354
|
],
|
|
304
355
|
},
|
|
305
356
|
],
|
|
306
|
-
functionName:
|
|
357
|
+
functionName: "setAutoRenew",
|
|
307
358
|
args: [BigInt(result.nftTokenId), true],
|
|
308
359
|
});
|
|
309
360
|
const txHash = await walletProvider.sendTransaction({
|
|
@@ -314,7 +365,7 @@ export class AgentDomainActionProvider {
|
|
|
314
365
|
}
|
|
315
366
|
else {
|
|
316
367
|
autoRenewMsg =
|
|
317
|
-
|
|
368
|
+
" (Cannot enable auto-renew because walletProvider lacks sendTransaction).";
|
|
318
369
|
}
|
|
319
370
|
}
|
|
320
371
|
catch (e) {
|
|
@@ -326,7 +377,7 @@ export class AgentDomainActionProvider {
|
|
|
326
377
|
async renewalStatus(walletProvider, args) {
|
|
327
378
|
const { ad } = this.createAgentDomain(walletProvider);
|
|
328
379
|
const status = await ad.getRenewalStatus(args.agentId);
|
|
329
|
-
return `Renewal status for ${status.domain}: next renewal $${status.nextRenewalAmountUsdc}, vault balance $${status.vaultBalanceUsdc}, shortfall $${status.shortfallUsdc}, expires ${status.expiresAt ??
|
|
380
|
+
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"}.`;
|
|
330
381
|
}
|
|
331
382
|
async fundRenewal(walletProvider, args) {
|
|
332
383
|
const { ad } = this.createAgentDomain(walletProvider);
|
|
@@ -339,30 +390,31 @@ export class AgentDomainActionProvider {
|
|
|
339
390
|
}
|
|
340
391
|
async enableAutoRenew(walletProvider, args) {
|
|
341
392
|
if (!this.renewalVaultAddress) {
|
|
342
|
-
throw new Error(
|
|
393
|
+
throw new Error("renewalVaultAddress is required to enable auto-renew.");
|
|
343
394
|
}
|
|
344
395
|
if (!walletProvider.sendTransaction) {
|
|
345
|
-
throw new Error(
|
|
396
|
+
throw new Error("walletProvider.sendTransaction is required to enable auto-renew.");
|
|
346
397
|
}
|
|
347
398
|
const { ad, wallet } = this.createAgentDomain(walletProvider);
|
|
348
399
|
const status = await ad.getRenewalStatus(args.agentId);
|
|
349
400
|
if (!status.tokenId)
|
|
350
|
-
throw new Error(
|
|
351
|
-
if (status.ownerAddress &&
|
|
401
|
+
throw new Error("AgentID NFT is not minted yet.");
|
|
402
|
+
if (status.ownerAddress &&
|
|
403
|
+
status.ownerAddress.toLowerCase() !== wallet.toLowerCase()) {
|
|
352
404
|
throw new Error(`Only the AgentID NFT owner (${status.ownerAddress}) can enable auto-renew.`);
|
|
353
405
|
}
|
|
354
406
|
const data = encodeFunctionData({
|
|
355
407
|
abi: [
|
|
356
408
|
{
|
|
357
|
-
type:
|
|
358
|
-
name:
|
|
409
|
+
type: "function",
|
|
410
|
+
name: "setAutoRenew",
|
|
359
411
|
inputs: [
|
|
360
|
-
{ name:
|
|
361
|
-
{ name:
|
|
412
|
+
{ name: "tokenId", type: "uint256" },
|
|
413
|
+
{ name: "enabled", type: "bool" },
|
|
362
414
|
],
|
|
363
415
|
},
|
|
364
416
|
],
|
|
365
|
-
functionName:
|
|
417
|
+
functionName: "setAutoRenew",
|
|
366
418
|
args: [BigInt(status.tokenId), true],
|
|
367
419
|
});
|
|
368
420
|
const txHash = await walletProvider.sendTransaction({
|
|
@@ -400,7 +452,7 @@ export class AgentDomainActionProvider {
|
|
|
400
452
|
}
|
|
401
453
|
async withdrawRenewal(walletProvider, args) {
|
|
402
454
|
if (!walletProvider.sendTransaction) {
|
|
403
|
-
throw new Error(
|
|
455
|
+
throw new Error("walletProvider.sendTransaction is required to withdraw vault funds.");
|
|
404
456
|
}
|
|
405
457
|
const { ad } = this.createAgentDomain(walletProvider);
|
|
406
458
|
const tx = await ad.withdrawFromVault(args.agentId, args.amountUsdc);
|
|
@@ -415,24 +467,28 @@ export class AgentDomainActionProvider {
|
|
|
415
467
|
async getServicePlan(walletProvider, args) {
|
|
416
468
|
const { ad } = this.createAgentDomain(walletProvider);
|
|
417
469
|
const result = await ad.getServicePlan(args.agentId);
|
|
418
|
-
return `Premium Plan for ${result.domain}: ${result.entitlement.plan} (${result.entitlement.status}),
|
|
470
|
+
return `Premium Plan for ${result.domain}: ${result.entitlement.plan} (${result.entitlement.status}), ${result.entitlement.limits.monthlyEmails} combined emails/month, ${result.entitlement.limits.apiKeys} API key(s), ${result.entitlement.limits.dnsRecords} DNS records, registry hidden ${result.registryVisibility.hidden}.`;
|
|
419
471
|
}
|
|
420
472
|
async purchaseServicePlan(walletProvider, args) {
|
|
421
473
|
const { ad } = this.createAgentDomain(walletProvider);
|
|
422
474
|
const result = await ad.purchaseServicePlan(args);
|
|
423
|
-
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"}.`;
|
|
424
476
|
}
|
|
425
477
|
async setRegistryVisibility(walletProvider, args) {
|
|
426
478
|
const { ad } = this.createAgentDomain(walletProvider);
|
|
427
479
|
const result = await ad.setRegistryVisibility(args.agentId, args.registryHidden);
|
|
428
|
-
return `${result.domain} is now ${result.registryVisibility.hidden ?
|
|
480
|
+
return `${result.domain} is now ${result.registryVisibility.hidden ? "hidden from" : "visible in"} the public registry.`;
|
|
429
481
|
}
|
|
430
482
|
async quote(walletProvider, args) {
|
|
431
483
|
const { ad } = this.createAgentDomain(walletProvider);
|
|
432
484
|
const q = await ad.quote(args);
|
|
433
|
-
const basenamePart = Number(q.basenameCostUsdc) > 0
|
|
434
|
-
|
|
435
|
-
|
|
485
|
+
const basenamePart = Number(q.basenameCostUsdc) > 0
|
|
486
|
+
? ` + Basename $${q.basenameCostUsdc}`
|
|
487
|
+
: "";
|
|
488
|
+
const ensPart = Number(q.ensCostUsdc) > 0 ? ` + ENS $${q.ensCostUsdc}` : "";
|
|
489
|
+
const planPart = Number(q.premiumPlanFeeUsdc ?? 0) > 0
|
|
490
|
+
? ` + ${q.premiumPlanLabel} $${q.premiumPlanFeeUsdc}`
|
|
491
|
+
: "";
|
|
436
492
|
return `Total: $${q.totalUsdc} USDC (domain $${q.domainCostUsdc} + platform $${q.platformFeeUsdc ?? q.serviceFeeUsdc}, email and SSL included${basenamePart}${ensPart}${planPart})`;
|
|
437
493
|
}
|
|
438
494
|
async search(walletProvider, args) {
|
|
@@ -440,7 +496,7 @@ export class AgentDomainActionProvider {
|
|
|
440
496
|
const result = await ad.search(args);
|
|
441
497
|
return `Found ${result.total} agents. First ${result.items.length}: ${result.items
|
|
442
498
|
.map((a) => a.domain)
|
|
443
|
-
.join(
|
|
499
|
+
.join(", ")}`;
|
|
444
500
|
}
|
|
445
501
|
async sendEmail(walletProvider, args) {
|
|
446
502
|
const { ad } = this.createAgentDomain(walletProvider);
|
|
@@ -450,13 +506,28 @@ export class AgentDomainActionProvider {
|
|
|
450
506
|
subject: args.subject,
|
|
451
507
|
text: args.text,
|
|
452
508
|
});
|
|
453
|
-
return `Email
|
|
509
|
+
return `Email queued: ${result.id}`;
|
|
454
510
|
}
|
|
455
511
|
async listEmail(walletProvider, args) {
|
|
456
512
|
const { ad } = this.createAgentDomain(walletProvider);
|
|
457
513
|
const result = await ad.listEmail(args.agentId, { limit: args.limit });
|
|
458
514
|
return JSON.stringify(result, null, 2);
|
|
459
515
|
}
|
|
516
|
+
async sendEmailBatch(walletProvider, args) {
|
|
517
|
+
const { ad } = this.createAgentDomain(walletProvider);
|
|
518
|
+
return JSON.stringify(await ad.sendEmailBatch(args.agentId, {
|
|
519
|
+
messages: args.messages,
|
|
520
|
+
idempotencyKey: args.idempotencyKey,
|
|
521
|
+
}), null, 2);
|
|
522
|
+
}
|
|
523
|
+
async emailUsage(walletProvider, args) {
|
|
524
|
+
const { ad } = this.createAgentDomain(walletProvider);
|
|
525
|
+
return JSON.stringify(await ad.getEmailUsage(args.agentId), null, 2);
|
|
526
|
+
}
|
|
527
|
+
async configureEmailWebhook(walletProvider, args) {
|
|
528
|
+
const { ad } = this.createAgentDomain(walletProvider);
|
|
529
|
+
return JSON.stringify(await ad.setEmailWebhook(args.agentId, args), null, 2);
|
|
530
|
+
}
|
|
460
531
|
async updatePrimaryEmail(walletProvider, args) {
|
|
461
532
|
const { ad } = this.createAgentDomain(walletProvider);
|
|
462
533
|
const result = await ad.updatePrimaryEmail(args.agentId, args.username);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentdomain/agentkit-plugin",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.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/sdk": "^0.
|
|
30
|
-
"@agentdomain/shared": "^0.
|
|
29
|
+
"@agentdomain/sdk": "^0.4.0",
|
|
30
|
+
"@agentdomain/shared": "^0.4.0"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
33
|
"@coinbase/agentkit": "^0.1.0"
|