@bd7pil/opencode-deep-memory 0.8.6 → 0.8.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 +1 -10
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -15815,26 +15815,17 @@ function simpleHash(s) {
|
|
|
15815
15815
|
}
|
|
15816
15816
|
function compressAssistantText(text) {
|
|
15817
15817
|
if (text.length < ASSISTANT_COMPRESS_MIN_LENGTH) return text;
|
|
15818
|
+
if (text.includes("```")) return text;
|
|
15818
15819
|
const lines = text.split("\n");
|
|
15819
15820
|
const head = 3;
|
|
15820
15821
|
const tail = 3;
|
|
15821
15822
|
const kept = [];
|
|
15822
|
-
let inCodeBlock = false;
|
|
15823
15823
|
for (let i = 0; i < lines.length; i++) {
|
|
15824
15824
|
const line = lines[i];
|
|
15825
15825
|
if (i < head || i >= lines.length - tail) {
|
|
15826
15826
|
kept.push(line);
|
|
15827
15827
|
continue;
|
|
15828
15828
|
}
|
|
15829
|
-
if (line.trim().startsWith("```")) {
|
|
15830
|
-
inCodeBlock = !inCodeBlock;
|
|
15831
|
-
kept.push(line);
|
|
15832
|
-
continue;
|
|
15833
|
-
}
|
|
15834
|
-
if (inCodeBlock) {
|
|
15835
|
-
kept.push(line);
|
|
15836
|
-
continue;
|
|
15837
|
-
}
|
|
15838
15829
|
if (/^#{1,3}\s/.test(line) || /error|fail|warning|critical|important/i.test(line) || /^\s*[-*]\s/.test(line) || /^\s*\d+\.\s/.test(line) || /^\/[^\s:]+/.test(line)) {
|
|
15839
15830
|
kept.push(line);
|
|
15840
15831
|
}
|