@mainwave/cli 0.11.0 → 0.12.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 (39) hide show
  1. package/README.md +168 -13
  2. package/dist/adapters/claude-code.js +3 -3
  3. package/dist/adapters/claude-desktop.js +35 -1
  4. package/dist/adapters/cursor.js +7 -2
  5. package/dist/adapters/kiro.js +13 -8
  6. package/dist/commands.js +217 -0
  7. package/dist/core/apply.js +3 -3
  8. package/dist/core/auth-commands.js +2 -1
  9. package/dist/core/codecs/kiro-hooks-json.js +1 -1
  10. package/dist/core/doctor.js +71 -8
  11. package/dist/core/entry-script.js +2 -3
  12. package/dist/core/format.js +0 -1
  13. package/dist/core/hook-copies.js +157 -0
  14. package/dist/core/install-hooks.js +144 -15
  15. package/dist/core/interview.js +8 -2
  16. package/dist/core/markers.js +86 -22
  17. package/dist/core/redaction.js +179 -0
  18. package/dist/core/skills.js +3 -11
  19. package/dist/core/status.js +21 -1
  20. package/dist/core/store.js +254 -4
  21. package/dist/core/wizard.js +91 -6
  22. package/dist/main.js +163 -162
  23. package/hooks/kiro-otlp.mjs +10 -1
  24. package/hooks/mainwave-hook.mjs +11 -1
  25. package/hooks/marker-core.mjs +56 -2
  26. package/hooks/matchers.json +1 -1
  27. package/hooks/redaction-data.mjs +201 -0
  28. package/hooks/redaction-json.mjs +215 -0
  29. package/hooks/redaction-pattern.mjs +503 -0
  30. package/hooks/redaction.d.mts +84 -0
  31. package/hooks/redaction.mjs +701 -0
  32. package/package.json +3 -1
  33. package/skills/mainwave-instrument/SKILL.md +24 -6
  34. package/skills/mainwave-instrument/reference/frameworks.md +4 -2
  35. package/skills/mainwave-instrument/reference/troubleshooting.md +4 -0
  36. package/skills/mainwave-instrument-node/SKILL.md +83 -38
  37. package/skills/mainwave-instrument-node/reference/api.md +16 -16
  38. package/skills/mainwave-instrument-node/reference/frameworks.md +42 -27
  39. package/skills/mainwave-instrument-node/reference/troubleshooting.md +11 -7
package/README.md CHANGED
@@ -104,6 +104,19 @@ credentials that come from repo config, and it had to be redone for every checko
104
104
  Re-run it any time. Existing values pre-fill the prompts, and opting back out of a setting removes it
105
105
  rather than leaving it stale.
106
106
 
107
+ ### Setting up from an invite
108
+
109
+ A developer with no Mainwave account can be invited by email. The email holds one command:
110
+
111
+ ```bash
112
+ npx @mainwave/cli setup --invite <token>
113
+ ```
114
+
115
+ The token is exchanged for a Mainwave key, the collector address and the email the invite went to,
116
+ so there is no sign-in and no key to paste, and the developer's activity is attributed to that
117
+ email. The token works once. `--invite` can't be combined with `--api-key`, `--ucid` or
118
+ `--use-case`.
119
+
107
120
  ## What gets captured
108
121
 
109
122
  Setup enables content capture by default: **prompt text**, **shell commands and file paths**,
