lancedb-opencode-pro 0.2.1 → 0.2.2

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/index.js CHANGED
@@ -150,7 +150,7 @@ const plugin = async (input) => {
150
150
  memory_delete: tool({
151
151
  description: "Delete one memory entry by id",
152
152
  args: {
153
- id: tool.schema.string().min(6),
153
+ id: tool.schema.string().min(8),
154
154
  scope: tool.schema.string().optional(),
155
155
  confirm: tool.schema.boolean().default(false),
156
156
  },
@@ -237,7 +237,7 @@ const plugin = async (input) => {
237
237
  memory_feedback_wrong: tool({
238
238
  description: "Record feedback for memory that should not be stored",
239
239
  args: {
240
- id: tool.schema.string().min(6),
240
+ id: tool.schema.string().min(8),
241
241
  reason: tool.schema.string().optional(),
242
242
  scope: tool.schema.string().optional(),
243
243
  },
@@ -268,7 +268,7 @@ const plugin = async (input) => {
268
268
  memory_feedback_useful: tool({
269
269
  description: "Record whether a recalled memory was helpful",
270
270
  args: {
271
- id: tool.schema.string().min(6),
271
+ id: tool.schema.string().min(8),
272
272
  helpful: tool.schema.boolean(),
273
273
  scope: tool.schema.string().optional(),
274
274
  },
@@ -313,7 +313,7 @@ const plugin = async (input) => {
313
313
  memory_scope_promote: tool({
314
314
  description: "Promote a memory from project scope to global scope for cross-project sharing",
315
315
  args: {
316
- id: tool.schema.string().min(6),
316
+ id: tool.schema.string().min(8),
317
317
  confirm: tool.schema.boolean().default(false),
318
318
  },
319
319
  execute: async (args, context) => {
@@ -339,7 +339,7 @@ const plugin = async (input) => {
339
339
  memory_scope_demote: tool({
340
340
  description: "Demote a memory from global scope to project scope",
341
341
  args: {
342
- id: tool.schema.string().min(6),
342
+ id: tool.schema.string().min(8),
343
343
  confirm: tool.schema.boolean().default(false),
344
344
  scope: tool.schema.string().optional(),
345
345
  },
package/dist/store.d.ts CHANGED
@@ -33,6 +33,7 @@ export declare class MemoryStore {
33
33
  list(scope: string, limit: number): Promise<MemoryRecord[]>;
34
34
  pruneScope(scope: string, maxEntries: number): Promise<number>;
35
35
  countIncompatibleVectors(scopes: string[], expectedDim: number): Promise<number>;
36
+ private matchesId;
36
37
  hasMemory(id: string, scopes: string[]): Promise<boolean>;
37
38
  updateMemoryUsage(id: string, projectScope: string, scopes: string[]): Promise<void>;
38
39
  listEvents(scopes: string[], limit: number): Promise<MemoryEffectivenessEvent[]>;
package/dist/store.js CHANGED
@@ -166,7 +166,7 @@ export class MemoryStore {
166
166
  }
167
167
  async deleteById(id, scopes) {
168
168
  const rows = await this.readByScopes(scopes);
169
- const match = rows.find((row) => row.id === id);
169
+ const match = rows.find((row) => this.matchesId(row.id, id));
170
170
  if (!match)
171
171
  return false;
172
172
  await this.requireTable().delete(`id = '${escapeSql(match.id)}'`);
@@ -175,10 +175,10 @@ export class MemoryStore {
175
175
  }
176
176
  async updateMemoryScope(id, newScope, scopes) {
177
177
  const rows = await this.readByScopes(scopes);
178
- const match = rows.find((row) => row.id === id);
178
+ const match = rows.find((row) => this.matchesId(row.id, id));
179
179
  if (!match)
180
180
  return false;
181
- await this.requireTable().delete(`id = '${escapeSql(id)}'`);
181
+ await this.requireTable().delete(`id = '${escapeSql(match.id)}'`);
182
182
  this.invalidateScope(match.scope);
183
183
  await this.requireTable().add([{ ...match, scope: newScope }]);
184
184
  this.invalidateScope(newScope);
@@ -220,10 +220,15 @@ export class MemoryStore {
220
220
  const rows = await this.readByScopes(scopes);
221
221
  return rows.filter((row) => row.vectorDim !== expectedDim).length;
222
222
  }
223
+ matchesId(candidateId, query) {
224
+ if (query.length >= 36)
225
+ return candidateId === query;
226
+ return candidateId.startsWith(query);
227
+ }
223
228
  async hasMemory(id, scopes) {
224
229
  for (let attempt = 0; attempt < 3; attempt++) {
225
230
  const rows = await this.readByScopes(scopes);
226
- if (rows.some((row) => row.id === id)) {
231
+ if (rows.some((row) => this.matchesId(row.id, id))) {
227
232
  return true;
228
233
  }
229
234
  if (attempt < 2) {
@@ -234,7 +239,7 @@ export class MemoryStore {
234
239
  }
235
240
  async updateMemoryUsage(id, projectScope, scopes) {
236
241
  const rows = await this.readByScopes(scopes);
237
- const match = rows.find((row) => row.id === id);
242
+ const match = rows.find((row) => this.matchesId(row.id, id));
238
243
  if (!match)
239
244
  return;
240
245
  const now = Date.now();
@@ -256,7 +261,7 @@ export class MemoryStore {
256
261
  newProjectCount = projects.size;
257
262
  }
258
263
  }
259
- await this.requireTable().delete(`id = '${escapeSql(id)}'`);
264
+ await this.requireTable().delete(`id = '${escapeSql(match.id)}'`);
260
265
  this.invalidateScope(match.scope);
261
266
  await this.requireTable().add([{
262
267
  ...match,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lancedb-opencode-pro",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "description": "LanceDB-backed long-term memory provider for OpenCode",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",