a2acalling 0.6.27 → 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.
- package/bin/cli.js +62 -16
- package/package.json +1 -1
- package/src/routes/callbook.js +2 -2
- package/src/routes/dashboard.js +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
|
-
//
|
|
458
|
-
const
|
|
459
|
-
|
|
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:
|
|
487
|
+
owner: ownerName,
|
|
464
488
|
expires: args.flags.expires || args.flags.e || 'never',
|
|
465
|
-
permissions:
|
|
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
|
|
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
|
-
|
|
516
|
-
const ownerText = record.owner || 'Someone';
|
|
540
|
+
const ownerText = record.owner || 'the owner';
|
|
517
541
|
const agentName = record.name;
|
|
518
|
-
const
|
|
519
|
-
const
|
|
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}**
|
|
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
|
-
|
|
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
|
-
|
|
574
|
+
── For agents already onboarded ──
|
|
575
|
+
a2a add "${inviteUrl}" "${agentName}" && a2a call "${agentName}" "Hello from my owner!"
|
|
528
576
|
|
|
529
|
-
|
|
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
package/src/routes/callbook.js
CHANGED
|
@@ -117,10 +117,10 @@ function createCallbookRouter() {
|
|
|
117
117
|
setStatus('Connected. Session cookie stored in your browser.', 'ok');
|
|
118
118
|
openBtn.style.display = 'inline-block';
|
|
119
119
|
openBtn.addEventListener('click', () => {
|
|
120
|
-
window.location.href = result.dashboard_path || '/dashboard/';
|
|
120
|
+
window.location.href = result.dashboard_path || '/api/a2a/dashboard/';
|
|
121
121
|
});
|
|
122
122
|
window.setTimeout(() => {
|
|
123
|
-
window.location.href = result.dashboard_path || '/dashboard/';
|
|
123
|
+
window.location.href = result.dashboard_path || '/api/a2a/dashboard/';
|
|
124
124
|
}, 350);
|
|
125
125
|
} catch (err) {
|
|
126
126
|
setStatus('Failed: ' + err.message, 'error');
|
package/src/routes/dashboard.js
CHANGED