@bd7pil/opencode-deep-memory 0.8.4 → 0.8.6

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 CHANGED
@@ -15534,7 +15534,13 @@ function compressFileRead(output) {
15534
15534
  }
15535
15535
  function compressBash(output) {
15536
15536
  const lines = output.split("\n");
15537
- if (lines.length <= 50) return output;
15537
+ if (lines.length <= 50 && output.length <= 5e3) return output;
15538
+ if (lines.length <= 50) {
15539
+ if (detectContentType(output) === "json") {
15540
+ return compressJsonOutput(output);
15541
+ }
15542
+ return lines.map((l) => l.length > MAX_LINE_LENGTH ? l.slice(0, MAX_LINE_LENGTH) + "..." : l).join("\n");
15543
+ }
15538
15544
  const errorLines = lines.filter((l) => /error|fail|exception|fatal|panic/i.test(l)).slice(0, 5);
15539
15545
  const tail = lines.slice(-30);
15540
15546
  return [...errorLines, ...tail].join("\n");
@@ -15813,13 +15819,23 @@ function compressAssistantText(text) {
15813
15819
  const head = 3;
15814
15820
  const tail = 3;
15815
15821
  const kept = [];
15822
+ let inCodeBlock = false;
15816
15823
  for (let i = 0; i < lines.length; i++) {
15817
15824
  const line = lines[i];
15818
15825
  if (i < head || i >= lines.length - tail) {
15819
15826
  kept.push(line);
15820
15827
  continue;
15821
15828
  }
15822
- if (/^#{1,3}\s/.test(line) || /error|fail|warning|critical|important/i.test(line) || /^\s*[-*]\s/.test(line) || /^\s*\d+\.\s/.test(line) || line.trim().startsWith("```") || /^\/[^\s:]+/.test(line)) {
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
+ 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)) {
15823
15839
  kept.push(line);
15824
15840
  }
15825
15841
  }