Skip to content

feat(telegram): attach_telegram tool, project picker, /new + /log fixes, remove forced DeepSeek language - #22

Merged
merfiDEV merged 9 commits into
masterfrom
update
Sep 26, 2026
Merged

merfiDEV merged 9 commits into
masterfrom
update

Conversation

@merfiDEV

Copy link
Copy Markdown
Owner

Что в этом PR

Ветка update → master. 9 коммитов, 20 файлов (+1252 / −368).

Added

  • Инструмент attach_telegram — AI может отправить любой локальный файл пользователю в Telegram:
    • JS-API attachTelegram(filePath, caption?, comment?); comment — необязательная заметка от AI, дописывается к caption или уходит подписью сама;
    • лимит 45 МБ (запас под лимит Telegram 50 МБ), подпись/комментарий обрезаются до 1024 символов;
    • отправка через уже настроенного бота (telegramBot.sendDocument), новых зависимостей нет;
    • регистрация в tools/index.js, обёртка в песочнице JsRunner, объявление в cuckoo-tools.d.ts.
  • Telegram-бот: выбор проекта кнопками — команда /projects (алиасы /project, /proj):
    • постраничный inline-список (8 на страницу) с навигацией и счётчиком;
    • выбор проекта переключает окно на существующую сессию проекта (как /switch), новый чат не создаётся;
    • кнопка ручного ввода абсолютного пути;
    • если проект не выбран, /diff, /log, /sessions показывают клавиатуру выбора.

Changed

  • /log и /sessions редактируют существующее сообщение (editMessageText) вместо отправки нового при повторном вызове и пагинации.
  • /new явно сообщает результат: успех / нет активного окна / ошибка.
  • Язык бота берётся ровно из настроек, без принудительной подстановки системного языка; /start больше не требует выбора языка.

Fixed

  • /new не отвечал — newChat() делает loadURL и выгружает JS-контекст, поэтому executeJavaScript с ожиданием результата зависал. Теперь fire-and-forget.
  • Пагинация выбора проекта падала — ReferenceError: msgId is not defined в _handleCallback; id берётся из cbq.message, есть фолбэк на sendMessage.
  • Выбор проекта не применялся в приложении — добавлен IPC set-project-dir (+ setProjectDir в preload, setProjectByDir в main): поиск сессии по папке проекта и навигация на неё.
  • Ошибка setProjectDir недоступен в окне — метода не существовало, добавлен полный путь IPC → preload → main.

Removed

  • Принудительная фиксация языка DeepSeek — удалён src/preload/dom/deepseek-language.js (переключал Language на «Система» и блокировал селект). Язык UI DeepSeek снова выбирается пользователем свободно.

Docs

  • CHANGELOG.md: запись 4.0.34 (ru + en).

Проверки

  • node --check по всем изменённым JS-файлам — OK.
  • attach_telegram прогнан через реальный JsRunner с моком Telegram API: успешная отправка (multipart POST .../sendDocument), отказ для файла >45 МБ, ошибка для отсутствующего файла.
  • CHANGELOG прогнан через src/main/changelog-parser.js: версия 4.0.34 распознана, попадает в диапазон whats-new.

Замечания для ревью

  • setProjectByDir переключает окно на первую найденную сессию проекта (если у проекта их несколько — на произвольную). При необходимости можно выбирать самую свежую или давать список.
  • EN-секции в CHANGELOG идут отдельными ### ... (EN) блоками внутри той же версии — whats-new покажет ru и en подряд.

… hearts, read name normalization

- tg: compact Tech-style notifications (emoji + action + path/command), batching of
  identical consecutive calls into (xN), command/result wrapped in blockquote,
  result (preview) shown as second blockquote, skip service tools (ask_user_question,
  exit_plan_mode), normalize read/readLines/read_lines/read_file icons
- settings: drop read/readLines from default telegramToolNotifyIgnore so reads show up
- pet: hold-drag petting emits hearts, pet returns home after stroke (both center and
  docked modes)
- new tools/AttachTelegramTool.js: attach_telegram / attachTelegram(filePath, caption?, comment?)
- sends any local file as a Telegram document via configured bot (telegramBot.sendDocument)
- optional comment: extra note the AI adds; appended to caption (blank line) or used as caption
- 45MB size cap (Telegram doc limit 50MB), caption/comment capped at 1024 chars
- register tool in tools/index.js; expose attachTelegram wrapper in JsRunner sandbox BOOTSTRAP
- add attachTelegram declaration to cuckoo-tools.d.ts
…ts in place

- add /projects (aliases /project, /proj): inline picker with paged list (8/page),
  nav buttons and manual path entry
- new IPC set-project-dir + preload setProjectDir + setProjectByDir() in
  project-context.js: set project by known path without opening the folder dialog
- /sessions and /log now edit the existing message instead of sending new ones
  (_lastListMsg map + editMessageId in _pagers), paginated callbacks pass msgId
- /new reports result explicitly: no window / failure / success (new.noWindow,
  new.failed, new.done)
- project.* i18n keys (ru/en)
…), fix msgId crash

- setProjectByDir(): after setting the dir, build and send initial-prompt to the
  window (same as initProject) so the AI actually switches to the new project
- setProjectByDir is now async; ipc handler awaits it
- fix ReferenceError: msgId is not defined in _handleCallback (project pagination);
  msgId now derived from cbq.message, editMessageText falls back to sendMessage
…f new chat

- setProjectByDir(): find an existing session mapped to the project dir and
  loadURL() to it (same as /switch), instead of sending initial-prompt
  (which behaved like starting a new chat)
- provider URL is built from sessionUrlBase; falls back to DeepSeek chat URL
- session-store currentSessionId is updated to the found session
- returns { success, dir, sessionId } so the bot can report which session was used
…loads)

- _cmdNew: call newChat fire-and-forget instead of awaiting executeJavaScript;
  loadURL inside newChat unloads the window context, so the awaited promise
  never resolved and the bot stayed silent
- always reply new.done after a short pause; drop the unreachable error branch
- delete src/preload/dom/deepseek-language.js: it force-switched the DeepSeek
  Language setting to System and locked the select (pointer-events:none,
  aria-disabled, killed onMouseDown/onKeyDown) so the user could not change it
- drop its require and startWatch() call from src/preload/index.js
- no other references remain (git grep clean); the language select is now free
@merfiDEV
merfiDEV merged commit a2dfc28 into master Sep 26, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant