lancedb-opencode-pro 0.1.5 → 0.1.6
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/dist/store.d.ts +1 -0
- package/dist/store.js +17 -0
- package/package.json +1 -1
package/dist/store.d.ts
CHANGED
package/dist/store.js
CHANGED
|
@@ -3,6 +3,7 @@ import { dirname } from "node:path";
|
|
|
3
3
|
import { tokenize } from "./utils.js";
|
|
4
4
|
const TABLE_NAME = "memories";
|
|
5
5
|
const EVENTS_TABLE_NAME = "effectiveness_events";
|
|
6
|
+
const EVENTS_SOURCE_COLUMN = "source";
|
|
6
7
|
export class MemoryStore {
|
|
7
8
|
dbPath;
|
|
8
9
|
lancedb = null;
|
|
@@ -69,6 +70,7 @@ export class MemoryStore {
|
|
|
69
70
|
this.eventTable = await this.connection.createTable(EVENTS_TABLE_NAME, [bootstrapEvent]);
|
|
70
71
|
await this.eventTable.delete("id = '__bootstrap__'");
|
|
71
72
|
}
|
|
73
|
+
await this.ensureEventTableCompatibility();
|
|
72
74
|
await this.ensureIndexes();
|
|
73
75
|
}
|
|
74
76
|
async put(record) {
|
|
@@ -445,6 +447,21 @@ export class MemoryStore {
|
|
|
445
447
|
this.indexState.ftsError = error instanceof Error ? error.message : String(error);
|
|
446
448
|
}
|
|
447
449
|
}
|
|
450
|
+
async ensureEventTableCompatibility() {
|
|
451
|
+
const table = this.requireEventTable();
|
|
452
|
+
const schema = await table.schema();
|
|
453
|
+
const hasSourceColumn = schema.fields.some((field) => field.name === EVENTS_SOURCE_COLUMN);
|
|
454
|
+
if (hasSourceColumn) {
|
|
455
|
+
return;
|
|
456
|
+
}
|
|
457
|
+
try {
|
|
458
|
+
await table.addColumns([{ name: EVENTS_SOURCE_COLUMN, valueSql: "CAST(NULL AS STRING)" }]);
|
|
459
|
+
}
|
|
460
|
+
catch (error) {
|
|
461
|
+
const reason = error instanceof Error ? error.message : String(error);
|
|
462
|
+
throw new Error(`Failed to patch ${EVENTS_TABLE_NAME} schema for ${EVENTS_SOURCE_COLUMN}: ${reason}`);
|
|
463
|
+
}
|
|
464
|
+
}
|
|
448
465
|
}
|
|
449
466
|
function normalizeRow(row) {
|
|
450
467
|
const vectorRaw = row.vector;
|