@andespindola/brainlink 0.1.0-beta.41 → 0.1.0-beta.43
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/AGENTS.md +2 -0
- package/CHANGELOG.md +6 -0
- package/README.md +26 -0
- package/dist/application/frontend/client-js.js +484 -47
- package/dist/application/frontend/client-worker-js.js +66 -0
- package/dist/application/index-vault.js +110 -4
- package/dist/application/server/routes.js +36 -1
- package/dist/application/start-server.js +75 -4
- package/dist/application/watch-vault.js +23 -2
- package/dist/cli/commands/write-commands.js +140 -13
- package/dist/infrastructure/search-packs.js +16 -1
- package/docs/AGENT_USAGE.md +18 -0
- package/package.json +1 -1
|
@@ -221,6 +221,7 @@ const sortedPackFiles = async (vaultPath) => {
|
|
|
221
221
|
}
|
|
222
222
|
};
|
|
223
223
|
const writeRowsAsPrivatePacks = async (vaultPath, rows, clearExisting) => {
|
|
224
|
+
const startedAt = process.hrtime.bigint();
|
|
224
225
|
const directory = toPackDirectory(vaultPath);
|
|
225
226
|
await mkdir(directory, { recursive: true });
|
|
226
227
|
if (clearExisting) {
|
|
@@ -231,6 +232,8 @@ const writeRowsAsPrivatePacks = async (vaultPath, rows, clearExisting) => {
|
|
|
231
232
|
}
|
|
232
233
|
const chunks = chunkRows(rows, rowChunkSize);
|
|
233
234
|
const packIndex = [];
|
|
235
|
+
let inputBytes = 0;
|
|
236
|
+
let outputBytes = 0;
|
|
234
237
|
for (let index = 0; index < chunks.length; index += 1) {
|
|
235
238
|
const chunk = chunks[index];
|
|
236
239
|
const fileName = `pack-${String(index + 1).padStart(4, '0')}.blpk`;
|
|
@@ -238,6 +241,8 @@ const writeRowsAsPrivatePacks = async (vaultPath, rows, clearExisting) => {
|
|
|
238
241
|
const compressed = await encodePrivatePack(vaultPath, Buffer.from(serialized, 'utf8'));
|
|
239
242
|
const tokenBloomB64 = bloomToBase64(bloomFromRows(chunk));
|
|
240
243
|
await writeFile(join(directory, fileName), compressed);
|
|
244
|
+
inputBytes += Buffer.byteLength(serialized, 'utf8');
|
|
245
|
+
outputBytes += compressed.byteLength;
|
|
241
246
|
packIndex.push({
|
|
242
247
|
fileName,
|
|
243
248
|
recordCount: chunk.length,
|
|
@@ -253,9 +258,19 @@ const writeRowsAsPrivatePacks = async (vaultPath, rows, clearExisting) => {
|
|
|
253
258
|
format: 'private-v2',
|
|
254
259
|
packIndex
|
|
255
260
|
});
|
|
261
|
+
const durationMs = Number(process.hrtime.bigint() - startedAt) / 1_000_000;
|
|
262
|
+
const safeInput = Math.max(inputBytes, 1);
|
|
263
|
+
const savedBytes = Math.max(inputBytes - outputBytes, 0);
|
|
256
264
|
return {
|
|
257
265
|
packCount: chunks.length,
|
|
258
|
-
recordCount: rows.length
|
|
266
|
+
recordCount: rows.length,
|
|
267
|
+
compression: {
|
|
268
|
+
inputBytes,
|
|
269
|
+
outputBytes,
|
|
270
|
+
ratio: outputBytes / safeInput,
|
|
271
|
+
savedBytes
|
|
272
|
+
},
|
|
273
|
+
durationMs
|
|
259
274
|
};
|
|
260
275
|
};
|
|
261
276
|
const selectCandidatePackFiles = async (vaultPath, tokens, agentId) => {
|
package/docs/AGENT_USAGE.md
CHANGED
|
@@ -477,6 +477,24 @@ This scans Markdown files and rebuilds:
|
|
|
477
477
|
- links
|
|
478
478
|
- full-text search records
|
|
479
479
|
|
|
480
|
+
### Benchmark Indexing Realtime
|
|
481
|
+
|
|
482
|
+
```bash
|
|
483
|
+
blink bench --vault ./vault
|
|
484
|
+
blink bench --vault ./vault --watch
|
|
485
|
+
blink bench --vault ./vault --watch --debounce 500
|
|
486
|
+
blink bench --vault ./vault --json
|
|
487
|
+
```
|
|
488
|
+
|
|
489
|
+
`bench` runs indexing with realtime phase events and prints a run summary with:
|
|
490
|
+
|
|
491
|
+
- indexed totals (documents, chunks, links)
|
|
492
|
+
- elapsed time and changed document count
|
|
493
|
+
- pack rebuild status and reason
|
|
494
|
+
- pack compression metrics (`inputBytes`, `outputBytes`, ratio/saved percentage)
|
|
495
|
+
|
|
496
|
+
Use `--watch` for continuous benchmark runs while editing notes. Watch mode is supported only for local filesystem vaults.
|
|
497
|
+
|
|
480
498
|
### Search Knowledge
|
|
481
499
|
|
|
482
500
|
```bash
|
package/package.json
CHANGED