lens-engine 0.1.10 → 0.1.12
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/cli.js
CHANGED
|
@@ -4368,7 +4368,7 @@ async function logoutCommand() {
|
|
|
4368
4368
|
}
|
|
4369
4369
|
|
|
4370
4370
|
// packages/cli/src/index.ts
|
|
4371
|
-
var program2 = new Command().name("lens").description("LENS \u2014 Local-first repo context engine").version("0.1.
|
|
4371
|
+
var program2 = new Command().name("lens").description("LENS \u2014 Local-first repo context engine").version("0.1.12");
|
|
4372
4372
|
function trackCommand(name) {
|
|
4373
4373
|
if (!isTelemetryEnabled()) return;
|
|
4374
4374
|
const BASE_URL2 = process.env.LENS_HOST ?? "http://127.0.0.1:4111";
|
package/daemon.js
CHANGED
|
@@ -34497,7 +34497,7 @@ function quotaRemaining(key) {
|
|
|
34497
34497
|
function createApp(db, dashboardDist, initialCaps, initialPlanData) {
|
|
34498
34498
|
let caps = initialCaps;
|
|
34499
34499
|
if (initialPlanData) {
|
|
34500
|
-
quotaCache = { ...initialPlanData, fetchedAt: Date.now() };
|
|
34500
|
+
quotaCache = { ...initialPlanData, subscription: null, fetchedAt: Date.now() };
|
|
34501
34501
|
}
|
|
34502
34502
|
const app = new Hono2();
|
|
34503
34503
|
const telemetryEnabled = isTelemetryEnabled();
|
|
@@ -34959,20 +34959,21 @@ function createApp(db, dashboardDist, initialCaps, initialPlanData) {
|
|
|
34959
34959
|
async () => cloudProxy("GET", "/api/usage/current")
|
|
34960
34960
|
);
|
|
34961
34961
|
trackRoute("GET", "/api/cloud/subscription");
|
|
34962
|
-
app.get(
|
|
34963
|
-
|
|
34964
|
-
|
|
34965
|
-
);
|
|
34962
|
+
app.get("/api/cloud/subscription", (c) => {
|
|
34963
|
+
const sub = quotaCache?.subscription ?? { plan: "free", status: "active" };
|
|
34964
|
+
return c.json({ subscription: sub });
|
|
34965
|
+
});
|
|
34966
34966
|
trackRoute("POST", "/api/cloud/billing/checkout");
|
|
34967
34967
|
app.post("/api/cloud/billing/checkout", async (c) => {
|
|
34968
34968
|
const body = await c.req.json().catch(() => ({}));
|
|
34969
34969
|
return cloudProxy("POST", "/api/billing/checkout", body);
|
|
34970
34970
|
});
|
|
34971
34971
|
trackRoute("GET", "/api/cloud/billing/portal");
|
|
34972
|
-
app.get(
|
|
34973
|
-
"
|
|
34974
|
-
|
|
34975
|
-
|
|
34972
|
+
app.get("/api/cloud/billing/portal", async (c) => {
|
|
34973
|
+
const returnUrl = c.req.query("return_url") || "";
|
|
34974
|
+
const qs = returnUrl ? `?return_url=${encodeURIComponent(returnUrl)}` : "";
|
|
34975
|
+
return cloudProxy("GET", `/api/billing/portal${qs}`);
|
|
34976
|
+
});
|
|
34976
34977
|
trackRoute("GET", "/api/dashboard/stats");
|
|
34977
34978
|
app.get("/api/dashboard/stats", (c) => {
|
|
34978
34979
|
try {
|
|
@@ -35239,13 +35240,18 @@ function createApp(db, dashboardDist, initialCaps, initialPlanData) {
|
|
|
35239
35240
|
}
|
|
35240
35241
|
async function refreshQuotaCache() {
|
|
35241
35242
|
try {
|
|
35242
|
-
const res = await
|
|
35243
|
+
const [res, subRes] = await Promise.all([
|
|
35244
|
+
cloudProxy("GET", "/api/usage/current"),
|
|
35245
|
+
cloudProxy("GET", "/api/subscription")
|
|
35246
|
+
]);
|
|
35243
35247
|
if (res.ok) {
|
|
35244
35248
|
const data = await res.json();
|
|
35249
|
+
const subData = subRes.ok ? (await subRes.json()).subscription ?? null : null;
|
|
35245
35250
|
quotaCache = {
|
|
35246
35251
|
plan: data.plan ?? "free",
|
|
35247
35252
|
usage: data.usage ?? {},
|
|
35248
35253
|
quota: data.quota ?? {},
|
|
35254
|
+
subscription: subData,
|
|
35249
35255
|
fetchedAt: Date.now()
|
|
35250
35256
|
};
|
|
35251
35257
|
if (caps && data.plan !== "pro") {
|
|
@@ -35280,10 +35286,10 @@ function createApp(db, dashboardDist, initialCaps, initialPlanData) {
|
|
|
35280
35286
|
console.error("[LENS] API key re-provisioned after 401");
|
|
35281
35287
|
return refreshQuotaCache();
|
|
35282
35288
|
}
|
|
35283
|
-
quotaCache = { plan: "free", usage: {}, quota: {}, fetchedAt: Date.now() };
|
|
35289
|
+
quotaCache = { plan: "free", usage: {}, quota: {}, subscription: null, fetchedAt: Date.now() };
|
|
35284
35290
|
caps = void 0;
|
|
35285
35291
|
} else {
|
|
35286
|
-
quotaCache = { plan: "free", usage: {}, quota: {}, fetchedAt: Date.now() };
|
|
35292
|
+
quotaCache = { plan: "free", usage: {}, quota: {}, subscription: null, fetchedAt: Date.now() };
|
|
35287
35293
|
caps = void 0;
|
|
35288
35294
|
}
|
|
35289
35295
|
} catch {
|