a2acalling 0.6.28 → 0.6.29

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 +62 -16
  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();
@@ -512,23 +537,44 @@ const commands = {
512
537
  console.log(`${'─'.repeat(50)}\n`);
513
538
 
514
539
  // Generate shareable invite block
515
- // Special invitation above the fold, agent setup below
516
- const ownerText = record.owner || 'Someone';
540
+ const ownerText = record.owner || 'the owner';
517
541
  const agentName = record.name;
518
- const topicsList = record.allowed_topics.join(' · ');
519
- const goalsList = (record.allowed_goals || []).join(' · ');
542
+ const tierName = record.tier || 'public';
543
+ const tierConfig = config.getAll().tiers?.[tierName] || {};
544
+ const tierDesc = tierConfig.description || `${tierName} access`;
545
+
546
+ // Format topics as bullet list
547
+ const topicsArray = record.allowed_topics || [];
548
+ const topicsList = topicsArray.length > 0
549
+ ? topicsArray.map(t => ` • ${t}`).join('\n')
550
+ : ' • General discussion';
551
+
552
+ // Format objectives as bullet list
553
+ const goalsArray = record.allowed_goals || [];
554
+ const goalsList = goalsArray.length > 0
555
+ ? goalsArray.map(g => ` • ${g}`).join('\n')
556
+ : '';
520
557
 
521
558
  const invite = `📞🗣️ **Agent-to-Agent Call Invite**
522
559
 
523
- 👤 **${ownerText}** would like your agent to call **${agentName}** and explore where our owners might collaborate.
560
+ 👤 **${ownerText}**'s agent **${agentName}** invites your agent to connect.
561
+ 📊 Access tier: **${tierName}** (${tierDesc})
562
+
563
+ 💬 **Topics to discuss:**
564
+ ${topicsList}
565
+ ${goalsList ? `\n🎯 **Objectives:**\n${goalsList}\n` : ''}
566
+ 🔗 ${inviteUrl}${expiresText === 'never' ? '' : `\n⏰ Expires: ${expiresText}`}
524
567
 
525
- 💬 ${topicsList}${goalsList ? `\n🎯 ${goalsList}` : ''}
568
+ ── For agents new to A2A ──
569
+ npm i -g a2acalling
570
+ a2a quickstart # First-time setup
571
+ a2a add "${inviteUrl}" "${agentName}" # Save contact
572
+ a2a call "${agentName}" "Hello!" # Start call
526
573
 
527
- ${inviteUrl}${expiresText === 'never' ? '' : `\n⏰ ${expiresText}`}
574
+ ── For agents already onboarded ──
575
+ a2a add "${inviteUrl}" "${agentName}" && a2a call "${agentName}" "Hello from my owner!"
528
576
 
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`;
577
+ 📖 https://github.com/onthegonow/a2a_calling`;
532
578
 
533
579
  console.log(invite);
534
580
  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.29",
4
4
  "description": "Agent-to-agent calling for OpenClaw - A2A agent communication",
5
5
  "main": "src/index.js",
6
6
  "bin": {