conare 0.6.5 → 0.6.7
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 -23
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -85,28 +85,29 @@ function hardCapContent(content) {
|
|
|
85
85
|
return content;
|
|
86
86
|
return content.slice(0, MAX_MEMORY_CONTENT - TRUNCATED_MARKER.length) + TRUNCATED_MARKER;
|
|
87
87
|
}
|
|
88
|
-
function
|
|
89
|
-
const
|
|
90
|
-
const
|
|
91
|
-
|
|
92
|
-
return `## Q: ${user}
|
|
88
|
+
function buildContent(header, rounds, maxUser) {
|
|
89
|
+
const body = rounds.map((r) => {
|
|
90
|
+
const user = maxUser > 0 && r.user.length > maxUser ? r.user.slice(0, maxUser) + "..." : r.user;
|
|
91
|
+
return `## Q: ${user}
|
|
93
92
|
|
|
94
93
|
---
|
|
95
94
|
|
|
96
95
|
${r.assistant}`;
|
|
97
|
-
|
|
96
|
+
}).join(`
|
|
98
97
|
|
|
99
98
|
---
|
|
100
99
|
|
|
101
100
|
`);
|
|
102
|
-
|
|
101
|
+
return `${header}
|
|
103
102
|
|
|
104
103
|
${body}`;
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
104
|
+
}
|
|
105
|
+
function fitContent(header, rounds) {
|
|
106
|
+
const capped = buildContent(header, rounds, userMsgCap);
|
|
107
|
+
if (capped.length <= MAX_MEMORY_CONTENT)
|
|
108
|
+
return capped;
|
|
109
|
+
const forced = userMsgCap > 0 && userMsgCap < TRUNCATED_USER_MSG ? capped : buildContent(header, rounds, TRUNCATED_USER_MSG);
|
|
110
|
+
return hardCapContent(forced);
|
|
110
111
|
}
|
|
111
112
|
function normalizeEpochMs(value) {
|
|
112
113
|
return value < 10000000000 ? value * 1000 : value;
|
|
@@ -128,11 +129,11 @@ function parseTimestampMs(value) {
|
|
|
128
129
|
}
|
|
129
130
|
function setSaveAmount(amount) {
|
|
130
131
|
if (amount)
|
|
131
|
-
|
|
132
|
+
userMsgCap = USER_MSG_CAP[amount];
|
|
132
133
|
}
|
|
133
134
|
function isNarration(text) {
|
|
134
135
|
const stripped = text.trim();
|
|
135
|
-
if (stripped.length <
|
|
136
|
+
if (stripped.length < MIN_SUBSTANTIVE)
|
|
136
137
|
return true;
|
|
137
138
|
if (stripped.length <= 300 && NARRATION_RE.test(stripped))
|
|
138
139
|
return true;
|
|
@@ -246,14 +247,14 @@ function clearIngested(source) {
|
|
|
246
247
|
}
|
|
247
248
|
var activeScope = null, MAX_MEMORY_CONTENT = 200000, TRUNCATED_USER_MSG = 3000, TRUNCATED_MARKER = `
|
|
248
249
|
|
|
249
|
-
...[truncated to fit Conare upload limit]`,
|
|
250
|
+
...[truncated to fit Conare upload limit]`, USER_MSG_CAP, userMsgCap, NARRATION_RE, MIN_SUBSTANTIVE = 200, remoteCache, CASE_INSENSITIVE_FS;
|
|
250
251
|
var init_shared = __esm(() => {
|
|
251
|
-
|
|
252
|
-
essentials:
|
|
253
|
-
balanced:
|
|
252
|
+
USER_MSG_CAP = {
|
|
253
|
+
essentials: 2000,
|
|
254
|
+
balanced: 8000,
|
|
254
255
|
everything: 0
|
|
255
256
|
};
|
|
256
|
-
|
|
257
|
+
userMsgCap = USER_MSG_CAP.balanced;
|
|
257
258
|
NARRATION_RE = /^[\s\n]*(Let me |Now let me |Now I['\u2019]|Now add |Now fix |Now replace |Now integrate |Now update |Now pass |Now clean |Now build|Update the |Builds clean|Deployed\.|Wait, I |Let['\u2019]s test |Good —|Great\.|Perfect\.|Alright|OK,? let me|I[''\u2019]ll |Starting |I need to |Need |I found |I read |I[''\u2019]ve (loaded|confirmed|verified)|Context loaded|Next (I[''\u2019]|step)|Deps confirm|Diff check|Still missing|I[''\u2019]ll (do|check|inspect|trace|run|grab|pull|read|verify))/;
|
|
258
259
|
remoteCache = new Map;
|
|
259
260
|
CASE_INSENSITIVE_FS = process.platform === "darwin" || process.platform === "win32";
|
|
@@ -1738,7 +1739,7 @@ async function selectMcpTargets(targets) {
|
|
|
1738
1739
|
}
|
|
1739
1740
|
async function confirmBackgroundSync() {
|
|
1740
1741
|
const value = ensureValue(await ve({
|
|
1741
|
-
message: "Auto-index new chats
|
|
1742
|
+
message: "Auto-index new chats in the background?",
|
|
1742
1743
|
initialValue: "yes",
|
|
1743
1744
|
options: [
|
|
1744
1745
|
{ value: "yes", label: "Yes" },
|
|
@@ -1752,9 +1753,9 @@ async function selectSaveAmount() {
|
|
|
1752
1753
|
message: "How much should Conare remember from each session?",
|
|
1753
1754
|
initialValue: "balanced",
|
|
1754
1755
|
options: [
|
|
1755
|
-
{ value: "essentials", label: "Essentials", hint: "
|
|
1756
|
+
{ value: "essentials", label: "Essentials", hint: "trim long pastes — leanest, cleanest memory" },
|
|
1756
1757
|
{ value: "balanced", label: "Balanced", hint: "recommended" },
|
|
1757
|
-
{ value: "everything", label: "Everything", hint: "full
|
|
1758
|
+
{ value: "everything", label: "Everything", hint: "keep full pastes & logs" }
|
|
1758
1759
|
]
|
|
1759
1760
|
}));
|
|
1760
1761
|
}
|
|
@@ -5018,7 +5019,6 @@ async function main() {
|
|
|
5018
5019
|
selectedSources = await selectChatSources(ingestibleTargets);
|
|
5019
5020
|
const saveAmount = await selectSaveAmount();
|
|
5020
5021
|
saveSaveAmount(saveAmount);
|
|
5021
|
-
opts.syncInterval = await selectSyncInterval();
|
|
5022
5022
|
}
|
|
5023
5023
|
setSaveAmount(getSaveAmount());
|
|
5024
5024
|
if (opts.uninstallSync) {
|
|
@@ -5415,6 +5415,8 @@ Nothing new to index.`);
|
|
|
5415
5415
|
} catch {}
|
|
5416
5416
|
const shouldSync = interactiveMode ? await confirmBackgroundSync() : true;
|
|
5417
5417
|
if (shouldSync) {
|
|
5418
|
+
if (interactiveMode)
|
|
5419
|
+
opts.syncInterval = await selectSyncInterval();
|
|
5418
5420
|
const syncSpinner = Y2();
|
|
5419
5421
|
syncSpinner.start("Setting up background sync...");
|
|
5420
5422
|
try {
|