• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

popstas / telegram-functions-bot / 16695300720

02 Aug 2025 03:57PM UTC coverage: 78.568% (+0.1%) from 78.428%
16695300720

push

github

web-flow
feat: add memory_delete tool and rename search_memory to memory_search (#139)

* feat: add memory delete tool and rename memory search

* fix: confirm memory deletes and strip punctuation

* fixes

1122 of 1669 branches covered (67.23%)

Branch coverage included in aggregate %.

26 of 34 new or added lines in 4 files covered. (76.47%)

2192 of 2549 relevant lines covered (85.99%)

5.16 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

65.0
/src/tools/memory_delete.ts
1
import { aiFunction, AIFunctionsProvider } from "@agentic/core";
2
import { z } from "zod";
3
import type {
4
  ConfigChatType,
5
  ToolResponse,
6
  ThreadStateType,
7
} from "../types.ts";
8
import { deleteEmbedding } from "../helpers/embeddings.ts";
9
import { sendTelegramMessage } from "../telegram/send.ts";
10

11
export const description = "Delete stored chat memory";
1✔
12
export const details = `- deletes vector memory for similar snippets\n- dbPath: toolParams.vector_memory.dbPath`;
1✔
13

14
export const defaultParams = {
1✔
15
  vector_memory: {
16
    dbPath: "data/memory/default.sqlite",
17
    dimension: 1536,
18
  },
19
};
20

21
export class MemoryDeleteClient extends AIFunctionsProvider {
1✔
22
  protected readonly configChat: ConfigChatType;
23
  protected readonly thread: ThreadStateType;
24

25
  constructor(configChat: ConfigChatType, thread: ThreadStateType) {
26
    super();
1✔
27
    this.configChat = configChat;
1✔
28
    this.thread = thread;
1✔
29
  }
30

31
  @aiFunction({
1✔
32
    name: "memory_delete",
33
    description,
34
    inputSchema: z.object({
35
      query: z.string().describe("Delete query"),
36
      limit: z.number().describe("Limit, set to 1 if not specified").optional().default(1),
37
    }),
38
  })
39
  async memory_delete({
1✔
40
    query,
41
    limit = 1,
×
42
  }: {
43
    query: string;
44
    limit?: number;
45
  }): Promise<ToolResponse> {
46
    const rows = await deleteEmbedding({ query, limit, chat: this.configChat });
1✔
47
    const content = rows.map((r) => `${r.date} ${r.text}`).join("\n");
1✔
48
    await sendTelegramMessage(
1✔
49
      this.thread.id,
50
      `Удалено записей: ${rows.length}`,
51
      undefined,
52
      undefined,
53
      this.configChat,
54
    );
55
    return { content };
1✔
56
  }
57

58
  options_string(str: string) {
NEW
59
    const { query } = JSON.parse(str) as { query: string };
×
NEW
60
    const text = query || "all";
×
NEW
61
    return `**Memory delete:** \`${text}\``;
×
62
  }
63
}
64

65
export function call(configChat: ConfigChatType, thread: ThreadStateType) {
NEW
66
  return new MemoryDeleteClient(configChat, thread);
×
67
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc