@moxuli/moremote 0.1.4 → 0.1.6

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
@@ -1,4 +1,4 @@
1
- import { randomUUID, createHash } from 'node:crypto';
1
+ import { createHash } from 'node:crypto';
2
2
  import { join } from 'node:path';
3
3
  import { setTimeout as sleep } from 'node:timers/promises';
4
4
  import { loadConfig, saveConfig, privateDirectory, pruneRetiredPairs } from './config.js';
@@ -13,7 +13,7 @@ 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
+ import { NotificationStatePublisher } from './notification-state.js';
17
17
  import { LocalEnrollment } from './local-enrollment.js';
18
18
  import { inspectResource } from './resources.js';
19
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); }
@@ -96,8 +96,6 @@ export async function runRuntime(dir, version) {
96
96
  const parentGone = () => { draining = true; drainWake.abort(); };
97
97
  let detach, closeJournal;
98
98
  const release = await ownRuntime(dir, () => ({ stage, lastError, activePairs, version: version ?? null }), stop);
99
- const activityLane = new ActivityWorkLane();
100
- let activityFailure = null, activityPairCursor = 0;
101
99
  const enrollment = new LocalEnrollment(dir);
102
100
  try {
103
101
  if (!inspectResource(join(dir, 'config.json'), 'file', true))
@@ -116,8 +114,7 @@ export async function runRuntime(dir, version) {
116
114
  let backoff = LIMITS.pollMs;
117
115
  let measuredAt = 0;
118
116
  let snapshot;
119
- const statePublications = new Map();
120
- const activityPublisher = new ActivityPublisher();
117
+ const statePublisher = new NotificationStatePublisher();
121
118
  const retryStates = new Map();
122
119
  const pollOrigins = new Set();
123
120
  process.once('SIGINT', stop);
@@ -128,8 +125,7 @@ export async function runRuntime(dir, version) {
128
125
  journal.cleanup(now);
129
126
  const config = await loadConfig(dir);
130
127
  pollOrigins.clear();
131
- let failure = activityFailure;
132
- activityFailure = null;
128
+ let failure;
133
129
  let acquisitionFailed = false;
134
130
  const clouds = new Map();
135
131
  const cycleFences = new Map();
@@ -153,10 +149,7 @@ export async function runRuntime(dir, version) {
153
149
  if (pruneRetiredPairs(config, now, journal))
154
150
  await saveConfig(dir, config);
155
151
  journal.cleanupRevocations(config.pairs.map(p => p.pairId), now);
156
- for (const pairId of statePublications.keys())
157
- if (!config.pairs.some(pair => pair.pairId === pairId))
158
- statePublications.delete(pairId);
159
- activityPublisher.retain(config.cloudEnabled ? config.pairs.filter(pair => pair.active && pair.relayRetiredAt === undefined && !journal.pairRevoked(pair.pairId)).map(pair => pair.pairId) : []);
152
+ statePublisher.retain(config.cloudEnabled ? config.pairs.filter(pair => pair.active && pair.relayRetiredAt === undefined && !journal.pairRevoked(pair.pairId)).map(pair => pair.pairId) : []);
160
153
  for (const origin of retryStates.keys())
161
154
  if (!config.pairs.some(pair => (pair.apiOrigin || config.apiOrigin) === origin))
162
155
  retryStates.delete(origin);
@@ -294,33 +287,6 @@ export async function runRuntime(dir, version) {
294
287
  if (bound)
295
288
  await queueAttention(journal, pair, bound);
296
289
  }
297
- if (!stopped && !draining) {
298
- const candidates = config.pairs.filter(pair => pair.active && pair.relayRetiredAt === undefined && !journal.pairRevoked(pair.pairId) && clouds.has(pair.pairId));
299
- const ordered = [...candidates.slice(activityPairCursor), ...candidates.slice(0, activityPairCursor)], activitySnapshot = snapshot, activityOfficial = official;
300
- // Schedule cached terminal recovery before any optional normal discovery.
301
- // The owned lane never delays command acquisition and is aborted/joined on drain.
302
- if (activityLane.start(async (signal) => {
303
- let optionalFailure;
304
- for (const terminalOnly of [true, false])
305
- for (const pair of ordered) {
306
- signal.throwIfAborted();
307
- if (!pair.active || journal.pairRevoked(pair.pairId))
308
- continue;
309
- const cloud = clouds.get(pair.pairId);
310
- try {
311
- await activityPublisher.publish(pair, cloud, activitySnapshot, Date.now(), (agentId, readSignal) => activityOfficial.activityTask(agentId, readSignal), { signal, terminalOnly });
312
- }
313
- catch (error) {
314
- if (signal.aborted)
315
- throw error;
316
- optionalFailure ??= error;
317
- }
318
- }
319
- if (optionalFailure)
320
- throw optionalFailure;
321
- }, error => { activityFailure = error; }, AbortSignal.any([controller.signal, drainWake.signal])))
322
- activityPairCursor = (activityPairCursor + 1) % Math.max(1, candidates.length);
323
- }
324
290
  for (const pair of config.pairs) {
325
291
  if (stopped)
326
292
  break;
@@ -347,20 +313,10 @@ export async function runRuntime(dir, version) {
347
313
  const active = await activatePending(config, dir, pair, cloud, official.info().serverId, snapshot.hostName);
348
314
  if (!active)
349
315
  continue;
316
+ let detailsCurrent = false;
350
317
  try {
351
- let publication = statePublications.get(pair.pairId);
352
- // A lost acknowledgement keeps the exact immutable envelope even across a
353
- // newer measurement. Expired display-only state can yield to a fresh sample.
354
- if (!publication || publication.envelope.expiresAt <= Date.now() || (publication.acknowledged && publication.envelope.issuedAt !== snapshot.measuredAt)) {
355
- const payload = await projectSnapshot(snapshot, pair, journal, official.generation);
356
- 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);
357
- publication = { envelope, widgetFingerprint: await widgetFingerprint(pair, payload), acknowledged: false };
358
- statePublications.set(pair.pairId, publication);
359
- }
360
- if (!publication.acknowledged) {
361
- await cloud.state(publication.envelope, publication.widgetFingerprint);
362
- publication.acknowledged = true;
363
- }
318
+ const payload = await projectSnapshot({ ...official.notificationSnapshot(), hostName: snapshot.hostName, measuredAt: snapshot.measuredAt }, pair, journal, official.generation);
319
+ detailsCurrent = await statePublisher.publish(pair, cloud, payload);
364
320
  }
365
321
  catch (error) {
366
322
  failure = error;
@@ -374,6 +330,8 @@ export async function runRuntime(dir, version) {
374
330
  failure = error;
375
331
  }
376
332
  for (const item of journal.attention(pair.pairId, Date.now())) {
333
+ if (!detailsCurrent && ['question', 'permission'].includes(item.body.kind))
334
+ continue;
377
335
  try {
378
336
  await cloud.attention(item.body);
379
337
  journal.attentionSent(pair.pairId, item.id);
@@ -455,7 +413,6 @@ export async function runRuntime(dir, version) {
455
413
  process.removeListener('message', parentMessage);
456
414
  process.removeListener('disconnect', parentGone);
457
415
  try {
458
- await activityLane.close();
459
416
  detach?.();
460
417
  await official?.close().catch(() => { });
461
418
  }
package/docs/STATE.md CHANGED
@@ -1,6 +1,49 @@
1
- # Current state — 2026-11-13
2
-
3
- ## 0.1.4 release candidate — owner-authorized, not yet published
1
+ # Current state — 2026-11-14
2
+
3
+ ## Released0.1.5 — 2026-11-14
4
+
5
+ Owner-authorized tagv0.1.5 targets `ba8a428b63562cdd4b258cd79f7a8251af067dbd`.
6
+ GitHub CI43567209765 passes complete checks and real packaged upgrade/rollback
7
+ on Windows, Linux and macOS. Release43567215583 succeeds through the existing
8
+ scoped-secret npm/provenance and GitHub publication workflow. Anonymous registry
9
+ readback confirms version/latest0.1.5. The public npm and GitHub tarballs are
10
+ byte-identical, match registry SHA512 and GitHub SHA256SUMS, and the isolated
11
+ public installation reports0.1.5. Tarball:137104bytes, SHA256
12
+ `8ad64844cab23dea5c0295e6e9b7ef3d4f0e88785c517ec182c783bdd23147dd`.
13
+
14
+ Cloudflare retains only notifications and explicit notification replies/approvals.
15
+ Deleted activity interests, optional surface lane, widget fingerprints and quota
16
+ reads. `/state` contains verified daemon identity and exact current bound requests
17
+ only. Accepted source reads retain pending requests outside bounded discovery;
18
+ resolution/replacement/reconnect fences prevent stale resurrection. Publish only
19
+ semantic changes, one final clear, and near-expiry pending hydration. Unknown
20
+ ACK retries keep original bytes and cannot replay user actions.
21
+
22
+ Fresh full `npm run check` passes237 behavioral tests, types and compilation.
23
+ Real SDK and real runtime subprocess consumers verify preserved notification
24
+ question/approval encoding,3s control cadence, normal/outage pause fences,
25
+ immutable lost acknowledgements, drain/receipt ownership and zero idle surface or
26
+ directory calls. Projection tests first exposed leaked title/host/usage fields
27
+ and silently dropped oversized requests; all now pass. Read-only independent
28
+ review found no remaining authority/replay blocker. The initial local aliased
29
+ frontend smoke exceeded its10second budget during concurrent builds; the exact
30
+ preserved frontend subsequently ran in0.58seconds, and the complete unchanged
31
+ upgrade/rollback smoke passed. No timeout or production behavior was relaxed.
32
+ No everyday service, installed runtime or production host session was changed.
33
+ The previous0.1.4 publication below remains historical.
34
+
35
+ ## Released0.1.4 — 2026-11-13
36
+
37
+ - Owner-authorizedv0.1.4 targets tested sourcea5615b6. Final local251/251,
38
+ typecheck/build and independent source reviews pass. HostedCI43389151913 passes
39
+ complete checks/identity/real upgrade and rollback on Linux, macOS and Windows.
40
+ - Release43390548675 succeeds through existing-secret npm/provenance and GitHub
41
+ publication. Independent public reads confirm version/latest0.1.4; downloaded
42
+ npm/GitHub bytes match SHA1/SHA512, GitHubSHA256SUMS and the exact local artifact.
43
+ SHA256: `c0e56b6ce596216fea6b2e546fc153c3833bafebc4c5ecf271d18b6a2d4e5151`.
44
+ - No everyday service, ordinary official conversation or production cloud change.
45
+ Earlier unreleased/acceptance entries below are historical checkpoints; these
46
+ verified publication facts supersede their former release status.
4
47
 
5
48
  - Pending questions/approvals now use a stable current-occurrence clock, not an
6
49
  older task-completion clock. Actual SDK delayed-current/snapshot regressions
@@ -33,7 +76,7 @@
33
76
  - Hosted1df64e0 exercises all new behaviors successfully on Windows, but its
34
77
  new cache fixture removes the directory before closing SQLite. Combine cleanup
35
78
  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.
79
+ rerun the full matrix on the corrected test source. Production code is unchanged.
37
80
 
38
81
  - Corrected8e4e065 Windows cleanup passes; macOS then rejects signaling an
39
82
  already stopped wrapper's old process group. Preserve independent lock/control/
@@ -74,7 +117,7 @@
74
117
 
75
118
  ## Scope
76
119
 
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.
120
+ Owner-approved notification/scoped delivery; local native surfaces are app-owned; 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.
78
121
 
79
122
  ## Unreleased single-pairing enrollment — source0.1.3, locally accepted
80
123
 
@@ -14,7 +14,7 @@ existing official daemon and preserve its exact identity, then enable cloud and
14
14
  local enrollment before installing/starting the existing owned service.
15
15
  Configured custom HTTPS origin/target, existing active/revoked phones and update
16
16
  policy are preserved. An absent origin selects
17
- `https://moremote-cloud-ingress.pages.dev`. Source checkout without managed state
17
+ `https://api.moremote.moxuli.com`. Source checkout without managed state
18
18
  binds its own current frontend and stays manual-update. Installed packages and
19
19
  retained managed state use capability-aware setup: if selected code predates
20
20
  enrollment, explicit setup installs/verifies the exact current version before
@@ -24,6 +24,14 @@ packages, pairs/custom origin and the independent auto-update opt-out.
24
24
  never enabled success or an older-package fallback. Nothing patches/upgrades
25
25
  official Paseo or global tools. This capability requires CLI0.1.4 or later.
26
26
 
27
+ The custom-domain default applies only when `apiOrigin` is absent. Every saved
28
+ origin remains authoritative, including the former default
29
+ `https://moremote-cloud-ingress.pages.dev`; setup, expert pairing and runtime do
30
+ not migrate it. Existing per-phone origins, original pending offers and exact
31
+ cloud-create bytes retain their original authority. Both domains must directly
32
+ serve the same notification service; redirects are not a migration mechanism.
33
+ Release the new default only after custom-domain DNS and TLS are verified.
34
+
27
35
  Optional schema-1 fields are `localEnrollment:{home:<absolute user home>}` and
28
36
  at most16 `enrollmentRequests`. Only explicit setup supplies that home; ordinary
29
37
  `run`/tests with legacy configuration never create discovery in the real HOME.
@@ -92,55 +100,16 @@ snapshots/receipt revisions are not retransmitted each poll. Relay disappearance
92
100
  or retirement fences execution but is not authenticated endpoint revocation.
93
101
  Retired recovery ends at original child audit deadlines without extending them.
94
102
 
95
- ## Optional activity and widget surfaces (unreleased)
96
-
97
- Published `@moxuli/moremote` remains0.1.1; these are local source changes,
98
- not a new release or a reason to alter service/runtime identities. There is no
99
- new CLI enable flag or separate activity-device command. Existing cloud opt-in,
100
- active pairing and a compatible phone/relay are prerequisites; official-only
101
- use remains independent. No deployment or device acceptance is implied.
102
-
103
- | Surface | Bound / behavior |
104
- | --- | --- |
105
- | Activity interests | Phone-selected, encrypted and pinned to pair/subscription/daemon/task; at most8 live interests per pair, original lifetime at most8h. |
106
- | 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. |
107
- | 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. |
108
- | 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. |
109
- | Widget registration | One current WidgetKit token per pair;24h expiry, native foreground renewal around12h with a fresh registration ID. Not the alert/activity token. |
110
- | 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. |
111
-
112
- The phone registers/deletes tokens and encrypted interests; the CLI never
113
- registers an official daemon push token or downloads full chat/timeline for
114
- these surfaces. The relay sees token/environment, IDs, opaque topic/fingerprint,
115
- envelope times/sizes and ciphertext. Only paired endpoints decrypt task/title,
116
- host/project and genuine usage values. Apple receives encrypted activity state
117
- in `ContentState.payload`, or exactly `{aps:{"content-changed":true}}` for widgets.
118
- Activity/widget pushes do not depend on alert admission or presence suppression.
119
-
120
- Terminal recovery uses cached authenticated unexpired interests and fresh
121
- snapshot facts before optional normal discovery; it needs no normal GET/state
122
- upload. Only end/delete routes are recovery-eligible, not ordinary updates,
123
- interest reads or registration. A404/409 publication rejection invalidates that
124
- cached target; it does not authorize a replacement or a blind replay. Conflicting
125
- same-registration bytes are409; replacement needs a fresh registration ID.
126
- Relay retired-identity guards share a1000-entry cap and fail closed rather than
127
- evicting live protection; guards last through original8h activity/24h widget
128
- expiry. Delayed registration PUTs cannot roll back replacements; identity-exact
129
- widget DELETEs and stale provider results cannot retire newer registrations.
130
- Activity DELETE targets the subscription itself. Expiry never renews through
131
- retry; stale/offline is not success.
132
-
133
- The relay needs explicit `APNS_WIDGET_TOPIC` for the widget extension plus
134
- `.push-type.widgets`; Live Activity topic is main `APNS_TOPIC` plus
135
- `.push-type.liveactivity`. Environments must match configured APNs sending.
136
- These are relay settings, not CLI configuration keys. Default-off, global
137
- budgets, kill deadline and existing receipt priority remain unchanged.
138
- Provider signing is inside the original10s attempt deadline; after signing,
139
- the durable caller rechecks enabled state, active pair, exact current
140
- registration/publication and expiry immediately before transport.
141
- APNs200 is provider admission, never display/delivery proof. Physical Live
142
- Activity, widget reload/freshness/offline behavior and live cloud/APNs acceptance
143
- for this delta remain pending. Exact routes/crypto: [[specs/03-api-contract]].
103
+ ## Notification-only cloud use
104
+
105
+ Cloud opt-in owns native notifications, replies and approvals only. Pending forms
106
+ are encrypted with exact request-instance bindings; no titles, usage or general
107
+ task directory leave through `/state`. Current empty state is cleared once and
108
+ is not renewed. Nonempty hydration renews with120seconds remaining of600seconds.
109
+ Unknown publication retries retain their original envelope until expiry; this
110
+ never grants authority to replay an uncertain user action. WidgetKit, ActivityKit
111
+ and ordinary app/extension sends are independent official Paseo clients. No
112
+ activity/widget provider registration or discovery command remains.
144
113
 
145
114
  ## Service resources
146
115
 
@@ -0,0 +1,21 @@
1
+ # Native enrollment and request delivery acceptance
2
+
3
+ Date: 2026-11-13. Scope: unpublished source candidate with an unmodified official Paseo0.15.4 development daemon and its built-in mock provider, an isolated computer home, production cloud transport and a physical iPad. No paid model or ordinary user conversation was exercised.
4
+
5
+ ## Observed results
6
+
7
+ - The native app retains its existing official host connection. An installed companion exchanges the per-phone offer over official authenticated file APIs and activates the production endpoint without another QR code or pasted invitation. An explicitly disabled previous endpoint still requires deliberate re-enablement; disabled history is not silently overwritten.
8
+ - A pending endpoint initially receives409 from active-only control routes. Runtime must validate official identity and original enrollment authority, activate in an activation-only cycle, and acquire fresh controls on the next cycle before commands or state publication. The production continuation activates the original pending offer after this correction.
9
+ - Official request snapshots can retain an older completion attention timestamp/reason while containing a new pending approval. Request notification authority therefore uses the persisted current occurrence, independently of that global completion hint. Unchanged occurrences retain their original clock and immutable notification bytes; resolution/replacement must not renew old authority.
10
+ - A real production permission notification opens the exact native request-review surface. Approve and deny are exercised on two distinct, still-pending official mock requests. Each produces one official resolution, no remaining pending request, and a resolved companion operation with revision1 acknowledged to cloud. Notification invalidation is acknowledged once for each occurrence.
11
+ - Production task tracking creates a subscription; a genuine terminal APNs activity update renders on the iPad and opens the exact task. Foreground terminal cleanup removes the subscription.
12
+
13
+ ## Focused local proof
14
+
15
+ The stricter pending-endpoint fixture reproduces the activation deadlock before repair. The focused enrollment selection passes22 tests; the existing runtime quota-pause consumer also passes with the controls-first fence. Three real SDK request-notification wire consumers reproduce stale completion hints, absent attention flags and stale permission clocks. The final selected notification/attention/official-wire set passes14 tests, typecheck and build. These are scoped results, not a claim that all later concurrent release-candidate changes were checked here.
16
+
17
+ ## Deliberately incomplete claims
18
+
19
+ An unlocked Notification Center text reply is submitted once, but native status remains unknown and no corresponding companion execution is observed. It is not replayed or reported as delivered. A hardware lock command has no conclusive lock-state evidence; this is not locked-reply acceptance. Full foreground/background/terminated delivery, cancellation, ActivityKit token rotation, widget remote token lifecycle, Siri, physical Action Button and interrupted file-share coverage remain separate gates. The test iPad has no physical Action Button.
20
+
21
+ Keep real task/host identifiers, endpoint tokens, device exports and raw receipts outside this public repository. Production deployment and cost limits are unchanged. No npm, TestFlight or cloud release is established by this document.
@@ -0,0 +1,69 @@
1
+ # Custom notification API origin
2
+
3
+ Owner-authorized preparation for the registered `moxuli.com` domain. Keep DNS
4
+ with Aliyun and bind `api.moremote.moxuli.com` to the existing Pages/Worker
5
+ notification service. This CLI branch performs no DNS/service deployment,
6
+ version bump, publication, real enrollment or service registration.
7
+
8
+ ## Acceptance and authority
9
+
10
+ - New explicit setup, its published local descriptor and expert `pair` use
11
+ `https://api.moremote.moxuli.com` only when config has no API origin.
12
+ - Reuse the existing `DEFAULT_API_ORIGIN` export; remove the separate expert
13
+ pairing literal. Default selection is not an implicit configuration migration.
14
+ - Preserve every existing configured origin, including the Pages default, and
15
+ every active/revoked/pending pair's original API authority and secrets.
16
+ - Resume retained enrollment requests with original request/offer/create bytes;
17
+ do not regenerate offers, extend expiry, replay uncertain mutations or redirect
18
+ enrolled phones to another origin.
19
+ - Both domains must directly reach the same notification backend. Widgets and
20
+ Live Activities acquire no new Cloudflare dependency.
21
+
22
+ ## Implementation and verification
23
+
24
+ `src/local-enrollment.ts` owns the shared default; existing setup and discovery
25
+ already consume it. `src/cli.ts` imports it for expert pairing. No encryption,
26
+ notification dispatch, official protocol, retry or service ownership behavior
27
+ changes.
28
+
29
+ Add regressions first: assert the literal new origin in fresh setup and its
30
+ descriptor, execute the real CLI expert onboarding against an in-process relay,
31
+ and preserve a saved Pages configuration with active/revoked/pending pairings
32
+ and immutable enrollment bytes. CLI fixtures replace native service-manager
33
+ queries with a temporary Node process that reports absent registration and
34
+ rejects lifecycle operations; a real installed service must never be consulted.
35
+
36
+ Integration owner runs:
37
+
38
+ ```sh
39
+ node --import tsx --test tests/local-enrollment.test.ts tests/pair-onboarding.test.ts tests/setup-command.test.ts tests/setup-migration.test.ts
40
+ npm run check
41
+ ```
42
+
43
+ Baseline RED: fresh setup selected the old Pages domain; the retained Pages
44
+ compatibility regression passed. The initial expert fixture stopped at
45
+ `FOREIGN_SERVICE_REGISTRATION` during diagnostics because changing HOME does
46
+ not isolate a native manager's real user domain. Correct the fixture rather
47
+ than weakening production ownership checks. Passing acceptance remains for
48
+ the integration owner to record after implementation.
49
+
50
+ ## Publication gate
51
+
52
+ Do not publish a CLI containing the new default until authoritative DNS,
53
+ certificate validation and direct HTTPS service behavior succeed on the
54
+ custom domain. Also verify the former Pages domain still directly serves the
55
+ same backend and existing pairings remain usable. Aliyun DNS entry and
56
+ Cloudflare binding are owned by the integration/deployment task. Keep the
57
+ package version unchanged during preparation; record final external evidence
58
+ and make any release decision separately.
59
+
60
+ ## Local verification and release gate
61
+
62
+ The custom hostname is active. Independent DNS, certificate and direct JSON API
63
+ reads pass on both origins without redirects. Full local check:238 tests, zero
64
+ failures; the actual packaged upgrade/rollback smoke, tag validation and
65
+ deterministic0.1.6 pack pass. A subsequent test-only Windows preload URL
66
+ correction passes both actual CLI fixture suites (5 tests). Independent quality
67
+ re-review clears the source; actual Windows, Linux and macOS CI remains required
68
+ before tagging. The published package remains0.1.5 until the release receiver
69
+ independently confirms0.1.6. No real service registration was performed.
@@ -37,7 +37,7 @@ per-user operation.
37
37
 
38
38
  ## Components
39
39
 
40
- - **Official adapter:** authenticated local daemon connection, bounded snapshot
40
+ - **Official adapter:** authenticated local daemon connection, bounded local notification discovery
41
41
  and authoritative event subscriptions; no fake user focus/read acknowledgements.
42
42
  - **Attention projection:** completion, pending question/approval and supported
43
43
  errors from typed evidence; no prose classifiers or fabricated progress/usage.
@@ -100,3 +100,16 @@ background-service installer on another OS. No package publication, public Git
100
100
  repository, automatic installer execution or production service registration is
101
101
  implied by implementation approval. The owner selected Apache-2.0; public
102
102
  publication remains separately authorized.
103
+
104
+ ## Notification-only cloud boundary — November 14
105
+
106
+ The optional companion publishes only current question/approval forms and their
107
+ exact occurrence bindings. It does not request provider usage or upload task
108
+ titles, host/project labels or a conversation directory. Accepted source reads
109
+ retain pending requests outside the bounded recent discovery page; stale reads
110
+ and resolved/replaced occurrences cannot restore them. Publication changes are
111
+ deduplicated; only pending hydration renews near expiry, and one empty publication
112
+ clears the last resolved request. Unknown acknowledgements retain immutable bytes.
113
+ No activity interests, WidgetKit registrations or dedicated surface APNs calls
114
+ remain. Notification control, explicit reply/approval execution, immutable action
115
+ journals and outcome reconciliation retain their original safeguards.
@@ -150,10 +150,10 @@ survive payload TTL for24hours after original expiry, including after revoke.
150
150
  Historical decoding is read-only and cannot extend command authority. After
151
151
  retention, the outcome is unavailable/unverifiable, not a cloud-only success.
152
152
 
153
- State snapshots are encrypted, size-bounded and timestamped. They contain useful
154
- current task/attention/real available-usage summaries, not the full conversation.
155
- The phone can preserve a stale snapshot with its original timestamp, never show
156
- it as a freshly measured host state. State is display-only, not an operation
153
+ State is encrypted, size-bounded notification hydration: verified daemon identity
154
+ and exact current request forms/bindings only. Directory, titles and usage are
155
+ excluded. A stale form is never execution authority; the host must validate the
156
+ current occurrence again before an explicit notification response. State is display-only, not an operation
157
157
  outcome audit: only the latest nonexpired snapshot keeps ciphertext, while each
158
158
  immutable state ID/digest survives supersession only through that envelope's
159
159
  original expiry. Exact retries do not renew it; expired snapshots cannot be newly
@@ -103,9 +103,7 @@ without contacting cloud.
103
103
 
104
104
  ### PUT /pairs/{pairId}/state; GET /pairs/{pairId}/state
105
105
 
106
- Host writes, phone reads. PUT accepts strict `{envelope}` or additive
107
- `{envelope,widgetFingerprint}`; GET returns the envelope only, as specified below.
108
- Envelope channel is `state`.
106
+ Host writes, phone reads. Body/response contains exactly `{envelope}` with the `state` channel.
109
107
  Only the latest nonexpired snapshot keeps ciphertext, monotonic by issuedAt then
110
108
  immutable ID. Each state ID/digest remains a conflict guard through its own
111
109
  original envelope expiry, including after supersession; no additional24hour
@@ -114,9 +112,14 @@ conflicting IDs/older snapshots never replace newer state. After expiry, a retry
114
112
  cannot be admitted as new live state. Supersession clears only the previous
115
113
  payload-bearing state, never rewrites older null tombstones. Operation, control,
116
114
  attention and minimal authenticated outcome retention is unchanged.
117
- Encrypted state is a versioned object with verified daemon
118
- identity, host name, measured timestamp and bounded actual tasks/available usage.
119
- No complete chat, code files or credentials.
115
+ Encrypted state is limited to `{version:1,daemonServerId,tasks}`. Each task
116
+ contains only `{agentId,pendingRequests}`; each pending request retains its exact
117
+ `requestId`, occurrence-bound `requestBinding` and original supported request.
118
+ This hydrates notification replies and approvals only. It contains no conversation
119
+ titles, directory, host labels, timestamps or usage report. Empty tasks are omitted.
120
+ Writers publish semantic changes, clear resolved requests once, and renew only
121
+ still-pending hydration near its original expiry. Immutable unknown retries keep
122
+ the same ID and bytes. Current-source validation remains mandatory at execution.
120
123
 
121
124
  ### PUT /pairs/{pairId}/device
122
125
 
@@ -398,120 +401,12 @@ host pairing response may contain two bounded proofs. A128KiB response reader
398
401
  would permanently reject valid work and is nonconforming. This larger response
399
402
  budget never raises the128KiB request or64KiB decrypted command-content limits.
400
403
 
401
- ## Opt-in task activities and widget reloads
402
-
403
- These additive routes do not change command, receipt, alert, pairing, service,
404
- or managed-update identities. Cloud remains disabled by default. Every route
405
- uses the existing pair bearer; subscription IDs and registration IDs are
406
- lowercase canonical UUIDs. No pair-level activity-device registration exists.
407
-
408
- | Route (under `/v1/pairs/{pairId}`) | Role | Exact JSON body | Admission |
409
- | --- | --- | --- | --- |
410
- | `PUT /activities/{subscriptionId}` | phone | `{registrationId,token,environment,topic,interest}` | normal |
411
- | `DELETE /activities/{subscriptionId}` | phone | none | recovery |
412
- | `GET /activities` | host | none | normal |
413
- | `PUT /activities/{subscriptionId}/state` | host | `{registrationId,topic,event:"update",envelope}` | normal |
414
- | `PUT /activities/{subscriptionId}/end` | host | `{registrationId,topic,event:"end",envelope}` | recovery |
415
- | `PUT /widget-device` | phone | `{registrationId,token,environment}` | normal |
416
- | `DELETE /widget-device/{registrationId}` | phone | none | recovery |
417
-
418
- Tokens are even-length hex,1–256 bytes, normalized lowercase. Environment is
419
- `sandbox|production`; provider configuration must match. The activity `topic`
420
- is the existing pair-key HMAC `presenceTopic(rootKey,pairId,agentId)` (32 bytes,
421
- base64url), not an APNs topic or plaintext agent identity. At most8 live
422
- subscriptions are admitted per pair. GET returns
423
- `{ok:true,subscriptions:[{id,registrationId,topic,interest,expiresAt}]}`.
424
- PUT registration returns the same single row as `{ok:true,subscription:...}`.
425
- Registration replacement uses a fresh registrationId; different bytes under
426
- the same registrationId conflict. Native renewal must preserve the ActivityKit
427
- activity's original8-hour ceiling. DELETE removes queued state immediately.
428
- Retired subscription/registration IDs share a bounded1000-entry token-free guard
429
- pool with widget registrations. Delayed registration PUTs cannot resurrect or
430
- roll back retired identities. Widget DELETE is registration-exact; activity DELETE targets the subscription.
431
- Activity guards retain the original8h ceiling and widget guards the original24h
432
- expiry, without retry extension. Unknown DELETEs also reserve bounded guards;
433
- capacity exhaustion fails closed, never evicts live protection.
434
-
435
- The encrypted `interest` uses additive channel `activityInterest`, envelope.id
436
- equal to subscriptionId, lifetime at most8h. Exact plaintext:
437
- `{version:1,subscriptionId,daemonServerId,agentId}`. The companion authenticates
438
- the envelope, pinned daemon, exact subscription and derived topic before any
439
- read-only task lookup. This plaintext cannot authorize commands. No timeline
440
- or chat download is required. Existing snapshot cadence (at least30s) admits
441
- one bounded interest pass, at most8 exact fallback reads outside the recent list.
442
- The owned optional lane has a2s deadline,250ms SDK reads and request cancellation.
443
- Commands/control never await it; drain aborts/joins before SDK/journal close. Missing tasks never imply finish.
444
-
445
- Activity state uses additive channel `activityState`, fresh envelope UUID and
446
- at most600s lifetime, capped by subscription expiry. Exact plaintext:
447
- `{version:1,subscriptionId,daemonServerId,agentId,title,hostName,phase,startedAt,measuredAt,expiresAt,requiresAttention,isTerminal}`.
448
- Title/hostName are limited to160/80 characters. Phase is
449
- `running|waiting|finished|error|idle`; permission attention maps to waiting;
450
- official closed/error or current terminal attention maps to end. A running
451
- turn supersedes an old terminal attention flag. startedAt is nullable, from
452
- official activeTurn.startedAt or lastUserMessageAt, never a measurement
453
- substitute. measuredAt/expiresAt exactly match envelope headers in milliseconds.
454
- Existing encrypted snapshots also include optional lastUserMessageAt,
455
- activeTurnStartedAt and bounded cwd per task. Encrypted usage adds genuine
456
- provider displayName and window/balance label (at most128 characters each),
457
- preserving absent values as unavailable. No full chats, invented labels or
458
- synthetic percentages are added.
459
-
460
- HKDF salt, AES-GCM nonce/tag framing, metadata AAD and existing channels remain
461
- byte-compatible. Only the new channel name changes HKDF info. Activity state
462
- serialized envelope is at most3000 UTF-8 bytes. Native ContentState has default
463
- Codable field `payload`, a canonical JSON string of that envelope (key order
464
- version,pairId,id,channel,issuedAt,expiresAt,nonce,ciphertext).
465
- Updates derive directly from real semantic task transitions, independently of
466
- alert admission/presence suppression. Unchanged measurements normally do not push.
467
- Acknowledged nonterminal state renews from fresh samples every8minutes (120s before600s expiry).
468
- Unknown admissions retain identical ciphertext until expiry; semantic changes can supersede progress. Disconnected state expires.
469
-
470
- Live authenticated interests are cached against the current pair key/daemon. Terminal work precedes optional normal discovery, once per fresh
471
- snapshot, without GET/state admission; authenticated404/409 invalidates its cache.
472
- Only exact429 `daily_work_limit`, `x-moremote-budget:normal` and consistent future
473
- `x-moremote-reset`/Retry-After pauses normal work alone. Missing/malformed hints,
474
- outages, disable or recovery exhaustion preserve origin-wide pause/cycle fences.
475
- Recovery still requires server admission; hints never grant operation authority.
476
-
477
- APNs uses `apns-push-type:liveactivity`, configured main topic plus
478
- `.push-type.liveactivity`, priority5 update/10 end, collapse-id subscriptionId,
479
- apns-id envelope.id, expiration floor(expiresAt/1000). Body is
480
- `{aps:{timestamp,event,"content-state":{payload},"stale-date"}}`; all APNs dates
481
- are epoch seconds. End additionally sets dismissal-date. There is no apns-event
482
- header. A512-byte static-attributes reserve and the complete4096-byte provider
483
- payload limit both apply. End and invalid-token retirement compare the exact
484
- current registration identity; stale provider failures never remove replacement
485
- tokens. Provider admission is not proof of rendering.
486
-
487
- Existing `PUT /state` accepts strict legacy `{envelope}` or additive
488
- `{envelope,widgetFingerprint}`. GET state remains unchanged. The new fingerprint
489
- is a pair-keyed HMAC using the presence domain over JSON
490
- `["widgetSnapshot",meaningfulProjection]`. Projection includes bounded sorted
491
- task identity/title/status/attention/latest turn/project plus usage values;
492
- measurement and usage fetchedAt clocks are excluded. Only a changed opaque
493
- fingerprint for the current widget registration queues a coalesced push.
494
- Legacy envelope-only publications do not cause widget pushes.
495
-
496
- Widget registration expires after24h and requires foreground/token renewal
497
- (native renewal around12h uses a fresh registration ID).
498
- Native uses the WidgetKit token, not an alert or activity token. Explicit
499
- `APNS_WIDGET_TOPIC` is the widget extension bundle ID plus `.push-type.widgets`;
500
- it is never derived from the main app topic. APNs uses push-type widgets,
501
- priority5 and `{aps:{"content-changed":true}}`, no private identifiers.
502
- WidgetKit automatically reloads timelines opportunistically on receipt;
503
- WidgetPushHandler observes token/configuration updates. Timeline providers use
504
- the existing sealed snapshot and its expiry; reload is not realtime delivery.
505
- See Apple's [WidgetKit push documentation](https://developer.apple.com/documentation/widgetkit/updating-widgets-with-widgetkit-push-notifications).
506
-
507
- Activity/widget work shares bounded provider attempts and background batches
508
- with alerts; no recursive requests, unbounded retries, recovery-budget borrowing
509
- for progress or changes to endpoint retirement/receipt/updater lifecycle.
510
-
511
- Every APNs sender requires a synchronous `BeforeSend = () => boolean` fence
512
- after asynchronous JWT signing and immediately before transport. The durable
513
- caller rechecks service enabled, active pair, exact current registration and
514
- publication, and expiry. Signing shares the original10s attempt deadline;
515
- late signing cannot start transport. Global budgets and kill deadline are unchanged.
516
- Physical Live Activity/widget behavior and live APNs/cloud delivery for this
517
- delta remain pending; provider200 never establishes device delivery.
404
+ ### Retired system-surface routes
405
+
406
+ Authenticated `/pairs/{pairId}/activities` and descendants, and
407
+ `/pairs/{pairId}/widget-device` and descendants, return `410 surface_removed`.
408
+ No registrations, tokens, interests, states, replay guards or provider queues for
409
+ these features remain. Durable Object initialization purges legacy surface rows;
410
+ notification device, attention, operation and control records remain intact.
411
+ Widgets and local ActivityKit read/update through the official Paseo path and
412
+ shared device state, independently of this notification service.
@@ -123,13 +123,21 @@ The companion persists its root/host/enrollment capabilities before POST pairs,
123
123
 
124
124
  Unreleased source onboarding: invoking `pair` is explicit cloud consent. If
125
125
  `apiOrigin` is absent, select the built-in
126
- `https://moremote-cloud-ingress.pages.dev`; otherwise preserve and validate the
126
+ `https://api.moremote.moxuli.com`; otherwise preserve and validate the
127
127
  configured origin. Existing target, local official discovery and daemon pin
128
128
  remain authoritative. Persist cloud-enabled configuration and the new offer
129
129
  only after the official connection succeeds, before relay creation. Retained
130
130
  pair keys, origins and revocation are never changed by a new enrollment.
131
131
  Passive config loads/check/status do not opt in, and pairing installs no service.
132
132
 
133
+ Explicit setup, the discovery descriptor and expert `pair` share this one
134
+ default. A saved `apiOrigin`, including the former default
135
+ `https://moremote-cloud-ingress.pages.dev`, is never replaced on upgrade/setup.
136
+ Retained per-pair origins, pending request/offer bytes and cloud-create bytes are
137
+ unchanged. Both domains directly serve the same notification backend; the
138
+ default change authorizes no redirect, old-pair migration or protocol change.
139
+ Custom-domain DNS/TLS verification is a release prerequisite.
140
+
133
141
  ## Official compatibility and observation
134
142
 
135
143
  Pin client/protocol0.15.3. createHostClient from client/node and exported internal/daemon-client types are the inspected API. Use clientType cli and a distinct companion clientId. Missing explicitEventSubscriptions fails closed. Subscribe only agent_attention_required, agent_permission_request, agent_permission_resolved, status.server_info with official remote notifications disabled. Never call client_heartbeat, clear_agent_attention, workspace read acknowledgement or register_push_token. Inspected SDK automatic liveness uses bare protocol ping (10s), not visible-user presence. Actual synthetic WebSocket consumers exercise the real adapter/SDK, await that liveness interval, verify wire traffic, then lose send/permission acknowledgements and reconnect without a second mutation.