acpgram 1.31.0 → 1.31.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
@@ -127,7 +127,7 @@ irm https://raw.githubusercontent.com/selesnow/acpgram/main/install.ps1 | iex
127
127
  curl -fsSL https://raw.githubusercontent.com/selesnow/acpgram/main/install.sh | bash
128
128
  ```
129
129
 
130
- The installer downloads the latest [release](https://github.com/selesnow/acpgram/releases) (checksum verified) into `%LOCALAPPDATA%\acpgram` or `~/.local/share/acpgram`, installs a private Node.js 24 if yours is missing or older (official build, checksum verified, no admin rights), adds the `acpgram` command to your PATH and starts the setup wizard. Run it again — or `acpgram update` — to update; your settings and data are kept.
130
+ The installer downloads the latest [release](https://github.com/selesnow/acpgram/releases) (checksum verified) into `%LOCALAPPDATA%\acpgram` or `~/.local/share/acpgram`, installs a private Node.js 24 if yours is missing or older and a private `nssm.exe` (Windows service manager) if it is not found — both official builds, SHA-256 verified, no admin rights — adds the `acpgram` command to your PATH and starts the setup wizard. An existing nssm is left alone; `ACPGRAM_NO_NSSM=1` skips it. Run it again — or `acpgram update` — to update; your settings and data are kept.
131
131
 
132
132
  ```text
133
133
  acpgram start the bot
@@ -138,6 +138,8 @@ acpgram update update to the latest release
138
138
 
139
139
  From source instead (Node.js 24+): `git clone https://github.com/selesnow/acpgram.git && cd acpgram && npm start` — npm scripts mirror the commands: `npm run setup`, `npm run service:install`.
140
140
 
141
+ > On Windows, `nssm` is only needed to run the bot as a service. The one-line `install.ps1` installs it automatically into `%LOCALAPPDATA%\acpgram\bin`; with `npm install -g acpgram` you need to install it yourself: `winget install --id NSSM.NSSM -e`. Running `acpgram` in a terminal does not need nssm.
142
+
141
143
  The **setup wizard** (`acpgram setup` / `npm run setup`, safe to re-run — current values are suggested):
142
144
 
143
145
  1. bot token — checked right away with `getMe`;
@@ -154,7 +156,7 @@ Autostart with the system and restart on failure — one command:
154
156
 
155
157
  | OS | How | Command |
156
158
  |---|---|---|
