@moxuli/moremote 0.1.0 → 0.1.2

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/runtime.js CHANGED
@@ -13,12 +13,15 @@ import { occurrenceBinding } from './bindings.js';
13
13
  import { projectSnapshot } from './projection.js';
14
14
  import { ownRuntime } from './control.js';
15
15
  import { LIMITS, object } from './limits.js';
16
+ import { ActivityPublisher, ActivityWorkLane, widgetFingerprint } from './activity.js';
16
17
  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); }
17
18
  export async function queueAttention(journal, pair, event, now = Date.now()) {
18
19
  if (event.timestamp + LIMITS.snapshotMs <= now || event.timestamp > now + LIMITS.futureMs)
19
20
  return;
20
21
  const payload = { agentId: event.agentId, kind: event.kind, timestamp: event.timestamp, ...(event.requestId ? { requestId: event.requestId } : {}), ...(event.requestBinding ? { requestBinding: event.requestBinding } : {}) };
21
- const id = stableId([pair.pairId, event.agentId, event.kind, event.requestId || '', event.sourceFingerprint || '', event.requestId && !event.sourceFingerprint ? null : event.timestamp]);
22
+ // A bound request notice belongs to its exact occurrence, not its snapshot clock.
23
+ // Keep the legacy source identity for callers without authoritative occurrences.
24
+ const id = event.requestId && event.occurrence ? stableId([pair.pairId, event.agentId, event.kind, event.requestId, 'occurrence', event.occurrence.occurrenceId]) : stableId([pair.pairId, event.agentId, event.kind, event.requestId || '', event.sourceFingerprint || '', event.requestId && !event.sourceFingerprint ? null : event.timestamp]);
22
25
  const issuedAt = event.timestamp;
23
26
  const envelope = await sealEnvelope(decode(pair.rootKey, 32), { version: 1, pairId: pair.pairId, id, channel: 'attention', issuedAt, expiresAt: issuedAt + LIMITS.snapshotMs }, payload);
24
27
  const topic = await presenceTopic(decode(pair.rootKey, 32), pair.pairId, event.agentId);
@@ -82,6 +85,8 @@ export async function runRuntime(dir, version) {
82
85
  const parentGone = () => { draining = true; drainWake.abort(); };
83
86
  let detach, closeJournal;
84
87
  const release = await ownRuntime(dir, () => ({ stage, lastError, activePairs, version: version ?? null }), stop);
88
+ const activityLane = new ActivityWorkLane();
89
+ let activityFailure = null, activityPairCursor = 0;
85
90
  try {
86
91
  const journal = new OperationJournal(join(dir, 'journal.sqlite'));
87
92
  closeJournal = () => journal.close();
@@ -98,6 +103,7 @@ export async function runRuntime(dir, version) {
98
103
  let measuredAt = 0;
99
104
  let snapshot;
100
105
  const statePublications = new Map();
106
+ const activityPublisher = new ActivityPublisher();
101
107
  const retryStates = new Map();
102
108
  const pollOrigins = new Set();
103
109
  process.once('SIGINT', stop);
@@ -108,7 +114,8 @@ export async function runRuntime(dir, version) {
108
114
  journal.cleanup(now);
109
115
  const config = await loadConfig(dir);
110
116
  pollOrigins.clear();
111
- let failure = null;
117
+ let failure = activityFailure;
118
+ activityFailure = null;
112
119
  let acquisitionFailed = false;
113
120
  const clouds = new Map();
114
121
  const cycleFences = new Map();
@@ -129,6 +136,7 @@ export async function runRuntime(dir, version) {
129
136
  for (const pairId of statePublications.keys())
130
137
  if (!config.pairs.some(pair => pair.pairId === pairId))
131
138
  statePublications.delete(pairId);
139
+ activityPublisher.retain(config.cloudEnabled ? config.pairs.filter(pair => pair.active && pair.relayRetiredAt === undefined && !journal.pairRevoked(pair.pairId)).map(pair => pair.pairId) : []);
132
140
  for (const origin of retryStates.keys())
133
141
  if (!config.pairs.some(pair => (pair.apiOrigin || config.apiOrigin) === origin))
134
142
  retryStates.delete(origin);
@@ -238,6 +246,33 @@ export async function runRuntime(dir, version) {
238
246
  if (bound)
239
247
  await queueAttention(journal, pair, bound);
240
248
  }
249
+ if (!stopped && !draining) {
250
+ const candidates = config.pairs.filter(pair => pair.active && pair.relayRetiredAt === undefined && !journal.pairRevoked(pair.pairId) && clouds.has(pair.pairId));
251
+ const ordered = [...candidates.slice(activityPairCursor), ...candidates.slice(0, activityPairCursor)], activitySnapshot = snapshot, activityOfficial = official;
252
+ // Schedule cached terminal recovery before any optional normal discovery.
253
+ // The owned lane never delays command acquisition and is aborted/joined on drain.
254
+ if (activityLane.start(async (signal) => {
255
+ let optionalFailure;
256
+ for (const terminalOnly of [true, false])
257
+ for (const pair of ordered) {
258
+ signal.throwIfAborted();
259
+ if (!pair.active || journal.pairRevoked(pair.pairId))
260
+ continue;
261
+ const cloud = clouds.get(pair.pairId);
262
+ try {
263
+ await activityPublisher.publish(pair, cloud, activitySnapshot, Date.now(), (agentId, readSignal) => activityOfficial.activityTask(agentId, readSignal), { signal, terminalOnly });
264
+ }
265
+ catch (error) {
266
+ if (signal.aborted)
267
+ throw error;
268
+ optionalFailure ??= error;
269
+ }
270
+ }
271
+ if (optionalFailure)
272
+ throw optionalFailure;
273
+ }, error => { activityFailure = error; }, AbortSignal.any([controller.signal, drainWake.signal])))
274
+ activityPairCursor = (activityPairCursor + 1) % Math.max(1, candidates.length);
275
+ }
241
276
  for (const pair of config.pairs) {
242
277
  if (stopped)
243
278
  break;
@@ -265,11 +300,11 @@ export async function runRuntime(dir, version) {
265
300
  if (!publication || publication.envelope.expiresAt <= Date.now() || (publication.acknowledged && publication.envelope.issuedAt !== snapshot.measuredAt)) {
266
301
  const payload = await projectSnapshot(snapshot, pair, journal, official.generation);
267
302
  const envelope = await sealEnvelope(decode(pair.rootKey, 32), { version: 1, pairId: pair.pairId, id: randomUUID(), channel: 'state', issuedAt: snapshot.measuredAt, expiresAt: snapshot.measuredAt + LIMITS.snapshotMs }, payload);
268
- publication = { envelope, acknowledged: false };
303
+ publication = { envelope, widgetFingerprint: await widgetFingerprint(pair, payload), acknowledged: false };
269
304
  statePublications.set(pair.pairId, publication);
270
305
  }
271
306
  if (!publication.acknowledged) {
272
- await cloud.state(publication.envelope);
307
+ await cloud.state(publication.envelope, publication.widgetFingerprint);
273
308
  publication.acknowledged = true;
274
309
  }
275
310
  }
@@ -360,6 +395,7 @@ export async function runRuntime(dir, version) {
360
395
  process.removeListener('message', parentMessage);
361
396
  process.removeListener('disconnect', parentGone);
362
397
  try {
398
+ await activityLane.close();
363
399
  detach?.();
364
400
  await official?.close().catch(() => { });
365
401
  }
package/dist/service.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import { spawn } from 'node:child_process';
2
2
  import { createHash, randomUUID } from 'node:crypto';
3
3
  import { join, dirname } from 'node:path';
4
- import { homedir, userInfo } from 'node:os';
4
+ import { homedir, userInfo, tmpdir } from 'node:os';
5
5
  import { constants } from 'node:fs';
6
- import { mkdir, readFile, unlink, access, lstat, open, rename, link, mkdtemp, rm } from 'node:fs/promises';
6
+ import { mkdir, readFile, unlink, access, lstat, open, rename, link, mkdtemp, rm, realpath } from 'node:fs/promises';
7
7
  import { privateDirectory, privateManagedDirectory } from './config.js';
8
8
  import { PACKAGE, exactVersion, updateLock } from './update-state.js';
9
9
  const taskName = '\\MoRemoteCLI';
@@ -90,6 +90,21 @@ function xmlValue(content, element) {
90
90
  const value = content.match(new RegExp('<' + element + '(?:\\s[^>]*)?>([\\s\\S]*?)</' + element + '>'))?.[1];
91
91
  return value?.replaceAll('&quot;', '"').replaceAll('&apos;', "'").replaceAll('&lt;', '<').replaceAll('&gt;', '>').replaceAll('&amp;', '&');
92
92
  }
93
+ async function sameRegistrationPath(actual, expected) {
94
+ if (actual === expected)
95
+ return true;
96
+ if (!actual)
97
+ return false;
98
+ try {
99
+ const [loaded, file] = await Promise.all([lstat(actual), lstat(expected)]);
100
+ return loaded.isFile() && !loaded.isSymbolicLink() && file.isFile() && !file.isSymbolicLink()
101
+ && loaded.dev === file.dev && loaded.ino === file.ino
102
+ && await realpath(actual) === await realpath(expected);
103
+ }
104
+ catch {
105
+ return false;
106
+ }
107
+ }
93
108
  async function registration(def, content) {
94
109
  if (def.platform === 'darwin') {
95
110
  let raw;
@@ -102,7 +117,7 @@ async function registration(def, content) {
102
117
  throw error;
103
118
  }
104
119
  const path = raw.match(/^\s*path = (.+)\s*$/m)?.[1]?.trim();
105
- if (path !== def.path)
120
+ if (!await sameRegistrationPath(path, def.path))
106
121
  throw Error('FOREIGN_SERVICE_REGISTRATION');
107
122
  }
108
123
  else if (def.platform === 'linux') {
@@ -110,7 +125,7 @@ async function registration(def, content) {
110
125
  const path = raw.match(/^FragmentPath=(.*)$/m)?.[1], load = raw.match(/^LoadState=(.*)$/m)?.[1];
111
126
  if (path === '' && load === 'not-found')
112
127
  return 'absent';
113
- if (path !== def.path)
128
+ if (!await sameRegistrationPath(path, def.path))
114
129
  throw Error(path ? 'FOREIGN_SERVICE_REGISTRATION' : 'SERVICE_MANAGER_INVALID_RESPONSE');
115
130
  }
116
131
  else if (def.platform === 'win32') {
@@ -154,6 +169,8 @@ async function writeDefinition(def) {
154
169
  const temp = def.path + '.' + randomUUID() + '.tmp';
155
170
  const handle = await open(temp, constants.O_CREAT | constants.O_EXCL | constants.O_WRONLY | constants.O_NOFOLLOW, 0o600);
156
171
  try {
172
+ // Retained public runtimes read this ownership file without stripping a BOM.
173
+ // The native-only import below supplies the scheduler's required byte order.
157
174
  try {
158
175
  await handle.writeFile(def.content, def.platform === 'win32' ? 'utf16le' : 'utf8');
159
176
  await handle.sync();
@@ -179,6 +196,26 @@ async function writeDefinition(def) {
179
196
  await rm(temp, { force: true });
180
197
  }
181
198
  }
199
+ async function registerWindowsService(def) {
200
+ // Keep native import bytes outside the shared state consumed by old runtimes.
201
+ const temporary = await mkdtemp(join(tmpdir(), 'moremote-cli-task-')), path = join(temporary, 'task.xml');
202
+ try {
203
+ const handle = await open(path, constants.O_CREAT | constants.O_EXCL | constants.O_WRONLY | constants.O_NOFOLLOW, 0o600);
204
+ try {
205
+ await handle.writeFile('\uFEFF' + def.content, 'utf16le');
206
+ await handle.sync();
207
+ }
208
+ finally {
209
+ await handle.close();
210
+ }
211
+ await command('schtasks', ['/Create', '/TN', taskName, '/XML', path, '/F']);
212
+ }
213
+ finally {
214
+ await rm(temporary, { recursive: true, force: true });
215
+ }
216
+ // Never leave the native-import copy present when the retained runtime starts.
217
+ await command('schtasks', ['/Run', '/TN', taskName]);
218
+ }
182
219
  export async function installService(def) {
183
220
  const status = await serviceStatus(def);
184
221
  requireKnown(status);
@@ -192,10 +229,8 @@ export async function installService(def) {
192
229
  await command('systemctl', ['--user', 'daemon-reload']);
193
230
  await command('systemctl', ['--user', 'enable', '--now', 'moremote-cli.service']);
194
231
  }
195
- else {
196
- await command('schtasks', ['/Create', '/TN', taskName, '/XML', def.path, '/F']);
197
- await command('schtasks', ['/Run', '/TN', taskName]);
198
- }
232
+ else
233
+ await registerWindowsService(def);
199
234
  }
200
235
  export async function stopService(def) {
201
236
  const status = await serviceStatus(def);
@@ -8,6 +8,7 @@ export interface ManagedRuntime {
8
8
  export declare function launchRuntime(entry: string, dir: string, onReady?: () => void): ManagedRuntime;
9
9
  export declare function drainRuntime(runtime: ManagedRuntime): Promise<number>;
10
10
  export declare function startupHealthy(runtime: ManagedRuntime, signal?: AbortSignal, grace?: number, deadline?: number, cancel?: () => boolean): Promise<boolean>;
11
+ export declare function stopManagedRuntime(dir: string): Promise<void>;
11
12
  export declare function runSupervisor(dir: string, timing?: {
12
13
  pollMs?: number;
13
14
  startupGraceMs?: number;
@@ -2,7 +2,8 @@ import { spawn } from 'node:child_process';
2
2
  import { setTimeout as sleep } from 'node:timers/promises';
3
3
  import { managedEntry } from './service.js';
4
4
  import { checkForUpdate, compatibleEntry } from './updater.js';
5
- import { readUpdateState, writeUpdateState, updateLock, supervisorStopRequested } from './update-state.js';
5
+ import { readUpdateState, writeUpdateState, updateLock, supervisorStopRequested, requestSupervisorStop, supervisorRunning } from './update-state.js';
6
+ import { requestControl, runtimeHasLiveOwner } from './control.js';
6
7
  export function launchRuntime(entry, dir, onReady = () => { }) {
7
8
  const child = spawn(process.execPath, [entry, 'run', '--data-dir', dir], { stdio: ['ignore', 'inherit', 'inherit', 'ipc'], windowsHide: true, env: { ...process.env, MOREMOTE_MANAGED_CHILD: '1' } });
8
9
  let ready = false, closed = false;
@@ -32,6 +33,48 @@ export async function startupHealthy(runtime, signal, grace = 10000, deadline =
32
33
  }
33
34
  return false;
34
35
  }
36
+ async function stopRuntime(dir) {
37
+ if (!await requestControl(dir, 'stop'))
38
+ return;
39
+ for (let i = 0; i < 300; i++) {
40
+ await sleep(200);
41
+ if (!await requestControl(dir, 'status'))
42
+ return;
43
+ }
44
+ throw Error('STOP_TIMEOUT');
45
+ }
46
+ export async function stopManagedRuntime(dir) {
47
+ requestSupervisorStop(dir);
48
+ let controlUnavailable = false;
49
+ // Native service shutdown may close IPC before its owned records are retired.
50
+ // A transport's absent generation is not proof that no replacement is alive.
51
+ try {
52
+ await stopRuntime(dir);
53
+ }
54
+ catch (error) {
55
+ if (error instanceof Error && (error.message === 'LEGACY_WINDOWS_CONTROL_UNAVAILABLE' || error.message === 'CONTROL_CONNECTION_CLOSED') && readUpdateState(dir))
56
+ controlUnavailable = true;
57
+ else
58
+ throw error;
59
+ }
60
+ if (!readUpdateState(dir)) {
61
+ if (runtimeHasLiveOwner(dir))
62
+ throw Error('STOP_TIMEOUT');
63
+ return;
64
+ }
65
+ for (let i = 0; i < 900; i++) {
66
+ if (!supervisorRunning(dir)) {
67
+ if (controlUnavailable && await requestControl(dir, 'status'))
68
+ throw Error('STOP_TIMEOUT');
69
+ // Revalidate synchronously after the awaited probe, including lock-only startup.
70
+ if (supervisorRunning(dir) || runtimeHasLiveOwner(dir))
71
+ throw Error('STOP_TIMEOUT');
72
+ return;
73
+ }
74
+ await sleep(200);
75
+ }
76
+ throw Error('SUPERVISOR_STOP_TIMEOUT');
77
+ }
35
78
  export async function runSupervisor(dir, timing = {}) {
36
79
  return updateLock(dir, async () => {
37
80
  let state = readUpdateState(dir);
package/docs/README.md CHANGED
@@ -1,9 +1,10 @@
1
1
  # Documentation index
2
2
 
3
3
  **MoRemote CLI**: independent optional `moremote-cli` repository/command,
4
- public npm `@moxuli/moremote`, over unmodified Paseo.
5
- STATE distinguishes historical pre-rename acceptance, renamed-tree checks and
6
- separately gated cloud/Apple activation.
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.
7
8
 
8
9
  - [Current state and external gates](STATE.md)
9
10
  - [Architecture](specs/01-architecture.md)
@@ -12,7 +13,7 @@ separately gated cloud/Apple activation.
12
13
  - [Endpoint controls, occurrences and receipt lifecycle](specs/04-control-and-receipt-lifecycle.md)
13
14
  - [Endpoint and lifecycle behavior](specs/05-endpoint-and-lifecycle.md)
14
15
  - [Managed updates and compatibility](specs/06-managed-updates.md)
15
- - [Public release and trusted-publisher prerequisites](releasing.md)
16
+ - [Public release and existing publishing-secret prerequisites](releasing.md)
16
17
  - [Managed-update decision](decisions/0001-managed-updates.md)
17
18
  - [Managed-update implementation plan](plans/2026-11-10-managed-updates.md)
18
19
  - [Configuration registry](configuration.md)
package/docs/STATE.md CHANGED
@@ -1,8 +1,155 @@
1
- # Current state — 2026-11-10
1
+ # Current state — 2026-11-12
2
2
 
3
3
  ## Scope
4
4
 
5
- Owner-approved notification/scoped-delivery first iteration; Apache-2.0. Standalone Node24 companion targeting inspected official SDK/protocol 0.15.3. Existing iOS protocol-vector floor is independent and unchanged. OpenUI, system extensions and broader native surfaces belong to later app iterations.
5
+ Owner-approved notification/scoped delivery and local activity/widget integration; Apache-2.0. Standalone Node24 companion targeting inspected official SDK/protocol0.15.3. Existing iOS protocol-vector floor is independent and unchanged. OpenUI and broader system extensions remain outside this scope.
6
+
7
+ ## Native service acceptance — 2026-11-12
8
+
9
+ - Actual Ubuntu26.04/Node24.13.0/systemd259 user-service acceptance passes:
10
+ install/start, authenticated status, QA0.1.1 → synthetic9000.0.2 activation,
11
+ failed9000.0.3 startup rollback, normal stop/uninstall and independent absence
12
+ of the unit, definition and live runtime. No cloud or real official daemon I/O.
13
+ - Initial Windows QA exposed missing native-import BOM and current-reader BOM
14
+ handling. Fresh-context specification review then found that persisting a BOM
15
+ breaks unchanged public0.1.1 runtimes, despite the current/current QA success.
16
+ - The current installer keeps persistent ownership XML BOM-free. Only a private
17
+ transient import outside shared state has a BOM; it is removed before `/Run`
18
+ and on `/Create` failure. Retained0.1.1 consumers remain usable for bootstrap
19
+ and rollback without a storage migration.
20
+ - Both new consumer regressions first failed. All20focused lifecycle/resource
21
+ consumers, typecheck and build then pass. The frozen reader matches the
22
+ independently downloaded public0.1.1 module bytes.
23
+ - The new actual Windows Task Scheduler journey passes in183.86seconds:
24
+ unchanged registry0.1.1 bootstrap → current synthetic9000.0.2 → deliberately
25
+ failed9000.0.3 → recovered9000.0.2, then normal stop/uninstall. Task,
26
+ definition, control endpoint and live supervisor/runtime are independently absent.
27
+ - Fresh-context specification and quality re-review close the scoped blocker.
28
+ This is the explicitly weaker same-provider fallback, not cross-vendor approval.
29
+ Earlier168.23second QA acceptance and unavailable provider reviews remain
30
+ historical evidence in [[2026-11-11-native-service-acceptance]].
31
+ - The candidate is unpublished QA bytes, not a public-to-public release. No real
32
+ official host, paid provider, cloud operation or everyday login service is used.
33
+ - The shared production cloud remains persistently enabled under the owner's
34
+ later decision; these isolated native tests neither use nor disable it. Older
35
+ temporary-window shutdown receipts below are historical, not current policy.
36
+
37
+ ## Local0.1.2 candidate preparation
38
+
39
+ - Package and lock root identities now select0.1.2; no dependency or compatibility
40
+ tuple changes. No tag, push, npm publication or GitHub Release has occurred.
41
+ - The combined check passes typecheck and180/181 tests. Its remaining legacy-wire
42
+ case incorrectly requires an extra read for an old event that may be coalesced.
43
+ The test now drains the actual wire and retains the phone-visible no-new-notice
44
+ and unchanged-ciphertext assertions without demanding that incidental RPC.
45
+ - Both actual SDK wire variants then pass2/2. Build, real packaged activation/
46
+ failed-start rollback/aliased frontend/clean stop, release identity validation
47
+ and deterministic0.1.2 packaging pass. These overlapping runs are not a new
48
+ single green full-suite result.
49
+ - Hosted cross-platform CI, exact immutable publication/receiver installation
50
+ and public-to-public activation remain release gates. Production device reply,
51
+ approval and remote activity/widget delivery still require their own evidence.
52
+
53
+ ## Active work — unreleased activity/widget integration
54
+
55
+ - Published install identity is **`@moxuli/moremote`0.1.1**; command/runtime
56
+ remains `moremote-cli`, with existing per-platform service identities.
57
+ Local activity/widget changes are **not released**; local0.1.2 is a candidate.
58
+ - Implemented locally: authenticated encrypted per-task interests and activity
59
+ state, an owned optional2s host lane with250ms exact fallback reads, meaningful
60
+ keyed widget fingerprints on existing snapshot publication, and normal-only
61
+ quota pauses that preserve eligible terminal recovery. Commands/controls do
62
+ not await activity work; shutdown/drain joins it before SDK/journal close.
63
+ - Limits/expiry/error/dataflow truth lives in [[configuration]] and
64
+ [[specs/03-api-contract#Opt-in task activities and widget reloads]].
65
+ Interest expiry is at most8h (8 per pair); state at most600s, fresh acknowledged
66
+ renewal around8min. Unknown admissions retain exact bytes. Widget registration
67
+ expires24h with native renewal around12h. Missing tasks never imply finish.
68
+ - Integration-owner-reported evidence: CLI typecheck and57 tests across
69
+ `tests/activity.test.ts`, `tests/cloud-retry.test.ts` and
70
+ `tests/runtime-receipt.test.ts` passed. This is targeted local evidence, not
71
+ a newly green full suite, released artifact, or physical/device acceptance.
72
+ - Next gates: independent integration review and owner verification of the final
73
+ delta; authorized native Live Activity/widget rendering, stale/offline and
74
+ token replacement/expiry acceptance; separately authorized live cloud/APNs
75
+ delivery. APNs200 is provider admission, not delivery. Historical alert proof
76
+ below does not cover either new surface.
77
+ - A later owner-approved bounded physical acceptance observed all four attention
78
+ kinds through the actual official mock → companion → cloud → sandbox APNs path.
79
+ Duplicate completion and premature request-resolution bugs were exposed and
80
+ corrected locally; this is not real paid-model or production-service evidence.
81
+ - The request lifecycle and canonical terminal-identity corrections pass13focused
82
+ consumers plus typecheck. A later reverse-order wire regression first failed
83
+ both SDK variants, then both passed with typecheck after observation-order
84
+ fencing. Independent same-provider review reports no blocker; the preferred
85
+ cross-vendor provider was unavailable.
86
+ - Earlier bounded sandbox windows restored disabled service and production
87
+ provider secrets. The later November12 owner decision now keeps the existing
88
+ production service enabled; no temporary watchdog or sandbox swap is allowed.
89
+ Genuine device reply/approval receipts and remote ActivityKit/WidgetKit
90
+ acceptance remain open. No real-work session or new release is implied.
91
+ - Fresh local end-to-end action acceptance passes against the unchanged official
92
+ development mock, production runtime, real Pages/Worker/SQLite and a compiled
93
+ unchanged native Kit/CryptoKit slice. Exact send and bound plan denial each
94
+ execute once and produce authenticated accepted/resolved receipts; initial and
95
+ post-settlement identical retries cannot redispatch or change receipts. Both
96
+ SQLite journals retain exactly two settled operations. This is not physical
97
+ locked-notification UI or whole native-package acceptance. Earlier observer and
98
+ incidental-prose harness failures were corrected without product exceptions.
99
+
100
+ ## Native macOS service continuation — partial acceptance
101
+
102
+ The current compiled source controller passed real launchd install/start/status/
103
+ stop/uninstall against the published0.1.1 managed runtime in an unused, isolated
104
+ per-user registration. A concurrent graceful-drain control-closure failure was
105
+ reproduced and corrected with an authoritative ownership-retirement barrier.
106
+ 22 focused shutdown/frontend/control/CLI regressions, typecheck and build pass.
107
+ The final registration, plist and owned state were removed; cloud stayed disabled
108
+ and no official connection or real-work session was used.
109
+
110
+ See [native service evidence](plans/2026-11-11-native-service-acceptance.md).
111
+ Independent review closed a reproduced replacement-owner race with fresh post-probe
112
+ supervisor/runtime liveness checks. The November12 continuation below additionally
113
+ accepts native macOS upgrade/rollback with a real published bootstrap and synthetic
114
+ candidates. The November12 native Linux/Windows gates also pass as recorded above;
115
+ a next immutable public release and public-to-public delivery remain open.
116
+ Published0.1.1 does not contain the later source corrections.
117
+
118
+ ## Packaged rollback continuation — 2026-11-12
119
+
120
+ The local macOS packaged smoke now exercises production `queueUpdate` and the
121
+ retained supervisor with three real npm-installed synthetic package versions:
122
+ 9000.0.1→9000.0.2 succeeds; compatible9000.0.3 exits before runtime readiness,
123
+ and the supervisor returns to9000.0.2. Authenticated status confirms the recovered
124
+ version. Bootstrap/previous remain9000.0.1, failed9000.0.3 is recorded, and
125
+ pending/activating are absent. The retained aliased frontend and final clean
126
+ shutdown also pass. Only disposable failed-candidate package bytes are altered.
127
+
128
+ `npm run build` passes. The first expanded smoke stops during fixture setup
129
+ because its new import accidentally omitted `managedEntry`; no supervisor starts.
130
+ After restoring that import, the exact smoke passes in133.54seconds, including
131
+ owned-process/file cleanup. This is not a newly green full unit suite or new
132
+ hosted-platform result. That smoke installs no native login service and changes no
133
+ official daemon, cloud, real session or public package. The separate installed
134
+ macOS journey is recorded below; Linux/Windows observations remain open.
135
+
136
+ ## Installed macOS upgrade continuation — 2026-11-12
137
+
138
+ An actual launchd test exposes raw-path ownership rejection after macOS resolves
139
+ `/tmp` to `/private/tmp`. Canonical parent aliases now require ordinary leaves,
140
+ equal device/inode and equal real paths; leaf symlinks and foreign files remain
141
+ rejected. All10service-lifecycle consumers, typecheck and build pass; independent
142
+ OpenCode review finds no blocker. Distinct hard links/bind mounts remain refused.
143
+
144
+ The real installed-service journey passes in181.29seconds: verified public0.1.1
145
+ bootstrap, current9000.0.2 synthetic activation, failed9000.0.3 startup, recovery
146
+ to9000.0.2, then normal stop/uninstall with registration/plist/owned successful-run
147
+ files removed. An earlier fixture missed the required client-ID prefix; that
148
+ `INVALID_CONFIG` startup failure is not a product defect. First-run cleanup safely
149
+ used its independently established canonical definition before the product fix.
150
+ No real official connection or cloud operation occurred. Details and remaining
151
+ public-release/platform limits: [native service evidence](plans/2026-11-11-native-service-acceptance.md).
152
+
6
153
 
7
154
  ## Approved identity cutover — locally verified
8
155
 
@@ -10,9 +157,10 @@ The owner approved the complete rename to **MoRemote CLI** on 2026-11-10:
10
157
  repository/command `moremote-cli`, current public npm `@moxuli/moremote`, entry `bin/moremote-cli.js`,
11
158
  `MOREMOTE_CLI_HOME`, state `MoRemoteCLI` on macOS/Windows and `moremote-cli`
12
159
  on Linux, and services `com.moremote.cli` / `moremote-cli.service` / `MoRemoteCLI`.
13
- Ownership/runtime/client/managed-package identities move together. There is no
14
- released package or installed service to migrate: no compatibility aliases or
15
- automatic adoption of old state. Foreign-resource protections remain strict.
160
+ Ownership/runtime/client/managed-package identities move together.
161
+ At the original rename checkpoint there was no released package or installed
162
+ service to migrate: no compatibility aliases or automatic adoption of old state.
163
+ The later0.1.0/0.1.1 publications are recorded below. Foreign-resource protections remain strict.
16
164
  The `companionHello` role, crypto salt/envelope schema, APNs categories and
17
165
  app/Keychain identities are unchanged.
18
166
 
@@ -31,8 +179,8 @@ remain separate gates.
31
179
  ## Managed updates and release — local acceptance complete
32
180
 
33
181
  The owner authorized public scoped npm identity `@moxuli/moremote`, retained
34
- private bootstrap/supervisor, cycle-safe automatic runtime activation and OIDC
35
- release workflows. Native service/state/executable identities remain unchanged.
182
+ private bootstrap/supervisor and cycle-safe automatic runtime activation.
183
+ Native service/state/executable identities remain unchanged.
36
184
  See [decision](decisions/0001-managed-updates.md), [specification](specs/06-managed-updates.md),
37
185
  [plan](plans/2026-11-10-managed-updates.md) and [publication prerequisites](releasing.md).
38
186
 
@@ -52,8 +200,47 @@ completed independent-context review is not represented as cross-vendor approval
52
200
  Public GitHub repository `moxuli/moremote-cli` exists. The owner authorized the
53
201
  first public0.1.0 release and reuse of an existing locally protected publishing
54
202
  token; its npm identity is verified without disclosing the credential. No new
55
- token or npm login is required. Hosted workflow execution, registry publication
56
- and trusted-publisher configuration require their actual receiver receipts.
203
+ token or npm login is required. Existing organization secret `NPM_TOKEN` is
204
+ restricted to this selected CLI repository; the release publish step reuses it.
205
+ Workstation0.1.0 publication is independently visible through the anonymous npm
206
+ registry. Published tarball SHA256 is
207
+ `6bf3cab16245745f5f9d43026687cff880ca081f106f195d6abe40a169c5efd6`;
208
+ registry SHA1 matches and a fresh exact public install runs version/help/
209
+ configure/status with cloud off, no runtime/pairs and no installed service.
210
+ Initial asynchronous404 processing was observed; publication was not repeated.
211
+
212
+ Hosted CI42821005843 accepts Ubuntu24.04 and macOS15 check/build/package-upgrade;
213
+ Windows2025 reports8control-transport failures (112pass/10explicit POSIX skips).
214
+ The correction is patch0.1.1: generation-bound transport selection preserves the
215
+ published strict runtime shape; framed peers avoid Windows half-close, while
216
+ known legacy POSIX transport is selected before exactly one write, never replayed.
217
+ Historical0.1.0 Windows EOF control remains explicitly unavailable/unknown;
218
+ managed stop requires real supervisor/runtime retirement evidence.
219
+
220
+ Final types,35focused control/lifecycle/CLI consumers, build and actual published
221
+ 0.1.0 retained-bootstrap→0.1.1 archive upgrade pass. The latter verifies active/
222
+ previous selection, both transport generations, selected frontend and clean
223
+ shutdown without a service/cloud/official-data mutation. Independent review
224
+ closes the mixed-transport finding with no remaining actionable P1/P2 issue.
225
+ Hosted CI42826719991 passes all three jobs: Ubuntu24.04, macOS15 and
226
+ Windows2025, including each platform's check/build, release identity validation
227
+ and real packaged upgrade. Source is `dad3d964b9ab144b646316a543e5d36151f8c210`.
228
+ Tagv0.1.1 targets that exact source. Automatic Release42827612987 completed
229
+ successfully using the existing organization secret: check/build, packaged
230
+ upgrade, deterministic artifact, signed GitHub provenance, npm submission and
231
+ GitHub Release all passed. No new token, login or trusted-publisher setup.
232
+
233
+ Independent anonymous npm catalog read confirms latest0.1.1; a fresh installation
234
+ by exact public package name runs0.1.1. The downloaded GitHub asset matches its
235
+ SHA256SUMS and npm's SHA1/SHA512 integrity. GitHub asset SHA256:
236
+ `358574ca750d27c8a116743cd729d7ab830c41fc17045ddfa46ff808ff3bba3b`.
237
+ The actual release asset separately runs configure/status with cloud off and
238
+ no runtime/service. Both submissions initially reported asynchronous processing;
239
+ the same immutable version was never republished.
240
+
241
+ Release: https://github.com/moxuli/moremote-cli/releases/tag/v0.1.1
242
+ Environment `npm-release` has a `v*` tag-only deployment policy; no new secret
243
+ was created.
57
244
 
58
245
  ## Locally accepted implementation
59
246
 
@@ -124,9 +311,9 @@ Official tag v0.15.3 points to commit d91ae138cb931447635e94296023414a58bedcc5.
124
311
  ## External gates / substrate gaps
125
312
 
126
313
  - Independent specification and quality/security reviews and frozen local check results belong to the integration owner.
127
- - Public GitHub repository exists; CI/release workflow source is prepared but no hosted run, tag/release, npm publication, trusted publisher, scheduler or branch/tag protection is claimed. Unpublished npm404 is a real update failure, persisted with bounded discovery rather than a retry storm or fake success.
128
- - Real per-user launchd/systemd/Windows logon-task installation requires point-of-use operator authorization and testing on each OS; adapters are source, not evidence of another OS’s acceptance.
129
- - No everyday login service, real work-session action, DNS/cloud deployment, paid model call, Apple key/capability change or public publication has been performed.
130
- - Production Cloudflare storage/network reachability, Apple provider signing and app topic/environment, actual iOS app enrollment and physical APNs delivery are real external setup/acceptance requirements. Emulation is not proof of delivery.
314
+ - Hosted cross-platform CI, exactv0.1.1 tag, npm publication, signed provenance and GitHub assets are verified above. Environment deployment is `v*`-tag-only. No broader branch/tag Ruleset or trusted-publisher migration is claimed.
315
+ - The native macOS/Linux/Windows managers now have the scoped acceptance recorded above. Public-to-public next-version activation and corresponding published-version rollback still require their own release evidence; synthetic QA versions are not that proof.
316
+ - No everyday login service, real-work-session send/approval or paid-model task was exercised. The temporary macOS registration was removed; it is not daily-host deployment.
317
+ - One authorized synthetic sandbox alert was observed on a real iPad through the independent cloud/app path. This is not genuine permission/reply execution, production TestFlight delivery or terminated-app acceptance; emulation and artifact installation do not establish those gates.
131
318
 
132
319
  Continue from this file and living specs, not private machine history. Record exercised evidence here before claiming a verified release.
@@ -15,11 +15,15 @@ HTTP response limit is5MiB, separately from the128KiB request limit; the relay c
15
15
  Local pair revocation tombstones are capped at4096, never evicting live protection. Exhaustion is an explicit failure. Running cleanup removes a tombstone only after its pairing credentials have been durably removed and all immutable child audit deadlines have passed. Offline configuration-only reads cannot prune revoked keys without their journal.
16
16
 
17
17
  HTTP429/503 may carry Retry-After as seconds or a canonical HTTP-date. Validate
18
- it, cap the wait at24hours and retain a fixed deadline per API origin. Paused
19
- origins make no repeated3second HTTP attempts; unrelated origins keep their own
20
- cadence. Once observed, a pause fences that origin for the remainder of the
21
- runtime cycle even if slow SDK work outlasts the deadline. The next cycle first
22
- reacquires controls before publication, receipt recovery or command acquisition.
18
+ it, cap the wait at24hours and retain a fixed deadline per API origin. By default,
19
+ paused origins make no repeated3second HTTP attempts; unrelated origins keep
20
+ their own cadence. Only429 `daily_work_limit` with `x-moremote-budget:normal`
21
+ and a future numeric `x-moremote-reset` consistent with Retry-After pauses normal
22
+ requests alone. Recovery routes still require server admission; hints grant no
23
+ authority. Missing/malformed hints, outages, disable and recovery exhaustion
24
+ retain origin-wide fences. Once observed, a pause fences its scope for the
25
+ remainder of the cycle even if slow SDK work outlasts the deadline. The next
26
+ cycle first reacquires controls before publication, receipt recovery or command acquisition.
23
27
  Never reseal/renew an action or automatically repeat an uncertain mutation.
24
28
 
25
29
  A successful upload acknowledges only those exact state/receipt bytes and
@@ -28,6 +32,56 @@ snapshots/receipt revisions are not retransmitted each poll. Relay disappearance
28
32
  or retirement fences execution but is not authenticated endpoint revocation.
29
33
  Retired recovery ends at original child audit deadlines without extending them.
30
34
 
35
+ ## Optional activity and widget surfaces (unreleased)
36
+
37
+ Published `@moxuli/moremote` remains0.1.1; these are local source changes,
38
+ not a new release or a reason to alter service/runtime identities. There is no
39
+ new CLI enable flag or separate activity-device command. Existing cloud opt-in,
40
+ active pairing and a compatible phone/relay are prerequisites; official-only
41
+ use remains independent. No deployment or device acceptance is implied.
42
+
43
+ | Surface | Bound / behavior |
44
+ | --- | --- |
45
+ | Activity interests | Phone-selected, encrypted and pinned to pair/subscription/daemon/task; at most8 live interests per pair, original lifetime at most8h. |
46
+ | Optional host work | Interest discovery no faster than30s; one owned2s cancellation-bounded lane, at most8 exact SDK fallback reads, each bounded250ms. Commands/controls do not await it; drain/stop cancels and joins before closing SDK/journal. |
47
+ | Activity state | At most600s, capped by interest expiry; serialized encrypted envelope at most3000bytes, title160/hostName80 characters. APNs body at most4096bytes with512bytes reserved for static attributes. |
48
+ | Activity renewal | Only acknowledged nonterminal state renews from a fresh official measurement with120s remaining (about8min). Unknown admissions retry identical bytes until expiry; semantic transitions can supersede progress. Missing tasks do not imply completion. |
49
+ | Widget registration | One current WidgetKit token per pair;24h expiry, native foreground renewal around12h with a fresh registration ID. Not the alert/activity token. |
50
+ | Widget reload | Pair-keyed meaningful-change fingerprint on existing state PUT; clocks alone do not trigger reloads. One coalesced signal per changed fingerprint/current registration; legacy envelope-only uploads do not queue pushes. |
51
+
52
+ The phone registers/deletes tokens and encrypted interests; the CLI never
53
+ registers an official daemon push token or downloads full chat/timeline for
54
+ these surfaces. The relay sees token/environment, IDs, opaque topic/fingerprint,
55
+ envelope times/sizes and ciphertext. Only paired endpoints decrypt task/title,
56
+ host/project and genuine usage values. Apple receives encrypted activity state
57
+ in `ContentState.payload`, or exactly `{aps:{"content-changed":true}}` for widgets.
58
+ Activity/widget pushes do not depend on alert admission or presence suppression.
59
+
60
+ Terminal recovery uses cached authenticated unexpired interests and fresh
61
+ snapshot facts before optional normal discovery; it needs no normal GET/state
62
+ upload. Only end/delete routes are recovery-eligible, not ordinary updates,
63
+ interest reads or registration. A404/409 publication rejection invalidates that
64
+ cached target; it does not authorize a replacement or a blind replay. Conflicting
65
+ same-registration bytes are409; replacement needs a fresh registration ID.
66
+ Relay retired-identity guards share a1000-entry cap and fail closed rather than
67
+ evicting live protection; guards last through original8h activity/24h widget
68
+ expiry. Delayed registration PUTs cannot roll back replacements; identity-exact
69
+ widget DELETEs and stale provider results cannot retire newer registrations.
70
+ Activity DELETE targets the subscription itself. Expiry never renews through
71
+ retry; stale/offline is not success.
72
+
73
+ The relay needs explicit `APNS_WIDGET_TOPIC` for the widget extension plus
74
+ `.push-type.widgets`; Live Activity topic is main `APNS_TOPIC` plus
75
+ `.push-type.liveactivity`. Environments must match configured APNs sending.
76
+ These are relay settings, not CLI configuration keys. Default-off, global
77
+ budgets, kill deadline and existing receipt priority remain unchanged.
78
+ Provider signing is inside the original10s attempt deadline; after signing,
79
+ the durable caller rechecks enabled state, active pair, exact current
80
+ registration/publication and expiry immediately before transport.
81
+ APNs200 is provider admission, never display/delivery proof. Physical Live
82
+ Activity, widget reload/freshness/offline behavior and live cloud/APNs acceptance
83
+ for this delta remain pending. Exact routes/crypto: [[specs/03-api-contract]].
84
+
31
85
  ## Service resources
32
86
 
33
87
  macOS: user Library/LaunchAgents/com.moremote.cli.plist. Linux: XDG_CONFIG_HOME/systemd/user/moremote-cli.service (fallback user .config). Windows: current-user task MoRemoteCLI and UTF-16 XML in CLI state, InteractiveToken/LeastPrivilege; built-in PowerShell checks exact existing task ownership before schtasks mutation. Marker binds the data-directory hash; manager registration/file ownership mismatch fails closed. A private CLI root marker refuses nonempty foreign directories and gates purge. No official Paseo service/resource is altered. Missing managers fail honestly.