@the-40-thieves/obsidian-tc-native 1.14.3 → 1.16.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/fallback.js CHANGED
@@ -77,7 +77,28 @@ function bm25Score(tf, docLen, avgDocLen, docFreq, docCount) {
77
77
  return (idf * (tf * (k1 + 1))) / denom;
78
78
  }
79
79
 
80
+ /** LCS length of two interned token-id sequences (two-row DP). Mirrors the Rust
81
+ * `rouge_l_lcs_core`. Only `a[i] === b[j]` is ever compared, so a negative sentinel in `a` for a
82
+ * token absent from `b` can never match. */
83
+ function rougeLLcs(a, b) {
84
+ if (a.length === 0 || b.length === 0) {
85
+ return 0;
86
+ }
87
+ const n = b.length;
88
+ let prev = new Uint32Array(n + 1);
89
+ let curr = new Uint32Array(n + 1);
90
+ for (let i = 0; i < a.length; i++) {
91
+ const ai = a[i];
92
+ for (let j = 1; j <= n; j++) {
93
+ curr[j] = ai === b[j - 1] ? prev[j - 1] + 1 : Math.max(prev[j], curr[j - 1]);
94
+ }
95
+ [prev, curr] = [curr, prev];
96
+ }
97
+ return prev[n];
98
+ }
99
+
80
100
  module.exports.cosineSimilarity = cosineSimilarity;
81
101
  module.exports.cosineBatch = cosineBatch;
82
102
  module.exports.tokenize = tokenize;
83
103
  module.exports.bm25Score = bm25Score;
104
+ module.exports.rougeLLcs = rougeLLcs;
package/index.d.ts CHANGED
@@ -25,6 +25,12 @@ export declare function bm25Score(
25
25
  docCount: number,
26
26
  ): number;
27
27
 
28
+ /** LCS length of two INTERNED token-id sequences, in one crossing for the whole pair — the inner
29
+ * loop of ROUGE-L stage-1 citation filtering. Interning stays on the TS side so one transcript is
30
+ * prepared once and reused across chunks; only the length crosses back, with the F1 arithmetic in
31
+ * TypeScript. A negative id in `a` marks a token absent from `b` and never matches. */
32
+ export declare function rougeLLcs(a: Int32Array, b: Int32Array): number;
33
+
28
34
  /** THE-272: symlink-safe, TOCTOU-free note read — opens following no symlink in any path component,
29
35
  * rejects a non-regular or hard-linked file, returns the bytes. Present only on the native module
30
36
  * (undefined on the pure-JS fallback). */
package/index.js CHANGED
@@ -143,6 +143,9 @@ module.exports.cosineSimilarity = impl.cosineSimilarity;
143
143
  module.exports.cosineBatch = impl.cosineBatch;
144
144
  module.exports.tokenize = impl.tokenize;
145
145
  module.exports.bm25Score = impl.bm25Score;
146
+ // rougeLLcs: same feature-detection posture as cosineBatch above — resolves from fallback.js on an
147
+ // older .node that predates it, and is deliberately NOT in isComplete() so such a binary still loads.
148
+ module.exports.rougeLLcs = impl.rougeLLcs;
146
149
  // THE-272: symlink-safe, TOCTOU-free vault I/O. Present only when the compiled native module is
147
150
  // loaded; on the pure-JS fallback these are undefined and the server's vault layer keeps its own
148
151
  // JS read/write path.
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@the-40-thieves/obsidian-tc-native",
3
- "version": "1.14.3",
3
+ "version": "1.16.0",
4
4
  "description": "Native perf module for obsidian-tc — vector ops, BM25, sqlite-vec, V2 clustering hooks",
5
5
  "license": "AGPL-3.0-only",
6
6
  "publishConfig": {
@@ -53,13 +53,13 @@
53
53
  "./package.json": "./package.json"
54
54
  },
55
55
  "optionalDependencies": {
56
- "@the-40-thieves/obsidian-tc-native-linux-x64-gnu": "1.14.3",
57
- "@the-40-thieves/obsidian-tc-native-linux-arm64-gnu": "1.14.3",
58
- "@the-40-thieves/obsidian-tc-native-linux-x64-musl": "1.14.3",
59
- "@the-40-thieves/obsidian-tc-native-linux-arm64-musl": "1.14.3",
60
- "@the-40-thieves/obsidian-tc-native-darwin-x64": "1.14.3",
61
- "@the-40-thieves/obsidian-tc-native-darwin-arm64": "1.14.3",
62
- "@the-40-thieves/obsidian-tc-native-win32-x64-msvc": "1.14.3",
63
- "@the-40-thieves/obsidian-tc-native-win32-arm64-msvc": "1.14.3"
56
+ "@the-40-thieves/obsidian-tc-native-linux-x64-gnu": "1.16.0",
57
+ "@the-40-thieves/obsidian-tc-native-linux-arm64-gnu": "1.16.0",
58
+ "@the-40-thieves/obsidian-tc-native-linux-x64-musl": "1.16.0",
59
+ "@the-40-thieves/obsidian-tc-native-linux-arm64-musl": "1.16.0",
60
+ "@the-40-thieves/obsidian-tc-native-darwin-x64": "1.16.0",
61
+ "@the-40-thieves/obsidian-tc-native-darwin-arm64": "1.16.0",
62
+ "@the-40-thieves/obsidian-tc-native-win32-x64-msvc": "1.16.0",
63
+ "@the-40-thieves/obsidian-tc-native-win32-arm64-msvc": "1.16.0"
64
64
  }
65
65
  }