bus-agent 2.3.3 → 2.3.4

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 (3) hide show
  1. package/bin/cli.js +15 -6
  2. package/coco-cli.js +34 -34
  3. package/package.json +1 -1
package/bin/cli.js CHANGED
@@ -14,28 +14,37 @@ const args = process.argv.slice(2);
14
14
 
15
15
  if (args.includes('--help') || args.includes('-h')) {
16
16
  console.log(`
17
- MCP Bus — MCP Bridge: OpenClaw ↔ Hermes Agent
17
+ MCP Bus — Agent Communication Hub
18
18
 
19
19
  Usage:
20
- bus-agent Run as stdio MCP server (for mcporter)
20
+ bus-agent Run as stdio MCP server (for MCP clients)
21
21
  bus-agent --daemon Start background daemon
22
22
  bus-agent --health Quick health check (exit 0 = ok)
23
23
  bus-agent --help Show this help
24
24
 
25
25
  Examples:
26
26
  # Run as stdio server (connect via mcporter):
27
- mcporter add coco --stdio "node path/to/index.js"
27
+ mcporter config add bus-agent --stdio "bus-agent"
28
28
 
29
29
  # Start as background daemon:
30
30
  bus-agent --daemon
31
31
 
32
- # Call from OpenClaw:
33
- mcporter call coco.ask_hermes prompt="Hello Hermes"
34
-
35
32
  # Check health:
36
33
  bus-agent --health
37
34
  `);
38
35
  process.exit(0);
39
36
  }
40
37
 
38
+ if (args.includes('--health')) {
39
+ const { AgentBus } = require(path.join(__dirname, '..', 'lib', 'bus'));
40
+ try {
41
+ const bus = new AgentBus();
42
+ const busDir = process.env.BUS_DIR || path.join(process.cwd(), '.bus');
43
+ const ok = require('fs').existsSync(path.join(busDir, 'agents.json'));
44
+ process.exit(ok ? 0 : 1);
45
+ } catch {
46
+ process.exit(1);
47
+ }
48
+ }
49
+
41
50
  require(path.join(__dirname, '..', 'index.js'));
package/coco-cli.js CHANGED
@@ -1,23 +1,23 @@
1
1
  #!/usr/bin/env node
2
2
  /**
3
- * CoCo CLI v2.1 Direct bus interface for CLI agents
3
+ * Bus CLI v2.3.3 - Direct bus interface for CLI agents
4
4
  *
5
- * No MCP needed. Direct file access to the CoCo Agent Bus.
5
+ * No MCP needed. Direct file access to the Bus Agent Bus.
6
6
  *
7
7
  * Usage:
8
- * node coco-cli.js agents # List all agents (with filters)
9
- * node coco-cli.js whoami # Show your agent identity
10
- * node coco-cli.js inbox [agent] # Show inbox messages
11
- * node coco-cli.js send <to> <message> # Send a message
12
- * node coco-cli.js reply <msg-id> <message> # Reply to a message
13
- * node coco-cli.js profile [agent] # Show profile
14
- * node coco-cli.js profile edit --status busy # Edit your profile
15
- * node coco-cli.js search <query> # Search agents
16
- * node coco-cli.js status # Show CoCo + your agent status
17
- * node coco-cli.js subscribe <channel> # Listen to channel messages
18
- * node coco-cli.js channel list|send|history # Channel operations
19
- * node coco-cli.js events [since] # View system events
20
- * node coco-cli.js watch [agent] # Watch for new messages
8
+ * bus agents # List all agents (with filters)
9
+ * bus whoami # Show your agent identity
10
+ * bus inbox [agent] # Show inbox messages
11
+ * bus send <to> <message> # Send a message
12
+ * bus reply <msg-id> <message> # Reply to a message
13
+ * bus profile [agent] # Show profile
14
+ * bus profile edit --status busy # Edit your profile
15
+ * bus search <query> # Search agents
16
+ * bus status # Show Bus + your agent status
17
+ * bus subscribe <channel> # Listen to channel messages
18
+ * bus channel list|send|history # Channel operations
19
+ * bus events [since] # View system events
20
+ * bus watch [agent] # Watch for new messages
21
21
  */