157
- | Windows | Windows service via [nssm](https://nssm.cc) (`winget install --id NSSM.NSSM -e`); run the terminal as administrator; you will be offered to run the service under your account (where the agents are signed in) | `npm run service:install` |
159
+ | Windows | Windows service via [nssm](https://nssm.cc) (the Windows installer already puts a private `nssm.exe` into `%LOCALAPPDATA%\acpgram\bin`; for an npm install use `winget install --id NSSM.NSSM -e`); run the terminal as administrator; you will be offered to run the service under your account (where the agents are signed in) | `npm run service:install` |
158
160
  | Linux | `systemd --user` (to keep it running without a login session: `sudo loginctl enable-linger $USER`) | `npm run service:install` |
159
161
  | macOS | LaunchAgent (`launchd`) | `npm run service:install` |
160
162
 
package/README.ru.md CHANGED
@@ -246,7 +246,7 @@ irm https://raw.githubusercontent.com/selesnow/acpgram/main/install.ps1 | iex
246
246
  curl -fsSL https://raw.githubusercontent.com/selesnow/acpgram/main/install.sh | bash
247
247
  ```
248
248
 
249
- Установщик скачивает последний [релиз](https://github.com/selesnow/acpgram/releases) (с проверкой контрольной суммы) в `%LOCALAPPDATA%\acpgram` или `~/.local/share/acpgram`, при необходимости ставит приватный Node.js 24 (официальная сборка, с проверкой контрольной суммы, без прав администратора), добавляет команду `acpgram` в PATH и запускает мастер настройки. Повторный запуск или `acpgram update` — обновление; настройки и данные сохраняются. Команды: `acpgram` (запуск), `acpgram setup`, `acpgram service install | restart | stop | status | uninstall`, `acpgram update`.
249
+ Установщик скачивает последний [релиз](https://github.com/selesnow/acpgram/releases) (с проверкой контрольной суммы) в `%LOCALAPPDATA%\acpgram` или `~/.local/share/acpgram`, при необходимости ставит приватный Node.js 24 и приватный `nssm.exe` (менеджер служб Windows; обе сборки официальные, с проверкой SHA-256, без прав администратора), добавляет команду `acpgram` в PATH и запускает мастер настройки. Уже установленный nssm не перезаписывается; `ACPGRAM_NO_NSSM=1` отключает его установку. Повторный запуск или `acpgram update` — обновление; настройки и данные сохраняются. Команды: `acpgram` (запуск), `acpgram setup`, `acpgram service install | restart | stop | status | uninstall`, `acpgram update`.
250
250
 
251
251
  Два способа, выбирайте под машину:
252
252
 
@@ -292,11 +292,13 @@ npm start # первый запуск без .env сам открое
292
292
 
293
293
  Вручную: скопировать `.env.example` в `.env`, заполнить и запустить `npm start`.
294
294
 
295
+ > `nssm` нужен только для запуска как служба Windows. Однострочный установщик (`install.ps1`) ставит его автоматически в `%LOCALAPPDATA%\acpgram\bin`; при установке через `npm install -g acpgram` его нужно установить самостоятельно: `winget install --id NSSM.NSSM -e`. Для обычного запуска в консоли `nssm` не нужен.
296
+
295
297
  **Служба одной командой** — автозапуск с системой и перезапуск при сбое:
296
298
 
297
299
  | ОС | Как | Команда |
298
300
  |---|---|---|
299
- | Windows | служба через [nssm](https://nssm.cc) (`winget install --id NSSM.NSSM -e`), терминал от имени администратора; мастер предложит запускать службу от вашей учётной записи (там авторизованы агенты) | `npm run service:install` |
301
+ | Windows | служба через [nssm](https://nssm.cc) (установщик Windows уже кладёт приватный `nssm.exe` в `%LOCALAPPDATA%\acpgram\bin`; при установке из npm — `winget install --id NSSM.NSSM -e`), терминал от имени администратора; мастер предложит запускать службу от вашей учётной записи (там авторизованы агенты) | `npm run service:install` |
300
302
  | Linux | `systemd --user` (для работы без входа в систему: `sudo loginctl enable-linger $USER`) | `npm run service:install` |
301
303
  | macOS | LaunchAgent (`launchd`) | `npm run service:install` |
302
304
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "acpgram",
3
- "version": "1.31.0",
3
+ "version": "1.31.3",
4
4
  "type": "module",
5
5
  "description": "Telegram gateway to AI coding agents (Gemini CLI, Claude Code, Antigravity CLI, Codex, OpenCode) over the Agent Client Protocol",
6
6
  "license": "MIT",
package/src/service.mjs CHANGED
@@ -146,10 +146,12 @@ const run = (cmd, args, { dry = false, secretAt = -1, quiet = false, timeout = 3
146
146
 
147
147
  const WINGET_LINKS = process.env.LOCALAPPDATA ? [join(process.env.LOCALAPPDATA, 'Microsoft', 'WinGet', 'Links')] : [];
148
148
 
149
- /** nssm: NSSM_PATH, затем PATH (поиск средствами Node — `where` портит пути с кириллицей), затем ссылки WinGet. */
150
- function findNssm() {
151
- if (process.env.NSSM_PATH && existsSync(process.env.NSSM_PATH)) return process.env.NSSM_PATH;
152
- return findOnPath('nssm', { exists: existsSync, exts: ['.exe'], extra: WINGET_LINKS });
149
+ /** nssm: NSSM_PATH, каталог установки bin\, затем PATH (поиск средствами Node — `where` портит пути с кириллицей) и ссылки WinGet. */
150
+ export function findNssm({ env = process.env, homeDir = HOME_DIR, extra = WINGET_LINKS } = {}) {
151
+ if (env.NSSM_PATH && existsSync(env.NSSM_PATH)) return env.NSSM_PATH;
152
+ const privateNssm = join(homeDir, 'bin', 'nssm.exe');
153
+ if (existsSync(privateNssm)) return privateNssm;
154
+ return findOnPath('nssm', { exists: existsSync, exts: ['.exe'], pathVar: env.PATH ?? env.Path ?? '', extra });
153
155
  }
154
156
 
155
157
  const isWinAdmin = () => spawnSync('net', ['session'], { windowsHide: true, stdio: 'ignore' }).status === 0;
package/src/winsvc.mjs CHANGED
@@ -7,7 +7,7 @@
7
7
  // • значения состояний (RUNNING, STOP_PENDING…) и формат «число (0xHEX)» зашиты в sc.exe;
8
8
  // • ключи и значения реестра (DeleteFlag), столбцы CSV tasklist.
9
9
  // Текст вывода используется только для показа пользователю.
10
- import { win32 } from 'node:path';
10
+ import { join, win32 } from 'node:path';
11
11
  import { tc } from './cli-i18n.mjs';
12
12
 
13
13
  /** Код Windows «служба не существует» (ERROR_SERVICE_DOES_NOT_EXIST) — его возвращает sc.exe как код выхода. */
@@ -116,9 +116,14 @@ export const parseOemCp = (output) => Number(/OEMCP\s+REG_SZ\s+(\d+)/.exec(outpu
116
116
  * @param {{pathVar?: string, exts?: string[], exists: (p: string) => boolean, extra?: string[]}} o
117
117
  */
118
118
  export function findOnPath(cmd, { pathVar = process.env.PATH ?? process.env.Path ?? '', exts = ['.exe', '.cmd', '.bat'], exists, extra = [] } = {}) {
119
- const dirs = [...pathVar.split(';').map((d) => d.trim().replace(/^"|"$/g, '')).filter(Boolean), ...extra];
119
+ const windowsStyle = /^[A-Za-z]:[\\/]/.test(pathVar) || pathVar.includes('\\') || pathVar.includes(';');
120
+ const pathJoin = windowsStyle ? win32.join : join;
121
+ const dirs = [...pathVar.split(windowsStyle ? ';' : ':').map((d) => d.trim().replace(/^"|"$/g, '')).filter(Boolean), ...extra];
120
122
  // имя уже с расширением («gemini.cmd», «codex-acp.cmd») — проверяем как есть, иначе получилось бы «codex-acp.cmd.cmd»
121
123
  const hasExt = exts.some((e) => cmd.toLowerCase().endsWith(e));
122
- for (const dir of dirs) for (const ext of hasExt ? [''] : exts) if (exists(win32.join(dir, cmd + ext))) return win32.join(dir, cmd + ext);
124
+ for (const dir of dirs) for (const ext of hasExt ? [''] : exts) {
125
+ const file = pathJoin(dir, cmd + ext);
126
+ if (exists(file)) return file;
127
+ }
123
128
  return null;
124
129
  }