leedab 0.1.4 → 0.1.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.
package/bin/leedab.js CHANGED
@@ -114,7 +114,19 @@ program
114
114
  console.log(` Key: ${license.key.slice(0, 16)}...`);
115
115
  console.log(` Tier: ${license.tier}`);
116
116
  console.log(` Status: ${license.valid ? chalk.green(license.status) : chalk.red(license.status)}`);
117
- console.log(` Seats: ${license.seatsUsed} / ${license.maxSeats}`);
117
+ // Count local allowlist users as seats
118
+ let localSeats = 0;
119
+ try {
120
+ const { readFile } = await import("node:fs/promises");
121
+ const { resolve } = await import("node:path");
122
+ const ocConfig = JSON.parse(await readFile(resolve(STATE_DIR, "openclaw.json"), "utf-8"));
123
+ const allUsers = new Set();
124
+ for (const ch of Object.values(ocConfig.channels || {})) {
125
+ for (const u of ch.allowFrom || []) allUsers.add(u);
126
+ }
127
+ localSeats = allUsers.size;
128
+ } catch {}
129
+ console.log(` Seats: ${localSeats} / ${license.maxSeats}`);
118
130
  console.log(` Checked: ${new Date(license.validatedAt).toLocaleDateString()}`);
119
131
  console.log("");
120
132
  });
@@ -296,6 +308,21 @@ pairing
296
308
  return;
297
309
  }
298
310
 
311
+ // Check seat limit
312
+ const { ensureLicense } = await import("../dist/license.js");
313
+ const license = await ensureLicense();
314
+ if (license && license.maxSeats > 0) {
315
+ // Count total unique users across all channel allowlists
316
+ const allUsers = new Set();
317
+ for (const ch of Object.values(config.channels || {})) {
318
+ for (const u of ch.allowFrom || []) allUsers.add(u);
319
+ }
320
+ if (allUsers.size >= license.maxSeats) {
321
+ console.error(chalk.red(`Seat limit reached (${allUsers.size}/${license.maxSeats}). Upgrade your plan to add more users.`));
322
+ process.exit(1);
323
+ }
324
+ }
325
+
299
326
  config.channels[channel].allowFrom.push(userId);
300
327
  config.channels[channel].dmPolicy = "allowlist";
301
328
  await writeFile(configPath, JSON.stringify(config, null, 2) + "\n");
@@ -0,0 +1,2 @@
1
+ /** Global LeedAB state directory - always ~/. leedab */
2
+ export declare const STATE_DIR: string;
package/dist/paths.js ADDED
@@ -0,0 +1,4 @@
1
+ import { resolve } from "node:path";
2
+ import { homedir } from "node:os";
3
+ /** Global LeedAB state directory - always ~/. leedab */
4
+ export const STATE_DIR = resolve(homedir(), ".leedab");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "leedab",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "description": "LeedAB — Your enterprise AI agent. Local-first, private by default.",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "author": "LeedAB <hello@leedab.com>",