@aryasaatvik/scratchpad 0.6.0 → 0.6.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,3 +1,11 @@
1
+ ## @aryasaatvik/scratchpad@0.6.1
2
+
3
+ ### Index notes with more than 1024 chunks
4
+
5
+ `scratchpad search` and `scratchpad index` failed with "Too many docs: N exceeds max write batch
6
+ size of 1024" when one note, or one cleanup pass, touched more than 1024 vector chunks. Vector
7
+ writes and deletes now go to zvec in batches of at most 1024.
8
+
1
9
  ## @aryasaatvik/scratchpad@0.6.0
2
10
 
3
11
  ### Note lifecycle: sweep, review, and hybrid search
@@ -51973,7 +51973,7 @@ var bundleHtml = async (options) => {
51973
51973
  // package.json
51974
51974
  var package_default = {
51975
51975
  name: "@aryasaatvik/scratchpad",
51976
- version: "0.6.0",
51976
+ version: "0.6.1",
51977
51977
  description: "Local-first GitHub issue and milestone tracking, hosted artifacts and uploads, and local architecture codemaps.",
51978
51978
  keywords: [
51979
51979
  "bun",
@@ -55722,6 +55722,13 @@ var assertRebuildAvailable = async (path) => {
55722
55722
 
55723
55723
  // packages/cli/src/search/index.ts
55724
55724
  var hash3 = (value) => createHash12("sha256").update(value).digest("hex");
55725
+ var VECTOR_WRITE_BATCH = 1024;
55726
+ var inBatches = (items, write) => {
55727
+ const results = [];
55728
+ for (let i = 0;i < items.length; i += VECTOR_WRITE_BATCH)
55729
+ results.push(...write(items.slice(i, i + VECTOR_WRITE_BATCH)));
55730
+ return results;
55731
+ };
55725
55732
  var Metadata = Struct({
55726
55733
  title: optional2(String5),
55727
55734
  kind: optional2(String5)
@@ -55842,7 +55849,7 @@ var run6 = fn2("Search.run")(function* (options, query) {
55842
55849
  if (docs.length) {
55843
55850
  store.invalidateVectors(docs.map((doc) => doc.id));
55844
55851
  store.trackVectors(docs.map((doc) => doc.id));
55845
- const failed = vectorWriter.upsertSync(docs).find((s) => !s.ok);
55852
+ const failed = inBatches(docs, (batch) => vectorWriter.upsertSync(batch)).find((s) => !s.ok);
55846
55853
  if (failed)
55847
55854
  throw new SearchError({ message: `Vector upsert failed: ${failed.message}` });
55848
55855
  }
@@ -55867,7 +55874,7 @@ var run6 = fn2("Search.run")(function* (options, query) {
55867
55874
  const live = new Set(store.chunks().map((c) => c.id));
55868
55875
  const removed = store.vectorIds().filter((id) => !live.has(id));
55869
55876
  if (removed.length) {
55870
- const failed = vectorWriter.deleteSync(removed).find((s) => !s.ok && s.code !== "ZVEC_NOT_FOUND");
55877
+ const failed = inBatches(removed, (batch) => vectorWriter.deleteSync(batch)).find((s) => !s.ok && s.code !== "ZVEC_NOT_FOUND");
55871
55878
  if (failed)
55872
55879
  throw new SearchError({ message: `Vector delete failed: ${failed.message}` });
55873
55880
  store.forgetVectors(removed);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aryasaatvik/scratchpad",
3
- "version": "0.6.0",
3
+ "version": "0.6.1",
4
4
  "description": "Local-first GitHub issue and milestone tracking, hosted artifacts and uploads, and local architecture codemaps.",
5
5
  "keywords": [
6
6
  "bun",