@dsh-mobile/mobile-remote 3.3.0 → 3.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/FAQ.md +2 -2
  2. package/LICENSE +0 -0
  3. package/README.md +13 -8
  4. package/docs/PRIVACY-POLICY.en.md +26 -18
  5. package/docs/PRIVACY-POLICY.md +26 -18
  6. package/docs/SUPPORT.md +1 -1
  7. package/docs/TERMS-OF-SERVICE.en.md +5 -3
  8. package/docs/TERMS-OF-SERVICE.md +5 -3
  9. package/docs/USER-GUIDE.zh-CN.md +7 -6
  10. package/lib/account-usage-query.js +60 -60
  11. package/lib/account-usage.js +10 -10
  12. package/lib/api-helpers.js +114 -110
  13. package/lib/assistant-prefs.js +119 -76
  14. package/lib/auto-config.js +65 -65
  15. package/lib/backup.js +159 -123
  16. package/lib/break-reminder.js +45 -45
  17. package/lib/client.js +336 -138
  18. package/lib/config.js +234 -218
  19. package/lib/git-read-bundled-provider.js +27 -7
  20. package/lib/git-read-service.js +5 -5
  21. package/lib/host-compat.js +84 -84
  22. package/lib/http-util.js +17 -17
  23. package/lib/index.js +1670 -1511
  24. package/lib/memory/context.js +45 -40
  25. package/lib/memory/decay.js +93 -93
  26. package/lib/memory/extract.js +77 -77
  27. package/lib/memory/routes.js +33 -33
  28. package/lib/memory/store.js +239 -192
  29. package/lib/notify-copy.js +93 -93
  30. package/lib/permission-guide.js +86 -86
  31. package/lib/persona-cards.js +73 -61
  32. package/lib/phone-action-args.js +175 -0
  33. package/lib/phone-actions.js +227 -0
  34. package/lib/phone-announce.js +58 -0
  35. package/lib/proactive-material.js +42 -42
  36. package/lib/proactive.js +122 -119
  37. package/lib/protected-paths.js +205 -45
  38. package/lib/protocol.js +62 -23
  39. package/lib/push.js +29 -29
  40. package/lib/rate-limit.js +16 -16
  41. package/lib/relay/connector.js +334 -81
  42. package/lib/relay/crypto.js +15 -15
  43. package/lib/relay/devices.js +64 -32
  44. package/lib/relay/fingerprint.js +34 -34
  45. package/lib/relay/identity.js +26 -26
  46. package/lib/relay/mux.js +60 -46
  47. package/lib/relay/noise.js +40 -40
  48. package/lib/relay/on-demand.js +36 -31
  49. package/lib/relay/p2p.js +239 -0
  50. package/lib/relay/pairing.js +54 -15
  51. package/lib/relay/phone.js +63 -39
  52. package/lib/relay/serve.js +21 -21
  53. package/lib/relay/signal.js +69 -0
  54. package/lib/relay/ws-server.js +245 -0
  55. package/lib/reminders.js +15 -15
  56. package/lib/rpc-adapter.js +43 -43
  57. package/lib/session-list.js +31 -31
  58. package/lib/session-rotation.js +95 -95
  59. package/lib/session-title-cache.js +35 -35
  60. package/lib/session-title-refresh.js +51 -51
  61. package/lib/timeline.js +140 -140
  62. package/lib/turn-outline.js +104 -104
  63. package/package.json +11 -18
