appback-remoteagent 0.15.4 → 0.15.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 +38 -12
- package/dist/services/bridge-service.js +5 -4
- package/docs/OPERATIONS.md +19 -2
- package/docs/RELEASING.md +126 -90
- package/package.json +5 -4
- package/scripts/prepublish-guard.mjs +16 -0
- package/scripts/release-deploy.sh +79 -0
- package/scripts/release-publish.sh +45 -0
- package/scripts/release-version.sh +27 -0
- package/scripts/bump-version.sh +0 -23
package/dist/bot.js
CHANGED
|
@@ -2258,6 +2258,9 @@ print(text)
|
|
|
2258
2258
|
const preview = stdout.trim();
|
|
2259
2259
|
return preview || undefined;
|
|
2260
2260
|
}
|
|
2261
|
+
const TELEGRAM_FILE_DOWNLOAD_ATTEMPTS = 4;
|
|
2262
|
+
const TELEGRAM_FILE_DOWNLOAD_TIMEOUT_SECONDS = 120;
|
|
2263
|
+
const TELEGRAM_FILE_DOWNLOAD_CONNECT_TIMEOUT_SECONDS = 20;
|
|
2261
2264
|
async function downloadTelegramFile(botToken, botId, chatId, fileId, preferredName) {
|
|
2262
2265
|
const file = await callTelegramApi(botToken, "getFile", {
|
|
2263
2266
|
file_id: fileId,
|
|
@@ -2270,20 +2273,43 @@ async function downloadTelegramFile(botToken, botId, chatId, fileId, preferredNa
|
|
|
2270
2273
|
const extension = path.extname(file.file_path) || path.extname(preferredName ?? "") || ".bin";
|
|
2271
2274
|
const basename = path.basename(preferredName ?? file.file_path, path.extname(preferredName ?? file.file_path));
|
|
2272
2275
|
const outputPath = path.join(directory, `${Date.now()}-${safePathSegment(basename)}-${randomUUID()}${extension}`);
|
|
2276
|
+
const partialPath = `${outputPath}.part`;
|
|
2273
2277
|
const fileUrl = new URL(file.file_path, `https://api.telegram.org/file/bot${botToken}/`).toString();
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2278
|
+
let lastError;
|
|
2279
|
+
for (let attempt = 1; attempt <= TELEGRAM_FILE_DOWNLOAD_ATTEMPTS; attempt += 1) {
|
|
2280
|
+
try {
|
|
2281
|
+
const { stderr } = await execFileAsync("curl", [
|
|
2282
|
+
"-fL",
|
|
2283
|
+
"-sS",
|
|
2284
|
+
"--connect-timeout",
|
|
2285
|
+
String(TELEGRAM_FILE_DOWNLOAD_CONNECT_TIMEOUT_SECONDS),
|
|
2286
|
+
"--max-time",
|
|
2287
|
+
String(TELEGRAM_FILE_DOWNLOAD_TIMEOUT_SECONDS),
|
|
2288
|
+
"-C",
|
|
2289
|
+
"-",
|
|
2290
|
+
"-o",
|
|
2291
|
+
partialPath,
|
|
2292
|
+
fileUrl,
|
|
2293
|
+
]);
|
|
2294
|
+
if (stderr?.trim()) {
|
|
2295
|
+
console.error(`curl stderr for Telegram file download: ${stderr.trim()}`);
|
|
2296
|
+
}
|
|
2297
|
+
await fs.rename(partialPath, outputPath);
|
|
2298
|
+
return { path: outputPath };
|
|
2299
|
+
}
|
|
2300
|
+
catch (error) {
|
|
2301
|
+
lastError = error;
|
|
2302
|
+
if (attempt < TELEGRAM_FILE_DOWNLOAD_ATTEMPTS) {
|
|
2303
|
+
const partialSize = await fs.stat(partialPath).then((stat) => stat.size).catch(() => 0);
|
|
2304
|
+
console.error(`Telegram file download attempt ${attempt}/${TELEGRAM_FILE_DOWNLOAD_ATTEMPTS} failed; ` +
|
|
2305
|
+
`retrying with resume from ${partialSize} bytes.`);
|
|
2306
|
+
await sleep(Math.min(5000, attempt * 1000));
|
|
2307
|
+
continue;
|
|
2308
|
+
}
|
|
2309
|
+
}
|
|
2285
2310
|
}
|
|
2286
|
-
|
|
2311
|
+
await fs.rm(partialPath, { force: true }).catch(() => undefined);
|
|
2312
|
+
throw lastError instanceof Error ? lastError : new Error("Telegram file download failed.");
|
|
2287
2313
|
}
|
|
2288
2314
|
function safePathSegment(value) {
|
|
2289
2315
|
const safe = value.replace(/[^a-zA-Z0-9._-]+/g, "_").replace(/^_+|_+$/g, "");
|
|
@@ -4,9 +4,10 @@ import os from "node:os";
|
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
import { stopSpawnedExecution } from "../adapters/windows-shell.js";
|
|
6
6
|
const MODEL_PRESETS = {
|
|
7
|
-
codex: ["gpt-5.5", "gpt-5.4", "gpt-5.4-mini", "gpt-5.2", "gpt-5.1-codex-max"],
|
|
7
|
+
codex: ["gpt-5.6-sol", "gpt-5.6-terra", "gpt-5.6-luna", "gpt-5.6", "gpt-5.5", "gpt-5.4", "gpt-5.4-mini", "gpt-5.2", "gpt-5.1-codex-max"],
|
|
8
8
|
claude: ["sonnet", "opus", "haiku"],
|
|
9
9
|
};
|
|
10
|
+
const DEFAULT_CODEX_MODEL = "gpt-5.6-sol";
|
|
10
11
|
export class BridgeService {
|
|
11
12
|
store;
|
|
12
13
|
adapters;
|
|
@@ -59,7 +60,7 @@ export class BridgeService {
|
|
|
59
60
|
cwd: workspace,
|
|
60
61
|
pairedAt: new Date().toISOString(),
|
|
61
62
|
sessionId: undefined,
|
|
62
|
-
model: provider
|
|
63
|
+
model: this.defaultModelFor(provider),
|
|
63
64
|
sandboxMode: provider === "codex" ? this.defaultCodexSandboxMode : undefined,
|
|
64
65
|
lastUsedAt: undefined,
|
|
65
66
|
}, workspace);
|
|
@@ -94,7 +95,7 @@ export class BridgeService {
|
|
|
94
95
|
cwd: workspace,
|
|
95
96
|
pairedAt: new Date().toISOString(),
|
|
96
97
|
sessionId: normalizedSessionId,
|
|
97
|
-
model: existing?.session[provider]?.model ?? (provider
|
|
98
|
+
model: existing?.session[provider]?.model ?? this.defaultModelFor(provider),
|
|
98
99
|
sandboxMode: provider === "codex"
|
|
99
100
|
? (existing?.session[provider]?.sandboxMode ?? this.defaultCodexSandboxMode)
|
|
100
101
|
: undefined,
|
|
@@ -655,7 +656,7 @@ export class BridgeService {
|
|
|
655
656
|
return next?.trim() || current || this.defaultWorkspace;
|
|
656
657
|
}
|
|
657
658
|
defaultModelFor(provider) {
|
|
658
|
-
return provider === "codex" ?
|
|
659
|
+
return provider === "codex" ? DEFAULT_CODEX_MODEL : "sonnet";
|
|
659
660
|
}
|
|
660
661
|
describeEffectiveAccess(session) {
|
|
661
662
|
if (!session.codex) {
|
package/docs/OPERATIONS.md
CHANGED
|
@@ -9,8 +9,17 @@ RemoteAgent production is operated from one canonical Git history:
|
|
|
9
9
|
- production package: `appback-remoteagent`
|
|
10
10
|
- branch used for production releases: `main`
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
Use `origin/main` as the authoritative source.
|
|
13
13
|
Code changes should be committed and pushed to `origin/main`, published to npm, and then server 30/26 should be updated from that npm version.
|
|
14
|
+
Production release commands are:
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
npm run release:publish
|
|
18
|
+
npm run release:deploy -- <version> all
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Local tarball installation is an emergency runtime restoration path.
|
|
22
|
+
The production release is completed by publishing the same version to npm and running `npm run release:deploy -- <version> all`.
|
|
14
23
|
|
|
15
24
|
## Product shape in operations
|
|
16
25
|
|
|
@@ -32,7 +41,7 @@ Current production bot ownership is intentionally split:
|
|
|
32
41
|
- server 30: RemoteAgent production bots
|
|
33
42
|
- local machine 21: local-only bot runtime
|
|
34
43
|
|
|
35
|
-
|
|
44
|
+
Assign each Telegram bot token to one runtime at a time.
|
|
36
45
|
Bot polling conflicts are treated as incidents, not harmless warnings.
|
|
37
46
|
|
|
38
47
|
When a runtime has several configured Telegram bots, polling pressure can become operationally visible.
|
|
@@ -134,6 +143,14 @@ If a temporary branch is unavoidable, merge it back to `main`, push it, and depl
|
|
|
134
143
|
|
|
135
144
|
A task is not done until commit and push both happened.
|
|
136
145
|
A production deployment is not done until server 30 and server 26 are running the published npm version and the runtime path has been verified.
|
|
146
|
+
If npm publish returns `403`, use a publish-capable npm token for the unscoped `appback-remoteagent` package and run:
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
source ~/.config/remoteagent/npm-token.env
|
|
150
|
+
npm run release:publish
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
See `docs/RELEASING.md`.
|
|
137
154
|
|
|
138
155
|
See `docs/RELEASING.md` for the detailed versioning rules.
|
|
139
156
|
|
package/docs/RELEASING.md
CHANGED
|
@@ -1,140 +1,176 @@
|
|
|
1
|
-
#
|
|
1
|
+
# RemoteAgent Release Runbook
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
This runbook is command-first. Use the scripts below as the release interface.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## 1. Bump Version
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
- `MINOR`: new user-facing capabilities, new commands, new adapters, or non-breaking workflow expansion
|
|
9
|
-
- `PATCH`: bug fixes, reliability improvements, security fixes, text-only corrections, and non-breaking maintenance
|
|
7
|
+
Patch release:
|
|
10
8
|
|
|
11
|
-
|
|
9
|
+
```bash
|
|
10
|
+
npm run release:version -- patch
|
|
11
|
+
```
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
Minor release:
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
```bash
|
|
16
|
+
npm run release:version -- minor
|
|
17
|
+
```
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
Major release:
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
```bash
|
|
22
|
+
npm run release:version -- major
|
|
23
|
+
```
|
|
22
24
|
|
|
23
|
-
|
|
25
|
+
Versioning guide:
|
|
24
26
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
4. Run `npm run build`
|
|
29
|
-
5. Commit the completed work
|
|
30
|
-
6. Push `main` to `origin/main`
|
|
31
|
-
7. Publish `appback-remoteagent@<version>` to npm from server 30's npm credentials
|
|
32
|
-
8. Install that exact npm version on server 30 and server 26
|
|
33
|
-
9. Restart `remoteagent.service` on each target if runtime code changed
|
|
34
|
-
10. Verify the relevant runtime path, logs, or Telegram behavior on each target
|
|
27
|
+
- `patch`: reliability fixes, bug fixes, text fixes, safe maintenance
|
|
28
|
+
- `minor`: new commands, new user-facing behavior, new non-breaking workflow
|
|
29
|
+
- `major`: storage/runtime contract changes or breaking command behavior
|
|
35
30
|
|
|
36
|
-
|
|
37
|
-
If server 30 or server 26 is not running the published npm version, the production deployment is incomplete.
|
|
31
|
+
## 2. Validate
|
|
38
32
|
|
|
39
|
-
|
|
33
|
+
```bash
|
|
34
|
+
npm run check
|
|
35
|
+
npm run build
|
|
36
|
+
```
|
|
40
37
|
|
|
41
|
-
|
|
38
|
+
## 3. Commit And Push
|
|
42
39
|
|
|
43
40
|
```bash
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
41
|
+
git status --short
|
|
42
|
+
git add -A
|
|
43
|
+
git commit -m "Release <version>"
|
|
44
|
+
git push origin main
|
|
47
45
|
```
|
|
48
46
|
|
|
49
|
-
|
|
47
|
+
Example:
|
|
50
48
|
|
|
51
49
|
```bash
|
|
52
|
-
|
|
53
|
-
npm run version:minor
|
|
54
|
-
npm run version:major
|
|
50
|
+
git commit -m "Release 0.15.5"
|
|
55
51
|
```
|
|
56
52
|
|
|
57
|
-
|
|
53
|
+
## 4. Publish To npm
|
|
54
|
+
|
|
55
|
+
Load the npm token when the shell has not loaded it yet:
|
|
58
56
|
|
|
59
57
|
```bash
|
|
60
|
-
|
|
61
|
-
npm run check
|
|
62
|
-
npm run build
|
|
63
|
-
git status
|
|
64
|
-
git add -A
|
|
65
|
-
git commit -m "Release 0.12.3"
|
|
66
|
-
git push origin main
|
|
67
|
-
npm pack
|
|
58
|
+
source ~/.config/remoteagent/npm-token.env
|
|
68
59
|
```
|
|
69
60
|
|
|
70
|
-
|
|
61
|
+
Publish:
|
|
71
62
|
|
|
72
|
-
|
|
63
|
+
```bash
|
|
64
|
+
npm run release:publish
|
|
65
|
+
```
|
|
73
66
|
|
|
74
|
-
|
|
67
|
+
The publish script performs:
|
|
75
68
|
|
|
76
|
-
|
|
77
|
-
|
|
69
|
+
- clean working tree check
|
|
70
|
+
- `npm whoami`
|
|
71
|
+
- `npm owner ls appback-remoteagent`
|
|
72
|
+
- `npm run check`
|
|
73
|
+
- `npm run build`
|
|
74
|
+
- `npm pack`
|
|
75
|
+
- guarded `npm publish`
|
|
76
|
+
- registry version verification
|
|
77
|
+
|
|
78
|
+
The package publish entrypoint is `npm run release:publish`.
|
|
79
|
+
`scripts/prepublish-guard.mjs` routes manual publish attempts back to that entrypoint.
|
|
80
|
+
|
|
81
|
+
## 5. Deploy Published Version
|
|
82
|
+
|
|
83
|
+
Deploy to server 30:
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
npm run release:deploy -- <version> 30
|
|
78
87
|
```
|
|
79
88
|
|
|
80
|
-
|
|
89
|
+
Deploy to server 26:
|
|
81
90
|
|
|
82
91
|
```bash
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
ssh au2223@192.168.0.30 "rm -f /tmp/appback-remoteagent-$VERSION.tgz"
|
|
92
|
+
npm run release:deploy -- <version> 26
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
Deploy to both production targets:
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
npm run release:deploy -- <version> all
|
|
91
99
|
```
|
|
92
100
|
|
|
93
|
-
|
|
101
|
+
Example:
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
npm run release:deploy -- 0.15.5 all
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
The deploy script performs:
|
|
108
|
+
|
|
109
|
+
- npm registry version check for `appback-remoteagent@<version>`
|
|
110
|
+
- server 30 npm install, install hook, systemd restart, version/log verification
|
|
111
|
+
- server 26 npm install, install hook, user-process restart, version/log verification
|
|
94
112
|
|
|
95
|
-
##
|
|
113
|
+
## 6. Verify
|
|
96
114
|
|
|
97
|
-
|
|
115
|
+
Registry:
|
|
98
116
|
|
|
99
117
|
```bash
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
118
|
+
npm view appback-remoteagent version
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
Server 30:
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
ssh au2223@192.168.0.30 'bash -lc '"'"'
|
|
103
125
|
export PATH="/home/au2223/.local/bin:/home/au2223/.nvm/versions/node/v22.22.0/bin:$PATH"
|
|
104
|
-
npm install -g appback-remoteagent@$VERSION
|
|
105
|
-
/home/au2223/.nvm/versions/node/v22.22.0/bin/remoteagent-install
|
|
106
|
-
sudo -n systemctl restart remoteagent
|
|
107
126
|
systemctl is-active remoteagent
|
|
108
|
-
node -p
|
|
109
|
-
journalctl -u remoteagent --since
|
|
110
|
-
|
|
127
|
+
node -p "require(\"/home/au2223/.nvm/versions/node/v22.22.0/lib/node_modules/appback-remoteagent/package.json\").version"
|
|
128
|
+
journalctl -u remoteagent --since "5 minutes ago" --no-pager | tail -80
|
|
129
|
+
'"'"''
|
|
111
130
|
```
|
|
112
131
|
|
|
113
|
-
|
|
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
|
-
|
|
117
|
-
Server 26 currently uses user-level start/stop scripts, not a systemd `remoteagent.service`:
|
|
132
|
+
Server 26:
|
|
118
133
|
|
|
119
134
|
```bash
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
set -euo pipefail
|
|
123
|
-
npm install -g appback-remoteagent@$VERSION
|
|
124
|
-
remoteagent-install
|
|
125
|
-
~/.remoteagent/stop-remoteagent.sh || true
|
|
126
|
-
sleep 2
|
|
127
|
-
~/.remoteagent/start-remoteagent.sh
|
|
128
|
-
sleep 3
|
|
135
|
+
ssh ospadmin@192.168.0.26 'bash -lc '"'"'
|
|
136
|
+
npm list -g appback-remoteagent --depth=0
|
|
129
137
|
pgrep -af "appback-remoteagent/dist/index.js"
|
|
130
138
|
tail -80 ~/.remoteagent/logs/agent.log
|
|
131
|
-
|
|
139
|
+
'"'"''
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
## Release 0.15.5
|
|
143
|
+
|
|
144
|
+
Date: 2026-07-08
|
|
145
|
+
|
|
146
|
+
Changes:
|
|
147
|
+
|
|
148
|
+
- Telegram file attachment download now writes to `.part` first.
|
|
149
|
+
- Telegram file attachment download resumes partial files with `curl -C -`.
|
|
150
|
+
- Telegram file attachment download retries up to 4 attempts.
|
|
151
|
+
- Download timeout changed from one 60-second attempt to resumable 120-second attempts.
|
|
152
|
+
- npm publish flow is guarded by `prepublishOnly`.
|
|
153
|
+
- Standard publish command is `npm run release:publish`.
|
|
154
|
+
- Standard deploy command is `npm run release:deploy -- <version> <30|26|all>`.
|
|
155
|
+
|
|
156
|
+
Validated:
|
|
157
|
+
|
|
158
|
+
```bash
|
|
159
|
+
npm run check
|
|
160
|
+
npm run build
|
|
161
|
+
npm run release:publish
|
|
162
|
+
npm run release:deploy -- 0.15.5 all
|
|
132
163
|
```
|
|
133
164
|
|
|
134
|
-
|
|
165
|
+
Published:
|
|
135
166
|
|
|
136
|
-
|
|
137
|
-
|
|
167
|
+
```text
|
|
168
|
+
appback-remoteagent@0.15.5
|
|
169
|
+
```
|
|
138
170
|
|
|
139
|
-
|
|
140
|
-
|
|
171
|
+
Runtime targets:
|
|
172
|
+
|
|
173
|
+
```text
|
|
174
|
+
server 30: 0.15.5 active
|
|
175
|
+
server 26: 0.15.5 running
|
|
176
|
+
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "appback-remoteagent",
|
|
3
|
-
"version": "0.15.
|
|
3
|
+
"version": "0.15.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",
|
|
@@ -20,9 +20,10 @@
|
|
|
20
20
|
"check": "tsc --noEmit -p tsconfig.json",
|
|
21
21
|
"selftest:telegram": "npm run build && node scripts/selftest-telegram-update.mjs",
|
|
22
22
|
"prepare": "npm run build",
|
|
23
|
-
"
|
|
24
|
-
"version
|
|
25
|
-
"
|
|
23
|
+
"prepublishOnly": "node scripts/prepublish-guard.mjs",
|
|
24
|
+
"release:version": "bash scripts/release-version.sh",
|
|
25
|
+
"release:publish": "bash scripts/release-publish.sh",
|
|
26
|
+
"release:deploy": "bash scripts/release-deploy.sh"
|
|
26
27
|
},
|
|
27
28
|
"dependencies": {
|
|
28
29
|
"dotenv": "^16.6.1",
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
if (process.env.REMOTEAGENT_PUBLISH_GUARD_OK === "1") {
|
|
4
|
+
process.exit(0);
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
console.error([
|
|
8
|
+
"RemoteAgent publishes through the guarded release command.",
|
|
9
|
+
"",
|
|
10
|
+
"Command:",
|
|
11
|
+
" npm run release:publish",
|
|
12
|
+
"",
|
|
13
|
+
"This command checks the working tree, npm identity, package owner, build, pack, publish, and registry version.",
|
|
14
|
+
].join("\n"));
|
|
15
|
+
|
|
16
|
+
process.exit(1);
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
|
|
4
|
+
usage() {
|
|
5
|
+
echo "Usage: npm run release:deploy -- <version> <30|26|all>" >&2
|
|
6
|
+
echo "Example: npm run release:deploy -- 0.15.5 all" >&2
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
if [[ $# -ne 2 ]]; then
|
|
10
|
+
usage
|
|
11
|
+
exit 1
|
|
12
|
+
fi
|
|
13
|
+
|
|
14
|
+
VERSION="$1"
|
|
15
|
+
TARGET="$2"
|
|
16
|
+
|
|
17
|
+
if [[ ! "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
|
18
|
+
usage
|
|
19
|
+
exit 1
|
|
20
|
+
fi
|
|
21
|
+
|
|
22
|
+
case "$TARGET" in
|
|
23
|
+
30|26|all)
|
|
24
|
+
;;
|
|
25
|
+
*)
|
|
26
|
+
usage
|
|
27
|
+
exit 1
|
|
28
|
+
;;
|
|
29
|
+
esac
|
|
30
|
+
|
|
31
|
+
PACKAGE_NAME="appback-remoteagent"
|
|
32
|
+
REGISTRY_VERSION="$(npm view "$PACKAGE_NAME@$VERSION" version)"
|
|
33
|
+
if [[ "$REGISTRY_VERSION" != "$VERSION" ]]; then
|
|
34
|
+
echo "Registry version check failed for $PACKAGE_NAME@$VERSION" >&2
|
|
35
|
+
exit 1
|
|
36
|
+
fi
|
|
37
|
+
|
|
38
|
+
deploy_30() {
|
|
39
|
+
ssh au2223@192.168.0.30 "VERSION=$VERSION bash -s" <<'REMOTE'
|
|
40
|
+
set -euo pipefail
|
|
41
|
+
export PATH="/home/au2223/.local/bin:/home/au2223/.nvm/versions/node/v22.22.0/bin:$PATH"
|
|
42
|
+
npm install -g "appback-remoteagent@$VERSION"
|
|
43
|
+
remoteagent-install
|
|
44
|
+
sudo -n systemctl restart remoteagent
|
|
45
|
+
sleep 5
|
|
46
|
+
systemctl is-active remoteagent
|
|
47
|
+
node -p 'require("/home/au2223/.nvm/versions/node/v22.22.0/lib/node_modules/appback-remoteagent/package.json").version'
|
|
48
|
+
journalctl -u remoteagent --since '1 minute ago' --no-pager | tail -80
|
|
49
|
+
REMOTE
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
deploy_26() {
|
|
53
|
+
ssh ospadmin@192.168.0.26 "VERSION=$VERSION bash -s" <<'REMOTE'
|
|
54
|
+
set -euo pipefail
|
|
55
|
+
export PATH="$HOME/.local/bin:$PATH"
|
|
56
|
+
npm install -g "appback-remoteagent@$VERSION"
|
|
57
|
+
remoteagent-install
|
|
58
|
+
~/.remoteagent/stop-remoteagent.sh || true
|
|
59
|
+
sleep 2
|
|
60
|
+
~/.remoteagent/start-remoteagent.sh
|
|
61
|
+
sleep 5
|
|
62
|
+
npm list -g appback-remoteagent --depth=0
|
|
63
|
+
pgrep -af 'appback-remoteagent/dist/index.js'
|
|
64
|
+
tail -80 ~/.remoteagent/logs/agent.log
|
|
65
|
+
REMOTE
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
case "$TARGET" in
|
|
69
|
+
30)
|
|
70
|
+
deploy_30
|
|
71
|
+
;;
|
|
72
|
+
26)
|
|
73
|
+
deploy_26
|
|
74
|
+
;;
|
|
75
|
+
all)
|
|
76
|
+
deploy_30
|
|
77
|
+
deploy_26
|
|
78
|
+
;;
|
|
79
|
+
esac
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
|
|
4
|
+
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
5
|
+
cd "$ROOT"
|
|
6
|
+
|
|
7
|
+
PACKAGE_NAME="$(node -p 'require("./package.json").name')"
|
|
8
|
+
VERSION="$(node -p 'require("./package.json").version')"
|
|
9
|
+
|
|
10
|
+
if [[ "$PACKAGE_NAME" != "appback-remoteagent" ]]; then
|
|
11
|
+
echo "Unexpected package name: $PACKAGE_NAME" >&2
|
|
12
|
+
exit 1
|
|
13
|
+
fi
|
|
14
|
+
|
|
15
|
+
if [[ -n "$(git status --porcelain)" ]]; then
|
|
16
|
+
echo "Working tree is not clean. Commit and push before publishing." >&2
|
|
17
|
+
git status --short >&2
|
|
18
|
+
exit 1
|
|
19
|
+
fi
|
|
20
|
+
|
|
21
|
+
echo "Publishing $PACKAGE_NAME@$VERSION"
|
|
22
|
+
echo
|
|
23
|
+
echo "npm identity:"
|
|
24
|
+
npm whoami
|
|
25
|
+
echo
|
|
26
|
+
echo "npm owners:"
|
|
27
|
+
npm owner ls "$PACKAGE_NAME"
|
|
28
|
+
echo
|
|
29
|
+
|
|
30
|
+
npm run check
|
|
31
|
+
npm run build
|
|
32
|
+
|
|
33
|
+
TARBALL="$(npm pack --silent)"
|
|
34
|
+
cleanup() {
|
|
35
|
+
rm -f "$TARBALL"
|
|
36
|
+
}
|
|
37
|
+
trap cleanup EXIT
|
|
38
|
+
|
|
39
|
+
echo
|
|
40
|
+
echo "Publishing tarball: $TARBALL"
|
|
41
|
+
REMOTEAGENT_PUBLISH_GUARD_OK=1 npm publish "$TARBALL" --access public
|
|
42
|
+
|
|
43
|
+
echo
|
|
44
|
+
echo "Verifying registry version:"
|
|
45
|
+
npm view "$PACKAGE_NAME" version
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
|
|
4
|
+
usage() {
|
|
5
|
+
echo "Usage: npm run release:version -- <patch|minor|major>" >&2
|
|
6
|
+
echo "Example: npm run release:version -- patch" >&2
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
if [[ $# -ne 1 ]]; then
|
|
10
|
+
usage
|
|
11
|
+
exit 1
|
|
12
|
+
fi
|
|
13
|
+
|
|
14
|
+
case "$1" in
|
|
15
|
+
patch|minor|major)
|
|
16
|
+
;;
|
|
17
|
+
*)
|
|
18
|
+
usage
|
|
19
|
+
exit 1
|
|
20
|
+
;;
|
|
21
|
+
esac
|
|
22
|
+
|
|
23
|
+
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
24
|
+
cd "$ROOT"
|
|
25
|
+
|
|
26
|
+
npm version --no-git-tag-version "$1"
|
|
27
|
+
node -p "'RemoteAgent version is now ' + require('./package.json').version"
|
package/scripts/bump-version.sh
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
set -euo pipefail
|
|
3
|
-
|
|
4
|
-
if [ $# -ne 1 ]; then
|
|
5
|
-
echo "Usage: $0 <patch|minor|major>" >&2
|
|
6
|
-
exit 1
|
|
7
|
-
fi
|
|
8
|
-
|
|
9
|
-
case "$1" in
|
|
10
|
-
patch|minor|major)
|
|
11
|
-
;;
|
|
12
|
-
*)
|
|
13
|
-
echo "Release type must be one of: patch, minor, major" >&2
|
|
14
|
-
exit 1
|
|
15
|
-
;;
|
|
16
|
-
esac
|
|
17
|
-
|
|
18
|
-
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
19
|
-
export PATH="$HOME/.local/bin:$PATH"
|
|
20
|
-
cd "$ROOT_DIR"
|
|
21
|
-
|
|
22
|
-
npm version --no-git-tag-version "$1"
|
|
23
|
-
node -p "'RemoteAgent version is now ' + require('./package.json').version"
|