brainjar 0.3.1230 → 0.3.1234

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/brainjar.js +39 -14
  2. package/package.json +1 -1
package/brainjar.js CHANGED
@@ -107,7 +107,7 @@ var CLI_VERSION, CACHE, DAY;
107
107
  var init_version_check = __esm({
108
108
  "packages/cli/src/version-check.ts"() {
109
109
  "use strict";
110
- CLI_VERSION = "0.3.1230";
110
+ CLI_VERSION = "0.3.1234";
111
111
  CACHE = path.join(os.homedir(), ".brainjar", "version-check.json");
112
112
  DAY = 864e5;
113
113
  }
@@ -6539,6 +6539,18 @@ var init_settings = __esm({
6539
6539
  }
6540
6540
  });
6541
6541
 
6542
+ // packages/db/src/health.ts
6543
+ var NO_WORKER_SECONDS, PROVIDER_FRESH_MS;
6544
+ var init_health = __esm({
6545
+ "packages/db/src/health.ts"() {
6546
+ "use strict";
6547
+ init_pool();
6548
+ init_settings();
6549
+ NO_WORKER_SECONDS = 5 * 60;
6550
+ PROVIDER_FRESH_MS = 10 * 6e4;
6551
+ }
6552
+ });
6553
+
6542
6554
  // packages/db/src/license-key.ts
6543
6555
  var LICENSE_PUBLIC_KEY;
6544
6556
  var init_license_key = __esm({
@@ -6553,19 +6565,38 @@ MCowBQYDK2VwAyEAKOUWx/Qgav+dKg78fIlckGby22CRKeuMWR5tkT1rYuw=
6553
6565
 
6554
6566
  // packages/db/src/plan.ts
6555
6567
  import { createPublicKey, sign, verify } from "node:crypto";
6556
- var trustedKeys, PAID_STATUSES;
6568
+ function planLimits(plan, seats = 0) {
6569
+ if (plan === "pro") return { brains: Infinity, people: 10 };
6570
+ if (plan === "company") return { brains: Infinity, people: seats };
6571
+ return { brains: 1, people: 3 };
6572
+ }
6573
+ var trustedKeys, RENEW_AFTER_MS, PAID_STATUSES;
6557
6574
  var init_plan = __esm({
6558
6575
  "packages/db/src/plan.ts"() {
6559
6576
  "use strict";
6560
6577
  init_src();
6561
6578
  init_pool();
6562
6579
  init_settings();
6580
+ init_health();
6563
6581
  init_license_key();
6564
6582
  trustedKeys = [createPublicKey(LICENSE_PUBLIC_KEY)];
6583
+ RENEW_AFTER_MS = 20 * 36e5;
6565
6584
  PAID_STATUSES = ["active", "trialing", "past_due"];
6566
6585
  }
6567
6586
  });
6568
6587
 
6588
+ // packages/db/src/dormancy.ts
6589
+ var FREE;
6590
+ var init_dormancy = __esm({
6591
+ "packages/db/src/dormancy.ts"() {
6592
+ "use strict";
6593
+ init_src();
6594
+ init_pool();
6595
+ init_plan();
6596
+ FREE = planLimits("free");
6597
+ }
6598
+ });
6599
+
6569
6600
  // packages/db/src/repository.ts
6570
6601
  async function getBrain(id, pool2 = getPool()) {
6571
6602
  return (await pool2.query("SELECT * FROM brain WHERE id = $1", [id])).rows[0] ?? null;
@@ -6582,6 +6613,7 @@ var init_repository = __esm({
6582
6613
  init_audit_origin();
6583
6614
  init_vector();
6584
6615
  init_plan();
6616
+ init_dormancy();
6585
6617
  MO_COLUMNS = "id, brain_id, type, title, body, why, status, confidence, version, created_by, verified_by, created_at, occurred_at, updated_at, last_verified_at";
6586
6618
  MO_COLUMNS_MO = MO_COLUMNS.split(", ").map((c) => `mo.${c}`).join(", ");
6587
6619
  evAgg = (ref) => `(SELECT count(*)::int FROM evidence_link ev WHERE ev.memory_object_id = ${ref}.id) AS evidence_count, (SELECT bool_or(ev.artifact_uri IS NOT NULL AND ev.artifact_uri <> '') FROM evidence_link ev WHERE ev.memory_object_id = ${ref}.id) AS evidence_uri`;
@@ -7975,6 +8007,7 @@ var init_auth = __esm({
7975
8007
  init_src();
7976
8008
  init_pool();
7977
8009
  init_plan();
8010
+ init_dormancy();
7978
8011
  init_ratelimit();
7979
8012
  init_auth_event();
7980
8013
  init_email_token();
@@ -8045,6 +8078,7 @@ var init_team = __esm({
8045
8078
  init_pool();
8046
8079
  init_auth();
8047
8080
  init_plan();
8081
+ init_dormancy();
8048
8082
  }
8049
8083
  });
8050
8084
 
@@ -8055,6 +8089,7 @@ var init_rbac = __esm({
8055
8089
  init_pool();
8056
8090
  init_repository();
8057
8091
  init_team();
8092
+ init_dormancy();
8058
8093
  }
8059
8094
  });
8060
8095
 
@@ -8183,18 +8218,6 @@ var init_tickets = __esm({
8183
8218
  }
8184
8219
  });
8185
8220
 
8186
- // packages/db/src/health.ts
8187
- var NO_WORKER_SECONDS, PROVIDER_FRESH_MS;
8188
- var init_health = __esm({
8189
- "packages/db/src/health.ts"() {
8190
- "use strict";
8191
- init_pool();
8192
- init_settings();
8193
- NO_WORKER_SECONDS = 5 * 60;
8194
- PROVIDER_FRESH_MS = 10 * 6e4;
8195
- }
8196
- });
8197
-
8198
8221
  // packages/db/src/spend.ts
8199
8222
  function dayKey(at = /* @__PURE__ */ new Date()) {
8200
8223
  return `day:${at.toISOString().slice(0, 10)}`;
@@ -8306,6 +8329,7 @@ var init_billing = __esm({
8306
8329
  init_pool();
8307
8330
  init_settings();
8308
8331
  init_plan();
8332
+ init_dormancy();
8309
8333
  isPaid = (status) => PAID_STATUSES.includes(status);
8310
8334
  }
8311
8335
  });
@@ -8435,6 +8459,7 @@ var init_src2 = __esm({
8435
8459
  init_spend();
8436
8460
  init_plan();
8437
8461
  init_billing();
8462
+ init_dormancy();
8438
8463
  init_provider_rate();
8439
8464
  init_ruleset();
8440
8465
  init_usage();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "brainjar",
3
- "version": "0.3.1230",
3
+ "version": "0.3.1234",
4
4
  "description": "BrainJar CLI: turn a repository into a live, self-documenting Brain.",
5
5
  "type": "module",
6
6
  "bin": {