@agent-finops/core 0.1.4 → 0.1.5

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.
@@ -30,6 +30,12 @@ export type PlanCheck = {
30
30
  suggestedPlan?: SubscriptionPlan;
31
31
  /** apiEquivalentMonthlyUsd - plan price, when positive. */
32
32
  monthlySavingsVsApiUsd?: number;
33
+ /**
34
+ * API-equivalent usage ÷ plan price — "you're getting N× the plan price in
35
+ * usage". The number a subscription user actually wants: am I getting my
36
+ * money's worth? Present only when a plan covers the usage.
37
+ */
38
+ valueMultiple?: number;
33
39
  /** One-line, render-ready verdict. */
34
40
  headline: string;
35
41
  };
package/dist/planMath.js CHANGED
@@ -35,12 +35,14 @@ export function computePlanChecks(records) {
35
35
  // (days with usage), which can differ from the calendar window shown
36
36
  // elsewhere on the readout — a technical reader will divide and check.
37
37
  const basis = `projected from ${windowDays} active day${windowDays === 1 ? "" : "s"}`;
38
+ const covered = suggested && typeof savings === "number" && savings > 0;
39
+ const valueMultiple = covered ? Math.round((monthly / suggested.monthlyUsd) * 10) / 10 : undefined;
38
40
  let headline;
39
41
  if (!suggested) {
40
42
  headline = `${agent}: ~$${monthly.toFixed(2)}/mo at API rates (${basis}).`;
41
43
  }
42
- else if (typeof savings === "number" && savings > 0) {
43
- headline = `${agent}: ~$${monthly.toFixed(2)}/mo at API rates (${basis}) — ${suggested.name} ($${suggested.monthlyUsd}/mo) likely covers this, ~$${savings.toFixed(2)}/mo cheaper than paying per token.`;
44
+ else if (covered) {
45
+ headline = `${agent}: ~$${monthly.toFixed(2)}/mo at API rates (${basis}) — ${suggested.name} ($${suggested.monthlyUsd}/mo) likely covers this. You're getting ~${valueMultiple}× the plan price in usage, ~$${savings.toFixed(2)}/mo cheaper than paying per token.`;
44
46
  }
45
47
  else {
46
48
  headline = `${agent}: ~$${monthly.toFixed(2)}/mo at API rates (${basis}) — within ${suggested.name} ($${suggested.monthlyUsd}/mo); pay-as-you-go API could be cheaper if you drop the subscription.`;
@@ -50,7 +52,8 @@ export function computePlanChecks(records) {
50
52
  apiEquivalentMonthlyUsd: monthly,
51
53
  windowDays,
52
54
  suggestedPlan: suggested,
53
- monthlySavingsVsApiUsd: typeof savings === "number" && savings > 0 ? savings : undefined,
55
+ monthlySavingsVsApiUsd: covered ? savings : undefined,
56
+ valueMultiple,
54
57
  headline
55
58
  });
56
59
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-finops/core",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",