22
22
  const path = require('path');
23
23
  const fs = require('fs');
@@ -123,7 +123,7 @@ function cmdAgents(filterArgs) {
123
123
  (a.description || '').toLowerCase().includes(filters.search.toLowerCase())
124
124
  );
125
125
 
126
- console.log(`\n🤖 Agents on CoCo Bus (${list.length} total):`);
126
+ console.log(`\n🤖 Agents on Bus (${list.length} total):`);
127
127
  console.log('─'.repeat(70));
128
128
 
129
129
  list.sort((a, b) => new Date(b[1].last_seen) - new Date(a[1].last_seen));
@@ -201,7 +201,7 @@ function cmdInbox(agentName, extra) {
201
201
 
202
202
  function cmdSend(to, text) {
203
203
  if (!to || !text) {
204
- console.log('Usage: node coco-cli.js send <to> <message>');
204
+ console.log('Usage: bus send <to> <message>');
205
205
  process.exit(1);
206
206
  }
207
207
  const from = process.env.COCO_AGENT || process.env.USER || 'anonymous';
@@ -220,7 +220,7 @@ function cmdSend(to, text) {
220
220
 
221
221
  function cmdReply(msgId, text) {
222
222
  if (!msgId || !text) {
223
- console.log('Usage: node coco-cli.js reply <msg-id> <message>');
223
+ console.log('Usage: bus reply <msg-id> <message>');
224
224
  process.exit(1);
225
225
  }
226
226
  const from = process.env.COCO_AGENT || process.env.USER || 'anonymous';
@@ -340,7 +340,7 @@ function cmdProfileEdit(edits) {
340
340
 
341
341
  function cmdSearch(query) {
342
342
  if (!query) {
343
- console.log('Usage: node coco-cli.js search <query>');
343
+ console.log('Usage: bus search <query>');
344
344
  console.log('Searches agent names, descriptions, capabilities, and tags');
345
345
  return;
346
346
  }
@@ -391,7 +391,7 @@ function cmdStatus() {
391
391
 
392
392
  console.log(`
393
393
  ╔══════════════════════════════════════════╗
394
- MCP CoCo — Agent Bus Status
394
+ Bus Agent — Agent Bus Status
395
395
  ╚══════════════════════════════════════════╝`);
396
396
  console.log(` You: ${myName} ${myOnline ? '🟢 online' : '⚫ offline'}`);
397
397
  console.log(` Bus agents: ${Object.keys(agents).length} total (${online.length} online, ${offline.length} offline)`);
@@ -419,7 +419,7 @@ function cmdStatus() {
419
419
 
420
420
  function cmdSubscribe(channelId) {
421
421
  if (!channelId) {
422
- console.log('Usage: node coco-cli.js subscribe <channel>');
422
+ console.log('Usage: bus subscribe <channel>');
423
423
  console.log('Listens to channel messages in real-time.');
424
424
  process.exit(1);
425
425
  }
@@ -573,7 +573,7 @@ function cmdChannel(subArgs) {
573
573
  if (sub === 'create') {
574
574
  const chId = subArgs[1];
575
575
  const topic = subArgs.slice(2).join(' ') || '';
576
- if (!chId) { console.log('Usage: node coco-cli.js channel create <name> [topic]'); return; }
576
+ if (!chId) { console.log('Usage: bus channel create <name> [topic]'); return; }
577
577
  const ch = { id: chId, topic, created_by: process.env.COCO_AGENT || 'cli', created_at: new Date().toISOString(), members: [] };
578
578
  fs.writeFileSync(path.join(CHANNELS_DIR, `${chId}.json`), JSON.stringify(ch, null, 2), 'utf-8');
579
579
  console.log(`✅ Channel "#${chId}" created`);
@@ -583,7 +583,7 @@ function cmdChannel(subArgs) {
583
583
  if (sub === 'join') {
584
584
  const chId = subArgs[1];
585
585
  const agentName = subArgs[2] || process.env.COCO_AGENT || process.env.USER || 'anonymous';
586
- if (!chId) { console.log('Usage: node coco-cli.js channel join <name> [agent]'); return; }
586
+ if (!chId) { console.log('Usage: bus channel join <name> [agent]'); return; }
587
587
  const chPath = path.join(CHANNELS_DIR, `${chId}.json`);
588
588
  if (!fs.existsSync(chPath)) { console.log(`❌ Channel "${chId}" not found`); return; }
589
589
  const ch = JSON.parse(fs.readFileSync(chPath, 'utf-8'));
@@ -597,7 +597,7 @@ function cmdChannel(subArgs) {
597
597
  const channelId = subArgs[1];
598
598
  const text = subArgs.slice(2).join(' ');
599
599
  if (!channelId || !text) {
600
- console.log('Usage: node coco-cli.js channel send <channel> <message>');
600
+ console.log('Usage: bus channel send <channel> <message>');
601
601
  return;
602
602
  }
603
603
  const from = process.env.COCO_AGENT || process.env.USER || 'anonymous';
@@ -672,7 +672,7 @@ function cmdWatch(agentName) {
672
672
  const msg = JSON.parse(fs.readFileSync(path.join(dir, f), 'utf-8'));
673
673
  const tag = msg.metadata?.channel ? `[#${msg.metadata.channel}]` : '';
674
674
  console.log(`\n📩 ${tag} [${msg.from}] ${msg.message}`);
675
- console.log(` Reply: node coco-cli.js reply ${msg.id} "your message"\n`);
675
+ console.log(` Reply: bus reply ${msg.id} "your message"\n`);
676
676
  } catch {}
677
677
  }
678
678
  lastCount = files.length;
@@ -899,11 +899,11 @@ function cmdBackup(args) {
899
899
  function cmdHelp() {
900
900
  console.log(`
901
901
  ╔═══════════════════════════════════════════════╗
902
- ║ MCP CoCo v2.1 CLI Agent Bus Interface ║
902
+ ║ MCP Bus v2.3.3 - CLI Agent Bus Interface (bus)
903
903
  ╚═══════════════════════════════════════════════╝
904
904
 
905
905
  Usage:
906
- node coco-cli.js <command> [args]
906
+ bus <command> [args]
907
907
 
908
908
  Commands:
909
909
  agents [filters] List all agents on the bus
@@ -916,7 +916,7 @@ Commands:
916
916
  profile [agent] Show agent profile details
917
917
  profile edit --status busy Edit your profile fields
918
918
  search <query> Search agents by name/capability/description
919
- status Show CoCo bus health & online agents
919
+ status Show bus health & online agents
920
920
  subscribe <channel> Listen to channel messages in real-time
921
921
 
922
922
  channel list List all channels
@@ -971,12 +971,12 @@ Environment:
971
971
  COCO_AGENT=opencode Set your agent name for inbox/send
972
972
 
973
973
  Examples:
974
- node coco-cli.js agents --online --capability code-review
975
- node coco-cli.js profile opencode
976
- node coco-cli.js search web
977
- node coco-cli.js status
978
- node coco-cli.js subscribe dev-chat
979
- node coco-cli.js channel create dev-chat "Development chat"
974
+ bus agents --online --capability code-review
975
+ bus profile opencode
976
+ bus search web
977
+ bus status
978
+ bus subscribe dev-chat
979
+ bus channel create dev-chat "Development chat"
980
980
  `);
981
981
  }
982
982
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bus-agent",
3
- "version": "2.3.3",
3
+ "version": "2.3.4",
4
4
  "description": "Universal Agent Communication Hub — Connect any AI agent to any other. MCP bus with messaging, channels, memory, scheduling, workflows, and diagnostics.",
5
5
  "main": "index.js",
6
6
  "bin": {