@agentdomain/agentkit-plugin 0.5.1 → 0.7.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/NOTICE +5 -0
- package/README.md +20 -3
- package/dist/index.d.ts +94 -0
- package/dist/index.js +114 -37
- package/package.json +6 -3
package/NOTICE
ADDED
package/README.md
CHANGED
|
@@ -10,10 +10,27 @@ 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.
|
|
22
|
+
|
|
23
|
+
Provide your public ERC-8021 app identifier when constructing the action
|
|
24
|
+
provider:
|
|
25
|
+
|
|
26
|
+
```ts
|
|
27
|
+
const provider = new AgentDomainActionProvider({
|
|
28
|
+
builderCode: process.env.AGENTDOMAIN_BUILDER_CODE,
|
|
29
|
+
renewalVaultAddress: process.env.RENEWAL_VAULT_ADDRESS,
|
|
30
|
+
});
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
`builderCode` is required only for direct Base writes such as auto-renew and
|
|
34
|
+
vault withdrawal. Missing or invalid attribution stops those actions before
|
|
35
|
+
`walletProvider.sendTransaction`; reads, signatures, and x402 v2 paid requests
|
|
36
|
+
keep their existing behavior.
|
package/dist/index.d.ts
CHANGED
|
@@ -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>;
|
|
@@ -68,6 +109,8 @@ export interface AgentDomainActionProviderOptions {
|
|
|
68
109
|
baseRpcUrl?: string;
|
|
69
110
|
renewalVaultAddress?: string;
|
|
70
111
|
network?: 'base' | 'base-sepolia';
|
|
112
|
+
/** Public ERC-8021 app code required for direct Base transaction actions. */
|
|
113
|
+
builderCode?: string;
|
|
71
114
|
}
|
|
72
115
|
export declare class AgentDomainActionProvider {
|
|
73
116
|
readonly name = "agentdomain";
|
|
@@ -76,6 +119,7 @@ export declare class AgentDomainActionProvider {
|
|
|
76
119
|
private readonly baseRpcUrl;
|
|
77
120
|
private readonly renewalVaultAddress?;
|
|
78
121
|
private readonly network;
|
|
122
|
+
private readonly builderCode?;
|
|
79
123
|
constructor(opts?: AgentDomainActionProviderOptions);
|
|
80
124
|
private createAgentDomain;
|
|
81
125
|
getActions(): ({
|
|
@@ -147,16 +191,66 @@ export declare class AgentDomainActionProvider {
|
|
|
147
191
|
agentId: string;
|
|
148
192
|
}>;
|
|
149
193
|
invoke: (walletProvider: WalletProvider, args: z.infer<typeof EmailUsageSchema>) => Promise<string>;
|
|
194
|
+
} | {
|
|
195
|
+
name: string;
|
|
196
|
+
description: string;
|
|
197
|
+
schema: z.ZodEffects<z.ZodObject<{
|
|
198
|
+
agentId: z.ZodString;
|
|
199
|
+
type: z.ZodEnum<["A", "AAAA", "ALIAS", "CAA", "CNAME", "HTTPS", "MX", "NS", "PTR", "SRV", "SVCB", "TLSA", "TXT"]>;
|
|
200
|
+
name: z.ZodString;
|
|
201
|
+
value: z.ZodOptional<z.ZodString>;
|
|
202
|
+
data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
203
|
+
ttl: z.ZodDefault<z.ZodNumber>;
|
|
204
|
+
priority: z.ZodOptional<z.ZodNumber>;
|
|
205
|
+
}, "strip", z.ZodTypeAny, {
|
|
206
|
+
type: "A" | "AAAA" | "ALIAS" | "CAA" | "CNAME" | "HTTPS" | "MX" | "NS" | "PTR" | "SRV" | "SVCB" | "TLSA" | "TXT";
|
|
207
|
+
agentId: string;
|
|
208
|
+
name: string;
|
|
209
|
+
ttl: number;
|
|
210
|
+
value?: string | undefined;
|
|
211
|
+
data?: Record<string, unknown> | undefined;
|
|
212
|
+
priority?: number | undefined;
|
|
213
|
+
}, {
|
|
214
|
+
type: "A" | "AAAA" | "ALIAS" | "CAA" | "CNAME" | "HTTPS" | "MX" | "NS" | "PTR" | "SRV" | "SVCB" | "TLSA" | "TXT";
|
|
215
|
+
agentId: string;
|
|
216
|
+
name: string;
|
|
217
|
+
value?: string | undefined;
|
|
218
|
+
data?: Record<string, unknown> | undefined;
|
|
219
|
+
ttl?: number | undefined;
|
|
220
|
+
priority?: number | undefined;
|
|
221
|
+
}>, {
|
|
222
|
+
type: "A" | "AAAA" | "ALIAS" | "CAA" | "CNAME" | "HTTPS" | "MX" | "NS" | "PTR" | "SRV" | "SVCB" | "TLSA" | "TXT";
|
|
223
|
+
agentId: string;
|
|
224
|
+
name: string;
|
|
225
|
+
ttl: number;
|
|
226
|
+
value?: string | undefined;
|
|
227
|
+
data?: Record<string, unknown> | undefined;
|
|
228
|
+
priority?: number | undefined;
|
|
229
|
+
}, {
|
|
230
|
+
type: "A" | "AAAA" | "ALIAS" | "CAA" | "CNAME" | "HTTPS" | "MX" | "NS" | "PTR" | "SRV" | "SVCB" | "TLSA" | "TXT";
|
|
231
|
+
agentId: string;
|
|
232
|
+
name: string;
|
|
233
|
+
value?: string | undefined;
|
|
234
|
+
data?: Record<string, unknown> | undefined;
|
|
235
|
+
ttl?: number | undefined;
|
|
236
|
+
priority?: number | undefined;
|
|
237
|
+
}>;
|
|
238
|
+
invoke: (walletProvider: WalletProvider, args: z.infer<typeof CreateDnsSchema>) => Promise<string>;
|
|
150
239
|
})[];
|
|
151
240
|
private register;
|
|
152
241
|
private renewalStatus;
|
|
153
242
|
private fundRenewal;
|
|
154
243
|
private enableAutoRenew;
|
|
244
|
+
private requireBuilderCode;
|
|
155
245
|
private reconfigureSsl;
|
|
156
246
|
private listDns;
|
|
247
|
+
private getDnsCapabilities;
|
|
157
248
|
private createDns;
|
|
158
249
|
private updateDns;
|
|
159
250
|
private deleteDns;
|
|
251
|
+
private changeDns;
|
|
252
|
+
private importDns;
|
|
253
|
+
private exportDns;
|
|
160
254
|
private withdrawRenewal;
|
|
161
255
|
private getServicePlan;
|
|
162
256
|
private purchaseServicePlan;
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { AgentDomain } from '@agentdomain/sdk';
|
|
2
|
+
import { AgentDomain, encodeSetAutoRenewCalldata } from '@agentdomain/sdk';
|
|
3
|
+
import { DNS_RECORD_TYPES, dnsRecordSchema } from '@agentdomain/shared';
|
|
3
4
|
import { AGENTDOMAIN_API_BASE_URL, SERVICE_PLAN_KEYS, SUPPORTED_FRAMEWORKS, SUPPORTED_TLDS, } from '@agentdomain/shared/constants';
|
|
4
|
-
import { createPublicClient, createWalletClient, http
|
|
5
|
+
import { createPublicClient, createWalletClient, http } from 'viem';
|
|
5
6
|
import { base, baseSepolia } from 'viem/chains';
|
|
6
7
|
const RegisterSchema = z.object({
|
|
7
8
|
preferredName: z.string().min(3).max(63),
|
|
@@ -90,26 +91,56 @@ const EnableAutoRenewSchema = z.object({
|
|
|
90
91
|
const SslReconfigureSchema = z.object({
|
|
91
92
|
agentId: z.string().min(1),
|
|
92
93
|
});
|
|
93
|
-
const DnsRecordTypeSchema = z.enum(
|
|
94
|
+
const DnsRecordTypeSchema = z.enum(DNS_RECORD_TYPES);
|
|
94
95
|
const ListDnsSchema = z.object({
|
|
95
96
|
agentId: z.string().min(1),
|
|
96
97
|
});
|
|
97
|
-
const CreateDnsSchema = z
|
|
98
|
+
const CreateDnsSchema = z
|
|
99
|
+
.object({
|
|
98
100
|
agentId: z.string().min(1),
|
|
99
101
|
type: DnsRecordTypeSchema,
|
|
100
102
|
name: z.string().min(1).max(253),
|
|
101
|
-
value: z.string().min(1).max(
|
|
103
|
+
value: z.string().min(1).max(65_535).optional(),
|
|
104
|
+
data: z.record(z.unknown()).optional(),
|
|
102
105
|
ttl: z.number().int().min(60).max(3600).default(3600),
|
|
103
|
-
priority: z.number().int().min(0).optional(),
|
|
106
|
+
priority: z.number().int().min(0).max(65_535).optional(),
|
|
107
|
+
})
|
|
108
|
+
.refine((record) => record.value !== undefined || record.data !== undefined, {
|
|
109
|
+
message: 'Provide structured data or the legacy value field',
|
|
110
|
+
path: ['data'],
|
|
104
111
|
});
|
|
105
|
-
const UpdateDnsSchema =
|
|
112
|
+
const UpdateDnsSchema = z.object({
|
|
106
113
|
agentId: z.string().min(1),
|
|
107
114
|
recordId: z.string().min(1),
|
|
115
|
+
type: DnsRecordTypeSchema.optional(),
|
|
116
|
+
name: z.string().min(1).max(253).optional(),
|
|
117
|
+
value: z.string().min(1).max(65_535).optional(),
|
|
118
|
+
data: z.record(z.unknown()).optional(),
|
|
119
|
+
ttl: z.number().int().min(60).max(3600).optional(),
|
|
120
|
+
priority: z.number().int().min(0).max(65_535).optional(),
|
|
108
121
|
});
|
|
109
122
|
const DeleteDnsSchema = z.object({
|
|
110
123
|
agentId: z.string().min(1),
|
|
111
124
|
recordId: z.string().min(1),
|
|
112
125
|
});
|
|
126
|
+
const ChangeDnsSchema = z.object({
|
|
127
|
+
agentId: z.string().min(1),
|
|
128
|
+
records: z.array(dnsRecordSchema).min(1).max(200),
|
|
129
|
+
mode: z.enum(['merge', 'replace']).default('merge'),
|
|
130
|
+
dryRun: z.boolean().default(true),
|
|
131
|
+
baseRevision: z.string().length(64).optional(),
|
|
132
|
+
});
|
|
133
|
+
const ImportDnsSchema = z.object({
|
|
134
|
+
agentId: z.string().min(1),
|
|
135
|
+
zoneFile: z.string().min(1).max(262_144),
|
|
136
|
+
mode: z.enum(['merge', 'replace']).default('merge'),
|
|
137
|
+
dryRun: z.boolean().default(true),
|
|
138
|
+
baseRevision: z.string().length(64).optional(),
|
|
139
|
+
});
|
|
140
|
+
const ExportDnsSchema = z.object({
|
|
141
|
+
agentId: z.string().min(1),
|
|
142
|
+
scope: z.enum(['user', 'all']).default('user'),
|
|
143
|
+
});
|
|
113
144
|
const WithdrawRenewalSchema = z.object({
|
|
114
145
|
agentId: z.string().min(1),
|
|
115
146
|
amountUsdc: z.string().regex(/^\d+(\.\d{1,6})?$/, 'Use a USDC amount with up to 6 decimals'),
|
|
@@ -151,12 +182,14 @@ export class AgentDomainActionProvider {
|
|
|
151
182
|
baseRpcUrl;
|
|
152
183
|
renewalVaultAddress;
|
|
153
184
|
network;
|
|
185
|
+
builderCode;
|
|
154
186
|
constructor(opts = {}) {
|
|
155
187
|
this.apiUrl = opts.apiUrl ?? AGENTDOMAIN_API_BASE_URL;
|
|
156
188
|
this.apiKey = opts.apiKey;
|
|
157
189
|
this.baseRpcUrl = opts.baseRpcUrl ?? 'https://mainnet.base.org';
|
|
158
190
|
this.renewalVaultAddress = opts.renewalVaultAddress;
|
|
159
191
|
this.network = opts.network ?? 'base';
|
|
192
|
+
this.builderCode = opts.builderCode;
|
|
160
193
|
}
|
|
161
194
|
createAgentDomain(walletProvider) {
|
|
162
195
|
const wallet = walletProvider.getAddress();
|
|
@@ -178,6 +211,7 @@ export class AgentDomainActionProvider {
|
|
|
178
211
|
apiKey: this.apiKey,
|
|
179
212
|
network: this.network,
|
|
180
213
|
renewalVaultAddress: this.renewalVaultAddress,
|
|
214
|
+
builderCode: this.builderCode,
|
|
181
215
|
walletClient: walletClient,
|
|
182
216
|
publicClient: publicClient,
|
|
183
217
|
});
|
|
@@ -263,6 +297,12 @@ export class AgentDomainActionProvider {
|
|
|
263
297
|
schema: SslReconfigureSchema,
|
|
264
298
|
invoke: this.reconfigureSsl.bind(this),
|
|
265
299
|
},
|
|
300
|
+
{
|
|
301
|
+
name: 'get_dns_capabilities',
|
|
302
|
+
description: 'Get machine-readable DNS types, fields, limits, and provider constraints.',
|
|
303
|
+
schema: ListDnsSchema,
|
|
304
|
+
invoke: this.getDnsCapabilities.bind(this),
|
|
305
|
+
},
|
|
266
306
|
{
|
|
267
307
|
name: 'list_dns_records',
|
|
268
308
|
description: 'List DNS records for an AgentDomain identity.',
|
|
@@ -287,6 +327,24 @@ export class AgentDomainActionProvider {
|
|
|
287
327
|
schema: DeleteDnsSchema,
|
|
288
328
|
invoke: this.deleteDns.bind(this),
|
|
289
329
|
},
|
|
330
|
+
{
|
|
331
|
+
name: 'change_dns_records',
|
|
332
|
+
description: 'Preview or apply a revision-protected DNS batch in merge or replace mode.',
|
|
333
|
+
schema: ChangeDnsSchema,
|
|
334
|
+
invoke: this.changeDns.bind(this),
|
|
335
|
+
},
|
|
336
|
+
{
|
|
337
|
+
name: 'import_dns_zone',
|
|
338
|
+
description: 'Preview or apply a validated BIND zone import without deleting system-managed records.',
|
|
339
|
+
schema: ImportDnsSchema,
|
|
340
|
+
invoke: this.importDns.bind(this),
|
|
341
|
+
},
|
|
342
|
+
{
|
|
343
|
+
name: 'export_dns_zone',
|
|
344
|
+
description: 'Export user or permitted complete DNS state as a BIND zone file.',
|
|
345
|
+
schema: ExportDnsSchema,
|
|
346
|
+
invoke: this.exportDns.bind(this),
|
|
347
|
+
},
|
|
290
348
|
{
|
|
291
349
|
name: 'withdraw_renewal_vault',
|
|
292
350
|
description: 'Withdraw unused USDC from an AgentID renewal vault. Requires the AgentID NFT owner wallet.',
|
|
@@ -338,30 +396,29 @@ export class AgentDomainActionProvider {
|
|
|
338
396
|
];
|
|
339
397
|
}
|
|
340
398
|
async register(walletProvider, args) {
|
|
341
|
-
const { ad, wallet } = this.createAgentDomain(walletProvider);
|
|
399
|
+
const { ad, wallet, publicClient } = this.createAgentDomain(walletProvider);
|
|
342
400
|
const result = await ad.register({ ...args, emailEnabled: true, wallet });
|
|
343
401
|
let autoRenewMsg = '';
|
|
344
402
|
if (args.autoRenew && this.renewalVaultAddress) {
|
|
345
403
|
try {
|
|
346
404
|
if (walletProvider.sendTransaction) {
|
|
347
|
-
const data =
|
|
348
|
-
abi: [
|
|
349
|
-
{
|
|
350
|
-
type: 'function',
|
|
351
|
-
name: 'setAutoRenew',
|
|
352
|
-
inputs: [
|
|
353
|
-
{ name: 'tokenId', type: 'uint256' },
|
|
354
|
-
{ name: 'enabled', type: 'bool' },
|
|
355
|
-
],
|
|
356
|
-
},
|
|
357
|
-
],
|
|
358
|
-
functionName: 'setAutoRenew',
|
|
359
|
-
args: [BigInt(result.nftTokenId), true],
|
|
360
|
-
});
|
|
405
|
+
const data = encodeSetAutoRenewCalldata(BigInt(result.nftTokenId), true, this.requireBuilderCode('Registration auto-renew'));
|
|
361
406
|
const txHash = await walletProvider.sendTransaction({
|
|
362
407
|
to: this.renewalVaultAddress,
|
|
363
408
|
data,
|
|
364
409
|
});
|
|
410
|
+
let receipt;
|
|
411
|
+
try {
|
|
412
|
+
receipt = await publicClient.waitForTransactionReceipt({
|
|
413
|
+
hash: txHash,
|
|
414
|
+
});
|
|
415
|
+
}
|
|
416
|
+
catch (e) {
|
|
417
|
+
throw new Error(`Auto-renew transaction ${txHash} was submitted but confirmation failed or remained pending: ${String(e)}`);
|
|
418
|
+
}
|
|
419
|
+
if (receipt.status !== 'success') {
|
|
420
|
+
throw new Error(`Auto-renew transaction ${txHash} confirmed with status ${receipt.status}; auto-renew was not enabled.`);
|
|
421
|
+
}
|
|
365
422
|
autoRenewMsg = ` Auto-renew enabled via tx ${txHash}.`;
|
|
366
423
|
}
|
|
367
424
|
else {
|
|
@@ -403,25 +460,18 @@ export class AgentDomainActionProvider {
|
|
|
403
460
|
if (status.ownerAddress && status.ownerAddress.toLowerCase() !== wallet.toLowerCase()) {
|
|
404
461
|
throw new Error(`Only the AgentID NFT owner (${status.ownerAddress}) can enable auto-renew.`);
|
|
405
462
|
}
|
|
406
|
-
const data =
|
|
407
|
-
abi: [
|
|
408
|
-
{
|
|
409
|
-
type: 'function',
|
|
410
|
-
name: 'setAutoRenew',
|
|
411
|
-
inputs: [
|
|
412
|
-
{ name: 'tokenId', type: 'uint256' },
|
|
413
|
-
{ name: 'enabled', type: 'bool' },
|
|
414
|
-
],
|
|
415
|
-
},
|
|
416
|
-
],
|
|
417
|
-
functionName: 'setAutoRenew',
|
|
418
|
-
args: [BigInt(status.tokenId), true],
|
|
419
|
-
});
|
|
463
|
+
const data = encodeSetAutoRenewCalldata(BigInt(status.tokenId), true, this.requireBuilderCode('Auto-renew'));
|
|
420
464
|
const txHash = await walletProvider.sendTransaction({
|
|
421
465
|
to: this.renewalVaultAddress,
|
|
422
466
|
data,
|
|
423
467
|
});
|
|
424
|
-
return `Auto-renew
|
|
468
|
+
return `Auto-renew transaction submitted via tx ${txHash}.`;
|
|
469
|
+
}
|
|
470
|
+
requireBuilderCode(operation) {
|
|
471
|
+
if (!this.builderCode) {
|
|
472
|
+
throw new Error(`${operation} requires builderCode in AgentDomainActionProvider options so the direct Base transaction is attributed.`);
|
|
473
|
+
}
|
|
474
|
+
return this.builderCode;
|
|
425
475
|
}
|
|
426
476
|
async reconfigureSsl(walletProvider, args) {
|
|
427
477
|
const { ad } = this.createAgentDomain(walletProvider);
|
|
@@ -433,6 +483,10 @@ export class AgentDomainActionProvider {
|
|
|
433
483
|
const records = await ad.listDnsRecords(args.agentId);
|
|
434
484
|
return JSON.stringify(records, null, 2);
|
|
435
485
|
}
|
|
486
|
+
async getDnsCapabilities(walletProvider, args) {
|
|
487
|
+
const { ad } = this.createAgentDomain(walletProvider);
|
|
488
|
+
return JSON.stringify(await ad.getDnsCapabilities(args.agentId), null, 2);
|
|
489
|
+
}
|
|
436
490
|
async createDns(walletProvider, args) {
|
|
437
491
|
const { ad } = this.createAgentDomain(walletProvider);
|
|
438
492
|
const { agentId, ...record } = args;
|
|
@@ -450,6 +504,24 @@ export class AgentDomainActionProvider {
|
|
|
450
504
|
await ad.deleteDnsRecord(args.agentId, args.recordId);
|
|
451
505
|
return `Deleted DNS record ${args.recordId}.`;
|
|
452
506
|
}
|
|
507
|
+
async changeDns(walletProvider, args) {
|
|
508
|
+
const { ad } = this.createAgentDomain(walletProvider);
|
|
509
|
+
const result = args.dryRun
|
|
510
|
+
? await ad.previewDnsBatch(args.agentId, args.records, args.mode)
|
|
511
|
+
: await ad.applyDnsBatch(args.agentId, args.records, requireDnsRevision(args.baseRevision), args.mode);
|
|
512
|
+
return JSON.stringify(result, null, 2);
|
|
513
|
+
}
|
|
514
|
+
async importDns(walletProvider, args) {
|
|
515
|
+
const { ad } = this.createAgentDomain(walletProvider);
|
|
516
|
+
const result = args.dryRun
|
|
517
|
+
? await ad.previewDnsImport(args.agentId, args.zoneFile, args.mode)
|
|
518
|
+
: await ad.applyDnsImport(args.agentId, args.zoneFile, requireDnsRevision(args.baseRevision), args.mode);
|
|
519
|
+
return JSON.stringify(result, null, 2);
|
|
520
|
+
}
|
|
521
|
+
async exportDns(walletProvider, args) {
|
|
522
|
+
const { ad } = this.createAgentDomain(walletProvider);
|
|
523
|
+
return ad.exportDnsZone(args.agentId, args.scope);
|
|
524
|
+
}
|
|
453
525
|
async withdrawRenewal(walletProvider, args) {
|
|
454
526
|
if (!walletProvider.sendTransaction) {
|
|
455
527
|
throw new Error('walletProvider.sendTransaction is required to withdraw vault funds.');
|
|
@@ -552,4 +624,9 @@ export class AgentDomainActionProvider {
|
|
|
552
624
|
return `Deleted email alias ${args.emailAddress}.`;
|
|
553
625
|
}
|
|
554
626
|
}
|
|
627
|
+
function requireDnsRevision(value) {
|
|
628
|
+
if (!value)
|
|
629
|
+
throw new Error('Apply requires baseRevision from a fresh DNS dry-run preview.');
|
|
630
|
+
return value;
|
|
631
|
+
}
|
|
555
632
|
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.7.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",
|
|
@@ -18,6 +18,8 @@
|
|
|
18
18
|
"files": [
|
|
19
19
|
"dist",
|
|
20
20
|
"README.md",
|
|
21
|
+
"LICENSE",
|
|
22
|
+
"NOTICE",
|
|
21
23
|
"package.json"
|
|
22
24
|
],
|
|
23
25
|
"publishConfig": {
|
|
@@ -26,8 +28,8 @@
|
|
|
26
28
|
"dependencies": {
|
|
27
29
|
"viem": "^2.55.2",
|
|
28
30
|
"zod": "^3.24.1",
|
|
29
|
-
"@agentdomain/
|
|
30
|
-
"@agentdomain/
|
|
31
|
+
"@agentdomain/shared": "^0.7.0",
|
|
32
|
+
"@agentdomain/sdk": "^0.7.0"
|
|
31
33
|
},
|
|
32
34
|
"peerDependencies": {
|
|
33
35
|
"@coinbase/agentkit": "^0.1.0"
|
|
@@ -37,6 +39,7 @@
|
|
|
37
39
|
},
|
|
38
40
|
"scripts": {
|
|
39
41
|
"build": "tsc",
|
|
42
|
+
"test": "pnpm --filter @agentdomain/sdk build && pnpm run build && node --test test/*.test.mjs",
|
|
40
43
|
"typecheck": "tsc --noEmit",
|
|
41
44
|
"lint": "echo \"no lint\""
|
|
42
45
|
}
|