Port bug fixes and stability improvements from PR #15

- Fix Float32Array embedder bug: was creating zero-filled array instead
  of copying data from TypedArray-like objects
- Fix VSS search query: use subquery pattern so LIMIT applies before JOIN
- Pin tree-sitter versions: remove caret ranges for ABI stability, add
  overrides to lock tree-sitter core at 0.22.4
- Lazy grammar loading: load native bindings on first use per language
  instead of all at startup, so one missing grammar doesn't affect others
- Remove stale src/extraction/queries copy from copy-assets script

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Colby McHenry
2026-02-09 23:40:37 -06:00
co-authored by Claude Opus 4.6
parent 082513b566
commit e07250ed60
4 changed files with 159 additions and 99 deletions
+1 -1
View File
@@ -296,7 +296,7 @@ export class TextEmbedder {
if (data && typeof data === 'object' && 'length' in data) {
// Handle TypedArray-like objects
const arr = data as ArrayLike<number>;
return new Float32Array(arr.length);
return Float32Array.from(Array.from(arr));
}
throw new Error('Unsupported data format for embedding');
}
+8 -7
View File
@@ -324,13 +324,14 @@ export class VectorSearchManager {
const rows = this.db
.prepare(
`
SELECT
vss_map.node_id,
vss_vectors.distance
FROM vss_vectors
JOIN vss_map ON vss_map.rowid = vss_vectors.rowid
WHERE vss_search(vss_vectors.embedding, ?)
LIMIT ${safeLimit}
SELECT m.node_id, v.distance
FROM (
SELECT rowid, distance
FROM vss_vectors
WHERE vss_search(embedding, ?)
LIMIT ${safeLimit}
) v
JOIN vss_map m ON m.rowid = v.rowid
`
)
.all(vectorJson) as Array<{ node_id: string; distance: number }>;