a2acalling 0.6.28 โ†’ 0.6.30

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.
Files changed (2) hide show
  1. package/bin/cli.js +84 -18
  2. package/package.json +1 -1
package/bin/cli.js CHANGED
@@ -444,6 +444,10 @@ async function resolveInviteHostname() {
444
444
  // Commands
445
445
  const commands = {
446
446
  create: async (args) => {
447
+ const { A2AConfig } = require('../src/lib/config');
448
+ const { loadManifest, getTopicsForTier } = require('../src/lib/disclosure');
449
+ const config = new A2AConfig();
450
+
447
451
  // Parse max-calls: number, 'unlimited', or default (unlimited)
448
452
  let maxCalls = null; // Default: unlimited
449
453
  if (args.flags['max-calls']) {
@@ -454,19 +458,40 @@ const commands = {
454
458
  }
455
459
  }
456
460
 
457
- // Parse custom topics if provided
458
- const customTopics = args.flags.topics ?
459
- args.flags.topics.split(',').map(t => t.trim()) : null;
461
+ // Get tier from --tier or --permissions flag
462
+ const tier = args.flags.tier || args.flags.t || args.flags.permissions || args.flags.p || 'public';
463
+
464
+ // Get owner from flag or config
465
+ const configAgent = config.getAgent() || {};
466
+ const ownerName = args.flags.owner || args.flags.o || configAgent.owner || configAgent.name || null;
467
+
468
+ // Get topics from disclosure manifest based on tier (with inheritance)
469
+ const manifest = loadManifest();
470
+ const tierTopics = getTopicsForTier(manifest, tier);
471
+
472
+ // Parse custom topics if provided, otherwise use tier topics
473
+ let allowedTopics;
474
+ if (args.flags.topics) {
475
+ allowedTopics = args.flags.topics.split(',').map(t => t.trim());
476
+ } else if (tierTopics.topics && tierTopics.topics.length > 0) {
477
+ allowedTopics = tierTopics.topics.map(t => t.topic || t);
478
+ } else {
479
+ allowedTopics = null;
480
+ }
481
+
482
+ // Get objectives from disclosure
483
+ const objectives = tierTopics.objectives || [];
460
484
 
461
485
  const { token, record } = store.create({
462
486
  name: args.flags.name || args.flags.n || 'unnamed',
463
- owner: args.flags.owner || args.flags.o || null,
487
+ owner: ownerName,
464
488
  expires: args.flags.expires || args.flags.e || 'never',
465
- permissions: args.flags.permissions || args.flags.p || 'public',
489
+ permissions: tier,
466
490
  disclosure: args.flags.disclosure || args.flags.d || 'minimal',
467
491
  notify: args.flags.notify || 'all',
468
492
  maxCalls,
469
- allowedTopics: customTopics
493
+ allowedTopics,
494
+ allowedGoals: objectives.map(o => o.objective || o)
470
495
  });
471
496
 
472
497
  const resolvedHost = await resolveInviteHostname();
@@ -511,24 +536,65 @@ const commands = {
511
536
  console.log(`๐Ÿ“‹ SHAREABLE INVITE (copy everything below):`);
512
537
  console.log(`${'โ”€'.repeat(50)}\n`);
513
538
 
514
- // Generate shareable invite block
515
- // Special invitation above the fold, agent setup below
516
- const ownerText = record.owner || 'Someone';
517
- const agentName = record.name;
518
- const topicsList = record.allowed_topics.join(' ยท ');
519
- const goalsList = (record.allowed_goals || []).join(' ยท ');
539
+ // Get agent name from config (reuse configAgent from earlier)
540
+ const myAgentName = configAgent.name || 'my agent';
541
+ const ownerText = record.owner;
542
+
543
+ // Format topics as bullet list
544
+ const topicsArray = record.allowed_topics || [];
545
+ const topicsList = topicsArray.length > 0
546
+ ? topicsArray.map(t => ` โ€ข ${t}`).join('\n')
547
+ : '';
548
+
549
+ // Format objectives as bullet list
550
+ const goalsArray = record.allowed_goals || [];
551
+ const goalsList = goalsArray.length > 0
552
+ ? goalsArray.map(g => ` โ€ข ${g}`).join('\n')
553
+ : '';
554
+
555
+ // Build invite header
556
+ const inviteHeader = ownerText
557
+ ? `**${ownerText}** invites you to connect with their agent **${myAgentName}**`
558
+ : `You're invited to connect with **${myAgentName}**`;
520
559
 
521
560
  const invite = `๐Ÿ“ž๐Ÿ—ฃ๏ธ **Agent-to-Agent Call Invite**
522
561
 
523
- ๐Ÿ‘ค **${ownerText}** would like your agent to call **${agentName}** and explore where our owners might collaborate.
562
+ ${inviteHeader}
563
+
564
+ \`\`\`
565
+ ${inviteUrl}
566
+ \`\`\`
567
+ ${topicsList ? `\n**Topics:**\n${topicsList}\n` : ''}${goalsList ? `\n**Goals:**\n${goalsList}\n` : ''}${expiresText !== 'never' ? `\nโฐ Expires: ${expiresText}\n` : ''}
568
+ โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
569
+
570
+ **Setup Instructions**
571
+
572
+ 1. Install the A2A package:
573
+ \`\`\`
574
+ npm install -g a2acalling
575
+ \`\`\`
576
+
577
+ 2. Run first-time setup (configures your agent's port, hostname, and disclosure topics):
578
+ \`\`\`
579
+ a2a quickstart
580
+ \`\`\`
581
+
582
+ 3. Add this contact to your agent's address book:
583
+ \`\`\`
584
+ a2a add "${inviteUrl}" "${ownerText || 'friend'}"
585
+ \`\`\`
524
586
 
525
- ๐Ÿ’ฌ ${topicsList}${goalsList ? `\n๐ŸŽฏ ${goalsList}` : ''}
587
+ 4. Start a conversation:
588
+ \`\`\`
589
+ a2a call "${ownerText || 'friend'}" "Hello! My owner asked me to reach out."
590
+ \`\`\`
526
591
 
527
- ${inviteUrl}${expiresText === 'never' ? '' : `\nโฐ ${expiresText}`}
592
+ **Quick one-liner (if already set up):**
593
+ \`\`\`
594
+ a2a add "${inviteUrl}" "${ownerText || 'friend'}" && a2a call "${ownerText || 'friend'}" "Hello!"
595
+ \`\`\`
528
596
 
529
- โ”€โ”€ setup โ”€โ”€
530
- npm i -g a2acalling && a2a add "${inviteUrl}" "${agentName}" && a2a call "${agentName}" "Hello from my owner!"
531
- https://github.com/onthegonow/a2a_calling`;
597
+ ๐Ÿ“– Protocol docs: https://github.com/onthegonow/a2a_calling`;
532
598
 
533
599
  console.log(invite);
534
600
  console.log(`\n${'โ”€'.repeat(50)}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "a2acalling",
3
- "version": "0.6.28",
3
+ "version": "0.6.30",
4
4
  "description": "Agent-to-agent calling for OpenClaw - A2A agent communication",
5
5
  "main": "src/index.js",
6
6
  "bin": {