@sym-bot/mesh-channel 0.3.5 → 0.3.6

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/package.json +3 -2
  2. package/server.js +28 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sym-bot/mesh-channel",
3
- "version": "0.3.5",
3
+ "version": "0.3.6",
4
4
  "description": "MCP server — real-time agent-to-agent cognition for Claude Code remote teams via the SYM mesh.",
5
5
  "main": "server.js",
6
6
  "bin": {
@@ -22,7 +22,8 @@
22
22
  ],
23
23
  "dependencies": {
24
24
  "@modelcontextprotocol/sdk": "^1.12.1",
25
- "@sym-bot/sym": "^0.5.8"
25
+ "@sym-bot/sym": "^0.5.8",
26
+ "bonjour-service": "^1.3.0"
26
27
  },
27
28
  "engines": {
28
29
  "node": ">=18"
package/server.js CHANGED
@@ -763,6 +763,8 @@ mcp.setRequestHandler(CallToolRequestSchema, async (request) => {
763
763
  RELAY_URL = relayUrl;
764
764
  RELAY_TOKEN = relayToken;
765
765
 
766
+ publishGroupBeacon(); // re-advertise the new group on _symgroups._tcp
767
+
766
768
  return {
767
769
  content: [{
768
770
  type: 'text',
@@ -887,6 +889,7 @@ let shuttingDown = false;
887
889
  async function shutdown(signal) {
888
890
  if (shuttingDown) return;
889
891
  shuttingDown = true;
892
+ stopGroupBeacon();
890
893
  try {
891
894
  await node.stop();
892
895
  } catch {
@@ -899,12 +902,37 @@ process.on('SIGTERM', () => shutdown('SIGTERM'));
899
902
  process.on('SIGINT', () => shutdown('SIGINT'));
900
903
  process.on('SIGHUP', () => shutdown('SIGHUP'));
901
904
 
905
+ // ── Group discovery beacon (MMP §5.8) ──────────────────────────
906
+ // Mirror the sym CLI daemon: advertise this node's group on the shared
907
+ // `_symgroups._tcp` service (group name in TXT) via the pure-JS bonjour-service,
908
+ // so `sym groups` lists this Claude/MCP node cross-platform alongside
909
+ // CLI-daemon nodes. Discovery-only — comms stay on the group's own
910
+ // `_<group>._tcp`. Re-published on group hot-swap; torn down on shutdown.
911
+ let groupBeacon = null;
912
+ function publishGroupBeacon() {
913
+ try {
914
+ const { Bonjour } = require('bonjour-service');
915
+ if (groupBeacon) { try { groupBeacon.unpublishAll(); groupBeacon.destroy(); } catch {} groupBeacon = null; }
916
+ groupBeacon = new Bonjour();
917
+ groupBeacon.publish({ name: NODE_NAME, type: 'symgroups', port: (node && node._port) || 7777, txt: { group: GROUP, node: NODE_NAME } });
918
+ } catch (e) {
919
+ process.stderr.write(`group beacon unavailable: ${e?.message || e}\n`);
920
+ }
921
+ }
922
+ function stopGroupBeacon() {
923
+ if (!groupBeacon) return;
924
+ try { groupBeacon.unpublishAll(() => { try { groupBeacon.destroy(); } catch {} }); } catch {}
925
+ groupBeacon = null;
926
+ }
927
+
902
928
  async function main() {
903
929
  // Start SymNode — connects to relay as a peer. The startup primer is
904
930
  // computed at module-load time (see BASE_INSTRUCTIONS above) and is
905
931
  // already embedded in the MCP server's initialize-response payload.
906
932
  await node.start();
907
933
 
934
+ publishGroupBeacon();
935
+
908
936
  // Start MCP server — communicates with Claude Code via stdio
909
937
  const transport = new StdioServerTransport();
910
938
  await mcp.connect(transport);