@agentdomain/eliza-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 +38 -0
- package/dist/index.js +213 -244
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -10,10 +10,10 @@ The plugin gives Eliza agents a complete AgentDomain lifecycle surface:
|
|
|
10
10
|
|
|
11
11
|
- Registration quote and x402 registration
|
|
12
12
|
- Registry discovery
|
|
13
|
-
- Agent email send/list/batch, monthly usage, signed inbound webhooks, primary address updates, and Starter/Pro/Enterprise aliases
|
|
13
|
+
- Agent email send/list/delete/batch, monthly usage, signed inbound webhooks, primary address updates, and Starter/Pro/Enterprise aliases
|
|
14
14
|
- DNS management
|
|
15
15
|
- SSL repair/reconfiguration
|
|
16
16
|
- RenewalVault status, funding, and auto-renew
|
|
17
|
-
- Per-agent Premium Plan status and
|
|
17
|
+
- Per-agent Premium Plan status, upgrades, and exact next-renewal tier selection
|
|
18
18
|
|
|
19
19
|
Configure `AGENTDOMAIN_API_URL` only if you need a custom endpoint. The default is `https://agentdomain.app/api/v1`.
|
package/dist/index.d.ts
CHANGED
|
@@ -70,6 +70,20 @@ export declare const listEmailAction: {
|
|
|
70
70
|
data: import("@agentdomain/sdk").EmailListResult;
|
|
71
71
|
}>;
|
|
72
72
|
};
|
|
73
|
+
export declare const deleteEmailMessageAction: {
|
|
74
|
+
name: string;
|
|
75
|
+
description: string;
|
|
76
|
+
similes: string[];
|
|
77
|
+
examples: never[];
|
|
78
|
+
validate: (runtime: IAgentRuntime) => Promise<boolean>;
|
|
79
|
+
handler: (runtime: IAgentRuntime, message: Memory) => Promise<{
|
|
80
|
+
text: string;
|
|
81
|
+
data: {
|
|
82
|
+
deleted: true;
|
|
83
|
+
messageId: string;
|
|
84
|
+
};
|
|
85
|
+
}>;
|
|
86
|
+
};
|
|
73
87
|
export declare const sendEmailAction: {
|
|
74
88
|
name: string;
|
|
75
89
|
description: string;
|
|
@@ -277,6 +291,17 @@ export declare const setRegistryVisibilityAction: {
|
|
|
277
291
|
data: import("@agentdomain/sdk").RegistryVisibilityResult;
|
|
278
292
|
}>;
|
|
279
293
|
};
|
|
294
|
+
export declare const scheduleServicePlanRenewalAction: {
|
|
295
|
+
name: string;
|
|
296
|
+
description: string;
|
|
297
|
+
similes: string[];
|
|
298
|
+
examples: never[];
|
|
299
|
+
validate: (runtime: IAgentRuntime) => Promise<boolean>;
|
|
300
|
+
handler: (runtime: IAgentRuntime, message: Memory) => Promise<{
|
|
301
|
+
text: string;
|
|
302
|
+
data: import("@agentdomain/sdk").ServicePlanRenewalResult;
|
|
303
|
+
}>;
|
|
304
|
+
};
|
|
280
305
|
export declare const purchaseServicePlanAction: {
|
|
281
306
|
name: string;
|
|
282
307
|
description: string;
|
|
@@ -346,6 +371,19 @@ export declare const agentDomainPlugin: {
|
|
|
346
371
|
text: string;
|
|
347
372
|
data: import("@agentdomain/sdk").EmailListResult;
|
|
348
373
|
}>;
|
|
374
|
+
} | {
|
|
375
|
+
name: string;
|
|
376
|
+
description: string;
|
|
377
|
+
similes: string[];
|
|
378
|
+
examples: never[];
|
|
379
|
+
validate: (runtime: IAgentRuntime) => Promise<boolean>;
|
|
380
|
+
handler: (runtime: IAgentRuntime, message: Memory) => Promise<{
|
|
381
|
+
text: string;
|
|
382
|
+
data: {
|
|
383
|
+
deleted: true;
|
|
384
|
+
messageId: string;
|
|
385
|
+
};
|
|
386
|
+
}>;
|
|
349
387
|
} | {
|
|
350
388
|
name: string;
|
|
351
389
|
description: string;
|
package/dist/index.js
CHANGED
|
@@ -1,37 +1,24 @@
|
|
|
1
|
-
import { AgentDomain } from
|
|
2
|
-
import { AGENTDOMAIN_API_BASE_URL, SERVICE_PLAN_KEYS, SUPPORTED_TLDS, } from
|
|
3
|
-
import { createPublicClient, createWalletClient, http, } from
|
|
4
|
-
import { privateKeyToAccount } from
|
|
5
|
-
import { base, baseSepolia } from
|
|
6
|
-
import { z } from
|
|
1
|
+
import { AgentDomain } from '@agentdomain/sdk';
|
|
2
|
+
import { AGENTDOMAIN_API_BASE_URL, SERVICE_PLAN_KEYS, SUPPORTED_TLDS, } from '@agentdomain/shared/constants';
|
|
3
|
+
import { createPublicClient, createWalletClient, http, } from 'viem';
|
|
4
|
+
import { privateKeyToAccount } from 'viem/accounts';
|
|
5
|
+
import { base, baseSepolia } from 'viem/chains';
|
|
6
|
+
import { z } from 'zod';
|
|
7
7
|
function getClients(runtime, opts = {}) {
|
|
8
|
-
const apiUrl = runtime.getSetting(
|
|
9
|
-
const apiKey = runtime.getSetting(
|
|
10
|
-
const pk = runtime.getSetting(
|
|
11
|
-
const rpc = runtime.getSetting(
|
|
12
|
-
const network = runtime.getSetting(
|
|
13
|
-
|
|
14
|
-
const chain = network === "base-sepolia" ? baseSepolia : base;
|
|
8
|
+
const apiUrl = runtime.getSetting('AGENTDOMAIN_API_URL') ?? AGENTDOMAIN_API_BASE_URL;
|
|
9
|
+
const apiKey = runtime.getSetting('AGENTDOMAIN_API_KEY');
|
|
10
|
+
const pk = runtime.getSetting('AGENT_PRIVATE_KEY');
|
|
11
|
+
const rpc = runtime.getSetting('BASE_RPC_URL') ?? 'https://mainnet.base.org';
|
|
12
|
+
const network = runtime.getSetting('AGENTDOMAIN_NETWORK') ?? 'base';
|
|
13
|
+
const chain = network === 'base-sepolia' ? baseSepolia : base;
|
|
15
14
|
if (!pk) {
|
|
16
15
|
if (opts.requireWallet)
|
|
17
|
-
throw new Error(
|
|
16
|
+
throw new Error('AGENT_PRIVATE_KEY not set');
|
|
18
17
|
const ad = new AgentDomain({ apiUrl, apiKey, network });
|
|
19
|
-
return {
|
|
20
|
-
ad,
|
|
21
|
-
account: null,
|
|
22
|
-
walletClient: null,
|
|
23
|
-
publicClient: null,
|
|
24
|
-
network,
|
|
25
|
-
chain,
|
|
26
|
-
rpc,
|
|
27
|
-
};
|
|
18
|
+
return { ad, account: null, walletClient: null, publicClient: null, network, chain, rpc };
|
|
28
19
|
}
|
|
29
20
|
const account = privateKeyToAccount(pk);
|
|
30
|
-
const walletClient = createWalletClient({
|
|
31
|
-
account,
|
|
32
|
-
chain,
|
|
33
|
-
transport: http(rpc),
|
|
34
|
-
});
|
|
21
|
+
const walletClient = createWalletClient({ account, chain, transport: http(rpc) });
|
|
35
22
|
const publicClient = createPublicClient({ chain, transport: http(rpc) });
|
|
36
23
|
const ad = new AgentDomain({
|
|
37
24
|
apiUrl,
|
|
@@ -42,7 +29,7 @@ function getClients(runtime, opts = {}) {
|
|
|
42
29
|
});
|
|
43
30
|
return { ad, account, walletClient, publicClient, network, chain, rpc };
|
|
44
31
|
}
|
|
45
|
-
const TLD_PATTERN = new RegExp(String.raw `([a-z0-9-]{3,63})\.([a-z]{2,20})\b`,
|
|
32
|
+
const TLD_PATTERN = new RegExp(String.raw `([a-z0-9-]{3,63})\.([a-z]{2,20})\b`, 'i');
|
|
46
33
|
const UUID_PATTERN = /[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}/i;
|
|
47
34
|
const AMOUNT_PATTERN = /\$?\s*(\d+(?:\.\d{1,6})?)\s*(?:usdc)?/i;
|
|
48
35
|
const EMAIL_PATTERN = /[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}/i;
|
|
@@ -50,22 +37,17 @@ const EMAIL_GLOBAL_PATTERN = /[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}/gi;
|
|
|
50
37
|
const EMAIL_USERNAME_PATTERN = /^[a-z0-9](?:[a-z0-9._+-]{0,62}[a-z0-9])?$/;
|
|
51
38
|
const registerSchema = z.object({
|
|
52
39
|
preferredName: z.string(),
|
|
53
|
-
tld: z.enum(SUPPORTED_TLDS).default(
|
|
40
|
+
tld: z.enum(SUPPORTED_TLDS).default('xyz'),
|
|
54
41
|
registerBasename: z.boolean().default(true),
|
|
55
42
|
registerEns: z.boolean().default(false),
|
|
56
43
|
emailEnabled: z.boolean().default(true),
|
|
57
|
-
emailUsername: z
|
|
58
|
-
.string()
|
|
59
|
-
.trim()
|
|
60
|
-
.toLowerCase()
|
|
61
|
-
.regex(EMAIL_USERNAME_PATTERN)
|
|
62
|
-
.default("agent"),
|
|
44
|
+
emailUsername: z.string().trim().toLowerCase().regex(EMAIL_USERNAME_PATTERN).default('agent'),
|
|
63
45
|
years: z.number().int().min(1).max(10).default(1),
|
|
64
46
|
autoRenew: z.boolean().default(false),
|
|
65
|
-
premiumPlan: z.enum(SERVICE_PLAN_KEYS).default(
|
|
47
|
+
premiumPlan: z.enum(SERVICE_PLAN_KEYS).default('included'),
|
|
66
48
|
});
|
|
67
49
|
const dnsRecordSchema = z.object({
|
|
68
|
-
type: z.enum([
|
|
50
|
+
type: z.enum(['A', 'AAAA', 'ALIAS', 'CNAME', 'MX', 'TXT', 'NS', 'SRV']),
|
|
69
51
|
name: z.string(),
|
|
70
52
|
value: z.string(),
|
|
71
53
|
ttl: z.number().int().min(60).max(3600).default(3600),
|
|
@@ -75,61 +57,57 @@ function parseParamsFromText(text) {
|
|
|
75
57
|
const m = text.match(TLD_PATTERN);
|
|
76
58
|
const lower = text.toLowerCase();
|
|
77
59
|
const yearsMatch = lower.match(/([1-9]|10)\s*years?/);
|
|
78
|
-
const noBasename = lower.includes(
|
|
79
|
-
lower.includes(
|
|
80
|
-
lower.includes(
|
|
81
|
-
const noEns = lower.includes(
|
|
82
|
-
lower.includes("without ens") ||
|
|
83
|
-
lower.includes("skip ens");
|
|
60
|
+
const noBasename = lower.includes('no basename') ||
|
|
61
|
+
lower.includes('without basename') ||
|
|
62
|
+
lower.includes('skip basename');
|
|
63
|
+
const noEns = lower.includes('no ens') || lower.includes('without ens') || lower.includes('skip ens');
|
|
84
64
|
const wantsEns = /\bens\b/.test(lower);
|
|
85
65
|
return {
|
|
86
|
-
preferredName: m?.[1]?.toLowerCase() ??
|
|
87
|
-
tld: m?.[2]?.toLowerCase() ??
|
|
66
|
+
preferredName: m?.[1]?.toLowerCase() ?? 'agent',
|
|
67
|
+
tld: m?.[2]?.toLowerCase() ?? 'xyz',
|
|
88
68
|
registerBasename: !noBasename,
|
|
89
69
|
registerEns: wantsEns && !noEns,
|
|
90
70
|
emailEnabled: true,
|
|
91
|
-
emailUsername: parseEmailUsername(text) ??
|
|
71
|
+
emailUsername: parseEmailUsername(text) ?? 'agent',
|
|
92
72
|
years: yearsMatch ? parseInt(yearsMatch[1], 10) : 1,
|
|
93
|
-
autoRenew: lower.includes(
|
|
94
|
-
lower.includes("auto-renew") ||
|
|
95
|
-
lower.includes("autorenew"),
|
|
73
|
+
autoRenew: lower.includes('auto renew') || lower.includes('auto-renew') || lower.includes('autorenew'),
|
|
96
74
|
premiumPlan: parseRegistrationPlan(lower),
|
|
97
75
|
};
|
|
98
76
|
}
|
|
99
77
|
function requireAgentId(text) {
|
|
100
78
|
const agentId = text.match(UUID_PATTERN)?.[0];
|
|
101
79
|
if (!agentId)
|
|
102
|
-
throw new Error(
|
|
80
|
+
throw new Error('Agent ID UUID is required');
|
|
103
81
|
return agentId;
|
|
104
82
|
}
|
|
105
83
|
function parseAmountUsdc(text) {
|
|
106
84
|
const amount = text.match(AMOUNT_PATTERN)?.[1];
|
|
107
85
|
if (!amount)
|
|
108
|
-
throw new Error(
|
|
86
|
+
throw new Error('USDC amount is required');
|
|
109
87
|
return amount;
|
|
110
88
|
}
|
|
111
89
|
function parseRegistrationPlan(lower) {
|
|
112
|
-
if (lower.includes(
|
|
113
|
-
return
|
|
114
|
-
if (lower.includes(
|
|
115
|
-
return
|
|
116
|
-
if (lower.includes(
|
|
117
|
-
return
|
|
118
|
-
return
|
|
90
|
+
if (lower.includes('enterprise'))
|
|
91
|
+
return 'enterprise';
|
|
92
|
+
if (lower.includes('pro'))
|
|
93
|
+
return 'pro';
|
|
94
|
+
if (lower.includes('starter'))
|
|
95
|
+
return 'starter';
|
|
96
|
+
return 'included';
|
|
119
97
|
}
|
|
120
98
|
function parsePlan(text) {
|
|
121
99
|
const lower = text.toLowerCase();
|
|
122
|
-
if (lower.includes(
|
|
100
|
+
if (lower.includes('enterprise')) {
|
|
123
101
|
const match = lower.match(/(\d+(?:\.\d+)?)\s*(k|m)/);
|
|
124
102
|
const monthly = match
|
|
125
|
-
? Math.round(Number(match[1]) * (match[2] ===
|
|
103
|
+
? Math.round(Number(match[1]) * (match[2] === 'm' ? 1_000_000 : 1_000))
|
|
126
104
|
: 100_000;
|
|
127
105
|
return {
|
|
128
|
-
plan:
|
|
106
|
+
plan: 'enterprise',
|
|
129
107
|
planSku: `enterprise-${monthly}`,
|
|
130
108
|
};
|
|
131
109
|
}
|
|
132
|
-
return { plan: lower.includes(
|
|
110
|
+
return { plan: lower.includes('starter') ? 'starter' : 'pro' };
|
|
133
111
|
}
|
|
134
112
|
function parseDnsRecord(text) {
|
|
135
113
|
const lower = text.toLowerCase();
|
|
@@ -139,16 +117,16 @@ function parseDnsRecord(text) {
|
|
|
139
117
|
const ttlMatch = text.match(/\bttl[:=]\s*(\d+)/i);
|
|
140
118
|
const priorityMatch = text.match(/\bpriority[:=]\s*(\d+)/i);
|
|
141
119
|
const parsed = dnsRecordSchema.parse({
|
|
142
|
-
type: typeMatch?.[1]?.toUpperCase() ?? (lower.includes(
|
|
143
|
-
name: nameMatch?.[1] ??
|
|
144
|
-
value: valueMatch?.[1] ?? text.match(/\b(?:\d{1,3}\.){3}\d{1,3}\b/)?.[0] ??
|
|
120
|
+
type: typeMatch?.[1]?.toUpperCase() ?? (lower.includes('txt') ? 'TXT' : 'A'),
|
|
121
|
+
name: nameMatch?.[1] ?? '@',
|
|
122
|
+
value: valueMatch?.[1] ?? text.match(/\b(?:\d{1,3}\.){3}\d{1,3}\b/)?.[0] ?? '',
|
|
145
123
|
ttl: ttlMatch ? Number(ttlMatch[1]) : 3600,
|
|
146
124
|
priority: priorityMatch ? Number(priorityMatch[1]) : undefined,
|
|
147
125
|
});
|
|
148
126
|
return parsed;
|
|
149
127
|
}
|
|
150
128
|
function parseEmailUsername(text) {
|
|
151
|
-
const explicit = text.match(/\b(?:email\s+username|primary\s+email|username|alias)[:=]?\s*([a-z0-9._+-]{1,64})/i)?.[1] ?? text.match(EMAIL_PATTERN)?.[0]?.split(
|
|
129
|
+
const explicit = text.match(/\b(?:email\s+username|primary\s+email|username|alias)[:=]?\s*([a-z0-9._+-]{1,64})/i)?.[1] ?? text.match(EMAIL_PATTERN)?.[0]?.split('@')[0];
|
|
152
130
|
const username = explicit?.trim().toLowerCase();
|
|
153
131
|
return username && EMAIL_USERNAME_PATTERN.test(username) ? username : null;
|
|
154
132
|
}
|
|
@@ -156,20 +134,18 @@ function parseEmailRequest(text) {
|
|
|
156
134
|
const fromAddress = text.match(/\bfrom[:=]\s*([A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,})/i)?.[1];
|
|
157
135
|
const explicitTo = text.match(/\bto[:=]\s*([A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,})/i)?.[1];
|
|
158
136
|
const emails = text.match(EMAIL_GLOBAL_PATTERN) ?? [];
|
|
159
|
-
const to = explicitTo ??
|
|
160
|
-
emails.find((email) => email.toLowerCase() !== fromAddress?.toLowerCase());
|
|
137
|
+
const to = explicitTo ?? emails.find((email) => email.toLowerCase() !== fromAddress?.toLowerCase());
|
|
161
138
|
if (!to)
|
|
162
|
-
throw new Error(
|
|
163
|
-
const subject = text.match(/\bsubject[:=]\s*([^|]+)/i)?.[1]?.trim() ??
|
|
164
|
-
"AgentDomain message";
|
|
139
|
+
throw new Error('Recipient email address is required');
|
|
140
|
+
const subject = text.match(/\bsubject[:=]\s*([^|]+)/i)?.[1]?.trim() ?? 'AgentDomain message';
|
|
165
141
|
const body = text.match(/\b(?:text|body|message)[:=]\s*([\s\S]+)/i)?.[1]?.trim() ??
|
|
166
|
-
text.replace(to,
|
|
167
|
-
return { to, fromAddress, subject, text: body ||
|
|
142
|
+
text.replace(to, '').trim();
|
|
143
|
+
return { to, fromAddress, subject, text: body || 'Hello from AgentDomain.' };
|
|
168
144
|
}
|
|
169
145
|
export const quoteRegistrationAction = {
|
|
170
|
-
name:
|
|
171
|
-
description:
|
|
172
|
-
similes: [
|
|
146
|
+
name: 'QUOTE_AGENT_REGISTRATION',
|
|
147
|
+
description: 'Quote an AgentDomain registration before paying.',
|
|
148
|
+
similes: ['PRICE_DOMAIN', 'REGISTRATION_QUOTE', 'QUOTE_IDENTITY'],
|
|
173
149
|
examples: [],
|
|
174
150
|
validate: async () => true,
|
|
175
151
|
handler: async (runtime, message) => {
|
|
@@ -183,58 +159,51 @@ export const quoteRegistrationAction = {
|
|
|
183
159
|
},
|
|
184
160
|
};
|
|
185
161
|
export const registerIdentityAction = {
|
|
186
|
-
name:
|
|
162
|
+
name: 'REGISTER_IDENTITY',
|
|
187
163
|
description: 'Register a complete agent identity bundle on AgentDomain. Domain, DNS, email setup, SSL certification, AgentID NFT orchestration, and platform fee are included by default. Users can say "no basename" to skip Basename, "with ENS" to add ENS, and "email username support" to customize the primary inbox.',
|
|
188
|
-
similes: [
|
|
164
|
+
similes: ['CLAIM_DOMAIN', 'CREATE_IDENTITY', 'GET_DOMAIN'],
|
|
189
165
|
examples: [
|
|
190
166
|
[
|
|
167
|
+
{ user: 'user1', content: { text: 'Register me as helpful-bot.ai email username support' } },
|
|
191
168
|
{
|
|
192
|
-
user:
|
|
193
|
-
content: {
|
|
194
|
-
text: "Register me as helpful-bot.ai email username support",
|
|
195
|
-
},
|
|
196
|
-
},
|
|
197
|
-
{
|
|
198
|
-
user: "agent",
|
|
169
|
+
user: 'agent',
|
|
199
170
|
content: {
|
|
200
171
|
text: "I'll register helpful-bot.ai with included email and SSL infrastructure now.",
|
|
201
|
-
action:
|
|
172
|
+
action: 'REGISTER_IDENTITY',
|
|
202
173
|
},
|
|
203
174
|
},
|
|
204
175
|
],
|
|
205
176
|
],
|
|
206
|
-
validate: async (runtime, _message) => Boolean(runtime.getSetting(
|
|
177
|
+
validate: async (runtime, _message) => Boolean(runtime.getSetting('AGENT_PRIVATE_KEY')),
|
|
207
178
|
handler: async (runtime, message) => {
|
|
208
179
|
const params = parseParamsFromText(message.content.text);
|
|
209
180
|
const validated = registerSchema.parse(params);
|
|
210
|
-
const { ad, account, walletClient, chain } = getClients(runtime, {
|
|
211
|
-
requireWallet: true,
|
|
212
|
-
});
|
|
181
|
+
const { ad, account, walletClient, chain } = getClients(runtime, { requireWallet: true });
|
|
213
182
|
if (!account || !walletClient)
|
|
214
|
-
throw new Error(
|
|
183
|
+
throw new Error('AGENT_PRIVATE_KEY not set');
|
|
215
184
|
const result = await ad.register({
|
|
216
185
|
...validated,
|
|
217
186
|
emailEnabled: true,
|
|
218
187
|
wallet: account.address,
|
|
219
188
|
});
|
|
220
|
-
let autoRenewMsg =
|
|
189
|
+
let autoRenewMsg = '';
|
|
221
190
|
if (validated.autoRenew) {
|
|
222
|
-
const vaultAddress = runtime.getSetting(
|
|
191
|
+
const vaultAddress = runtime.getSetting('RENEWAL_VAULT_ADDRESS');
|
|
223
192
|
if (vaultAddress) {
|
|
224
193
|
try {
|
|
225
194
|
const txHash = await walletClient.writeContract({
|
|
226
195
|
address: vaultAddress,
|
|
227
196
|
abi: [
|
|
228
197
|
{
|
|
229
|
-
type:
|
|
230
|
-
name:
|
|
198
|
+
type: 'function',
|
|
199
|
+
name: 'setAutoRenew',
|
|
231
200
|
inputs: [
|
|
232
|
-
{ name:
|
|
233
|
-
{ name:
|
|
201
|
+
{ name: 'tokenId', type: 'uint256' },
|
|
202
|
+
{ name: 'enabled', type: 'bool' },
|
|
234
203
|
],
|
|
235
204
|
},
|
|
236
205
|
],
|
|
237
|
-
functionName:
|
|
206
|
+
functionName: 'setAutoRenew',
|
|
238
207
|
args: [BigInt(result.nftTokenId), true],
|
|
239
208
|
chain,
|
|
240
209
|
account,
|
|
@@ -246,20 +215,19 @@ export const registerIdentityAction = {
|
|
|
246
215
|
}
|
|
247
216
|
}
|
|
248
217
|
else {
|
|
249
|
-
autoRenewMsg =
|
|
250
|
-
" (Requires RENEWAL_VAULT_ADDRESS env var to enable auto-renew on-chain).";
|
|
218
|
+
autoRenewMsg = ' (Requires RENEWAL_VAULT_ADDRESS env var to enable auto-renew on-chain).';
|
|
251
219
|
}
|
|
252
220
|
}
|
|
253
221
|
return {
|
|
254
|
-
text: `Registered ${result.domain}${result.basename ? ` and ${result.basename}` :
|
|
222
|
+
text: `Registered ${result.domain}${result.basename ? ` and ${result.basename}` : ''}. Token #${result.nftTokenId}.${autoRenewMsg}`,
|
|
255
223
|
data: result,
|
|
256
224
|
};
|
|
257
225
|
},
|
|
258
226
|
};
|
|
259
227
|
export const searchAgentsAction = {
|
|
260
|
-
name:
|
|
261
|
-
description:
|
|
262
|
-
similes: [
|
|
228
|
+
name: 'SEARCH_AGENTS',
|
|
229
|
+
description: 'Search the public AgentDomain registry by name, capability, or framework.',
|
|
230
|
+
similes: ['FIND_AGENT', 'DISCOVER_AGENT'],
|
|
263
231
|
examples: [],
|
|
264
232
|
validate: async () => true,
|
|
265
233
|
handler: async (runtime, message) => {
|
|
@@ -273,27 +241,41 @@ export const searchAgentsAction = {
|
|
|
273
241
|
},
|
|
274
242
|
};
|
|
275
243
|
export const listEmailAction = {
|
|
276
|
-
name:
|
|
277
|
-
description:
|
|
278
|
-
similes: [
|
|
244
|
+
name: 'LIST_AGENT_EMAIL',
|
|
245
|
+
description: 'List text-only email messages and extracted verification codes for an AgentDomain identity.',
|
|
246
|
+
similes: ['CHECK_EMAIL', 'READ_INBOX'],
|
|
279
247
|
examples: [],
|
|
280
|
-
validate: async (runtime) => Boolean(runtime.getSetting(
|
|
248
|
+
validate: async (runtime) => Boolean(runtime.getSetting('AGENT_PRIVATE_KEY')),
|
|
281
249
|
handler: async (runtime, message) => {
|
|
282
250
|
const { ad } = getClients(runtime);
|
|
283
251
|
const agentId = message.content.text.match(/[0-9a-f-]{36}/i)?.[0];
|
|
284
252
|
if (!agentId)
|
|
285
|
-
throw new Error(
|
|
253
|
+
throw new Error('Agent ID UUID is required to list email');
|
|
286
254
|
const result = await ad.listEmail(agentId, { limit: 20 });
|
|
287
255
|
return { text: `Found ${result.messages.length} messages.`, data: result };
|
|
288
256
|
},
|
|
289
257
|
};
|
|
258
|
+
export const deleteEmailMessageAction = {
|
|
259
|
+
name: 'DELETE_AGENT_EMAIL',
|
|
260
|
+
description: 'Permanently delete one AgentDomain email message.',
|
|
261
|
+
similes: ['DELETE_EMAIL_MESSAGE', 'REMOVE_EMAIL_MESSAGE'],
|
|
262
|
+
examples: [],
|
|
263
|
+
validate: async (runtime) => Boolean(runtime.getSetting('AGENT_PRIVATE_KEY') || runtime.getSetting('AGENTDOMAIN_API_KEY')),
|
|
264
|
+
handler: async (runtime, message) => {
|
|
265
|
+
const { ad } = getClients(runtime);
|
|
266
|
+
const ids = message.content.text.match(new RegExp(UUID_PATTERN.source, 'gi')) ?? [];
|
|
267
|
+
if (!ids[0] || !ids[1])
|
|
268
|
+
throw new Error('Agent ID and message ID UUIDs are required');
|
|
269
|
+
const result = await ad.deleteEmailMessage(ids[0], ids[1]);
|
|
270
|
+
return { text: `Deleted email message ${ids[1]}.`, data: result };
|
|
271
|
+
},
|
|
272
|
+
};
|
|
290
273
|
export const sendEmailAction = {
|
|
291
|
-
name:
|
|
292
|
-
description:
|
|
293
|
-
similes: [
|
|
274
|
+
name: 'SEND_AGENT_EMAIL',
|
|
275
|
+
description: 'Send text-only email from an AgentDomain primary address or active alias.',
|
|
276
|
+
similes: ['SEND_EMAIL', 'EMAIL_FROM_AGENT'],
|
|
294
277
|
examples: [],
|
|
295
|
-
validate: async (runtime) => Boolean(runtime.getSetting(
|
|
296
|
-
runtime.getSetting("AGENTDOMAIN_API_KEY")),
|
|
278
|
+
validate: async (runtime) => Boolean(runtime.getSetting('AGENT_PRIVATE_KEY') || runtime.getSetting('AGENTDOMAIN_API_KEY')),
|
|
297
279
|
handler: async (runtime, message) => {
|
|
298
280
|
const { ad } = getClients(runtime);
|
|
299
281
|
const agentId = requireAgentId(message.content.text);
|
|
@@ -303,12 +285,11 @@ export const sendEmailAction = {
|
|
|
303
285
|
},
|
|
304
286
|
};
|
|
305
287
|
export const emailUsageAction = {
|
|
306
|
-
name:
|
|
307
|
-
description:
|
|
308
|
-
similes: [
|
|
288
|
+
name: 'GET_AGENT_EMAIL_USAGE',
|
|
289
|
+
description: 'Get combined monthly sent and received email usage.',
|
|
290
|
+
similes: ['EMAIL_USAGE', 'EMAIL_QUOTA'],
|
|
309
291
|
examples: [],
|
|
310
|
-
validate: async (runtime) => Boolean(runtime.getSetting(
|
|
311
|
-
runtime.getSetting("AGENTDOMAIN_API_KEY")),
|
|
292
|
+
validate: async (runtime) => Boolean(runtime.getSetting('AGENT_PRIVATE_KEY') || runtime.getSetting('AGENTDOMAIN_API_KEY')),
|
|
312
293
|
handler: async (runtime, message) => {
|
|
313
294
|
const { ad } = getClients(runtime);
|
|
314
295
|
const result = await ad.getEmailUsage(requireAgentId(message.content.text));
|
|
@@ -319,123 +300,110 @@ export const emailUsageAction = {
|
|
|
319
300
|
},
|
|
320
301
|
};
|
|
321
302
|
export const configureEmailWebhookAction = {
|
|
322
|
-
name:
|
|
323
|
-
description:
|
|
324
|
-
similes: [
|
|
303
|
+
name: 'CONFIGURE_EMAIL_WEBHOOK',
|
|
304
|
+
description: 'Configure a signed inbound email webhook. Include an HTTPS URL in the request.',
|
|
305
|
+
similes: ['SET_EMAIL_WEBHOOK'],
|
|
325
306
|
examples: [],
|
|
326
|
-
validate: async (runtime) => Boolean(runtime.getSetting(
|
|
327
|
-
runtime.getSetting("AGENTDOMAIN_API_KEY")),
|
|
307
|
+
validate: async (runtime) => Boolean(runtime.getSetting('AGENT_PRIVATE_KEY') || runtime.getSetting('AGENTDOMAIN_API_KEY')),
|
|
328
308
|
handler: async (runtime, message) => {
|
|
329
309
|
const { ad } = getClients(runtime);
|
|
330
310
|
const agentId = requireAgentId(message.content.text);
|
|
331
311
|
const url = message.content.text.match(/https:\/\/[^\s]+/)?.[0];
|
|
332
312
|
if (!url)
|
|
333
|
-
throw new Error(
|
|
313
|
+
throw new Error('HTTPS webhook URL is required');
|
|
334
314
|
const result = await ad.setEmailWebhook(agentId, {
|
|
335
315
|
url,
|
|
336
|
-
payloadMode: /inline/i.test(message.content.text)
|
|
337
|
-
? "inline_text"
|
|
338
|
-
: "metadata",
|
|
316
|
+
payloadMode: /inline/i.test(message.content.text) ? 'inline_text' : 'metadata',
|
|
339
317
|
enabled: true,
|
|
340
318
|
});
|
|
341
|
-
return { text:
|
|
319
|
+
return { text: 'Inbound email webhook configured.', data: result };
|
|
342
320
|
},
|
|
343
321
|
};
|
|
344
322
|
export const sendEmailBatchAction = {
|
|
345
|
-
name:
|
|
346
|
-
description:
|
|
347
|
-
similes: [
|
|
323
|
+
name: 'SEND_AGENT_EMAIL_BATCH',
|
|
324
|
+
description: 'Queue up to 100 emails supplied as a JSON messages array.',
|
|
325
|
+
similes: ['BATCH_EMAIL'],
|
|
348
326
|
examples: [],
|
|
349
|
-
validate: async (runtime) => Boolean(runtime.getSetting(
|
|
350
|
-
runtime.getSetting("AGENTDOMAIN_API_KEY")),
|
|
327
|
+
validate: async (runtime) => Boolean(runtime.getSetting('AGENT_PRIVATE_KEY') || runtime.getSetting('AGENTDOMAIN_API_KEY')),
|
|
351
328
|
handler: async (runtime, message) => {
|
|
352
329
|
const { ad } = getClients(runtime);
|
|
353
330
|
const agentId = requireAgentId(message.content.text);
|
|
354
|
-
const json = message.content.text.slice(message.content.text.indexOf(
|
|
331
|
+
const json = message.content.text.slice(message.content.text.indexOf('{'));
|
|
355
332
|
const parsed = JSON.parse(json);
|
|
356
|
-
const result = await ad.sendEmailBatch(agentId, {
|
|
357
|
-
messages: parsed.messages,
|
|
358
|
-
});
|
|
333
|
+
const result = await ad.sendEmailBatch(agentId, { messages: parsed.messages });
|
|
359
334
|
return { text: `Queued ${result.jobs.length} email jobs.`, data: result };
|
|
360
335
|
},
|
|
361
336
|
};
|
|
362
337
|
export const updatePrimaryEmailAction = {
|
|
363
|
-
name:
|
|
364
|
-
description:
|
|
365
|
-
similes: [
|
|
338
|
+
name: 'UPDATE_PRIMARY_EMAIL',
|
|
339
|
+
description: 'Change an AgentDomain primary email username. The old primary address stops receiving new mail.',
|
|
340
|
+
similes: ['CHANGE_PRIMARY_EMAIL', 'RENAME_EMAIL'],
|
|
366
341
|
examples: [],
|
|
367
|
-
validate: async (runtime) => Boolean(runtime.getSetting(
|
|
368
|
-
runtime.getSetting("AGENTDOMAIN_API_KEY")),
|
|
342
|
+
validate: async (runtime) => Boolean(runtime.getSetting('AGENT_PRIVATE_KEY') || runtime.getSetting('AGENTDOMAIN_API_KEY')),
|
|
369
343
|
handler: async (runtime, message) => {
|
|
370
344
|
const { ad } = getClients(runtime);
|
|
371
345
|
const agentId = requireAgentId(message.content.text);
|
|
372
346
|
const username = parseEmailUsername(message.content.text);
|
|
373
347
|
if (!username)
|
|
374
|
-
throw new Error(
|
|
348
|
+
throw new Error('New email username is required');
|
|
375
349
|
const result = await ad.updatePrimaryEmail(agentId, username);
|
|
376
350
|
return { text: result.message, data: result };
|
|
377
351
|
},
|
|
378
352
|
};
|
|
379
353
|
export const createEmailAliasAction = {
|
|
380
|
-
name:
|
|
381
|
-
description:
|
|
382
|
-
similes: [
|
|
354
|
+
name: 'CREATE_EMAIL_ALIAS',
|
|
355
|
+
description: 'Create a receive-and-send email alias for an AgentDomain identity. Requires available paid-plan alias capacity.',
|
|
356
|
+
similes: ['ADD_EMAIL_ALIAS', 'CREATE_ALIAS'],
|
|
383
357
|
examples: [],
|
|
384
|
-
validate: async (runtime) => Boolean(runtime.getSetting(
|
|
385
|
-
runtime.getSetting("AGENTDOMAIN_API_KEY")),
|
|
358
|
+
validate: async (runtime) => Boolean(runtime.getSetting('AGENT_PRIVATE_KEY') || runtime.getSetting('AGENTDOMAIN_API_KEY')),
|
|
386
359
|
handler: async (runtime, message) => {
|
|
387
360
|
const { ad } = getClients(runtime);
|
|
388
361
|
const agentId = requireAgentId(message.content.text);
|
|
389
362
|
const username = parseEmailUsername(message.content.text);
|
|
390
363
|
if (!username)
|
|
391
|
-
throw new Error(
|
|
364
|
+
throw new Error('Alias username is required');
|
|
392
365
|
const result = await ad.createEmailAlias(agentId, username);
|
|
393
|
-
return {
|
|
394
|
-
text: `Created email alias ${result.address.emailAddress}.`,
|
|
395
|
-
data: result,
|
|
396
|
-
};
|
|
366
|
+
return { text: `Created email alias ${result.address.emailAddress}.`, data: result };
|
|
397
367
|
},
|
|
398
368
|
};
|
|
399
369
|
export const deleteEmailAliasAction = {
|
|
400
|
-
name:
|
|
401
|
-
description:
|
|
402
|
-
similes: [
|
|
370
|
+
name: 'DELETE_EMAIL_ALIAS',
|
|
371
|
+
description: 'Delete an active AgentDomain email alias.',
|
|
372
|
+
similes: ['REMOVE_EMAIL_ALIAS', 'DELETE_ALIAS'],
|
|
403
373
|
examples: [],
|
|
404
|
-
validate: async (runtime) => Boolean(runtime.getSetting(
|
|
405
|
-
runtime.getSetting("AGENTDOMAIN_API_KEY")),
|
|
374
|
+
validate: async (runtime) => Boolean(runtime.getSetting('AGENT_PRIVATE_KEY') || runtime.getSetting('AGENTDOMAIN_API_KEY')),
|
|
406
375
|
handler: async (runtime, message) => {
|
|
407
376
|
const { ad } = getClients(runtime);
|
|
408
377
|
const agentId = requireAgentId(message.content.text);
|
|
409
378
|
const emailAddress = message.content.text.match(EMAIL_PATTERN)?.[0];
|
|
410
379
|
if (!emailAddress)
|
|
411
|
-
throw new Error(
|
|
380
|
+
throw new Error('Full alias email address is required');
|
|
412
381
|
const result = await ad.deleteEmailAlias(agentId, emailAddress);
|
|
413
382
|
return { text: `Deleted email alias ${emailAddress}.`, data: result };
|
|
414
383
|
},
|
|
415
384
|
};
|
|
416
385
|
export const renewalStatusAction = {
|
|
417
|
-
name:
|
|
418
|
-
description:
|
|
419
|
-
similes: [
|
|
386
|
+
name: 'GET_RENEWAL_STATUS',
|
|
387
|
+
description: 'Get RenewalVault balance, shortfall, renewal amount, and auto-renew state.',
|
|
388
|
+
similes: ['RENEWAL_STATUS', 'CHECK_RENEWAL', 'VAULT_STATUS'],
|
|
420
389
|
examples: [],
|
|
421
|
-
validate: async (runtime) => Boolean(runtime.getSetting(
|
|
422
|
-
runtime.getSetting("AGENTDOMAIN_API_KEY")),
|
|
390
|
+
validate: async (runtime) => Boolean(runtime.getSetting('AGENT_PRIVATE_KEY') || runtime.getSetting('AGENTDOMAIN_API_KEY')),
|
|
423
391
|
handler: async (runtime, message) => {
|
|
424
392
|
const { ad } = getClients(runtime);
|
|
425
393
|
const agentId = requireAgentId(message.content.text);
|
|
426
394
|
const status = await ad.getRenewalStatus(agentId);
|
|
427
395
|
return {
|
|
428
|
-
text: `Renewal for ${status.domain}: next $${status.nextRenewalAmountUsdc}, balance $${status.vaultBalanceUsdc}, shortfall $${status.shortfallUsdc}, auto-renew ${status.autoRenewEnabled ?
|
|
396
|
+
text: `Renewal for ${status.domain}: next $${status.nextRenewalAmountUsdc}, balance $${status.vaultBalanceUsdc}, shortfall $${status.shortfallUsdc}, auto-renew ${status.autoRenewEnabled ? 'enabled' : 'off'}.`,
|
|
429
397
|
data: status,
|
|
430
398
|
};
|
|
431
399
|
},
|
|
432
400
|
};
|
|
433
401
|
export const fundRenewalAction = {
|
|
434
|
-
name:
|
|
435
|
-
description:
|
|
436
|
-
similes: [
|
|
402
|
+
name: 'FUND_RENEWAL_VAULT',
|
|
403
|
+
description: 'Deposit USDC into an AgentID renewal vault.',
|
|
404
|
+
similes: ['DEPOSIT_RENEWAL', 'FUND_VAULT'],
|
|
437
405
|
examples: [],
|
|
438
|
-
validate: async (runtime) => Boolean(runtime.getSetting(
|
|
406
|
+
validate: async (runtime) => Boolean(runtime.getSetting('AGENT_PRIVATE_KEY')),
|
|
439
407
|
handler: async (runtime, message) => {
|
|
440
408
|
const { ad } = getClients(runtime, { requireWallet: true });
|
|
441
409
|
const agentId = requireAgentId(message.content.text);
|
|
@@ -448,35 +416,31 @@ export const fundRenewalAction = {
|
|
|
448
416
|
},
|
|
449
417
|
};
|
|
450
418
|
export const enableAutoRenewAction = {
|
|
451
|
-
name:
|
|
452
|
-
description:
|
|
453
|
-
similes: [
|
|
419
|
+
name: 'ENABLE_AUTO_RENEW',
|
|
420
|
+
description: 'Enable on-chain RenewalVault auto-renew for an AgentDomain identity.',
|
|
421
|
+
similes: ['AUTO_RENEW', 'ENABLE_RENEWAL'],
|
|
454
422
|
examples: [],
|
|
455
|
-
validate: async (runtime) => Boolean(runtime.getSetting(
|
|
456
|
-
runtime.getSetting("RENEWAL_VAULT_ADDRESS")),
|
|
423
|
+
validate: async (runtime) => Boolean(runtime.getSetting('AGENT_PRIVATE_KEY') && runtime.getSetting('RENEWAL_VAULT_ADDRESS')),
|
|
457
424
|
handler: async (runtime, message) => {
|
|
458
425
|
const { ad } = getClients(runtime, { requireWallet: true });
|
|
459
426
|
const agentId = requireAgentId(message.content.text);
|
|
460
427
|
const result = await ad.setAutoRenew(agentId, true, {
|
|
461
|
-
renewalVaultAddress: runtime.getSetting(
|
|
428
|
+
renewalVaultAddress: runtime.getSetting('RENEWAL_VAULT_ADDRESS'),
|
|
462
429
|
});
|
|
463
|
-
return {
|
|
464
|
-
text: `Auto-renew enabled for token #${result.tokenId}.`,
|
|
465
|
-
data: result,
|
|
466
|
-
};
|
|
430
|
+
return { text: `Auto-renew enabled for token #${result.tokenId}.`, data: result };
|
|
467
431
|
},
|
|
468
432
|
};
|
|
469
433
|
export const reconfigureSslAction = {
|
|
470
|
-
name:
|
|
471
|
-
description:
|
|
472
|
-
similes: [
|
|
434
|
+
name: 'RECONFIGURE_SSL',
|
|
435
|
+
description: 'Rebuild the Cloudflare SaaS SSL hostname and sync Spaceship DNS validation records for an AgentDomain identity.',
|
|
436
|
+
similes: ['FIX_SSL', 'REPAIR_SSL', 'SYNC_SSL'],
|
|
473
437
|
examples: [],
|
|
474
|
-
validate: async (runtime) => Boolean(runtime.getSetting(
|
|
438
|
+
validate: async (runtime) => Boolean(runtime.getSetting('AGENT_PRIVATE_KEY')),
|
|
475
439
|
handler: async (runtime, message) => {
|
|
476
440
|
const { ad } = getClients(runtime);
|
|
477
441
|
const agentId = message.content.text.match(/[0-9a-f-]{36}/i)?.[0];
|
|
478
442
|
if (!agentId)
|
|
479
|
-
throw new Error(
|
|
443
|
+
throw new Error('Agent ID UUID is required to reconfigure SSL');
|
|
480
444
|
const result = await ad.reconfigureSsl(agentId);
|
|
481
445
|
return {
|
|
482
446
|
text: `SSL reconfigured for ${result.domain}. Status: ${result.sslStatus}.`,
|
|
@@ -485,12 +449,11 @@ export const reconfigureSslAction = {
|
|
|
485
449
|
},
|
|
486
450
|
};
|
|
487
451
|
export const listDnsAction = {
|
|
488
|
-
name:
|
|
489
|
-
description:
|
|
490
|
-
similes: [
|
|
452
|
+
name: 'LIST_DNS_RECORDS',
|
|
453
|
+
description: 'List DNS records for an AgentDomain identity.',
|
|
454
|
+
similes: ['DNS_RECORDS', 'LIST_DNS'],
|
|
491
455
|
examples: [],
|
|
492
|
-
validate: async (runtime) => Boolean(runtime.getSetting(
|
|
493
|
-
runtime.getSetting("AGENTDOMAIN_API_KEY")),
|
|
456
|
+
validate: async (runtime) => Boolean(runtime.getSetting('AGENT_PRIVATE_KEY') || runtime.getSetting('AGENTDOMAIN_API_KEY')),
|
|
494
457
|
handler: async (runtime, message) => {
|
|
495
458
|
const { ad } = getClients(runtime);
|
|
496
459
|
const agentId = requireAgentId(message.content.text);
|
|
@@ -499,70 +462,60 @@ export const listDnsAction = {
|
|
|
499
462
|
},
|
|
500
463
|
};
|
|
501
464
|
export const createDnsAction = {
|
|
502
|
-
name:
|
|
503
|
-
description:
|
|
504
|
-
similes: [
|
|
465
|
+
name: 'CREATE_DNS_RECORD',
|
|
466
|
+
description: 'Create a user-managed DNS record. Use text like: agentId type A name @ value 1.2.3.4.',
|
|
467
|
+
similes: ['ADD_DNS', 'CREATE_DNS'],
|
|
505
468
|
examples: [],
|
|
506
|
-
validate: async (runtime) => Boolean(runtime.getSetting(
|
|
507
|
-
runtime.getSetting("AGENTDOMAIN_API_KEY")),
|
|
469
|
+
validate: async (runtime) => Boolean(runtime.getSetting('AGENT_PRIVATE_KEY') || runtime.getSetting('AGENTDOMAIN_API_KEY')),
|
|
508
470
|
handler: async (runtime, message) => {
|
|
509
471
|
const { ad } = getClients(runtime);
|
|
510
472
|
const agentId = requireAgentId(message.content.text);
|
|
511
473
|
const record = parseDnsRecord(message.content.text);
|
|
512
474
|
const result = await ad.createDnsRecord(agentId, record);
|
|
513
|
-
return {
|
|
514
|
-
text: `Created ${result.type} DNS record ${result.name}.`,
|
|
515
|
-
data: result,
|
|
516
|
-
};
|
|
475
|
+
return { text: `Created ${result.type} DNS record ${result.name}.`, data: result };
|
|
517
476
|
},
|
|
518
477
|
};
|
|
519
478
|
export const updateDnsAction = {
|
|
520
|
-
name:
|
|
521
|
-
description:
|
|
522
|
-
similes: [
|
|
479
|
+
name: 'UPDATE_DNS_RECORD',
|
|
480
|
+
description: 'Update a user-managed DNS record. Include agent UUID and record UUID.',
|
|
481
|
+
similes: ['EDIT_DNS', 'UPDATE_DNS'],
|
|
523
482
|
examples: [],
|
|
524
|
-
validate: async (runtime) => Boolean(runtime.getSetting(
|
|
525
|
-
runtime.getSetting("AGENTDOMAIN_API_KEY")),
|
|
483
|
+
validate: async (runtime) => Boolean(runtime.getSetting('AGENT_PRIVATE_KEY') || runtime.getSetting('AGENTDOMAIN_API_KEY')),
|
|
526
484
|
handler: async (runtime, message) => {
|
|
527
485
|
const { ad } = getClients(runtime);
|
|
528
|
-
const ids = message.content.text.match(new RegExp(UUID_PATTERN.source,
|
|
486
|
+
const ids = message.content.text.match(new RegExp(UUID_PATTERN.source, 'gi')) ?? [];
|
|
529
487
|
const agentId = ids[0];
|
|
530
488
|
const recordId = ids[1];
|
|
531
489
|
if (!agentId || !recordId)
|
|
532
|
-
throw new Error(
|
|
490
|
+
throw new Error('Agent ID and record ID UUIDs are required');
|
|
533
491
|
const record = parseDnsRecord(message.content.text);
|
|
534
492
|
const result = await ad.updateDnsRecord(agentId, recordId, record);
|
|
535
|
-
return {
|
|
536
|
-
text: `Updated ${result.type} DNS record ${result.name}.`,
|
|
537
|
-
data: result,
|
|
538
|
-
};
|
|
493
|
+
return { text: `Updated ${result.type} DNS record ${result.name}.`, data: result };
|
|
539
494
|
},
|
|
540
495
|
};
|
|
541
496
|
export const deleteDnsAction = {
|
|
542
|
-
name:
|
|
543
|
-
description:
|
|
544
|
-
similes: [
|
|
497
|
+
name: 'DELETE_DNS_RECORD',
|
|
498
|
+
description: 'Delete a user-managed DNS record. Include agent UUID and record UUID.',
|
|
499
|
+
similes: ['REMOVE_DNS', 'DELETE_DNS'],
|
|
545
500
|
examples: [],
|
|
546
|
-
validate: async (runtime) => Boolean(runtime.getSetting(
|
|
547
|
-
runtime.getSetting("AGENTDOMAIN_API_KEY")),
|
|
501
|
+
validate: async (runtime) => Boolean(runtime.getSetting('AGENT_PRIVATE_KEY') || runtime.getSetting('AGENTDOMAIN_API_KEY')),
|
|
548
502
|
handler: async (runtime, message) => {
|
|
549
503
|
const { ad } = getClients(runtime);
|
|
550
|
-
const ids = message.content.text.match(new RegExp(UUID_PATTERN.source,
|
|
504
|
+
const ids = message.content.text.match(new RegExp(UUID_PATTERN.source, 'gi')) ?? [];
|
|
551
505
|
const agentId = ids[0];
|
|
552
506
|
const recordId = ids[1];
|
|
553
507
|
if (!agentId || !recordId)
|
|
554
|
-
throw new Error(
|
|
508
|
+
throw new Error('Agent ID and record ID UUIDs are required');
|
|
555
509
|
const result = await ad.deleteDnsRecord(agentId, recordId);
|
|
556
510
|
return { text: `Deleted DNS record ${recordId}.`, data: result };
|
|
557
511
|
},
|
|
558
512
|
};
|
|
559
513
|
export const servicePlanStatusAction = {
|
|
560
|
-
name:
|
|
561
|
-
description:
|
|
562
|
-
similes: [
|
|
514
|
+
name: 'GET_SERVICE_PLAN',
|
|
515
|
+
description: 'Get an agent Premium Plan, limits, current period, and billing state.',
|
|
516
|
+
similes: ['PLAN_STATUS', 'CHECK_PLAN'],
|
|
563
517
|
examples: [],
|
|
564
|
-
validate: async (runtime) => Boolean(runtime.getSetting(
|
|
565
|
-
runtime.getSetting("AGENTDOMAIN_API_KEY")),
|
|
518
|
+
validate: async (runtime) => Boolean(runtime.getSetting('AGENT_PRIVATE_KEY') || runtime.getSetting('AGENTDOMAIN_API_KEY')),
|
|
566
519
|
handler: async (runtime, message) => {
|
|
567
520
|
const { ad } = getClients(runtime);
|
|
568
521
|
const agentId = requireAgentId(message.content.text);
|
|
@@ -574,38 +527,52 @@ export const servicePlanStatusAction = {
|
|
|
574
527
|
},
|
|
575
528
|
};
|
|
576
529
|
export const setRegistryVisibilityAction = {
|
|
577
|
-
name:
|
|
578
|
-
description:
|
|
579
|
-
similes: [
|
|
580
|
-
"HIDE_AGENT_REGISTRY",
|
|
581
|
-
"SHOW_AGENT_REGISTRY",
|
|
582
|
-
"REGISTRY_VISIBILITY",
|
|
583
|
-
],
|
|
530
|
+
name: 'SET_REGISTRY_VISIBILITY',
|
|
531
|
+
description: 'Hide or show an agent in the public AgentDomain registry. Hiding requires an active paid Premium Plan.',
|
|
532
|
+
similes: ['HIDE_AGENT_REGISTRY', 'SHOW_AGENT_REGISTRY', 'REGISTRY_VISIBILITY'],
|
|
584
533
|
examples: [],
|
|
585
|
-
validate: async (runtime) => Boolean(runtime.getSetting(
|
|
586
|
-
runtime.getSetting("AGENTDOMAIN_API_KEY")),
|
|
534
|
+
validate: async (runtime) => Boolean(runtime.getSetting('AGENT_PRIVATE_KEY') || runtime.getSetting('AGENTDOMAIN_API_KEY')),
|
|
587
535
|
handler: async (runtime, message) => {
|
|
588
536
|
const { ad } = getClients(runtime);
|
|
589
537
|
const agentId = requireAgentId(message.content.text);
|
|
590
538
|
const text = message.content.text.toLowerCase();
|
|
591
|
-
const wantsPublic = text.includes(
|
|
592
|
-
text.includes(
|
|
593
|
-
text.includes(
|
|
594
|
-
text.includes(
|
|
595
|
-
const registryHidden = !wantsPublic && (text.includes(
|
|
539
|
+
const wantsPublic = text.includes('unhide') ||
|
|
540
|
+
text.includes('show') ||
|
|
541
|
+
text.includes('visible') ||
|
|
542
|
+
text.includes('public');
|
|
543
|
+
const registryHidden = !wantsPublic && (text.includes('hide') || text.includes('private'));
|
|
596
544
|
const result = await ad.setRegistryVisibility(agentId, registryHidden);
|
|
597
545
|
return {
|
|
598
|
-
text: `${result.domain} is now ${result.registryVisibility.hidden ?
|
|
546
|
+
text: `${result.domain} is now ${result.registryVisibility.hidden ? 'hidden from' : 'visible in'} the public registry.`,
|
|
547
|
+
data: result,
|
|
548
|
+
};
|
|
549
|
+
},
|
|
550
|
+
};
|
|
551
|
+
export const scheduleServicePlanRenewalAction = {
|
|
552
|
+
name: 'SCHEDULE_SERVICE_PLAN_RENEWAL',
|
|
553
|
+
description: 'Choose the exact AgentDomain Premium Plan SKU for the next identity renewal.',
|
|
554
|
+
similes: ['CHANGE_RENEWAL_PLAN', 'SET_NEXT_RENEWAL_PLAN'],
|
|
555
|
+
examples: [],
|
|
556
|
+
validate: async (runtime) => Boolean(runtime.getSetting('AGENT_PRIVATE_KEY') || runtime.getSetting('AGENTDOMAIN_API_KEY')),
|
|
557
|
+
handler: async (runtime, message) => {
|
|
558
|
+
const { ad } = getClients(runtime);
|
|
559
|
+
const agentId = requireAgentId(message.content.text);
|
|
560
|
+
const lower = message.content.text.toLowerCase();
|
|
561
|
+
const plan = parseRegistrationPlan(lower);
|
|
562
|
+
const parsed = plan === 'enterprise' ? parsePlan(lower) : { plan, planSku: plan };
|
|
563
|
+
const result = await ad.scheduleServicePlanRenewal(agentId, parsed);
|
|
564
|
+
return {
|
|
565
|
+
text: `Scheduled ${result.renewalPlanSku} for the next identity renewal.`,
|
|
599
566
|
data: result,
|
|
600
567
|
};
|
|
601
568
|
},
|
|
602
569
|
};
|
|
603
570
|
export const purchaseServicePlanAction = {
|
|
604
|
-
name:
|
|
605
|
-
description:
|
|
606
|
-
similes: [
|
|
571
|
+
name: 'PURCHASE_SERVICE_PLAN',
|
|
572
|
+
description: 'Upgrade an agent to AgentDomain Starter, Pro, or Enterprise using x402 USDC.',
|
|
573
|
+
similes: ['BUY_PLAN', 'UPGRADE_PLAN'],
|
|
607
574
|
examples: [],
|
|
608
|
-
validate: async (runtime) => Boolean(runtime.getSetting(
|
|
575
|
+
validate: async (runtime) => Boolean(runtime.getSetting('AGENT_PRIVATE_KEY')),
|
|
609
576
|
handler: async (runtime, message) => {
|
|
610
577
|
const { ad } = getClients(runtime, { requireWallet: true });
|
|
611
578
|
const agentId = requireAgentId(message.content.text);
|
|
@@ -621,8 +588,8 @@ export const purchaseServicePlanAction = {
|
|
|
621
588
|
},
|
|
622
589
|
};
|
|
623
590
|
export const agentDomainPlugin = {
|
|
624
|
-
name:
|
|
625
|
-
description:
|
|
591
|
+
name: 'agentdomain',
|
|
592
|
+
description: 'Identity infrastructure for AI agents on Base (domain + Basename + DNS + email + SSL).',
|
|
626
593
|
actions: [
|
|
627
594
|
quoteRegistrationAction,
|
|
628
595
|
registerIdentityAction,
|
|
@@ -632,6 +599,7 @@ export const agentDomainPlugin = {
|
|
|
632
599
|
emailUsageAction,
|
|
633
600
|
configureEmailWebhookAction,
|
|
634
601
|
listEmailAction,
|
|
602
|
+
deleteEmailMessageAction,
|
|
635
603
|
updatePrimaryEmailAction,
|
|
636
604
|
createEmailAliasAction,
|
|
637
605
|
deleteEmailAliasAction,
|
|
@@ -645,6 +613,7 @@ export const agentDomainPlugin = {
|
|
|
645
613
|
deleteDnsAction,
|
|
646
614
|
servicePlanStatusAction,
|
|
647
615
|
setRegistryVisibilityAction,
|
|
616
|
+
scheduleServicePlanRenewalAction,
|
|
648
617
|
purchaseServicePlanAction,
|
|
649
618
|
],
|
|
650
619
|
evaluators: [],
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentdomain/eliza-plugin",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "ElizaOS plugin for AgentDomain - give your Eliza agent a complete identity stack",
|
|
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.5.0",
|
|
30
|
+
"@agentdomain/shared": "^0.5.0"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
33
|
"@elizaos/core": "^1.0.0"
|