@agentdomain/eliza-plugin 0.3.0 → 0.4.1

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 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, primary address update, and 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 upgrades
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;
@@ -81,6 +95,47 @@ export declare const sendEmailAction: {
81
95
  data: import("@agentdomain/sdk").EmailResult;
82
96
  }>;
83
97
  };
98
+ export declare const emailUsageAction: {
99
+ name: string;
100
+ description: string;
101
+ similes: string[];
102
+ examples: never[];
103
+ validate: (runtime: IAgentRuntime) => Promise<boolean>;
104
+ handler: (runtime: IAgentRuntime, message: Memory) => Promise<{
105
+ text: string;
106
+ data: import("@agentdomain/sdk").EmailUsageResult;
107
+ }>;
108
+ };
109
+ export declare const configureEmailWebhookAction: {
110
+ name: string;
111
+ description: string;
112
+ similes: string[];
113
+ examples: never[];
114
+ validate: (runtime: IAgentRuntime) => Promise<boolean>;
115
+ handler: (runtime: IAgentRuntime, message: Memory) => Promise<{
116
+ text: string;
117
+ data: {
118
+ webhook: import("@agentdomain/sdk").EmailWebhookConfig;
119
+ signingSecret?: string;
120
+ };
121
+ }>;
122
+ };
123
+ export declare const sendEmailBatchAction: {
124
+ name: string;
125
+ description: string;
126
+ similes: string[];
127
+ examples: never[];
128
+ validate: (runtime: IAgentRuntime) => Promise<boolean>;
129
+ handler: (runtime: IAgentRuntime, message: Memory) => Promise<{
130
+ text: string;
131
+ data: {
132
+ batchId: string;
133
+ status: string;
134
+ jobs: unknown[];
135
+ errors: unknown[];
136
+ };
137
+ }>;
138
+ };
84
139
  export declare const updatePrimaryEmailAction: {
85
140
  name: string;
86
141
  description: string;
@@ -236,6 +291,17 @@ export declare const setRegistryVisibilityAction: {
236
291
  data: import("@agentdomain/sdk").RegistryVisibilityResult;
237
292
  }>;
238
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
+ };
239
305
  export declare const purchaseServicePlanAction: {
240
306
  name: string;
241
307
  description: string;
@@ -305,6 +371,19 @@ export declare const agentDomainPlugin: {
305
371
  text: string;
306
372
  data: import("@agentdomain/sdk").EmailListResult;
307
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
+ }>;
308
387
  } | {
309
388
  name: string;
310
389
  description: string;
@@ -315,6 +394,44 @@ export declare const agentDomainPlugin: {
315
394
  text: string;
316
395
  data: import("@agentdomain/sdk").EmailResult;
317
396
  }>;
397
+ } | {
398
+ name: string;
399
+ description: string;
400
+ similes: string[];
401
+ examples: never[];
402
+ validate: (runtime: IAgentRuntime) => Promise<boolean>;
403
+ handler: (runtime: IAgentRuntime, message: Memory) => Promise<{
404
+ text: string;
405
+ data: import("@agentdomain/sdk").EmailUsageResult;
406
+ }>;
407
+ } | {
408
+ name: string;
409
+ description: string;
410
+ similes: string[];
411
+ examples: never[];
412
+ validate: (runtime: IAgentRuntime) => Promise<boolean>;
413
+ handler: (runtime: IAgentRuntime, message: Memory) => Promise<{
414
+ text: string;
415
+ data: {
416
+ webhook: import("@agentdomain/sdk").EmailWebhookConfig;
417
+ signingSecret?: string;
418
+ };
419
+ }>;
420
+ } | {
421
+ name: string;
422
+ description: string;
423
+ similes: string[];
424
+ examples: never[];
425
+ validate: (runtime: IAgentRuntime) => Promise<boolean>;
426
+ handler: (runtime: IAgentRuntime, message: Memory) => Promise<{
427
+ text: string;
428
+ data: {
429
+ batchId: string;
430
+ status: string;
431
+ jobs: unknown[];
432
+ errors: unknown[];
433
+ };
434
+ }>;
318
435
  } | {
319
436
  name: string;
320
437
  description: string;
package/dist/index.js CHANGED
@@ -41,12 +41,7 @@ const registerSchema = z.object({
41
41
  registerBasename: z.boolean().default(true),
42
42
  registerEns: z.boolean().default(false),
43
43
  emailEnabled: z.boolean().default(true),
44
- emailUsername: z
45
- .string()
46
- .trim()
47
- .toLowerCase()
48
- .regex(EMAIL_USERNAME_PATTERN)
49
- .default('agent'),
44
+ emailUsername: z.string().trim().toLowerCase().regex(EMAIL_USERNAME_PATTERN).default('agent'),
50
45
  years: z.number().int().min(1).max(10).default(1),
51
46
  autoRenew: z.boolean().default(false),
52
47
  premiumPlan: z.enum(SERVICE_PLAN_KEYS).default('included'),
@@ -96,12 +91,23 @@ function parseRegistrationPlan(lower) {
96
91
  return 'enterprise';
97
92
  if (lower.includes('pro'))
98
93
  return 'pro';
94
+ if (lower.includes('starter'))
95
+ return 'starter';
99
96
  return 'included';
100
97
  }
101
98
  function parsePlan(text) {
102
99
  const lower = text.toLowerCase();
103
- const plan = lower.includes('enterprise') ? 'enterprise' : 'pro';
104
- return { plan };
100
+ if (lower.includes('enterprise')) {
101
+ const match = lower.match(/(\d+(?:\.\d+)?)\s*(k|m)/);
102
+ const monthly = match
103
+ ? Math.round(Number(match[1]) * (match[2] === 'm' ? 1_000_000 : 1_000))
104
+ : 100_000;
105
+ return {
106
+ plan: 'enterprise',
107
+ planSku: `enterprise-${monthly}`,
108
+ };
109
+ }
110
+ return { plan: lower.includes('starter') ? 'starter' : 'pro' };
105
111
  }
106
112
  function parseDnsRecord(text) {
107
113
  const lower = text.toLowerCase();
@@ -120,8 +126,7 @@ function parseDnsRecord(text) {
120
126
  return parsed;
121
127
  }
122
128
  function parseEmailUsername(text) {
123
- const explicit = text.match(/\b(?:email\s+username|primary\s+email|username|alias)[:=]?\s*([a-z0-9._+-]{1,64})/i)?.[1] ??
124
- text.match(EMAIL_PATTERN)?.[0]?.split('@')[0];
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];
125
130
  const username = explicit?.trim().toLowerCase();
126
131
  return username && EMAIL_USERNAME_PATTERN.test(username) ? username : null;
127
132
  }
@@ -250,6 +255,21 @@ export const listEmailAction = {
250
255
  return { text: `Found ${result.messages.length} messages.`, data: result };
251
256
  },
252
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
+ };
253
273
  export const sendEmailAction = {
254
274
  name: 'SEND_AGENT_EMAIL',
255
275
  description: 'Send text-only email from an AgentDomain primary address or active alias.',
@@ -261,7 +281,57 @@ export const sendEmailAction = {
261
281
  const agentId = requireAgentId(message.content.text);
262
282
  const payload = parseEmailRequest(message.content.text);
263
283
  const result = await ad.sendEmail(agentId, payload);
264
- return { text: `Email sent: ${result.id}.`, data: result };
284
+ return { text: `Email queued: ${result.id}.`, data: result };
285
+ },
286
+ };
287
+ export const emailUsageAction = {
288
+ name: 'GET_AGENT_EMAIL_USAGE',
289
+ description: 'Get combined monthly sent and received email usage.',
290
+ similes: ['EMAIL_USAGE', 'EMAIL_QUOTA'],
291
+ examples: [],
292
+ validate: async (runtime) => Boolean(runtime.getSetting('AGENT_PRIVATE_KEY') || runtime.getSetting('AGENTDOMAIN_API_KEY')),
293
+ handler: async (runtime, message) => {
294
+ const { ad } = getClients(runtime);
295
+ const result = await ad.getEmailUsage(requireAgentId(message.content.text));
296
+ return {
297
+ text: `Used ${result.used} of ${result.limit} emails; ${result.remaining} remain.`,
298
+ data: result,
299
+ };
300
+ },
301
+ };
302
+ export const configureEmailWebhookAction = {
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'],
306
+ examples: [],
307
+ validate: async (runtime) => Boolean(runtime.getSetting('AGENT_PRIVATE_KEY') || runtime.getSetting('AGENTDOMAIN_API_KEY')),
308
+ handler: async (runtime, message) => {
309
+ const { ad } = getClients(runtime);
310
+ const agentId = requireAgentId(message.content.text);
311
+ const url = message.content.text.match(/https:\/\/[^\s]+/)?.[0];
312
+ if (!url)
313
+ throw new Error('HTTPS webhook URL is required');
314
+ const result = await ad.setEmailWebhook(agentId, {
315
+ url,
316
+ payloadMode: /inline/i.test(message.content.text) ? 'inline_text' : 'metadata',
317
+ enabled: true,
318
+ });
319
+ return { text: 'Inbound email webhook configured.', data: result };
320
+ },
321
+ };
322
+ export const sendEmailBatchAction = {
323
+ name: 'SEND_AGENT_EMAIL_BATCH',
324
+ description: 'Queue up to 100 emails supplied as a JSON messages array.',
325
+ similes: ['BATCH_EMAIL'],
326
+ examples: [],
327
+ validate: async (runtime) => Boolean(runtime.getSetting('AGENT_PRIVATE_KEY') || runtime.getSetting('AGENTDOMAIN_API_KEY')),
328
+ handler: async (runtime, message) => {
329
+ const { ad } = getClients(runtime);
330
+ const agentId = requireAgentId(message.content.text);
331
+ const json = message.content.text.slice(message.content.text.indexOf('{'));
332
+ const parsed = JSON.parse(json);
333
+ const result = await ad.sendEmailBatch(agentId, { messages: parsed.messages });
334
+ return { text: `Queued ${result.jobs.length} email jobs.`, data: result };
265
335
  },
266
336
  };
267
337
  export const updatePrimaryEmailAction = {
@@ -282,7 +352,7 @@ export const updatePrimaryEmailAction = {
282
352
  };
283
353
  export const createEmailAliasAction = {
284
354
  name: 'CREATE_EMAIL_ALIAS',
285
- description: 'Create a receive-and-send email alias for an AgentDomain identity. Requires available Pro or Enterprise alias capacity.',
355
+ description: 'Create a receive-and-send email alias for an AgentDomain identity. Requires available paid-plan alias capacity.',
286
356
  similes: ['ADD_EMAIL_ALIAS', 'CREATE_ALIAS'],
287
357
  examples: [],
288
358
  validate: async (runtime) => Boolean(runtime.getSetting('AGENT_PRIVATE_KEY') || runtime.getSetting('AGENTDOMAIN_API_KEY')),
@@ -451,14 +521,14 @@ export const servicePlanStatusAction = {
451
521
  const agentId = requireAgentId(message.content.text);
452
522
  const result = await ad.getServicePlan(agentId);
453
523
  return {
454
- text: `${result.domain} is on ${result.entitlement.plan}. Email limit ${result.entitlement.limits.emailPerHour}/hour, DNS limit ${result.entitlement.limits.dnsRecords}, registry hidden ${result.registryVisibility.hidden}.`,
524
+ text: `${result.domain} is on ${result.entitlement.plan}. Email limit ${result.entitlement.limits.monthlyEmails}/month combined, DNS limit ${result.entitlement.limits.dnsRecords}, registry hidden ${result.registryVisibility.hidden}.`,
455
525
  data: result,
456
526
  };
457
527
  },
458
528
  };
459
529
  export const setRegistryVisibilityAction = {
460
530
  name: 'SET_REGISTRY_VISIBILITY',
461
- description: 'Hide or show an agent in the public AgentDomain registry. Hiding requires an active Pro or Enterprise Premium Plan.',
531
+ description: 'Hide or show an agent in the public AgentDomain registry. Hiding requires an active paid Premium Plan.',
462
532
  similes: ['HIDE_AGENT_REGISTRY', 'SHOW_AGENT_REGISTRY', 'REGISTRY_VISIBILITY'],
463
533
  examples: [],
464
534
  validate: async (runtime) => Boolean(runtime.getSetting('AGENT_PRIVATE_KEY') || runtime.getSetting('AGENTDOMAIN_API_KEY')),
@@ -478,9 +548,28 @@ export const setRegistryVisibilityAction = {
478
548
  };
479
549
  },
480
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.`,
566
+ data: result,
567
+ };
568
+ },
569
+ };
481
570
  export const purchaseServicePlanAction = {
482
571
  name: 'PURCHASE_SERVICE_PLAN',
483
- description: 'Upgrade an agent to AgentDomain Pro or Enterprise Premium Plan using x402 USDC.',
572
+ description: 'Upgrade an agent to AgentDomain Starter, Pro, or Enterprise using x402 USDC.',
484
573
  similes: ['BUY_PLAN', 'UPGRADE_PLAN'],
485
574
  examples: [],
486
575
  validate: async (runtime) => Boolean(runtime.getSetting('AGENT_PRIVATE_KEY')),
@@ -506,7 +595,11 @@ export const agentDomainPlugin = {
506
595
  registerIdentityAction,
507
596
  searchAgentsAction,
508
597
  sendEmailAction,
598
+ sendEmailBatchAction,
599
+ emailUsageAction,
600
+ configureEmailWebhookAction,
509
601
  listEmailAction,
602
+ deleteEmailMessageAction,
510
603
  updatePrimaryEmailAction,
511
604
  createEmailAliasAction,
512
605
  deleteEmailAliasAction,
@@ -520,6 +613,7 @@ export const agentDomainPlugin = {
520
613
  deleteDnsAction,
521
614
  servicePlanStatusAction,
522
615
  setRegistryVisibilityAction,
616
+ scheduleServicePlanRenewalAction,
523
617
  purchaseServicePlanAction,
524
618
  ],
525
619
  evaluators: [],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentdomain/eliza-plugin",
3
- "version": "0.3.0",
3
+ "version": "0.4.1",
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.3.0",
30
- "@agentdomain/shared": "^0.3.0"
29
+ "@agentdomain/sdk": "^0.4.1",
30
+ "@agentdomain/shared": "^0.4.0"
31
31
  },
32
32
  "peerDependencies": {
33
33
  "@elizaos/core": "^1.0.0"