@mainwave/cli 0.11.0 → 0.13.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 +203 -16
- package/dist/adapters/claude-code.js +3 -3
- package/dist/adapters/claude-desktop.js +35 -1
- package/dist/adapters/codex-cli.js +16 -16
- package/dist/adapters/cursor.js +7 -2
- package/dist/adapters/kiro.js +13 -8
- package/dist/commands.js +219 -0
- package/dist/core/apply.js +47 -8
- package/dist/core/auth-commands.js +2 -1
- package/dist/core/codecs/kiro-hooks-json.js +1 -1
- package/dist/core/codex-trust.js +178 -0
- package/dist/core/doctor.js +144 -12
- package/dist/core/entry-script.js +2 -3
- package/dist/core/format.js +0 -1
- package/dist/core/hook-copies.js +157 -0
- package/dist/core/install-hooks.js +198 -15
- package/dist/core/interview.js +36 -16
- package/dist/core/markers.js +209 -44
- package/dist/core/redaction.js +188 -0
- package/dist/core/skills.js +3 -11
- package/dist/core/status.js +21 -1
- package/dist/core/store.js +254 -4
- package/dist/core/wizard.js +91 -6
- package/dist/main.js +173 -163
- package/hooks/codex-turns.mjs +584 -0
- package/hooks/kiro-otlp.mjs +10 -1
- package/hooks/mainwave-hook.mjs +27 -3
- package/hooks/marker-core.mjs +66 -8
- package/hooks/matchers.json +98 -1
- package/hooks/redaction-data.mjs +209 -0
- package/hooks/redaction-json.mjs +215 -0
- package/hooks/redaction-pattern.mjs +503 -0
- package/hooks/redaction.d.mts +84 -0
- package/hooks/redaction.mjs +701 -0
- package/hooks/vocabulary.mjs +41 -2
- package/package.json +3 -1
- package/skills/mainwave-instrument/SKILL.md +24 -6
- package/skills/mainwave-instrument/reference/frameworks.md +4 -2
- package/skills/mainwave-instrument/reference/troubleshooting.md +4 -0
- package/skills/mainwave-instrument-node/SKILL.md +83 -38
- package/skills/mainwave-instrument-node/reference/api.md +16 -16
- package/skills/mainwave-instrument-node/reference/frameworks.md +42 -27
- 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
|
|
@@ -120,9 +141,13 @@ npx @mainwave/cli setup claude-code --opt-in none
|
|
|
120
141
|
```
|
|
121
142
|
|
|
122
143
|
For Claude Code that still leaves every activity view working — tool names, tokens, cost, sessions
|
|
123
|
-
and per-person activity are all metadata. **Codex is different:**
|
|
124
|
-
|
|
125
|
-
`--opt-in
|
|
144
|
+
and per-person activity are all metadata. **Codex is different:** its config has one content switch, the
|
|
145
|
+
prompt text (`otel.log_user_prompt`). It exports tool commands and results whatever `--opt-in` says,
|
|
146
|
+
so `--opt-in none` stops Codex's prompt text only. Codex caps each tool result at 2,048 bytes by
|
|
147
|
+
default (its `[otel.tool_result] max_bytes`). An earlier CLI version also wrote
|
|
148
|
+
`otel.log_system_prompt`, `log_tool_payloads`, `log_mcp_interactions` and `log_governance_events`,
|
|
149
|
+
which Codex ignores and reports at start as unrecognized settings; setup removes them, and `doctor`
|
|
150
|
+
reports them while they remain.
|
|
126
151
|
|
|
127
152
|
Or pick exactly what you want: `--opt-in tool-details`, `--opt-in prompts,tool-details`,
|
|
128
153
|
`--opt-in tool-details,repository`, and so on.
|
|
@@ -134,12 +159,132 @@ start, so a session that was already open keeps the old settings and sends nothi
|
|
|
134
159
|
one you ran setup from. `verify` can't catch that: it proves the key and the network path, not that
|
|
135
160
|
a tool picked the file up.
|
|
136
161
|
|
|
162
|
+
## Redacting sensitive data
|
|
163
|
+
|
|
164
|
+
The Mainwave hooks strip credentials from the spans they send by default — the ticket, PR and commit
|
|
165
|
+
markers, the Claude plan snapshot, the Cursor and Kiro hooks — before the spans leave your machine.
|
|
166
|
+
Nothing to set up: they run the `secrets` pack, the same one the Mainwave SDKs use, on every span. It
|
|
167
|
+
replaces AWS access key ids, GitHub tokens (classic and fine-grained), Anthropic and OpenAI API keys
|
|
168
|
+
(including `sk-proj-`, `sk-svcacct-`, `sk-admin-` and OpenRouter-style `sk-or-v1-` keys), Slack
|
|
169
|
+
tokens, PEM private-key blocks and JWTs with `[REDACTED:secrets.<rule>]`, for example
|
|
170
|
+
`[REDACTED:secrets.github_token]`. A span that had a replacement carries `mainwave.redaction.count`.
|
|
171
|
+
The `pii.*` packs are not on by default: they change data the product shows, such as an email address
|
|
172
|
+
in a pull request title, and what counts as personal data differs by organization.
|
|
173
|
+
|
|
174
|
+
The default also reaches a machine that gets the hooks only through your organization's managed
|
|
175
|
+
settings, where `setup` never ran, once that machine runs a release with it.
|
|
176
|
+
|
|
177
|
+
To turn it off, run setup with the one option for it, `--no-redact-secrets`. `--redact-secrets` turns
|
|
178
|
+
the default back on. `status` and `doctor` show it as off, and `doctor` warns.
|
|
179
|
+
|
|
180
|
+
```bash
|
|
181
|
+
npx @mainwave/cli setup --no-redact-secrets
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
To redact more than credentials, record a rules file:
|
|
185
|
+
|
|
186
|
+
```bash
|
|
187
|
+
npx @mainwave/cli setup --redaction-file ./redaction.json
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
The file is a JSON rules object in the same format the Mainwave SDKs read for
|
|
191
|
+
`MAINWAVE_REDACTION_FILE`: `packs` (`secrets`, `pii.contact`, `pii.us_gov_id`, `pii.payment_card`),
|
|
192
|
+
`blocked_values`, `allowed_values`, `blocked_key_patterns`, `ignored_keys`, `ignored_key_patterns`
|
|
193
|
+
and `summary`. The "Redacting sensitive data" section of the Node and Python SDK READMEs describes
|
|
194
|
+
each field and every pack, and the same file gives the same output in the SDKs and here, unless your
|
|
195
|
+
organization has chosen packs (see "Packs your organization sets" below). For example,
|
|
196
|
+
`{ "packs": ["pii.contact"] }` sends an email address in a pull request title as
|
|
197
|
+
`[REDACTED:pii.contact.email]`, and the span carries `mainwave.redaction.count` unless `summary` is
|
|
198
|
+
`silent`. The masking function is code-only in the SDKs, so a rules file can't carry it.
|
|
199
|
+
|
|
200
|
+
- **Your rules still get `secrets`.** A recorded file's rules run with the `secrets` pack added when
|
|
201
|
+
the file doesn't list it, so a file of your own never switches the credential default off. Only
|
|
202
|
+
`--no-redact-secrets` does.
|
|
203
|
+
- **Checked at setup.** A file that is missing, unreadable, empty, not JSON or invalid fails setup,
|
|
204
|
+
naming the file and the bad rule, pack or key. Nothing is written in that case.
|
|
205
|
+
- **Referenced, not copied.** Setup records the file's absolute path, so an edit to the file applies
|
|
206
|
+
at the next hook run. A re-run without `--redaction-file` keeps the recorded path. `--no-redaction`
|
|
207
|
+
removes the path and keeps the credential default.
|
|
208
|
+
- **Fails closed.** If a recorded file later goes missing or invalid, a hook sends nothing for that
|
|
209
|
+
event and logs the reason; it never sends the unredacted span. It never delays your coding tool
|
|
210
|
+
either.
|
|
211
|
+
- **Never dropped by accident.** If `~/.mainwave/settings.json` stops parsing as JSON (a hand-edit
|
|
212
|
+
left a trailing comma) and still mentions `"redaction"`, the hooks send nothing, and `setup` and
|
|
213
|
+
`login` stop and name the file instead of overwriting it. Fix or remove the file. A file that
|
|
214
|
+
doesn't mention `"redaction"` leaves the default on.
|
|
215
|
+
- **Shown by `status` and `doctor`:** whether redaction is on by default, on with a file (the file,
|
|
216
|
+
the packs it enables, which include `secrets`, and the summary mode), off because `secrets` was
|
|
217
|
+
turned off, or the error that makes the hooks send nothing.
|
|
218
|
+
|
|
219
|
+
### Packs your organization sets
|
|
220
|
+
|
|
221
|
+
An admin can choose redaction packs for the whole organization in Claude Code's managed settings: the
|
|
222
|
+
org-wide payload's session-start command then runs `install-hooks --redaction-packs <list>`, for
|
|
223
|
+
example `--redaction-packs secrets,pii.contact`. At each Claude Code session start, `install-hooks`
|
|
224
|
+
records the packs that the managed settings in effect name, and every Mainwave hook on the machine
|
|
225
|
+
applies them: Claude Code's and Codex's, and Cursor's and Kiro's too.
|
|
226
|
+
|
|
227
|
+
- **From managed settings only.** `install-hooks` reads the packs from the managed settings Claude
|
|
228
|
+
Code uses for that session (the file-based tier and the server-managed cache), never from its own
|
|
229
|
+
command line, the environment, a project's settings or your user settings. Run by hand on a machine
|
|
230
|
+
whose managed settings name none, `install-hooks --redaction-packs` records nothing and says so.
|
|
231
|
+
Packs are cleared only when a managed source that runs the Mainwave session-start command names
|
|
232
|
+
none; if that source can't be read, or doesn't run the command, the packs already recorded stay.
|
|
233
|
+
So if your organization removes the Mainwave payload from its managed settings entirely, the packs
|
|
234
|
+
it last set stay on the machine, which errs toward more redaction, until a managed source runs the
|
|
235
|
+
command without packs. A
|
|
236
|
+
pack name the CLI doesn't know makes it exit non-zero and record nothing.
|
|
237
|
+
- **Applied first.** The organization's packs, and only those, run in a first pass of their own,
|
|
238
|
+
and your rules run after them on what they left: your file plus the `secrets` default, exactly as
|
|
239
|
+
they run when no pack is set. Nothing in your file, `allowed_values` included, can bring back a
|
|
240
|
+
value the organization's packs replaced. `secrets` is in the first pass only when the organization
|
|
241
|
+
lists it. With no organization packs there is no first pass, and your rules behave as described
|
|
242
|
+
above, the same as in the SDKs. `mainwave.redaction.count` is the sum of the passes that count; with
|
|
243
|
+
`summary: silent` in your file, the count still includes what the organization's packs replaced,
|
|
244
|
+
but not what your rules replaced in the second pass, credentials caught by `secrets` included.
|
|
245
|
+
- **Not yours to remove.** `setup`, including `--no-redaction` and `--no-redact-secrets`, never
|
|
246
|
+
changes them, and `--no-redact-secrets` doesn't stop a `secrets` pack the organization chose. The
|
|
247
|
+
next session start puts back a recorded pack that was edited out by hand.
|
|
248
|
+
- **Cleared by the admin.** When the admin removes the packs from the managed settings, the next
|
|
249
|
+
session start clears them.
|
|
250
|
+
- **Per Claude config dir.** The packs are recorded for the Claude config dir the session runs in
|
|
251
|
+
(`CLAUDE_CONFIG_DIR`, or `~/.claude`), so a second profile signed in to another organization keeps
|
|
252
|
+
its own. Hooks that can't tell which config dir they belong to (Cursor's, Kiro's and Codex's)
|
|
253
|
+
apply every recorded dir's packs.
|
|
254
|
+
- **Fails closed.** A recorded pack that a hook doesn't have (one a newer release recorded) makes it
|
|
255
|
+
send nothing for that event, as an invalid rules file does. On a machine with no Mainwave hooks yet,
|
|
256
|
+
the packs are recorded before the hooks are installed.
|
|
257
|
+
- **Shown by `status` and `doctor`**, apart from your rules file and the default, and marked as set by
|
|
258
|
+
your organization's managed settings: `doctor` for Claude Code shows that config dir's packs, and
|
|
259
|
+
`status` lists every config dir's. Their `--json` output has them under `redaction.org`.
|
|
260
|
+
|
|
261
|
+
Packs apply to what the Mainwave hooks send, not to the prompts and tool content Claude Code exports
|
|
262
|
+
through its own OpenTelemetry (see below).
|
|
263
|
+
|
|
264
|
+
**What it doesn't cover.** Claude Code, Codex, Copilot CLI, Copilot Chat, Claude Desktop and Cursor's
|
|
265
|
+
Enterprise export send their own OpenTelemetry directly to your collector, with the CLI not in the
|
|
266
|
+
path, so their content is not redacted by any of these settings. When you record a rules file, setup
|
|
267
|
+
and `doctor` say so for each such tool you have configured with content capture on. Run
|
|
268
|
+
`setup --opt-in none` to stop those tools sending prompt text, tool details and tool content. Copilot
|
|
269
|
+
CLI and Cursor's Enterprise export have no such switch in what setup writes (the latter is set in
|
|
270
|
+
Cursor's dashboard), so the notice stays for them.
|
|
271
|
+
|
|
272
|
+
**Known limitations.** Hook copies installed by an older release send spans unredacted until you
|
|
273
|
+
re-run setup, which refreshes every hook copy on the machine; `status` and `doctor` report such a
|
|
274
|
+
copy as a warning while only the default is on, and as an error, with `doctor` exiting non-zero, once
|
|
275
|
+
you have recorded a rules file. If an old script in `~/.mainwave/hooks/` imports something this
|
|
276
|
+
release no longer provides, setup leaves that directory as it is and names the scripts; `status` and
|
|
277
|
+
`doctor` name them too. Remove those scripts, then re-run setup. `setup --json` reports what the
|
|
278
|
+
refresh did under `redaction.hookCopies`. When your organization's packs are recorded, `install-hooks` refreshes
|
|
279
|
+
Cursor and Kiro hook copies that predate organization packs, the same way.
|
|
280
|
+
|
|
137
281
|
## Proving it works
|
|
138
282
|
|
|
139
283
|
```bash
|
|
140
284
|
mainwave-cli verify # push a sample trace, wait for it to land, print the link
|
|
141
285
|
mainwave-cli verify --json
|
|
142
286
|
mainwave-cli verify --no-sample # with a pinned use case: just watch for its spans, send nothing
|
|
287
|
+
mainwave-cli verify --timeout 120 # wait up to 120 seconds for it to land (default 60)
|
|
143
288
|
```
|
|
144
289
|
|
|
145
290
|
With a use case pinned — `--ucid` here, or one a `setup --ucid` / `--use-case` run pinned that one
|
|
@@ -163,18 +308,21 @@ mainwave-cli setup claude-code codex \
|
|
|
163
308
|
--opt-in none --no-markers --yes --json
|
|
164
309
|
```
|
|
165
310
|
|
|
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
|
-
| `--
|
|
173
|
-
| `--
|
|
174
|
-
| `--
|
|
175
|
-
| `--
|
|
176
|
-
| `--no-
|
|
177
|
-
| `--
|
|
311
|
+
| Flag | Answers |
|
|
312
|
+
| --------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- |
|
|
313
|
+
| `--api-key <k>` | the collector key (otherwise minted for you when signed in) |
|
|
314
|
+
| `--collector-url <u>` / `--api-url <u>` | which deployment |
|
|
315
|
+
| `--ucid <id\|url>` / `--use-case <name>` / `--no-use-case` | pin one use case, or `--no-use-case` to unpin (default: none) |
|
|
316
|
+
| `--email <e>` | attribution identity for tools that need it injected |
|
|
317
|
+
| `--invite <token>` | redeem a developer invite instead of signing in (see [Setting up from an invite](#setting-up-from-an-invite)) |
|
|
318
|
+
| `--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) |
|
|
319
|
+
| `--no-markers` | skip the Mainwave hooks (installed by default): ticket, PR & commit markers, the Claude plan snapshot |
|
|
320
|
+
| `--redaction-file <path>` / `--no-redaction` | redact the hooks' spans with a rules file, or remove it (see [Redacting sensitive data](#redacting-sensitive-data)) |
|
|
321
|
+
| `--no-redact-secrets` / `--redact-secrets` | stop stripping credentials from the hooks' spans, or restore the default |
|
|
322
|
+
| `--new-key` | mint a fresh machine key instead of reusing this machine's |
|
|
323
|
+
| `--yes` | write without the confirmation prompt |
|
|
324
|
+
| `--no-verify` / `--verify-timeout <s>` | the closing first-span check |
|
|
325
|
+
| `--skills` / `--no-skills` | the agent skills payload |
|
|
178
326
|
|
|
179
327
|
Without a terminal the CLI never prompts: it answers from flags and environment, or fails naming the
|
|
180
328
|
flag it needed. `status` and `doctor` also take `--json`.
|
|
@@ -296,6 +444,34 @@ an earlier version copied into `~/.mainwave/hooks/` once nothing runs them. To d
|
|
|
296
444
|
the plan snapshot included, re-run setup with `--no-markers` — the entries are removed cleanly. `doctor` checks that the entry is installed, that it names an installed release with every
|
|
297
445
|
script, and that every Mainwave hook group is in the background and narrowed by its matcher.
|
|
298
446
|
|
|
447
|
+
Codex gets the same session-start hook in `~/.codex/hooks.json`, with `--host codex` added to the
|
|
448
|
+
command (on Windows, where Codex runs hooks through `cmd.exe`, an equivalent `cmd` command). It
|
|
449
|
+
installs the latest release's scripts and adds any hook that setup told you about and the file
|
|
450
|
+
lacks. It never edits or removes a hook already in the file, because Codex trusts each hook by a
|
|
451
|
+
hash of its definition and skips a changed hook until you approve it again in `/hooks`. Codex also
|
|
452
|
+
skips a hook it hasn't seen, so approve each new Mainwave hook there after setup. Hooks an earlier
|
|
453
|
+
CLI version wrote keep their 5-second timeout until you re-run setup; `doctor` reports them, and a
|
|
454
|
+
hooks file without the session-start hook, as warnings.
|
|
455
|
+
|
|
456
|
+
Codex also gets hooks that record when each turn starts and ends, so Developer Work can show Codex
|
|
457
|
+
turns and the time split between working, waiting for your approval and away: on a prompt, a stop
|
|
458
|
+
or interrupt, a permission request, a subagent starting or stopping, a tool call, a model request
|
|
459
|
+
and a session start. They send one span per turn, per approval wait and per subagent run, when it
|
|
460
|
+
ends: the session, turn and subagent ids, the subagent's type, the working directory, the name of the
|
|
461
|
+
tool waiting for your approval, and the start and end times. They never send your prompt, Codex's
|
|
462
|
+
reply, a tool's input or output, or the transcript path. They run in the background, except the
|
|
463
|
+
stop and interrupt hooks: Codex waits for those at the end of each turn while they send it (1.2 s at
|
|
464
|
+
most for the send, 1 s for an interrupt), because `codex exec` exits without waiting for a background hook. They keep a
|
|
465
|
+
small state file per session in `~/.mainwave/state/codex-turns/`, deleted after seven days.
|
|
466
|
+
|
|
467
|
+
Codex runs a hook only after you trust it. The first Codex session after setup shows "Hooks need
|
|
468
|
+
review": choose "Trust all", or open `/hooks` and trust each Mainwave hook, the session-start hook
|
|
469
|
+
included. Until then no Mainwave hook runs in Codex, and `codex exec` skips them unless it is run
|
|
470
|
+
with `--dangerously-bypass-hook-trust`. Codex checks each hook's definition against what you
|
|
471
|
+
approved, so it asks again after any change to a Mainwave hook, such as a setup run that adds a
|
|
472
|
+
route or a release that changes a command. Setup says all of this when it finishes, and `doctor`
|
|
473
|
+
lists the Mainwave hooks Codex is skipping, read from the trust records in `~/.codex/config.toml`.
|
|
474
|
+
|
|
299
475
|
On Windows, the Claude Code hooks need Git for Windows. Claude Code runs hook commands through Git
|
|
300
476
|
Bash, and through PowerShell when it finds none, where the entry's shell command can't run. Without
|
|
301
477
|
Git Bash, setup installs no Claude Code hooks and says why, and `doctor` reports it as an error;
|
|
@@ -324,7 +500,8 @@ both being present. When managed settings deliver the
|
|
|
324
500
|
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
501
|
out any hook your managed settings already run. Your own session-start hook stays: while the
|
|
326
502
|
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
|
|
503
|
+
silent form runs beside it until your admin re-pastes — harmless; so does one whose admin chose
|
|
504
|
+
redaction packs, since the packs make the command differ), and if they stop delivering the
|
|
328
505
|
hooks it puts back the ones setup installed for you. It never edits project settings; `doctor` lists
|
|
329
506
|
every settings file that installs the hooks and warns when two of them would fire for the same
|
|
330
507
|
ticket or PR. The org-wide setup follows how Claude Code 2.1.282 and later apply managed settings;
|
|
@@ -378,6 +555,15 @@ which is right for CI and wrong for a coding agent, where a human is sitting rig
|
|
|
378
555
|
approve. `--device` says so explicitly and forces the browser flow. `--password` and an explicit
|
|
379
556
|
`--email` / `--password` value still win over it.
|
|
380
557
|
|
|
558
|
+
```bash
|
|
559
|
+
mainwave-cli login --force # sign in again although a session is active
|
|
560
|
+
mainwave-cli login --device-timeout 600 # wait up to 600 seconds for the approval (default 300)
|
|
561
|
+
```
|
|
562
|
+
|
|
563
|
+
With a session already active for the deployment, `login` prints who is signed in and exits without
|
|
564
|
+
signing in again; `--force` signs in anyway. The browser flow waits 300 seconds for your approval
|
|
565
|
+
unless `--device-timeout` says otherwise, and never longer than the code shown stays valid.
|
|
566
|
+
|
|
381
567
|
Scripts and CI sign in without a terminal by setting `MAINWAVE_EMAIL` and `MAINWAVE_PASSWORD`,
|
|
382
568
|
which also selects the password path (the `--password` flag picks the _flow_; it never takes the
|
|
383
569
|
password itself — argv lands in shell history and in `ps`). Point the CLI at a non-production
|
|
@@ -395,6 +581,7 @@ mainwave-cli status [<adapter>] # on-disk config for every tool, or
|
|
|
395
581
|
mainwave-cli doctor <adapter> # settings hierarchy + health checks
|
|
396
582
|
mainwave-cli doctor <adapter> --validate # also auth-check against the collector
|
|
397
583
|
mainwave-cli edit <adapter> # open the settings file in $EDITOR
|
|
584
|
+
mainwave-cli edit <adapter> --global # the user-level file, without the picker (--local: this project's)
|
|
398
585
|
mainwave-cli env <adapter> # print shell export lines
|
|
399
586
|
mainwave-cli install-hooks [--quiet] # install or refresh the Mainwave hook entry and the latest release's scripts
|
|
400
587
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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}
|
|
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).',
|
|
@@ -23,29 +23,24 @@ const protocolKey = (block) => `otel.${block}.otlp-http.protocol`;
|
|
|
23
23
|
const headerKey = (block, name) => `otel.${block}.otlp-http.headers.${name}`;
|
|
24
24
|
const MANAGED_ENV_KEYS = [
|
|
25
25
|
'otel.log_user_prompt',
|
|
26
|
-
'otel.log_system_prompt',
|
|
27
|
-
'otel.log_tool_payloads',
|
|
28
|
-
'otel.log_mcp_interactions',
|
|
29
|
-
'otel.log_governance_events',
|
|
30
26
|
...SIGNAL_BLOCKS.flatMap((b) => [
|
|
31
27
|
endpointKey(b),
|
|
32
28
|
protocolKey(b),
|
|
33
29
|
...HEADER_NAMES.map((h) => headerKey(b, h)),
|
|
34
30
|
]),
|
|
35
31
|
];
|
|
32
|
+
const RETIRED_ENV_KEYS = [
|
|
33
|
+
'otel.log_system_prompt',
|
|
34
|
+
'otel.log_tool_payloads',
|
|
35
|
+
'otel.log_mcp_interactions',
|
|
36
|
+
'otel.log_governance_events',
|
|
37
|
+
];
|
|
36
38
|
const stripTrailingSlash = (url) => url.replace(/\/+$/, '');
|
|
37
39
|
const buildEnv = ({ ucid, collectorUrl, apiKey, optIns, userEmail, }) => {
|
|
38
40
|
const base = stripTrailingSlash(collectorUrl);
|
|
39
41
|
const out = {};
|
|
40
|
-
if (optIns.userPrompts)
|
|
42
|
+
if (optIns.userPrompts)
|
|
41
43
|
out['otel.log_user_prompt'] = 'true';
|
|
42
|
-
out['otel.log_system_prompt'] = 'true';
|
|
43
|
-
}
|
|
44
|
-
if (optIns.toolDetails || optIns.toolContent) {
|
|
45
|
-
out['otel.log_tool_payloads'] = 'true';
|
|
46
|
-
out['otel.log_mcp_interactions'] = 'true';
|
|
47
|
-
out['otel.log_governance_events'] = 'true';
|
|
48
|
-
}
|
|
49
44
|
for (const block of SIGNAL_BLOCKS) {
|
|
50
45
|
out[endpointKey(block)] = `${base}${SIGNAL_PATH[block]}`;
|
|
51
46
|
out[protocolKey(block)] = 'binary';
|
|
@@ -98,8 +93,8 @@ const parseEnv = (env) => {
|
|
|
98
93
|
out.userEmail = userEmail;
|
|
99
94
|
out.optIns = {
|
|
100
95
|
userPrompts: env['otel.log_user_prompt'] === 'true',
|
|
101
|
-
toolDetails:
|
|
102
|
-
toolContent:
|
|
96
|
+
toolDetails: true,
|
|
97
|
+
toolContent: true,
|
|
103
98
|
};
|
|
104
99
|
return out;
|
|
105
100
|
};
|
|
@@ -145,7 +140,7 @@ const collectChecks = (env) => {
|
|
|
145
140
|
}
|
|
146
141
|
issues.push({
|
|
147
142
|
level: 'warn',
|
|
148
|
-
message: 'Codex
|
|
143
|
+
message: 'Codex exports tool output in `codex.tool_result.output`, capped at 2,048 bytes by default (`[otel.tool_result] max_bytes`), and has no switch to turn it off. ' +
|
|
149
144
|
'If your workflow runs commands over sensitive files, scrub at the collector or avoid Codex for those flows.',
|
|
150
145
|
});
|
|
151
146
|
return issues;
|
|
@@ -182,6 +177,8 @@ export const codexCli = {
|
|
|
182
177
|
injectsIdentity: true,
|
|
183
178
|
codec: tomlOtelCodec,
|
|
184
179
|
managedEnvKeys: MANAGED_ENV_KEYS,
|
|
180
|
+
retiredEnvKeys: RETIRED_ENV_KEYS,
|
|
181
|
+
alwaysOnOptIns: { toolDetails: true, toolContent: true },
|
|
185
182
|
hierarchy: HIERARCHY,
|
|
186
183
|
buildEnv,
|
|
187
184
|
parseEnv,
|
|
@@ -189,7 +186,10 @@ export const codexCli = {
|
|
|
189
186
|
collectFileChecks,
|
|
190
187
|
normalizeForGenericChecks,
|
|
191
188
|
markers: {
|
|
192
|
-
disclosure: 'Sends Linear/Jira issue ids and GitHub PR / GitLab MR urls to the collector — never ticket bodies or diff content.'
|
|
189
|
+
disclosure: 'Sends Linear/Jira issue ids and GitHub PR / GitLab MR urls to the collector — never ticket bodies or diff content. ' +
|
|
190
|
+
'It also sends, for each Codex turn, the session, turn and subagent ids, the working directory, the name of a tool ' +
|
|
191
|
+
'call waiting for your approval, and when the turn, the wait and the subagent started and ended — ids and ' +
|
|
192
|
+
'timestamps, never prompt or response text.',
|
|
193
193
|
hooksFile: {
|
|
194
194
|
path: join(homedir(), '.codex', 'hooks.json'),
|
|
195
195
|
localPath: join('.codex', 'hooks.json'),
|
package/dist/adapters/cursor.js
CHANGED
|
@@ -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: [
|
|
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',
|
package/dist/adapters/kiro.js
CHANGED
|
@@ -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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
118
|
-
|
|
119
|
-
|
|
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: [
|
|
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'}`,
|