@ai-matrx/content-ir 0.23.0 → 0.24.1

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,12 +1,27 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.24.1
4
+
5
+ Automatic changed-only republish (docs/metadata drift since the last tag — see
6
+ `git diff npm/content-ir-core/v0.24.0..npm/content-ir-core/v0.24.1 -- apps/shared/content-ir-core`).
7
+ No source changes intended and no consumer action required.
8
+
9
+ ## 0.24.0 — one thinking-strip rule
10
+
11
+ - `stripThinking` / `stripThinkingStreaming` / `hasThinkingTags` are the ONE reasoning-block rule
12
+ (alchemy's and print's copies now call it): `<think>` joins `<thinking>` and `<reasoning>`, and
13
+ paragraph structure around a removed block survives — a block between blank lines leaves two
14
+ paragraphs, one on its own line leaves a line break, one inside a line leaves nothing. Tags in
15
+ code stay text, as before.
16
+
17
+ Consumer action: none. Output differs only in the newlines around a removed block.
3
18
 
4
19
  ## 0.23.0 — the one markdown-source home
5
20
 
6
21
  - `/source` gains the delimiter guard (`guardMarkdownDelimiters`, `guardMathDelimiters`,
7
22
  `guardRunawayLinks`, `reportDelimiterViolations` + types) and the thinking-tag helpers
8
23
  (`stripThinking`, `hasThinkingTags`, `stripThinkingStreaming`), moved from `@ai-matrx/kit`. The
9
- guard's math rules are now THE rules of `source/math-pairs` (kit carried a private copy);
24
+ guard's math rules are now THE rules of `source/math-pairs` (kit carried a private copy);
10
25
  `opensFlowBlock` is exported there.
11
26
  - New subpath `/json-extract` (moved from `@ai-matrx/kit/json-extract`): JSON in model text,
12
27
  fenced or bare, complete or streaming. New dependencies: `json5`, `jsonrepair`.
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) {