@@ -1,30 +1,30 @@
1
- /**
2
- * Break reminder (T-15; plan §5.7, decision D10). Work framing only: it says how long you
3
- * have been working and nothing else. No streaks, no guilt, nothing caused by absence.
4
- *
5
- * What counts as activity is decided by the caller and fed in through `activity()`: in the
6
- * plugin that is activity *from a person* (a message the user typed in any DSH client, see
7
- * `isUserActivityEvent`, and a write request from the phone), not the agent's own output or
8
- * injected messages, so an unattended run does not count.
9
- *
10
- * Rules:
11
- * - a gap of `idleResetMs` (10 min) or more between activities starts the count again;
12
- * - after `afterMs` (2 h) of continuous activity, `check()` reminds once and the count
13
- * starts again, so the next reminder needs another full stretch;
14
- * - at most one reminder per `minIntervalMs` (2 h), whatever happens to the count;
15
- * - never while `isQuiet(date)` says quiet hours; never while `isEnabled()` is false.
16
- *
17
- * Pure state plus an injected clock, so every rule can be tested with a fake one. Nothing is
18
- * written to disk: after a restart the count starts again, which can only delay a reminder.
19
- */
20
-
21
- /**
22
- * Whether a session event is a person typing (T-15 review follow-up). Only `user/message`
23
- * events whose source is `"user"` count (the kernel marks system injections with `plugin`,
24
- * `tool`, `model`, `agent-instructions` and so on, in `data.source` or `data.message.source`),
25
- * and never in a subagent session. Otherwise an unattended tool loop that injects messages
26
- * would keep the count going and the user would be told they worked 2 h while away.
27
- */
1
+
2
+
3
+
4
+
5
+
6
+
7
+
8
+
9
+
10
+
11
+
12
+
13
+
14
+
15
+
16
+
17
+
18
+
19
+
20
+
21
+
22
+
23
+
24
+
25
+
26
+
27
+
28
28
  export function isUserActivityEvent(session, event) {
29
29
  if (event?.type !== "user/message") return false;
30
30
  if (session?.header?.origin === "subagent") return false;
@@ -35,19 +35,19 @@ export function isUserActivityEvent(session, event) {
35
35
  export const BREAK_AFTER_MS = 2 * 60 * 60_000;
36
36
  export const BREAK_IDLE_RESET_MS = 10 * 60_000;
37
37
  export const BREAK_MIN_INTERVAL_MS = 2 * 60 * 60_000;
38
- /** How often the plugin calls `check()`. Minute precision is plenty for a 2-hour rule. */
38
+
39
39
  export const BREAK_CHECK_MS = 60_000;
40
40
 
41
- /**
42
- * @param {object} [e]
43
- * @param {() => number} [e.now] clock in ms (tests inject a fake one)
44
- * @param {() => boolean} [e.isEnabled] the off switches (config and the app's setting)
45
- * @param {(at: Date) => boolean} [e.isQuiet] quiet hours, in local time
46
- * @param {(r: {at: number, workedMs: number}) => void} [e.remind] deliver one reminder
47
- * @param {number} [e.afterMs]
48
- * @param {number} [e.idleResetMs]
49
- * @param {number} [e.minIntervalMs]
50
- */
41
+
42
+
43
+
44
+
45
+
46
+
47
+
48
+
49
+
50
+
51
51
  export function createBreakReminder({
52
52
  now = () => Date.now(),
53
53
  isEnabled = () => true,
@@ -57,7 +57,7 @@ export function createBreakReminder({
57
57
  idleResetMs = BREAK_IDLE_RESET_MS,
58
58
  minIntervalMs = BREAK_MIN_INTERVAL_MS,
59
59
  } = {}) {
60
- /** Start of the current continuous stretch, or null when there is none. */
60
+
61
61
  let streakStart = null;
62
62
  let lastActivityAt = null;
63
63
  let lastRemindedAt = null;
@@ -69,14 +69,14 @@ export function createBreakReminder({
69
69
  lastActivityAt = null;
70
70
  };
71
71
 
72
- /** Record one piece of client activity. */
72
+
73
73
  function activity(at = now()) {
74
- // A long gap, or the clock moving backwards, starts a new stretch.
74
+
75
75
  if (lastActivityAt === null || at < lastActivityAt || at - lastActivityAt >= idleResetMs) streakStart = at;
76
76
  lastActivityAt = at;
77
77
  }
78
78
 
79
- /** Decide whether to remind now. Returns `{ fired, reason, workedMs? }`. */
79
+
80
80
  function check(at = now()) {
81
81
  const result = (() => {
82
82
  if (streakStart === null) return { fired: false, reason: "no-activity" };
@@ -88,7 +88,7 @@ export function createBreakReminder({
88
88
  reset();
89
89
  return { fired: false, reason: "idle-reset" };
90
90
  }
91
- // Switched off: keep counting, so switching it back on behaves as if it had been on.
91
+
92
92
  if (!isEnabled()) return { fired: false, reason: "disabled" };
93
93
  const workedMs = at - streakStart;
94
94
  if (workedMs < afterMs) return { fired: false, reason: "not-yet" };
@@ -111,7 +111,7 @@ export function createBreakReminder({
111
111
  try {
112
112
  check();
113
113
  } catch {
114
- // A failing delivery must not stop the timer; the next check tries again later.
114
+
115
115
  }
116
116
  }, intervalMs);
117
117
  timer.unref?.();
@@ -127,7 +127,7 @@ export function createBreakReminder({
127
127
  check,
128
128
  start,
129
129
  stop,
130
- /** Read-only state for diagnostics and tests. */
130
+
131
131
  snapshot: () => ({ streakStart, lastActivityAt, lastRemindedAt, lastReason, running: timer !== null }),
132
132
  };
133
133
  }