@thesashadev/girl-agent 0.1.5 → 0.1.7

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/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.7 — MarkdownV2 escaping fix
4
+
5
+ Дата: 2026-05-06
6
+
7
+ - Исправлена ошибка `400: Bad Request: can't parse entities` при отправке сообщений с точками, скобками и другими зарезервированными символами MarkdownV2. (#15)
8
+ - Добавлен `escapeMarkdownV2()` хелпер для экранирования всех 18 зарезервированных символов.
9
+ - Fallback на plain text если экранирование не помогает.
10
+
11
+ ## 0.1.6 — --new flag
12
+
13
+ Дата: 2026-05-06
14
+
15
+ - Добавлен флаг `--new` для принудительного открытия визарда при создании нового профиля (даже если уже есть существующие).
16
+
3
17
  ## 0.1.5 — owner TG credentials proxy
4
18
 
5
19
  Дата: 2026-05-06
package/dist/cli.js CHANGED
@@ -18,6 +18,19 @@ var init_esm_shims = __esm({
18
18
  }
19
19
  });
20
20
 
21
+ // src/telegram/markdown.ts
22
+ function escapeMarkdownV2(text) {
23
+ return text.replace(MD2_RESERVED, "\\$1");
24
+ }
25
+ var MD2_RESERVED;
26
+ var init_markdown = __esm({
27
+ "src/telegram/markdown.ts"() {
28
+ "use strict";
29
+ init_esm_shims();
30
+ MD2_RESERVED = /([_*\[\]()~`>#+\-=|{}.!\\])/g;
31
+ }
32
+ });
33
+
21
34
  // src/telegram/userbot.ts
22
35
  var userbot_exports = {};
23
36
  __export(userbot_exports, {
@@ -177,7 +190,11 @@ function makeUserbotAdapter(cfg) {
177
190
  },
178
191
  async editLastMessage(chatId, messageId, text) {
179
192
  const peer = await resolvePeer(chatId);
180
- await client.editMessage(peer, { message: messageId, text, parseMode: "MarkdownV2" });
193
+ try {
194
+ await client.editMessage(peer, { message: messageId, text: escapeMarkdownV2(text), parseMode: "MarkdownV2" });
195
+ } catch {
196
+ await client.editMessage(peer, { message: messageId, text });
197
+ }
181
198
  },
182
199
  async deleteMessages(chatId, messageIds, revoke = false) {
183
200
  const peer = await resolvePeer(chatId);
@@ -241,6 +258,7 @@ var init_userbot = __esm({
241
258
  "src/telegram/userbot.ts"() {
242
259
  "use strict";
243
260
  init_esm_shims();
261
+ init_markdown();
244
262
  }
245
263
  });
246
264
 
@@ -275,8 +293,13 @@ function makeBotAdapter(cfg) {
275
293
  });
276
294
  },
277
295
  async sendText(chatId, text) {
278
- const msg = await bot.api.sendMessage(chatId, text, { parse_mode: "MarkdownV2" });
279
- return msg.message_id;
296
+ try {
297
+ const msg = await bot.api.sendMessage(chatId, escapeMarkdownV2(text), { parse_mode: "MarkdownV2" });
298
+ return msg.message_id;
299
+ } catch {
300
+ const msg = await bot.api.sendMessage(chatId, text);
301
+ return msg.message_id;
302
+ }
280
303
  },
281
304
  async setTyping(chatId, on) {
282
305
  if (on) {
@@ -318,6 +341,7 @@ var init_bot = __esm({
318
341
  "src/telegram/bot.ts"() {
319
342
  "use strict";
320
343
  init_esm_shims();
344
+ init_markdown();
321
345
  }
322
346
  });
323
347
 
@@ -5557,7 +5581,8 @@ var HELP = `
5557
5581
  girl-agent \u2014 AI girl for Telegram
5558
5582
 
5559
5583
  usage:
5560
- npx girl-agent # \u0437\u0430\u043F\u0443\u0441\u0442\u0438\u0442\u044C TUI \u0432\u0438\u0437\u0430\u0440\u0434
5584
+ npx girl-agent # \u0437\u0430\u043F\u0443\u0441\u0442\u0438\u0442\u044C TUI \u0432\u0438\u0437\u0430\u0440\u0434 (\u0438\u043B\u0438 \u0430\u0432\u0442\u043E\u0437\u0430\u0433\u0440\u0443\u0437\u043A\u0430 \u0435\u0441\u043B\u0438 1 \u043F\u0440\u043E\u0444\u0438\u043B\u044C)
5585
+ npx girl-agent --new # \u043F\u0440\u0438\u043D\u0443\u0434\u0438\u0442\u0435\u043B\u044C\u043D\u043E \u043E\u0442\u043A\u0440\u044B\u0442\u044C \u0432\u0438\u0437\u0430\u0440\u0434 \u0434\u043B\u044F \u043D\u043E\u0432\u043E\u0433\u043E \u043F\u0440\u043E\u0444\u0438\u043B\u044F
5561
5586
  npx girl-agent --profile=<slug> # \u0437\u0430\u043F\u0443\u0441\u0442\u0438\u0442\u044C \u0433\u043E\u0442\u043E\u0432\u044B\u0439 \u043F\u0440\u043E\u0444\u0438\u043B\u044C
5562
5587
  npx girl-agent --reset --profile=<slug>
5563
5588
  npx girl-agent <flags> # \u043F\u0440\u043E\u043F\u0443\u0441\u0442\u0438\u0442\u044C \u0432\u0438\u0437\u0430\u0440\u0434 \u0441 \u0430\u0440\u0433\u0443\u043C\u0435\u043D\u0442\u0430\u043C\u0438
@@ -5585,6 +5610,7 @@ required flags \u0434\u043B\u044F headless setup (--name --age --stage --api-pre
5585
5610
  --tz=<value> IANA "Europe/Moscow" / "GMT+3" / "+3" / "\u041A\u0438\u0435\u0432" \u2014 \u043F\u043E\u0438\u0441\u043A
5586
5611
  --stage=<id> met-irl-got-tg|tg-given-cold|tg-given-warming|convinced|first-date-done|dating-early|dating-stable|long-term
5587
5612
  --mcp=exa:KEY \u043C\u043E\u0436\u043D\u043E \u043D\u0435\u0441\u043A\u043E\u043B\u044C\u043A\u043E \u0440\u0430\u0437
5613
+ --new \u043F\u0440\u0438\u043D\u0443\u0434\u0438\u0442\u0435\u043B\u044C\u043D\u043E \u043E\u0442\u043A\u0440\u044B\u0442\u044C \u0432\u0438\u0437\u0430\u0440\u0434 \u0434\u043B\u044F \u043D\u043E\u0432\u043E\u0433\u043E \u043F\u0440\u043E\u0444\u0438\u043B\u044F
5588
5614
  --list \u043F\u043E\u043A\u0430\u0437\u0430\u0442\u044C \u043F\u0440\u043E\u0444\u0438\u043B\u0438
5589
5615
  --help
5590
5616
 
@@ -5618,7 +5644,7 @@ async function main() {
5618
5644
  "life-sharing",
5619
5645
  "privacy"
5620
5646
  ],
5621
- boolean: ["help", "list", "reset"],
5647
+ boolean: ["help", "list", "reset", "new"],
5622
5648
  alias: { h: "help" }
5623
5649
  });
5624
5650
  if (argv.help) {
@@ -5671,7 +5697,7 @@ ${profiles.join("\n")}
5671
5697
  await runRuntime(cfg);
5672
5698
  return;
5673
5699
  }
5674
- if (!argv.profile && !haveEnoughForFlags) {
5700
+ if (!argv.new && !argv.profile && !haveEnoughForFlags) {
5675
5701
  const profiles = await listProfiles();
5676
5702
  if (profiles.length === 1) {
5677
5703
  const cfg = await readConfig(profiles[0]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thesashadev/girl-agent",
3
- "version": "0.1.5",
3
+ "version": "0.1.7",
4
4
  "description": "Telegram AI persona engine with memory, schedule, relationship state and MTProto userbot mode.",
5
5
  "type": "module",
6
6
  "bin": {