acpgram 1.19.1 → 1.19.3

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/README.md CHANGED
@@ -11,7 +11,7 @@
11
11
  [![Node.js](https://img.shields.io/badge/node-%3E%3D22.13.0-brightgreen.svg)](https://nodejs.org)
12
12
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
13
13
 
14
- **English** · [Русский](README.ru.md)
14
+ **English** · [Русский](README.ru.md) · [Website](https://alexey-seleznev.pro/acpgram/)
15
15
 
16
16
  A Telegram gateway to AI coding agents — **Gemini CLI**, **Claude Code**, **Antigravity CLI** and **OpenAI Codex**. The bot runs the agent as a subprocess on the machine where it is installed and talks to it over the [Agent Client Protocol](https://agentclientprotocol.com) (JSON-RPC over stdin/stdout). You write a task in Telegram; the agent works in the selected project on your server, PC or laptop, and you watch its progress, approve its actions and get the answer right in the chat.
17
17
 
package/README.ru.md CHANGED
@@ -11,7 +11,7 @@
11
11
  [![Node.js](https://img.shields.io/badge/node-%3E%3D22.13.0-brightgreen.svg)](https://nodejs.org)
12
12
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
13
13
 
14
- [English](README.md) · **Русский**
14
+ [English](README.md) · **Русский** · [Сайт](https://alexey-seleznev.pro/acpgram/)
15
15
 
16
16
  Telegram-шлюз к AI-агентам разработки **Gemini CLI**, **Claude Code**, **Antigravity CLI** и **OpenAI Codex**: бот запускает агента как подпроцесс на той машине, где он установлен, и общается с ним по [Agent Client Protocol](https://agentclientprotocol.com) (JSON-RPC через stdin/stdout). Каждый пользователь выбирает движок сам (`/engine`), движок по умолчанию задаётся в `.env`. Ответы приходят со стримингом, ходом работы агента и кнопками подтверждения действий.
17
17
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "acpgram",
3
- "version": "1.19.1",
3
+ "version": "1.19.3",
4
4
  "type": "module",
5
5
  "description": "Telegram gateway to AI coding agents (Gemini CLI, Claude Code, Antigravity CLI, Codex) over the Agent Client Protocol",
6
6
  "license": "MIT",
@@ -18,7 +18,7 @@
18
18
  "llm",
19
19
  "cli"
20
20
  ],
21
- "homepage": "https://github.com/selesnow/acpgram#readme",
21
+ "homepage": "https://alexey-seleznev.pro/acpgram/",
22
22
  "bugs": {
23
23
  "url": "https://github.com/selesnow/acpgram/issues"
24
24
  },
package/src/i18n.mjs CHANGED
@@ -213,6 +213,16 @@ const M = {
213
213
  'ses.list': { en: 'Sessions of project {p}.\nChoose which one to return to:', ru: 'Сессии проекта {p}.\nВыберите, к какой вернуться:', uk: 'Сесії проєкту {p}.\nОберіть, до якої повернутися:' },
214
214
  'ses.reqs': { en: '{n} req.', ru: '{n} запр.', uk: '{n} запит.' },
215
215
  'ses.alreadyActive': { en: 'This session is already active', ru: 'Эта сессия уже активна', uk: 'Ця сесія вже активна' },
216
+ 'ses.movedAway': {
217
+ en: '↪️ This session was continued in another dialog, so it was closed here. The next request here starts a new session.',
218
+ ru: '↪️ Эту сессию продолжили в другом диалоге, поэтому здесь она закрыта. Следующий запрос здесь начнёт новую сессию.',
219
+ uk: '↪️ Цю сесію продовжили в іншому діалозі, тому тут її закрито. Наступний запит тут почне нову сесію.',
220
+ },
221
+ 'ses.busyElsewhere': {
222
+ en: '⏳ This session is answering a request in another dialog right now. Wait for the answer or /stop it there, then try again.',
223
+ ru: '⏳ Эта сессия сейчас отвечает на запрос в другом диалоге. Дождитесь ответа или остановите его там (/stop) и повторите.',
224
+ uk: '⏳ Ця сесія зараз відповідає на запит в іншому діалозі. Дочекайтеся відповіді або зупиніть його там (/stop) і повторіть.',
225
+ },
216
226
  'ses.notFound': { en: 'The session was not found or belongs to another project. Run /sessions again.', ru: 'Сессия не найдена или относится к другому проекту. Вызовите /sessions заново.', uk: 'Сесію не знайдено або вона належить іншому проєкту. Викличте /sessions знову.' },
217
227
  'ses.engineDown': { en: '{engine} is unavailable on the server right now — the session cannot be resumed.', ru: '{engine} сейчас недоступен на сервере — сессию не возобновить.', uk: '{engine} зараз недоступний на сервері — сесію не відновити.' },
218
228
  'ses.engineOff': { en: 'The {engine} engine is not granted to you right now — the session cannot be resumed. Contact the administrator.', ru: 'Движок {engine} вам сейчас не выдан — сессию не возобновить. Обратитесь к администратору.', uk: 'Рушій {engine} вам зараз не видано — сесію не відновити. Зверніться до адміністратора.' },
package/src/state.mjs CHANGED
@@ -256,7 +256,33 @@ export async function ensureAgent(st, { resume } = {}) {
256
256
  }
257
257
  }
258
258
 
259
+ /**
260
+ * Одна сессия агента — в одном диалоге. Перед возобновлением сессии sessionId в диалоге st она закрывается во всех
261
+ * других диалогах пользователя (General, другие темы): иначе два процесса агента писали бы в одну историю.
262
+ * Там, где сессия работала, — короткое сообщение; там, где она только ждала возобновления, — тихо забываем.
263
+ * Занятый запросом диалог не трогаем: LimitError — пусть сначала закончит или будет остановлен.
264
+ */
265
+ export function releaseSessionElsewhere(st, sessionId) {
266
+ if (!sessionId) return;
267
+ const lang = langOf(st.userId);
268
+ for (const other of statesOf(st.userId)) {
269
+ if (other === st) continue;
270
+ const live = other.agent && !other.agent.closed && other.agent.sessionId === sessionId;
271
+ if (live) {
272
+ if (other.busy) throw new LimitError(t('ses.busyElsewhere', lang));
273
+ dropPermissions(other);
274
+ endAgent(other, 'moved');
275
+ log('сессия', sessionId, 'перенесена в другой диалог и закрыта здесь | пользователь', st.userId, '| тема', other.topic);
276
+ say(other.to, t('ses.movedAway', lang));
277
+ } else if (other.resumeId === sessionId) {
278
+ other.resumeId = null;
279
+ if (other.topic) db.saveTopic(other.userId, other.topic, { acpSessionId: '' });
280
+ }
281
+ }
282
+ }
283
+
259
284
  async function startAgent(st, { resume } = {}) {
285
+ releaseSessionElsewhere(st, resume);
260
286
  reserveSlot(st);
261
287
  const engine = engineOf(st);
262
288
  const allowed = modeFor(st.userId, engine);