autotel-devtools 27.0.0 → 27.2.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
@@ -176,7 +176,8 @@ process. Point them at the bound port, or free the original.
176
176
  - ✅ Service map visualization
177
177
  - ✅ Resources view (derived from telemetry)
178
178
  - ✅ GenAI run summaries + narrated walkthrough
179
- - ✅ **Agents view**: observe coding agents (Claude Code, opencode) from their OTel metrics + log events
179
+ - ✅ **Agents view**: observe coding agents (Claude Code, opencode), with cost split by model, effort, skill, sub-agent and prompt
180
+ - ✅ **WebMCP tools**: the full-page viewer offers its stored telemetry to an agent driving the page (see below)
180
181
  - ✅ Global time window shared by every tab
181
182
  - ✅ Live tail that freezes while you read, with a "N new" pill to catch up
182
183
  - ✅ Configurable telemetry limits (env vars)
@@ -202,10 +203,11 @@ on top of the per-span detail:
202
203
 
203
204
  ### Agents: observe Claude Code (and other coding agents)
204
205
 
205
- Coding agents like **Claude Code** emit OpenTelemetry **metrics and log events**
206
- (no traces). The **Agents** tab reconstructs them into a session-centric view.
207
- Powered by the [`autotel-agents`](../autotel-agents) package, which also handles
208
- opencode and is one adapter away from Codex.
206
+ Coding agents like **Claude Code** emit OpenTelemetry **metrics and log events**.
207
+ The **Agents** tab reconstructs them into a session-centric view, and splits the
208
+ spend by model, effort, skill, sub-agent and prompt. Powered by the
209
+ [`autotel-agents`](../autotel-agents) package, which also handles opencode and is
210
+ one adapter away from Codex.
209
211
 
210
212
  One command starts the receiver _and_ launches Claude Code wired to it:
211
213
 
@@ -214,9 +216,11 @@ npx autotel-devtools claude
214
216
  ```
215
217
 
216
218
  This sets the telemetry env for a live local view: OTLP **`http/protobuf`**, 1s
217
- export intervals, and `session.id` kept on metrics. The receiver also accepts
218
- standard OTLP/gRPC on `:4317`. Then open the UI
219
- and switch to **Agents**.
219
+ export intervals, and `session.id` kept on metrics. It also turns on Claude
220
+ Code's span hierarchy `claude_code.interaction` `llm_request` / `tool`, with
221
+ the sub-agent tree on `parent_agent_id` — which lands in the **Traces** tab. The
222
+ receiver also accepts standard OTLP/gRPC on `:4317`. Then open the UI and switch
223
+ to **Agents**.
220
224
 
221
225
  - `--print-env`: print the env block instead of launching (for managed-settings
222
226
  / MDM / VS Code), e.g. `npx autotel-devtools claude --print-env`.
@@ -325,6 +329,32 @@ The same store backs `autotel-mcp`'s `devtools` backend, so `autotel diagnose`,
325
329
  autotel diagnose errors --backend devtools --devtools-base-url http://localhost:4318
326
330
  ```
327
331
 
