@moxuli/moremote 0.1.2 → 0.1.4

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/resources.js CHANGED
@@ -3,10 +3,22 @@ import { dirname, basename, join } from 'node:path';
3
3
  import { pathToFileURL } from 'node:url';
4
4
  import { DatabaseSync } from 'node:sqlite';
5
5
  import { createHash, randomUUID } from 'node:crypto';
6
+ import { isUtf8 } from 'node:buffer';
6
7
  export const JOURNAL_APPLICATION_ID = 0x4d524331;
8
+ export const CONFIG_BYTES = 524288;
7
9
  export const RUNTIME_OWNER = 'MoRemote CLI runtime';
8
10
  export function hasCode(error, code) { return error instanceof Error && 'code' in error && error.code === code; }
9
11
  export function sameResource(left, right) { return left.dev === right.dev && left.ino === right.ino; }
12
+ function assertResource(stat, kind, privateMode, retiredFile = false) {
13
+ if (stat.isSymbolicLink() || !(kind === 'file' ? stat.isFile() : kind === 'directory' ? stat.isDirectory() : stat.isSocket()))
14
+ throw Error('FOREIGN_RESOURCE_KIND');
15
+ if (kind !== 'directory' && stat.nlink !== 1 && !(retiredFile && kind === 'file' && stat.nlink === 0))
16
+ throw Error('FOREIGN_RESOURCE_LINKS');
17
+ if (typeof process.getuid === 'function' && stat.uid !== process.getuid())
18
+ throw Error('FOREIGN_RESOURCE_USER');
19
+ if (privateMode && process.platform !== 'win32' && ((stat.mode & 0o7077) !== 0 || (stat.mode & (kind === 'directory' ? 0o700 : 0o600)) !== (kind === 'directory' ? 0o700 : 0o600)))
20
+ throw Error('FOREIGN_RESOURCE_MODE');
21
+ }
10
22
  export function inspectResource(path, kind, optional = false, privateMode = true) {
11
23
  let stat;
12
24
  try {
@@ -17,39 +29,60 @@ export function inspectResource(path, kind, optional = false, privateMode = true
17
29
  return null;
18
30
  throw error;
19
31
  }
20
- if (stat.isSymbolicLink() || !(kind === 'file' ? stat.isFile() : kind === 'directory' ? stat.isDirectory() : stat.isSocket()))
21
- throw Error('FOREIGN_RESOURCE_KIND');
22
- if (kind !== 'directory' && stat.nlink !== 1)
23
- throw Error('FOREIGN_RESOURCE_LINKS');
24
- if (typeof process.getuid === 'function' && stat.uid !== process.getuid())
25
- throw Error('FOREIGN_RESOURCE_USER');
26
- if (privateMode && process.platform !== 'win32' && ((stat.mode & 0o7077) !== 0 || (stat.mode & (kind === 'directory' ? 0o700 : 0o600)) !== (kind === 'directory' ? 0o700 : 0o600)))
27
- throw Error('FOREIGN_RESOURCE_MODE');
32
+ assertResource(stat, kind, privateMode);
28
33
  return stat;
29
34
  }
30
- export function readPrivateText(path, limit, encoding = 'utf8') {
31
- const before = inspectResource(path, 'file');
32
- const fd = openSync(path, constants.O_RDONLY | constants.O_NOFOLLOW | constants.O_NONBLOCK);
33
- try {
34
- const opened = fstatSync(fd);
35
- if (!before || !sameResource(before, opened) || !opened.isFile() || opened.nlink !== 1 || opened.size > limit)
36
- throw Error('FOREIGN_RESOURCE_LIMIT');
37
- const bytes = Buffer.alloc(limit + 1);
38
- let size = 0;
39
- while (size < bytes.length) {
40
- const count = readSync(fd, bytes, size, bytes.length - size, null);
41
- if (count === 0)
42
- break;
43
- size += count;
35
+ export function readPrivateText(path, limit, encoding = 'utf8', privateMode = true) {
36
+ for (let attempt = 0; attempt < 3; attempt++) {
37
+ const before = inspectResource(path, 'file', false, privateMode);
38
+ const fd = openSync(path, constants.O_RDONLY | constants.O_NOFOLLOW | constants.O_NONBLOCK);
39
+ try {
40
+ const opened = fstatSync(fd);
41
+ assertResource(opened, 'file', privateMode, true);
42
+ if (opened.size > limit)
43
+ throw Error('FOREIGN_RESOURCE_LIMIT');
44
+ // A rename can retire an already opened inode before fstat. Never read or
45
+ // return that unlinked handle; require a valid replacement and reopen it.
46
+ if (opened.nlink === 0) {
47
+ const replacement = inspectResource(path, 'file', false, privateMode);
48
+ if (!replacement || sameResource(opened, replacement))
49
+ throw Error('FOREIGN_RESOURCE_CHANGED');
50
+ continue;
51
+ }
52
+ if (!before || !sameResource(before, opened))
53
+ continue;
54
+ const bytes = Buffer.alloc(limit + 1);
55
+ let size = 0;
56
+ while (size < bytes.length) {
57
+ const count = readSync(fd, bytes, size, bytes.length - size, null);
58
+ if (count === 0)
59
+ break;
60
+ size += count;
61
+ }
62
+ if (size > limit)
63
+ throw Error('FOREIGN_RESOURCE_LIMIT');
64
+ const finished = fstatSync(fd);
65
+ assertResource(finished, 'file', privateMode, true);
66
+ // Content changes already observed on this handle remain failures even if a
67
+ // later atomic replacement would otherwise permit reopening the pathname.
68
+ if (opened.size !== size || opened.size !== finished.size || opened.mtimeMs !== finished.mtimeMs)
69
+ throw Error('FOREIGN_RESOURCE_CHANGED');
70
+ const after = inspectResource(path, 'file', false, privateMode);
71
+ // Only an ordinary owned replacement permits another read. Linked, foreign
72
+ // or insecure paths fail inspection, and in-place mutation is never retried.
73
+ if (after && !sameResource(opened, after))
74
+ continue;
75
+ if (!after || finished.nlink !== 1 || opened.size !== after.size || opened.mtimeMs !== after.mtimeMs || opened.ctimeMs !== after.ctimeMs || opened.ctimeMs !== finished.ctimeMs)
76
+ throw Error('FOREIGN_RESOURCE_CHANGED');
77
+ if (encoding === 'utf8' && !isUtf8(bytes.subarray(0, size)))
78
+ throw Error('FOREIGN_RESOURCE_ENCODING');
79
+ return { text: bytes.toString(encoding, 0, size), identity: { dev: opened.dev, ino: opened.ino } };
80
+ }
81
+ finally {
82
+ closeSync(fd);
44
83
  }
45
- const after = inspectResource(path, 'file');
46
- if (size > limit || !after || !sameResource(opened, after) || opened.size !== after.size || opened.mtimeMs !== after.mtimeMs)
47
- throw Error('FOREIGN_RESOURCE_CHANGED');
48
- return { text: bytes.toString(encoding, 0, size), identity: { dev: opened.dev, ino: opened.ino } };
49
- }
50
- finally {
51
- closeSync(fd);
52
84
  }
85
+ throw Error('FOREIGN_RESOURCE_CHANGED');
53
86
  }
54
87
  export function assertStateRoot(dir) {
55
88
  inspectResource(dir, 'directory');
@@ -210,6 +243,9 @@ export function writePrivateAtomic(path, value) {
210
243
  assertStateRoot(dir);
211
244
  if (name !== 'config.json' && name !== 'runtime.json' && name !== 'runtime.lock')
212
245
  throw Error('FOREIGN_RESOURCE_NAME');
246
+ const bytes = JSON.stringify(value) + '\n';
247
+ if (name === 'config.json' && Buffer.byteLength(bytes) > CONFIG_BYTES)
248
+ throw Error('CONFIG_LIMIT');
213
249
  const before = inspectResource(path, 'file', true);
214
250
  if (before) {
215
251
  if (name === 'runtime.lock')
@@ -218,7 +254,7 @@ export function writePrivateAtomic(path, value) {
218
254
  assertStateResource(dir, name);
219
255
  }
220
256
  const temp = path + '.' + randomUUID() + '.tmp';
221
- const identity = createPrivateFile(temp, JSON.stringify(value) + '\n');
257
+ const identity = createPrivateFile(temp, bytes);
222
258
  try {
223
259
  const current = inspectResource(path, 'file', true);
224
260
  if (before ? (!current || !sameResource(before, current)) : current !== null)
@@ -279,7 +315,7 @@ export function assertStateResource(dir, name) {
279
315
  return;
280
316
  }
281
317
  if (name === 'config.json' || /^config\.json\.[0-9a-f-]{36}\.tmp$/.test(name)) {
282
- const value = JSON.parse(readPrivateText(path, 131072).text);
318
+ const value = JSON.parse(readPrivateText(path, CONFIG_BYTES).text);
283
319
  if (!object(value) || value.version !== 1 || typeof value.clientId !== 'string' || !value.clientId.startsWith('moremote-cli-') || value.clientId.length > 256)
284
320
  throw Error('FOREIGN_CONFIG');
285
321
  return;
package/dist/runtime.d.ts CHANGED
@@ -1,8 +1,17 @@
1
1
  import { type Pair } from './config.js';
2
- import { type Attention } from './official-client.js';
2
+ import { OfficialClient, type Attention } from './official-client.js';
3
3
  import { OperationJournal, type Occurrence } from './journal.js';
4
4
  export declare function queueAttention(journal: OperationJournal, pair: Pair, event: Attention & {
5
5
  sourceFingerprint?: string;
6
6
  occurrence?: Occurrence;
7
7
  }, now?: number): Promise<void>;
8
+ export declare function boundAttention(journal: OperationJournal, pair: Pair, event: Attention, official: Pick<OfficialClient, 'requestContext' | 'generation'>): Promise<Attention | {
9
+ occurrence: Occurrence;
10
+ sourceFingerprint: string;
11
+ requestBinding: string;
12
+ agentId: string;
13
+ requestId?: string;
14
+ kind: "finished" | "question" | "permission" | "error";
15
+ timestamp: number;
16
+ } | null>;
8
17
  export declare function runRuntime(dir: string, version?: string): Promise<void>;
package/dist/runtime.js CHANGED
@@ -14,6 +14,8 @@ import { projectSnapshot } from './projection.js';
14
14
  import { ownRuntime } from './control.js';
15
15
  import { LIMITS, object } from './limits.js';
16
16
  import { ActivityPublisher, ActivityWorkLane, widgetFingerprint } from './activity.js';
17
+ import { LocalEnrollment } from './local-enrollment.js';
18
+ import { inspectResource } from './resources.js';
17
19
  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); }
18
20
  export async function queueAttention(journal, pair, event, now = Date.now()) {
19
21
  if (event.timestamp + LIMITS.snapshotMs <= now || event.timestamp > now + LIMITS.futureMs)
@@ -29,10 +31,19 @@ export async function queueAttention(journal, pair, event, now = Date.now()) {
29
31
  return;
30
32
  journal.queueAttention(pair.pairId, id, envelope.expiresAt, { id, kind: event.kind, topic, envelope }, payload);
31
33
  }
32
- async function boundAttention(journal, pair, event, official) { if (!event.requestId)
33
- return event; const occurrence = journal.currentOccurrence(official.requestContext().serverId, event.agentId, event.requestId); if (!occurrence || occurrence.generation !== official.generation)
34
- return null; const requestBinding = await occurrenceBinding(pair, occurrence); if (!journal.isCurrent(occurrence))
35
- return null; return { ...event, occurrence, sourceFingerprint: occurrence.fingerprint, requestBinding }; }
34
+ export async function boundAttention(journal, pair, event, official) {
35
+ if (!event.requestId)
36
+ return event;
37
+ // Bind the occurrence captured when this event was observed. Looking up a
38
+ // replacement here could give its identity an older cached event's clock.
39
+ const occurrence = event.occurrence;
40
+ if (!occurrence || occurrence.serverId !== official.requestContext().serverId || occurrence.agentId !== event.agentId || occurrence.requestId !== event.requestId || occurrence.generation !== official.generation || occurrence.createdAt !== event.timestamp || !journal.isCurrent(occurrence))
41
+ return null;
42
+ const requestBinding = await occurrenceBinding(pair, occurrence);
43
+ if (!journal.isCurrent(occurrence))
44
+ return null;
45
+ return { ...event, occurrence, sourceFingerprint: occurrence.fingerprint, requestBinding };
46
+ }
36
47
  async function publishResolutions(journal, pair, cloud) { for (const event of journal.attentionResolutions(pair.pairId)) {
37
48
  try {
38
49
  await cloud.resolveAttention(event.id, event.resolvedAt);
@@ -87,7 +98,10 @@ export async function runRuntime(dir, version) {
87
98
  const release = await ownRuntime(dir, () => ({ stage, lastError, activePairs, version: version ?? null }), stop);
88
99
  const activityLane = new ActivityWorkLane();
89
100
  let activityFailure = null, activityPairCursor = 0;
101
+ const enrollment = new LocalEnrollment(dir);
90
102
  try {
103
+ if (!inspectResource(join(dir, 'config.json'), 'file', true))
104
+ await saveConfig(dir, await loadConfig(dir));
91
105
  const journal = new OperationJournal(join(dir, 'journal.sqlite'));
92
106
  closeJournal = () => journal.close();
93
107
  if (process.send) {
@@ -129,6 +143,12 @@ export async function runRuntime(dir, version) {
129
143
  if (pair.relayRetiredAt !== undefined)
130
144
  pair.active = false;
131
145
  }
146
+ try {
147
+ await enrollment.cleanup(config);
148
+ }
149
+ catch (error) {
150
+ failure = error;
151
+ }
132
152
  // Prune before any request: a retained 404 must not extend automatic recovery.
133
153
  if (pruneRetiredPairs(config, now, journal))
134
154
  await saveConfig(dir, config);
@@ -148,6 +168,8 @@ export async function runRuntime(dir, version) {
148
168
  const origin = pair.apiOrigin || config.apiOrigin;
149
169
  if (!origin || (!pair.active && pair.revokedAt === undefined && pair.relayRetiredAt === undefined && pair.expiresAt !== undefined && pair.expiresAt <= Date.now()))
150
170
  continue;
171
+ if (config.enrollmentRequests?.some(record => record.pairId === pair.pairId && !record.created))
172
+ continue;
151
173
  pollOrigins.add(origin);
152
174
  let retryState = retryStates.get(origin);
153
175
  if (!retryState) {
@@ -161,6 +183,12 @@ export async function runRuntime(dir, version) {
161
183
  }
162
184
  const cloud = new CloudClient(origin, pair.pairId, pair.hostToken, config.allowLoopbackHttp, fetch, controller.signal, retryState, cycleFence);
163
185
  let controlsVerified = true;
186
+ // Pending endpoints cannot use active-only control routes. Admit activation
187
+ // after official identity verification, without granting an execution lane.
188
+ if (!pair.active && pair.revokedAt === undefined && pair.relayRetiredAt === undefined && !journal.pairRevoked(pair.pairId)) {
189
+ clouds.set(pair.pairId, cloud);
190
+ continue;
191
+ }
164
192
  try {
165
193
  for (const envelope of await cloud.controls()) {
166
194
  try {
@@ -231,6 +259,26 @@ export async function runRuntime(dir, version) {
231
259
  lastError = 'ATTENTION_QUEUE_LIMIT'; });
232
260
  measuredAt = 0;
233
261
  }
262
+ try {
263
+ await enrollment.cycle(config, official.info().serverId, pair => {
264
+ const origin = pair.apiOrigin || config.apiOrigin;
265
+ pollOrigins.add(origin);
266
+ let retry = retryStates.get(origin);
267
+ if (!retry) {
268
+ retry = {};
269
+ retryStates.set(origin, retry);
270
+ }
271
+ let fence = cycleFences.get(origin);
272
+ if (!fence) {
273
+ fence = {};
274
+ cycleFences.set(origin, fence);
275
+ }
276
+ return new CloudClient(origin, pair.pairId, pair.hostToken, config.allowLoopbackHttp, fetch, controller.signal, retry, fence);
277
+ });
278
+ }
279
+ catch (error) {
280
+ failure = error;
281
+ }
234
282
  if (snapshot === undefined || Date.now() - measuredAt >= 30000) {
235
283
  snapshot = await official.snapshot();
236
284
  measuredAt = snapshot.measuredAt;
@@ -285,6 +333,12 @@ export async function runRuntime(dir, version) {
285
333
  continue;
286
334
  throw Error('PAIR_DAEMON_MISMATCH');
287
335
  }
336
+ // A new activation gets no commands/state in this cycle. The next cycle must
337
+ // acquire and validate controls before it can execute any phone operation.
338
+ if (!pair.active && pair.revokedAt === undefined && pair.relayRetiredAt === undefined && !journal.pairRevoked(pair.pairId)) {
339
+ await activatePending(config, dir, pair, cloud, official.info().serverId, snapshot.hostName);
340
+ continue;
341
+ }
288
342
  // Read-only reconciliation remains available after revoke and original message expiry.
289
343
  if (await reconcileJournal({ pair, journal, official, cloud, clock: Date.now }))
290
344
  failure = Error('RECEIPT_RECONCILIATION_FAILED');
@@ -354,6 +408,12 @@ export async function runRuntime(dir, version) {
354
408
  acquisitionFailed = true;
355
409
  }
356
410
  }
411
+ try {
412
+ await enrollment.cleanup(config);
413
+ }
414
+ catch (error) {
415
+ failure = error;
416
+ }
357
417
  if (failure) {
358
418
  lastError = failure instanceof CloudError ? failure.code : 'CLI_CYCLE_FAILED';
359
419
  stage = 'degraded';
@@ -401,10 +461,15 @@ export async function runRuntime(dir, version) {
401
461
  }
402
462
  finally {
403
463
  try {
404
- closeJournal?.();
464
+ enrollment.close();
405
465
  }
406
466
  finally {
407
- await release();
467
+ try {
468
+ closeJournal?.();
469
+ }
470
+ finally {
471
+ await release();
472
+ }
408
473
  }
409
474
  }
410
475
  }
@@ -0,0 +1,2 @@
1
+ export declare function supportsLocalEnrollment(entry: string): Promise<boolean>;
2
+ export declare function setupServiceEntry(directory: string, currentEntry: string): Promise<string>;
@@ -0,0 +1,65 @@
1
+ import { dirname, join } from 'node:path';
2
+ import { readFile } from 'node:fs/promises';
3
+ import { privateDirectory, privateManagedDirectory } from './config.js';
4
+ import { CONFIG_BYTES } from './resources.js';
5
+ import { runtimeHasLiveOwner } from './control.js';
6
+ import { managedEntry, stagePackage } from './service.js';
7
+ import { packageManaged, packageVersion, compatibleEntry, serviceEntry } from './updater.js';
8
+ import { readUpdateState, writeUpdateState, initialUpdateState, updateLock, supervisorRunning, autoUpdateDisabled } from './update-state.js';
9
+ import { object } from './limits.js';
10
+ export async function supportsLocalEnrollment(entry) {
11
+ const manifest = object(JSON.parse(await readFile(join(dirname(dirname(entry)), 'package.json'), 'utf8')));
12
+ const capability = manifest.moremote ? object(manifest.moremote) : {};
13
+ return capability.localEnrollment === 1 && typeof capability.configBytes === 'number' && capability.configBytes >= CONFIG_BYTES && await compatibleEntry(entry);
14
+ }
15
+ // Explicit setup may upgrade only this owned CLI, even when automatic updates
16
+ // are opted out. Never select an older public package as a feature fallback.
17
+ export async function setupServiceEntry(directory, currentEntry) {
18
+ const selected = readUpdateState(directory);
19
+ if (!selected && !await packageManaged())
20
+ return currentEntry;
21
+ await privateDirectory(directory);
22
+ await privateManagedDirectory(join(directory, 'managed'));
23
+ await privateManagedDirectory(join(directory, 'managed', 'versions'));
24
+ await updateLock(directory, async () => {
25
+ if (supervisorRunning(directory) || runtimeHasLiveOwner(directory))
26
+ throw Error('STOP_CLI_BEFORE_SETUP');
27
+ let state = readUpdateState(directory);
28
+ let entry = state ? await managedEntry(directory, state.active) : undefined;
29
+ const capable = entry ? await supportsLocalEnrollment(entry) : false;
30
+ if (state && capable && state.bootstrap === state.active)
31
+ return;
32
+ if (!entry || !capable) {
33
+ const version = await packageVersion();
34
+ try {
35
+ entry = await stagePackage(directory, version);
36
+ }
37
+ catch (error) {
38
+ if (error instanceof Error && error.message.startsWith('FOREIGN_'))
39
+ throw error;
40
+ throw Error('SETUP_CURRENT_PACKAGE_UNAVAILABLE');
41
+ }
42
+ if (!await supportsLocalEnrollment(entry))
43
+ throw Error('SETUP_CAPABILITY_REQUIRED');
44
+ if (state) {
45
+ state.previous = state.active;
46
+ state.active = version;
47
+ }
48
+ else
49
+ state = initialUpdateState(version);
50
+ delete state.pending;
51
+ delete state.pendingManual;
52
+ delete state.activating;
53
+ delete state.manualRequired;
54
+ }
55
+ if (!state)
56
+ throw Error('SETUP_CAPABILITY_REQUIRED');
57
+ // The old bootstrap's compatibility reader cannot promise the enlarged
58
+ // config bound. Retain its immutable package/previous identity, not its loop.
59
+ state.bootstrap = state.active;
60
+ if (autoUpdateDisabled(directory))
61
+ state.enabled = false;
62
+ writeUpdateState(directory, state);
63
+ });
64
+ return serviceEntry(directory);
65
+ }
@@ -0,0 +1,12 @@
1
+ import { type Config } from './config.js';
2
+ export interface SetupDependencies {
3
+ yes: boolean;
4
+ home?: string;
5
+ stopOwned: () => Promise<void>;
6
+ authenticate: (config: Config) => Promise<{
7
+ serverId: string;
8
+ }>;
9
+ prepare?: () => Promise<void>;
10
+ install: () => Promise<void>;
11
+ }
12
+ export declare function setupEnrollment(directory: string, dependencies: SetupDependencies): Promise<Config>;
package/dist/setup.js ADDED
@@ -0,0 +1,38 @@
1
+ import { homedir } from 'node:os';
2
+ import { resolve } from 'node:path';
3
+ import { loadConfig, saveConfig, privateDirectory, validateOrigin } from './config.js';
4
+ import { DEFAULT_API_ORIGIN } from './local-enrollment.js';
5
+ import { ownRuntime } from './control.js';
6
+ // Lifecycle and identity I/O are injectable: consumer tests never register a
7
+ // service or touch the real home. Callers must use the owned lifecycle adapters.
8
+ export async function setupEnrollment(directory, dependencies) {
9
+ if (!dependencies.yes)
10
+ throw Error('EXPLICIT_YES_REQUIRED');
11
+ await dependencies.stopOwned();
12
+ // Preparation can stage an owned managed version, but never reads or writes
13
+ // enrollment configuration. A concurrent run wins safely before we claim it.
14
+ await dependencies.prepare?.();
15
+ await privateDirectory(directory);
16
+ let cancelled = false;
17
+ const release = await ownRuntime(directory, () => ({ stage: 'setup' }), () => { cancelled = true; });
18
+ let config;
19
+ try {
20
+ config = await loadConfig(directory);
21
+ const origin = validateOrigin(config.apiOrigin ?? DEFAULT_API_ORIGIN, false);
22
+ const identity = await dependencies.authenticate(config);
23
+ if (cancelled)
24
+ throw Error('SETUP_CANCELLED');
25
+ if (!identity.serverId || Buffer.byteLength(identity.serverId) > 512 || config.daemonServerId && config.daemonServerId !== identity.serverId || config.pairs.some(pair => pair.revokedAt === undefined && pair.relayRetiredAt === undefined && pair.daemonServerId && pair.daemonServerId !== identity.serverId))
26
+ throw Error('DAEMON_IDENTITY_CHANGED');
27
+ config.apiOrigin = origin;
28
+ config.cloudEnabled = true;
29
+ config.daemonServerId = identity.serverId;
30
+ config.localEnrollment = { home: resolve(dependencies.home ?? homedir()) };
31
+ await saveConfig(directory, config);
32
+ }
33
+ finally {
34
+ await release();
35
+ }
36
+ await dependencies.install();
37
+ return config;
38
+ }
package/docs/STATE.md CHANGED
@@ -1,9 +1,145 @@
1
- # Current state — 2026-11-12
1
+ # Current state — 2026-11-13
2
+
3
+ ## 0.1.4 release candidate — owner-authorized, not yet published
4
+
5
+ - Pending questions/approvals now use a stable current-occurrence clock, not an
6
+ older task-completion clock. Actual SDK delayed-current/snapshot regressions
7
+ first reproduce resolution/replacement resurrection, then the observation fence
8
+ prevents journal, binding and notification renewal. Actual same-batch SDK reply
9
+ consumers also reproduce caller-continuation resurrection before repair: adapter
10
+ journal ownership removes duplicate synchronization, source fingerprints prevent
11
+ old request text acquiring a replacement binding, and crypto rechecks currentness.
12
+ Cached question/approval consumers fail before exact occurrence capture/drain
13
+ binding, then notifications10/10 pass without old clocks consuming new IDs.
14
+ Final unchanged-input full check passes251/251,typecheck and build. Independent
15
+ Stage A closes both lifecycle blockers; final quality re-review and hosted
16
+ three-platform verification remain pending before immutable publication.
17
+ - Quality review catches observed in-place mutation followed by valid rename;
18
+ both real regressions fail before the pre-retry guard, then resource24/24 pass.
19
+ Hosted40e1b73 passes Linux/macOS but Windows rejects test-injected replacement
20
+ with a live handle. Tests now verify real refusal, complete original contents
21
+ and identity, then actual post-close replacement and strict unsafe-file refusal;
22
+ no production error guard or platform coverage is removed. Narrow review passes.
23
+
24
+ - Ordinary config rename is now distinguished from an unsafe resource: at most
25
+ three reopen attempts, independent descriptor/path validation, retired handles
26
+ discarded, strict no-follow/user/private-mode/link/byte/encoding checks retained.
27
+ Same-inode content changes remain rejected. Real rename regressions reproduce
28
+ the failure before repair, then22resource consumers and the original2runtime
29
+ cases pass. Final unchanged-input full check passes235/235,typecheck and build.
30
+ Stage A narrow review passes; independent quality/security review and fresh
31
+ hosted three-platform verification remain in progress before publication.
32
+
33
+ - Hosted1df64e0 exercises all new behaviors successfully on Windows, but its
34
+ new cache fixture removes the directory before closing SQLite. Combine cleanup
35
+ into one ordered close-then-remove hook; preserve all behavior assertions and
36
+ rerun the full matrix on the corrected test source. Production bytes are unchanged.
37
+
38
+ - Corrected8e4e065 Windows cleanup passes; macOS then rejects signaling an
39
+ already stopped wrapper's old process group. Preserve independent lock/control/
40
+ supervisor/exit assertions and skip redundant group signaling only after those
41
+ shutdown proofs. All4actual local lifecycle consumers pass; narrow review agrees.
42
+
43
+ - Exact tagv0.1.3 and its successful three-platform CI43380589650 are retained.
44
+ Release43381419784 fails its full check before packaging/publication: concurrent
45
+ normal runtime config replacement triggers FOREIGN_RESOURCE_LIMIT in a read.
46
+ Publish and GitHub Release steps are skipped; no0.1.3 package is submitted.
47
+ Preserve that immutable failed tag and prepare0.1.4 after a deterministic repair.
48
+
49
+ - First hosted run43378427840 correctly rejects three cross-environment fixture
50
+ defects: inherited config/service paths, unsupported Windows POSIX-mode equality,
51
+ and an unbound synthetic Paseo home whose local mismatch check had accidentally
52
+ contacted the ordinary daemon read-only. Bind the exact fixture home and require
53
+ its real handshake, no cloud calls, unchanged config and private-output absence.
54
+ - Stricter pending-endpoint controls return409 before activation. Runtime now
55
+ activates only after official identity and original expiry/revocation checks;
56
+ no command/state lane exists in that cycle, and the next cycle validates controls.
57
+ Shared origin quota fences and fixed activation proof remain intact. Independent
58
+ narrow review finds no blocker. Final unchanged-input full check passes221/221
59
+ and build; hosted portability/packaged smoke are being rerun on this exact delta.
60
+
61
+ - Integrated51942a0 and reviewed the final enrollment/setup and packaging delta.
62
+ Exact public0.1.2 archive bytes now live in the test fixtures with verified npm
63
+ SHA1/SHA512 and matching recorded GitHub SHA256, independent of workstation caches.
64
+ - Final full check passes typecheck,221/221 tests and build. Three actual retained
65
+ public0.1.2 migration consumers pass. Real packaged activation/failed-start
66
+ rollback/retained frontend and clean shutdown pass; no everyday service is installed.
67
+ - Release validation accepts additive capability metadata while retaining the
68
+ strict1/1/1 protocol tuple and exact source/package capability equality.
69
+ Constructor-scoped fixture isolation removes inherited operator credentials;
70
+ the smoke retries only read-only unproven-stage probes under its live owned supervisor.
71
+ - Independent Stage A and Stage B reviews find no remaining scoped blocker.
72
+ Main integration, hosted checks, immutable npm/GitHub publication and independent
73
+ registry receipt remain pending. The production cloud remains unchanged.
2
74
 
3
75
  ## Scope
4
76
 
5
77
  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
78
 
79
+ ## Unreleased single-pairing enrollment — source0.1.3, locally accepted
80
+
81
+ - Official Paseo pairing is the only normal user pairing. Explicit
82
+ `setup --yes` prepares the optional owned CLI service; a connected native
83
+ client exchanges the existing per-phone offer through official authenticated
84
+ file APIs. No second QR, pasted invitation, terminal command or new relay
85
+ configuration is required in the app.
86
+ - Discovery is private and bounded; original request identity/expiry, canonical
87
+ offer and cloud-create bytes are durable before network I/O. Activation and
88
+ expiry remove the private handoff. Revocation, retained active phones, custom
89
+ origin, daemon pinning and managed-update opt-out remain authoritative.
90
+ - Confirmed review findings are fixed: duplicate runtime startup never rewrites
91
+ configuration; setup prepares packages before acquiring shared runtime
92
+ ownership, then holds it across load/authenticate/save. A concurrent runtime
93
+ either wins before config loading or is refused. Config readers/writers share
94
+ the524288-byte encoded bound; old managed0.1.2 setup selects a verified
95
+ enrollment-capable current package instead of silently enabling old code.
96
+ - Optional admission performs at most one cloud-create attempt per cycle with
97
+ its own3-second deadline. Unknown results retain exact retry bytes. No cloud
98
+ endpoint, recursive dispatch, polling budget or production deployment changes.
99
+ - Node24.13.0 typecheck passes. The final six-file selection passes37/38;
100
+ its remaining source-setup assertion incorrectly demanded absence of an
101
+ internal managed directory. That implementation-detail assertion is removed,
102
+ while actual package-manager refusal and service-entry checks remain. The
103
+ corrected consumer passes independently and the compiled build passes.
104
+ Both new setup/runtime interleavings failed before the ownership correction.
105
+ - Actual unmodified official Paseo0.15.4 and the native transport exchange the
106
+ canonical offer, verify the real native claim and unchanged activation proof,
107
+ and remove exact private request/response files. One cloud-create body and
108
+ zero official agents are observed. The cloud is a local in-process test
109
+ double; this is not production, physical-device or APNs acceptance.
110
+ - Independent-context source re-review closes the scoped native/CLI findings.
111
+ The weaker same-provider route is explicit; unavailable external native
112
+ reviews are not approvals. Temporary probe code/state are removed, with
113
+ redacted receipts retained outside the repository.
114
+ - Source0.1.3 remains unpublished. Public0.1.2, shared production and existing
115
+ official data are unchanged. No npm tag, TestFlight upload or phone install
116
+ is implied.
117
+
118
+ ## Unreleased Share-first onboarding delta — locally verified
119
+
120
+ - Approved cross-repository plan: MoRemote
121
+ `docs/plans/2026-11-13-share-first-onboarding.md`; CLI ownership is source,
122
+ focused consumers and public docs only. No publication or deployment.
123
+ - Explicit `pair` opts in to cloud, uses the production endpoint only when no
124
+ origin exists, and reuses existing official listen/credential discovery.
125
+ Origin validation, daemon pinning, custom targets/origins and retained
126
+ pair authority remain intact. Plain load/check/status remain passive.
127
+ - Task snapshots carry genuine provider and ISO-8601 creation time alongside
128
+ last-user time, through existing bounded projection and authenticated state.
129
+ Widget equality includes the new meaningful metadata. No assistant-update
130
+ substitution for user recency.
131
+ - Added actual CLI enrollment consumers with a synthetic official WebSocket
132
+ and isolated relay, passive diagnostics/custom authority/invalid-origin and
133
+ daemon-pin cases; added real-SDK encrypted task metadata consumers.
134
+ - Node24.13.0 typecheck, 22 focused pair-onboarding/task-projection/activity/CLI
135
+ consumers, and compiled build pass. The actual SDK/HTTP boundary exercises
136
+ passive diagnostics, authenticated enrollment, custom authority and encrypted
137
+ metadata without production enrollment or official-file changes.
138
+ - Independent read-only review `run-20261113030053-9f69faa3` approves the scoped
139
+ implementation. The same-provider fallback is explicit; this is not physical
140
+ acceptance or a new package release. Public0.1.2 and its cached receiver remain
141
+ unchanged.
142
+
7
143
  ## Native service acceptance — 2026-11-12
8
144
 
9
145
  - Actual Ubuntu26.04/Node24.13.0/systemd259 user-service acceptance passes:
@@ -34,10 +170,10 @@ Owner-approved notification/scoped delivery and local activity/widget integratio
34
170
  later decision; these isolated native tests neither use nor disable it. Older
35
171
  temporary-window shutdown receipts below are historical, not current policy.
36
172
 
37
- ## Local0.1.2 candidate preparation
173
+ ## Released0.1.2 — 2026-11-12
38
174
 
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.
175
+ - Package and lock root identities select0.1.2; no dependency or compatibility
176
+ tuple changes. Owner-approved tagv0.1.2 targets739c76008ea583fa86bfb023dafaa17a3ea9adf4.
41
177
  - The combined check passes typecheck and180/181 tests. Its remaining legacy-wire
42
178
  case incorrectly requires an extra read for an old event that may be coalesced.
43
179
  The test now drains the actual wire and retains the phone-visible no-new-notice
@@ -46,15 +182,32 @@ Owner-approved notification/scoped delivery and local activity/widget integratio
46
182
  failed-start rollback/aliased frontend/clean stop, release identity validation
47
183
  and deterministic0.1.2 packaging pass. These overlapping runs are not a new
48
184
  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
185
+ - Hosted CI43227228037 passes full check/build, release validation and real
186
+ packaged upgrade on Ubuntu24.04, macOS15 and Windows2025.
187
+ Automatic Release43232455123 passes check/build, upgrade smoke, deterministic
188
+ packaging, existing-secret npm publication/provenance and GitHub Release.
189
+ - Anonymous registry reads independently confirm version/latest0.1.2 after
190
+ asynchronous processing; publication is never repeated. Downloaded GitHub
191
+ bytes match SHA256SUMS and npm SHA1/SHA512 integrity. Archive SHA256:
192
+ `845fd98470964303a6a86dc696e64c47ac1e7b1ce90b59cd730cdec56d64f9bb`.
193
+ - Actual public0.1.1 installation/retained supervisor discovers and downloads
194
+ public0.1.2 through its unchanged normal background scheduler, not a custom
195
+ fetcher, direct queue, altered package or fake clock. Exact authenticated
196
+ status becomes0.1.2; bootstrap/previous remain0.1.1; retained frontend returns
197
+ 0.1.2; normal stop exits0 and all owned processes/files are removed, in80.12s.
198
+ No login service, real official connection or cloud operation occurs.
199
+ An initial fixture prepopulates an unowned state directory and is correctly
200
+ rejected before any process starts; initialization is corrected outside the
201
+ managed state, preserving strict ownership. Its exact failed fixture is removed.
202
+ - Production device reply/approval and remote activity/widget delivery still
203
+ require their separate acceptance; the release does not claim those gates.
204
+ - Release: https://github.com/moxuli/moremote-cli/releases/tag/v0.1.2
205
+
206
+ ## Released activity/widget integration — production acceptance open
207
+
208
+ - Published install identity is **`@moxuli/moremote`0.1.2**; command/runtime
56
209
  remains `moremote-cli`, with existing per-platform service identities.
57
- Local activity/widget changes are **not released**; local0.1.2 is a candidate.
210
+ Activity/widget changes are included; physical production acceptance remains open.
58
211
  - Implemented locally: authenticated encrypted per-task interests and activity
59
212
  state, an owned optional2s host lane with250ms exact fallback reads, meaningful
60
213
  keyed widget fingerprints on existing snapshot publication, and normal-only