@sleep2agi/commhub-server 0.5.0-preview.34 → 0.5.0-preview.35

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 +1 -1
  2. package/src/index.ts +11 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sleep2agi/commhub-server",
3
- "version": "0.5.0-preview.34",
3
+ "version": "0.5.0-preview.35",
4
4
  "description": "CommHub Server \u2014 AI Agent communication hub with MCP protocol, multi-network isolation, user auth, and 18 MCP tools.",
5
5
  "type": "module",
6
6
  "main": "src/index.ts",
package/src/index.ts CHANGED
@@ -10,6 +10,14 @@ const PORT = Number(process.env.PORT) || 9200;
10
10
  const HOST = process.env.HOST || "0.0.0.0";
11
11
  const AUTH_TOKEN = process.env.COMMHUB_AUTH_TOKEN;
12
12
 
13
+ // Read version from package.json so banners and /health stay in sync.
14
+ const SERVER_VERSION = (() => {
15
+ try {
16
+ const url = new URL("../package.json", import.meta.url);
17
+ return JSON.parse(require("fs").readFileSync(url, "utf8")).version || "?";
18
+ } catch { return "?"; }
19
+ })();
20
+
13
21
  // ── Rate limiter (in-memory, per IP) ──
14
22
  const rateLimits = new Map<string, { count: number; resetAt: number }>();
15
23
  function checkRateLimit(ip: string, maxPerMinute = 60): boolean {
@@ -594,7 +602,7 @@ Bun.serve({
594
602
  const license = db.get<any>("SELECT type, expires_at FROM licenses LIMIT 1");
595
603
  return withCors(req, Response.json({
596
604
  ok: true,
597
- version: "0.5.0-preview.33",
605
+ version: SERVER_VERSION,
598
606
  api_version: "v3",
599
607
  transport: "streamable-http",
600
608
  sessions_count: count?.cnt ?? 0,
@@ -913,7 +921,7 @@ Bun.serve({
913
921
  }
914
922
 
915
923
  return withCors(req, new Response(
916
- `CommHub MCP Server v0.5.0-preview.33 (Streamable HTTP + SSE Push)
924
+ `CommHub MCP Server v${SERVER_VERSION} (Streamable HTTP + SSE Push)
917
925
 
918
926
  Endpoints:
919
927
  POST /mcp - MCP Streamable HTTP (for Claude Code / Codex)
@@ -1025,7 +1033,7 @@ process.on("SIGINT", shutdown);
1025
1033
 
1026
1034
  console.log(`
1027
1035
  ╔══════════════════════════════════════════════════╗
1028
- ║ CommHub MCP Server v0.5.0-preview.33
1036
+ ║ CommHub MCP Server v${SERVER_VERSION}
1029
1037
  ║ Transport: Streamable HTTP (Bun native) ║
1030
1038
  ║ Auth: ${AUTH_TOKEN ? "ENABLED (Bearer token)" : "DISABLED (set COMMHUB_AUTH_TOKEN)"}${"".padEnd(AUTH_TOKEN ? 5 : 0)}║
1031
1039
  ║ ║