conare 0.4.7 → 0.5.0
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/dist/index.js +25 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -453,6 +453,7 @@ __export(exports_api, {
|
|
|
453
453
|
uploadBulk: () => uploadBulk,
|
|
454
454
|
listRemoteMemories: () => listRemoteMemories,
|
|
455
455
|
getRemoteMemoryCount: () => getRemoteMemoryCount,
|
|
456
|
+
getBillingStatus: () => getBillingStatus,
|
|
456
457
|
deleteMemory: () => deleteMemory,
|
|
457
458
|
deleteMemories: () => deleteMemories,
|
|
458
459
|
createUploadBatches: () => createUploadBatches,
|
|
@@ -548,6 +549,13 @@ async function getRemoteMemoryCount(apiKey) {
|
|
|
548
549
|
return null;
|
|
549
550
|
}
|
|
550
551
|
}
|
|
552
|
+
async function getBillingStatus(apiKey) {
|
|
553
|
+
try {
|
|
554
|
+
return await apiRequest("/api/billing/status", apiKey);
|
|
555
|
+
} catch {
|
|
556
|
+
return null;
|
|
557
|
+
}
|
|
558
|
+
}
|
|
551
559
|
async function uploadItems(apiKey, items) {
|
|
552
560
|
let retries = 4;
|
|
553
561
|
while (retries > 0) {
|
|
@@ -562,6 +570,12 @@ async function uploadItems(apiKey, items) {
|
|
|
562
570
|
return data.results;
|
|
563
571
|
} catch (error) {
|
|
564
572
|
if (error instanceof ApiError && error.statusCode === 429) {
|
|
573
|
+
if (error.message.includes("quota_exceeded")) {
|
|
574
|
+
return items.map(() => ({
|
|
575
|
+
success: false,
|
|
576
|
+
error: "Memory limit reached. Upgrade at https://conare.ai/pricing"
|
|
577
|
+
}));
|
|
578
|
+
}
|
|
565
579
|
retries--;
|
|
566
580
|
await new Promise((r) => setTimeout(r, 5000));
|
|
567
581
|
continue;
|
|
@@ -3987,6 +4001,17 @@ Nothing new to index.`);
|
|
|
3987
4001
|
const db = b3.metadata?.date || "0000";
|
|
3988
4002
|
return db.localeCompare(da);
|
|
3989
4003
|
});
|
|
4004
|
+
const billing = await getBillingStatus(apiKey);
|
|
4005
|
+
if (billing && billing.plan === "free" && billing.limits.uploadedChats > 0) {
|
|
4006
|
+
const chatLimit = billing.limits.uploadedChats;
|
|
4007
|
+
if (allMemories.length > chatLimit) {
|
|
4008
|
+
const skipped = allMemories.length - chatLimit;
|
|
4009
|
+
allMemories.splice(chatLimit);
|
|
4010
|
+
log(`\x1B[33m⚠\x1B[0m Free plan: uploading ${chatLimit} most recent sessions (${skipped} older sessions skipped)`);
|
|
4011
|
+
log(` Upgrade to Pro for unlimited uploads → \x1B[4mhttps://conare.ai/pricing\x1B[0m`);
|
|
4012
|
+
log();
|
|
4013
|
+
}
|
|
4014
|
+
}
|
|
3990
4015
|
log();
|
|
3991
4016
|
if (allMemories.length > 2000 && !opts.dryRun && !opts.quiet) {
|
|
3992
4017
|
if (hasTty) {
|