mobile-automator 0.32.0 → 0.33.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.
package/README.md CHANGED
@@ -124,7 +124,9 @@ In agnostic mode, OS-shaped gestures become four semantic actions — `press_bac
124
124
  `mauto` collects nothing by default. Anonymous usage telemetry is opt-in via
125
125
  `mauto telemetry enable`, sends no free text of any kind, and carries no
126
126
  per-machine identifier.
127
- `MAUTO_TELEMETRY=0` and `DO_NOT_TRACK=1` force it off. Run `mauto telemetry
127
+ `MAUTO_TELEMETRY=0` and `DO_NOT_TRACK=1` force it off. The device engine's own
128
+ telemetry (mobile-mcp's) is off by default too: `mauto` starts it with
129
+ `MOBILEMCP_DISABLE_TELEMETRY=1`. Run `mauto telemetry
128
130
  status` for the exact field list, or read
129
131
  [Telemetry & Privacy](https://sh3lan93.github.io/mobile-automator/reference/telemetry/).
130
132
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mobile-automator",
3
- "version": "0.32.0",
3
+ "version": "0.33.0",
4
4
  "description": "Host-agnostic mauto CLI for AI-driven mobile QA automation — analyzes a mobile project and drives devices through mobile-mcp.",
5
5
  "homepage": "https://github.com/sh3lan93/mobile-automator#readme",
6
6
  "repository": {
package/src/cli.js CHANGED
@@ -961,12 +961,18 @@ function setEngine({ projectRoot, env, store }, value) {
961
961
  // field lists come from EVENT_FIELDS at runtime, so the disclosure a user reads
962
962
  // before opting in cannot drift from what the uploader actually sends. Prose
963
963
  // that restates a catalog is prose that will eventually be wrong.
964
-
964
+ //
965
+ // `engine` is the device engine's (mobile-mcp's) own telemetry (#213), a
966
+ // separate sender with a separate switch. It comes from the same resolver
967
+ // buildEngineEnv uses, so the report states what the engine is actually handed
968
+ // rather than a second opinion about it.
965
969
  function telemetryReport({ projectRoot, env }, extra = {}) {
966
970
  const decision = observeTelemetry.decideForProject(projectRoot, env);
971
+ const engine = observeTelemetry.resolveEngineTelemetry(env);
967
972
  return {
968
973
  enabled: decision.enabled,
969
974
  reason: decision.reason,
975
+ engine: { enabled: engine.enabled, reason: engine.reason },
970
976
  endpoint: observeTransport.endpointUrl(env),
971
977
  fields_sent: observeTelemetry.sentFields(),
972
978
  fields_never_sent: observeTelemetry.neverSentFields(),
@@ -6,6 +6,7 @@ const { StdioClientTransport } = require('@modelcontextprotocol/sdk/client/stdio
6
6
  const { injectDeviceArg } = require('./tool-args');
7
7
  const { resolveSingleDevice } = require('./device-resolver');
8
8
  const { normalizeDevices } = require('./device-model');
9
+ const { resolveEngineTelemetry } = require('../observe/telemetry');
9
10
  const { ErrorCode } = require('@modelcontextprotocol/sdk/types.js');
10
11
 
11
12
  // Bound on mobile-mcp's MCP initialize handshake (#156). Measured at ~200ms on
@@ -68,10 +69,22 @@ function resolveServerEntry() {
68
69
  // resolveEngine reports the env as the source so the recorded engine matches
69
70
  // the one that runs. Unlike the URL guard, a running daemon on the other
70
71
  // engine needs no manual `session end`: resolve-connection.js restarts it.
72
+ //
73
+ // MOBILEMCP_DISABLE_TELEMETRY defaults to "1" (#213). Left unset, mobile-mcp
74
+ // sends a PostHog event on every tool call and a scarf.sh pixel once per
75
+ // process. mauto's own telemetry is opt-in, and an engine it spawns on the
76
+ // user's behalf should not be quietly opt-out. The engine's gate is truthiness,
77
+ // so any non-empty value keeps it off and only an explicit empty string
78
+ // (MOBILEMCP_DISABLE_TELEMETRY=) opts back in; a user-set value is passed
79
+ // through verbatim. MAUTO_TELEMETRY=0 and DO_NOT_TRACK=1 force it off whatever
80
+ // the user set. The decision lives in resolveEngineTelemetry so that
81
+ // `mauto telemetry status` reports exactly what this hands the engine, and the
82
+ // same `mauto session end` rule applies to a change.
71
83
  function buildEngineEnv({ device = null, baseEnv = process.env, engine = null } = {}) {
72
84
  const env = {
73
85
  ...baseEnv,
74
86
  MOBILEMCP_ALLOW_UNSAFE_URLS: baseEnv.MOBILEMCP_ALLOW_UNSAFE_URLS ?? '1',
87
+ MOBILEMCP_DISABLE_TELEMETRY: resolveEngineTelemetry(baseEnv).disableValue,
75
88
  };
76
89
  if (engine === 'legacy' && baseEnv.MOBILEMCP_LEGACY_ROBOT === undefined) {
77
90
  env.MOBILEMCP_LEGACY_ROBOT = '1';
@@ -49,6 +49,9 @@ const CONSENT_NOTICE = [
49
49
  'Run `mauto telemetry status` to see the exact field list, read from the same',
50
50
  'catalog the uploader uses. Run `mauto telemetry enable` to turn it on, or set',
51
51
  'MAUTO_TELEMETRY=0 (or DO_NOT_TRACK=1) to force it off everywhere.',
52
+ '',
53
+ 'The device engine mauto drives (mobile-mcp) has telemetry of its own, and it',
54
+ 'is off too: mauto starts it with MOBILEMCP_DISABLE_TELEMETRY=1.',
52
55
  ].join('\n');
53
56
 
54
57
  function envKillSwitch(env = process.env) {
@@ -70,6 +73,29 @@ function resolveTelemetry({ env = process.env, config = null } = {}) {
70
73
  return { enabled: true, reason: 'enabled' };
71
74
  }
72
75
 
76
+ // The device engine's own telemetry (#213). mobile-mcp sends a PostHog event
77
+ // per tool call and a scarf.sh pixel per process unless
78
+ // MOBILEMCP_DISABLE_TELEMETRY is set, and its gate is a plain truthiness check:
79
+ // any non-empty string turns it off, and only an empty string leaves it on.
80
+ //
81
+ // mauto's own telemetry is opt-in, so an engine mauto spawns must not be
82
+ // opt-out — the default here is off. The user's opt-in is the engine's own
83
+ // variable, passed through verbatim the way #212 passes through
84
+ // MOBILEMCP_ALLOW_UNSAFE_URLS: if they set it at all, even to '', they meant
85
+ // it. The env kill switches still win, because they promise "nothing leaves
86
+ // this machine", and a promise with an exception is not one.
87
+ //
88
+ // One function decides, and both buildEngineEnv (what the engine receives) and
89
+ // `mauto telemetry status` (what the user is told) call it, so the env and the
90
+ // report cannot disagree.
91
+ function resolveEngineTelemetry(env = process.env) {
92
+ const killed = envKillSwitch(env);
93
+ if (killed) return { disableValue: '1', enabled: false, reason: killed };
94
+ const value = env && env.MOBILEMCP_DISABLE_TELEMETRY;
95
+ if (value === undefined) return { disableValue: '1', enabled: false, reason: 'default_off' };
96
+ return { disableValue: value, enabled: value === '', reason: 'user_env' };
97
+ }
98
+
73
99
  // Memoised per project root. resolveLevels() is re-derived per record() call
74
100
  // because it reads only env; this one reads config.json, and a file read per
75
101
  // event is not acceptable on a path that runs on every verb.
@@ -135,6 +161,7 @@ module.exports = {
135
161
  REASONS,
136
162
  envKillSwitch,
137
163
  resolveTelemetry,
164
+ resolveEngineTelemetry,
138
165
  decideForProject,
139
166
  setEnabled,
140
167
  _resetMemo,