@sleep2agi/commhub-server 0.5.0-preview.17 → 0.5.0-preview.18

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/tools.ts +13 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sleep2agi/commhub-server",
3
- "version": "0.5.0-preview.17",
3
+ "version": "0.5.0-preview.18",
4
4
  "description": "CommHub MCP Server — AI Agent communication hub with SSE push, MCP protocol, and REST API",
5
5
  "type": "module",
6
6
  "main": "src/index.ts",
package/src/tools.ts CHANGED
@@ -351,6 +351,19 @@ export function registerTools(server: McpServer, clientIP?: string, enforceNetwo
351
351
  },
352
352
  async ({ alias, task, priority, context, from_session, ttl_seconds, network_id: netId }) => {
353
353
  const effectiveNetId = getNetworkId(netId);
354
+
355
+ // License check
356
+ const license = db.query<any, []>("SELECT type, expires_at FROM licenses ORDER BY created_at LIMIT 1").get();
357
+ if (license?.expires_at) {
358
+ const now = new Date().toISOString().replace("T", " ").slice(0, 19);
359
+ if (license.expires_at < now) {
360
+ return { content: [{ type: "text" as const, text: JSON.stringify({
361
+ ok: false, error: "license_expired",
362
+ message: "Trial expired. Activate a license: anet activate <key>",
363
+ }) }] };
364
+ }
365
+ }
366
+
354
367
  console.log(`[${ts()}] ${from_session} → send_task → ${alias}: ${task.slice(0, 60)}${priority === "high" ? " [HIGH]" : ""}`);
355
368
  const id = uuidv4();
356
369
  // 事务:inbox + tasks 双写