@jian-ai/remote-control 0.8.5 → 1.0.1
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 +6 -12
- package/bin/jian-remote.mjs +19 -3
- package/macos/computer-helper +0 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -5,25 +5,19 @@ over outbound HTTPS polling.
|
|
|
5
5
|
|
|
6
6
|
## Install
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
npm install -g @jian-ai/remote-control
|
|
10
|
-
jian-remote install --gateway https://gateway.example --machine MACHINE_UUID --token WORKER_TOKEN
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
Or without a global install:
|
|
8
|
+
The Remote Control page of the panel shows this command with your values filled in:
|
|
14
9
|
|
|
15
10
|
```sh
|
|
16
|
-
|
|
17
|
-
--gateway https://gateway.example
|
|
18
|
-
--machine MACHINE_UUID \
|
|
19
|
-
--token WORKER_TOKEN
|
|
11
|
+
npm install -g @jian-ai/remote-control && jian-remote install \
|
|
12
|
+
--gateway https://gateway.example --machine MACHINE_UUID --token WORKER_TOKEN
|
|
20
13
|
```
|
|
21
14
|
|
|
22
15
|
## Update
|
|
23
16
|
|
|
17
|
+
The worker keeps itself on the gateway's version. To update by hand:
|
|
18
|
+
|
|
24
19
|
```sh
|
|
25
|
-
|
|
26
|
-
# or: jian-remote update [--version 0.6.0]
|
|
20
|
+
jian-remote update [--version 0.6.0]
|
|
27
21
|
```
|
|
28
22
|
|
|
29
23
|
Reads `~/.config/jian-remote` (no token, machine id, or gateway flags), installs a compatible
|
package/bin/jian-remote.mjs
CHANGED
|
@@ -69,7 +69,7 @@ export function parseCliInvocation(argv = args) {
|
|
|
69
69
|
* Stamped to the release tag on npm publish and when the gateway serves this script.
|
|
70
70
|
* Compatibility with the gateway requires the same major.minor (see versionsCompatible).
|
|
71
71
|
*/
|
|
72
|
-
export const PACKAGE_VERSION = '0.
|
|
72
|
+
export const PACKAGE_VERSION = '1.0.1';
|
|
73
73
|
|
|
74
74
|
/** Soft stdout/stderr caps while capturing a command (chars). Gateway schema matches these. */
|
|
75
75
|
const STDOUT_CAP = 400_000;
|
|
@@ -2175,6 +2175,9 @@ async function postResult(base, headers, result) {
|
|
|
2175
2175
|
async function run() {
|
|
2176
2176
|
await acquireWorkerLock();
|
|
2177
2177
|
let stopMacIdle = () => {};
|
|
2178
|
+
// Set once the gateway is known: tells it this worker is stopping, so the panel shows the
|
|
2179
|
+
// machine offline at once instead of when its last poll grows old.
|
|
2180
|
+
let sayGoodbye = async () => {};
|
|
2178
2181
|
const shutdown = () => {
|
|
2179
2182
|
try {
|
|
2180
2183
|
stopMacIdle();
|
|
@@ -2190,8 +2193,10 @@ async function run() {
|
|
|
2190
2193
|
};
|
|
2191
2194
|
for (const signal of ['SIGINT', 'SIGTERM']) {
|
|
2192
2195
|
process.once(signal, () => {
|
|
2193
|
-
|
|
2194
|
-
|
|
2196
|
+
void sayGoodbye().finally(() => {
|
|
2197
|
+
shutdown();
|
|
2198
|
+
process.exit(0);
|
|
2199
|
+
});
|
|
2195
2200
|
});
|
|
2196
2201
|
}
|
|
2197
2202
|
process.once('exit', shutdown);
|
|
@@ -2224,6 +2229,17 @@ async function run() {
|
|
|
2224
2229
|
...(capabilities.length ? { 'x-jian-remote-capabilities': capabilities.join(',') } : {}),
|
|
2225
2230
|
});
|
|
2226
2231
|
const base = `${config.gateway}/v1/remote/worker/${config.machineId}`;
|
|
2232
|
+
// Best effort and brief: a stop must not hang on an unreachable gateway.
|
|
2233
|
+
sayGoodbye = () =>
|
|
2234
|
+
fetch(`${base}/disconnect`, {
|
|
2235
|
+
method: 'POST',
|
|
2236
|
+
headers: pollHeaders(),
|
|
2237
|
+
redirect: 'error',
|
|
2238
|
+
signal: AbortSignal.timeout(2000),
|
|
2239
|
+
}).then(
|
|
2240
|
+
() => {},
|
|
2241
|
+
() => {},
|
|
2242
|
+
);
|
|
2227
2243
|
// Match the gateway worker (including major.minor skew) before polling so fleets do not
|
|
2228
2244
|
// crash-loop on refuse without attempting a self-update first.
|
|
2229
2245
|
const gatewayVersion = await reconcileWorkerWithGateway(config, base, pollHeaders());
|
package/macos/computer-helper
CHANGED
|
Binary file
|