appback-remoteagent 0.14.5 → 0.14.6

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/dist/bot.js CHANGED
@@ -89,6 +89,7 @@ const RECOGNIZED_COMMANDS = new Set([
89
89
  ]);
90
90
  const TELEGRAM_STALE_UPDATE_GRACE_SECONDS = 10;
91
91
  const TELEGRAM_PROCESS_STARTED_AT_SECONDS = Math.floor(Date.now() / 1000);
92
+ const activeWorkLoopKeys = new Set();
92
93
  const REPORT_CONTINUE_PROMPT = [
93
94
  "Continue the same task now.",
94
95
  "Do more concrete work before replying again.",
@@ -1132,6 +1133,16 @@ async function runWithPendingAnimation(botToken, chatId, task) {
1132
1133
  async function routeTelegramWorkLoop(bridge, botId, chatId, message, label, botManagement, helpers, autoContinue, memoryService, transform = (blocks) => blocks) {
1133
1134
  const currentSession = await bridge.status(botId, chatId);
1134
1135
  const sessionId = currentSession?.session.sessionId;
1136
+ const activeKey = workLoopKey(botId, chatId, sessionId);
1137
+ if (activeWorkLoopKeys.has(activeKey)) {
1138
+ const message = [
1139
+ `Session ${currentSession?.session.publicId ?? sessionId ?? `${botId}:${chatId}`} is already running.`,
1140
+ "Send /stop to interrupt the active work, then send the instruction again.",
1141
+ ].join("\n");
1142
+ await bridge.logSystem(botId, chatId, `Rejected overlapping Telegram work loop for ${activeKey}.`);
1143
+ return [message];
1144
+ }
1145
+ activeWorkLoopKeys.add(activeKey);
1135
1146
  if (currentSession) {
1136
1147
  await memoryService.recordInstruction(currentSession.session, message);
1137
1148
  }
@@ -1319,6 +1330,7 @@ async function routeTelegramWorkLoop(bridge, botId, chatId, message, label, botM
1319
1330
  }
1320
1331
  }
1321
1332
  finally {
1333
+ activeWorkLoopKeys.delete(activeKey);
1322
1334
  if (currentSession) {
1323
1335
  if (providerCompleted) {
1324
1336
  await botManagement.markProviderCompleted(botId, sessionId);
@@ -1329,6 +1341,9 @@ async function routeTelegramWorkLoop(bridge, botId, chatId, message, label, botM
1329
1341
  }
1330
1342
  }
1331
1343
  }
1344
+ function workLoopKey(botId, chatId, sessionId) {
1345
+ return sessionId ? `session:${sessionId}` : `chat:${botId}:${chatId}`;
1346
+ }
1332
1347
  class SilentTelegramAbort extends Error {
1333
1348
  constructor(message) {
1334
1349
  super(message);
@@ -100,8 +100,11 @@ journalctl -u remoteagent -f
100
100
  Restart after build:
101
101
 
102
102
  ```bash
103
- sudo npm install -g appback-remoteagent@<version>
103
+ export PATH="/home/au2223/.local/bin:/home/au2223/.nvm/versions/node/v22.22.0/bin:$PATH"
104
+ npm install -g appback-remoteagent@<version>
105
+ remoteagent-install
104
106
  sudo systemctl restart remoteagent
107
+ node -p 'require("/home/au2223/.nvm/versions/node/v22.22.0/lib/node_modules/appback-remoteagent/package.json").version'
105
108
  ```
106
109
 
107
110
  Check the lock owner:
package/docs/RELEASING.md CHANGED
@@ -100,14 +100,20 @@ Server 30 uses a systemd service:
100
100
  VERSION=0.14.0
101
101
  ssh au2223@192.168.0.30 "VERSION=$VERSION bash -s" <<'REMOTE'
102
102
  set -euo pipefail
103
- sudo -n env "PATH=$PATH" npm install -g appback-remoteagent@$VERSION
103
+ export PATH="/home/au2223/.local/bin:/home/au2223/.nvm/versions/node/v22.22.0/bin:$PATH"
104
+ npm install -g appback-remoteagent@$VERSION
104
105
  /home/au2223/.nvm/versions/node/v22.22.0/bin/remoteagent-install
105
106
  sudo -n systemctl restart remoteagent
106
107
  systemctl is-active remoteagent
108
+ node -p 'require("/home/au2223/.nvm/versions/node/v22.22.0/lib/node_modules/appback-remoteagent/package.json").version'
107
109
  journalctl -u remoteagent --since '2 minutes ago' --no-pager
108
110
  REMOTE
109
111
  ```
110
112
 
113
+ Do not run `sudo npm install -g` on server 30. The global RemoteAgent package is installed under
114
+ `/home/au2223/.nvm/versions/node/v22.22.0`; only the `systemctl restart remoteagent` step needs sudo.
115
+ Runtime state remains in `/home/au2223/.remoteagent` and must not be deleted during npm upgrades.
116
+
111
117
  Server 26 currently uses user-level start/stop scripts, not a systemd `remoteagent.service`:
112
118
 
113
119
  ```bash
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "appback-remoteagent",
3
- "version": "0.14.5",
3
+ "version": "0.14.6",
4
4
  "description": "Personal installable session server for continuing local AI work across PC and Telegram",
5
5
  "license": "MIT",
6
6
  "type": "module",