Skip to content

A plugin marketplace for GitHub Copilot and other AI agents that provides Power Platform development plugins, including reusable skills, agents, and commands for building and deploying solutions.

docs: clarify telemetry privacy and routing (#612)

amitjoshi438f57ff3ec652f
diff --git a/README.md b/README.md
index f34c70aad..8c9396f9a 100644
--- a/README.md
+++ b/README.md
@@ -294,6 +294,6 @@ Any use of third-party trademarks or logos are subject to those third-party's po
## Telemetry
-Power Pages and Model Apps ship 1DS telemetry code, but their committed configurations have different states. Power Pages telemetry is enabled and default-on; its usage events can include Dataverse organization and Entra tenant GUIDs when PAC is signed in, plus the signed-in user's Entra object ID when PAC exposes it. Model Apps ships hard-disabled (`disabled: true`), so it currently transmits no events and writes no local telemetry mirror. If Model Apps is enabled later, its events can include organization and tenant GUIDs but exclude the signed-in user's Entra object ID.
+Power Pages, Mobile Apps, and Model Apps ship 1DS telemetry code, but their committed configurations and event schemas differ. Power Pages and Mobile Apps telemetry are enabled and default-on. Power Pages events can include Dataverse organization and Entra tenant GUIDs when PAC is signed in, plus the signed-in user's Entra object ID when PAC exposes it. Mobile Apps excludes those identity fields and records its documented invocation, project-instance, checkpoint, and App Insights selection fields. Model Apps ships hard-disabled (`disabled: true`), so it currently transmits no events and writes no local telemetry mirror; if enabled later, its events can include organization and tenant GUIDs but exclude the signed-in user's Entra object ID.
-For an enabled plugin, users opt out of transmission via `/<plugin>:telemetry off` (for example, `/power-pages:telemetry off`), stored in `~/.power-platform-skills/config.json`. The local diagnostic mirror is still written after this transmission-only opt-out. Each adopting plugin also honors `POWER_PLATFORM_SKILLS_TELEMETRY_<PLUGIN>_OPTOUT` for automation and CI. The environment variable has highest precedence and disables transmission regardless of the saved command choice. See `shared/telemetry/README.md` for the full field list, kill-switch semantics, and local-mirror behavior.
+For an enabled plugin, users opt out of transmission via `/<plugin>:telemetry off` (for example, `/power-pages:telemetry off`), stored in `~/.power-platform-skills/config.json`. The local diagnostic mirror is still written after this transmission-only opt-out. Each adopting plugin also honors `POWER_PLATFORM_SKILLS_TELEMETRY_<PLUGIN>_OPTOUT` for automation and CI. The environment variable has highest precedence and disables transmission regardless of the saved command choice. See the [shared telemetry guide](shared/telemetry/README.md) for the full field list, current plugin states, geo-routing behavior, kill-switch semantics, and local-mirror behavior.
diff --git a/shared/telemetry/README.md b/shared/telemetry/README.md
index 817ee20a5..9472c8b32 100644
--- a/shared/telemetry/README.md
+++ b/shared/telemetry/README.md
@@ -6,6 +6,8 @@ Canonical source for 1DS telemetry used by plugins in this repo. Each adopting p
Zero npm dependencies. Node stdlib only.
+For the repository-level user disclosure, see [Telemetry](../../README.md#telemetry).
+
---
## What it does
@@ -48,6 +50,18 @@ so a user can hand over one self-contained file per problem. Session directories
older than 14 days are pruned best-effort whenever a new session starts, and an
individual session log is rotated to `events.<stamp>.old` if it ever exceeds 10 MB.
+### Current adopters
+
+The committed `disabled` value in each plugin's `ikey.json` determines whether
+that plugin currently emits telemetry. A user command or environment-variable
+choice cannot override `disabled: true`.
+
+| Plugin | Committed state | Current behavior | Plugin-specific fields |
+|---|---|---|---|
+| Power Pages | `disabled: false` | Enabled and default-on for transmission. Organization-based geo routing selects a regional collector; without an organization ID, the configured US default is used. Events are written to the local mirror even after a user transmission opt-out. | `eventInfo.aadObjectId` when PAC exposes the signed-in user's Entra object ID; `eventInfo.framework` when the Power Pages code-site framework can be determined. |
+| Mobile Apps | `disabled: false` | Enabled and default-on for transmission. Its project environment selects the regional collector. Until that cluster is resolved, events remain in the local mirror and are not transmitted. | `eventInfo.invocationSource`; random per-project `eventInfo.appInstanceId` (or `null` outside a prepared project); optional validated checkpoint `eventInfo.additionalInfo`; and `eventInfo.appInsightsSelection`. |
+| Model Apps | `disabled: true` | Hard-off: no event building, network transmission, or local mirror. If enabled later, transmission will be default-on and the standard mirror and opt-out behavior will apply. | No signed-in user object ID. If enabled, the base event can include `orgId` and `tenantId` when PAC is signed in. |
+
### Custom routing (the resolver contract)
The destination iKey/collector is **not** hard-coded, and the shared library is
@@ -71,6 +85,11 @@ region routing; that implementation lives entirely in
`plugins/power-pages/scripts/lib/telemetry/region/` — the shared library knows
nothing about it.
+Mobile Apps also owns its routing implementation. Its custom dispatcher and
+resolver select a configured regional collector from the prepared project's
+resolved Power Platform environment. If no valid project cluster is available,
+the sanitized event remains in the local mirror and transmission is deferred.
+
## What is sent
Every event carries a fixed allowlist enforced by `lib/events.js`. Field names match the destination Kusto column names (camelCase).
@@ -85,23 +104,34 @@ Every event carries a fixed allowlist enforced by `lib/events.js`. Field names m
**PAC + agent (when available, otherwise omitted):**
-- `orgId`, `tenantId` — Dataverse org GUID and Entra tenant GUID, read from `pac auth who` if the user is signed in (`orgId` is passed to the plugin resolver — power-pages uses it for Artemis region routing)
+- `orgId`, `tenantId` — Dataverse org GUID and Entra tenant GUID, read from `pac auth who` if the user is signed in. Power Pages uses `orgId` for Artemis region routing; Model Apps can include both fields if enabled. Mobile Apps excludes both and routes from its prepared project environment instead.
- `pacCliVersion` — semver from `pac --version`
- `aiAgentName`, `aiAgentVersion` — host AI agent detected via env in the hook process before the detached dispatcher is spawned. Claude Code (`CLAUDECODE=1`) reports `Claude Code` with the version read from its installed `package.json` via `CLAUDE_CODE_EXECPATH`; that `package.json` only exists for npm-global installs, so when it can't be read (e.g. the native installer's standalone binary) the version falls back to the dotted semver parsed out of `AI_AGENT` (`claude-code_<maj>-<min>-<patch>_agent`), which Claude Code sets regardless of install method. GitHub Copilot CLI (`COPILOT_CLI=1`) reports `Copilot CLI` with the version from `COPILOT_CLI_BINARY_VERSION` or `COPILOT_CLI_VERSION`. Codex, OpenCode, Hermes, and OpenClaw are detected from their agent-specific env flags/version variables (`CODEX_*`, `OPENCODE_*`, `HERMES_*`, `OPENCLAW_*`) or from `AI_AGENT` when it includes a recognizable agent name. Explicit `AI_AGENT_NAME` / `AI_AGENT_VERSION` env vars override detection (used for testing); when `AI_AGENT_NAME` is set but `AI_AGENT_VERSION` is empty, the version is backfilled from whichever detector matches.
**Per-event:**
- `skillName` (on every event)
-- `eventInfo` — caller-supplied JSON object (dynamic Kusto column). Power Pages populates it with:
+- `eventInfo` — caller-supplied JSON object (dynamic Kusto column). Approved plugin schemas are:
+
+ **Power Pages**
- `aadObjectId` — the signed-in user's stable Entra ID / AAD directory object ID, parsed from `pac auth who`, when available. Omitted when `pac auth who` does not surface an object ID.
- `framework` — the SPA framework of the Power Pages **code site** the skill is running against, drawn from the closed set `react`, `vue`, `angular`, `astro`. Omitted unless the working directory resolves to a site with a `powerpages.config.json`.
Each key is omitted independently when its source is unavailable; `eventInfo` itself is omitted only when every key would be absent.
- On the wire it is sent as a JSON **string** (re-serialized by `emit-dispatcher.js`, not the local mirror) because the tenant-side field mapping flattens `data.<key>` to a single `data_<key>` leaf and does not recurse into nested objects. The Kusto side must `parse_json()` / `todynamic()` it back into a dynamic value.
+ **Mobile Apps**
+
+ - `invocationSource` — one of `prompt`, `pretool`, or `checkpoint`.
+ - `appInstanceId` — a random per-project UUID, or `null` outside a prepared project.
+ - `additionalInfo` — optional author-defined checkpoint metadata, restricted to `snake_case` and at most 64 characters.
+ - `appInsightsSelection` — `enabled` or `disabled`, emitted by the `/setup-app-insights` skill.
+
+ Mobile Apps does not add Dataverse organization or tenant IDs, or an Entra user object ID.
+
+ The shared dispatcher used by Power Pages and Model Apps sends `eventInfo` as a JSON **string** (re-serialized by `emit-dispatcher.js`, not the local mirror) because the tenant-side field mapping flattens `data.<key>` to a single `data_<key>` leaf and does not recurse into nested objects. The Kusto side must `parse_json()` / `todynamic()` it back into a dynamic value. The Mobile Apps custom dispatcher serializes the sanitized event fields into the Power Apps `event` stream's `customDimensions`; its local mirror also keeps the structured object.
- `FIELD_TYPES` enforces only that `eventInfo` is a structured JSON value; it does **not** enforce nested keys. Callers **MUST** restrict it to the documented schema. The approved nested fields are currently Power Pages `aadObjectId` (string) and `framework` (string, restricted to the closed set above — it describes the scaffold a site was built from, is shared by every site built from that scaffold, and therefore identifies no user, project, or site). Callers **MUST NOT** add other personal data, prompts, project or site identifiers, paths, URLs, credentials, or arbitrary caller payloads. Any proposed expansion requires review and approval, plus updates to this privacy disclosure, the documented event schema, and tests before code emits the new field.
+ `FIELD_TYPES` enforces only that `eventInfo` is a structured JSON value; it does **not** enforce nested keys. Callers **MUST** restrict it to the documented schemas above. Power Pages `framework` is restricted to its closed set and describes only the scaffold, not a user, project, or site. Mobile Apps `appInstanceId` is randomly generated and is not derived from an app name, environment, tenant, organization, or user. Callers **MUST NOT** add other personal data, prompts, project or site identifiers, paths, URLs, credentials, or arbitrary caller payloads. Any proposed expansion requires review and approval, plus updates to this privacy disclosure, the documented event schema, and tests before code emits the new field.
`emitSkillStartedFromPrompt(promptText, opts)` accepts an optional `opts.eventInfo` so a plugin can contribute its own approved keys from the `UserPromptSubmit` hook. It takes either a plain object or a **thunk** returning one; the thunk is preferred, and is invoked only *after* the slash-command, `disabled`, and `isProvisioned` gates pass — that hook fires on every user prompt, so any real work (filesystem probing, shellouts) must not run on untracked prompts. A thunk that throws contributes nothing and never blocks the event. Non-object values (including arrays) are ignored.
@@ -113,8 +143,15 @@ The dispatcher runs a defense-in-depth allowlist filter against `FIELD_TYPES` be
## Privacy posture
-- **Default-on.** Usage telemetry is enabled by default. No first-run prompt.
-- **Identifiers.** When PAC is signed in, events can include the Dataverse organization GUID (`orgId`), Entra tenant GUID (`tenantId`), and, for Power Pages, the signed-in user's Entra object ID (`eventInfo.aadObjectId`). The local diagnostic mirror retains the same fields.
+- **Shipped state is per plugin.** The committed `ikey.json` controls whether a
+ plugin is enabled or hard-disabled; see [Current adopters](#current-adopters).
+ A hard-disabled plugin produces no network or local telemetry side effects.
+- **Enabled plugins are default-on for transmission.** There is no first-run
+ prompt. A plugin that ships `disabled: true` remains hard-off regardless of a
+ user's saved telemetry choice.
+- **Identifiers.** Power Pages, and Model Apps if enabled, can include the Dataverse organization GUID (`orgId`) and Entra tenant GUID (`tenantId`) when PAC is signed in. Power Pages can also include the signed-in user's Entra object ID (`eventInfo.aadObjectId`) when PAC exposes it. Mobile Apps excludes all three identity fields. The local diagnostic mirror retains the same fields as the event produced by each plugin.
+- **Authenticated scenario.** When an adopter has the authentication or project-environment context required by its routing implementation, the resolved cloud and geo select the corresponding configured regional collector. Depending on the adopter's documented schema, the transmitted event may include End User Pseudonymous Information (EUPI) or Organization Identifiable Information (OII).
+- **Unauthenticated or unresolved scenario.** When PAC provides no authentication context, the organization, tenant, and Entra user object ID fields are absent. Destination behavior when routing context is unavailable is adopter-specific: configurations with a default region use that configured destination, while configurations that require a resolved project cluster retain the event in the local mirror and do not transmit it until a valid cluster is available. The event can still contain the allowlisted operational and system metadata and separately documented non-identity plugin-specific fields.
- **Opt out of transmission** via `/<plugin>:telemetry off` (per-user, per-plugin). This writes `telemetry[<plugin>] = "off"` into `~/.power-platform-skills/config.json` and stops the network POST to the collector — **nothing leaves the machine** — but the local diagnostic mirror (a per-session `events.jsonl`) is still written so the user/developer can see exactly what would have been sent. It is therefore an opt-out of *transmission*, not of local logging. CI/headless can opt out by writing that file directly. Re-enable with `/<plugin>:telemetry on`.
- **Opt out for automation** via the per-plugin opt-out env var
`POWER_PLATFORM_SKILLS_TELEMETRY_<PLUGIN>_OPTOUT` (e.g.