@moxuli/moremote 0.1.9 → 0.1.10

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
@@ -3,7 +3,7 @@
3
3
  Optional, independent Apache-2.0 computer companion for MoRemote and an **unmodified Paseo 0.15.3** daemon. Existing official-only clients keep working without this project or its cloud.
4
4
 
5
5
  Canonical repository/command: `moremote-cli`; public npm package:
6
- **`@moxuli/moremote`** (release **0.1.9**); source entry: `bin/moremote-cli.js`.
6
+ **`@moxuli/moremote`** (release **0.1.10**); source entry: `bin/moremote-cli.js`.
7
7
  There is no unscoped npm alias or automatic adoption of foreign/old state.
8
8
 
9
9
  ## Install the published package
@@ -17,7 +17,9 @@ Requires an available public package and a user-owned npm prefix; never use sudo
17
17
  or upgrade global Node/tools on this project's behalf. First installed-package
18
18
  `run` or explicit `service-install --yes` creates an independently owned private
19
19
  managed installation with automatic updates enabled. Source-checkout `run`
20
- alone stays manual. No command starts/upgrades the official daemon.
20
+ alone stays manual. When bound to a local `PASEO_HOME` (without `--target`),
21
+ `run` and the owned service automatically start or self-heal the local Paseo
22
+ daemon after a reboot or crash, while `stop` and `uninstall` leave Paseo untouched. No command upgrades or stops the official daemon.
21
23
 
22
24
  ## Build and foreground use
23
25
 
@@ -120,7 +122,7 @@ Endpoint cancellation/revocation uses authenticated encrypted controls and durab
120
122
 
121
123
  - `status` and `check` are redacted. Only explicit `check --connect` contacts the selected official daemon (read-only).
122
124
  - `setup --yes`: explicit automatic-enrollment/cloud opt-in plus only the owned per-user background service; no second user pairing or official changes. Existing custom authorities, phone records and update opt-out survive.
123
- - `service-install --yes`: explicit per-user LaunchAgent on macOS, systemd user unit on Linux, or least-privilege interactive-user **logon task** on Windows (not an administrator Windows Service). Foreground `run` needs none of these. No sudo/admin installation.
125
+ - `service-install --yes`: explicit per-user LaunchAgent on macOS, systemd user unit (with best-effort `loginctl enable-linger`) on Linux, or least-privilege interactive-user **logon task** on Windows (not an administrator Windows Service). Foreground `run` needs none of these. No sudo/admin installation.
124
126
  - `stop`: stop only the owned companion registration/runtime; never signal an official process. Linux/Windows registration remains available for a future login; macOS bootout leaves its owned plist available for explicit reinstallation.
125
127
  - `unpair --pair-id <exact-id>`: revoke one phone, leaving other phones unchanged. Stop the runtime first.
126
128
  - `cloud-disable`: stop the companion, persist local cloud-off and per-pair execution tombstones, then relay-revoke every own pairing when reachable. An unreachable relay is pending, not success; local execution remains off. Run again to retry relay revocation. Protected keys are retained for final read-only control/outcome audit; they do not restore execution authority.
@@ -136,8 +138,8 @@ Default CLI state uses `LOCALAPPDATA/MoRemoteCLI` on Windows, `~/Library/Applica
136
138
 
137
139
  [Docs](docs/README.md) · [Contributing](CONTRIBUTING.md) · [License](LICENSE) · [Notices](NOTICE)
138
140
 
139
- Public release prerequisites, existing-secret setup and exact verification commands:
140
- [releasing](docs/releasing.md). Checked-in workflows are not proof of a published package.
141
+ Use the [release runbook](docs/releasing.md) for `npm run release`, public
142
+ package verification and the separate App, cloud and website runbooks.
141
143
 
142
144
  Widgets and ordinary app/extension sends connect through Paseo and local device
143
145
  state. Optional remote Live Activity delivery shares the notification service;
package/dist/cli.js CHANGED
@@ -36,7 +36,7 @@ Usage: moremote-cli <command> [options]
36
36
  uninstall [--purge] --yes Remove own registration/install; purge deletes own keys/journal
37
37
  --data-dir <directory> Override CLI-only state
38
38
  --help | --version
39
- No command starts/stops/updates Paseo. Foreground run needs no installed service.
39
+ When bound to local PASEO_HOME, run/service automatically starts/heals Paseo after reboot or crash. No command stops or updates Paseo. Foreground run needs no installed service.
40
40
  `;
41
41
  const versionOnly = process.argv.length === 3 && process.argv[2] === '--version';
42
42
  const supportedNode = Number(process.versions.node.split('.')[0]) === 24 && Number(process.versions.node.split('.')[1]) >= 13;
@@ -128,6 +128,7 @@ async function main() {
128
128
  }
