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

popstas / telegram-functions-bot / 19547104604

16 Nov 2025 02:44PM UTC coverage: 77.537% (-0.03%) from 77.562%
19547104604

push

github

popstas
feat(memory): add memory_add tool and share logic with Запомни; hide memory tools and auto-include when vector_memory is enabled; docs and tests

1361 of 2050 branches covered (66.39%)

Branch coverage included in aggregate %.

30 of 37 new or added lines in 5 files covered. (81.08%)

2543 of 2985 relevant lines covered (85.19%)

5.84 hits per line

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

66.67
/src/tools/memory_add.ts
1
import { aiFunction, AIFunctionsProvider } from "@agentic/core";
2
import { z } from "zod";
3
import type { ConfigChatType, ToolResponse, ThreadStateType } from "../types.ts";
4
import { rememberSave } from "../helpers/memory.ts";
5
import type { Message } from "telegraf/types";
6

7
export const description = "Add/store text into vector memory";
1✔
8
export const details = `- stores text to vector memory\n- dbPath: toolParams.vector_memory.dbPath`;
1✔
9

10
export const defaultParams = {
1✔
11
  vector_memory: {
12
    dbPath: "data/memory/default.sqlite",
13
    dimension: 1536,
14
  },
15
};
16

17
export class MemoryAddClient extends AIFunctionsProvider {
1✔
18
  protected readonly configChat: ConfigChatType;
19
  protected readonly thread: ThreadStateType;
20

21
  constructor(configChat: ConfigChatType, thread: ThreadStateType) {
22
    super();
1✔
23
    this.configChat = configChat;
1✔
24
    this.thread = thread;
1✔
25
  }
26

27
  @aiFunction({
1✔
28
    name: "memory_add",
29
    description,
30
    inputSchema: z.object({
31
      text: z.string().min(1).describe("Text to store in memory"),
32
    }),
33
  })
34
  async memory_add({ text }: { text: string }): Promise<ToolResponse> {
1✔
35
    const lastMsg = this.thread.msgs.at(-1) as Message.TextMessage | undefined;
1✔
36
    const content = await rememberSave({ text, msg: lastMsg, chat: this.configChat });
1✔
37
    return { content };
1✔
38
  }
39

40
  options_string(str: string) {
NEW
41
    const { text } = JSON.parse(str) as { text: string };
×
NEW
42
    const preview = text?.slice(0, 48) || "";
×
NEW
43
    return `**Memory add:** \`${preview}\``;
×
44
  }
45
}
46

47
export function call(configChat: ConfigChatType, thread: ThreadStateType) {
NEW
48
  return new MemoryAddClient(configChat, thread);
×
49
}
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

© 2025 Coveralls, Inc