@agentdomain/eliza-plugin 0.6.0 → 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 ADDED
@@ -0,0 +1,5 @@
1
+ AgentDomain public developer tools and verified Base contracts
2
+ Copyright 2026 Md. Rakib
3
+
4
+ AgentDomain and related names and logos are trademarks or service marks of
5
+ their respective owner. This license does not grant trademark rights.
package/README.md CHANGED
@@ -18,4 +18,11 @@ The plugin gives Eliza agents a complete AgentDomain lifecycle surface:
18
18
 
19
19
  Configure `AGENTDOMAIN_API_URL` only if you need a custom endpoint. The default is `https://agentdomain.app/api/v1`.
20
20
 
21
+ Set `AGENTDOMAIN_BUILDER_CODE` to your public ERC-8021 app identifier whenever
22
+ the runtime can submit direct Base writes. The value is not a private key.
23
+ Eliza passes it to the SDK and uses it for post-registration auto-renew; missing
24
+ or invalid attribution stops the direct transaction before submission. Reads,
25
+ offchain signatures, Ethereum L1 ENS operations, and standard x402 v2 paid
26
+ requests are not changed.
27
+
21
28
  Request the default base URL directly to retrieve AgentDomain's machine-readable API discovery metadata.
package/dist/index.d.ts CHANGED
@@ -11,6 +11,8 @@ interface Memory {
11
11
  text: string;
12
12
  };
13
13
  }
14
+ /** Builds the attributed direct calldata used by Eliza's post-registration auto-renew step. */
15
+ export declare function encodeElizaAutoRenewCalldata(tokenId: bigint, builderCode?: string): `0x${string}`;
14
16
  export declare const quoteRegistrationAction: {
15
17
  name: string;
16
18
  description: string;
package/dist/index.js CHANGED
@@ -1,38 +1,33 @@
1
- import { AgentDomain } from "@agentdomain/sdk";
2
- import { AGENTDOMAIN_API_BASE_URL, SERVICE_PLAN_KEYS, SUPPORTED_TLDS, } from "@agentdomain/shared/constants";
3
- import { DNS_RECORD_TYPES, dnsRecordSchema as sharedDnsRecordSchema, } from "@agentdomain/shared";
4
- import { createPublicClient, createWalletClient, http, } from "viem";
5
- import { privateKeyToAccount } from "viem/accounts";
6
- import { base, baseSepolia } from "viem/chains";
7
- import { z } from "zod";
1
+ import { AgentDomain, encodeSetAutoRenewCalldata } from '@agentdomain/sdk';
2
+ import { AGENTDOMAIN_API_BASE_URL, SERVICE_PLAN_KEYS, SUPPORTED_TLDS, } from '@agentdomain/shared/constants';
3
+ import { DNS_RECORD_TYPES, dnsRecordSchema as sharedDnsRecordSchema, } from '@agentdomain/shared';
4
+ import { createPublicClient, createWalletClient, http } from 'viem';
5
+ import { privateKeyToAccount } from 'viem/accounts';
6
+ import { base, baseSepolia } from 'viem/chains';
7
+ import { z } from 'zod';
8
+ /** Builds the attributed direct calldata used by Eliza's post-registration auto-renew step. */
9
+ export function encodeElizaAutoRenewCalldata(tokenId, builderCode) {
10
+ if (!builderCode) {
11
+ throw new Error('AGENTDOMAIN_BUILDER_CODE is required for attributed direct Base transactions.');
12
+ }
13
+ return encodeSetAutoRenewCalldata(tokenId, true, builderCode);
14
+ }
8
15
  function getClients(runtime, opts = {}) {
9
- const apiUrl = runtime.getSetting("AGENTDOMAIN_API_URL") ?? AGENTDOMAIN_API_BASE_URL;
10
- const apiKey = runtime.getSetting("AGENTDOMAIN_API_KEY");
11
- const pk = runtime.getSetting("AGENT_PRIVATE_KEY");
12
- const rpc = runtime.getSetting("BASE_RPC_URL") ?? "https://mainnet.base.org";
13
- const network = runtime.getSetting("AGENTDOMAIN_NETWORK") ??
14
- "base";
15
- const chain = network === "base-sepolia" ? baseSepolia : base;
16
+ const apiUrl = runtime.getSetting('AGENTDOMAIN_API_URL') ?? AGENTDOMAIN_API_BASE_URL;
17
+ const apiKey = runtime.getSetting('AGENTDOMAIN_API_KEY');
18
+ const pk = runtime.getSetting('AGENT_PRIVATE_KEY');
19
+ const rpc = runtime.getSetting('BASE_RPC_URL') ?? 'https://mainnet.base.org';
20
+ const network = runtime.getSetting('AGENTDOMAIN_NETWORK') ?? 'base';
21
+ const builderCode = runtime.getSetting('AGENTDOMAIN_BUILDER_CODE');
22
+ const chain = network === 'base-sepolia' ? baseSepolia : base;
16
23
  if (!pk) {
17
24
  if (opts.requireWallet)
18
- throw new Error("AGENT_PRIVATE_KEY not set");
19
- const ad = new AgentDomain({ apiUrl, apiKey, network });
20
- return {
21
- ad,
22
- account: null,
23
- walletClient: null,
24
- publicClient: null,
25
- network,
26
- chain,
27
- rpc,
28
- };
25
+ throw new Error('AGENT_PRIVATE_KEY not set');
26
+ const ad = new AgentDomain({ apiUrl, apiKey, network, builderCode });
27
+ return { ad, account: null, walletClient: null, publicClient: null, network, chain, rpc };
29
28
  }
30
29
  const account = privateKeyToAccount(pk);
31
- const walletClient = createWalletClient({
32
- account,
33
- chain,
34
- transport: http(rpc),
35
- });
30
+ const walletClient = createWalletClient({ account, chain, transport: http(rpc) });
36
31
  const publicClient = createPublicClient({ chain, transport: http(rpc) });
37
32
  const ad = new AgentDomain({
38
33
  apiUrl,
@@ -40,10 +35,11 @@ function getClients(runtime, opts = {}) {
40
35
  network,
41
36
  walletClient: walletClient,
42
37
  publicClient: publicClient,
38
+ builderCode,
43
39
  });
44
40
  return { ad, account, walletClient, publicClient, network, chain, rpc };
45
41
  }
46
- const TLD_PATTERN = new RegExp(String.raw `([a-z0-9-]{3,63})\.([a-z]{2,20})\b`, "i");
42
+ const TLD_PATTERN = new RegExp(String.raw `([a-z0-9-]{3,63})\.([a-z]{2,20})\b`, 'i');
47
43
  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;
48
44
  const AMOUNT_PATTERN = /\$?\s*(\d+(?:\.\d{1,6})?)\s*(?:usdc)?/i;
49
45
  const EMAIL_PATTERN = /[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}/i;
@@ -51,19 +47,14 @@ const EMAIL_GLOBAL_PATTERN = /[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}/gi;
51
47
  const EMAIL_USERNAME_PATTERN = /^[a-z0-9](?:[a-z0-9._+-]{0,62}[a-z0-9])?$/;
52
48
  const registerSchema = z.object({
53
49
  preferredName: z.string(),
54
- tld: z.enum(SUPPORTED_TLDS).default("xyz"),
50
+ tld: z.enum(SUPPORTED_TLDS).default('xyz'),
55
51
  registerBasename: z.boolean().default(true),
56
52
  registerEns: z.boolean().default(false),
57
53
  emailEnabled: z.boolean().default(true),
58
- emailUsername: z
59
- .string()
60
- .trim()
61
- .toLowerCase()
62
- .regex(EMAIL_USERNAME_PATTERN)
63
- .default("agent"),
54
+ emailUsername: z.string().trim().toLowerCase().regex(EMAIL_USERNAME_PATTERN).default('agent'),
64
55
  years: z.number().int().min(1).max(10).default(1),
65
56
  autoRenew: z.boolean().default(false),
66
- premiumPlan: z.enum(SERVICE_PLAN_KEYS).default("included"),
57
+ premiumPlan: z.enum(SERVICE_PLAN_KEYS).default('included'),
67
58
  });
68
59
  const dnsRecordSchema = z.object({
69
60
  type: z.enum(DNS_RECORD_TYPES),
@@ -76,61 +67,57 @@ function parseParamsFromText(text) {
76
67
  const m = text.match(TLD_PATTERN);
77
68
  const lower = text.toLowerCase();
78
69
  const yearsMatch = lower.match(/([1-9]|10)\s*years?/);
79
- const noBasename = lower.includes("no basename") ||
80
- lower.includes("without basename") ||
81
- lower.includes("skip basename");
82
- const noEns = lower.includes("no ens") ||
83
- lower.includes("without ens") ||
84
- lower.includes("skip ens");
70
+ const noBasename = lower.includes('no basename') ||
71
+ lower.includes('without basename') ||
72
+ lower.includes('skip basename');
73
+ const noEns = lower.includes('no ens') || lower.includes('without ens') || lower.includes('skip ens');
85
74
  const wantsEns = /\bens\b/.test(lower);
86
75
  return {
87
- preferredName: m?.[1]?.toLowerCase() ?? "agent",
88
- tld: m?.[2]?.toLowerCase() ?? "xyz",
76
+ preferredName: m?.[1]?.toLowerCase() ?? 'agent',
77
+ tld: m?.[2]?.toLowerCase() ?? 'xyz',
89
78
  registerBasename: !noBasename,
90
79
  registerEns: wantsEns && !noEns,
91
80
  emailEnabled: true,
92
- emailUsername: parseEmailUsername(text) ?? "agent",
81
+ emailUsername: parseEmailUsername(text) ?? 'agent',
93
82
  years: yearsMatch ? parseInt(yearsMatch[1], 10) : 1,
94
- autoRenew: lower.includes("auto renew") ||
95
- lower.includes("auto-renew") ||
96
- lower.includes("autorenew"),
83
+ autoRenew: lower.includes('auto renew') || lower.includes('auto-renew') || lower.includes('autorenew'),
97
84
  premiumPlan: parseRegistrationPlan(lower),
98
85
  };
99
86
  }
100
87
  function requireAgentId(text) {
101
88
  const agentId = text.match(UUID_PATTERN)?.[0];
102
89
  if (!agentId)
103
- throw new Error("Agent ID UUID is required");
90
+ throw new Error('Agent ID UUID is required');
104
91
  return agentId;
105
92
  }
106
93
  function parseAmountUsdc(text) {
107
94
  const amount = text.match(AMOUNT_PATTERN)?.[1];
108
95
  if (!amount)
109
- throw new Error("USDC amount is required");
96
+ throw new Error('USDC amount is required');
110
97
  return amount;
111
98
  }
112
99
  function parseRegistrationPlan(lower) {
113
- if (lower.includes("enterprise"))
114
- return "enterprise";
115
- if (lower.includes("pro"))
116
- return "pro";
117
- if (lower.includes("starter"))
118
- return "starter";
119
- return "included";
100
+ if (lower.includes('enterprise'))
101
+ return 'enterprise';
102
+ if (lower.includes('pro'))
103
+ return 'pro';
104
+ if (lower.includes('starter'))
105
+ return 'starter';
106
+ return 'included';
120
107
  }
121
108
  function parsePlan(text) {
122
109
  const lower = text.toLowerCase();
123
- if (lower.includes("enterprise")) {
110
+ if (lower.includes('enterprise')) {
124
111
  const match = lower.match(/(\d+(?:\.\d+)?)\s*(k|m)/);
125
112
  const monthly = match
126
- ? Math.round(Number(match[1]) * (match[2] === "m" ? 1_000_000 : 1_000))
113
+ ? Math.round(Number(match[1]) * (match[2] === 'm' ? 1_000_000 : 1_000))
127
114
  : 100_000;
128
115
  return {
129
- plan: "enterprise",
116
+ plan: 'enterprise',
130
117
  planSku: `enterprise-${monthly}`,
131
118
  };
132
119
  }
133
- return { plan: lower.includes("starter") ? "starter" : "pro" };
120
+ return { plan: lower.includes('starter') ? 'starter' : 'pro' };
134
121
  }
135
122
  function parseDnsRecord(text) {
136
123
  const lower = text.toLowerCase();
@@ -140,11 +127,9 @@ function parseDnsRecord(text) {
140
127
  const ttlMatch = text.match(/\bttl[:=]\s*(\d+)/i);
141
128
  const priorityMatch = text.match(/\bpriority[:=]\s*(\d+)/i);
142
129
  const parsed = dnsRecordSchema.parse({
143
- type: typeMatch?.[1]?.toUpperCase() ?? (lower.includes("txt") ? "TXT" : "A"),
144
- name: nameMatch?.[1] ?? "@",
145
- value: valueMatch?.[1]?.trim() ??
146
- text.match(/\b(?:\d{1,3}\.){3}\d{1,3}\b/)?.[0] ??
147
- "",
130
+ type: typeMatch?.[1]?.toUpperCase() ?? (lower.includes('txt') ? 'TXT' : 'A'),
131
+ name: nameMatch?.[1] ?? '@',
132
+ value: valueMatch?.[1]?.trim() ?? text.match(/\b(?:\d{1,3}\.){3}\d{1,3}\b/)?.[0] ?? '',
148
133
  ttl: ttlMatch ? Number(ttlMatch[1]) : 3600,
149
134
  priority: priorityMatch ? Number(priorityMatch[1]) : undefined,
150
135
  });
@@ -152,36 +137,32 @@ function parseDnsRecord(text) {
152
137
  }
153
138
  function parseDnsRecordsJson(text) {
154
139
  const fenced = text.match(/```(?:json)?\s*([\s\S]*?)```/i)?.[1];
155
- const json = fenced ?? text.slice(text.indexOf("["), text.lastIndexOf("]") + 1);
140
+ const json = fenced ?? text.slice(text.indexOf('['), text.lastIndexOf(']') + 1);
156
141
  if (!json)
157
- throw new Error("A JSON array of DNS records is required");
158
- return z
159
- .array(sharedDnsRecordSchema)
160
- .min(1)
161
- .max(200)
162
- .parse(JSON.parse(json));
142
+ throw new Error('A JSON array of DNS records is required');
143
+ return z.array(sharedDnsRecordSchema).min(1).max(200).parse(JSON.parse(json));
163
144
  }
164
145
  function parseZoneFile(text) {
165
146
  const fenced = text.match(/```(?:bind|zone|dns)?\s*([\s\S]*?)```/i)?.[1];
166
147
  if (!fenced?.trim())
167
- throw new Error("Put the BIND zone records inside a fenced code block");
148
+ throw new Error('Put the BIND zone records inside a fenced code block');
168
149
  return fenced.trim();
169
150
  }
170
151
  function parseDnsApplyOptions(text) {
171
152
  const lower = text.toLowerCase();
172
153
  return {
173
- mode: lower.includes("replace") ? "replace" : "merge",
154
+ mode: lower.includes('replace') ? 'replace' : 'merge',
174
155
  dryRun: !/\bapply\b/i.test(text),
175
156
  baseRevision: text.match(/\bbaseRevision[:=]\s*([a-f0-9]{64})/i)?.[1],
176
157
  };
177
158
  }
178
159
  function requireDnsRevision(value) {
179
160
  if (!value)
180
- throw new Error("Apply requires baseRevision from a fresh DNS preview");
161
+ throw new Error('Apply requires baseRevision from a fresh DNS preview');
181
162
  return value;
182
163
  }
183
164
  function parseEmailUsername(text) {
184
- 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];
165
+ 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];
185
166
  const username = explicit?.trim().toLowerCase();
186
167
  return username && EMAIL_USERNAME_PATTERN.test(username) ? username : null;
187
168
  }
@@ -189,20 +170,18 @@ function parseEmailRequest(text) {
189
170
  const fromAddress = text.match(/\bfrom[:=]\s*([A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,})/i)?.[1];
190
171
  const explicitTo = text.match(/\bto[:=]\s*([A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,})/i)?.[1];
191
172
  const emails = text.match(EMAIL_GLOBAL_PATTERN) ?? [];
192
- const to = explicitTo ??
193
- emails.find((email) => email.toLowerCase() !== fromAddress?.toLowerCase());
173
+ const to = explicitTo ?? emails.find((email) => email.toLowerCase() !== fromAddress?.toLowerCase());
194
174
  if (!to)
195
- throw new Error("Recipient email address is required");
196
- const subject = text.match(/\bsubject[:=]\s*([^|]+)/i)?.[1]?.trim() ??
197
- "AgentDomain message";
175
+ throw new Error('Recipient email address is required');
176
+ const subject = text.match(/\bsubject[:=]\s*([^|]+)/i)?.[1]?.trim() ?? 'AgentDomain message';
198
177
  const body = text.match(/\b(?:text|body|message)[:=]\s*([\s\S]+)/i)?.[1]?.trim() ??
199
- text.replace(to, "").trim();
200
- return { to, fromAddress, subject, text: body || "Hello from AgentDomain." };
178
+ text.replace(to, '').trim();
179
+ return { to, fromAddress, subject, text: body || 'Hello from AgentDomain.' };
201
180
  }
202
181
  export const quoteRegistrationAction = {
203
- name: "QUOTE_AGENT_REGISTRATION",
204
- description: "Quote an AgentDomain registration before paying.",
205
- similes: ["PRICE_DOMAIN", "REGISTRATION_QUOTE", "QUOTE_IDENTITY"],
182
+ name: 'QUOTE_AGENT_REGISTRATION',
183
+ description: 'Quote an AgentDomain registration before paying.',
184
+ similes: ['PRICE_DOMAIN', 'REGISTRATION_QUOTE', 'QUOTE_IDENTITY'],
206
185
  examples: [],
207
186
  validate: async () => true,
208
187
  handler: async (runtime, message) => {
@@ -216,62 +195,56 @@ export const quoteRegistrationAction = {
216
195
  },
217
196
  };
218
197
  export const registerIdentityAction = {
219
- name: "REGISTER_IDENTITY",
198
+ name: 'REGISTER_IDENTITY',
220
199
  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.',
221
- similes: ["CLAIM_DOMAIN", "CREATE_IDENTITY", "GET_DOMAIN"],
200
+ similes: ['CLAIM_DOMAIN', 'CREATE_IDENTITY', 'GET_DOMAIN'],
222
201
  examples: [
223
202
  [
203
+ { user: 'user1', content: { text: 'Register me as helpful-bot.ai email username support' } },
224
204
  {
225
- user: "user1",
226
- content: {
227
- text: "Register me as helpful-bot.ai email username support",
228
- },
229
- },
230
- {
231
- user: "agent",
205
+ user: 'agent',
232
206
  content: {
233
207
  text: "I'll register helpful-bot.ai with included email and SSL infrastructure now.",
234
- action: "REGISTER_IDENTITY",
208
+ action: 'REGISTER_IDENTITY',
235
209
  },
236
210
  },
237
211
  ],
238
212
  ],
239
- validate: async (runtime, _message) => Boolean(runtime.getSetting("AGENT_PRIVATE_KEY")),
213
+ validate: async (runtime, _message) => Boolean(runtime.getSetting('AGENT_PRIVATE_KEY')),
240
214
  handler: async (runtime, message) => {
241
215
  const params = parseParamsFromText(message.content.text);
242
216
  const validated = registerSchema.parse(params);
243
- const { ad, account, walletClient, chain } = getClients(runtime, {
217
+ const { ad, account, walletClient, publicClient, chain } = getClients(runtime, {
244
218
  requireWallet: true,
245
219
  });
246
- if (!account || !walletClient)
247
- throw new Error("AGENT_PRIVATE_KEY not set");
220
+ if (!account || !walletClient || !publicClient)
221
+ throw new Error('AGENT_PRIVATE_KEY not set');
248
222
  const result = await ad.register({
249
223
  ...validated,
250
224
  emailEnabled: true,
251
225
  wallet: account.address,
252
226
  });
253
- let autoRenewMsg = "";
227
+ let autoRenewMsg = '';
254
228
  if (validated.autoRenew) {
255
- const vaultAddress = runtime.getSetting("RENEWAL_VAULT_ADDRESS");
229
+ const vaultAddress = runtime.getSetting('RENEWAL_VAULT_ADDRESS');
256
230
  if (vaultAddress) {
257
231
  try {
258
- const txHash = await walletClient.writeContract({
259
- address: vaultAddress,
260
- abi: [
261
- {
262
- type: "function",
263
- name: "setAutoRenew",
264
- inputs: [
265
- { name: "tokenId", type: "uint256" },
266
- { name: "enabled", type: "bool" },
267
- ],
268
- },
269
- ],
270
- functionName: "setAutoRenew",
271
- args: [BigInt(result.nftTokenId), true],
232
+ const txHash = await walletClient.sendTransaction({
233
+ to: vaultAddress,
234
+ data: encodeElizaAutoRenewCalldata(BigInt(result.nftTokenId), runtime.getSetting('AGENTDOMAIN_BUILDER_CODE')),
272
235
  chain,
273
236
  account,
274
237
  });
238
+ let receipt;
239
+ try {
240
+ receipt = await publicClient.waitForTransactionReceipt({ hash: txHash });
241
+ }
242
+ catch (e) {
243
+ throw new Error(`Auto-renew transaction ${txHash} was submitted but confirmation failed or remained pending: ${String(e)}`);
244
+ }
245
+ if (receipt.status !== 'success') {
246
+ throw new Error(`Auto-renew transaction ${txHash} confirmed with status ${receipt.status}; auto-renew was not enabled.`);
247
+ }
275
248
  autoRenewMsg = ` Auto-renew enabled via tx ${txHash}.`;
276
249
  }
277
250
  catch (e) {
@@ -279,20 +252,19 @@ export const registerIdentityAction = {
279
252
  }
280
253
  }
281
254
  else {
282
- autoRenewMsg =
283
- " (Requires RENEWAL_VAULT_ADDRESS env var to enable auto-renew on-chain).";
255
+ autoRenewMsg = ' (Requires RENEWAL_VAULT_ADDRESS env var to enable auto-renew on-chain).';
284
256
  }
285
257
  }
286
258
  return {
287
- text: `Registered ${result.domain}${result.basename ? ` and ${result.basename}` : ""}. Token #${result.nftTokenId}.${autoRenewMsg}`,
259
+ text: `Registered ${result.domain}${result.basename ? ` and ${result.basename}` : ''}. Token #${result.nftTokenId}.${autoRenewMsg}`,
288
260
  data: result,
289
261
  };
290
262
  },
291
263
  };
292
264
  export const searchAgentsAction = {
293
- name: "SEARCH_AGENTS",
294
- description: "Search the public AgentDomain registry by name, capability, or framework.",
295
- similes: ["FIND_AGENT", "DISCOVER_AGENT"],
265
+ name: 'SEARCH_AGENTS',
266
+ description: 'Search the public AgentDomain registry by name, capability, or framework.',
267
+ similes: ['FIND_AGENT', 'DISCOVER_AGENT'],
296
268
  examples: [],
297
269
  validate: async () => true,
298
270
  handler: async (runtime, message) => {
@@ -306,43 +278,41 @@ export const searchAgentsAction = {
306
278
  },
307
279
  };
308
280
  export const listEmailAction = {
309
- name: "LIST_AGENT_EMAIL",
310
- description: "List text-only email messages and extracted verification codes for an AgentDomain identity.",
311
- similes: ["CHECK_EMAIL", "READ_INBOX"],
281
+ name: 'LIST_AGENT_EMAIL',
282
+ description: 'List text-only email messages and extracted verification codes for an AgentDomain identity.',
283
+ similes: ['CHECK_EMAIL', 'READ_INBOX'],
312
284
  examples: [],
313
- validate: async (runtime) => Boolean(runtime.getSetting("AGENT_PRIVATE_KEY")),
285
+ validate: async (runtime) => Boolean(runtime.getSetting('AGENT_PRIVATE_KEY')),
314
286
  handler: async (runtime, message) => {
315
287
  const { ad } = getClients(runtime);
316
288
  const agentId = message.content.text.match(/[0-9a-f-]{36}/i)?.[0];
317
289
  if (!agentId)
318
- throw new Error("Agent ID UUID is required to list email");
290
+ throw new Error('Agent ID UUID is required to list email');
319
291
  const result = await ad.listEmail(agentId, { limit: 20 });
320
292
  return { text: `Found ${result.messages.length} messages.`, data: result };
321
293
  },
322
294
  };
323
295
  export const deleteEmailMessageAction = {
324
- name: "DELETE_AGENT_EMAIL",
325
- description: "Permanently delete one AgentDomain email message.",
326
- similes: ["DELETE_EMAIL_MESSAGE", "REMOVE_EMAIL_MESSAGE"],
296
+ name: 'DELETE_AGENT_EMAIL',
297
+ description: 'Permanently delete one AgentDomain email message.',
298
+ similes: ['DELETE_EMAIL_MESSAGE', 'REMOVE_EMAIL_MESSAGE'],
327
299
  examples: [],
328
- validate: async (runtime) => Boolean(runtime.getSetting("AGENT_PRIVATE_KEY") ||
329
- runtime.getSetting("AGENTDOMAIN_API_KEY")),
300
+ validate: async (runtime) => Boolean(runtime.getSetting('AGENT_PRIVATE_KEY') || runtime.getSetting('AGENTDOMAIN_API_KEY')),
330
301
  handler: async (runtime, message) => {
331
302
  const { ad } = getClients(runtime);
332
- const ids = message.content.text.match(new RegExp(UUID_PATTERN.source, "gi")) ?? [];
303
+ const ids = message.content.text.match(new RegExp(UUID_PATTERN.source, 'gi')) ?? [];
333
304
  if (!ids[0] || !ids[1])
334
- throw new Error("Agent ID and message ID UUIDs are required");
305
+ throw new Error('Agent ID and message ID UUIDs are required');
335
306
  const result = await ad.deleteEmailMessage(ids[0], ids[1]);
336
307
  return { text: `Deleted email message ${ids[1]}.`, data: result };
337
308
  },
338
309
  };
339
310
  export const sendEmailAction = {
340
- name: "SEND_AGENT_EMAIL",
341
- description: "Send text-only email from an AgentDomain primary address or active alias.",
342
- similes: ["SEND_EMAIL", "EMAIL_FROM_AGENT"],
311
+ name: 'SEND_AGENT_EMAIL',
312
+ description: 'Send text-only email from an AgentDomain primary address or active alias.',
313
+ similes: ['SEND_EMAIL', 'EMAIL_FROM_AGENT'],
343
314
  examples: [],
344
- validate: async (runtime) => Boolean(runtime.getSetting("AGENT_PRIVATE_KEY") ||
345
- runtime.getSetting("AGENTDOMAIN_API_KEY")),
315
+ validate: async (runtime) => Boolean(runtime.getSetting('AGENT_PRIVATE_KEY') || runtime.getSetting('AGENTDOMAIN_API_KEY')),
346
316
  handler: async (runtime, message) => {
347
317
  const { ad } = getClients(runtime);
348
318
  const agentId = requireAgentId(message.content.text);
@@ -352,12 +322,11 @@ export const sendEmailAction = {
352
322
  },
353
323
  };
354
324
  export const emailUsageAction = {
355
- name: "GET_AGENT_EMAIL_USAGE",
356
- description: "Get combined monthly sent and received email usage.",
357
- similes: ["EMAIL_USAGE", "EMAIL_QUOTA"],
325
+ name: 'GET_AGENT_EMAIL_USAGE',
326
+ description: 'Get combined monthly sent and received email usage.',
327
+ similes: ['EMAIL_USAGE', 'EMAIL_QUOTA'],
358
328
  examples: [],
359
- validate: async (runtime) => Boolean(runtime.getSetting("AGENT_PRIVATE_KEY") ||
360
- runtime.getSetting("AGENTDOMAIN_API_KEY")),
329
+ validate: async (runtime) => Boolean(runtime.getSetting('AGENT_PRIVATE_KEY') || runtime.getSetting('AGENTDOMAIN_API_KEY')),
361
330
  handler: async (runtime, message) => {
362
331
  const { ad } = getClients(runtime);
363
332
  const result = await ad.getEmailUsage(requireAgentId(message.content.text));
@@ -368,123 +337,110 @@ export const emailUsageAction = {
368
337
  },
369
338
  };
370
339
  export const configureEmailWebhookAction = {
371
- name: "CONFIGURE_EMAIL_WEBHOOK",
372
- description: "Configure a signed inbound email webhook. Include an HTTPS URL in the request.",
373
- similes: ["SET_EMAIL_WEBHOOK"],
340
+ name: 'CONFIGURE_EMAIL_WEBHOOK',
341
+ description: 'Configure a signed inbound email webhook. Include an HTTPS URL in the request.',
342
+ similes: ['SET_EMAIL_WEBHOOK'],
374
343
  examples: [],
375
- validate: async (runtime) => Boolean(runtime.getSetting("AGENT_PRIVATE_KEY") ||
376
- runtime.getSetting("AGENTDOMAIN_API_KEY")),
344
+ validate: async (runtime) => Boolean(runtime.getSetting('AGENT_PRIVATE_KEY') || runtime.getSetting('AGENTDOMAIN_API_KEY')),
377
345
  handler: async (runtime, message) => {
378
346
  const { ad } = getClients(runtime);
379
347
  const agentId = requireAgentId(message.content.text);
380
348
  const url = message.content.text.match(/https:\/\/[^\s]+/)?.[0];
381
349
  if (!url)
382
- throw new Error("HTTPS webhook URL is required");
350
+ throw new Error('HTTPS webhook URL is required');
383
351
  const result = await ad.setEmailWebhook(agentId, {
384
352
  url,
385
- payloadMode: /inline/i.test(message.content.text)
386
- ? "inline_text"
387
- : "metadata",
353
+ payloadMode: /inline/i.test(message.content.text) ? 'inline_text' : 'metadata',
388
354
  enabled: true,
389
355
  });
390
- return { text: "Inbound email webhook configured.", data: result };
356
+ return { text: 'Inbound email webhook configured.', data: result };
391
357
  },
392
358
  };
393
359
  export const sendEmailBatchAction = {
394
- name: "SEND_AGENT_EMAIL_BATCH",
395
- description: "Queue up to 100 emails supplied as a JSON messages array.",
396
- similes: ["BATCH_EMAIL"],
360
+ name: 'SEND_AGENT_EMAIL_BATCH',
361
+ description: 'Queue up to 100 emails supplied as a JSON messages array.',
362
+ similes: ['BATCH_EMAIL'],
397
363
  examples: [],
398
- validate: async (runtime) => Boolean(runtime.getSetting("AGENT_PRIVATE_KEY") ||
399
- runtime.getSetting("AGENTDOMAIN_API_KEY")),
364
+ validate: async (runtime) => Boolean(runtime.getSetting('AGENT_PRIVATE_KEY') || runtime.getSetting('AGENTDOMAIN_API_KEY')),
400
365
  handler: async (runtime, message) => {
401
366
  const { ad } = getClients(runtime);
402
367
  const agentId = requireAgentId(message.content.text);
403
- const json = message.content.text.slice(message.content.text.indexOf("{"));
368
+ const json = message.content.text.slice(message.content.text.indexOf('{'));
404
369
  const parsed = JSON.parse(json);
405
- const result = await ad.sendEmailBatch(agentId, {
406
- messages: parsed.messages,
407
- });
370
+ const result = await ad.sendEmailBatch(agentId, { messages: parsed.messages });
408
371
  return { text: `Queued ${result.jobs.length} email jobs.`, data: result };
409
372
  },
410
373
  };
411
374
  export const updatePrimaryEmailAction = {
412
- name: "UPDATE_PRIMARY_EMAIL",
413
- description: "Change an AgentDomain primary email username. The old primary address stops receiving new mail.",
414
- similes: ["CHANGE_PRIMARY_EMAIL", "RENAME_EMAIL"],
375
+ name: 'UPDATE_PRIMARY_EMAIL',
376
+ description: 'Change an AgentDomain primary email username. The old primary address stops receiving new mail.',
377
+ similes: ['CHANGE_PRIMARY_EMAIL', 'RENAME_EMAIL'],
415
378
  examples: [],
416
- validate: async (runtime) => Boolean(runtime.getSetting("AGENT_PRIVATE_KEY") ||
417
- runtime.getSetting("AGENTDOMAIN_API_KEY")),
379
+ validate: async (runtime) => Boolean(runtime.getSetting('AGENT_PRIVATE_KEY') || runtime.getSetting('AGENTDOMAIN_API_KEY')),
418
380
  handler: async (runtime, message) => {
419
381
  const { ad } = getClients(runtime);
420
382
  const agentId = requireAgentId(message.content.text);
421
383
  const username = parseEmailUsername(message.content.text);
422
384
  if (!username)
423
- throw new Error("New email username is required");
385
+ throw new Error('New email username is required');
424
386
  const result = await ad.updatePrimaryEmail(agentId, username);
425
387
  return { text: result.message, data: result };
426
388
  },
427
389
  };
428
390
  export const createEmailAliasAction = {
429
- name: "CREATE_EMAIL_ALIAS",
430
- description: "Create a receive-and-send email alias for an AgentDomain identity. Requires available paid-plan alias capacity.",
431
- similes: ["ADD_EMAIL_ALIAS", "CREATE_ALIAS"],
391
+ name: 'CREATE_EMAIL_ALIAS',
392
+ description: 'Create a receive-and-send email alias for an AgentDomain identity. Requires available paid-plan alias capacity.',
393
+ similes: ['ADD_EMAIL_ALIAS', 'CREATE_ALIAS'],
432
394
  examples: [],
433
- validate: async (runtime) => Boolean(runtime.getSetting("AGENT_PRIVATE_KEY") ||
434
- runtime.getSetting("AGENTDOMAIN_API_KEY")),
395
+ validate: async (runtime) => Boolean(runtime.getSetting('AGENT_PRIVATE_KEY') || runtime.getSetting('AGENTDOMAIN_API_KEY')),
435
396
  handler: async (runtime, message) => {
436
397
  const { ad } = getClients(runtime);
437
398
  const agentId = requireAgentId(message.content.text);
438
399
  const username = parseEmailUsername(message.content.text);
439
400
  if (!username)
440
- throw new Error("Alias username is required");
401
+ throw new Error('Alias username is required');
441
402
  const result = await ad.createEmailAlias(agentId, username);
442
- return {
443
- text: `Created email alias ${result.address.emailAddress}.`,
444
- data: result,
445
- };
403
+ return { text: `Created email alias ${result.address.emailAddress}.`, data: result };
446
404
  },
447
405
  };
448
406
  export const deleteEmailAliasAction = {
449
- name: "DELETE_EMAIL_ALIAS",
450
- description: "Delete an active AgentDomain email alias.",
451
- similes: ["REMOVE_EMAIL_ALIAS", "DELETE_ALIAS"],
407
+ name: 'DELETE_EMAIL_ALIAS',
408
+ description: 'Delete an active AgentDomain email alias.',
409
+ similes: ['REMOVE_EMAIL_ALIAS', 'DELETE_ALIAS'],
452
410
  examples: [],
453
- validate: async (runtime) => Boolean(runtime.getSetting("AGENT_PRIVATE_KEY") ||
454
- runtime.getSetting("AGENTDOMAIN_API_KEY")),
411
+ validate: async (runtime) => Boolean(runtime.getSetting('AGENT_PRIVATE_KEY') || runtime.getSetting('AGENTDOMAIN_API_KEY')),
455
412
  handler: async (runtime, message) => {
456
413
  const { ad } = getClients(runtime);
457
414
  const agentId = requireAgentId(message.content.text);
458
415
  const emailAddress = message.content.text.match(EMAIL_PATTERN)?.[0];
459
416
  if (!emailAddress)
460
- throw new Error("Full alias email address is required");
417
+ throw new Error('Full alias email address is required');
461
418
  const result = await ad.deleteEmailAlias(agentId, emailAddress);
462
419
  return { text: `Deleted email alias ${emailAddress}.`, data: result };
463
420
  },
464
421
  };
465
422
  export const renewalStatusAction = {
466
- name: "GET_RENEWAL_STATUS",
467
- description: "Get RenewalVault balance, shortfall, renewal amount, and auto-renew state.",
468
- similes: ["RENEWAL_STATUS", "CHECK_RENEWAL", "VAULT_STATUS"],
423
+ name: 'GET_RENEWAL_STATUS',
424
+ description: 'Get RenewalVault balance, shortfall, renewal amount, and auto-renew state.',
425
+ similes: ['RENEWAL_STATUS', 'CHECK_RENEWAL', 'VAULT_STATUS'],
469
426
  examples: [],
470
- validate: async (runtime) => Boolean(runtime.getSetting("AGENT_PRIVATE_KEY") ||
471
- runtime.getSetting("AGENTDOMAIN_API_KEY")),
427
+ validate: async (runtime) => Boolean(runtime.getSetting('AGENT_PRIVATE_KEY') || runtime.getSetting('AGENTDOMAIN_API_KEY')),
472
428
  handler: async (runtime, message) => {
473
429
  const { ad } = getClients(runtime);
474
430
  const agentId = requireAgentId(message.content.text);
475
431
  const status = await ad.getRenewalStatus(agentId);
476
432
  return {
477
- text: `Renewal for ${status.domain}: next $${status.nextRenewalAmountUsdc}, balance $${status.vaultBalanceUsdc}, shortfall $${status.shortfallUsdc}, auto-renew ${status.autoRenewEnabled ? "enabled" : "off"}.`,
433
+ text: `Renewal for ${status.domain}: next $${status.nextRenewalAmountUsdc}, balance $${status.vaultBalanceUsdc}, shortfall $${status.shortfallUsdc}, auto-renew ${status.autoRenewEnabled ? 'enabled' : 'off'}.`,
478
434
  data: status,
479
435
  };
480
436
  },
481
437
  };
482
438
  export const fundRenewalAction = {
483
- name: "FUND_RENEWAL_VAULT",
484
- description: "Deposit USDC into an AgentID renewal vault.",
485
- similes: ["DEPOSIT_RENEWAL", "FUND_VAULT"],
439
+ name: 'FUND_RENEWAL_VAULT',
440
+ description: 'Deposit USDC into an AgentID renewal vault.',
441
+ similes: ['DEPOSIT_RENEWAL', 'FUND_VAULT'],
486
442
  examples: [],
487
- validate: async (runtime) => Boolean(runtime.getSetting("AGENT_PRIVATE_KEY")),
443
+ validate: async (runtime) => Boolean(runtime.getSetting('AGENT_PRIVATE_KEY')),
488
444
  handler: async (runtime, message) => {
489
445
  const { ad } = getClients(runtime, { requireWallet: true });
490
446
  const agentId = requireAgentId(message.content.text);
@@ -497,35 +453,32 @@ export const fundRenewalAction = {
497
453
  },
498
454
  };
499
455
  export const enableAutoRenewAction = {
500
- name: "ENABLE_AUTO_RENEW",
501
- description: "Enable on-chain RenewalVault auto-renew for an AgentDomain identity.",
502
- similes: ["AUTO_RENEW", "ENABLE_RENEWAL"],
456
+ name: 'ENABLE_AUTO_RENEW',
457
+ description: 'Enable on-chain RenewalVault auto-renew for an AgentDomain identity.',
458
+ similes: ['AUTO_RENEW', 'ENABLE_RENEWAL'],
503
459
  examples: [],
504
- validate: async (runtime) => Boolean(runtime.getSetting("AGENT_PRIVATE_KEY") &&
505
- runtime.getSetting("RENEWAL_VAULT_ADDRESS")),
460
+ validate: async (runtime) => Boolean(runtime.getSetting('AGENT_PRIVATE_KEY') && runtime.getSetting('RENEWAL_VAULT_ADDRESS')),
506
461
  handler: async (runtime, message) => {
507
462
  const { ad } = getClients(runtime, { requireWallet: true });
508
463
  const agentId = requireAgentId(message.content.text);
509
464
  const result = await ad.setAutoRenew(agentId, true, {
510
- renewalVaultAddress: runtime.getSetting("RENEWAL_VAULT_ADDRESS"),
465
+ renewalVaultAddress: runtime.getSetting('RENEWAL_VAULT_ADDRESS'),
466
+ waitForReceipt: true,
511
467
  });
512
- return {
513
- text: `Auto-renew enabled for token #${result.tokenId}.`,
514
- data: result,
515
- };
468
+ return { text: `Auto-renew enabled for token #${result.tokenId}.`, data: result };
516
469
  },
517
470
  };
518
471
  export const reconfigureSslAction = {
519
- name: "RECONFIGURE_SSL",
520
- description: "Rebuild the Cloudflare SaaS SSL hostname and sync Spaceship DNS validation records for an AgentDomain identity.",
521
- similes: ["FIX_SSL", "REPAIR_SSL", "SYNC_SSL"],
472
+ name: 'RECONFIGURE_SSL',
473
+ description: 'Rebuild the Cloudflare SaaS SSL hostname and sync Spaceship DNS validation records for an AgentDomain identity.',
474
+ similes: ['FIX_SSL', 'REPAIR_SSL', 'SYNC_SSL'],
522
475
  examples: [],
523
- validate: async (runtime) => Boolean(runtime.getSetting("AGENT_PRIVATE_KEY")),
476
+ validate: async (runtime) => Boolean(runtime.getSetting('AGENT_PRIVATE_KEY')),
524
477
  handler: async (runtime, message) => {
525
478
  const { ad } = getClients(runtime);
526
479
  const agentId = message.content.text.match(/[0-9a-f-]{36}/i)?.[0];
527
480
  if (!agentId)
528
- throw new Error("Agent ID UUID is required to reconfigure SSL");
481
+ throw new Error('Agent ID UUID is required to reconfigure SSL');
529
482
  const result = await ad.reconfigureSsl(agentId);
530
483
  return {
531
484
  text: `SSL reconfigured for ${result.domain}. Status: ${result.sslStatus}.`,
@@ -534,12 +487,11 @@ export const reconfigureSslAction = {
534
487
  },
535
488
  };
536
489
  export const listDnsAction = {
537
- name: "LIST_DNS_RECORDS",
538
- description: "List DNS records for an AgentDomain identity.",
539
- similes: ["DNS_RECORDS", "LIST_DNS"],
490
+ name: 'LIST_DNS_RECORDS',
491
+ description: 'List DNS records for an AgentDomain identity.',
492
+ similes: ['DNS_RECORDS', 'LIST_DNS'],
540
493
  examples: [],
541
- validate: async (runtime) => Boolean(runtime.getSetting("AGENT_PRIVATE_KEY") ||
542
- runtime.getSetting("AGENTDOMAIN_API_KEY")),
494
+ validate: async (runtime) => Boolean(runtime.getSetting('AGENT_PRIVATE_KEY') || runtime.getSetting('AGENTDOMAIN_API_KEY')),
543
495
  handler: async (runtime, message) => {
544
496
  const { ad } = getClients(runtime);
545
497
  const agentId = requireAgentId(message.content.text);
@@ -548,12 +500,11 @@ export const listDnsAction = {
548
500
  },
549
501
  };
550
502
  export const dnsCapabilitiesAction = {
551
- name: "GET_DNS_CAPABILITIES",
552
- description: "Get AgentDomain DNS record types, validation fields, limits, and provider warnings.",
553
- similes: ["DNS_CAPABILITIES", "DNS_TYPES", "DNS_LIMITS"],
503
+ name: 'GET_DNS_CAPABILITIES',
504
+ description: 'Get AgentDomain DNS record types, validation fields, limits, and provider warnings.',
505
+ similes: ['DNS_CAPABILITIES', 'DNS_TYPES', 'DNS_LIMITS'],
554
506
  examples: [],
555
- validate: async (runtime) => Boolean(runtime.getSetting("AGENT_PRIVATE_KEY") ||
556
- runtime.getSetting("AGENTDOMAIN_API_KEY")),
507
+ validate: async (runtime) => Boolean(runtime.getSetting('AGENT_PRIVATE_KEY') || runtime.getSetting('AGENTDOMAIN_API_KEY')),
557
508
  handler: async (runtime, message) => {
558
509
  const { ad } = getClients(runtime);
559
510
  const result = await ad.getDnsCapabilities(requireAgentId(message.content.text));
@@ -564,70 +515,60 @@ export const dnsCapabilitiesAction = {
564
515
  },
565
516
  };
566
517
  export const createDnsAction = {
567
- name: "CREATE_DNS_RECORD",
568
- description: "Create a user-managed DNS record. Use text like: agentId type A name @ value 1.2.3.4.",
569
- similes: ["ADD_DNS", "CREATE_DNS"],
518
+ name: 'CREATE_DNS_RECORD',
519
+ description: 'Create a user-managed DNS record. Use text like: agentId type A name @ value 1.2.3.4.',
520
+ similes: ['ADD_DNS', 'CREATE_DNS'],
570
521
  examples: [],
571
- validate: async (runtime) => Boolean(runtime.getSetting("AGENT_PRIVATE_KEY") ||
572
- runtime.getSetting("AGENTDOMAIN_API_KEY")),
522
+ validate: async (runtime) => Boolean(runtime.getSetting('AGENT_PRIVATE_KEY') || runtime.getSetting('AGENTDOMAIN_API_KEY')),
573
523
  handler: async (runtime, message) => {
574
524
  const { ad } = getClients(runtime);
575
525
  const agentId = requireAgentId(message.content.text);
576
526
  const record = parseDnsRecord(message.content.text);
577
527
  const result = await ad.createDnsRecord(agentId, record);
578
- return {
579
- text: `Created ${result.type} DNS record ${result.name}.`,
580
- data: result,
581
- };
528
+ return { text: `Created ${result.type} DNS record ${result.name}.`, data: result };
582
529
  },
583
530
  };
584
531
  export const updateDnsAction = {
585
- name: "UPDATE_DNS_RECORD",
586
- description: "Update a user-managed DNS record. Include agent UUID and record UUID.",
587
- similes: ["EDIT_DNS", "UPDATE_DNS"],
532
+ name: 'UPDATE_DNS_RECORD',
533
+ description: 'Update a user-managed DNS record. Include agent UUID and record UUID.',
534
+ similes: ['EDIT_DNS', 'UPDATE_DNS'],
588
535
  examples: [],
589
- validate: async (runtime) => Boolean(runtime.getSetting("AGENT_PRIVATE_KEY") ||
590
- runtime.getSetting("AGENTDOMAIN_API_KEY")),
536
+ validate: async (runtime) => Boolean(runtime.getSetting('AGENT_PRIVATE_KEY') || runtime.getSetting('AGENTDOMAIN_API_KEY')),
591
537
  handler: async (runtime, message) => {
592
538
  const { ad } = getClients(runtime);
593
- const ids = message.content.text.match(new RegExp(UUID_PATTERN.source, "gi")) ?? [];
539
+ const ids = message.content.text.match(new RegExp(UUID_PATTERN.source, 'gi')) ?? [];
594
540
  const agentId = ids[0];
595
541
  const recordId = ids[1];
596
542
  if (!agentId || !recordId)
597
- throw new Error("Agent ID and record ID UUIDs are required");
543
+ throw new Error('Agent ID and record ID UUIDs are required');
598
544
  const record = parseDnsRecord(message.content.text);
599
545
  const result = await ad.updateDnsRecord(agentId, recordId, record);
600
- return {
601
- text: `Updated ${result.type} DNS record ${result.name}.`,
602
- data: result,
603
- };
546
+ return { text: `Updated ${result.type} DNS record ${result.name}.`, data: result };
604
547
  },
605
548
  };
606
549
  export const deleteDnsAction = {
607
- name: "DELETE_DNS_RECORD",
608
- description: "Delete a user-managed DNS record. Include agent UUID and record UUID.",
609
- similes: ["REMOVE_DNS", "DELETE_DNS"],
550
+ name: 'DELETE_DNS_RECORD',
551
+ description: 'Delete a user-managed DNS record. Include agent UUID and record UUID.',
552
+ similes: ['REMOVE_DNS', 'DELETE_DNS'],
610
553
  examples: [],
611
- validate: async (runtime) => Boolean(runtime.getSetting("AGENT_PRIVATE_KEY") ||
612
- runtime.getSetting("AGENTDOMAIN_API_KEY")),
554
+ validate: async (runtime) => Boolean(runtime.getSetting('AGENT_PRIVATE_KEY') || runtime.getSetting('AGENTDOMAIN_API_KEY')),
613
555
  handler: async (runtime, message) => {
614
556
  const { ad } = getClients(runtime);
615
- const ids = message.content.text.match(new RegExp(UUID_PATTERN.source, "gi")) ?? [];
557
+ const ids = message.content.text.match(new RegExp(UUID_PATTERN.source, 'gi')) ?? [];
616
558
  const agentId = ids[0];
617
559
  const recordId = ids[1];
618
560
  if (!agentId || !recordId)
619
- throw new Error("Agent ID and record ID UUIDs are required");
561
+ throw new Error('Agent ID and record ID UUIDs are required');
620
562
  const result = await ad.deleteDnsRecord(agentId, recordId);
621
563
  return { text: `Deleted DNS record ${recordId}.`, data: result };
622
564
  },
623
565
  };
624
566
  export const changeDnsRecordsAction = {
625
- name: "CHANGE_DNS_RECORDS",
626
- description: "Preview or apply a revision-protected DNS batch from a JSON array of structured records.",
627
- similes: ["BATCH_DNS", "PREVIEW_DNS_CHANGES", "APPLY_DNS_CHANGES"],
567
+ name: 'CHANGE_DNS_RECORDS',
568
+ description: 'Preview or apply a revision-protected DNS batch from a JSON array of structured records.',
569
+ similes: ['BATCH_DNS', 'PREVIEW_DNS_CHANGES', 'APPLY_DNS_CHANGES'],
628
570
  examples: [],
629
- validate: async (runtime) => Boolean(runtime.getSetting("AGENT_PRIVATE_KEY") ||
630
- runtime.getSetting("AGENTDOMAIN_API_KEY")),
571
+ validate: async (runtime) => Boolean(runtime.getSetting('AGENT_PRIVATE_KEY') || runtime.getSetting('AGENTDOMAIN_API_KEY')),
631
572
  handler: async (runtime, message) => {
632
573
  const { ad } = getClients(runtime);
633
574
  const agentId = requireAgentId(message.content.text);
@@ -637,20 +578,17 @@ export const changeDnsRecordsAction = {
637
578
  ? await ad.previewDnsBatch(agentId, records, options.mode)
638
579
  : await ad.applyDnsBatch(agentId, records, requireDnsRevision(options.baseRevision), options.mode);
639
580
  return {
640
- text: options.dryRun
641
- ? "DNS preview generated."
642
- : "DNS change set applied.",
581
+ text: options.dryRun ? 'DNS preview generated.' : 'DNS change set applied.',
643
582
  data: result,
644
583
  };
645
584
  },
646
585
  };
647
586
  export const importDnsZoneAction = {
648
- name: "IMPORT_DNS_ZONE",
649
- description: "Preview or apply a validated BIND DNS zone import.",
650
- similes: ["DNS_ZONE_IMPORT", "IMPORT_BIND_ZONE"],
587
+ name: 'IMPORT_DNS_ZONE',
588
+ description: 'Preview or apply a validated BIND DNS zone import.',
589
+ similes: ['DNS_ZONE_IMPORT', 'IMPORT_BIND_ZONE'],
651
590
  examples: [],
652
- validate: async (runtime) => Boolean(runtime.getSetting("AGENT_PRIVATE_KEY") ||
653
- runtime.getSetting("AGENTDOMAIN_API_KEY")),
591
+ validate: async (runtime) => Boolean(runtime.getSetting('AGENT_PRIVATE_KEY') || runtime.getSetting('AGENTDOMAIN_API_KEY')),
654
592
  handler: async (runtime, message) => {
655
593
  const { ad } = getClients(runtime);
656
594
  const agentId = requireAgentId(message.content.text);
@@ -660,33 +598,29 @@ export const importDnsZoneAction = {
660
598
  ? await ad.previewDnsImport(agentId, zoneFile, options.mode)
661
599
  : await ad.applyDnsImport(agentId, zoneFile, requireDnsRevision(options.baseRevision), options.mode);
662
600
  return {
663
- text: options.dryRun
664
- ? "DNS import preview generated."
665
- : "DNS zone import applied.",
601
+ text: options.dryRun ? 'DNS import preview generated.' : 'DNS zone import applied.',
666
602
  data: result,
667
603
  };
668
604
  },
669
605
  };
670
606
  export const exportDnsZoneAction = {
671
- name: "EXPORT_DNS_ZONE",
672
- description: "Export AgentDomain DNS records as a standard BIND zone file.",
673
- similes: ["DNS_ZONE_EXPORT", "EXPORT_BIND_ZONE"],
607
+ name: 'EXPORT_DNS_ZONE',
608
+ description: 'Export AgentDomain DNS records as a standard BIND zone file.',
609
+ similes: ['DNS_ZONE_EXPORT', 'EXPORT_BIND_ZONE'],
674
610
  examples: [],
675
- validate: async (runtime) => Boolean(runtime.getSetting("AGENT_PRIVATE_KEY") ||
676
- runtime.getSetting("AGENTDOMAIN_API_KEY")),
611
+ validate: async (runtime) => Boolean(runtime.getSetting('AGENT_PRIVATE_KEY') || runtime.getSetting('AGENTDOMAIN_API_KEY')),
677
612
  handler: async (runtime, message) => {
678
613
  const { ad } = getClients(runtime);
679
- const zone = await ad.exportDnsZone(requireAgentId(message.content.text), /\b(?:all|complete)\b/i.test(message.content.text) ? "all" : "user");
680
- return { text: zone, data: { format: "bind", zone } };
614
+ const zone = await ad.exportDnsZone(requireAgentId(message.content.text), /\b(?:all|complete)\b/i.test(message.content.text) ? 'all' : 'user');
615
+ return { text: zone, data: { format: 'bind', zone } };
681
616
  },
682
617
  };
683
618
  export const servicePlanStatusAction = {
684
- name: "GET_SERVICE_PLAN",
685
- description: "Get an agent Premium Plan, limits, current period, and billing state.",
686
- similes: ["PLAN_STATUS", "CHECK_PLAN"],
619
+ name: 'GET_SERVICE_PLAN',
620
+ description: 'Get an agent Premium Plan, limits, current period, and billing state.',
621
+ similes: ['PLAN_STATUS', 'CHECK_PLAN'],
687
622
  examples: [],
688
- validate: async (runtime) => Boolean(runtime.getSetting("AGENT_PRIVATE_KEY") ||
689
- runtime.getSetting("AGENTDOMAIN_API_KEY")),
623
+ validate: async (runtime) => Boolean(runtime.getSetting('AGENT_PRIVATE_KEY') || runtime.getSetting('AGENTDOMAIN_API_KEY')),
690
624
  handler: async (runtime, message) => {
691
625
  const { ad } = getClients(runtime);
692
626
  const agentId = requireAgentId(message.content.text);
@@ -698,45 +632,39 @@ export const servicePlanStatusAction = {
698
632
  },
699
633
  };
700
634
  export const setRegistryVisibilityAction = {
701
- name: "SET_REGISTRY_VISIBILITY",
702
- description: "Hide or show an agent in the public AgentDomain registry. Hiding requires an active paid Premium Plan.",
703
- similes: [
704
- "HIDE_AGENT_REGISTRY",
705
- "SHOW_AGENT_REGISTRY",
706
- "REGISTRY_VISIBILITY",
707
- ],
635
+ name: 'SET_REGISTRY_VISIBILITY',
636
+ description: 'Hide or show an agent in the public AgentDomain registry. Hiding requires an active paid Premium Plan.',
637
+ similes: ['HIDE_AGENT_REGISTRY', 'SHOW_AGENT_REGISTRY', 'REGISTRY_VISIBILITY'],
708
638
  examples: [],
709
- validate: async (runtime) => Boolean(runtime.getSetting("AGENT_PRIVATE_KEY") ||
710
- runtime.getSetting("AGENTDOMAIN_API_KEY")),
639
+ validate: async (runtime) => Boolean(runtime.getSetting('AGENT_PRIVATE_KEY') || runtime.getSetting('AGENTDOMAIN_API_KEY')),
711
640
  handler: async (runtime, message) => {
712
641
  const { ad } = getClients(runtime);
713
642
  const agentId = requireAgentId(message.content.text);
714
643
  const text = message.content.text.toLowerCase();
715
- const wantsPublic = text.includes("unhide") ||
716
- text.includes("show") ||
717
- text.includes("visible") ||
718
- text.includes("public");
719
- const registryHidden = !wantsPublic && (text.includes("hide") || text.includes("private"));
644
+ const wantsPublic = text.includes('unhide') ||
645
+ text.includes('show') ||
646
+ text.includes('visible') ||
647
+ text.includes('public');
648
+ const registryHidden = !wantsPublic && (text.includes('hide') || text.includes('private'));
720
649
  const result = await ad.setRegistryVisibility(agentId, registryHidden);
721
650
  return {
722
- text: `${result.domain} is now ${result.registryVisibility.hidden ? "hidden from" : "visible in"} the public registry.`,
651
+ text: `${result.domain} is now ${result.registryVisibility.hidden ? 'hidden from' : 'visible in'} the public registry.`,
723
652
  data: result,
724
653
  };
725
654
  },
726
655
  };
727
656
  export const scheduleServicePlanRenewalAction = {
728
- name: "SCHEDULE_SERVICE_PLAN_RENEWAL",
729
- description: "Choose the exact AgentDomain Premium Plan SKU for the next identity renewal.",
730
- similes: ["CHANGE_RENEWAL_PLAN", "SET_NEXT_RENEWAL_PLAN"],
657
+ name: 'SCHEDULE_SERVICE_PLAN_RENEWAL',
658
+ description: 'Choose the exact AgentDomain Premium Plan SKU for the next identity renewal.',
659
+ similes: ['CHANGE_RENEWAL_PLAN', 'SET_NEXT_RENEWAL_PLAN'],
731
660
  examples: [],
732
- validate: async (runtime) => Boolean(runtime.getSetting("AGENT_PRIVATE_KEY") ||
733
- runtime.getSetting("AGENTDOMAIN_API_KEY")),
661
+ validate: async (runtime) => Boolean(runtime.getSetting('AGENT_PRIVATE_KEY') || runtime.getSetting('AGENTDOMAIN_API_KEY')),
734
662
  handler: async (runtime, message) => {
735
663
  const { ad } = getClients(runtime);
736
664
  const agentId = requireAgentId(message.content.text);
737
665
  const lower = message.content.text.toLowerCase();
738
666
  const plan = parseRegistrationPlan(lower);
739
- const parsed = plan === "enterprise" ? parsePlan(lower) : { plan, planSku: plan };
667
+ const parsed = plan === 'enterprise' ? parsePlan(lower) : { plan, planSku: plan };
740
668
  const result = await ad.scheduleServicePlanRenewal(agentId, parsed);
741
669
  return {
742
670
  text: `Scheduled ${result.renewalPlanSku} for the next identity renewal.`,
@@ -745,11 +673,11 @@ export const scheduleServicePlanRenewalAction = {
745
673
  },
746
674
  };
747
675
  export const purchaseServicePlanAction = {
748
- name: "PURCHASE_SERVICE_PLAN",
749
- description: "Upgrade an agent to AgentDomain Starter, Pro, or Enterprise using x402 USDC.",
750
- similes: ["BUY_PLAN", "UPGRADE_PLAN"],
676
+ name: 'PURCHASE_SERVICE_PLAN',
677
+ description: 'Upgrade an agent to AgentDomain Starter, Pro, or Enterprise using x402 USDC.',
678
+ similes: ['BUY_PLAN', 'UPGRADE_PLAN'],
751
679
  examples: [],
752
- validate: async (runtime) => Boolean(runtime.getSetting("AGENT_PRIVATE_KEY")),
680
+ validate: async (runtime) => Boolean(runtime.getSetting('AGENT_PRIVATE_KEY')),
753
681
  handler: async (runtime, message) => {
754
682
  const { ad } = getClients(runtime, { requireWallet: true });
755
683
  const agentId = requireAgentId(message.content.text);
@@ -765,8 +693,8 @@ export const purchaseServicePlanAction = {
765
693
  },
766
694
  };
767
695
  export const agentDomainPlugin = {
768
- name: "agentdomain",
769
- description: "Identity infrastructure for AI agents on Base (domain + Basename + DNS + email + SSL).",
696
+ name: 'agentdomain',
697
+ description: 'Identity infrastructure for AI agents on Base (domain + Basename + DNS + email + SSL).',
770
698
  actions: [
771
699
  quoteRegistrationAction,
772
700
  registerIdentityAction,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentdomain/eliza-plugin",
3
- "version": "0.6.0",
3
+ "version": "0.7.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",
@@ -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/sdk": "^0.6.0",
30
- "@agentdomain/shared": "^0.6.0"
31
+ "@agentdomain/sdk": "^0.7.0",
32
+ "@agentdomain/shared": "^0.7.0"
31
33
  },
32
34
  "peerDependencies": {
33
35
  "@elizaos/core": "^1.0.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
  }