332
+ ### Asking an in-page agent
333
+
334
+ The full-page viewer also registers itself as a set of [WebMCP](https://github.com/webmachinelearning/webmcp)
335
+ tools, so an AI agent driving the browser can read the same telemetry without a
336
+ CLI, an API key or a screenshot. Open the viewer in a browser that supports
337
+ WebMCP and the tools are there:
338
+
339
+ | Tool | Answers |
340
+ | -------------------------- | ----------------------------------------------------------------- |
341
+ | `autotel_query_traces` | Search traces — one row each: name, service, status, duration |
342
+ | `autotel_get_trace` | Every span of one trace, by id |
343
+ | `autotel_list_errors` | What is failing, grouped by fingerprint |
344
+ | `autotel_query_logs` | Search log records, with the trace id when there is one |
345
+ | `autotel_webmcp_inventory` | The page's own WebMCP tool surface, including dropped annotations |
346
+
347
+ They take the [query language](#querying) above, so "show me failing checkouts
348
+ over 500ms" reaches the agent as `status = ERROR name contains checkout duration > 500`.
349
+ Results are projected down to the columns the panel lists and capped per call,
350
+ because a page of full span trees is mostly context the agent pays for and does
351
+ not read.
352
+
353
+ Read-only, and **full-page only**: the embedded widget is a guest in someone
354
+ else's page, where `document.modelContext` belongs to that page. Registered
355
+ against the browser's WebMCP API directly, with no runtime dependency; in a
356
+ browser without WebMCP nothing is registered.
357
+
328
358
  ## Configuration
329
359
 
330
360
  ### Environment Variables
package/dist/cli.cjs CHANGED
@@ -103,12 +103,14 @@ function parseBytes(value) {
103
103
  if (!value) return void 0;
104
104
  const match = value.trim().toLowerCase().match(/^(\d+(?:\.\d+)?)\s*(b|kb|mb|gb)?$/);
105
105
  if (!match) return void 0;
106
- return Math.floor(Number(match[1]) * {
106
+ const factors = {
107
107
  b: 1,
108
108
  kb: 1024,
109
109
  mb: 1024 ** 2,
110
110
  gb: 1024 ** 3
111
- }[match[2] || "b"]);
111
+ };
112
+ const unit = match[2] || "b";
113
+ return Math.floor(Number(match[1]) * factors[unit]);
112
114
  }
113
115
  function parsePort(value) {
114
116
  const n = Number(value);
@@ -174,6 +176,8 @@ async function startReceiver(options) {
174
176
  function buildAgentEnv(uiBase, logPrompts) {
175
177
  const env = {
176
178
  CLAUDE_CODE_ENABLE_TELEMETRY: "1",
179
+ CLAUDE_CODE_ENHANCED_TELEMETRY_BETA: "1",
180
+ OTEL_TRACES_EXPORTER: "otlp",
177
181
  OTEL_METRICS_EXPORTER: "otlp",
178
182
  OTEL_LOGS_EXPORTER: "otlp",
179
183
  OTEL_EXPORTER_OTLP_PROTOCOL: "http/protobuf",
@@ -182,8 +186,10 @@ function buildAgentEnv(uiBase, logPrompts) {
182
186
  OTEL_LOGS_EXPORT_INTERVAL: "1000",
183
187
  OTEL_METRICS_INCLUDE_SESSION_ID: "true"
184
188
  };
185
- if (logPrompts) env.OTEL_LOG_USER_PROMPTS = "1";
186
- return env;
189
+ return logPrompts ? {
190
+ ...env,
191
+ OTEL_LOG_USER_PROMPTS: "1"
192
+ } : env;
187
193
  }
188
194
  function printEnvBlock(env) {
189
195
  for (const [key, value] of Object.entries(env)) process.stdout.write(`export ${key}=${value}\n`);
package/dist/cli.js CHANGED
@@ -103,12 +103,14 @@ function parseBytes(value) {
103
103
  if (!value) return void 0;
104
104
  const match = value.trim().toLowerCase().match(/^(\d+(?:\.\d+)?)\s*(b|kb|mb|gb)?$/);
105
105
  if (!match) return void 0;
106
- return Math.floor(Number(match[1]) * {
106
+ const factors = {
107
107
  b: 1,
108
108
  kb: 1024,
109
109
  mb: 1024 ** 2,
110
110
  gb: 1024 ** 3
111
- }[match[2] || "b"]);
111
+ };
112
+ const unit = match[2] || "b";
113
+ return Math.floor(Number(match[1]) * factors[unit]);
112
114
  }
113
115
  function parsePort(value) {
114
116
  const n = Number(value);
@@ -174,6 +176,8 @@ async function startReceiver(options) {
174
176
  function buildAgentEnv(uiBase, logPrompts) {
175
177
  const env = {
176
178
  CLAUDE_CODE_ENABLE_TELEMETRY: "1",
179
+ CLAUDE_CODE_ENHANCED_TELEMETRY_BETA: "1",
180
+ OTEL_TRACES_EXPORTER: "otlp",
177
181
  OTEL_METRICS_EXPORTER: "otlp",
178
182
  OTEL_LOGS_EXPORTER: "otlp",
179
183
  OTEL_EXPORTER_OTLP_PROTOCOL: "http/protobuf",
@@ -182,8 +186,10 @@ function buildAgentEnv(uiBase, logPrompts) {
182
186
  OTEL_LOGS_EXPORT_INTERVAL: "1000",
183
187
  OTEL_METRICS_INCLUDE_SESSION_ID: "true"
184
188
  };
185
- if (logPrompts) env.OTEL_LOG_USER_PROMPTS = "1";
186
- return env;
189
+ return logPrompts ? {
190
+ ...env,
191
+ OTEL_LOG_USER_PROMPTS: "1"
192
+ } : env;
187
193
  }
188
194
  function printEnvBlock(env) {
189
195
  for (const [key, value] of Object.entries(env)) process.stdout.write(`export ${key}=${value}\n`);