hive-intelligence 1.13.0 → 1.13.1

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/build/cli.js CHANGED
@@ -3453,7 +3453,7 @@ program2.hook("preAction", (thisCommand) => {
3453
3453
  setCliFlags({ apiKey: opts.apiKey, noRetry: opts.retry === false });
3454
3454
  });
3455
3455
  program2.action(async () => {
3456
- const { startStdio } = await import("./serve-47QIM7OD.js");
3456
+ const { startStdio } = await import("./serve-GVD5SX46.js");
3457
3457
  await startStdio(program2.opts().envFile);
3458
3458
  });
3459
3459
  program2.command("serve").description(
@@ -3471,10 +3471,10 @@ program2.command("serve").description(
3471
3471
  );
3472
3472
  process.exit(ExitCode.INVALID_ARGS);
3473
3473
  }
3474
- const { startHttp } = await import("./serve-47QIM7OD.js");
3474
+ const { startHttp } = await import("./serve-GVD5SX46.js");
3475
3475
  await startHttp(port, program2.opts().envFile);
3476
3476
  } else {
3477
- const { startStdio } = await import("./serve-47QIM7OD.js");
3477
+ const { startStdio } = await import("./serve-GVD5SX46.js");
3478
3478
  await startStdio(program2.opts().envFile, { local: opts.local });
3479
3479
  }
3480
3480
  });
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "package": "hive-intelligence",
3
- "version": "1.13.0",
4
- "buildSha": "97bb981841e65ba3c48c31bf14ae02fdecd7b502",
5
- "imageDigest": "sha256:17ebc81537ba98c83bb68acbf974e0a4d2c96990cbf70a7632a4fd9d78f5b657",
3
+ "version": "1.13.1",
4
+ "buildSha": "56d9fb966f40b006065857756fc88e102c957643",
5
+ "imageDigest": "sha256:53f4e1cf4027eac66eb4ed298c19479d6f41a6197668ecccab785a1953fa8074",
6
6
  "deployedUrl": "https://mcp.hiveintelligence.xyz",
7
- "manifest": "https://raw.githubusercontent.com/hive-intel/hive-sdk/v1.13.0/releases/v1.13.0.json"
7
+ "manifest": "https://raw.githubusercontent.com/hive-intel/hive-sdk/v1.13.1/releases/v1.13.1.json"
8
8
  }
package/build/server.js CHANGED
@@ -3903,16 +3903,22 @@ function priceForPlanCycle(planId, cycle) {
3903
3903
  function canUpgradeTo(current, target) {
3904
3904
  const currentIndex = PLAN_TIER_ORDER.indexOf(current ?? "demo");
3905
3905
  const targetIndex = PLAN_TIER_ORDER.indexOf(target);
3906
- if (targetIndex < 0) return false;
3907
- return targetIndex > (currentIndex < 0 ? 0 : currentIndex);
3906
+ if (currentIndex < 0 || targetIndex < 0) return false;
3907
+ return targetIndex > currentIndex;
3908
3908
  }
3909
3909
  var RENEWAL_WINDOW_DAYS = 30;
3910
- function canPurchasePlan(current, target, termEnd, now = /* @__PURE__ */ new Date()) {
3910
+ var MAX_MONTHLY_TERM_DAYS = 32;
3911
+ function canPurchasePlan(current, target, termStart, termEnd, now = /* @__PURE__ */ new Date()) {
3911
3912
  if (canUpgradeTo(current, target)) return true;
3912
3913
  if (current !== target) return false;
3913
- if (!termEnd) return false;
3914
+ if (!termStart || !termEnd) return false;
3915
+ const start = termStart instanceof Date ? termStart : new Date(termStart);
3914
3916
  const end = termEnd instanceof Date ? termEnd : new Date(termEnd);
3915
- if (Number.isNaN(end.getTime())) return false;
3917
+ if (Number.isNaN(start.getTime()) || Number.isNaN(end.getTime())) {
3918
+ return false;
3919
+ }
3920
+ const termMs = end.getTime() - start.getTime();
3921
+ if (termMs <= MAX_MONTHLY_TERM_DAYS * 24 * 60 * 60 * 1e3) return false;
3916
3922
  const windowOpens = new Date(
3917
3923
  end.getTime() - RENEWAL_WINDOW_DAYS * 24 * 60 * 60 * 1e3
3918
3924
  );
@@ -4698,10 +4704,11 @@ billingRouter.post(
4698
4704
  }
4699
4705
  const { data: profile } = await getSupabaseAdmin().from("user_profiles").select("plan_id, billing_subscription_id, billing_status").eq("id", userId).maybeSingle();
4700
4706
  const hasOccupyingSubscription = Boolean(profile?.billing_subscription_id) && typeof profile?.billing_status === "string" && OCCUPYING_BILLING_STATUSES.has(profile.billing_status);
4701
- const { data: liveSubscription } = await getSupabaseAdmin().from("stripe_subscriptions").select("current_period_end").eq("user_id", userId).in("status", [...OCCUPYING_BILLING_STATUSES]).order("current_period_end", { ascending: false }).limit(1).maybeSingle();
4707
+ const { data: liveSubscription } = await getSupabaseAdmin().from("stripe_subscriptions").select("current_period_start, current_period_end").eq("user_id", userId).in("status", [...OCCUPYING_BILLING_STATUSES]).order("current_period_end", { ascending: false }).limit(1).maybeSingle();
4702
4708
  if (!canPurchasePlan(
4703
4709
  profile?.plan_id ?? null,
4704
4710
  planId,
4711
+ liveSubscription?.current_period_start ?? null,
4705
4712
  liveSubscription?.current_period_end ?? null
4706
4713
  )) {
4707
4714
  const sameTier = profile?.plan_id === planId;
@@ -4709,7 +4716,7 @@ billingRouter.post(
4709
4716
  apiError(
4710
4717
  "invalid_request_error",
4711
4718
  hasOccupyingSubscription ? "SUBSCRIPTION_EXISTS" : "PLAN_NOT_AN_UPGRADE",
4712
- sameTier ? `This account is already on ${planId} and the current term still has more than ${RENEWAL_WINDOW_DAYS} days left, so renewing now would replace time you have already paid for. Next action: renew inside the last ${RENEWAL_WINDOW_DAYS} days, pick a higher tier to upgrade immediately, or message us at https://t.me/HiveIntelligence.` : `This account is already on ${profile?.plan_id ?? "a paid plan"}. Next action: pick a higher tier to upgrade now, or message us at https://t.me/HiveIntelligence to change or cancel the current plan.`
4719
+ sameTier ? `This account is already on ${planId}, and buying it again now would charge twice for time already paid for: a monthly plan renews on its own, and an annual plan can be renewed in the last ${RENEWAL_WINDOW_DAYS} days of its term. Next action: pick a higher tier to upgrade immediately, or message us at https://t.me/HiveIntelligence.` : `This account is already on ${profile?.plan_id ?? "a paid plan"}. Next action: pick a higher tier to upgrade now, or message us at https://t.me/HiveIntelligence to change or cancel the current plan.`
4713
4720
  )
4714
4721
  );
4715
4722
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hive-intelligence",
3
- "version": "1.13.0",
3
+ "version": "1.13.1",
4
4
  "description": "Evidence-backed crypto due diligence for AI agents, with sources, freshness, and a runtime receipt on every call.",
5
5
  "mcpName": "xyz.hiveintelligence/mcp",
6
6
  "type": "module",
File without changes