@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.
- package/package.json +1 -1
- package/src/tools.ts +13 -0
package/package.json
CHANGED
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 双写
|