@@ -113,6 +126,14 @@ sent to your collector alongside the metadata (tool names, tokens, cost, who ran
113
126
  says so before it finishes — it is not a question, because what an organization collects is a
114
127
  policy decision rather than a per-developer one.
115
128
 
129
+ For Claude Desktop (Cowork), the same default also turns on **raw model request and response
130
+ bodies** (system prompts included, each cut at 61,440 characters) and exports session titles from
131
+ the desktop app's own event stream. Any narrower `--opt-in` turns raw bodies off. On a first-party
132
+ Team or Enterprise plan, the Cowork admin console sets only the endpoint, protocol and headers.
133
+ Content capture also needs the `otlpContentCapture` key on each device, pushed with your device
134
+ management tool. Without it, current Claude Desktop versions send metadata only. Setup prints the
135
+ exact value.
136
+
116
137
  To send metadata only:
117
138
 
118
139
  ```bash
@@ -134,12 +155,132 @@ start, so a session that was already open keeps the old settings and sends nothi
134
155
  one you ran setup from. `verify` can't catch that: it proves the key and the network path, not that
135
156
  a tool picked the file up.
136
157
 
158
+ ## Redacting sensitive data
159
+
160
+ The Mainwave hooks strip credentials from the spans they send by default — the ticket, PR and commit
161
+ markers, the Claude plan snapshot, the Cursor and Kiro hooks — before the spans leave your machine.
162
+ Nothing to set up: they run the `secrets` pack, the same one the Mainwave SDKs use, on every span. It
163
+ replaces AWS access key ids, GitHub tokens (classic and fine-grained), Anthropic and OpenAI API keys
164
+ (including `sk-proj-`, `sk-svcacct-`, `sk-admin-` and OpenRouter-style `sk-or-v1-` keys), Slack
165
+ tokens, PEM private-key blocks and JWTs with `[REDACTED:secrets.<rule>]`, for example
166
+ `[REDACTED:secrets.github_token]`. A span that had a replacement carries `mainwave.redaction.count`.
167
+ The `pii.*` packs are not on by default: they change data the product shows, such as an email address
168
+ in a pull request title, and what counts as personal data differs by organization.
169
+
170
+ The default also reaches a machine that gets the hooks only through your organization's managed
171
+ settings, where `setup` never ran, once that machine runs a release with it.
172
+
173
+ To turn it off, run setup with the one option for it, `--no-redact-secrets`. `--redact-secrets` turns
174
+ the default back on. `status` and `doctor` show it as off, and `doctor` warns.
175
+
176
+ ```bash
177
+ npx @mainwave/cli setup --no-redact-secrets
178
+ ```
179
+
180
+ To redact more than credentials, record a rules file:
181
+
182
+ ```bash
183
+ npx @mainwave/cli setup --redaction-file ./redaction.json
184
+ ```
185
+
186
+ The file is a JSON rules object in the same format the Mainwave SDKs read for
187
+ `MAINWAVE_REDACTION_FILE`: `packs` (`secrets`, `pii.contact`, `pii.us_gov_id`, `pii.payment_card`),
188
+ `blocked_values`, `allowed_values`, `blocked_key_patterns`, `ignored_keys`, `ignored_key_patterns`
189
+ and `summary`. The "Redacting sensitive data" section of the Node and Python SDK READMEs describes
190
+ each field and every pack, and the same file gives the same output in the SDKs and here, unless your
191
+ organization has chosen packs (see "Packs your organization sets" below). For example,
192
+ `{ "packs": ["pii.contact"] }` sends an email address in a pull request title as
193
+ `[REDACTED:pii.contact.email]`, and the span carries `mainwave.redaction.count` unless `summary` is
194
+ `silent`. The masking function is code-only in the SDKs, so a rules file can't carry it.
195
+
196
+ - **Your rules still get `secrets`.** A recorded file's rules run with the `secrets` pack added when
197
+ the file doesn't list it, so a file of your own never switches the credential default off. Only
198
+ `--no-redact-secrets` does.
199
+ - **Checked at setup.** A file that is missing, unreadable, empty, not JSON or invalid fails setup,
200
+ naming the file and the bad rule, pack or key. Nothing is written in that case.
201
+ - **Referenced, not copied.** Setup records the file's absolute path, so an edit to the file applies
202
+ at the next hook run. A re-run without `--redaction-file` keeps the recorded path. `--no-redaction`
203
+ removes the path and keeps the credential default.
204
+ - **Fails closed.** If a recorded file later goes missing or invalid, a hook sends nothing for that
205
+ event and logs the reason; it never sends the unredacted span. It never delays your coding tool
206
+ either.
207
+ - **Never dropped by accident.** If `~/.mainwave/settings.json` stops parsing as JSON (a hand-edit
208
+ left a trailing comma) and still mentions `"redaction"`, the hooks send nothing, and `setup` and
209
+ `login` stop and name the file instead of overwriting it. Fix or remove the file. A file that
210
+ doesn't mention `"redaction"` leaves the default on.
211
+ - **Shown by `status` and `doctor`:** whether redaction is on by default, on with a file (the file,
212
+ the packs it enables, which include `secrets`, and the summary mode), off because `secrets` was
213
+ turned off, or the error that makes the hooks send nothing.
214
+
215
+ ### Packs your organization sets
216
+
217
+ An admin can choose redaction packs for the whole organization in Claude Code's managed settings: the
218
+ org-wide payload's session-start command then runs `install-hooks --redaction-packs <list>`, for
219
+ example `--redaction-packs secrets,pii.contact`. At each Claude Code session start, `install-hooks`
220
+ records the packs that the managed settings in effect name, and every Mainwave hook on the machine
221
+ applies them: Claude Code's and Codex's, and Cursor's and Kiro's too.
222
+
223
+ - **From managed settings only.** `install-hooks` reads the packs from the managed settings Claude
224
+ Code uses for that session (the file-based tier and the server-managed cache), never from its own
225
+ command line, the environment, a project's settings or your user settings. Run by hand on a machine
226
+ whose managed settings name none, `install-hooks --redaction-packs` records nothing and says so.
227
+ Packs are cleared only when a managed source that runs the Mainwave session-start command names
228
+ none; if that source can't be read, or doesn't run the command, the packs already recorded stay.
229
+ So if your organization removes the Mainwave payload from its managed settings entirely, the packs
230
+ it last set stay on the machine, which errs toward more redaction, until a managed source runs the
231
+ command without packs. A
232
+ pack name the CLI doesn't know makes it exit non-zero and record nothing.
233
+ - **Applied first.** The organization's packs, and only those, run in a first pass of their own,
234
+ and your rules run after them on what they left: your file plus the `secrets` default, exactly as
235
+ they run when no pack is set. Nothing in your file, `allowed_values` included, can bring back a
236
+ value the organization's packs replaced. `secrets` is in the first pass only when the organization
237
+ lists it. With no organization packs there is no first pass, and your rules behave as described
238
+ above, the same as in the SDKs. `mainwave.redaction.count` is the sum of the passes that count; with
239
+ `summary: silent` in your file, the count still includes what the organization's packs replaced,
240
+ but not what your rules replaced in the second pass, credentials caught by `secrets` included.
241
+ - **Not yours to remove.** `setup`, including `--no-redaction` and `--no-redact-secrets`, never
242
+ changes them, and `--no-redact-secrets` doesn't stop a `secrets` pack the organization chose. The
243
+ next session start puts back a recorded pack that was edited out by hand.
244
+ - **Cleared by the admin.** When the admin removes the packs from the managed settings, the next
245
+ session start clears them.
246
+ - **Per Claude config dir.** The packs are recorded for the Claude config dir the session runs in
247
+ (`CLAUDE_CONFIG_DIR`, or `~/.claude`), so a second profile signed in to another organization keeps
248
+ its own. Hooks that can't tell which config dir they belong to (Cursor's, Kiro's and Codex's)
249
+ apply every recorded dir's packs.
250
+ - **Fails closed.** A recorded pack that a hook doesn't have (one a newer release recorded) makes it
251
+ send nothing for that event, as an invalid rules file does. On a machine with no Mainwave hooks yet,
252
+ the packs are recorded before the hooks are installed.
253
+ - **Shown by `status` and `doctor`**, apart from your rules file and the default, and marked as set by
254
+ your organization's managed settings: `doctor` for Claude Code shows that config dir's packs, and
255
+ `status` lists every config dir's. Their `--json` output has them under `redaction.org`.
256
+
257
+ Packs apply to what the Mainwave hooks send, not to the prompts and tool content Claude Code exports
258
+ through its own OpenTelemetry (see below).
259
+
260
+ **What it doesn't cover.** Claude Code, Codex, Copilot CLI, Copilot Chat, Claude Desktop and Cursor's
261
+ Enterprise export send their own OpenTelemetry directly to your collector, with the CLI not in the
262
+ path, so their content is not redacted by any of these settings. When you record a rules file, setup
263
+ and `doctor` say so for each such tool you have configured with content capture on. Run
264
+ `setup --opt-in none` to stop those tools sending prompt text, tool details and tool content. Copilot
265
+ CLI and Cursor's Enterprise export have no such switch in what setup writes (the latter is set in
266
+ Cursor's dashboard), so the notice stays for them.
267
+
268
+ **Known limitations.** Hook copies installed by an older release send spans unredacted until you
269
+ re-run setup, which refreshes every hook copy on the machine; `status` and `doctor` report such a
270
+ copy as a warning while only the default is on, and as an error, with `doctor` exiting non-zero, once
271
+ you have recorded a rules file. If an old script in `~/.mainwave/hooks/` imports something this
272
+ release no longer provides, setup leaves that directory as it is and names the scripts; `status` and
273
+ `doctor` name them too. Remove those scripts, then re-run setup. `setup --json` reports what the
274
+ refresh did under `redaction.hookCopies`. When your organization's packs are recorded, `install-hooks` refreshes
275
+ Cursor and Kiro hook copies that predate organization packs, the same way.
276
+
137
277
  ## Proving it works
138
278
 
139
279
  ```bash
140
280
  mainwave-cli verify # push a sample trace, wait for it to land, print the link
141
281
  mainwave-cli verify --json
142
282
  mainwave-cli verify --no-sample # with a pinned use case: just watch for its spans, send nothing
283
+ mainwave-cli verify --timeout 120 # wait up to 120 seconds for it to land (default 60)
143
284
  ```
144
285
 
145
286
  With a use case pinned — `--ucid` here, or one a `setup --ucid` / `--use-case` run pinned that one
@@ -163,18 +304,21 @@ mainwave-cli setup claude-code codex \
163
304
  --opt-in none --no-markers --yes --json
164
305
  ```
165
306
 
166
- | Flag | Answers |
167
- | --------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- |
168
- | `--api-key <k>` | the collector key (otherwise minted for you when signed in) |
169
- | `--collector-url <u>` / `--api-url <u>` | which deployment |
170
- | `--ucid <id\|url>` / `--use-case <name>` / `--no-use-case` | pin one use case, or `--no-use-case` to unpin (default: none) |
171
- | `--email <e>` | attribution identity for tools that need it injected |
172
- | `--opt-in prompts,tool-details,tool-content,repository` (or `all` / `none`) | content capture (default: all on; `none` sends metadata only; `repository` is Claude Code's repository names) |
173
- | `--no-markers` | skip the Mainwave hooks (installed by default): ticket, PR & commit markers, the Claude plan snapshot |
174
- | `--new-key` | mint a fresh machine key instead of reusing this machine's |
175
- | `--yes` | write without the confirmation prompt |
176
- | `--no-verify` / `--verify-timeout <s>` | the closing first-span check |
177
- | `--skills` / `--no-skills` | the agent skills payload |
307
+ | Flag | Answers |
308
+ | --------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- |
309
+ | `--api-key <k>` | the collector key (otherwise minted for you when signed in) |
310
+ | `--collector-url <u>` / `--api-url <u>` | which deployment |
311
+ | `--ucid <id\|url>` / `--use-case <name>` / `--no-use-case` | pin one use case, or `--no-use-case` to unpin (default: none) |
312
+ | `--email <e>` | attribution identity for tools that need it injected |
313
+ | `--invite <token>` | redeem a developer invite instead of signing in (see [Setting up from an invite](#setting-up-from-an-invite)) |
314
+ | `--opt-in prompts,tool-details,tool-content,repository` (or `all` / `none`) | content capture (default: all on; `none` sends metadata only; `repository` is Claude Code's repository names) |
315
+ | `--no-markers` | skip the Mainwave hooks (installed by default): ticket, PR & commit markers, the Claude plan snapshot |
316
+ | `--redaction-file <path>` / `--no-redaction` | redact the hooks' spans with a rules file, or remove it (see [Redacting sensitive data](#redacting-sensitive-data)) |
317
+ | `--no-redact-secrets` / `--redact-secrets` | stop stripping credentials from the hooks' spans, or restore the default |
318
+ | `--new-key` | mint a fresh machine key instead of reusing this machine's |
319
+ | `--yes` | write without the confirmation prompt |
320
+ | `--no-verify` / `--verify-timeout <s>` | the closing first-span check |
321
+ | `--skills` / `--no-skills` | the agent skills payload |
178
322
 
179
323
  Without a terminal the CLI never prompts: it answers from flags and environment, or fails naming the
180
324
  flag it needed. `status` and `doctor` also take `--json`.
@@ -324,7 +468,8 @@ both being present. When managed settings deliver the
324
468
  hooks, `install-hooks` also removes your user settings' copy of each hook they deliver, so each ticket and PR is marked once and each prompt sends one plan snapshot, and `setup` itself leaves
325
469
  out any hook your managed settings already run. Your own session-start hook stays: while the
326
470
  managed settings run the same command Claude Code runs it once (a payload pasted before the
327
- silent form runs beside it until your admin re-pastes — harmless), and if they stop delivering the
471
+ silent form runs beside it until your admin re-pastes — harmless; so does one whose admin chose
472
+ redaction packs, since the packs make the command differ), and if they stop delivering the
328
473
  hooks it puts back the ones setup installed for you. It never edits project settings; `doctor` lists
329
474
  every settings file that installs the hooks and warns when two of them would fire for the same
330
475
  ticket or PR. The org-wide setup follows how Claude Code 2.1.282 and later apply managed settings;
@@ -378,6 +523,15 @@ which is right for CI and wrong for a coding agent, where a human is sitting rig
378
523
  approve. `--device` says so explicitly and forces the browser flow. `--password` and an explicit
379
524
  `--email` / `--password` value still win over it.
380
525
 
526
+ ```bash
527
+ mainwave-cli login --force # sign in again although a session is active
528
+ mainwave-cli login --device-timeout 600 # wait up to 600 seconds for the approval (default 300)
529
+ ```
530
+
531
+ With a session already active for the deployment, `login` prints who is signed in and exits without
532
+ signing in again; `--force` signs in anyway. The browser flow waits 300 seconds for your approval
533
+ unless `--device-timeout` says otherwise, and never longer than the code shown stays valid.
534
+
381
535
  Scripts and CI sign in without a terminal by setting `MAINWAVE_EMAIL` and `MAINWAVE_PASSWORD`,
382
536
  which also selects the password path (the `--password` flag picks the _flow_; it never takes the
383
537
  password itself — argv lands in shell history and in `ps`). Point the CLI at a non-production
@@ -395,6 +549,7 @@ mainwave-cli status [<adapter>] # on-disk config for every tool, or
395
549
  mainwave-cli doctor <adapter> # settings hierarchy + health checks
396
550
  mainwave-cli doctor <adapter> --validate # also auth-check against the collector
397
551
  mainwave-cli edit <adapter> # open the settings file in $EDITOR
552
+ mainwave-cli edit <adapter> --global # the user-level file, without the picker (--local: this project's)
398
553
  mainwave-cli env <adapter> # print shell export lines
399
554
  mainwave-cli install-hooks [--quiet] # install or refresh the Mainwave hook entry and the latest release's scripts
400
555
  mainwave-cli --help
@@ -228,7 +228,7 @@ const IGNORED_EXACT = new Set([
228
228
  ]);
229
229
  const OTLP_IGNORED = /^OTEL_EXPORTER_OTLP_(?:(?:TRACES|METRICS|LOGS)_)?\w*(?:ENDPOINT|HEADERS|PROTOCOL|CERTIFICATE|CLIENT_KEY|INSECURE)$/;
230
230
  const CONTENT_OFF_VALUES = new Set(['0', 'false', 'no', 'off']);
231
- export const isProjectIgnoredTelemetryKey = (key) => IGNORED_EXACT.has(key) || OTLP_IGNORED.test(key);
231
+ const isProjectIgnoredTelemetryKey = (key) => IGNORED_EXACT.has(key) || OTLP_IGNORED.test(key);
232
232
  const isHonoredOffValue = (key, value) => {
233
233
  const v = value.trim().toLowerCase();
234
234
  if (EXPORTER_SELECTORS.includes(key))
@@ -238,7 +238,7 @@ const isHonoredOffValue = (key, value) => {
238
238
  return false;
239
239
  };
240
240
  let installedVersionCache;
241
- export const trustedPath = (env = process.env) => (env.PATH ?? '')
241
+ const trustedPath = (env = process.env) => (env.PATH ?? '')
242
242
  .split(delimiter)
243
243
  .filter((dir) => dir && isAbsolute(dir) && !/[\\/]node_modules[\\/]\.bin[\\/]?$/.test(dir))
244
244
  .join(delimiter);
@@ -393,7 +393,7 @@ const SERVER_BYPASS_PROVIDER_FLAGS = [
393
393
  'CLAUDE_CODE_USE_MANTLE',
394
394
  'CLAUDE_CODE_USE_ANTHROPIC_AWS',
395
395
  ];
396
- export const serverManagedBypassed = (env) => {
396
+ const serverManagedBypassed = (env) => {
397
397
  if (SERVER_BYPASS_PROVIDER_FLAGS.some((k) => TRUTHY.has((env[k] ?? '').trim().toLowerCase()))) {
398
398
  return true;
399
399
  }
@@ -6,12 +6,15 @@ const SOURCE_VALUE = 'cowork.claude_desktop';
6
6
  const DEFAULT_PROTOCOL = 'http/protobuf';
7
7
  const OTEL_MIN_APP_VERSION = '1.1.4173';
8
8
  const TRACES_MIN_APP_VERSION = '1.22209.0';
9
+ const CONTENT_CAPTURE_MIN_APP_VERSION = '1.15962.0';
10
+ const DESKTOP_LOG_LEVEL = 'info';
9
11
  const KEY = {
10
12
  endpoint: 'otlpEndpoint',
11
13
  protocol: 'otlpProtocol',
12
14
  headers: 'otlpHeaders',
13
15
  contentCapture: 'otlpContentCapture',
14
16
  tracesEnabled: 'otlpTracesEnabled',
17
+ desktopLogLevel: 'otlpDesktopLogLevel',
15
18
  };
16
19
  const MANAGED_ENV_KEYS = [
17
20
  KEY.endpoint,
@@ -19,6 +22,7 @@ const MANAGED_ENV_KEYS = [
19
22
  KEY.headers,
20
23
  KEY.contentCapture,
21
24
  KEY.tracesEnabled,
25
+ KEY.desktopLogLevel,
22
26
  ];
23
27
  const stripTrailingSlash = (url) => url.replace(/\/+$/, '');
24
28
  const contentCategories = (optIns) => {
@@ -29,6 +33,8 @@ const contentCategories = (optIns) => {
29
33
  cats.push('toolDetails');
30
34
  if (optIns.toolContent)
31
35
  cats.push('toolContent');
36
+ if (optIns.userPrompts && optIns.toolDetails && optIns.toolContent)
37
+ cats.push('rawApiBodies');
32
38
  return cats;
33
39
  };
34
40
  const headersFor = (input) => buildHeaders({ apiKey: input.apiKey, ucid: input.ucid, source: SOURCE_VALUE });
@@ -39,6 +45,7 @@ const buildEnv = ({ ucid, collectorUrl, apiKey, optIns, }) => {
39
45
  [KEY.protocol]: DEFAULT_PROTOCOL,
40
46
  [KEY.headers]: jsonObjectHeaders.encode(headersFor({ ucid, apiKey })),
41
47
  [KEY.tracesEnabled]: 'true',
48
+ [KEY.desktopLogLevel]: DESKTOP_LOG_LEVEL,
42
49
  };
43
50
  const cats = contentCategories(optIns);
44
51
  if (cats.length > 0)
@@ -111,8 +118,21 @@ const collectChecks = (env) => {
111
118
  issues.push({
112
119
  level: 'info',
113
120
  message: `Claude Desktop OTel export requires app ≥ ${OTEL_MIN_APP_VERSION}; the traces beta ` +
114
- `(otlpTracesEnabled) requires ≥ ${TRACES_MIN_APP_VERSION}. Older builds ignore traces.`,
121
+ `(otlpTracesEnabled) requires ≥ ${TRACES_MIN_APP_VERSION}, content capture ` +
122
+ `(otlpContentCapture) ≥ ${CONTENT_CAPTURE_MIN_APP_VERSION}. Older builds ignore them.`,
115
123
  });
124
+ issues.push(tryParseArray(env[KEY.contentCapture]).length > 0
125
+ ? {
126
+ level: 'info',
127
+ message: 'Content capture (otlpContentCapture) only applies once it is on each device: ' +
128
+ 'the first-party Cowork console cannot set it. Push it with your device ' +
129
+ 'management tool, or current Claude Desktop versions send metadata only.',
130
+ }
131
+ : {
132
+ level: 'info',
133
+ message: 'otlpContentCapture is not set: Claude Desktop sends metadata only — no prompt, ' +
134
+ 'response or tool content.',
135
+ });
116
136
  return issues;
117
137
  };
118
138
  const PROFILE_FILENAME = 'claude-desktop-managed-settings.json';
@@ -129,6 +149,7 @@ const HIERARCHY = [
129
149
  const printPostSetupInstructions = (input) => {
130
150
  const env = buildEnv(input);
131
151
  const consoleHeaders = headersAsConsoleValue(headersFor(input));
152
+ const capture = env[KEY.contentCapture];
132
153
  const lines = [
133
154
  'Claude Desktop reads OTel config from a managed source, not this file directly.',
134
155
  'Deploy the generated profile one of two ways:',
@@ -138,6 +159,19 @@ const printPostSetupInstructions = (input) => {
138
159
  ` OTLP protocol: ${env[KEY.protocol]}`,
139
160
  ` OTLP headers: ${consoleHeaders}`,
140
161
  ' (headers are comma-separated key=value pairs — the console rejects a JSON object)',
162
+ ...(capture
163
+ ? [
164
+ ' The console has no content setting. Without the next step, current Claude Desktop',
165
+ ' versions send metadata only — no prompt, response or tool content. Push this key',
166
+ ' to every device with your device management tool, as a string value:',
167
+ ` otlpContentCapture = ${capture}`,
168
+ ' macOS: com.anthropic.claudefordesktop profile (/Library/Managed Preferences)',
169
+ ' Windows: REG_SZ under HKLM\\SOFTWARE\\Policies\\Claude',
170
+ ' Linux: /etc/claude-desktop/managed-settings.json (root-owned, not group- or',
171
+ ' world-writable)',
172
+ ' Restart Claude Desktop afterwards.',
173
+ ]
174
+ : []),
141
175
  '',
142
176
  ' • Third-party / MDM: push the generated keys via Jamf / Intune / Group Policy',
143
177
  ' (macOS plist, Windows registry, or Linux /etc/claude-desktop/managed-settings.json).',
@@ -5,7 +5,7 @@ import { cursorHooksJsonCodec } from '../core/codecs/cursor-hooks-json.js';
5
5
  import { envFileCodec } from '../core/codecs/env-file.js';
6
6
  import { hasBinary, hasPath } from '../core/detect.js';
7
7
  import { buildHeaders, HEADER_NAME, headerBearerToken, kvPairsHeaders } from '../core/headers.js';
8
- import { buildScriptHookCommand, installedHooksDir } from '../core/markers.js';
8
+ import { buildScriptHookCommand, installedHooksDir, REDACTION_HOOK_MODULES, } from '../core/markers.js';
9
9
  import { isSamePath } from '../core/settings.js';
10
10
  import { VERSION } from '../core/version.js';
11
11
  const SOURCE_VALUE = 'coding_agent.cursor';
@@ -145,7 +145,12 @@ export const cursor = {
145
145
  collectFileChecks,
146
146
  normalizeForGenericChecks,
147
147
  additionalWrites: [hooksWrite],
148
- bundledHookScripts: ['marker-core.mjs', 'vocabulary.mjs', 'cursor-otlp.mjs'],
148
+ bundledHookScripts: [
149
+ ...REDACTION_HOOK_MODULES,
150
+ 'marker-core.mjs',
151
+ 'vocabulary.mjs',
152
+ 'cursor-otlp.mjs',
153
+ ],
149
154
  behaviourHooks: {
150
155
  toolName: 'Cursor',
151
156
  setupCommand: 'mainwave-cli setup cursor',
@@ -7,7 +7,7 @@ import { kiroHooksJsonCodec } from '../core/codecs/kiro-hooks-json.js';
7
7
  import { hasBinary, hasPath } from '../core/detect.js';
8
8
  import { buildHeaders, HEADER_NAME, headerBearerToken, kvPairsHeaders } from '../core/headers.js';
9
9
  import { prepareUpdate, readExistingEnv } from '../core/settings.js';
10
- import { hookLogDir, installedHooksDir, MANAGED_BY } from '../core/markers.js';
10
+ import { hookLogDir, installedHooksDir, MANAGED_BY, REDACTION_HOOK_MODULES, } from '../core/markers.js';
11
11
  import { planBlockRemoval } from '../core/skills.js';
12
12
  import { VERSION } from '../core/version.js';
13
13
  const SOURCE = {
@@ -20,7 +20,7 @@ const CONFIG_MANAGED_KEYS = [
20
20
  'OTEL_EXPORTER_OTLP_HEADERS',
21
21
  'OTEL_LOG_USER_PROMPTS',
22
22
  ];
23
- export const KIRO_SURFACE_KEY = {
23
+ const KIRO_SURFACE_KEY = {
24
24
  ide: 'MAINWAVE_KIRO_IDE',
25
25
  cli: 'MAINWAVE_KIRO_CLI',
26
26
  };
@@ -44,7 +44,7 @@ export const KIRO_TRIGGERS = [
44
44
  'Stop',
45
45
  'SessionEnd',
46
46
  ];
47
- export const hookKey = (trigger) => `hooks.${trigger}`;
47
+ const hookKey = (trigger) => `hooks.${trigger}`;
48
48
  const HOOKS_MANAGED_KEYS = KIRO_TRIGGERS.map(hookKey);
49
49
  export const buildKiroHookCommand = (scriptPath, version, trigger, plat = process.platform) => {
50
50
  const args = `${MANAGED_BY}@${version} --trigger ${trigger}`;
@@ -104,7 +104,7 @@ export const KIRO_CLI = {
104
104
  return whoamiOnce.email;
105
105
  },
106
106
  };
107
- export const KIRO_CLI_MIN_VERSION = '2.13.0';
107
+ const KIRO_CLI_MIN_VERSION = '2.13.0';
108
108
  const versionAtLeast = (v, min) => {
109
109
  const a = v.split('.').map(Number);
110
110
  const b = min.split('.').map(Number);
@@ -114,9 +114,9 @@ const versionAtLeast = (v, min) => {
114
114
  }
115
115
  return true;
116
116
  };
117
- export const kiroActivityPath = (home = homedir()) => join(hookLogDir(home), 'kiro.log.ok');
118
- export const KIRO_STALE_DAYS = 7;
119
- export const kiroHooksRegistered = (path = HOOKS_GLOBAL) => {
117
+ const kiroActivityPath = (home = homedir()) => join(hookLogDir(home), 'kiro.log.ok');
118
+ const KIRO_STALE_DAYS = 7;
119
+ const kiroHooksRegistered = (path = HOOKS_GLOBAL) => {
120
120
  try {
121
121
  const doc = kiroHooksJsonCodec.parse(readFileSync(path, 'utf8'), path);
122
122
  return Object.keys(kiroHooksJsonCodec.readEnv(doc)).length > 0;
@@ -344,7 +344,12 @@ const kiroAdapter = (surface) => {
344
344
  collectChecks,
345
345
  normalizeForGenericChecks,
346
346
  additionalWrites: [hooksWrite],
347
- bundledHookScripts: ['marker-core.mjs', 'vocabulary.mjs', KIRO_HOOK_SCRIPT],
347
+ bundledHookScripts: [
348
+ ...REDACTION_HOOK_MODULES,
349
+ 'marker-core.mjs',
350
+ 'vocabulary.mjs',
351
+ KIRO_HOOK_SCRIPT,
352
+ ],
348
353
  behaviourHooks: {
349
354
  toolName: 'Kiro',
350
355
  setupCommand: `mainwave-cli setup ${surface === 'ide' ? 'kiro-ide' : 'kiro-cli'}`,