@nordhavnhq/runner 0.96.0 → 0.97.0
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/cli/update.js +28 -16
- package/dist/index.js +3 -1
- package/dist/runtime/up.js +1 -3
- package/dist/update/install.d.ts +9 -0
- package/dist/update/install.js +31 -1
- package/dist/update/manifest.d.ts +14 -4
- package/dist/update/manifest.js +30 -11
- package/dist/update/policy.js +8 -8
- package/dist/update/updater.d.ts +8 -0
- package/dist/update/updater.js +14 -1
- package/dist/version.json +3 -3
- package/node_modules/@nordhavnhq/runner-browser/package.json +1 -1
- package/node_modules/@nordhavnhq/runner-runtime/package.json +1 -1
- package/package.json +3 -3
package/dist/cli/update.js
CHANGED
|
@@ -2,7 +2,7 @@ import { loadConfig } from '../config.js';
|
|
|
2
2
|
import { isAlive, spawnDetachedAgent } from '../runtime/daemon.js';
|
|
3
3
|
import { VERSION, bold, cyan, dim, green, red, yellow, isNewerVersion, showHelp, helpOpt } from '../utils/format.js';
|
|
4
4
|
import { detectInstallKind } from '../update/install-kind.js';
|
|
5
|
-
import { performUpdate } from '../update/install.js';
|
|
5
|
+
import { installNotWritable, ownershipFix, performUpdate } from '../update/install.js';
|
|
6
6
|
import { fetchManifest, manifestUrl } from '../update/manifest.js';
|
|
7
7
|
import { liveRuntimes, signalRestart } from '../update/peers.js';
|
|
8
8
|
import { autoUpdateOptedOut, updateHint } from '../update/policy.js';
|
|
@@ -22,13 +22,9 @@ export async function update(ctx) {
|
|
|
22
22
|
const check = ctx.cmdArgs.includes('--check');
|
|
23
23
|
const force = ctx.cmdArgs.includes('--force');
|
|
24
24
|
console.log('');
|
|
25
|
+
// The release comes from npm: no pairing needed. The config only says whether auto update is off.
|
|
25
26
|
const config = await loadConfig();
|
|
26
|
-
const url = manifestUrl(
|
|
27
|
-
if (!url) {
|
|
28
|
-
console.log(red(' Not configured. Run `nordhavn init` first.\n'));
|
|
29
|
-
process.exit(1);
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
27
|
+
const url = manifestUrl();
|
|
32
28
|
const kind = detectInstallKind();
|
|
33
29
|
let manifest;
|
|
34
30
|
try {
|
|
@@ -41,15 +37,7 @@ export async function update(ctx) {
|
|
|
41
37
|
}
|
|
42
38
|
const newer = isNewerVersion(manifest.version, VERSION);
|
|
43
39
|
if (check) {
|
|
44
|
-
|
|
45
|
-
console.log(` ${dim('installed')} ${bold(VERSION)}`);
|
|
46
|
-
console.log(` ${dim('latest')} ${bold(manifest.version)}${manifest.releasedAt ? dim(` (${manifest.releasedAt})`) : ''}`);
|
|
47
|
-
console.log(` ${dim('install')} ${kind.kind === 'global' ? `global ${dim(kind.prefix)}` : kind.kind}`);
|
|
48
|
-
console.log(` ${dim('auto update')} ${auto}`);
|
|
49
|
-
console.log('');
|
|
50
|
-
console.log(newer
|
|
51
|
-
? ` ${yellow('update available')}: run ${cyan(updateHint(kind.kind))}\n`
|
|
52
|
-
: ` ${green('up to date')}\n`);
|
|
40
|
+
printCheck(kind, manifest, autoUpdateOptedOut(config), newer);
|
|
53
41
|
return;
|
|
54
42
|
}
|
|
55
43
|
if (kind.kind !== 'global') {
|
|
@@ -62,6 +50,13 @@ export async function update(ctx) {
|
|
|
62
50
|
console.log(green(` Up to date (${VERSION}).\n`));
|
|
63
51
|
return;
|
|
64
52
|
}
|
|
53
|
+
const notWritable = installNotWritable(kind.packageDir);
|
|
54
|
+
if (notWritable) {
|
|
55
|
+
console.log(red(` Cannot update: ${notWritable}.`));
|
|
56
|
+
console.log(dim(` Give the install back to your user once, then auto update works too:\n ${ownershipFix(kind.packageDir)}\n`));
|
|
57
|
+
process.exit(1);
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
65
60
|
const runtimes = liveRuntimes();
|
|
66
61
|
const busy = runtimes.filter(r => r.activeRuns > 0);
|
|
67
62
|
if (busy.length > 0 && !force) {
|
|
@@ -88,6 +83,23 @@ export async function update(ctx) {
|
|
|
88
83
|
await moveRuntimes(runtimes);
|
|
89
84
|
console.log('');
|
|
90
85
|
}
|
|
86
|
+
function printCheck(kind, manifest, optedOut, newer) {
|
|
87
|
+
const notWritable = kind.kind === 'global' ? installNotWritable(kind.packageDir) : null;
|
|
88
|
+
const auto = kind.kind !== 'global'
|
|
89
|
+
? `no (${kind.reason})`
|
|
90
|
+
: optedOut ? 'off' : notWritable ? `no (${notWritable})` : 'on';
|
|
91
|
+
console.log(` ${dim('installed')} ${bold(VERSION)}`);
|
|
92
|
+
console.log(` ${dim('latest')} ${bold(manifest.version)}${manifest.releasedAt ? dim(` (${manifest.releasedAt})`) : ''}`);
|
|
93
|
+
console.log(` ${dim('source')} ${dim(manifestUrl())}`);
|
|
94
|
+
console.log(` ${dim('install')} ${kind.kind === 'global' ? `global ${dim(kind.prefix)}` : kind.kind}`);
|
|
95
|
+
console.log(` ${dim('auto update')} ${auto}`);
|
|
96
|
+
if (notWritable && kind.kind === 'global')
|
|
97
|
+
console.log(dim(` fix: ${ownershipFix(kind.packageDir)}`));
|
|
98
|
+
console.log('');
|
|
99
|
+
console.log(newer
|
|
100
|
+
? ` ${yellow('update available')}: run ${cyan(updateHint(kind.kind))}\n`
|
|
101
|
+
: ` ${green('up to date')}\n`);
|
|
102
|
+
}
|
|
91
103
|
/**
|
|
92
104
|
* Running runtimes onto the new version. One that knows self-update gets the
|
|
93
105
|
* restart signal and restarts once idle. An older detached one is stopped and
|
package/dist/index.js
CHANGED
|
@@ -45,6 +45,8 @@ const aliases = {
|
|
|
45
45
|
'agent:list': 'agent',
|
|
46
46
|
'-h': 'help',
|
|
47
47
|
'--help': 'help',
|
|
48
|
+
// Only as the command itself: `nordhavn up -v` stays the debug flag.
|
|
49
|
+
'-v': 'version',
|
|
48
50
|
'--version': 'version',
|
|
49
51
|
'-V': 'version',
|
|
50
52
|
};
|
|
@@ -110,7 +112,7 @@ function printRootHelp() {
|
|
|
110
112
|
[cyan('unlink'), 'Remove the pairing and its agent'],
|
|
111
113
|
[cyan('agent'), 'Show the agent of this runner'],
|
|
112
114
|
[`${cyan('update')} ${dim('[--check]')}`, 'Install the latest runner release'],
|
|
113
|
-
[cyan('--version')
|
|
115
|
+
[`${cyan('-v')}, ${cyan('--version')}`, 'Print the installed version'],
|
|
114
116
|
] },
|
|
115
117
|
{ title: 'Folders', rows: [
|
|
116
118
|
[cyan('folder ls'), 'List folders and the projects they expose'],
|
package/dist/runtime/up.js
CHANGED
|
@@ -35,7 +35,6 @@ import { detectInstallKind } from '../update/install-kind.js';
|
|
|
35
35
|
import { createRuntimeUpdater, updateHint } from '../update/policy.js';
|
|
36
36
|
import { RESTART_SIGNAL, canSignalRestart } from '../update/peers.js';
|
|
37
37
|
import { RESTART_EXIT_CODE, SUPERVISED_ENV, supervise } from '../update/supervisor.js';
|
|
38
|
-
import { UPDATE_CHECK_INTERVAL_MS } from '../update/updater.js';
|
|
39
38
|
/** The host tools, warming the codebase index after a git tool moved a checkout's files. */
|
|
40
39
|
const toolProvider = withSonarPrewarm(hostToolProvider);
|
|
41
40
|
export async function up(opts) {
|
|
@@ -1179,8 +1178,7 @@ export async function up(opts) {
|
|
|
1179
1178
|
process.on(RESTART_SIGNAL, () => updater.requestRestart());
|
|
1180
1179
|
// Besides the studio's announcement on connect: look for a release now and
|
|
1181
1180
|
// then, for a runtime that stays connected for days.
|
|
1182
|
-
|
|
1183
|
-
setInterval(() => { void updater.check(); }, UPDATE_CHECK_INTERVAL_MS).unref();
|
|
1181
|
+
updater.schedule();
|
|
1184
1182
|
// Heartbeat: every 30s, ping live sockets and recycle stale ones.
|
|
1185
1183
|
// Connecting sockets are left alone - connectWebSocket's own connect-timeout
|
|
1186
1184
|
// guards a stalled handshake. Closed sockets are already being reconnected
|
package/dist/update/install.d.ts
CHANGED
|
@@ -5,6 +5,15 @@ import { type ReleaseManifest } from './manifest.js';
|
|
|
5
5
|
* crashed install must not block every later one.
|
|
6
6
|
*/
|
|
7
7
|
export declare function acquireLock(path: string, staleMs?: number): (() => void) | null;
|
|
8
|
+
/**
|
|
9
|
+
* Why npm cannot replace the install as the current user, or null when it can:
|
|
10
|
+
* npm needs write access to the package folder and the scope folder around it.
|
|
11
|
+
* A runner installed with `sudo npm i -g` is owned by root, and every attempt
|
|
12
|
+
* would end in EACCES.
|
|
13
|
+
*/
|
|
14
|
+
export declare function installNotWritable(packageDir: string, platform?: NodeJS.Platform): string | null;
|
|
15
|
+
/** The command that gives a root-owned install back to the current user. */
|
|
16
|
+
export declare function ownershipFix(packageDir: string): string;
|
|
8
17
|
/**
|
|
9
18
|
* Arguments for the global install. npm 12 blocks install scripts unless
|
|
10
19
|
* allowed; ffmpeg's platform package only marks its binary executable, which
|
package/dist/update/install.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { execFile, execFileSync } from 'node:child_process';
|
|
2
|
-
import { closeSync, existsSync, mkdirSync, mkdtempSync, openSync, readFileSync, realpathSync, rmSync, statSync, writeFileSync, writeSync } from 'node:fs';
|
|
2
|
+
import { accessSync, closeSync, constants as fsConstants, existsSync, mkdirSync, mkdtempSync, openSync, readFileSync, realpathSync, rmSync, statSync, writeFileSync, writeSync } from 'node:fs';
|
|
3
3
|
import { tmpdir } from 'node:os';
|
|
4
4
|
import { basename, delimiter, dirname, join } from 'node:path';
|
|
5
5
|
import { isNewerVersion } from '../utils/format.js';
|
|
@@ -78,6 +78,35 @@ async function waitForLock(path, timeoutMs = LOCK_WAIT_MS, pollMs = 1000) {
|
|
|
78
78
|
await new Promise(resolve => setTimeout(resolve, pollMs));
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
|
+
/**
|
|
82
|
+
* Why npm cannot replace the install as the current user, or null when it can:
|
|
83
|
+
* npm needs write access to the package folder and the scope folder around it.
|
|
84
|
+
* A runner installed with `sudo npm i -g` is owned by root, and every attempt
|
|
85
|
+
* would end in EACCES.
|
|
86
|
+
*/
|
|
87
|
+
export function installNotWritable(packageDir, platform = process.platform) {
|
|
88
|
+
if (platform === 'win32')
|
|
89
|
+
return null;
|
|
90
|
+
for (const dir of [dirname(packageDir), packageDir]) {
|
|
91
|
+
try {
|
|
92
|
+
accessSync(dir, fsConstants.W_OK);
|
|
93
|
+
}
|
|
94
|
+
catch {
|
|
95
|
+
return `${dir} is not writable by this user (installed with sudo?)`;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
return null;
|
|
99
|
+
}
|
|
100
|
+
function assertWritable(packageDir) {
|
|
101
|
+
const reason = installNotWritable(packageDir);
|
|
102
|
+
if (reason)
|
|
103
|
+
throw new Error(`${reason}; fix: ${ownershipFix(packageDir)}`);
|
|
104
|
+
}
|
|
105
|
+
/** The command that gives a root-owned install back to the current user. */
|
|
106
|
+
export function ownershipFix(packageDir) {
|
|
107
|
+
const user = process.env.USER || '$(whoami)';
|
|
108
|
+
return `sudo chown -R ${user} "${dirname(packageDir)}"`;
|
|
109
|
+
}
|
|
81
110
|
/**
|
|
82
111
|
* The npm that belongs to the node running this process, run through that
|
|
83
112
|
* node: the npm first on PATH may belong to another node (nvm) and install
|
|
@@ -158,6 +187,7 @@ export async function performUpdate(opts) {
|
|
|
158
187
|
const onDisk = readPackageVersion(opts.packageDir);
|
|
159
188
|
if (onDisk && !isNewerVersion(opts.manifest.version, onDisk))
|
|
160
189
|
return 'already-installed';
|
|
190
|
+
assertWritable(opts.packageDir);
|
|
161
191
|
opts.onStep?.(`downloading ${opts.manifest.url}`);
|
|
162
192
|
const data = await downloadTarball(opts.manifest);
|
|
163
193
|
work = mkdtempSync(join(tmpdir(), 'nordhavn-update-'));
|
|
@@ -2,12 +2,22 @@ export interface ReleaseManifest {
|
|
|
2
2
|
version: string;
|
|
3
3
|
url: string;
|
|
4
4
|
sha512: string;
|
|
5
|
-
size
|
|
5
|
+
/** Byte size of the tarball; the npm registry does not give it. */
|
|
6
|
+
size?: number;
|
|
6
7
|
releasedAt?: string;
|
|
7
8
|
}
|
|
8
|
-
/**
|
|
9
|
-
export declare
|
|
10
|
-
/**
|
|
9
|
+
/** The package the runner is published as. */
|
|
10
|
+
export declare const RUNNER_PACKAGE = "@nordhavnhq/runner";
|
|
11
|
+
/**
|
|
12
|
+
* Where this runner reads the latest release from: the npm registry
|
|
13
|
+
* (NORDHAVN_UPDATE_REGISTRY overrides it), or NORDHAVN_UPDATE_MANIFEST_URL
|
|
14
|
+
* when set (tests, staging).
|
|
15
|
+
*/
|
|
16
|
+
export declare function manifestUrl(env?: NodeJS.ProcessEnv): string;
|
|
17
|
+
/**
|
|
18
|
+
* Validates a parsed manifest, the bucket format or an npm registry version
|
|
19
|
+
* document; throws with what is wrong.
|
|
20
|
+
*/
|
|
11
21
|
export declare function parseManifest(data: unknown): ReleaseManifest;
|
|
12
22
|
export declare function fetchManifest(url: string): Promise<ReleaseManifest>;
|
|
13
23
|
/** Base64 sha512 of the bytes, the manifest's format. */
|
package/dist/update/manifest.js
CHANGED
|
@@ -1,15 +1,20 @@
|
|
|
1
1
|
import { createHash } from 'node:crypto';
|
|
2
|
-
|
|
2
|
+
/** The package the runner is published as. */
|
|
3
|
+
export const RUNNER_PACKAGE = '@nordhavnhq/runner';
|
|
4
|
+
const DEFAULT_REGISTRY = 'https://registry.npmjs.org';
|
|
3
5
|
const FETCH_TIMEOUT_MS = 30_000;
|
|
4
6
|
const DOWNLOAD_TIMEOUT_MS = 10 * 60_000;
|
|
5
|
-
/**
|
|
6
|
-
|
|
7
|
+
/**
|
|
8
|
+
* Where this runner reads the latest release from: the npm registry
|
|
9
|
+
* (NORDHAVN_UPDATE_REGISTRY overrides it), or NORDHAVN_UPDATE_MANIFEST_URL
|
|
10
|
+
* when set (tests, staging).
|
|
11
|
+
*/
|
|
12
|
+
export function manifestUrl(env = process.env) {
|
|
7
13
|
const override = env.NORDHAVN_UPDATE_MANIFEST_URL?.trim();
|
|
8
14
|
if (override)
|
|
9
15
|
return override;
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
return studioUrl.replace(/\/+$/, '') + MANIFEST_PATH;
|
|
16
|
+
const registry = (env.NORDHAVN_UPDATE_REGISTRY?.trim() || DEFAULT_REGISTRY).replace(/\/+$/, '');
|
|
17
|
+
return `${registry}/${RUNNER_PACKAGE.replace('/', '%2f')}/latest`;
|
|
13
18
|
}
|
|
14
19
|
/** Plain http is only accepted for a server on this machine (a test server). */
|
|
15
20
|
function isAllowedUrl(raw) {
|
|
@@ -24,18 +29,32 @@ function isAllowedUrl(raw) {
|
|
|
24
29
|
return true;
|
|
25
30
|
return url.protocol === 'http:' && ['localhost', '127.0.0.1', '[::1]'].includes(url.hostname);
|
|
26
31
|
}
|
|
27
|
-
/**
|
|
32
|
+
/** An npm registry version document as a manifest: only a sha512 integrity is accepted. */
|
|
33
|
+
function fromNpmDoc(doc) {
|
|
34
|
+
const integrity = typeof doc.dist?.integrity === 'string' ? doc.dist.integrity : '';
|
|
35
|
+
const sha512 = integrity.split(/\s+/).find(i => i.startsWith('sha512-'))?.slice('sha512-'.length);
|
|
36
|
+
return {
|
|
37
|
+
version: typeof doc.version === 'string' ? doc.version : undefined,
|
|
38
|
+
url: typeof doc.dist?.tarball === 'string' ? doc.dist.tarball : undefined,
|
|
39
|
+
sha512,
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Validates a parsed manifest, the bucket format or an npm registry version
|
|
44
|
+
* document; throws with what is wrong.
|
|
45
|
+
*/
|
|
28
46
|
export function parseManifest(data) {
|
|
29
|
-
|
|
30
|
-
if (!m || typeof m !== 'object')
|
|
47
|
+
if (!data || typeof data !== 'object')
|
|
31
48
|
throw new Error('manifest is not an object');
|
|
49
|
+
const npm = 'dist' in data;
|
|
50
|
+
const m = npm ? fromNpmDoc(data) : data;
|
|
32
51
|
if (typeof m.version !== 'string' || !/^\d+\.\d+\.\d+/.test(m.version))
|
|
33
52
|
throw new Error('manifest has no valid version');
|
|
34
53
|
if (typeof m.url !== 'string' || !isAllowedUrl(m.url))
|
|
35
54
|
throw new Error('manifest url must be https');
|
|
36
55
|
if (typeof m.sha512 !== 'string' || !m.sha512)
|
|
37
56
|
throw new Error('manifest has no sha512');
|
|
38
|
-
if (typeof m.size !== 'number' || !Number.isFinite(m.size) || m.size <= 0)
|
|
57
|
+
if (!npm && (typeof m.size !== 'number' || !Number.isFinite(m.size) || m.size <= 0))
|
|
39
58
|
throw new Error('manifest has no valid size');
|
|
40
59
|
return { version: m.version, url: m.url, sha512: m.sha512, size: m.size, releasedAt: m.releasedAt };
|
|
41
60
|
}
|
|
@@ -53,7 +72,7 @@ export function sha512Base64(data) {
|
|
|
53
72
|
}
|
|
54
73
|
/** Throws unless the bytes are exactly what the manifest describes. */
|
|
55
74
|
export function verifyTarball(data, manifest) {
|
|
56
|
-
if (data.byteLength !== manifest.size) {
|
|
75
|
+
if (manifest.size !== undefined && data.byteLength !== manifest.size) {
|
|
57
76
|
throw new Error(`tarball size ${data.byteLength} does not match the manifest (${manifest.size})`);
|
|
58
77
|
}
|
|
59
78
|
const expected = manifest.sha512.replace(/^sha512-/, '');
|
package/dist/update/policy.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { VERSION } from '../utils/format.js';
|
|
2
2
|
import { currentPackageDir, detectInstallKind, readPackageVersion, runningPackageDir } from './install-kind.js';
|
|
3
|
-
import { performUpdate } from './install.js';
|
|
3
|
+
import { installNotWritable, performUpdate } from './install.js';
|
|
4
4
|
import { fetchManifest, manifestUrl } from './manifest.js';
|
|
5
5
|
import { signalRestart } from './peers.js';
|
|
6
6
|
import { Updater } from './updater.js';
|
|
@@ -19,20 +19,16 @@ export function updateHint(kind) {
|
|
|
19
19
|
export function createRuntimeUpdater(opts) {
|
|
20
20
|
const kind = detectInstallKind();
|
|
21
21
|
const optedOut = autoUpdateOptedOut(opts.config);
|
|
22
|
-
const url = manifestUrl(
|
|
22
|
+
const url = manifestUrl();
|
|
23
23
|
const manualReason = kind.kind !== 'global'
|
|
24
24
|
? kind.reason
|
|
25
|
-
: optedOut ? 'automatic updates are off' :
|
|
25
|
+
: optedOut ? 'automatic updates are off' : installNotWritable(kind.packageDir);
|
|
26
26
|
const packageDir = kind.kind === 'global' ? kind.packageDir : runningPackageDir();
|
|
27
27
|
const updater = new Updater({
|
|
28
28
|
currentVersion: VERSION,
|
|
29
29
|
enabled: manualReason === null,
|
|
30
30
|
isIdle: opts.isIdle,
|
|
31
|
-
fetchLatest: () =>
|
|
32
|
-
if (!url)
|
|
33
|
-
return Promise.reject(new Error('no manifest url'));
|
|
34
|
-
return fetchManifest(url);
|
|
35
|
-
},
|
|
31
|
+
fetchLatest: () => fetchManifest(url),
|
|
36
32
|
install: async (manifest) => {
|
|
37
33
|
if (kind.kind !== 'global')
|
|
38
34
|
throw new Error(`not a global install: ${kind.reason}`);
|
|
@@ -45,5 +41,9 @@ export function createRuntimeUpdater(opts) {
|
|
|
45
41
|
restart: opts.restart,
|
|
46
42
|
log: opts.log,
|
|
47
43
|
});
|
|
44
|
+
// A release install that cannot update itself (root-owned, opted out) says so
|
|
45
|
+
// once at start; a linked or dev run is expected not to.
|
|
46
|
+
if (kind.kind === 'global' && manualReason)
|
|
47
|
+
opts.log(`no automatic update: ${manualReason}`);
|
|
48
48
|
return { updater, kind, manualReason };
|
|
49
49
|
}
|
package/dist/update/updater.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import type { ReleaseManifest } from './manifest.js';
|
|
2
2
|
import type { PerformUpdateResult } from './install.js';
|
|
3
|
+
/** How often a running runtime asks npm for a newer release (a small JSON request). */
|
|
3
4
|
export declare const UPDATE_CHECK_INTERVAL_MS: number;
|
|
5
|
+
/** The first check after start: the studio's announcement on connect may be missing or behind. */
|
|
6
|
+
export declare const UPDATE_FIRST_CHECK_MS: number;
|
|
4
7
|
export interface UpdaterDeps {
|
|
5
8
|
currentVersion: string;
|
|
6
9
|
/** Global install and not opted out: install on its own. Otherwise only `requestRestart` acts. */
|
|
@@ -29,6 +32,11 @@ export declare class Updater {
|
|
|
29
32
|
private now;
|
|
30
33
|
/** A newer version was announced (the studio's `connected` frame). */
|
|
31
34
|
offer(version: string | null | undefined): Promise<void>;
|
|
35
|
+
/**
|
|
36
|
+
* Checks npm shortly after start, then every UPDATE_CHECK_INTERVAL_MS, for
|
|
37
|
+
* a runtime that stays up for days. Nothing when updates are not enabled.
|
|
38
|
+
*/
|
|
39
|
+
schedule(): void;
|
|
32
40
|
/** The periodic check: read the manifest itself. */
|
|
33
41
|
check(): Promise<void>;
|
|
34
42
|
/** A chat or task ended: an install or restart that waited for idle may go now. */
|
package/dist/update/updater.js
CHANGED
|
@@ -6,7 +6,10 @@ import { isNewerVersion } from '../utils/format.js';
|
|
|
6
6
|
// chat or task is running, and restarts into it once idle again (a run may
|
|
7
7
|
// have started during the install). A failure is logged and left for the next
|
|
8
8
|
// trigger; the process keeps running the version it has.
|
|
9
|
-
|
|
9
|
+
/** How often a running runtime asks npm for a newer release (a small JSON request). */
|
|
10
|
+
export const UPDATE_CHECK_INTERVAL_MS = 60 * 60_000;
|
|
11
|
+
/** The first check after start: the studio's announcement on connect may be missing or behind. */
|
|
12
|
+
export const UPDATE_FIRST_CHECK_MS = 2 * 60_000;
|
|
10
13
|
/** After a failed attempt, triggers within this window are ignored (the periodic check is not). */
|
|
11
14
|
const FAILURE_BACKOFF_MS = 60 * 60_000;
|
|
12
15
|
export class Updater {
|
|
@@ -32,6 +35,16 @@ export class Updater {
|
|
|
32
35
|
this.target = version;
|
|
33
36
|
return this.attempt(false);
|
|
34
37
|
}
|
|
38
|
+
/**
|
|
39
|
+
* Checks npm shortly after start, then every UPDATE_CHECK_INTERVAL_MS, for
|
|
40
|
+
* a runtime that stays up for days. Nothing when updates are not enabled.
|
|
41
|
+
*/
|
|
42
|
+
schedule() {
|
|
43
|
+
if (!this.deps.enabled)
|
|
44
|
+
return;
|
|
45
|
+
setTimeout(() => { void this.check(); }, UPDATE_FIRST_CHECK_MS).unref();
|
|
46
|
+
setInterval(() => { void this.check(); }, UPDATE_CHECK_INTERVAL_MS).unref();
|
|
47
|
+
}
|
|
35
48
|
/** The periodic check: read the manifest itself. */
|
|
36
49
|
async check() {
|
|
37
50
|
if (!this.deps.enabled || this.installing || this.restartPending)
|
package/dist/version.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nordhavnhq/runner-browser",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.97.0",
|
|
4
4
|
"description": "Nordhavn OS agent browser: Playwright sessions, the browser tools, the confirm-first guard and the live view, for the runner and the browser host",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"type": "module",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nordhavnhq/runner",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.97.0",
|
|
4
4
|
"description": "Nordhavn OS runner CLI: runs agents headless on a host and supplies the host tools",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"publishConfig": {
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
"@ffmpeg-installer/ffmpeg": "^1.1.0",
|
|
26
26
|
"@vscode/ripgrep": "^1.18.0",
|
|
27
27
|
"mysql2": "^3.24.6",
|
|
28
|
-
"@nordhavnhq/runner-runtime": "0.
|
|
29
|
-
"@nordhavnhq/runner-browser": "0.
|
|
28
|
+
"@nordhavnhq/runner-runtime": "0.97.0",
|
|
29
|
+
"@nordhavnhq/runner-browser": "0.97.0"
|
|
30
30
|
},
|
|
31
31
|
"bundleDependencies": [
|
|
32
32
|
"@nordhavnhq/runner-runtime",
|