@agentdomain/agentkit-plugin 0.5.0 → 0.6.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 +5 -3
- package/dist/index.d.ts +92 -2
- package/dist/index.js +195 -99
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -10,10 +10,12 @@ The provider exposes actions for:
|
|
|
10
10
|
|
|
11
11
|
- Agent identity registration and quote
|
|
12
12
|
- Registry search
|
|
13
|
-
- Email send/list/
|
|
14
|
-
- DNS list/create/update/delete
|
|
13
|
+
- Email send/list/batch, monthly usage, signed inbound webhooks, primary address updates, and Starter/Pro/Enterprise aliases
|
|
14
|
+
- Typed DNS list/create/update/delete for all 13 Spaceship-supported types, plus capabilities, batch preview/apply, and BIND import/export
|
|
15
15
|
- SSL reconfiguration
|
|
16
16
|
- RenewalVault status, funding, auto-renew, and withdrawal
|
|
17
|
-
- Per-agent Starter, Pro, and
|
|
17
|
+
- Per-agent Starter, Pro, and Enterprise Premium Plans
|
|
18
18
|
|
|
19
19
|
Default API base: `https://agentdomain.app/api/v1`.
|
|
20
|
+
|
|
21
|
+
Request the base URL directly to retrieve AgentDomain's machine-readable API discovery metadata.
|
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"]>>;
|
|
@@ -56,6 +56,47 @@ declare const EmailUsageSchema: z.ZodObject<{
|
|
|
56
56
|
}, {
|
|
57
57
|
agentId: string;
|
|
58
58
|
}>;
|
|
59
|
+
declare const CreateDnsSchema: z.ZodEffects<z.ZodObject<{
|
|
60
|
+
agentId: z.ZodString;
|
|
61
|
+
type: z.ZodEnum<["A", "AAAA", "ALIAS", "CAA", "CNAME", "HTTPS", "MX", "NS", "PTR", "SRV", "SVCB", "TLSA", "TXT"]>;
|
|
62
|
+
name: z.ZodString;
|
|
63
|
+
value: z.ZodOptional<z.ZodString>;
|
|
64
|
+
data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
65
|
+
ttl: z.ZodDefault<z.ZodNumber>;
|
|
66
|
+
priority: z.ZodOptional<z.ZodNumber>;
|
|
67
|
+
}, "strip", z.ZodTypeAny, {
|
|
68
|
+
type: "A" | "AAAA" | "ALIAS" | "CAA" | "CNAME" | "HTTPS" | "MX" | "NS" | "PTR" | "SRV" | "SVCB" | "TLSA" | "TXT";
|
|
69
|
+
agentId: string;
|
|
70
|
+
name: string;
|
|
71
|
+
ttl: number;
|
|
72
|
+
value?: string | undefined;
|
|
73
|
+
data?: Record<string, unknown> | undefined;
|
|
74
|
+
priority?: number | undefined;
|
|
75
|
+
}, {
|
|
76
|
+
type: "A" | "AAAA" | "ALIAS" | "CAA" | "CNAME" | "HTTPS" | "MX" | "NS" | "PTR" | "SRV" | "SVCB" | "TLSA" | "TXT";
|
|
77
|
+
agentId: string;
|
|
78
|
+
name: string;
|
|
79
|
+
value?: string | undefined;
|
|
80
|
+
data?: Record<string, unknown> | undefined;
|
|
81
|
+
ttl?: number | undefined;
|
|
82
|
+
priority?: number | undefined;
|
|
83
|
+
}>, {
|
|
84
|
+
type: "A" | "AAAA" | "ALIAS" | "CAA" | "CNAME" | "HTTPS" | "MX" | "NS" | "PTR" | "SRV" | "SVCB" | "TLSA" | "TXT";
|
|
85
|
+
agentId: string;
|
|
86
|
+
name: string;
|
|
87
|
+
ttl: number;
|
|
88
|
+
value?: string | undefined;
|
|
89
|
+
data?: Record<string, unknown> | undefined;
|
|
90
|
+
priority?: number | undefined;
|
|
91
|
+
}, {
|
|
92
|
+
type: "A" | "AAAA" | "ALIAS" | "CAA" | "CNAME" | "HTTPS" | "MX" | "NS" | "PTR" | "SRV" | "SVCB" | "TLSA" | "TXT";
|
|
93
|
+
agentId: string;
|
|
94
|
+
name: string;
|
|
95
|
+
value?: string | undefined;
|
|
96
|
+
data?: Record<string, unknown> | undefined;
|
|
97
|
+
ttl?: number | undefined;
|
|
98
|
+
priority?: number | undefined;
|
|
99
|
+
}>;
|
|
59
100
|
interface WalletProvider {
|
|
60
101
|
getAddress(): string;
|
|
61
102
|
signTypedData?: (data: unknown) => Promise<string>;
|
|
@@ -67,7 +108,7 @@ export interface AgentDomainActionProviderOptions {
|
|
|
67
108
|
apiKey?: string;
|
|
68
109
|
baseRpcUrl?: string;
|
|
69
110
|
renewalVaultAddress?: string;
|
|
70
|
-
network?:
|
|
111
|
+
network?: "base" | "base-sepolia";
|
|
71
112
|
}
|
|
72
113
|
export declare class AgentDomainActionProvider {
|
|
73
114
|
readonly name = "agentdomain";
|
|
@@ -147,6 +188,51 @@ export declare class AgentDomainActionProvider {
|
|
|
147
188
|
agentId: string;
|
|
148
189
|
}>;
|
|
149
190
|
invoke: (walletProvider: WalletProvider, args: z.infer<typeof EmailUsageSchema>) => Promise<string>;
|
|
191
|
+
} | {
|
|
192
|
+
name: string;
|
|
193
|
+
description: string;
|
|
194
|
+
schema: z.ZodEffects<z.ZodObject<{
|
|
195
|
+
agentId: z.ZodString;
|
|
196
|
+
type: z.ZodEnum<["A", "AAAA", "ALIAS", "CAA", "CNAME", "HTTPS", "MX", "NS", "PTR", "SRV", "SVCB", "TLSA", "TXT"]>;
|
|
197
|
+
name: z.ZodString;
|
|
198
|
+
value: z.ZodOptional<z.ZodString>;
|
|
199
|
+
data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
200
|
+
ttl: z.ZodDefault<z.ZodNumber>;
|
|
201
|
+
priority: z.ZodOptional<z.ZodNumber>;
|
|
202
|
+
}, "strip", z.ZodTypeAny, {
|
|
203
|
+
type: "A" | "AAAA" | "ALIAS" | "CAA" | "CNAME" | "HTTPS" | "MX" | "NS" | "PTR" | "SRV" | "SVCB" | "TLSA" | "TXT";
|
|
204
|
+
agentId: string;
|
|
205
|
+
name: string;
|
|
206
|
+
ttl: number;
|
|
207
|
+
value?: string | undefined;
|
|
208
|
+
data?: Record<string, unknown> | undefined;
|
|
209
|
+
priority?: number | undefined;
|
|
210
|
+
}, {
|
|
211
|
+
type: "A" | "AAAA" | "ALIAS" | "CAA" | "CNAME" | "HTTPS" | "MX" | "NS" | "PTR" | "SRV" | "SVCB" | "TLSA" | "TXT";
|
|
212
|
+
agentId: string;
|
|
213
|
+
name: string;
|
|
214
|
+
value?: string | undefined;
|
|
215
|
+
data?: Record<string, unknown> | undefined;
|
|
216
|
+
ttl?: number | undefined;
|
|
217
|
+
priority?: number | undefined;
|
|
218
|
+
}>, {
|
|
219
|
+
type: "A" | "AAAA" | "ALIAS" | "CAA" | "CNAME" | "HTTPS" | "MX" | "NS" | "PTR" | "SRV" | "SVCB" | "TLSA" | "TXT";
|
|
220
|
+
agentId: string;
|
|
221
|
+
name: string;
|
|
222
|
+
ttl: number;
|
|
223
|
+
value?: string | undefined;
|
|
224
|
+
data?: Record<string, unknown> | undefined;
|
|
225
|
+
priority?: number | undefined;
|
|
226
|
+
}, {
|
|
227
|
+
type: "A" | "AAAA" | "ALIAS" | "CAA" | "CNAME" | "HTTPS" | "MX" | "NS" | "PTR" | "SRV" | "SVCB" | "TLSA" | "TXT";
|
|
228
|
+
agentId: string;
|
|
229
|
+
name: string;
|
|
230
|
+
value?: string | undefined;
|
|
231
|
+
data?: Record<string, unknown> | undefined;
|
|
232
|
+
ttl?: number | undefined;
|
|
233
|
+
priority?: number | undefined;
|
|
234
|
+
}>;
|
|
235
|
+
invoke: (walletProvider: WalletProvider, args: z.infer<typeof CreateDnsSchema>) => Promise<string>;
|
|
150
236
|
})[];
|
|
151
237
|
private register;
|
|
152
238
|
private renewalStatus;
|
|
@@ -154,9 +240,13 @@ export declare class AgentDomainActionProvider {
|
|
|
154
240
|
private enableAutoRenew;
|
|
155
241
|
private reconfigureSsl;
|
|
156
242
|
private listDns;
|
|
243
|
+
private getDnsCapabilities;
|
|
157
244
|
private createDns;
|
|
158
245
|
private updateDns;
|
|
159
246
|
private deleteDns;
|
|
247
|
+
private changeDns;
|
|
248
|
+
private importDns;
|
|
249
|
+
private exportDns;
|
|
160
250
|
private withdrawRenewal;
|
|
161
251
|
private getServicePlan;
|
|
162
252
|
private purchaseServicePlan;
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { z } from
|
|
2
|
-
import { AgentDomain } from
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { AgentDomain } from "@agentdomain/sdk";
|
|
3
|
+
import { DNS_RECORD_TYPES, dnsRecordSchema, } from "@agentdomain/shared";
|
|
4
|
+
import { AGENTDOMAIN_API_BASE_URL, SERVICE_PLAN_KEYS, SUPPORTED_FRAMEWORKS, SUPPORTED_TLDS, } from "@agentdomain/shared/constants";
|
|
5
|
+
import { createPublicClient, createWalletClient, http, encodeFunctionData, } from "viem";
|
|
6
|
+
import { base, baseSepolia } from "viem/chains";
|
|
6
7
|
const RegisterSchema = z.object({
|
|
7
8
|
preferredName: z.string().min(3).max(63),
|
|
8
|
-
tld: z.enum(SUPPORTED_TLDS).default(
|
|
9
|
+
tld: z.enum(SUPPORTED_TLDS).default("xyz"),
|
|
9
10
|
registerBasename: z.boolean().default(true),
|
|
10
11
|
basenameLabel: z.string().min(3).max(63).optional(),
|
|
11
12
|
registerEns: z.boolean().default(false),
|
|
@@ -24,11 +25,11 @@ const RegisterSchema = z.object({
|
|
|
24
25
|
dnsTarget: z.string().url().optional(),
|
|
25
26
|
years: z.number().int().min(1).max(10).default(1),
|
|
26
27
|
autoRenew: z.boolean().default(false),
|
|
27
|
-
premiumPlan: z.enum(SERVICE_PLAN_KEYS).default(
|
|
28
|
+
premiumPlan: z.enum(SERVICE_PLAN_KEYS).default("included"),
|
|
28
29
|
});
|
|
29
30
|
const QuoteSchema = z.object({
|
|
30
31
|
preferredName: z.string(),
|
|
31
|
-
tld: z.enum(SUPPORTED_TLDS).default(
|
|
32
|
+
tld: z.enum(SUPPORTED_TLDS).default("xyz"),
|
|
32
33
|
registerBasename: z.boolean().default(true),
|
|
33
34
|
basenameLabel: z.string().min(3).max(63).optional(),
|
|
34
35
|
registerEns: z.boolean().default(false),
|
|
@@ -41,7 +42,7 @@ const QuoteSchema = z.object({
|
|
|
41
42
|
.regex(/^[a-z0-9](?:[a-z0-9._+-]{0,62}[a-z0-9])?$/)
|
|
42
43
|
.optional(),
|
|
43
44
|
years: z.number().int().min(1).max(10).default(1),
|
|
44
|
-
premiumPlan: z.enum(SERVICE_PLAN_KEYS).default(
|
|
45
|
+
premiumPlan: z.enum(SERVICE_PLAN_KEYS).default("included"),
|
|
45
46
|
});
|
|
46
47
|
const SearchSchema = z.object({
|
|
47
48
|
q: z.string().optional(),
|
|
@@ -73,7 +74,7 @@ const EmailUsageSchema = z.object({ agentId: z.string() });
|
|
|
73
74
|
const EmailWebhookSchema = z.object({
|
|
74
75
|
agentId: z.string(),
|
|
75
76
|
url: z.string().url(),
|
|
76
|
-
payloadMode: z.enum([
|
|
77
|
+
payloadMode: z.enum(["metadata", "inline_text"]).default("metadata"),
|
|
77
78
|
enabled: z.boolean().default(true),
|
|
78
79
|
});
|
|
79
80
|
const RenewalStatusSchema = z.object({
|
|
@@ -81,7 +82,9 @@ const RenewalStatusSchema = z.object({
|
|
|
81
82
|
});
|
|
82
83
|
const FundRenewalSchema = z.object({
|
|
83
84
|
agentId: z.string().min(1),
|
|
84
|
-
amountUsdc: z
|
|
85
|
+
amountUsdc: z
|
|
86
|
+
.string()
|
|
87
|
+
.regex(/^\d+(\.\d{1,6})?$/, "Use a USDC amount with up to 6 decimals"),
|
|
85
88
|
enableAutoRenew: z.boolean().default(false),
|
|
86
89
|
});
|
|
87
90
|
const EnableAutoRenewSchema = z.object({
|
|
@@ -90,36 +93,68 @@ const EnableAutoRenewSchema = z.object({
|
|
|
90
93
|
const SslReconfigureSchema = z.object({
|
|
91
94
|
agentId: z.string().min(1),
|
|
92
95
|
});
|
|
93
|
-
const DnsRecordTypeSchema = z.enum(
|
|
96
|
+
const DnsRecordTypeSchema = z.enum(DNS_RECORD_TYPES);
|
|
94
97
|
const ListDnsSchema = z.object({
|
|
95
98
|
agentId: z.string().min(1),
|
|
96
99
|
});
|
|
97
|
-
const CreateDnsSchema = z
|
|
100
|
+
const CreateDnsSchema = z
|
|
101
|
+
.object({
|
|
98
102
|
agentId: z.string().min(1),
|
|
99
103
|
type: DnsRecordTypeSchema,
|
|
100
104
|
name: z.string().min(1).max(253),
|
|
101
|
-
value: z.string().min(1).max(
|
|
105
|
+
value: z.string().min(1).max(65_535).optional(),
|
|
106
|
+
data: z.record(z.unknown()).optional(),
|
|
102
107
|
ttl: z.number().int().min(60).max(3600).default(3600),
|
|
103
|
-
priority: z.number().int().min(0).optional(),
|
|
108
|
+
priority: z.number().int().min(0).max(65_535).optional(),
|
|
109
|
+
})
|
|
110
|
+
.refine((record) => record.value !== undefined || record.data !== undefined, {
|
|
111
|
+
message: "Provide structured data or the legacy value field",
|
|
112
|
+
path: ["data"],
|
|
104
113
|
});
|
|
105
|
-
const UpdateDnsSchema =
|
|
114
|
+
const UpdateDnsSchema = z.object({
|
|
106
115
|
agentId: z.string().min(1),
|
|
107
116
|
recordId: z.string().min(1),
|
|
117
|
+
type: DnsRecordTypeSchema.optional(),
|
|
118
|
+
name: z.string().min(1).max(253).optional(),
|
|
119
|
+
value: z.string().min(1).max(65_535).optional(),
|
|
120
|
+
data: z.record(z.unknown()).optional(),
|
|
121
|
+
ttl: z.number().int().min(60).max(3600).optional(),
|
|
122
|
+
priority: z.number().int().min(0).max(65_535).optional(),
|
|
108
123
|
});
|
|
109
124
|
const DeleteDnsSchema = z.object({
|
|
110
125
|
agentId: z.string().min(1),
|
|
111
126
|
recordId: z.string().min(1),
|
|
112
127
|
});
|
|
128
|
+
const ChangeDnsSchema = z.object({
|
|
129
|
+
agentId: z.string().min(1),
|
|
130
|
+
records: z.array(dnsRecordSchema).min(1).max(200),
|
|
131
|
+
mode: z.enum(["merge", "replace"]).default("merge"),
|
|
132
|
+
dryRun: z.boolean().default(true),
|
|
133
|
+
baseRevision: z.string().length(64).optional(),
|
|
134
|
+
});
|
|
135
|
+
const ImportDnsSchema = z.object({
|
|
136
|
+
agentId: z.string().min(1),
|
|
137
|
+
zoneFile: z.string().min(1).max(262_144),
|
|
138
|
+
mode: z.enum(["merge", "replace"]).default("merge"),
|
|
139
|
+
dryRun: z.boolean().default(true),
|
|
140
|
+
baseRevision: z.string().length(64).optional(),
|
|
141
|
+
});
|
|
142
|
+
const ExportDnsSchema = z.object({
|
|
143
|
+
agentId: z.string().min(1),
|
|
144
|
+
scope: z.enum(["user", "all"]).default("user"),
|
|
145
|
+
});
|
|
113
146
|
const WithdrawRenewalSchema = z.object({
|
|
114
147
|
agentId: z.string().min(1),
|
|
115
|
-
amountUsdc: z
|
|
148
|
+
amountUsdc: z
|
|
149
|
+
.string()
|
|
150
|
+
.regex(/^\d+(\.\d{1,6})?$/, "Use a USDC amount with up to 6 decimals"),
|
|
116
151
|
});
|
|
117
152
|
const ServicePlanStatusSchema = z.object({
|
|
118
153
|
agentId: z.string().min(1),
|
|
119
154
|
});
|
|
120
155
|
const PurchaseServicePlanSchema = z.object({
|
|
121
156
|
agentId: z.string().min(1),
|
|
122
|
-
plan: z.enum([
|
|
157
|
+
plan: z.enum(["starter", "pro", "enterprise"]),
|
|
123
158
|
planSku: z.custom().optional(),
|
|
124
159
|
});
|
|
125
160
|
const SetRegistryVisibilitySchema = z.object({
|
|
@@ -128,7 +163,7 @@ const SetRegistryVisibilitySchema = z.object({
|
|
|
128
163
|
});
|
|
129
164
|
const ScheduleServicePlanRenewalSchema = z.object({
|
|
130
165
|
agentId: z.string().uuid(),
|
|
131
|
-
plan: z.enum([
|
|
166
|
+
plan: z.enum(["included", "starter", "pro", "enterprise"]),
|
|
132
167
|
planSku: z.custom(),
|
|
133
168
|
});
|
|
134
169
|
const UpdatePrimaryEmailSchema = z.object({
|
|
@@ -145,7 +180,7 @@ const DeleteEmailAliasSchema = z.object({
|
|
|
145
180
|
emailAddress: z.string().email(),
|
|
146
181
|
});
|
|
147
182
|
export class AgentDomainActionProvider {
|
|
148
|
-
name =
|
|
183
|
+
name = "agentdomain";
|
|
149
184
|
apiUrl;
|
|
150
185
|
apiKey;
|
|
151
186
|
baseRpcUrl;
|
|
@@ -154,14 +189,17 @@ export class AgentDomainActionProvider {
|
|
|
154
189
|
constructor(opts = {}) {
|
|
155
190
|
this.apiUrl = opts.apiUrl ?? AGENTDOMAIN_API_BASE_URL;
|
|
156
191
|
this.apiKey = opts.apiKey;
|
|
157
|
-
this.baseRpcUrl = opts.baseRpcUrl ??
|
|
192
|
+
this.baseRpcUrl = opts.baseRpcUrl ?? "https://mainnet.base.org";
|
|
158
193
|
this.renewalVaultAddress = opts.renewalVaultAddress;
|
|
159
|
-
this.network = opts.network ??
|
|
194
|
+
this.network = opts.network ?? "base";
|
|
160
195
|
}
|
|
161
196
|
createAgentDomain(walletProvider) {
|
|
162
197
|
const wallet = walletProvider.getAddress();
|
|
163
|
-
const chain = this.network ===
|
|
164
|
-
const publicClient = createPublicClient({
|
|
198
|
+
const chain = this.network === "base-sepolia" ? baseSepolia : base;
|
|
199
|
+
const publicClient = createPublicClient({
|
|
200
|
+
chain,
|
|
201
|
+
transport: http(this.baseRpcUrl),
|
|
202
|
+
});
|
|
165
203
|
const walletClient = createWalletClient({
|
|
166
204
|
chain,
|
|
167
205
|
transport: http(this.baseRpcUrl),
|
|
@@ -186,152 +224,176 @@ export class AgentDomainActionProvider {
|
|
|
186
224
|
getActions() {
|
|
187
225
|
return [
|
|
188
226
|
{
|
|
189
|
-
name:
|
|
190
|
-
description:
|
|
227
|
+
name: "register_agent_identity",
|
|
228
|
+
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.",
|
|
191
229
|
schema: RegisterSchema,
|
|
192
230
|
invoke: this.register.bind(this),
|
|
193
231
|
},
|
|
194
232
|
{
|
|
195
|
-
name:
|
|
196
|
-
description:
|
|
233
|
+
name: "quote_agent_registration",
|
|
234
|
+
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.",
|
|
197
235
|
schema: QuoteSchema,
|
|
198
236
|
invoke: this.quote.bind(this),
|
|
199
237
|
},
|
|
200
238
|
{
|
|
201
|
-
name:
|
|
202
|
-
description:
|
|
239
|
+
name: "search_agents",
|
|
240
|
+
description: "Search the public AgentDomain registry.",
|
|
203
241
|
schema: SearchSchema,
|
|
204
242
|
invoke: this.search.bind(this),
|
|
205
243
|
},
|
|
206
244
|
{
|
|
207
|
-
name:
|
|
208
|
-
description:
|
|
245
|
+
name: "send_agent_email",
|
|
246
|
+
description: "Send text-only email from an agent primary email or active alias via AWS SES.",
|
|
209
247
|
schema: SendEmailSchema,
|
|
210
248
|
invoke: this.sendEmail.bind(this),
|
|
211
249
|
},
|
|
212
250
|
{
|
|
213
|
-
name:
|
|
214
|
-
description:
|
|
251
|
+
name: "list_agent_email",
|
|
252
|
+
description: "Query text-only agent email and extracted verification codes.",
|
|
215
253
|
schema: ListEmailSchema,
|
|
216
254
|
invoke: this.listEmail.bind(this),
|
|
217
255
|
},
|
|
218
256
|
{
|
|
219
|
-
name:
|
|
220
|
-
description:
|
|
257
|
+
name: "delete_agent_email",
|
|
258
|
+
description: "Permanently delete one email message from an agent inbox.",
|
|
221
259
|
schema: DeleteEmailMessageSchema,
|
|
222
260
|
invoke: this.deleteEmailMessage.bind(this),
|
|
223
261
|
},
|
|
224
262
|
{
|
|
225
|
-
name:
|
|
226
|
-
description:
|
|
263
|
+
name: "send_agent_email_batch",
|
|
264
|
+
description: "Queue up to 100 emails in one API request.",
|
|
227
265
|
schema: BatchEmailSchema,
|
|
228
266
|
invoke: this.sendEmailBatch.bind(this),
|
|
229
267
|
},
|
|
230
268
|
{
|
|
231
|
-
name:
|
|
232
|
-
description:
|
|
269
|
+
name: "get_agent_email_usage",
|
|
270
|
+
description: "Get combined monthly sent and received email usage.",
|
|
233
271
|
schema: EmailUsageSchema,
|
|
234
272
|
invoke: this.emailUsage.bind(this),
|
|
235
273
|
},
|
|
236
274
|
{
|
|
237
|
-
name:
|
|
238
|
-
description:
|
|
275
|
+
name: "configure_email_webhook",
|
|
276
|
+
description: "Configure signed inbound email events for this agent.",
|
|
239
277
|
schema: EmailWebhookSchema,
|
|
240
278
|
invoke: this.configureEmailWebhook.bind(this),
|
|
241
279
|
},
|
|
242
280
|
{
|
|
243
|
-
name:
|
|
244
|
-
description:
|
|
281
|
+
name: "get_renewal_status",
|
|
282
|
+
description: "Get exact next renewal amount, shortfall, vault balance, expiry date, and auto-renew state for an AgentDomain identity.",
|
|
245
283
|
schema: RenewalStatusSchema,
|
|
246
284
|
invoke: this.renewalStatus.bind(this),
|
|
247
285
|
},
|
|
248
286
|
{
|
|
249
|
-
name:
|
|
250
|
-
description:
|
|
287
|
+
name: "fund_renewal_vault",
|
|
288
|
+
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.",
|
|
251
289
|
schema: FundRenewalSchema,
|
|
252
290
|
invoke: this.fundRenewal.bind(this),
|
|
253
291
|
},
|
|
254
292
|
{
|
|
255
|
-
name:
|
|
256
|
-
description:
|
|
293
|
+
name: "enable_auto_renew",
|
|
294
|
+
description: "Enable RenewalVault auto-renew. Requires the wallet provider to be the AgentID NFT owner and support sendTransaction.",
|
|
257
295
|
schema: EnableAutoRenewSchema,
|
|
258
296
|
invoke: this.enableAutoRenew.bind(this),
|
|
259
297
|
},
|
|
260
298
|
{
|
|
261
|
-
name:
|
|
262
|
-
description:
|
|
299
|
+
name: "reconfigure_ssl",
|
|
300
|
+
description: "Rebuild the Cloudflare SaaS SSL hostname and sync the required Spaceship DNS validation records for an existing agent.",
|
|
263
301
|
schema: SslReconfigureSchema,
|
|
264
302
|
invoke: this.reconfigureSsl.bind(this),
|
|
265
303
|
},
|
|
266
304
|
{
|
|
267
|
-
name:
|
|
268
|
-
description:
|
|
305
|
+
name: "get_dns_capabilities",
|
|
306
|
+
description: "Get machine-readable DNS types, fields, limits, and provider constraints.",
|
|
307
|
+
schema: ListDnsSchema,
|
|
308
|
+
invoke: this.getDnsCapabilities.bind(this),
|
|
309
|
+
},
|
|
310
|
+
{
|
|
311
|
+
name: "list_dns_records",
|
|
312
|
+
description: "List DNS records for an AgentDomain identity.",
|
|
269
313
|
schema: ListDnsSchema,
|
|
270
314
|
invoke: this.listDns.bind(this),
|
|
271
315
|
},
|
|
272
316
|
{
|
|
273
|
-
name:
|
|
274
|
-
description:
|
|
317
|
+
name: "create_dns_record",
|
|
318
|
+
description: "Create a user-managed DNS record and sync it to the domain provider.",
|
|
275
319
|
schema: CreateDnsSchema,
|
|
276
320
|
invoke: this.createDns.bind(this),
|
|
277
321
|
},
|
|
278
322
|
{
|
|
279
|
-
name:
|
|
280
|
-
description:
|
|
323
|
+
name: "update_dns_record",
|
|
324
|
+
description: "Update a user-managed DNS record and sync it to the domain provider.",
|
|
281
325
|
schema: UpdateDnsSchema,
|
|
282
326
|
invoke: this.updateDns.bind(this),
|
|
283
327
|
},
|
|
284
328
|
{
|
|
285
|
-
name:
|
|
286
|
-
description:
|
|
329
|
+
name: "delete_dns_record",
|
|
330
|
+
description: "Delete a user-managed DNS record and sync the domain provider state.",
|
|
287
331
|
schema: DeleteDnsSchema,
|
|
288
332
|
invoke: this.deleteDns.bind(this),
|
|
289
333
|
},
|
|
290
334
|
{
|
|
291
|
-
name:
|
|
292
|
-
description:
|
|
335
|
+
name: "change_dns_records",
|
|
336
|
+
description: "Preview or apply a revision-protected DNS batch in merge or replace mode.",
|
|
337
|
+
schema: ChangeDnsSchema,
|
|
338
|
+
invoke: this.changeDns.bind(this),
|
|
339
|
+
},
|
|
340
|
+
{
|
|
341
|
+
name: "import_dns_zone",
|
|
342
|
+
description: "Preview or apply a validated BIND zone import without deleting system-managed records.",
|
|
343
|
+
schema: ImportDnsSchema,
|
|
344
|
+
invoke: this.importDns.bind(this),
|
|
345
|
+
},
|
|
346
|
+
{
|
|
347
|
+
name: "export_dns_zone",
|
|
348
|
+
description: "Export user or permitted complete DNS state as a BIND zone file.",
|
|
349
|
+
schema: ExportDnsSchema,
|
|
350
|
+
invoke: this.exportDns.bind(this),
|
|
351
|
+
},
|
|
352
|
+
{
|
|
353
|
+
name: "withdraw_renewal_vault",
|
|
354
|
+
description: "Withdraw unused USDC from an AgentID renewal vault. Requires the AgentID NFT owner wallet.",
|
|
293
355
|
schema: WithdrawRenewalSchema,
|
|
294
356
|
invoke: this.withdrawRenewal.bind(this),
|
|
295
357
|
},
|
|
296
358
|
{
|
|
297
|
-
name:
|
|
298
|
-
description:
|
|
359
|
+
name: "get_service_plan",
|
|
360
|
+
description: "Get the current per-agent Premium Plan, limits, and billing state.",
|
|
299
361
|
schema: ServicePlanStatusSchema,
|
|
300
362
|
invoke: this.getServicePlan.bind(this),
|
|
301
363
|
},
|
|
302
364
|
{
|
|
303
|
-
name:
|
|
304
|
-
description:
|
|
365
|
+
name: "purchase_service_plan",
|
|
366
|
+
description: "Upgrade one agent to an AgentDomain Starter, Pro, or Enterprise Premium Plan using x402 USDC payment.",
|
|
305
367
|
schema: PurchaseServicePlanSchema,
|
|
306
368
|
invoke: this.purchaseServicePlan.bind(this),
|
|
307
369
|
},
|
|
308
370
|
{
|
|
309
|
-
name:
|
|
310
|
-
description:
|
|
371
|
+
name: "set_registry_visibility",
|
|
372
|
+
description: "Hide or show one agent in the public AgentDomain registry. Hiding requires an active paid Premium Plan.",
|
|
311
373
|
schema: SetRegistryVisibilitySchema,
|
|
312
374
|
invoke: this.setRegistryVisibility.bind(this),
|
|
313
375
|
},
|
|
314
376
|
{
|
|
315
|
-
name:
|
|
316
|
-
description:
|
|
377
|
+
name: "schedule_service_plan_renewal",
|
|
378
|
+
description: "Choose the exact Premium Plan SKU for the next identity renewal, including Enterprise tiers.",
|
|
317
379
|
schema: ScheduleServicePlanRenewalSchema,
|
|
318
380
|
invoke: this.scheduleServicePlanRenewal.bind(this),
|
|
319
381
|
},
|
|
320
382
|
{
|
|
321
|
-
name:
|
|
322
|
-
description:
|
|
383
|
+
name: "update_primary_email",
|
|
384
|
+
description: "Change one agent primary email username. The old primary address stops receiving new mail.",
|
|
323
385
|
schema: UpdatePrimaryEmailSchema,
|
|
324
386
|
invoke: this.updatePrimaryEmail.bind(this),
|
|
325
387
|
},
|
|
326
388
|
{
|
|
327
|
-
name:
|
|
328
|
-
description:
|
|
389
|
+
name: "create_email_alias",
|
|
390
|
+
description: "Create an extra receive-and-send alias for one agent. Requires available paid-plan alias capacity.",
|
|
329
391
|
schema: CreateEmailAliasSchema,
|
|
330
392
|
invoke: this.createEmailAlias.bind(this),
|
|
331
393
|
},
|
|
332
394
|
{
|
|
333
|
-
name:
|
|
334
|
-
description:
|
|
395
|
+
name: "delete_email_alias",
|
|
396
|
+
description: "Delete one active email alias from an agent.",
|
|
335
397
|
schema: DeleteEmailAliasSchema,
|
|
336
398
|
invoke: this.deleteEmailAlias.bind(this),
|
|
337
399
|
},
|
|
@@ -339,23 +401,27 @@ export class AgentDomainActionProvider {
|
|
|
339
401
|
}
|
|
340
402
|
async register(walletProvider, args) {
|
|
341
403
|
const { ad, wallet } = this.createAgentDomain(walletProvider);
|
|
342
|
-
const result = await ad.register({
|
|
343
|
-
|
|
404
|
+
const result = await ad.register({
|
|
405
|
+
...args,
|
|
406
|
+
emailEnabled: true,
|
|
407
|
+
wallet,
|
|
408
|
+
});
|
|
409
|
+
let autoRenewMsg = "";
|
|
344
410
|
if (args.autoRenew && this.renewalVaultAddress) {
|
|
345
411
|
try {
|
|
346
412
|
if (walletProvider.sendTransaction) {
|
|
347
413
|
const data = encodeFunctionData({
|
|
348
414
|
abi: [
|
|
349
415
|
{
|
|
350
|
-
type:
|
|
351
|
-
name:
|
|
416
|
+
type: "function",
|
|
417
|
+
name: "setAutoRenew",
|
|
352
418
|
inputs: [
|
|
353
|
-
{ name:
|
|
354
|
-
{ name:
|
|
419
|
+
{ name: "tokenId", type: "uint256" },
|
|
420
|
+
{ name: "enabled", type: "bool" },
|
|
355
421
|
],
|
|
356
422
|
},
|
|
357
423
|
],
|
|
358
|
-
functionName:
|
|
424
|
+
functionName: "setAutoRenew",
|
|
359
425
|
args: [BigInt(result.nftTokenId), true],
|
|
360
426
|
});
|
|
361
427
|
const txHash = await walletProvider.sendTransaction({
|
|
@@ -366,7 +432,7 @@ export class AgentDomainActionProvider {
|
|
|
366
432
|
}
|
|
367
433
|
else {
|
|
368
434
|
autoRenewMsg =
|
|
369
|
-
|
|
435
|
+
" (Cannot enable auto-renew because walletProvider lacks sendTransaction).";
|
|
370
436
|
}
|
|
371
437
|
}
|
|
372
438
|
catch (e) {
|
|
@@ -378,7 +444,7 @@ export class AgentDomainActionProvider {
|
|
|
378
444
|
async renewalStatus(walletProvider, args) {
|
|
379
445
|
const { ad } = this.createAgentDomain(walletProvider);
|
|
380
446
|
const status = await ad.getRenewalStatus(args.agentId);
|
|
381
|
-
return `Renewal status for ${status.domain}: next renewal $${status.nextRenewalAmountUsdc}, vault balance $${status.vaultBalanceUsdc}, shortfall $${status.shortfallUsdc}, expires ${status.expiresAt ??
|
|
447
|
+
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"}.`;
|
|
382
448
|
}
|
|
383
449
|
async fundRenewal(walletProvider, args) {
|
|
384
450
|
const { ad } = this.createAgentDomain(walletProvider);
|
|
@@ -391,30 +457,31 @@ export class AgentDomainActionProvider {
|
|
|
391
457
|
}
|
|
392
458
|
async enableAutoRenew(walletProvider, args) {
|
|
393
459
|
if (!this.renewalVaultAddress) {
|
|
394
|
-
throw new Error(
|
|
460
|
+
throw new Error("renewalVaultAddress is required to enable auto-renew.");
|
|
395
461
|
}
|
|
396
462
|
if (!walletProvider.sendTransaction) {
|
|
397
|
-
throw new Error(
|
|
463
|
+
throw new Error("walletProvider.sendTransaction is required to enable auto-renew.");
|
|
398
464
|
}
|
|
399
465
|
const { ad, wallet } = this.createAgentDomain(walletProvider);
|
|
400
466
|
const status = await ad.getRenewalStatus(args.agentId);
|
|
401
467
|
if (!status.tokenId)
|
|
402
|
-
throw new Error(
|
|
403
|
-
if (status.ownerAddress &&
|
|
468
|
+
throw new Error("AgentID NFT is not minted yet.");
|
|
469
|
+
if (status.ownerAddress &&
|
|
470
|
+
status.ownerAddress.toLowerCase() !== wallet.toLowerCase()) {
|
|
404
471
|
throw new Error(`Only the AgentID NFT owner (${status.ownerAddress}) can enable auto-renew.`);
|
|
405
472
|
}
|
|
406
473
|
const data = encodeFunctionData({
|
|
407
474
|
abi: [
|
|
408
475
|
{
|
|
409
|
-
type:
|
|
410
|
-
name:
|
|
476
|
+
type: "function",
|
|
477
|
+
name: "setAutoRenew",
|
|
411
478
|
inputs: [
|
|
412
|
-
{ name:
|
|
413
|
-
{ name:
|
|
479
|
+
{ name: "tokenId", type: "uint256" },
|
|
480
|
+
{ name: "enabled", type: "bool" },
|
|
414
481
|
],
|
|
415
482
|
},
|
|
416
483
|
],
|
|
417
|
-
functionName:
|
|
484
|
+
functionName: "setAutoRenew",
|
|
418
485
|
args: [BigInt(status.tokenId), true],
|
|
419
486
|
});
|
|
420
487
|
const txHash = await walletProvider.sendTransaction({
|
|
@@ -433,6 +500,10 @@ export class AgentDomainActionProvider {
|
|
|
433
500
|
const records = await ad.listDnsRecords(args.agentId);
|
|
434
501
|
return JSON.stringify(records, null, 2);
|
|
435
502
|
}
|
|
503
|
+
async getDnsCapabilities(walletProvider, args) {
|
|
504
|
+
const { ad } = this.createAgentDomain(walletProvider);
|
|
505
|
+
return JSON.stringify(await ad.getDnsCapabilities(args.agentId), null, 2);
|
|
506
|
+
}
|
|
436
507
|
async createDns(walletProvider, args) {
|
|
437
508
|
const { ad } = this.createAgentDomain(walletProvider);
|
|
438
509
|
const { agentId, ...record } = args;
|
|
@@ -450,9 +521,27 @@ export class AgentDomainActionProvider {
|
|
|
450
521
|
await ad.deleteDnsRecord(args.agentId, args.recordId);
|
|
451
522
|
return `Deleted DNS record ${args.recordId}.`;
|
|
452
523
|
}
|
|
524
|
+
async changeDns(walletProvider, args) {
|
|
525
|
+
const { ad } = this.createAgentDomain(walletProvider);
|
|
526
|
+
const result = args.dryRun
|
|
527
|
+
? await ad.previewDnsBatch(args.agentId, args.records, args.mode)
|
|
528
|
+
: await ad.applyDnsBatch(args.agentId, args.records, requireDnsRevision(args.baseRevision), args.mode);
|
|
529
|
+
return JSON.stringify(result, null, 2);
|
|
530
|
+
}
|
|
531
|
+
async importDns(walletProvider, args) {
|
|
532
|
+
const { ad } = this.createAgentDomain(walletProvider);
|
|
533
|
+
const result = args.dryRun
|
|
534
|
+
? await ad.previewDnsImport(args.agentId, args.zoneFile, args.mode)
|
|
535
|
+
: await ad.applyDnsImport(args.agentId, args.zoneFile, requireDnsRevision(args.baseRevision), args.mode);
|
|
536
|
+
return JSON.stringify(result, null, 2);
|
|
537
|
+
}
|
|
538
|
+
async exportDns(walletProvider, args) {
|
|
539
|
+
const { ad } = this.createAgentDomain(walletProvider);
|
|
540
|
+
return ad.exportDnsZone(args.agentId, args.scope);
|
|
541
|
+
}
|
|
453
542
|
async withdrawRenewal(walletProvider, args) {
|
|
454
543
|
if (!walletProvider.sendTransaction) {
|
|
455
|
-
throw new Error(
|
|
544
|
+
throw new Error("walletProvider.sendTransaction is required to withdraw vault funds.");
|
|
456
545
|
}
|
|
457
546
|
const { ad } = this.createAgentDomain(walletProvider);
|
|
458
547
|
const tx = await ad.withdrawFromVault(args.agentId, args.amountUsdc);
|
|
@@ -472,12 +561,12 @@ export class AgentDomainActionProvider {
|
|
|
472
561
|
async purchaseServicePlan(walletProvider, args) {
|
|
473
562
|
const { ad } = this.createAgentDomain(walletProvider);
|
|
474
563
|
const result = await ad.purchaseServicePlan(args);
|
|
475
|
-
return `Purchased ${result.entitlement.plan} Premium Plan for ${result.domain}. Current period ends ${result.entitlement.currentPeriodEnd ??
|
|
564
|
+
return `Purchased ${result.entitlement.plan} Premium Plan for ${result.domain}. Current period ends ${result.entitlement.currentPeriodEnd ?? "unknown"}.`;
|
|
476
565
|
}
|
|
477
566
|
async setRegistryVisibility(walletProvider, args) {
|
|
478
567
|
const { ad } = this.createAgentDomain(walletProvider);
|
|
479
568
|
const result = await ad.setRegistryVisibility(args.agentId, args.registryHidden);
|
|
480
|
-
return `${result.domain} is now ${result.registryVisibility.hidden ?
|
|
569
|
+
return `${result.domain} is now ${result.registryVisibility.hidden ? "hidden from" : "visible in"} the public registry.`;
|
|
481
570
|
}
|
|
482
571
|
async scheduleServicePlanRenewal(walletProvider, args) {
|
|
483
572
|
const { ad } = this.createAgentDomain(walletProvider);
|
|
@@ -487,11 +576,13 @@ export class AgentDomainActionProvider {
|
|
|
487
576
|
async quote(walletProvider, args) {
|
|
488
577
|
const { ad } = this.createAgentDomain(walletProvider);
|
|
489
578
|
const q = await ad.quote(args);
|
|
490
|
-
const basenamePart = Number(q.basenameCostUsdc) > 0
|
|
491
|
-
|
|
579
|
+
const basenamePart = Number(q.basenameCostUsdc) > 0
|
|
580
|
+
? ` + Basename $${q.basenameCostUsdc}`
|
|
581
|
+
: "";
|
|
582
|
+
const ensPart = Number(q.ensCostUsdc) > 0 ? ` + ENS $${q.ensCostUsdc}` : "";
|
|
492
583
|
const planPart = Number(q.premiumPlanFeeUsdc ?? 0) > 0
|
|
493
584
|
? ` + ${q.premiumPlanLabel} $${q.premiumPlanFeeUsdc}`
|
|
494
|
-
:
|
|
585
|
+
: "";
|
|
495
586
|
return `Total: $${q.totalUsdc} USDC (domain $${q.domainCostUsdc} + platform $${q.platformFeeUsdc ?? q.serviceFeeUsdc}, email and SSL included${basenamePart}${ensPart}${planPart})`;
|
|
496
587
|
}
|
|
497
588
|
async search(walletProvider, args) {
|
|
@@ -499,7 +590,7 @@ export class AgentDomainActionProvider {
|
|
|
499
590
|
const result = await ad.search(args);
|
|
500
591
|
return `Found ${result.total} agents. First ${result.items.length}: ${result.items
|
|
501
592
|
.map((a) => a.domain)
|
|
502
|
-
.join(
|
|
593
|
+
.join(", ")}`;
|
|
503
594
|
}
|
|
504
595
|
async sendEmail(walletProvider, args) {
|
|
505
596
|
const { ad } = this.createAgentDomain(walletProvider);
|
|
@@ -552,4 +643,9 @@ export class AgentDomainActionProvider {
|
|
|
552
643
|
return `Deleted email alias ${args.emailAddress}.`;
|
|
553
644
|
}
|
|
554
645
|
}
|
|
646
|
+
function requireDnsRevision(value) {
|
|
647
|
+
if (!value)
|
|
648
|
+
throw new Error("Apply requires baseRevision from a fresh DNS dry-run preview.");
|
|
649
|
+
return value;
|
|
650
|
+
}
|
|
555
651
|
export default AgentDomainActionProvider;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentdomain/agentkit-plugin",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.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/sdk": "^0.6.0",
|
|
30
|
+
"@agentdomain/shared": "^0.6.0"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
33
|
"@coinbase/agentkit": "^0.1.0"
|