@ai-matrx/content-ir 0.23.0 → 0.24.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/CHANGELOG.md CHANGED
@@ -1,6 +1,16 @@
1
1
  # Changelog
2
2
 
3
3
 
4
+ ## 0.24.0 — one thinking-strip rule
5
+
6
+ - `stripThinking` / `stripThinkingStreaming` / `hasThinkingTags` are the ONE reasoning-block rule
7
+ (alchemy's and print's copies now call it): `<think>` joins `<thinking>` and `<reasoning>`, and
8
+ paragraph structure around a removed block survives — a block between blank lines leaves two
9
+ paragraphs, one on its own line leaves a line break, one inside a line leaves nothing. Tags in
10
+ code stay text, as before.
11
+
12
+ Consumer action: none. Output differs only in the newlines around a removed block.
13
+
4
14
  ## 0.23.0 — the one markdown-source home
5
15
 
6
16
  - `/source` gains the delimiter guard (`guardMarkdownDelimiters`, `guardMathDelimiters`,
package/dist/index.cjs CHANGED
@@ -7968,7 +7968,7 @@ function collapseGaps(text) {
7968
7968
  }
7969
7969
  return out + text.slice(at).replace(/\n{3,}/g, "\n\n");
7970
7970
  }
7971
- var OPEN_TAG = /<(thinking|reasoning)\b[^>]*>/gi;
7971
+ var OPEN_TAG = /<(thinking|think|reasoning)\b[^>]*>/gi;
7972
7972
  function removeClosedBlocks(input, live) {
7973
7973
  let text = input;
7974
7974
  for (; ; ) {
@@ -7992,7 +7992,20 @@ function removeClosedBlocks(input, live) {
7992
7992
  }
7993
7993
  }
7994
7994
  if (!closer) return { text, openAt: opener.index };
7995
- text = text.slice(0, opener.index) + text.slice(closer.index + closer[0].length);
7995
+ let start = opener.index;
7996
+ let end = closer.index + closer[0].length;
7997
+ let before = 0;
7998
+ let after = 0;
7999
+ while (start > 0 && text[start - 1] === "\n") {
8000
+ start--;
8001
+ before++;
8002
+ }
8003
+ while (end < text.length && text[end] === "\n") {
8004
+ end++;
8005
+ after++;
8006
+ }
8007
+ const gap = before >= 2 || after >= 2 ? "\n\n" : before + after > 0 ? "\n" : "";
8008
+ text = text.slice(0, start) + gap + text.slice(end);
7996
8009
  }
7997
8010
  }
7998
8011
  function stripThinking(input) {