@lotargo/memory_plugin 1.2.9 → 1.2.901

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.
@@ -165,20 +165,30 @@ server.registerTool(
165
165
  server.registerTool(
166
166
  "forget",
167
167
  {
168
- description: "Delete a fact by number (from recall) or text search",
168
+ description:
169
+ "Delete a fact by number (from recall), by range (e.g. '3-30', inclusive), or by text search",
169
170
  inputSchema: z.object({
170
- query: z.string().describe("Number or text to search for"),
171
+ query: z.string().describe("Number, range like '3-30', or text to search for"),
171
172
  scope: z.string().default("project").describe("'project' (default) or 'global'"),
172
173
  }),
173
174
  },
174
175
  async ({ query, scope }) => {
175
176
  const key = scopeKey(scope, null, null);
176
177
  const entries = await readMemory(key);
178
+ const rangeMatch = /^\s*(\d+)\s*-\s*(\d+)\s*$/.exec(query);
177
179
  const num = parseInt(query, 10);
178
180
  let removed;
179
- if (!isNaN(num) && num > 0 && num <= entries.length) {
181
+ if (rangeMatch) {
182
+ const from = parseInt(rangeMatch[1], 10);
183
+ const to = parseInt(rangeMatch[2], 10);
184
+ if (from > 0 && to >= from && to <= entries.length) {
185
+ removed = entries.splice(from - 1, to - from + 1);
186
+ }
187
+ }
188
+ if (!removed && !isNaN(num) && num > 0 && num <= entries.length) {
180
189
  removed = entries.splice(num - 1, 1);
181
- } else {
190
+ }
191
+ if (!removed) {
182
192
  const filtered = entries.filter((e) => !e.toLowerCase().includes(query.toLowerCase()));
183
193
  removed = entries.filter((e) => e.toLowerCase().includes(query.toLowerCase()));
184
194
  entries.length = 0;
@@ -415,9 +415,9 @@ export const MemoryPlugin = async ({ directory, worktree, client }) => {
415
415
  },
416
416
  },
417
417
  "forget": {
418
- description: "Удалить факт по номеру (см. recall) или тексту",
418
+ description: "Удалить факт по номеру (см. recall), по диапазону (например '3-30', включительно) или тексту",
419
419
  args: {
420
- query: { type: "string", description: "Номер факта или текст для поиска" },
420
+ query: { type: "string", description: "Номер факта, диапазон вида '3-30' или текст для поиска" },
421
421
  scope: {
422
422
  type: "string",
423
423
  description: "project (по умолчанию) или global",
@@ -427,11 +427,20 @@ export const MemoryPlugin = async ({ directory, worktree, client }) => {
427
427
  async execute({ query, scope }, { worktree, directory }) {
428
428
  const key = scopeKey(scope || "project", worktree, directory);
429
429
  const entries = await readMemory(key);
430
+ const rangeMatch = /^\s*(\d+)\s*-\s*(\d+)\s*$/.exec(query);
430
431
  const num = parseInt(query, 10);
431
432
  let removed;
432
- if (!isNaN(num) && num > 0 && num <= entries.length) {
433
+ if (rangeMatch) {
434
+ const from = parseInt(rangeMatch[1], 10);
435
+ const to = parseInt(rangeMatch[2], 10);
436
+ if (from > 0 && to >= from && to <= entries.length) {
437
+ removed = entries.splice(from - 1, to - from + 1);
438
+ }
439
+ }
440
+ if (!removed && !isNaN(num) && num > 0 && num <= entries.length) {
433
441
  removed = entries.splice(num - 1, 1);
434
- } else {
442
+ }
443
+ if (!removed) {
435
444
  const filtered = entries.filter((e) => !e.toLowerCase().includes(query.toLowerCase()));
436
445
  removed = entries.filter((e) => e.toLowerCase().includes(query.toLowerCase()));
437
446
  entries.length = 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lotargo/memory_plugin",
3
- "version": "1.2.9",
3
+ "version": "1.2.901",
4
4
  "description": "Persistent memory agent for coding AI tools — remembers user preferences and project context across sessions. Works with Antigravity, OpenCode, Claude Code, and Codex.",
5
5
  "type": "module",
6
6
  "main": "opencode-plugin/index.js",