129
129
  if (action === 'setup') {
130
130
  let preparedEntry;
131
+ let lingerEnabled = null;
131
132
  await setupEnrollment(dir, { yes: !!args.yes, stopOwned: () => stopOwned(dir, definition), authenticate: async (current) => {
132
133
  const official = new OfficialClient(current);
133
134
  try {
@@ -142,9 +143,11 @@ async function main() {
142
143
  }, install: async () => {
143
144
  if (!preparedEntry)
144
145
  throw Error('SETUP_CAPABILITY_REQUIRED');
145
- await installService(currentDefinition(preparedEntry, dir));
146
+ ({ lingerEnabled } = await installService(currentDefinition(preparedEntry, dir)));
146
147
  } });
147
- console.log('MoRemote CLI automatic enrollment and owned per-user service enabled. Official Paseo unchanged.');
148
+ console.log('MoRemote CLI automatic enrollment, local Paseo autostart/recovery and owned per-user service enabled. Official data unchanged.');
149
+ if (lingerEnabled === false)
150
+ console.error('LINGER_NOT_ENABLED: run sudo loginctl enable-linger $USER for headless reboot autostart.');
148
151
  return;
149
152
  }
150
153
  if (action === 'configure') {
@@ -275,8 +278,10 @@ async function main() {
275
278
  throw Error('EXPLICIT_YES_REQUIRED');
276
279
  await stopped(dir);
277
280
  await saveConfig(dir, config);
278
- await installService(currentDefinition(await serviceEntry(dir), dir));
281
+ const { lingerEnabled } = await installService(currentDefinition(await serviceEntry(dir), dir));
279
282
  console.log('MoRemote CLI per-user managed login registration installed; automatic updates enabled unless opted out. Official service unchanged.');
283
+ if (lingerEnabled === false)
284
+ console.error('LINGER_NOT_ENABLED: run sudo loginctl enable-linger $USER for headless reboot autostart.');
280
285
  return;
281
286
  }
282
287
  if (action === 'auto-update') {
@@ -0,0 +1,62 @@
1
+ import type { Config } from './config.js';
2
+ export interface PaseoLauncher {
3
+ command: string;
4
+ argsPrefix: string[];
5
+ }
6
+ export interface PaseoStartResult {
7
+ ok: boolean;
8
+ code: string | null;
9
+ }
10
+ export interface PaseoWatchdogStatus {
11
+ state: 'idle' | 'recovering' | 'backoff' | 'unavailable';
12
+ recoveries: number;
13
+ lastCode: string | null;
14
+ }
15
+ export declare function canManageLocalPaseo(config: Config): boolean;
16
+ export declare function isPaseoPidAlive(paseoHome: string, now?: number): boolean;
17
+ export declare function resolvePaseoLauncher(env?: NodeJS.ProcessEnv, platform?: NodeJS.Platform, execPath?: string, home?: string): PaseoLauncher | null;
18
+ export declare function resolveSystemdRun(env?: NodeJS.ProcessEnv, systemDirs?: readonly string[]): string | null;
19
+ export declare function systemdRunSupportsNoExpand(systemdRun: string): boolean;
20
+ export declare function spawnPaseoStart(paseoHome: string, signal?: AbortSignal, options?: {
21
+ env?: NodeJS.ProcessEnv;
22
+ platform?: NodeJS.Platform;
23
+ execPath?: string;
24
+ home?: string;
25
+ timeoutMs?: number;
26
+ systemDirs?: readonly string[];
27
+ }): Promise<PaseoStartResult>;
28
+ export interface PaseoWatchdogOptions {
29
+ restartGraceMs?: number;
30
+ cooldownMs?: number;
31
+ missingBinaryCooldownMs?: number;
32
+ maxBackoffMs?: number;
33
+ clock?: () => number;
34
+ isAlive?: (paseoHome: string, now: number) => boolean;
35
+ startDaemon?: (paseoHome: string, signal?: AbortSignal) => Promise<PaseoStartResult>;
36
+ }
37
+ export declare class PaseoWatchdog {
38
+ private hasObservedLiveDaemon;
39
+ private pendingRecoverySince;
40
+ private consecutiveFailures;
41
+ private nextAttemptAt;
42
+ private recoveries;
43
+ private lastCode;
44
+ private state;
45
+ private readonly restartGraceMs;
46
+ private readonly cooldownMs;
47
+ private readonly missingBinaryCooldownMs;
48
+ private readonly maxBackoffMs;
49
+ private readonly clock;
50
+ private readonly isAlive;
51
+ private readonly startDaemon;
52
+ constructor(options?: PaseoWatchdogOptions);
53
+ onConnected(): void;
54
+ status(): PaseoWatchdogStatus;
55
+ ensureAfterConnectFailure(config: Config, options?: {
56
+ signal?: AbortSignal;
57
+ }): Promise<{
58
+ attempted: boolean;
59
+ started: boolean;
60
+ code: string | null;
61
+ }>;
62
+ }
@@ -0,0 +1,432 @@
1
+ import { spawn, spawnSync } from 'node:child_process';
2
+ import { accessSync, constants, lstatSync, readFileSync, realpathSync } from 'node:fs';
3
+ import { homedir, uptime } from 'node:os';
4
+ import { delimiter, dirname, join, resolve } from 'node:path';
5
+ const KNOWN_FILES = ['config.json', 'daemon-keypair.json', 'server-id', 'paseo.pid'];
6
+ const IDENTITY_PROOF_FILES = ['daemon-keypair.json', 'server-id', 'paseo.pid'];
7
+ const START_TIMEOUT_SECONDS = '15';
8
+ const SPAWN_TIMEOUT_MS = 20000;
9
+ const BOOT_TOLERANCE_MS = 5000;
10
+ function entryExists(path) {
11
+ try {
12
+ lstatSync(path);
13
+ return true;
14
+ }
15
+ catch (error) {
16
+ return !(error instanceof Error && 'code' in error && error.code === 'ENOENT');
17
+ }
18
+ }
19
+ function ownedRegularFile(path, maxBytes = 65536) {
20
+ try {
21
+ const stat = lstatSync(path);
22
+ if (!stat.isFile() || stat.isSymbolicLink() || stat.size > maxBytes)
23
+ return null;
24
+ if (typeof process.getuid === 'function' && stat.uid !== process.getuid())
25
+ return null;
26
+ const content = readFileSync(path, 'utf8');
27
+ return Buffer.byteLength(content) <= maxBytes ? content : null;
28
+ }
29
+ catch {
30
+ return null;
31
+ }
32
+ }
33
+ function ownedDirectory(path) {
34
+ try {
35
+ const stat = lstatSync(path);
36
+ if (!stat.isDirectory() || stat.isSymbolicLink())
37
+ return false;
38
+ if (typeof process.getuid === 'function' && stat.uid !== process.getuid())
39
+ return false;
40
+ return true;
41
+ }
42
+ catch {
43
+ return false;
44
+ }
45
+ }
46
+ export function canManageLocalPaseo(config) {
47
+ if (config.target)
48
+ return false;
49
+ if (!config.paseoHome || resolve(config.paseoHome) !== config.paseoHome)
50
+ return false;
51
+ if (!ownedDirectory(config.paseoHome))
52
+ return false;
53
+ for (const name of KNOWN_FILES) {
54
+ const full = join(config.paseoHome, name);
55
+ if (entryExists(full) && ownedRegularFile(full) === null)
56
+ return false;
57
+ }
58
+ const initialized = IDENTITY_PROOF_FILES.some(name => ownedRegularFile(join(config.paseoHome, name)) !== null);
59
+ if (!initialized)
60
+ return false;
61
+ if (config.daemonServerId) {
62
+ const serverId = ownedRegularFile(join(config.paseoHome, 'server-id'), 512)?.trim();
63
+ if (!serverId || serverId !== config.daemonServerId)
64
+ return false;
65
+ }
66
+ return true;
67
+ }
68
+ function currentLinuxBootId() {
69
+ if (process.platform !== 'linux')
70
+ return null;
71
+ try {
72
+ return readFileSync('/proc/sys/kernel/random/boot_id', 'utf8').trim() || null;
73
+ }
74
+ catch {
75
+ return null;
76
+ }
77
+ }
78
+ export function isPaseoPidAlive(paseoHome, now = Date.now()) {
79
+ const raw = ownedRegularFile(join(paseoHome, 'paseo.pid'), 65536);
80
+ if (!raw)
81
+ return false;
82
+ let parsed;
83
+ try {
84
+ const value = JSON.parse(raw);
85
+ if (!value || typeof value !== 'object' || Array.isArray(value))
86
+ return false;
87
+ parsed = value;
88
+ }
89
+ catch {
90
+ return false;
91
+ }
92
+ const pid = parsed.pid;
93
+ if (typeof pid !== 'number' || !Number.isSafeInteger(pid) || pid <= 1 || pid === process.pid)
94
+ return false;
95
+ const bootId = currentLinuxBootId();
96
+ if (typeof parsed.bootId === 'string' && bootId && parsed.bootId !== bootId)
97
+ return false;
98
+ if (typeof parsed.startedAt === 'string') {
99
+ const started = Date.parse(parsed.startedAt);
100
+ if (Number.isFinite(started) && started < now - uptime() * 1000 - BOOT_TOLERANCE_MS)
101
+ return false;
102
+ }
103
+ try {
104
+ process.kill(pid, 0);
105
+ return true;
106
+ }
107
+ catch (error) {
108
+ return !(error instanceof Error && 'code' in error && error.code === 'ESRCH');
109
+ }
110
+ }
111
+ function resolveOfficialJsEntry(candidate) {
112
+ try {
113
+ const real = realpathSync(candidate);
114
+ const normalized = real.replaceAll('\\', '/');
115
+ if (normalized.endsWith('/@getpaseo/cli/bin/paseo'))
116
+ return real;
117
+ return null;
118
+ }
119
+ catch {
120
+ return null;
121
+ }
122
+ }
123
+ function isExecutableFile(candidate) {
124
+ try {
125
+ const stat = lstatSync(candidate);
126
+ if (stat.isSymbolicLink()) {
127
+ const target = realpathSync(candidate);
128
+ if (!lstatSync(target).isFile())
129
+ return false;
130
+ }
131
+ else if (!stat.isFile())
132
+ return false;
133
+ if (process.platform !== 'win32')
134
+ accessSync(candidate, constants.X_OK);
135
+ return true;
136
+ }
137
+ catch {
138
+ return false;
139
+ }
140
+ }
141
+ function readNpmrcPrefix(rcPath, home, env) {
142
+ const raw = ownedRegularFile(rcPath, 65536);
143
+ if (!raw)
144
+ return null;
145
+ for (const line of raw.split(/\r?\n/)) {
146
+ const trimmed = line.trim();
147
+ if (!trimmed || trimmed.startsWith('#') || trimmed.startsWith(';'))
148
+ continue;
149
+ const eq = trimmed.indexOf('=');
150
+ if (eq < 0)
151
+ continue;
152
+ const key = trimmed.slice(0, eq).trim();
153
+ if (key !== 'prefix')
154
+ continue;
155
+ let value = trimmed.slice(eq + 1).trim();
156
+ if ((value.startsWith('"') && value.endsWith('"')) || (value.startsWith("'") && value.endsWith("'"))) {
157
+ value = value.slice(1, -1);
158
+ }
159
+ if (!value)
160
+ continue;
161
+ let unresolved = false;
162
+ value = value.replace(/\$\{([A-Za-z_][A-Za-z0-9_]*)\}/g, (_m, name) => {
163
+ const resolved = name === 'HOME' ? (env.HOME ?? home) : env[name];
164
+ if (resolved === undefined) {
165
+ unresolved = true;
166
+ return '';
167
+ }
168
+ return resolved;
169
+ });
170
+ if (unresolved || !value)
171
+ continue;
172
+ if (value === '~' || value.startsWith('~/') || value.startsWith('~\\')) {
173
+ value = join(home, value.slice(2));
174
+ }
175
+ return value;
176
+ }
177
+ return null;
178
+ }
179
+ export function resolvePaseoLauncher(env = process.env, platform = process.platform, execPath = process.execPath, home = homedir()) {
180
+ const dirs = [];
181
+ const seen = new Set();
182
+ const pushDir = (dir) => {
183
+ if (!dir)
184
+ return;
185
+ const resolved = resolve(dir);
186
+ if (!seen.has(resolved)) {
187
+ seen.add(resolved);
188
+ dirs.push(resolved);
189
+ }
190
+ };
191
+ const pushPrefix = (prefix) => {
192
+ if (!prefix)
193
+ return;
194
+ pushDir(platform === 'win32' ? prefix : join(prefix, 'bin'));
195
+ pushDir(prefix);
196
+ };
197
+ for (const part of (env.PATH ?? '').split(delimiter)) {
198
+ if (part)
199
+ pushDir(part);
200
+ }
201
+ pushDir(dirname(execPath));
202
+ pushPrefix(env.npm_config_prefix || env.NPM_CONFIG_PREFIX);
203
+ pushPrefix(readNpmrcPrefix(env.NPM_CONFIG_USERCONFIG || join(home, '.npmrc'), home, env));
204
+ if (env.NPM_CONFIG_GLOBALCONFIG)
205
+ pushPrefix(readNpmrcPrefix(env.NPM_CONFIG_GLOBALCONFIG, home, env));
206
+ if (platform === 'win32') {
207
+ pushDir(join(env.APPDATA || join(home, 'AppData', 'Roaming'), 'npm'));
208
+ }
209
+ else {
210
+ pushDir(join(home, '.npm-global', 'bin'));
211
+ pushDir(join(home, '.local', 'bin'));
212
+ pushDir('/opt/homebrew/bin');
213
+ pushDir('/usr/local/bin');
214
+ }
215
+ for (const dir of dirs) {
216
+ if (platform === 'win32') {
217
+ for (const candidate of [
218
+ join(dir, 'node_modules', '@getpaseo', 'cli', 'bin', 'paseo'),
219
+ join(dir, '..', 'lib', 'node_modules', '@getpaseo', 'cli', 'bin', 'paseo'),
220
+ join(dir, '..', 'node_modules', '@getpaseo', 'cli', 'bin', 'paseo'),
221
+ ]) {
222
+ const jsEntry = resolveOfficialJsEntry(candidate);
223
+ if (jsEntry)
224
+ return { command: execPath, argsPrefix: ['--disable-warning=DEP0040', jsEntry] };
225
+ }
226
+ const exe = join(dir, 'paseo.exe');
227
+ if (isExecutableFile(exe))
228
+ return { command: exe, argsPrefix: [] };
229
+ }
230
+ else {
231
+ const bin = join(dir, 'paseo');
232
+ if (isExecutableFile(bin)) {
233
+ const jsEntry = resolveOfficialJsEntry(bin);
234
+ if (jsEntry)
235
+ return { command: execPath, argsPrefix: ['--disable-warning=DEP0040', jsEntry] };
236
+ return { command: bin, argsPrefix: [] };
237
+ }
238
+ const jsEntry = resolveOfficialJsEntry(join(dir, '..', 'lib', 'node_modules', '@getpaseo', 'cli', 'bin', 'paseo'));
239
+ if (jsEntry)
240
+ return { command: execPath, argsPrefix: ['--disable-warning=DEP0040', jsEntry] };
241
+ }
242
+ }
243
+ return null;
244
+ }
245
+ export function resolveSystemdRun(env = process.env, systemDirs = ['/usr/bin', '/bin']) {
246
+ const candidates = [
247
+ ...(env.PATH ?? '').split(delimiter).filter(Boolean).map(dir => join(resolve(dir), 'systemd-run')),
248
+ ...systemDirs.map(dir => join(dir, 'systemd-run')),
249
+ ];
250
+ for (const candidate of candidates) {
251
+ if (isExecutableFile(candidate))
252
+ return candidate;
253
+ }
254
+ return null;
255
+ }
256
+ export function systemdRunSupportsNoExpand(systemdRun) {
257
+ try {
258
+ const res = spawnSync(systemdRun, ['--help'], {
259
+ stdio: ['ignore', 'pipe', 'pipe'],
260
+ shell: false,
261
+ windowsHide: true,
262
+ timeout: 2000,
263
+ encoding: 'utf8',
264
+ });
265
+ return res.status === 0 && (res.stdout ?? '').includes('--expand-environment');
266
+ }
267
+ catch {
268
+ return false;
269
+ }
270
+ }
271
+ export async function spawnPaseoStart(paseoHome, signal, options = {}) {
272
+ if (signal?.aborted)
273
+ return { ok: false, code: 'PASEO_START_ABORTED' };
274
+ const env = options.env ?? process.env;
275
+ const platform = options.platform ?? process.platform;
276
+ const execPath = options.execPath ?? process.execPath;
277
+ const launcher = resolvePaseoLauncher(env, platform, execPath, options.home);
278
+ if (!launcher)
279
+ return { ok: false, code: 'PASEO_CLI_NOT_FOUND' };
280
+ const nodeBin = dirname(execPath);
281
+ const pathParts = (env.PATH ?? '').split(delimiter).filter(Boolean);
282
+ const nextPath = pathParts.includes(nodeBin) ? env.PATH : [nodeBin, ...pathParts].join(delimiter);
283
+ const childEnv = { ...env, PATH: nextPath, PASEO_HOME: paseoHome };
284
+ const baseArgs = [...launcher.argsPrefix, 'daemon', 'start', '--home', paseoHome, '--timeout', START_TIMEOUT_SECONDS];
285
+ let command = launcher.command;
286
+ let args = baseArgs;
287
+ if (platform === 'linux' && env.INVOCATION_ID) {
288
+ const systemdRun = resolveSystemdRun(env, options.systemDirs);
289
+ if (!systemdRun)
290
+ return { ok: false, code: 'PASEO_ISOLATION_UNAVAILABLE' };
291
+ const noExpand = systemdRunSupportsNoExpand(systemdRun);
292
+ if (!noExpand && [launcher.command, ...baseArgs].some(part => part.includes('$'))) {
293
+ return { ok: false, code: 'PASEO_ISOLATION_UNAVAILABLE' };
294
+ }
295
+ command = systemdRun;
296
+ args = [
297
+ '--user',
298
+ '--scope',
299
+ '--quiet',
300
+ '--collect',
301
+ ...(noExpand ? ['--expand-environment=no'] : []),
302
+ '--',
303
+ launcher.command,
304
+ ...baseArgs,
305
+ ];
306
+ }
307
+ return new Promise(resolvePromise => {
308
+ let settled = false;
309
+ let outputBytes = 0;
310
+ const child = spawn(command, args, {
311
+ stdio: ['ignore', 'pipe', 'pipe'],
312
+ shell: false,
313
+ windowsHide: true,
314
+ env: childEnv,
315
+ });
316
+ const finish = (result) => {
317
+ if (settled)
318
+ return;
319
+ settled = true;
320
+ clearTimeout(timer);
321
+ signal?.removeEventListener('abort', onAbort);
322
+ resolvePromise(result);
323
+ };
324
+ const onAbort = () => {
325
+ for (const stream of [child.stdout, child.stderr])
326
+ stream?.destroy();
327
+ child.unref();
328
+ finish({ ok: false, code: 'PASEO_START_ABORTED' });
329
+ };
330
+ const timer = setTimeout(() => {
331
+ if (child.exitCode === null && child.signalCode === null)
332
+ child.kill('SIGKILL');
333
+ finish({ ok: false, code: 'PASEO_START_TIMEOUT' });
334
+ }, options.timeoutMs ?? SPAWN_TIMEOUT_MS);
335
+ timer.unref();
336
+ signal?.addEventListener('abort', onAbort, { once: true });
337
+ for (const stream of [child.stdout, child.stderr]) {
338
+ stream?.on('data', (chunk) => {
339
+ outputBytes += chunk.byteLength;
340
+ if (outputBytes > 65536) {
341
+ stream.destroy();
342
+ }
343
+ });
344
+ }
345
+ child.once('error', () => finish({ ok: false, code: 'PASEO_START_FAILED' }));
346
+ child.once('close', code => {
347
+ finish(code === 0 ? { ok: true, code: null } : { ok: false, code: 'PASEO_START_FAILED' });
348
+ });
349
+ });
350
+ }
351
+ export class PaseoWatchdog {
352
+ hasObservedLiveDaemon = false;
353
+ pendingRecoverySince = null;
354
+ consecutiveFailures = 0;
355
+ nextAttemptAt = 0;
356
+ recoveries = 0;
357
+ lastCode = null;
358
+ state = 'idle';
359
+ restartGraceMs;
360
+ cooldownMs;
361
+ missingBinaryCooldownMs;
362
+ maxBackoffMs;
363
+ clock;
364
+ isAlive;
365
+ startDaemon;
366
+ constructor(options = {}) {
367
+ this.restartGraceMs = options.restartGraceMs ?? 4000;
368
+ this.cooldownMs = options.cooldownMs ?? 10000;
369
+ this.missingBinaryCooldownMs = options.missingBinaryCooldownMs ?? 60000;
370
+ this.maxBackoffMs = options.maxBackoffMs ?? 300000;
371
+ this.clock = options.clock ?? Date.now;
372
+ this.isAlive = options.isAlive ?? isPaseoPidAlive;
373
+ this.startDaemon = options.startDaemon ?? ((home, signal) => spawnPaseoStart(home, signal));
374
+ }
375
+ onConnected() {
376
+ this.hasObservedLiveDaemon = true;
377
+ this.pendingRecoverySince = null;
378
+ this.consecutiveFailures = 0;
379
+ this.nextAttemptAt = 0;
380
+ this.lastCode = null;
381
+ this.state = 'idle';
382
+ }
383
+ status() {
384
+ return { state: this.state, recoveries: this.recoveries, lastCode: this.lastCode };
385
+ }
386
+ async ensureAfterConnectFailure(config, options = {}) {
387
+ if (options.signal?.aborted)
388
+ return { attempted: false, started: false, code: null };
389
+ if (!canManageLocalPaseo(config)) {
390
+ this.state = 'idle';
391
+ this.lastCode = null;
392
+ return { attempted: false, started: false, code: null };
393
+ }
394
+ const now = this.clock();
395
+ if (this.isAlive(config.paseoHome, now)) {
396
+ this.state = 'recovering';
397
+ this.lastCode = 'PASEO_STARTING';
398
+ return { attempted: false, started: false, code: 'PASEO_STARTING' };
399
+ }
400
+ if (this.hasObservedLiveDaemon) {
401
+ if (this.pendingRecoverySince === null)
402
+ this.pendingRecoverySince = now;
403
+ if (now - this.pendingRecoverySince < this.restartGraceMs) {
404
+ this.state = 'recovering';
405
+ this.lastCode = 'PASEO_RESTART_GRACE';
406
+ return { attempted: false, started: false, code: 'PASEO_RESTART_GRACE' };
407
+ }
408
+ }
409
+ if (now < this.nextAttemptAt) {
410
+ return { attempted: false, started: false, code: this.lastCode };
411
+ }
412
+ const result = await this.startDaemon(config.paseoHome, options.signal);
413
+ if (result.ok) {
414
+ this.recoveries += 1;
415
+ this.consecutiveFailures = 0;
416
+ this.nextAttemptAt = this.clock() + this.cooldownMs;
417
+ this.lastCode = null;
418
+ this.state = 'recovering';
419
+ return { attempted: true, started: true, code: null };
420
+ }
421
+ if (result.code === 'PASEO_START_ABORTED') {
422
+ return { attempted: true, started: false, code: result.code };
423
+ }
424
+ this.consecutiveFailures += 1;
425
+ const baseDelay = result.code === 'PASEO_CLI_NOT_FOUND' ? this.missingBinaryCooldownMs : this.cooldownMs;
426
+ const delay = Math.min(baseDelay * 2 ** (this.consecutiveFailures - 1), this.maxBackoffMs);
427
+ this.nextAttemptAt = this.clock() + delay;
428
+ this.lastCode = result.code ?? 'PASEO_START_FAILED';
429
+ this.state = result.code === 'PASEO_CLI_NOT_FOUND' ? 'unavailable' : 'backoff';
430
+ return { attempted: true, started: false, code: this.lastCode };
431
+ }
432
+ }
package/dist/runtime.js CHANGED
@@ -19,6 +19,7 @@ import { inspectResource } from './resources.js';
19
19
  import { LiveActivityPublisher } from './live-activity.js';
20
20
  import { publishEvents } from './event-publication.js';
21
21
  import { encryptNotificationPreview } from './notification-preview.js';
22
+ import { PaseoWatchdog } from './paseo-watchdog.js';
22
23
  function stableId(value) { const h = createHash('sha256').update(JSON.stringify(value)).digest('hex').slice(0, 32); return h.slice(0, 8) + '-' + h.slice(8, 12) + '-' + h.slice(12, 16) + '-' + h.slice(16, 20) + '-' + h.slice(20); }
23
24
  export async function queueAttention(journal, pair, event, now = Date.now(), includePreview = true) {
24
25
  if (event.timestamp + LIMITS.snapshotMs <= now || event.timestamp > now + LIMITS.futureMs)
@@ -99,7 +100,8 @@ export async function runRuntime(dir, version) {
99
100
  } };
100
101
  const parentGone = () => { draining = true; drainWake.abort(); };
101
102
  let detach, closeJournal;
102
- const release = await ownRuntime(dir, () => ({ stage, lastError, activePairs, version: version ?? null }), stop);
103
+ const watchdog = new PaseoWatchdog();
104
+ const release = await ownRuntime(dir, () => ({ stage, lastError, activePairs, version: version ?? null, paseoWatchdog: watchdog.status() }), stop);
103
105
  const enrollment = new LocalEnrollment(dir);
104
106
  try {
105
107
  if (!inspectResource(join(dir, 'config.json'), 'file', true))
@@ -244,8 +246,26 @@ export async function runRuntime(dir, version) {
244
246
  detach?.();
245
247
  await official?.close().catch(() => { });
246
248
  stage = 'connecting';
247
- official = new OfficialClient(config, journal);
248
- await official.connect();
249
+ const openOfficial = async () => { const client = new OfficialClient(config, journal); try {
250
+ await client.connect();
251
+ return client;
252
+ }
253
+ catch (error) {
254
+ await client.close().catch(() => { });
255
+ throw error;
256
+ } };
257
+ try {
258
+ official = await openOfficial();
259
+ }
260
+ catch (error) {
261
+ if (stopped || draining)
262
+ throw error;
263
+ const recovery = await watchdog.ensureAfterConnectFailure(config, { signal: controller.signal });
264
+ if (!recovery.started || stopped || draining)
265
+ throw error;
266
+ official = await openOfficial();
267
+ }
268
+ watchdog.onConnected();
249
269
  const serverId = official.info().serverId;
250
270
  if (!config.daemonServerId) {
251
271
  config.daemonServerId = serverId;
package/dist/service.d.ts CHANGED
@@ -4,6 +4,9 @@ export interface ServiceDefinition {
4
4
  platform: string;
5
5
  entry: string;
6
6
  }
7
+ export interface ServiceInstallResult {
8
+ lingerEnabled: boolean | null;
9
+ }
7
10
  export declare function serviceDefinition(platform: string, home: string, node: string, entry: string, data: string): ServiceDefinition;
8
11
  export declare function command(program: string, args: string[], capture?: boolean, timeout?: number): Promise<string>;
9
12
  export interface ServiceStatus {
@@ -12,7 +15,7 @@ export interface ServiceStatus {
12
15
  error?: string;
13
16
  }
14
17
  export declare function serviceStatus(def: ServiceDefinition): Promise<ServiceStatus>;
15
- export declare function installService(def: ServiceDefinition): Promise<void>;
18
+ export declare function installService(def: ServiceDefinition): Promise<ServiceInstallResult>;
16
19
  export declare function stopService(def: ServiceDefinition): Promise<void>;
17
20
  export declare function removeService(def: ServiceDefinition): Promise<void>;
18
21
  export declare function managedEntry(dir: string, version: string): Promise<string>;
package/dist/service.js CHANGED
@@ -14,9 +14,9 @@ function windowsArg(s) { return '"' + s.replace(/(\\*)"/g, '$1$1\\"').replace(/(
14
14
  export function serviceDefinition(platform, home, node, entry, data) {
15
15
  const marker = 'Managed by moremote-cli; per-user ownership v1; owner=' + createHash('sha256').update(data).digest('hex');
16
16
  if (platform === 'darwin')
17
- return { platform, entry, path: join(home, 'Library', 'LaunchAgents', 'com.moremote.cli.plist'), content: '<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"><plist version="1.0"><dict><key>Label</key><string>com.moremote.cli</string><key>Description</key><string>' + marker + '</string><key>ProgramArguments</key><array>' + [node, entry, 'run', '--data-dir', data].map(s => '<string>' + xml(s) + '</string>').join('') + '</array><key>RunAtLoad</key><true/><key>KeepAlive</key><true/><key>ProcessType</key><string>Background</string></dict></plist>\n' };
17
+ return { platform, entry, path: join(home, 'Library', 'LaunchAgents', 'com.moremote.cli.plist'), content: '<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"><plist version="1.0"><dict><key>Label</key><string>com.moremote.cli</string><key>Description</key><string>' + marker + '</string><key>ProgramArguments</key><array>' + [node, entry, 'run', '--data-dir', data].map(s => '<string>' + xml(s) + '</string>').join('') + '</array><key>RunAtLoad</key><true/><key>KeepAlive</key><true/><key>AbandonProcessGroup</key><true/><key>ProcessType</key><string>Background</string></dict></plist>\n' };
18
18
  if (platform === 'linux')
19
- return { platform, entry, path: join(process.env.XDG_CONFIG_HOME || join(home, '.config'), 'systemd', 'user', 'moremote-cli.service'), content: '[Unit]\nDescription=' + marker + '\n[Service]\nExecStart=' + [node, entry, 'run', '--data-dir', data].map(systemd).join(' ') + '\nRestart=on-failure\nRestartSec=5\n[Install]\nWantedBy=default.target\n' };
19
+ return { platform, entry, path: join(process.env.XDG_CONFIG_HOME || join(home, '.config'), 'systemd', 'user', 'moremote-cli.service'), content: '[Unit]\nDescription=' + marker + '\n[Service]\nExecStart=' + [node, entry, 'run', '--data-dir', data].map(systemd).join(' ') + '\nKillMode=process\nRestart=on-failure\nRestartSec=5\n[Install]\nWantedBy=default.target\n' };
20
20
  if (platform === 'win32')
21
21
  return { platform, entry, path: join(data, 'moremote-cli-task.xml'), content: '<?xml version="1.0" encoding="UTF-16"?><Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task"><RegistrationInfo><Description>' + marker + '</Description></RegistrationInfo><Triggers><LogonTrigger><UserId>' + xml(userInfo().username) + '</UserId><Enabled>true</Enabled></LogonTrigger></Triggers><Principals><Principal id="CurrentUser"><UserId>' + xml(userInfo().username) + '</UserId><LogonType>InteractiveToken</LogonType><RunLevel>LeastPrivilege</RunLevel></Principal></Principals><Settings><MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy><ExecutionTimeLimit>PT0S</ExecutionTimeLimit><Enabled>true</Enabled></Settings><Actions Context="CurrentUser"><Exec><Command>' + xml(node) + '</Command><Arguments>' + xml([entry, 'run', '--data-dir', data].map(windowsArg).join(' ')) + '</Arguments></Exec></Actions></Task>' };
22
22
  throw Error('UNSUPPORTED_SERVICE_PLATFORM');
@@ -223,14 +223,23 @@ export async function installService(def) {
223
223
  if (status.registration === 'registered')
224
224
  await stopService(def);
225
225
  await writeDefinition(def);
226
- if (def.platform === 'darwin')
226
+ if (def.platform === 'darwin') {
227
227
  await command('launchctl', ['bootstrap', 'gui/' + process.getuid(), def.path]);
228
- else if (def.platform === 'linux') {
228
+ return { lingerEnabled: null };
229
+ }
230
+ if (def.platform === 'linux') {
229
231
  await command('systemctl', ['--user', 'daemon-reload']);
230
232
  await command('systemctl', ['--user', 'enable', '--now', 'moremote-cli.service']);
233
+ try {
234
+ await command('loginctl', ['--no-ask-password', 'enable-linger', userInfo().username], true, 5000);
235
+ return { lingerEnabled: true };
236
+ }
237
+ catch (error) {
238
+ return { lingerEnabled: missing(error) ? null : false };
239
+ }
231
240
  }
232
- else
233
- await registerWindowsService(def);
241
+ await registerWindowsService(def);
242
+ return { lingerEnabled: null };
234
243
  }
235
244
  export async function stopService(def) {
236
245
  const status = await serviceStatus(def);
package/docs/README.md CHANGED
@@ -1,10 +1,8 @@
1
1
  # Documentation index
2
2
 
3
3
  **MoRemote CLI**: independent optional `moremote-cli` repository/command,
4
- public npm `@moxuli/moremote`0.1.1, over unmodified Paseo.
5
- Activity/widget support is local unreleased source, not part of that published
6
- package. [[STATE]] separates targeted local evidence from native/device/live
7
- cloud acceptance, which remains pending for these new surfaces; cloud is disabled.
4
+ public npm `@moxuli/moremote`, over unmodified Paseo. See [STATE](STATE.md)
5
+ for the public release and the separate host, device and cloud acceptance records.
8
6
 
9
7
  - [Current state and external gates](STATE.md)
10
8
  - [Architecture](specs/01-architecture.md)
@@ -13,7 +11,7 @@ cloud acceptance, which remains pending for these new surfaces; cloud is disable
13
11
  - [Endpoint controls, occurrences and receipt lifecycle](specs/04-control-and-receipt-lifecycle.md)
14
12
  - [Endpoint and lifecycle behavior](specs/05-endpoint-and-lifecycle.md)
15
13
  - [Managed updates and compatibility](specs/06-managed-updates.md)
16
- - [Public release and existing publishing-secret prerequisites](releasing.md)
14
+ - [Public release operator and receiver verification](releasing.md)
17
15
  - [Managed-update decision](decisions/0001-managed-updates.md)
18
16
  - [Managed-update implementation plan](plans/2026-11-10-managed-updates.md)
19
17
  - [Configuration registry](configuration.md)
package/docs/STATE.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # Project state
2
2
 
3
+ ## Public 0.1.9 and release operator
4
+
5
+ Source `3dfb1986db11cbcdb91f00e5656aef5a2fe18aa6` is public as `v0.1.9`.
6
+ Main CI `44493968482` and the hosted release `44493968462` succeeded.
7
+ The release operator's read-only receiver check downloaded the npm archive and
8
+ both GitHub assets anonymously, verified all checksums and installed the same
9
+ archive in an isolated prefix. Its CLI printed 0.1.9. SHA256 of the
10
+ 171,886-byte public archive is
11
+ `7671890a2e14db8b91bf63f782be7ea2d3f18b6bf495e4d519a33675d8fee954`.
12
+
13
+ See [the release runbook](releasing.md) for operator commands, required
14
+ authorization and sibling procedures. A fresh local check passed all 286 tests,
15
+ typecheck and build. The isolated packaged-upgrade smoke accepted the compatible
16
+ candidate and rolled back the failing candidate. The operator is source-only
17
+ at this checkpoint.
18
+
3
19
  ## Public0.1.8 — 2026-11-15
4
20
 
5
21
  Reviewed sourced545c23 is public as0.1.8. All3OS CI43718667202 and release
@@ -21,8 +21,16 @@ enrollment, explicit setup installs/verifies the exact current version before
21
21
  enabling the feature, then moves active/bootstrap while retaining previous
22
22
  packages, pairs/custom origin and the independent auto-update opt-out.
23
23
  `SETUP_CURRENT_PACKAGE_UNAVAILABLE`/`SETUP_CAPABILITY_REQUIRED` are failures,
24
- never enabled success or an older-package fallback. Nothing patches/upgrades
25
- official Paseo or global tools. This capability requires CLI0.1.4 or later.
24
+ never enabled success or an older-package fallback. Nothing patches/upgrades/stops
25
+ official Paseo or global tools. When configured without `--target` against an
26
+ initialized local `paseoHome` matching `daemonServerId` (fail-closed on missing or
27
+ unsafe `server-id`), the runtime includes a local Paseo watchdog (`paseo daemon start
28
+ --home <paseoHome> --timeout 15`, resolving `PATH`, node sibling bins, and `.npmrc`
29
+ prefix without shell wrappers) for login/boot autostart and crash recovery after a
30
+ brief restart grace window; Linux units set `KillMode=process`, isolate watchdog
31
+ launches in a transient `systemd-run --user --scope` when running under systemd, and
32
+ attempt non-interactive `loginctl --no-ask-password enable-linger`; macOS LaunchAgents
33
+ set `AbandonProcessGroup`. This capability requires CLI0.1.4 or later.
26
34
 
27
35
  The custom-domain default applies only when `apiOrigin` is absent. Every saved
28
36
  origin remains authoritative, including the former default
@@ -0,0 +1,51 @@
1
+ # CLI release operator plan
2
+
3
+ The operator connects existing package checks and the tag-triggered workflow
4
+ to a separate public receiver check. Keep the hosted publish workflow,
5
+ credential scope and deterministic packer.
6
+
7
+ 1. **Ground the workflow.** Read the 0.1.8 release journal and the historical
8
+ 0.1.9 release recap. Query the actual hosted jobs with
9
+ `gh run view 44493968482 -R moxuli/moremote-cli` and
10
+ `gh run view 44493968462 -R moxuli/moremote-cli`. The output must show
11
+ successful CI and Release runs for source `3dfb198` and tag `v0.1.9`.
12
+ Use those receipts to document pending and complete states.
13
+ 2. **Implement preflight and authorized publication.** Add
14
+ `scripts/release-operator.mjs` and the `npm run release` entry.
15
+ `plan` and `prepare` consume a full reviewed SHA on a clean checkout.
16
+ They print the exact tag and, after local checks and deterministic packing,
17
+ the archive SHA256. `publish` also consumes that tag as explicit
18
+ confirmation. It verifies the exact upstream SHA and three-platform CI,
19
+ writes an exclusive per-tag intent in the Git common directory, pushes
20
+ one annotated tag and reads it back. A prior intent fences an uncertain
21
+ request across operator processes.
22
+ 3. **Implement receiver acceptance.** `verify` consumes the published SHA,
23
+ tag and optional prepared SHA256. It reports the exact hosted run,
24
+ artifact size, digest and installed frontend version. GitHub repository,
25
+ release and asset GETs and npm reads are anonymous. GitHub's hosted-run and
26
+ release metadata checks use the existing GitHub CLI credentials. A failed
27
+ run can establish recovery only when the exact hosted npm publish completed
28
+ and GitHub Release creation was the sole failed step.
29
+ 4. **Verify the change.** Add `tests/release-operator.test.ts` with synthetic
30
+ provider responses for wrong commits, published/partial states, retry
31
+ fences, anonymous asset redirects and integrity mismatches.
32
+ Run `node --import tsx --test tests/release-validation.test.ts tests/release-operator.test.ts`
33
+ for nine passing release checks. Run `npm ci --ignore-scripts`,
34
+ `npm run check` and `npm run smoke:upgrade` for clean install,
35
+ typecheck, tests, build and the compatible/failed packaged update outcomes.
36
+ Exercise the existing release with
37
+ `npm run release -- verify --sha 3dfb1986db11cbcdb91f00e5656aef5a2fe18aa6 --tag v0.1.9 --expect-sha256 7671890a2e14db8b91bf63f782be7ea2d3f18b6bf495e4d519a33675d8fee954`.
38
+ Expect 171,886 matching bytes and the isolated CLI reporting 0.1.9.
39
+ 5. **Document and land.** Update `docs/releasing.md`, index, README, AGENTS,
40
+ changelog and STATE with actual results. Review the release scope and
41
+ implementation, then run `git diff --check`. Land the reviewed changes
42
+ with a normal source commit. This plan authorizes source verification only.
43
+
44
+ ## Verification record
45
+
46
+ The complete check passed 286 tests, typecheck and build. The packaged
47
+ upgrade smoke verified compatible activation and rollback of a failing
48
+ candidate. The operator independently verified the real public `v0.1.9`
49
+ archives and a disposable installation. Separate scope and quality
50
+ reviews confirmed identity, authorization and receiver evidence using fresh
51
+ Codex contexts after the cross-vendor route was unavailable.
package/docs/releasing.md CHANGED
@@ -1,6 +1,8 @@
1
1
  # Releasing @moxuli/moremote
2
2
 
3
- Repository: public `moxuli/moremote-cli`; package: public `@moxuli/moremote`; executable: `moremote-cli`. No unscoped alias is published. Credentials never belong in this repository, release assets or package contents.
3
+ The public `moxuli/moremote-cli` repository releases `@moxuli/moremote`.
4
+ The installed command is `moremote-cli`. Keep credentials outside the
5
+ repository, release assets and package contents.
4
6
 
5
7
  ## Existing publishing authority
6
8
 
@@ -10,18 +12,109 @@ The release job uses environment `npm-release`. Only its publish step receives t
10
12
 
11
13
  Configure the release environment to accept authorized `v*` tags. Branch/tag protection and required reviewers remain owner-governed settings. Token replacement/revocation is a separate account action. npm trusted publishing remains an optional future migration, not an additional prerequisite for the current owner's existing setup.
12
14
 
13
- ## Normal release
15
+ ## Prepare and publish
14
16
 
15
- 1. Keep dependencies pinned. Preserve the compatibility tuple only when storage/wire rollback is genuinely safe. On Node24.13.0 run `npm ci --ignore-scripts`, `npm run check`, `npm run smoke:upgrade`, `node scripts/release.mjs validate vX.Y.Z` and `node scripts/release.mjs pack vX.Y.Z`.
16
- 2. Review public contents and changelog. Update package.json and only lockfile root versions, commit through review, then push the exact owner-authorized stable `vX.Y.Z` tag. Prerelease/range/mismatched tags fail closed. Generated tarballs/SHA256SUMS are release outputs, not tracked source.
17
- 3. The GitHub-hosted Ubuntu24.04 job validates repository/tag/package/lock identity, checks/builds and produces two byte-identical packs. It publishes the exact tested tarball with the existing scoped secret, public access and GitHub provenance. Node24.13.0 is pinned; no global toolchain upgrade occurs.
18
- 4. Only after npm accepts publication does the job create a GitHub Release with the identical tarball and SHA256SUMS. Release concurrency is serialized and never cancels an in-flight publish. Only this job receives contents:write/id-token:write for release/provenance; ordinary CI is contents:read. Checkout credentials are not persisted and release builds use no cache.
19
- 5. If npm fails, no successful GitHub Release is created. If npm accepted but GitHub creation failed, **do not republish or retag**: recover the exact published bytes, validate integrity against the accepted build artifact/checksum, and recover the GitHub Release under the owner's release authorization. npm versions are immutable.
20
- 6. npm can acknowledge submission while processing a new package. Require an independent anonymous registry read and installation of the public exact version before claiming availability. Do not repeatedly republish while processing. Record the receiver result in STATE.
17
+ Use Node 24.13.0, Git and an authenticated GitHub CLI. Review the public
18
+ package and changelog, update `package.json` and only the lockfile root
19
+ version fields, then land the approved candidate on `main`. Preserve the
20
+ compatibility tuple when storage and wire rollback are genuinely safe.
21
+ Set `RELEASE_SHA` to the full reviewed Git SHA and `RELEASE_TAG` to the tag
22
+ matching the exact stable package version, such as `v0.1.9`.
21
23
 
22
- The first workstation bootstrap publication is0.1.0. Subsequent automated releases must use a genuinely new version; neither workflow reruns nor corrected documentation can replace published0.1.0 bytes.
24
+ ```sh
25
+ npm run release -- plan --sha "$RELEASE_SHA"
26
+ npm run release -- prepare --sha "$RELEASE_SHA"
27
+ ```
23
28
 
24
- CI also runs portable behavior and isolated real packaged-upgrade smoke on macOS/Linux/Windows. It never installs a real login service. Native platform managers and physical APNs are separate acceptance gates.
29
+ `plan` is offline. `prepare` clones the reviewed commit into a temporary
30
+ checkout with isolated npm configuration and runs dependency installation,
31
+ the complete check, packaged upgrade smoke and deterministic packer. Keep the
32
+ printed SHA256 with the acceptance evidence.
33
+
34
+ On macOS the isolated directory uses a short path under `/tmp`. The native
35
+ smoke tests create Unix sockets and can hit the path limit when nested under
36
+ the long, per-user temporary directory.
37
+
38
+ After the owner authorizes that commit and tag, trigger the existing release
39
+ workflow with the command below. The operator requires a clean reviewed
40
+ checkout, the exact remote main SHA, a passing three-platform CI run, an active
41
+ release workflow, an unused remote tag, and a 404 for the exact registry
42
+ version. It repeats the local preparation and remote checks before pushing
43
+ one annotated tag from its temporary checkout. Before sending, it records
44
+ that attempt under `moremote-release-intents/` in the Git common directory.
45
+ Any existing intent for the tag blocks another push even if the remote tag
46
+ is still absent. Worktrees sharing a common directory share this guard.
47
+ Locate it with `git rev-parse --path-format=absolute --git-common-dir`.
48
+
49
+ ```sh
50
+ npm run release -- publish --sha "$RELEASE_SHA" --confirm "$RELEASE_TAG"
51
+ ```
52
+
53
+ GitHub Actions validates the tag and package identity, checks the source,
54
+ builds two byte-identical packs and publishes the tested tarball to npm.
55
+ After npm accepts it, the workflow creates the public GitHub Release with
56
+ the same tarball and `SHA256SUMS`. Only the hosted publish step has the scoped
57
+ npm secret. The operator's tag result confirms the trigger.
58
+
59
+ ## Verify the public release
60
+
61
+ ```sh
62
+ npm run release -- verify --sha "$RELEASE_SHA" --tag "$RELEASE_TAG"
63
+ npm run release -- verify --sha "$RELEASE_SHA" --tag "$RELEASE_TAG" --expect-sha256 "$RELEASE_DIGEST"
64
+ ```
65
+
66
+ Use the second form with `RELEASE_DIGEST` set to the retained SHA256. Both forms
67
+ check the remote tag and exact hosted release run, read the exact
68
+ version anonymously from npm, read the public GitHub repository, release and
69
+ both assets without GitHub credentials, compare the tarball and checksum,
70
+ and install the verified archive into a disposable npm prefix with scripts
71
+ disabled. The isolated frontend must report the exact
72
+ version. Record the source SHA, hosted CI and release run URLs, npm/GitHub
73
+ artifact SHA256 and installation evidence in [STATE](STATE.md) or the journal.
74
+ Managed-runtime activation, platform service admission and physical APNs
75
+ delivery have their own evidence.
76
+
77
+ ## Recovery and observed releases
78
+
79
+ - [v0.1.9](https://github.com/moxuli/moremote-cli/releases/tag/v0.1.9)
80
+ resolves to `3dfb1986db11cbcdb91f00e5656aef5a2fe18aa6`. The
81
+ [main CI](https://github.com/moxuli/moremote-cli/actions/runs/44493968482)
82
+ and [release run](https://github.com/moxuli/moremote-cli/actions/runs/44493968462)
83
+ passed. The npm and GitHub archives match at 171,886 bytes with SHA256
84
+ `7671890a2e14db8b91bf63f782be7ea2d3f18b6bf495e4d519a33675d8fee954`.
85
+ - [v0.1.8 acceptance](journal/2026-11-15-title-provenance-release.md) records
86
+ an early failing Ubuntu CI run. The tag was withheld until the fixed SHA
87
+ passed all three hosted platforms. npm then briefly returned 404 while
88
+ processing the accepted upload. The receiver waited for the exact version,
89
+ verified matching bytes and installed it with empty npm configuration.
90
+ - If the tag push times out or the registry version is pending, inspect the
91
+ existing remote tag, release job and npm version. Resume the read-only
92
+ verification once the provider exposes the package. Preserve the local
93
+ intent as evidence. Only move its record aside under release authorization
94
+ after GitHub and npm authoritatively confirm the attempt had no effect.
95
+ - If npm has accepted a version and GitHub Release creation failed, recover
96
+ the same validated public bytes and checksum under the original release
97
+ authorization. Re-run only `verify`. It accepts the original hosted
98
+ failure after reading the exact tag and SHA and confirming that npm
99
+ publication succeeded and GitHub Release creation was the only failed
100
+ step. Recovered GitHub assets must pass the same anonymous reads, digest
101
+ checks and isolated install as a normal release. npm versions and the
102
+ established tag are immutable.
103
+ - For a faulty public package, retain the existing artifacts and coordinate a
104
+ new reviewed version. The packaged-upgrade smoke tests the managed
105
+ runtime's own fallback to its previous local version.
106
+
107
+ See the [operator implementation plan](plans/2026-11-19-release-operator.md)
108
+ for the integration and verification order.
109
+
110
+ ## Related releases
111
+
112
+ Use the corresponding repository's procedure for other components.
113
+
114
+ - [MoRemote iOS App](https://github.com/moxuli/moremote/blob/main/docs/releasing.md)
115
+ - [MoRemote Cloud](https://github.com/moxuli/moremote-cloud/blob/main/docs/releasing.md)
116
+ - [MoRemote website](https://github.com/moxuli/moremote-site/blob/main/docs/releasing.md)
117
+ - [Moxuli Studio website](https://github.com/moxuli/moxuli-site/blob/main/docs/releasing.md)
25
118
 
26
119
  ## Verified action pins and primary sources
27
120
 
@@ -6,9 +6,12 @@
6
6
  ## Purpose and boundaries
7
7
 
8
8
  MoRemote CLI (`moremote-cli`) is the optional open-source enhancement layer for MoRemote.
9
- It consumes official Paseo interfaces. It never patches, forks, replaces or
10
- silently updates Paseo. The official daemon continues owning agents, sessions,
11
- tools and approvals. Baseline MoRemote works without this companion.
9
+ It consumes official Paseo interfaces. It never patches, forks, replaces, stops or
10
+ silently updates Paseo. When bound to a local initialized `PASEO_HOME` (without
11
+ an explicit `--target`), the companion runtime may launch `paseo daemon start`
12
+ after a reboot or crash so paired phones can reconnect automatically. The official
13
+ daemon continues owning agents, sessions, tools and approvals. Baseline MoRemote
14
+ works without this companion.
12
15
 
13
16
  This repository must build and run independently of the app repository, any
14
17
  private automation workspace or a developer's personal machine configuration.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moxuli/moremote",
3
- "version": "0.1.9",
3
+ "version": "0.1.10",
4
4
  "description": "Optional encrypted notification and scoped-action companion for Paseo",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -44,6 +44,7 @@
44
44
  "typecheck": "tsc --noEmit",
45
45
  "test": "node --import tsx --test tests/*.test.ts",
46
46
  "check": "npm run typecheck && npm test && npm run build",
47
+ "release": "node scripts/release-operator.mjs",
47
48
  "smoke:upgrade": "node scripts/smoke-upgrade.mjs"
48
49
  },
49
50
  "dependencies": {