conare 0.6.6 → 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 +22 -21
- 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";
|
|
@@ -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
|
}
|